diff --git a/Makefile b/Makefile index 0c8cddb..c3373ac 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ build-wasm: $(call print-help, build-wasm, Build the webassembly version of the wasm-bindgen target/wasm32-unknown-unknown/release/roguelike_tutorial.wasm --out-dir wasm --no-modules --no-typescript build-wasm-dev: $(call print-help, build-wasm-dev, Build the webassembly version of the game (dev version)) - cargo build --target wasm32-unknown-unknown --features wasm + cargo build --target wasm32-unknown-unknown --features wasm,debug wasm-bindgen target/wasm32-unknown-unknown/debug/roguelike_tutorial.wasm --out-dir wasm --no-modules --no-typescript clean: $(call print-help, clean, Removes save file and compilation artifacts) diff --git a/src/spawner.rs b/src/spawner.rs index d2f697d..c38faba 100644 --- a/src/spawner.rs +++ b/src/spawner.rs @@ -41,14 +41,7 @@ pub fn player(ecs: &mut World, player_x: i32, player_y: i32) -> Entity { .build(); // Starting equipment - let starting_equipment_carried = ["Dried Sausage", "Beer", "Shortbow"]; - let starting_equipment_equipped = [ - "Rusty Longsword", - "Stained Tunic", - "Torn Trousers", - "Old Boots", - ]; - for equipment in starting_equipment_carried.iter() { + for equipment in ["Dried Sausage", "Beer"].iter() { spawn_named_entity( &RAWS.lock().unwrap(), ecs, @@ -56,7 +49,14 @@ pub fn player(ecs: &mut World, player_x: i32, player_y: i32) -> Entity { SpawnType::Carried { by: player }, ); } - for equipment in starting_equipment_equipped.iter() { + for equipment in [ + "Rusty Longsword", + "Stained Tunic", + "Torn Trousers", + "Old Boots", + ] + .iter() + { spawn_named_entity( &RAWS.lock().unwrap(), ecs, diff --git a/src/systems/melee_combat_system.rs b/src/systems/melee_combat_system.rs index cf26fe7..34536ca 100644 --- a/src/systems/melee_combat_system.rs +++ b/src/systems/melee_combat_system.rs @@ -170,7 +170,9 @@ impl<'a> System<'a> for MeleeCombatSystem { // Proc effects if let Some(chance) = &weapon_info.proc_chance { if roll_dice(1, 100) <= (chance * 100.0) as i32 { - let effect_target = if weapon_info.proc_target.unwrap() == "Self" { + let effect_target = if weapon_info.proc_target.is_some() + && weapon_info.proc_target.unwrap() == "Self" + { Targets::Single { target: entity } } else { Targets::Single {