Skip to content

Commit

Permalink
only reset idle counter on beast defeat (#552)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
loothero authored Feb 24, 2024
1 parent 1f1909d commit 703c0a1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions contracts/game/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 703c0a1

Please sign in to comment.