diff --git a/godot/scenes/Tim.gd b/godot/scenes/Tim.gd index 9d9a2b7..34e673d 100644 --- a/godot/scenes/Tim.gd +++ b/godot/scenes/Tim.gd @@ -96,12 +96,19 @@ func _on_stamina_empty(): func ouch(): $Sprite2D.texture = ducking_texture + var bottle_joke = Joke.get_bottle_joke() _start_joke_for_audience() + stamina -= bottle_joke.required_stamina + await get_tree().create_timer(1).timeout + $Sprite2D.texture = default_texture - _tell_joke_for_audience(Joke.get_bottle_joke(), true) + _tell_joke_for_audience(bottle_joke, true) _finish_joke_for_audience() + if stamina <= 0: + _on_stamina_empty() + func _on_animation_player_animation_finished(anim_name): _tell_joke_for_audience(last_joke, false) _finish_joke_for_audience() diff --git a/godot/types/joke.gd b/godot/types/joke.gd index a21590e..2103375 100644 --- a/godot/types/joke.gd +++ b/godot/types/joke.gd @@ -19,7 +19,7 @@ var required_stamina: int var effectiveness: float static func get_bottle_joke(): - return Joke.new(JokeType.Bottle, 0, 1) + return Joke.new(JokeType.Bottle, 5, 1) static func get_random_joke(type): var stamina = STAMINA_CATEGORIES[randi_range(0, STAMINA_CATEGORIES.size() - 1)]