diff --git a/contracts/adventurer/src/adventurer.cairo b/contracts/adventurer/src/adventurer.cairo index 66e24f710..d0772cf89 100644 --- a/contracts/adventurer/src/adventurer.cairo +++ b/contracts/adventurer/src/adventurer.cairo @@ -13,15 +13,16 @@ use super::{ adventurer_constants::{ STARTING_GOLD, StatisticIndex, POTION_PRICE, STARTING_HEALTH, CHARISMA_POTION_DISCOUNT, MINIMUM_ITEM_PRICE, MINIMUM_POTION_PRICE, HEALTH_INCREASE_PER_VITALITY, MAX_GOLD, - MAX_STAT_VALUE, MAX_STAT_UPGRADES, MAX_XP, MAX_ADVENTURER_BLOCKS, ITEM_MAX_GREATNESS, - ITEM_MAX_XP, MAX_ADVENTURER_HEALTH, CHARISMA_ITEM_DISCOUNT, ClassStatBoosts, + MAX_STAT_VALUE, MAX_STAT_UPGRADE_POINTS, MAX_XP, MAX_ADVENTURER_BLOCKS, + ITEM_MAX_GREATNESS, ITEM_MAX_XP, MAX_ADVENTURER_HEALTH, CHARISMA_ITEM_DISCOUNT, MAX_BLOCK_COUNT, STAT_UPGRADE_POINTS_PER_LEVEL, NECKLACE_G20_BONUS_STATS, SILVER_RING_G20_LUCK_BONUS, BEAST_SPECIAL_NAME_LEVEL_UNLOCK, U128_MAX, JEWELRY_BONUS_BEAST_GOLD_PERCENT, JEWELRY_BONUS_CRITICAL_HIT_PERCENT_PER_GREATNESS, JEWELRY_BONUS_NAME_MATCH_PERCENT_PER_GREATNESS, NECKLACE_ARMOR_BONUS, MINIMUM_DAMAGE_FROM_BEASTS, OBSTACLE_CRITICAL_HIT_CHANCE, BEAST_CRITICAL_HIT_CHANCE, SILVER_RING_LUCK_BONUS_PER_GREATNESS, MINIMUM_DAMAGE_FROM_OBSTACLES, - MINIMUM_DAMAGE_TO_BEASTS, MAX_ACTIONS_PER_BLOCK + MINIMUM_DAMAGE_TO_BEASTS, MAX_ACTIONS_PER_BLOCK, MAX_PACKABLE_ITEM_XP, + MAX_PACKABLE_BEAST_HEALTH, MAX_LAST_ACTION_BLOCK }, discovery_constants::DiscoveryEnums::{ExploreResult, DiscoveryType} } @@ -60,6 +61,8 @@ struct Adventurer { impl AdventurerPacking of StorePacking { fn pack(value: Adventurer) -> felt252 { + value.prepack_overflow_assertions(); + (value.last_action_block.into() + value.health.into() * TWO_POW_9 + value.xp.into() * TWO_POW_18 @@ -501,7 +504,7 @@ impl ImplAdventurer of IAdventurer { } // @notice Grants stat upgrades to the Adventurer. - // @dev The function will add the specified value to the stat_points_available up to the maximum limit of MAX_STAT_UPGRADES. + // @dev The function will add the specified value to the stat_points_available up to the maximum limit of MAX_STAT_UPGRADE_POINTS. // @param value The amount of stat points to be added to the Adventurer. #[inline(always)] fn increase_stat_points_available(ref self: Adventurer, amount: u8) { @@ -509,17 +512,17 @@ impl ImplAdventurer of IAdventurer { if (u8_overflowing_add(self.stat_points_available, amount).is_ok()) { // if overflow is ok // check if added amount is less than or equal to max upgrade points - if (self.stat_points_available + amount <= MAX_STAT_UPGRADES) { + if (self.stat_points_available + amount <= MAX_STAT_UPGRADE_POINTS) { // if it is, add upgrade points to adventurer and return self.stat_points_available += amount; return; } } - // fall through is to return MAX_STAT_UPGRADES + // fall through is to return MAX_STAT_UPGRADE_POINTS // this will happen either in a u8 overflow case // or if the upgrade points being added exceeds max upgrade points - self.stat_points_available = MAX_STAT_UPGRADES + self.stat_points_available = MAX_STAT_UPGRADE_POINTS } // @notice Increase the Adventurer's strength stat. @@ -1707,6 +1710,31 @@ impl ImplAdventurer of IAdventurer { fn reset_actions_per_block(ref self: Adventurer) { self.actions_per_block = 1; } + + #[inline(always)] + fn prepack_overflow_assertions(self: Adventurer) { + assert(self.health <= MAX_ADVENTURER_HEALTH, 'health overflow'); + assert(self.xp <= MAX_XP, 'xp overflow'); + assert(self.gold <= MAX_GOLD, 'gold overflow'); + assert(self.stats.strength <= MAX_STAT_VALUE, 'strength overflow'); + assert(self.stats.dexterity <= MAX_STAT_VALUE, 'dexterity overflow'); + assert(self.stats.vitality <= MAX_STAT_VALUE, 'vitality overflow'); + assert(self.stats.charisma <= MAX_STAT_VALUE, 'charisma overflow'); + assert(self.stats.intelligence <= MAX_STAT_VALUE, 'intelligence overflow'); + assert(self.stats.wisdom <= MAX_STAT_VALUE, 'wisdom overflow'); + assert(self.weapon.xp <= MAX_PACKABLE_ITEM_XP, 'weapon xp overflow'); + assert(self.chest.xp <= MAX_PACKABLE_ITEM_XP, 'chest xp overflow'); + assert(self.head.xp <= MAX_PACKABLE_ITEM_XP, 'head xp overflow'); + assert(self.waist.xp <= MAX_PACKABLE_ITEM_XP, 'waist xp overflow'); + assert(self.foot.xp <= MAX_PACKABLE_ITEM_XP, 'foot xp overflow'); + assert(self.hand.xp <= MAX_PACKABLE_ITEM_XP, 'hand xp overflow'); + assert(self.neck.xp <= MAX_PACKABLE_ITEM_XP, 'neck xp overflow'); + assert(self.ring.xp <= MAX_PACKABLE_ITEM_XP, 'ring xp overflow'); + assert(self.beast_health <= MAX_PACKABLE_BEAST_HEALTH, 'beast health overflow'); + assert(self.stat_points_available <= MAX_STAT_UPGRADE_POINTS, 'stat points avail overflow'); + assert(self.last_action_block <= MAX_LAST_ACTION_BLOCK, 'last action block overflow'); + assert(self.actions_per_block <= MAX_ACTIONS_PER_BLOCK, 'actions per block overflow'); + } } const TWO_POW_3: u256 = 0x8; @@ -1753,11 +1781,12 @@ mod tests { adventurer_constants::{ STARTING_GOLD, StatisticIndex, POTION_PRICE, STARTING_HEALTH, CHARISMA_POTION_DISCOUNT, MINIMUM_ITEM_PRICE, MINIMUM_POTION_PRICE, - HEALTH_INCREASE_PER_VITALITY, MAX_GOLD, MAX_STAT_VALUE, MAX_STAT_UPGRADES, MAX_XP, - MAX_ADVENTURER_BLOCKS, ITEM_MAX_GREATNESS, ITEM_MAX_XP, MAX_ADVENTURER_HEALTH, - CHARISMA_ITEM_DISCOUNT, ClassStatBoosts, MAX_BLOCK_COUNT, + HEALTH_INCREASE_PER_VITALITY, MAX_GOLD, MAX_STAT_VALUE, MAX_STAT_UPGRADE_POINTS, + MAX_XP, MAX_ADVENTURER_BLOCKS, ITEM_MAX_GREATNESS, ITEM_MAX_XP, + MAX_ADVENTURER_HEALTH, CHARISMA_ITEM_DISCOUNT, MAX_BLOCK_COUNT, SILVER_RING_G20_LUCK_BONUS, JEWELRY_BONUS_NAME_MATCH_PERCENT_PER_GREATNESS, - NECKLACE_ARMOR_BONUS, SILVER_RING_LUCK_BONUS_PER_GREATNESS + NECKLACE_ARMOR_BONUS, SILVER_RING_LUCK_BONUS_PER_GREATNESS, MAX_ACTIONS_PER_BLOCK, + MAX_PACKABLE_ITEM_XP, MAX_PACKABLE_BEAST_HEALTH, MAX_LAST_ACTION_BLOCK }, discovery_constants::DiscoveryEnums::{ExploreResult, DiscoveryType} } @@ -2832,6 +2861,186 @@ mod tests { ); } + #[test] + #[should_panic(expected: ('health overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_health() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.health = MAX_ADVENTURER_HEALTH + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('gold overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_gold() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.gold = MAX_GOLD + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('xp overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_xp() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.xp = MAX_XP + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('strength overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_strength() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.stats.strength = MAX_STAT_VALUE + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('dexterity overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_dexterity() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.stats.dexterity = MAX_STAT_VALUE + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('vitality overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_vitality() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.stats.vitality = MAX_STAT_VALUE + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('intelligence overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_intelligence() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.stats.intelligence = MAX_STAT_VALUE + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('wisdom overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_wisdom() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.stats.wisdom = MAX_STAT_VALUE + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('weapon xp overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_weapon_xp() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.weapon.xp = MAX_PACKABLE_ITEM_XP + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('chest xp overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_chest_xp() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.chest.xp = MAX_PACKABLE_ITEM_XP + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('head xp overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_head_xp() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.head.xp = MAX_PACKABLE_ITEM_XP + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('waist xp overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_waist_xp() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.waist.xp = MAX_PACKABLE_ITEM_XP + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('foot xp overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_foot_xp() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.foot.xp = MAX_PACKABLE_ITEM_XP + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('hand xp overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_hand_xp() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.hand.xp = MAX_PACKABLE_ITEM_XP + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('neck xp overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_neck_xp() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.neck.xp = MAX_PACKABLE_ITEM_XP + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('ring xp overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_ring_xp() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.ring.xp = MAX_PACKABLE_ITEM_XP + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('beast health overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_beast_health() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.beast_health = MAX_PACKABLE_BEAST_HEALTH + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('stat points avail overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_stat_points_available() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.stat_points_available = MAX_STAT_UPGRADE_POINTS + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('actions per block overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_actions_per_block() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.actions_per_block = MAX_ACTIONS_PER_BLOCK + 1; + AdventurerPacking::pack(adventurer); + } + + #[test] + #[should_panic(expected: ('last action block overflow',))] + #[available_gas(3000000)] + fn test_pack_protection_overflow_last_action_block() { + let mut adventurer = ImplAdventurer::new(12, 0, 0, 0); + adventurer.last_action_block = MAX_LAST_ACTION_BLOCK + 1; + AdventurerPacking::pack(adventurer); + } + #[test] #[available_gas(2000000)] fn test_new_adventurer() { @@ -2976,19 +3185,24 @@ mod tests { ); // max stat upgrade value case - adventurer.increase_stat_points_available(MAX_STAT_UPGRADES); - assert(adventurer.stat_points_available == MAX_STAT_UPGRADES, 'stat points should be max'); + adventurer.increase_stat_points_available(MAX_STAT_UPGRADE_POINTS); + assert( + adventurer.stat_points_available == MAX_STAT_UPGRADE_POINTS, 'stat points should be max' + ); // pack and unpack at max value to ensure our max values are correct for packing let unpacked: Adventurer = AdventurerPacking::unpack(AdventurerPacking::pack(adventurer)); assert( - unpacked.stat_points_available == MAX_STAT_UPGRADES, 'stat point should still be max' + unpacked.stat_points_available == MAX_STAT_UPGRADE_POINTS, + 'stat point should still be max' ); // extreme/overflow case adventurer.stat_points_available = 255; adventurer.increase_stat_points_available(255); - assert(adventurer.stat_points_available == MAX_STAT_UPGRADES, 'stat points should be max'); + assert( + adventurer.stat_points_available == MAX_STAT_UPGRADE_POINTS, 'stat points should be max' + ); } #[test] diff --git a/contracts/adventurer/src/adventurer_utils.cairo b/contracts/adventurer/src/adventurer_utils.cairo index 9d7a06ec3..01566e415 100644 --- a/contracts/adventurer/src/adventurer_utils.cairo +++ b/contracts/adventurer/src/adventurer_utils.cairo @@ -9,8 +9,8 @@ use core::{ use super::{ constants::{ adventurer_constants::{ - MAX_STAT_VALUE, U128_MAX, ClassStatBoosts, STARTING_HEALTH, - HEALTH_INCREASE_PER_VITALITY, MAX_ADVENTURER_HEALTH + MAX_STAT_VALUE, U128_MAX, STARTING_HEALTH, HEALTH_INCREASE_PER_VITALITY, + MAX_ADVENTURER_HEALTH }, discovery_constants::DiscoveryEnums::{ExploreResult, DiscoveryType} }, @@ -317,8 +317,8 @@ mod tests { use survivor::{ constants::{ adventurer_constants::{ - MAX_STAT_VALUE, U128_MAX, ClassStatBoosts, STARTING_HEALTH, - HEALTH_INCREASE_PER_VITALITY, MAX_ADVENTURER_HEALTH + MAX_STAT_VALUE, U128_MAX, STARTING_HEALTH, HEALTH_INCREASE_PER_VITALITY, + MAX_ADVENTURER_HEALTH }, discovery_constants::DiscoveryEnums::{ExploreResult, DiscoveryType} }, diff --git a/contracts/adventurer/src/constants/adventurer_constants.cairo b/contracts/adventurer/src/constants/adventurer_constants.cairo index e27f74461..4687ec510 100644 --- a/contracts/adventurer/src/constants/adventurer_constants.cairo +++ b/contracts/adventurer/src/constants/adventurer_constants.cairo @@ -1,9 +1,19 @@ // Starting Setting const STARTING_GOLD: u16 = 25; -const MAX_GOLD: u16 = 511; // 2^9 - 1 - const STARTING_HEALTH: u16 = 100; -const MAX_ADVENTURER_HEALTH: u16 = 511; // 2^9 - 1 + +// Adventurer Max Values +const MAX_ADVENTURER_HEALTH: u16 = 511; // 9 bits +const MAX_XP: u16 = 8191; // 13 bits +const MAX_STAT_VALUE: u8 = 15; // 4 bits +const MAX_GOLD: u16 = 511; // 9 bits +const MAX_PACKABLE_ITEM_XP: u16 = 511; // 9 bits +const MAX_PACKABLE_BEAST_HEALTH: u16 = 511; // 9 bits +const MAX_STAT_UPGRADE_POINTS: u8 = 7; // 3 bits +const MAX_LAST_ACTION_BLOCK: u16 = 511; // 9 bits +const MAX_ACTIONS_PER_BLOCK: u8 = 15; // 4 bits + +const ITEM_MAX_XP: u16 = 400; // Potion Settings const POTION_PRICE: u16 = 1; @@ -15,7 +25,6 @@ const CHARISMA_POTION_DISCOUNT: u16 = 2; const CHARISMA_ITEM_DISCOUNT: u16 = 1; const MINIMUM_ITEM_PRICE: u16 = 1; const ITEM_MAX_GREATNESS: u8 = 20; -const ITEM_MAX_XP: u16 = 400; const MAX_GREATNESS_STAT_BONUS: u8 = 1; const NECKLACE_G20_BONUS_STATS: u8 = 1; const SILVER_RING_G20_LUCK_BONUS: u8 = 20; @@ -27,8 +36,6 @@ const JEWELRY_BONUS_NAME_MATCH_PERCENT_PER_GREATNESS: u8 = 3; const NECKLACE_ARMOR_BONUS: u8 = 3; // Stat Settings -const MAX_STAT_VALUE: u8 = 31; // 2^5 - 1 -const MAX_STAT_UPGRADES: u8 = 7; // 2^3 - 1 const HEALTH_INCREASE_PER_VITALITY: u8 = 10; const VITALITY_INSTANT_HEALTH_BONUS: u16 = 10; @@ -40,12 +47,10 @@ const BEAST_CRITICAL_HIT_CHANCE: u8 = 10; const OBSTACLE_CRITICAL_HIT_CHANCE: u8 = 10; // Misc Settings -const MAX_XP: u16 = 8191; // 2^13 - 1 const MAX_ADVENTURER_BLOCKS: u16 = 512; // 2^9 const STAT_UPGRADE_POINTS_PER_LEVEL: u8 = 1; const BEAST_SPECIAL_NAME_LEVEL_UNLOCK: u16 = 19; const XP_FOR_DISCOVERIES: u16 = 1; -const MAX_ACTIONS_PER_BLOCK: u8 = 15; // controls how much faster items level up compared to the player const ITEM_XP_MULTIPLIER_BEASTS: u16 = 2; @@ -64,41 +69,6 @@ mod StatisticIndex { const CHARISMA: u8 = 5; } -mod ClassStatBoosts { - mod Cleric { - const STRENGTH: u8 = 0; - const DEXTERITY: u8 = 0; - const VITALITY: u8 = 3; - const INTELLIGENCE: u8 = 0; - const WISDOM: u8 = 0; - const CHARISMA: u8 = 3; - } - mod Scout { - const STRENGTH: u8 = 0; - const DEXTERITY: u8 = 2; - const VITALITY: u8 = 0; - const INTELLIGENCE: u8 = 2; - const WISDOM: u8 = 2; - const CHARISMA: u8 = 0; - } - mod Hunter { - const STRENGTH: u8 = 3; - const DEXTERITY: u8 = 0; - const VITALITY: u8 = 0; - const INTELLIGENCE: u8 = 3; - const WISDOM: u8 = 0; - const CHARISMA: u8 = 0; - } - mod Warrior { - const STRENGTH: u8 = 1; - const DEXTERITY: u8 = 1; - const VITALITY: u8 = 1; - const INTELLIGENCE: u8 = 1; - const WISDOM: u8 = 1; - const CHARISMA: u8 = 1; - } -} - const U128_MAX: u128 = 340282366920938463463374607431768211455; const MAX_U128_PRIME: u128 = 340282366920938463463374607431768211383; @@ -106,4 +76,4 @@ const TWO_POW_8: u128 = 0x100; const TWO_POW_40: u128 = 0x10000000000; const MASK_8: u128 = 0xff; -const MASK_32: u128 = 0xffffffff; \ No newline at end of file +const MASK_32: u128 = 0xffffffff; diff --git a/contracts/game/src/lib.cairo b/contracts/game/src/lib.cairo index 239627dd4..1b1df31a1 100644 --- a/contracts/game/src/lib.cairo +++ b/contracts/game/src/lib.cairo @@ -52,18 +52,20 @@ mod Game { STARTING_GOLD, STARTING_HEALTH, POTION_PRICE, MINIMUM_POTION_PRICE, CHARISMA_POTION_DISCOUNT, CHARISMA_ITEM_DISCOUNT, MINIMUM_ITEM_PRICE, MINIMUM_DAMAGE_TO_BEASTS, MINIMUM_DAMAGE_FROM_OBSTACLES, - OBSTACLE_CRITICAL_HIT_CHANCE, MAX_STAT_UPGRADES + OBSTACLE_CRITICAL_HIT_CHANCE, MAX_STAT_UPGRADE_POINTS } }, item_meta::{ImplItemSpecials, ItemSpecials, IItemSpecials, ItemSpecialsStorage}, adventurer_utils::AdventurerUtils, leaderboard::{Score, Leaderboard}, }; use market::{ - market::{ImplMarket, LootWithPrice, ItemPurchase}, constants::{NUMBER_OF_ITEMS_PER_LEVEL, TIER_PRICE}, + market::{ImplMarket, LootWithPrice, ItemPurchase}, + constants::{NUMBER_OF_ITEMS_PER_LEVEL, TIER_PRICE}, }; use obstacles::obstacle::{ImplObstacle, IObstacle}; use combat::{ - combat::{CombatSpec, SpecialPowers, ImplCombat}, constants::{CombatSettings::STRENGTH_DAMAGE_BONUS, CombatEnums::{Slot, Tier, Type}} + combat::{CombatSpec, SpecialPowers, ImplCombat}, + constants::{CombatSettings::STRENGTH_DAMAGE_BONUS, CombatEnums::{Slot, Tier, Type}} }; use beasts::beast::{Beast, IBeast, ImplBeast}; use game_entropy::game_entropy::{GameEntropy, ImplGameEntropy}; @@ -215,7 +217,12 @@ mod Game { // process explore or apply idle penalty if !idle { _explore( - ref self, ref adventurer, adventurer_id, adventurer_entropy, game_entropy.hash, till_beast + ref self, + ref adventurer, + adventurer_id, + adventurer_entropy, + game_entropy.hash, + till_beast ); } else { _apply_idle_penalty(ref self, adventurer_id, ref adventurer, num_blocks); @@ -982,7 +989,7 @@ mod Game { OBSTACLE_CRITICAL_HIT_CHANCE } fn stat_upgrades_per_level(self: @ContractState) -> u8 { - MAX_STAT_UPGRADES + MAX_STAT_UPGRADE_POINTS } fn beast_special_name_unlock_level(self: @ContractState) -> u16 { BEAST_SPECIAL_NAME_LEVEL_UNLOCK diff --git a/contracts/game/src/tests/test_game.cairo b/contracts/game/src/tests/test_game.cairo index 950eff38d..36823b4e6 100644 --- a/contracts/game/src/tests/test_game.cairo +++ b/contracts/game/src/tests/test_game.cairo @@ -31,8 +31,7 @@ mod tests { use survivor::{ stats::Stats, adventurer_meta::{AdventurerMetadata}, constants::adventurer_constants::{ - STARTING_GOLD, POTION_HEALTH_AMOUNT, POTION_PRICE, STARTING_HEALTH, ClassStatBoosts, - MAX_BLOCK_COUNT + STARTING_GOLD, POTION_HEALTH_AMOUNT, POTION_PRICE, STARTING_HEALTH, MAX_BLOCK_COUNT }, adventurer::{Adventurer, ImplAdventurer, IAdventurer}, item_primitive::ItemPrimitive, bag::{Bag, IBag}, adventurer_utils::AdventurerUtils