diff --git a/backend/dojo_examples/combat_game/.tool-versions b/backend/dojo_examples/combat_game/.tool-versions index 2ae4f76..faadd70 100644 --- a/backend/dojo_examples/combat_game/.tool-versions +++ b/backend/dojo_examples/combat_game/.tool-versions @@ -1,2 +1,2 @@ -dojo 1.2.1 -scarb 2.9.2 +dojo v1.6.0-alpha.1 +scarb 2.10.1 diff --git a/backend/dojo_examples/combat_game/Scarb.lock b/backend/dojo_examples/combat_game/Scarb.lock index fd7b434..ddb276c 100644 --- a/backend/dojo_examples/combat_game/Scarb.lock +++ b/backend/dojo_examples/combat_game/Scarb.lock @@ -4,7 +4,7 @@ version = 1 [[package]] name = "achievement" version = "0.0.0" -source = "git+https://github.com/cartridge-gg/arcade?tag=v1.2.1#8b8ccea5ec85ae7f903903ced9cd16e16b8e47cb" +source = "git+https://github.com/cartridge-gg/arcade?tag=v1.6.0-alpha.1#0378ed6d9d8188fa6532e66c8db8729a27eb8a5f" dependencies = [ "dojo", ] @@ -20,21 +20,21 @@ dependencies = [ [[package]] name = "dojo" -version = "1.2.1" -source = "git+https://github.com/dojoengine/dojo?tag=v1.2.1#3d4b1a3e662f70679813f9fb65c0b5c7fa5d6f0a" +version = "1.6.0-alpha.0" +source = "git+https://github.com/dojoengine/dojo?tag=v1.6.0-alpha.1#054623bbf939a3bf90786355bd9b081a2b1b3c3a" dependencies = [ "dojo_plugin", ] [[package]] name = "dojo_cairo_test" -version = "1.0.12" -source = "git+https://github.com/dojoengine/dojo?tag=v1.2.1#3d4b1a3e662f70679813f9fb65c0b5c7fa5d6f0a" +version = "1.6.0-alpha.0" +source = "git+https://github.com/dojoengine/dojo?tag=v1.6.0-alpha.1#054623bbf939a3bf90786355bd9b081a2b1b3c3a" dependencies = [ "dojo", ] [[package]] name = "dojo_plugin" -version = "2.9.2" -source = "git+https://github.com/dojoengine/dojo?tag=v1.2.1#3d4b1a3e662f70679813f9fb65c0b5c7fa5d6f0a" +version = "2.10.1" +source = "git+https://github.com/dojoengine/dojo?tag=v1.6.0-alpha.1#054623bbf939a3bf90786355bd9b081a2b1b3c3a" diff --git a/backend/dojo_examples/combat_game/Scarb.toml b/backend/dojo_examples/combat_game/Scarb.toml index 860a7c3..df2095d 100644 --- a/backend/dojo_examples/combat_game/Scarb.toml +++ b/backend/dojo_examples/combat_game/Scarb.toml @@ -1,5 +1,5 @@ [package] -cairo-version = "2.9.2" +cairo-version = "2.10.1" name = "combat_game" version = "0.1.0" edition = "2023_11" @@ -11,8 +11,8 @@ sierra-replace-ids = true sepolia = "sozo --profile sepolia clean && sozo --profile sepolia build && sozo --profile sepolia migrate --account-address $DEPLOYER_ACCOUNT_ADDRESS --private-key $DEPLOYER_PRIVATE_KEY --fee strk" [dependencies] -dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.2.1" } -achievement = { git = "https://github.com/cartridge-gg/arcade", tag = "v1.2.1" } +dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.6.0-alpha.1" } +achievement = { git = "https://github.com/cartridge-gg/arcade", tag = "v1.6.0-alpha.1" } [[target.starknet-contract]] build-external-contracts = [ @@ -22,7 +22,7 @@ build-external-contracts = [ ] [dev-dependencies] -cairo_test = "2.9.2" -dojo_cairo_test = { git = "https://github.com/dojoengine/dojo", tag = "v1.2.1" } +cairo_test = "2.10.1" +dojo_cairo_test = { git = "https://github.com/dojoengine/dojo", tag = "v1.6.0-alpha.1" } [profile.sepolia] \ No newline at end of file diff --git a/backend/dojo_examples/combat_game/src/models/skill.cairo b/backend/dojo_examples/combat_game/src/models/skill.cairo index 69fcbd8..091e30b 100644 --- a/backend/dojo_examples/combat_game/src/models/skill.cairo +++ b/backend/dojo_examples/combat_game/src/models/skill.cairo @@ -67,14 +67,12 @@ pub impl SkillImpl of SkillTrait { #[cfg(test)] mod tests { use super::{ - SkillImpl, SkillType, - SLASH_SKILL_ID, BEAM_SKILL_ID, WAVE_SKILL_ID, PUNCH_SKILL_ID, KICK_SKILL_ID, - BLAST_SKILL_ID, CRUSH_SKILL_ID, PIERCE_SKILL_ID, SMASH_SKILL_ID, BURN_SKILL_ID, - FREEZE_SKILL_ID, SHOCK_SKILL_ID, DEFAULT_SKILL_ID, - SLASH_SKILL_DAMAGE, BEAM_SKILL_DAMAGE, WAVE_SKILL_DAMAGE, PUNCH_SKILL_DAMAGE, - KICK_SKILL_DAMAGE, BLAST_SKILL_DAMAGE, CRUSH_SKILL_DAMAGE, PIERCE_SKILL_DAMAGE, - SMASH_SKILL_DAMAGE, BURN_SKILL_DAMAGE, FREEZE_SKILL_DAMAGE, SHOCK_SKILL_DAMAGE, - DEFAULT_SKILL_DAMAGE, + SkillImpl, SkillType, SLASH_SKILL_ID, BEAM_SKILL_ID, WAVE_SKILL_ID, PUNCH_SKILL_ID, + KICK_SKILL_ID, BLAST_SKILL_ID, CRUSH_SKILL_ID, PIERCE_SKILL_ID, SMASH_SKILL_ID, + BURN_SKILL_ID, FREEZE_SKILL_ID, SHOCK_SKILL_ID, DEFAULT_SKILL_ID, SLASH_SKILL_DAMAGE, + BEAM_SKILL_DAMAGE, WAVE_SKILL_DAMAGE, PUNCH_SKILL_DAMAGE, KICK_SKILL_DAMAGE, + BLAST_SKILL_DAMAGE, CRUSH_SKILL_DAMAGE, PIERCE_SKILL_DAMAGE, SMASH_SKILL_DAMAGE, + BURN_SKILL_DAMAGE, FREEZE_SKILL_DAMAGE, SHOCK_SKILL_DAMAGE, DEFAULT_SKILL_DAMAGE, }; #[test] @@ -248,10 +246,19 @@ mod tests { fn test_all_skill_constants() { // Test that all skill ID constants are unique let skill_ids = array![ - SLASH_SKILL_ID, BEAM_SKILL_ID, WAVE_SKILL_ID, PUNCH_SKILL_ID, - KICK_SKILL_ID, BLAST_SKILL_ID, CRUSH_SKILL_ID, PIERCE_SKILL_ID, - SMASH_SKILL_ID, BURN_SKILL_ID, FREEZE_SKILL_ID, SHOCK_SKILL_ID, - DEFAULT_SKILL_ID + SLASH_SKILL_ID, + BEAM_SKILL_ID, + WAVE_SKILL_ID, + PUNCH_SKILL_ID, + KICK_SKILL_ID, + BLAST_SKILL_ID, + CRUSH_SKILL_ID, + PIERCE_SKILL_ID, + SMASH_SKILL_ID, + BURN_SKILL_ID, + FREEZE_SKILL_ID, + SHOCK_SKILL_ID, + DEFAULT_SKILL_ID, ]; // Test that each ID is within expected range @@ -262,12 +269,18 @@ mod tests { assert!(KICK_SKILL_ID >= 1 && KICK_SKILL_ID <= 13, "Kick skill ID should be in range"); assert!(BLAST_SKILL_ID >= 1 && BLAST_SKILL_ID <= 13, "Blast skill ID should be in range"); assert!(CRUSH_SKILL_ID >= 1 && CRUSH_SKILL_ID <= 13, "Crush skill ID should be in range"); - assert!(PIERCE_SKILL_ID >= 1 && PIERCE_SKILL_ID <= 13, "Pierce skill ID should be in range"); + assert!( + PIERCE_SKILL_ID >= 1 && PIERCE_SKILL_ID <= 13, "Pierce skill ID should be in range", + ); assert!(SMASH_SKILL_ID >= 1 && SMASH_SKILL_ID <= 13, "Smash skill ID should be in range"); assert!(BURN_SKILL_ID >= 1 && BURN_SKILL_ID <= 13, "Burn skill ID should be in range"); - assert!(FREEZE_SKILL_ID >= 1 && FREEZE_SKILL_ID <= 13, "Freeze skill ID should be in range"); + assert!( + FREEZE_SKILL_ID >= 1 && FREEZE_SKILL_ID <= 13, "Freeze skill ID should be in range", + ); assert!(SHOCK_SKILL_ID >= 1 && SHOCK_SKILL_ID <= 13, "Shock skill ID should be in range"); - assert!(DEFAULT_SKILL_ID >= 1 && DEFAULT_SKILL_ID <= 13, "Default skill ID should be in range"); + assert!( + DEFAULT_SKILL_ID >= 1 && DEFAULT_SKILL_ID <= 13, "Default skill ID should be in range", + ); } #[test] @@ -276,7 +289,7 @@ mod tests { // Test that base damage matches what would be set when creating skills let slash_skill = SkillImpl::new(SLASH_SKILL_ID, SLASH_SKILL_DAMAGE, SkillType::Slash, 1); let calculated_damage = SkillImpl::base_damage(SkillType::Slash); - + assert_eq!(slash_skill.power, calculated_damage, "Skill power should match base damage"); } -} \ No newline at end of file +} diff --git a/backend/dojo_examples/combat_game/src/systems/beast.cairo b/backend/dojo_examples/combat_game/src/systems/beast.cairo index 38bb40f..cff9cf7 100644 --- a/backend/dojo_examples/combat_game/src/systems/beast.cairo +++ b/backend/dojo_examples/combat_game/src/systems/beast.cairo @@ -38,7 +38,7 @@ pub mod beast_system { store.init_beast_skills(beast_id); let beast_stats = BeastStatsActionTrait::new_beast_stats( - beast_id, beast_type, beast.level, get_block_timestamp() + beast_id, beast_type, beast.level, get_block_timestamp(), ); store.write_beast_stats(beast_stats); beast_id diff --git a/backend/dojo_examples/combat_game/src/systems/player.cairo b/backend/dojo_examples/combat_game/src/systems/player.cairo index 99ffc41..f8b9010 100644 --- a/backend/dojo_examples/combat_game/src/systems/player.cairo +++ b/backend/dojo_examples/combat_game/src/systems/player.cairo @@ -18,7 +18,7 @@ pub mod player_system { player_counter: u256, } - // Constructor + // Constructor fn dojo_init(ref self: ContractState) { self.player_counter.write(1); } diff --git a/backend/dojo_examples/combat_game/src/types/beast_type.cairo b/backend/dojo_examples/combat_game/src/types/beast_type.cairo index d06f1cd..5e9185f 100644 --- a/backend/dojo_examples/combat_game/src/types/beast_type.cairo +++ b/backend/dojo_examples/combat_game/src/types/beast_type.cairo @@ -35,7 +35,7 @@ pub impl Intou8BeastType of Into { 0 => BeastType::Light, 1 => BeastType::Magic, 2 => BeastType::Shadow, - _ => BeastType::Light, // Default fallback + _ => BeastType::Light // Default fallback } } } @@ -153,4 +153,4 @@ mod tests { let display_string = format!("{}", beast_type); assert_eq!(display_string, "Shadow"); } -} \ No newline at end of file +}