From 703c0a1812fbe6ef449d553284ce1ae1153b9cd1 Mon Sep 17 00:00:00 2001 From: loothero <100039621+loothero@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:20:12 -0500 Subject: [PATCH] only reset idle counter on beast defeat (#552) * on v1.0.0 the idle counter is reset on every attack * adventurers can exploit this during certain battles to significantly prolong the duration of the battle which weakens the protection provided by the idle death penalty and global entropy sub-systems --- contracts/game/src/lib.cairo | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/game/src/lib.cairo b/contracts/game/src/lib.cairo index 9ccdf53e0..203fb87e5 100644 --- a/contracts/game/src/lib.cairo +++ b/contracts/game/src/lib.cairo @@ -331,9 +331,6 @@ mod Game { @self, immutable_adventurer, adventurer_id, game_entropy ); - // update players last action block - adventurer.set_last_action_block(block_number); - // process attack or apply idle penalty if !idle { // get weapon specials @@ -1099,6 +1096,9 @@ mod Game { // zero out beast health adventurer.beast_health = 0; + // update players last action block + adventurer.set_last_action_block(starknet::get_block_info().unbox().block_number); + // get gold reward and increase adventurers gold let gold_earned = beast.get_gold_reward(beast_seed); let ring_bonus = adventurer.ring.jewelry_gold_bonus(gold_earned);