Skip to content

Commit

Permalink
add event create level (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpinones authored Nov 1, 2024
1 parent 955b21a commit 4873303
Show file tree
Hide file tree
Showing 8 changed files with 2,276 additions and 423 deletions.
2,586 changes: 2,172 additions & 414 deletions manifests/dev/deployment/manifest.json

Large diffs are not rendered by default.

106 changes: 99 additions & 7 deletions manifests/dev/deployment/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,22 @@ manifest_name = "dojo-base"
[[contracts]]
kind = "DojoContract"
address = "0x6a41badee85305fa1aac33488860360c66b60d7f3b204d6e2cd84071dc3c394"
class_hash = "0x42e0a9b814ff24e92f45d9dd6e764ec9fc948c70b49242249b2cb7d97d62071"
original_class_hash = "0x42e0a9b814ff24e92f45d9dd6e764ec9fc948c70b49242249b2cb7d97d62071"
class_hash = "0x3a4aafb2e4f059bf801527b62432f2671368d33ae29c33b737f3c145e832229"
original_class_hash = "0x3a4aafb2e4f059bf801527b62432f2671368d33ae29c33b737f3c145e832229"
base_class_hash = "0x2427dd10a58850ac9a5ca6ce04b7771b05330fd18f2e481831ad903b969e6b2"
abi = "manifests/dev/deployment/abis/contracts/jokers_of_neon-game_system-7a205bbc.json"
reads = []
writes = ["ns:jokers_of_neon"]
init_calldata = []
tag = "jokers_of_neon-game_system"
systems = [
"select_deck",
"select_special_cards",
"select_modifier_cards",
"create_level",
"play",
"discard",
"end_turn",
"select_deck",
"select_special_cards",
"select_modifier_cards",
"discard_effect_card",
"discard_special_card",
]
Expand Down Expand Up @@ -368,6 +369,73 @@ name = "points"
type = "u32"
key = false

[[models]]
kind = "DojoModel"
class_hash = "0x366273a4ee649b33c07c7584bba0132ac37cc86f52ba525e4ced46a49b960f4"
original_class_hash = "0x366273a4ee649b33c07c7584bba0132ac37cc86f52ba525e4ced46a49b960f4"
abi = "manifests/dev/deployment/abis/models/jokers_of_neon-Challenge-61873cc7.json"
tag = "jokers_of_neon-Challenge"
qualified_path = "jokers_of_neon::models::data::challenge::challenge"
manifest_name = "jokers_of_neon-Challenge-61873cc7"

[[models.members]]
name = "game_id"
type = "u32"
key = true

[[models.members]]
name = "active_ids"
type = "Span<u32>"
key = false

[[models]]
kind = "DojoModel"
class_hash = "0x21c6b6495f7bb89f6e79396f221ce4a47c8eab4f678e55d51248219648a003c"
original_class_hash = "0x21c6b6495f7bb89f6e79396f221ce4a47c8eab4f678e55d51248219648a003c"
abi = "manifests/dev/deployment/abis/models/jokers_of_neon-ChallengeCompleted-510bb1ff.json"
tag = "jokers_of_neon-ChallengeCompleted"
qualified_path = "jokers_of_neon::models::data::events::challenge_completed"
manifest_name = "jokers_of_neon-ChallengeCompleted-510bb1ff"

[[models.members]]
name = "player"
type = "ContractAddress"
key = true

[[models.members]]
name = "player_name"
type = "felt252"
key = false

[[models.members]]
name = "game_id"
type = "u32"
key = false

[[models]]
kind = "DojoModel"
class_hash = "0x60b252cd03fc19cedc1fb08e6295aa77daa96bf9d2ddb405282359f11bee54d"
original_class_hash = "0x60b252cd03fc19cedc1fb08e6295aa77daa96bf9d2ddb405282359f11bee54d"
abi = "manifests/dev/deployment/abis/models/jokers_of_neon-ChallengePlayer-7d4feee6.json"
tag = "jokers_of_neon-ChallengePlayer"
qualified_path = "jokers_of_neon::models::data::challenge::challenge_player"
manifest_name = "jokers_of_neon-ChallengePlayer-7d4feee6"

[[models.members]]
name = "game_id"
type = "u32"
key = true

[[models.members]]
name = "discards"
type = "u8"
key = false

[[models.members]]
name = "plays"
type = "u8"
key = false

[[models]]
kind = "DojoModel"
class_hash = "0x101deece771f5cbf115831a78e13c3e68fcf8a6220ea0f86b9177799a610dd1"
Expand Down Expand Up @@ -535,8 +603,8 @@ key = false

[[models]]
kind = "DojoModel"
class_hash = "0x55a1aee842d76a253cb36c4989bc5ef74d3cd7d2d8dd4c464c64295986afa10"
original_class_hash = "0x55a1aee842d76a253cb36c4989bc5ef74d3cd7d2d8dd4c464c64295986afa10"
class_hash = "0x2a0bf5c76a2a51057fa8cd30b669b8b2e9ac982f6a7c0d2aac0caf2e8b385a1"
original_class_hash = "0x2a0bf5c76a2a51057fa8cd30b669b8b2e9ac982f6a7c0d2aac0caf2e8b385a1"
abi = "manifests/dev/deployment/abis/models/jokers_of_neon-Game-162de85b.json"
tag = "jokers_of_neon-Game"
qualified_path = "jokers_of_neon::models::status::game::game::game"
Expand Down Expand Up @@ -670,6 +738,30 @@ name = "energy_max_player"
type = "u8"
key = false

[[models]]
kind = "DojoModel"
class_hash = "0x2cdd0f8efcd582eb49fd33a9bc2c466d96bda4d2b7739b48258842fdb18984d"
original_class_hash = "0x2cdd0f8efcd582eb49fd33a9bc2c466d96bda4d2b7739b48258842fdb18984d"
abi = "manifests/dev/deployment/abis/models/jokers_of_neon-LastBeastLevel-ce77bf82.json"
tag = "jokers_of_neon-LastBeastLevel"
qualified_path = "jokers_of_neon::models::data::last_beast_level::last_beast_level"
manifest_name = "jokers_of_neon-LastBeastLevel-ce77bf82"

[[models.members]]
name = "game_id"
type = "u32"
key = true

[[models.members]]
name = "current_probability"
type = "u16"
key = false

[[models.members]]
name = "level"
type = "u8"
key = false

[[models]]
kind = "DojoModel"
class_hash = "0x42cf1e65c45e0ef0b7c53dce92420243d76e261a51da744de4b1edb51937625"
Expand Down
1 change: 1 addition & 0 deletions scripts/enviroment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ echo -e "\n[INFO] Modifier cards selected successfully. Setup complete!"

# sozo execute game_system play -c 1,5,0,1,2,3,4,5,100,100,100,100,100 --wait --world 0x37578f01e123327fb366fc6e2224f4be4e44234d682855e1326363b57444b88
# sozo execute game_system end_turn -c 1 --wait --world 0x37578f01e123327fb366fc6e2224f4be4e44234d682855e1326363b57444b88
# sozo execute game_system create_level -c 1 --wait --world 0x37578f01e123327fb366fc6e2224f4be4e44234d682855e1326363b57444b88
1 change: 1 addition & 0 deletions src/models/data/beast.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ struct GameModeBeast {
}

#[derive(Copy, Drop, IntrospectPacked, Serde)]
#[dojo::event]
#[dojo::model]
struct Beast {
#[key]
Expand Down
1 change: 1 addition & 0 deletions src/models/data/challenge.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#[derive(Copy, Drop, Serde)]
#[dojo::event]
#[dojo::model]
struct Challenge {
#[key]
Expand Down
1 change: 1 addition & 0 deletions src/models/status/round/beast.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ impl BeastImpl of BeastTrait {

let beast = Beast { game_id, tier: 5, level: 5, health: 300, attack: 15 };
BeastStore::set(@beast, world);
emit!(world, (beast));

let player_beast = PlayerBeast { game_id, health: 100, energy: game_mode_beast.energy_max_player };
PlayerBeastStore::set(@player_beast, world);
Expand Down
1 change: 1 addition & 0 deletions src/models/status/round/challenge.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ impl ChallengeImpl of ChallengeTrait {
let mut challenge = ChallengeStore::get(world, game_id);
challenge.active_ids = generate_unique_random_values(world, 3, challenges_all(), array![]).span();
ChallengeStore::set(@challenge, world);
emit!(world, (challenge));
}

fn play(world: IWorldDispatcher, game_id: u32, cards_index: Array<u32>, modifiers_index: Array<u32>) {
Expand Down
2 changes: 0 additions & 2 deletions src/systems/game_system.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ mod game_system {

game.state = GameState::IN_GAME;
store.set_game(game);

create_level(world, ref store, game);
}

fn discard_effect_card(ref world: IWorldDispatcher, game_id: u32, card_index: u32) {
Expand Down

0 comments on commit 4873303

Please sign in to comment.