Skip to content

Commit

Permalink
fix: Bully damage intents now shown in predictions
Browse files Browse the repository at this point in the history
  • Loading branch information
db0 committed May 24, 2022
1 parent b796bcf commit 3c7fabc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/dreamscape/CombatElements/Enemies/Elites/BullyIntents.gd
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ func _get_elite_scripts(intent_name: String) -> Array:
"icon": preload("res://assets/icons/alien-egg.png"),
"description": "What's the matter, gonna cry?",
"torment_special": "Call Buddy",
"predict_as": true
"predict_as": true,
"add_to_dreamer_damage_prediction": true,
},
],
"Gather Crowd": [
Expand All @@ -157,7 +158,8 @@ func _get_elite_scripts(intent_name: String) -> Array:
"icon": preload("res://assets/icons/alien-egg.png"),
"description": "You're never gonna have any friends here...",
"torment_special": "Gather Crowd",
"predict_as": true
"predict_as": true,
"add_to_dreamer_damage_prediction": true,
},
{
"name": "torment_special",
Expand All @@ -167,7 +169,8 @@ func _get_elite_scripts(intent_name: String) -> Array:
"icon": preload("res://assets/icons/alien-egg.png"),
"description": "...am I right, everyone?",
"torment_special": "Gather Crowd",
"predict_as": true
"predict_as": true,
"add_to_dreamer_damage_prediction": true,
},
],
}
Expand Down
3 changes: 2 additions & 1 deletion src/dreamscape/CombatElements/Enemies/EnemyIntents.gd
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ func refresh_intents(specific_index = null) -> void:
intent.queue_free()
# warning-ignore:return_value_discarded
prepare_intents(specific_index)
cfc.flush_cache()

# We have this externally to allow to override it if needed (e.g. for boss intents)
func _get_intent_scripts(_intent_name: String) -> Array:
Expand All @@ -247,6 +246,7 @@ func _display_intents(new_intents: Dictionary) -> void:
for intent in get_children():
intent.queue_free()
intents_displayed = false
# To allow previous intents to queue_freed
yield(get_tree().create_timer(0.01), "timeout")
for intent in new_intents.intent_scripts:
# Some intents can use a generic format of "Intent Name: Value"
Expand Down Expand Up @@ -292,6 +292,7 @@ func _display_intents(new_intents: Dictionary) -> void:
add_child(new_intent)
new_intent.setup(single_intent, intent_name)
intents_displayed = true
cfc.flush_cache()
emit_signal("intents_displayed")


Expand Down
2 changes: 2 additions & 0 deletions src/dreamscape/Globals/Globals.gd
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,5 @@ func clear_state_snapshot(snapshot_id) -> void:
"CombatEntities",
"clear_snapshot",
snapshot_id)
cfc.NMAP.board.snapshot_dmg_predictions.clear()
cfc.NMAP.board.snapshot_lost_defence_predictions.clear()
5 changes: 5 additions & 0 deletions src/dreamscape/ScriptingEngine/ScriptingEngine.gd
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,12 @@ func predict_intent_amount(_snapshot_id: float) -> int:
total_amount += amount
# If there's multiple targets, we calculate the amount only for a single of them
break
var add_to_dreamer_damage_prediction := false
if script.script_name == "modify_damage" and script.get_property(SP.KEY_SUBJECT) == "dreamer":
add_to_dreamer_damage_prediction = true
if script.get_property("add_to_dreamer_damage_prediction", false):
add_to_dreamer_damage_prediction = true
if add_to_dreamer_damage_prediction:
if not cfc.NMAP.board.snapshot_dmg_predictions.has(snapshot_id):
cfc.NMAP.board.snapshot_dmg_predictions[snapshot_id] = 0
if not cfc.NMAP.board.snapshot_lost_defence_predictions.has(snapshot_id):
Expand Down

0 comments on commit 3c7fabc

Please sign in to comment.