diff --git a/godot/scenes/Joke Button.gd b/godot/scenes/Joke Button.gd index c06a19c..e7ac194 100644 --- a/godot/scenes/Joke Button.gd +++ b/godot/scenes/Joke Button.gd @@ -22,7 +22,7 @@ func _map_action_to_joke_type(): return Joke.JokeType.Joke3 func _get_joke(type): - return Joke.new(type, stamina_categories[randi_range(0, stamina_categories.size() - 1)]) + return Joke.get_random_joke(type) func _ready(): stamina_label = find_child("StaminaLabel") diff --git a/godot/scenes/crowd/person.gd b/godot/scenes/crowd/person.gd index 465259a..e975837 100644 --- a/godot/scenes/crowd/person.gd +++ b/godot/scenes/crowd/person.gd @@ -142,7 +142,7 @@ func on_joke_start(): is_listening = true func on_hear_joke(joke: Joke): - var mood_change = profile.joke_mood_mapping.get(joke.type, 0) + var mood_change = profile.joke_mood_mapping.get(joke.type, 0) * joke.effectiveness if joke.type == last_joke_heard: mood_change = min(0, mood_change) update_mood(mood_change) diff --git a/godot/types/joke.gd b/godot/types/joke.gd index 515bc6a..a21590e 100644 --- a/godot/types/joke.gd +++ b/godot/types/joke.gd @@ -7,12 +7,25 @@ enum JokeType { Bottle, } +const EFFECTIVENESS_SCALING: float = 1 +const STAMINA_CATEGORIES: Array[float] = [ + 1, + 5, + 10, +] + var type: JokeType var required_stamina: int +var effectiveness: float static func get_bottle_joke(): - return Joke.new(JokeType.Bottle, 0) + return Joke.new(JokeType.Bottle, 0, 1) -func _init(type, required_stamina): +static func get_random_joke(type): + var stamina = STAMINA_CATEGORIES[randi_range(0, STAMINA_CATEGORIES.size() - 1)] + return Joke.new(type, stamina, stamina * EFFECTIVENESS_SCALING) + +func _init(type, required_stamina, effectiveness): self.type = type self.required_stamina = required_stamina + self.effectiveness = effectiveness