Jokes now have an effectiveness scaling based on stamina
This commit is contained in:
parent
cb9b905227
commit
a55d6f04a0
|
@ -22,7 +22,7 @@ func _map_action_to_joke_type():
|
||||||
return Joke.JokeType.Joke3
|
return Joke.JokeType.Joke3
|
||||||
|
|
||||||
func _get_joke(type):
|
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():
|
func _ready():
|
||||||
stamina_label = find_child("StaminaLabel")
|
stamina_label = find_child("StaminaLabel")
|
||||||
|
|
|
@ -142,7 +142,7 @@ func on_joke_start():
|
||||||
is_listening = true
|
is_listening = true
|
||||||
|
|
||||||
func on_hear_joke(joke: Joke):
|
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:
|
if joke.type == last_joke_heard:
|
||||||
mood_change = min(0, mood_change)
|
mood_change = min(0, mood_change)
|
||||||
update_mood(mood_change)
|
update_mood(mood_change)
|
||||||
|
|
|
@ -7,12 +7,25 @@ enum JokeType {
|
||||||
Bottle,
|
Bottle,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const EFFECTIVENESS_SCALING: float = 1
|
||||||
|
const STAMINA_CATEGORIES: Array[float] = [
|
||||||
|
1,
|
||||||
|
5,
|
||||||
|
10,
|
||||||
|
]
|
||||||
|
|
||||||
var type: JokeType
|
var type: JokeType
|
||||||
var required_stamina: int
|
var required_stamina: int
|
||||||
|
var effectiveness: float
|
||||||
|
|
||||||
static func get_bottle_joke():
|
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.type = type
|
||||||
self.required_stamina = required_stamina
|
self.required_stamina = required_stamina
|
||||||
|
self.effectiveness = effectiveness
|
||||||
|
|
Loading…
Reference in New Issue