Merge branch 'main' of 192.168.8.1:tough_crowd
This commit is contained in:
commit
ba841c2eb2
|
@ -4,8 +4,6 @@ signal button_pressed(joke)
|
|||
|
||||
@export_enum("joke_button_1", "joke_button_2", "joke_button_3") var action: String
|
||||
@export var sprite: Sprite2D
|
||||
|
||||
@export var stamina_categories: Array[int]
|
||||
@export var type_sprites: Array[Texture2D]
|
||||
|
||||
var stamina_label: RichTextLabel
|
||||
|
@ -22,7 +20,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")
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://r1i7ln2hpwq5"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/Joke Button.gd" id="1_lofpb"]
|
||||
[ext_resource type="Texture2D" uid="uid://br2j6yu0f7x37" path="res://sprites/room/bubble_blue.svg" id="2_ivsb5"]
|
||||
[ext_resource type="Texture2D" uid="uid://b2vtyqcfr5ukt" path="res://sprites/room/bubble_green.svg" id="3_26ki8"]
|
||||
[ext_resource type="Texture2D" uid="uid://03ch1nqrnm6c" path="res://sprites/room/bubble_red.svg" id="4_o1r21"]
|
||||
[ext_resource type="Texture2D" uid="uid://huokdqy7birm" path="res://sprites/room/bubble_blue.svg" id="2_ivsb5"]
|
||||
[ext_resource type="Texture2D" uid="uid://bsda544aynmha" path="res://sprites/room/bubble_green.svg" id="3_26ki8"]
|
||||
[ext_resource type="Texture2D" uid="uid://cttngp4bj5fh2" path="res://sprites/room/bubble_red.svg" id="4_o1r21"]
|
||||
|
||||
[node name="Joke Button" type="Node2D" node_paths=PackedStringArray("sprite")]
|
||||
script = ExtResource("1_lofpb")
|
||||
action = "joke_button_1"
|
||||
sprite = NodePath("Sprite2D")
|
||||
stamina_categories = Array[int]([1, 5, 10])
|
||||
type_sprites = Array[Texture2D]([ExtResource("3_26ki8"), ExtResource("2_ivsb5"), ExtResource("4_o1r21")])
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue