fix: preserve refused loot details in HUD
This commit is contained in:
@@ -51,9 +51,15 @@ func test_temporary_rewards_grant_ammunition_and_teach_the_offensive_spell_throu
|
||||
var spell_reward := _reward_with_item(state.floor_state.chests, &"misc_grimoire_ombre")
|
||||
|
||||
game.pending_loot = ranged_reward.duplicate(true)
|
||||
var ammunition_before := state.player.ammunition
|
||||
var awarded_ammunition := int(ranged_reward.get("ammunition", 0))
|
||||
game._take_all_loot()
|
||||
assert_eq(state.player.ammunition, 20)
|
||||
assert_eq(state.player.ammunition, ammunition_before + awarded_ammunition)
|
||||
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)
|
||||
|
||||
game.pending_loot = spell_reward.duplicate(true)
|
||||
game._take_all_loot()
|
||||
|
||||
Reference in New Issue
Block a user