alone management
This commit is contained in:
@@ -5,6 +5,8 @@ class_name MaskedChara
|
||||
@export var face_mask: MaskResource
|
||||
@export var mouth_mask: MaskResource
|
||||
|
||||
const ALONE_TRAIT = preload("uid://c4kpcm4tplsgg")
|
||||
|
||||
var pref_score_map: Dictionary[CharacterResource.Preference, float] = {
|
||||
CharacterResource.Preference.LOVE: 2.0,
|
||||
CharacterResource.Preference.APPROVE: 1.0,
|
||||
@@ -26,10 +28,12 @@ func compute_score(other_guests: Array[MaskedChara]) -> float:
|
||||
var overall_score = 0.0
|
||||
var preferences = character.preferences
|
||||
|
||||
var is_alone = true
|
||||
for guest in other_guests:
|
||||
if guest == null:
|
||||
continue
|
||||
|
||||
|
||||
is_alone = false
|
||||
var guest_mouth_mask = guest.mouth_mask
|
||||
var guest_traits = guest.character.traits
|
||||
|
||||
@@ -47,10 +51,18 @@ func compute_score(other_guests: Array[MaskedChara]) -> float:
|
||||
var preference = character.preferences.get(guest_trait) if guest_trait in character.preferences else CharacterResource.Preference.DONT_CARE
|
||||
var score_multiplier = pref_score_map.get(preference) if preference in pref_score_map else 0.0
|
||||
guest_appreciation += trait_strength*score_multiplier
|
||||
|
||||
print("%s guest appreciation %s" % [character.name, guest_appreciation])
|
||||
|
||||
overall_score += guest_appreciation
|
||||
|
||||
print("%s score: %s" % [character.name, overall_score])
|
||||
if is_alone:
|
||||
var alone_pref = character.preferences.get(ALONE_TRAIT) if ALONE_TRAIT in character.preferences else CharacterResource.Preference.DONT_CARE
|
||||
var alone_score = pref_score_map.get(alone_pref) if alone_pref in pref_score_map else 0.0
|
||||
var alone_strength = 0.0
|
||||
for stimuli in ALONE_TRAIT.stimulis:
|
||||
var strength = stimuli
|
||||
if face_mask != null and stimuli == face_mask.stimuli:
|
||||
strength *= face_mask.stimuli_multiplier
|
||||
alone_strength += strength
|
||||
overall_score = alone_score*alone_strength
|
||||
|
||||
return overall_score
|
||||
|
||||
Reference in New Issue
Block a user