Skip to content

Commit

Permalink
only reset idle counter on beast defeat (#552)
Browse files Browse the repository at this point in the history
* previously this would get reset on every attack
* adventurers can occasionally exploit this is to significantly slow down the game
* this circumvents idle death penalty and global entropy system
  • Loading branch information
loothero committed Feb 24, 2024
1 parent 1f1909d commit 32dbfe1
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 32dbfe1

Please sign in to comment.