fix: align loot feedback with pickup outcomes

This commit is contained in:
goose
2026-10-09 11:25:11 -04:00
parent 8816c31301
commit 78f4744c3f
8 changed files with 88 additions and 13 deletions
@@ -53,13 +53,15 @@ func test_temporary_rewards_grant_ammunition_and_teach_the_offensive_spell_throu
game.pending_loot = ranged_reward.duplicate(true)
var ammunition_before := state.player.ammunition
var awarded_ammunition := int(ranged_reward.get("ammunition", 0))
assert_gt(awarded_ammunition, 0)
assert_eq(awarded_ammunition, 20)
game._take_all_loot()
assert_eq(state.player.ammunition, ammunition_before + awarded_ammunition)
assert_eq(state.player.ammunition, ammunition_before + 20)
assert_true(game.get_run_state().inventory.items.any(func(item: ItemInstance) -> bool: return item.definition.id == &"weapon_hand_crossbow"))
var loot_event := game.get_run_state().recent_events(1)[0]
assert_eq(loot_event.kind, &"loot_taken")
assert_eq(loot_event.payload.ammunition, awarded_ammunition)
assert_string_contains((game.get_node("HUD/EventLog") as RichTextLabel).get_parsed_text(), "%d munitions récupérées" % awarded_ammunition)
assert_eq(loot_event.payload.ammunition, 20)
assert_string_contains((game.get_node("HUD/EventLog") as RichTextLabel).get_parsed_text(), "20 munitions récupérées")
game.pending_loot = spell_reward.duplicate(true)
game._take_all_loot()