ability framework, some more rounds
This commit is contained in:
parent
2f547b95a4
commit
a867fc77c2
3 changed files with 324 additions and 31 deletions
|
@ -1,6 +1,8 @@
|
|||
use crate::commands::zombies::gear::{
|
||||
Weapon::{*},
|
||||
WeaponMaterial::{*}
|
||||
WeaponMaterial::{Wood, Stone},
|
||||
ArmorPiece::{*},
|
||||
ArmorMaterial::{Chainmail, Leather},
|
||||
};
|
||||
|
||||
pub type Enchanted = bool;
|
||||
|
@ -23,11 +25,11 @@ impl ArmorPiece {
|
|||
pub fn armor_value(&self) -> &ArmorValue {
|
||||
match self {
|
||||
ArmorPiece::None(value) => value,
|
||||
ArmorPiece::Helmet(value, _, _) => value,
|
||||
ArmorPiece::Head(value, _, _) => value,
|
||||
ArmorPiece::Chestplate(value, _, _) => value,
|
||||
ArmorPiece::Leggings(value, _, _) => value,
|
||||
ArmorPiece::Boots(value, _, _) => value
|
||||
Helmet(value, _, _) => value,
|
||||
Head(value, _, _) => value,
|
||||
Chestplate(value, _, _) => value,
|
||||
Leggings(value, _, _) => value,
|
||||
Boots(value, _, _) => value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +52,7 @@ pub enum ArmorMaterial {
|
|||
}
|
||||
#[derive(Debug)]
|
||||
pub enum Weapon {
|
||||
None(Damage),
|
||||
None,
|
||||
Axe(Damage, Enchanted, WeaponMaterial),
|
||||
Sword(Damage, Enchanted, WeaponMaterial),
|
||||
|
||||
|
@ -60,7 +62,7 @@ pub enum Weapon {
|
|||
impl Weapon {
|
||||
pub fn damage(&self) -> &Damage {
|
||||
match self {
|
||||
None(damage) => damage,
|
||||
Weapon::None => &0_u8,
|
||||
Axe(damage, _, _) => damage,
|
||||
Sword(damage, _, _) => damage,
|
||||
Other(damage, _, _) => damage
|
||||
|
@ -74,14 +76,21 @@ pub const NO_HELMET: ArmorPiece = ArmorPiece::None(0);
|
|||
pub const NO_CHESTPLATE: ArmorPiece = ArmorPiece::None(0);
|
||||
pub const NO_LEGGINGS: ArmorPiece = ArmorPiece::None(0);
|
||||
pub const NO_BOOTS: ArmorPiece = ArmorPiece::None(0);
|
||||
pub const SLIME_HEAD: ArmorPiece = ArmorPiece::Head(0,false,0);
|
||||
pub const CHAIN_CHESTPLATE: ArmorPiece = Chestplate(5,false,Chainmail);
|
||||
pub const CHAIN_LEGGINGS: ArmorPiece = Leggings(4,false,Chainmail);
|
||||
pub const CHAIN_BOOTS: ArmorPiece = Boots(1, false, Chainmail);
|
||||
pub const SLIME_HEAD: ArmorPiece = Head(0,false,0);
|
||||
pub const WERE_HEAD: ArmorPiece = Head(0,false,1);
|
||||
pub const LILY_HEAD: ArmorPiece = Head(0,false,2);
|
||||
|
||||
|
||||
//Weapons
|
||||
pub const NO_WEAPON: Weapon = Weapon::None(0);
|
||||
pub const NO_WEAPON: Weapon = Weapon::None;
|
||||
pub const WOODEN_AXE: Weapon = Axe(3,false,Wood);
|
||||
pub const DIAMOND_AXE: Weapon = Axe(6,false,Diamond);
|
||||
pub const GOLD_SWORD: Weapon = Sword(4,false,Gold);
|
||||
pub const DIAMOND_SWORD: Weapon = Sword(7,false,Diamond);
|
||||
pub const DIAMOND_AXE: Weapon = Axe(6,false,WeaponMaterial::Diamond);
|
||||
pub const GOLD_SWORD: Weapon = Sword(4,false,WeaponMaterial::Gold);
|
||||
pub const STONE_SWORD: Weapon = Sword(5,false,Stone);
|
||||
pub const IRON_SWORD: Weapon = Sword(6,false,WeaponMaterial::Iron);
|
||||
pub const DIAMOND_SWORD: Weapon = Sword(7,false,WeaponMaterial::Diamond);
|
||||
pub const SLIME_BALL: Weapon = Other(0, true, "Slime Ball");
|
||||
|
||||
|
|
|
@ -89,38 +89,38 @@ impl BadBlood {
|
|||
//wave 1
|
||||
vec![
|
||||
Horde {
|
||||
zombie: BB_Z_2,
|
||||
zombie: BB_Z_3,
|
||||
count: 4,
|
||||
},
|
||||
Horde {
|
||||
zombie: BB_SZ_1,
|
||||
count: 2,
|
||||
},
|
||||
}
|
||||
],
|
||||
//wave 2
|
||||
vec![
|
||||
Horde {
|
||||
zombie: BB_Z_2,
|
||||
zombie: BB_Z_3,
|
||||
count: 3,
|
||||
},
|
||||
Horde {
|
||||
zombie: BB_SZ_1,
|
||||
count: 2,
|
||||
count: 1,
|
||||
},
|
||||
Horde {
|
||||
zombie: BB_S_1,
|
||||
zombie: BB_WI_1,
|
||||
count: 2,
|
||||
}
|
||||
],
|
||||
//wave 3
|
||||
vec![
|
||||
Horde {
|
||||
zombie: BB_Z_2,
|
||||
zombie: BB_Z_3,
|
||||
count: 3,
|
||||
},
|
||||
Horde {
|
||||
zombie: BB_SZ_1,
|
||||
count: 2,
|
||||
count: 1,
|
||||
},
|
||||
Horde {
|
||||
zombie: BB_S_1,
|
||||
|
@ -129,16 +129,138 @@ impl BadBlood {
|
|||
]
|
||||
]
|
||||
}
|
||||
/*fn round5() -> Round {
|
||||
fn round5() -> Round {
|
||||
vec![
|
||||
//wave 1
|
||||
vec![
|
||||
Horde {
|
||||
zombie: BB_WO_1,
|
||||
count: 3,
|
||||
},
|
||||
Horde {
|
||||
zombie: BB_WW_1,
|
||||
count: 1,
|
||||
}
|
||||
],
|
||||
//wave 2
|
||||
vec![
|
||||
Horde {
|
||||
zombie: BB_WO_1,
|
||||
count: 3,
|
||||
},
|
||||
Horde {
|
||||
zombie: BB_WW_1,
|
||||
count: 1,
|
||||
}
|
||||
],
|
||||
//wave 3
|
||||
vec![
|
||||
Horde {
|
||||
zombie: BB_WO_1,
|
||||
count: 2,
|
||||
},
|
||||
Horde {
|
||||
zombie: BB_WW_1,
|
||||
count: 1,
|
||||
},
|
||||
Horde {
|
||||
zombie: BB_LILY,
|
||||
count: 1,
|
||||
},
|
||||
Horde {
|
||||
zombie: BB_ELLIE,
|
||||
count: 1,
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
fn round6() -> Round {
|
||||
vec![
|
||||
//wave 1
|
||||
vec![
|
||||
Horde {
|
||||
zombie: BB_Z_4,
|
||||
count: 4,
|
||||
},
|
||||
Horde {
|
||||
zombie: BB_WI_1,
|
||||
count: 3,
|
||||
}
|
||||
],
|
||||
//wave 2
|
||||
vec![
|
||||
Horde {
|
||||
zombie: BB_Z_4,
|
||||
count: 3,
|
||||
},
|
||||
Horde {
|
||||
zombie: BB_WI_1,
|
||||
count: 2,
|
||||
}
|
||||
],
|
||||
//wave 3
|
||||
vec![
|
||||
Horde {
|
||||
zombie: BB_Z_4,
|
||||
count: 3,
|
||||
},
|
||||
Horde {
|
||||
zombie: BB_WI_1,
|
||||
count: 2,
|
||||
},
|
||||
]
|
||||
]
|
||||
}
|
||||
fn round7() -> Round {
|
||||
vec![
|
||||
//wave 1
|
||||
vec![
|
||||
Horde {
|
||||
zombie: BB_S_1,
|
||||
count: 3,
|
||||
},
|
||||
Horde {
|
||||
zombie: BB_WI_1,
|
||||
count: 3,
|
||||
}
|
||||
],
|
||||
//wave 2
|
||||
vec![
|
||||
Horde {
|
||||
zombie: BB_S_1,
|
||||
count: 3,
|
||||
},
|
||||
Horde {
|
||||
zombie: BB_WI_1,
|
||||
count: 3,
|
||||
}
|
||||
],
|
||||
//wave 3
|
||||
vec![
|
||||
Horde {
|
||||
zombie: BB_S_1,
|
||||
count: 3,
|
||||
},
|
||||
Horde {
|
||||
zombie: BB_WI_1,
|
||||
count: 3,
|
||||
},
|
||||
]
|
||||
]
|
||||
}
|
||||
/*fn round8() -> Round {
|
||||
|
||||
}*/
|
||||
pub(crate) fn get_round(round: u8) -> Round {
|
||||
pub(crate) fn get_round(round: u8) -> Option<Round> {
|
||||
match round {
|
||||
1 => Self::round1(),
|
||||
2 => Self::round2(),
|
||||
3 => Self::round3(),
|
||||
4 => Self::round4(),
|
||||
_ => panic!("Round {} not found", round)
|
||||
1 => Some(Self::round1()),
|
||||
2 => Some(Self::round2()),
|
||||
3 => Some(Self::round3()),
|
||||
4 => Some(Self::round4()),
|
||||
5 => Some(Self::round5()),
|
||||
6 => Some(Self::round6()),
|
||||
7 => Some(Self::round7()),
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,8 +4,9 @@ use crate::commands::zombies::gear::{
|
|||
ArmorPiece::*,
|
||||
Weapon::*
|
||||
};
|
||||
use crate::commands::zombies::rounds::{Round, Wave};
|
||||
|
||||
type ChildrenCount = u8;
|
||||
type RespawningChildren = bool;
|
||||
#[derive(Debug)]
|
||||
pub struct Family {
|
||||
family: *const str,
|
||||
|
@ -22,14 +23,34 @@ pub struct Zombie {
|
|||
pub speed: f32,
|
||||
armor: Armor,
|
||||
weapon: Weapon,
|
||||
children: Children,
|
||||
damage_type: DamageType,
|
||||
}
|
||||
#[derive(Debug)]
|
||||
pub enum Children {
|
||||
None,
|
||||
Single(&'static Horde, RespawningChildren),
|
||||
}
|
||||
#[derive(Debug)]
|
||||
pub enum Ability {
|
||||
Single(*const str),
|
||||
Double(*const str, *const str),
|
||||
}
|
||||
#[derive(Debug)]
|
||||
pub enum DamageType {
|
||||
Melee,
|
||||
Ranged,
|
||||
Ability(Ability),
|
||||
MeleeRanged,
|
||||
MeleeAbility(Ability),
|
||||
RangedAbility(Ability),
|
||||
}
|
||||
|
||||
impl Zombie {
|
||||
pub fn health(&self) -> u16 {
|
||||
self.family.health
|
||||
}
|
||||
pub fn damage(&self) -> Damage {
|
||||
self.family.damage+ self.weapon.damage()
|
||||
pub fn damage(&self) -> (&DamageType, Damage) {
|
||||
(&self.damage_type, self.family.damage + self.weapon.damage())
|
||||
}
|
||||
pub fn follow_range(&self) -> u8 {
|
||||
self.family.follow_range
|
||||
|
@ -73,6 +94,27 @@ pub const BB_SLIME: Family = Family {
|
|||
follow_range: 16,
|
||||
base_armor: 2,
|
||||
};
|
||||
pub const BB_WITCH: Family = Family {
|
||||
family: "witch",
|
||||
damage: 2,
|
||||
health: 20,
|
||||
follow_range: 16,
|
||||
base_armor: 0,
|
||||
};
|
||||
pub const BB_WOLF: Family = Family {
|
||||
family: "wolf",
|
||||
damage: 4,
|
||||
health: 16,
|
||||
follow_range: 16,
|
||||
base_armor: 0,
|
||||
};
|
||||
pub const BB_WEREWOLF: Family = Family {
|
||||
family: "werewolf",
|
||||
damage: 3,
|
||||
health: 32,
|
||||
follow_range: 35,
|
||||
base_armor: 2,
|
||||
};
|
||||
|
||||
pub const BB_Z_1: Zombie = Zombie {
|
||||
family: BB_BASIC,
|
||||
|
@ -86,6 +128,8 @@ pub const BB_Z_1: Zombie = Zombie {
|
|||
NO_BOOTS,
|
||||
],
|
||||
weapon: NO_WEAPON,
|
||||
children: Children::None,
|
||||
damage_type: DamageType::Melee,
|
||||
};
|
||||
pub const BB_Z_2: Zombie = Zombie {
|
||||
family: BB_BASIC,
|
||||
|
@ -99,6 +143,8 @@ pub const BB_Z_2: Zombie = Zombie {
|
|||
NO_BOOTS,
|
||||
],
|
||||
weapon: NO_WEAPON,
|
||||
children: Children::None,
|
||||
damage_type: DamageType::Melee,
|
||||
};
|
||||
pub const BB_Z_3: Zombie = Zombie {
|
||||
family: BB_BASIC,
|
||||
|
@ -112,6 +158,23 @@ pub const BB_Z_3: Zombie = Zombie {
|
|||
NO_BOOTS,
|
||||
],
|
||||
weapon: WOODEN_AXE,
|
||||
children: Children::None,
|
||||
damage_type: DamageType::Melee,
|
||||
};
|
||||
pub const BB_Z_4: Zombie = Zombie {
|
||||
family: BB_BASIC,
|
||||
tier: 4,
|
||||
|
||||
speed: 0.25,
|
||||
armor: [
|
||||
NO_HELMET,
|
||||
Chestplate(3,false,Leather(0x000000)),
|
||||
Leggings(2,false,Leather(0x000000)),
|
||||
NO_BOOTS,
|
||||
],
|
||||
weapon: WOODEN_AXE,
|
||||
children: Children::None,
|
||||
damage_type: DamageType::Melee,
|
||||
};
|
||||
|
||||
pub const BB_SZ_1: Zombie = Zombie {
|
||||
|
@ -126,7 +189,10 @@ pub const BB_SZ_1: Zombie = Zombie {
|
|||
Boots(1,false,Leather(0x000000)),
|
||||
],
|
||||
weapon: SLIME_BALL,
|
||||
children: Children::None,
|
||||
damage_type: DamageType::Melee,
|
||||
};
|
||||
|
||||
pub const BB_S_1: Zombie = Zombie {
|
||||
family: BB_SLIME,
|
||||
tier: 1,
|
||||
|
@ -139,4 +205,100 @@ pub const BB_S_1: Zombie = Zombie {
|
|||
NO_BOOTS,
|
||||
],
|
||||
weapon: NO_WEAPON,
|
||||
children: Children::None,
|
||||
damage_type: DamageType::Melee,
|
||||
};
|
||||
|
||||
pub const BB_WI_1: Zombie = Zombie {
|
||||
family: BB_WITCH,
|
||||
tier: 1,
|
||||
|
||||
speed: 0.25,
|
||||
armor: [
|
||||
NO_HELMET,
|
||||
NO_CHESTPLATE,
|
||||
NO_LEGGINGS,
|
||||
NO_BOOTS,
|
||||
],
|
||||
weapon: NO_WEAPON,
|
||||
children: Children::None,
|
||||
damage_type: DamageType::Ability(Ability::Double("splash potion of Harming", "splash potion of Poison")),
|
||||
};
|
||||
|
||||
pub const BB_WO_1: Zombie = Zombie {
|
||||
family: BB_WOLF,
|
||||
tier: 1,
|
||||
|
||||
speed: 0.36,
|
||||
armor: [
|
||||
NO_HELMET,
|
||||
NO_CHESTPLATE,
|
||||
NO_LEGGINGS,
|
||||
NO_BOOTS,
|
||||
],
|
||||
weapon: NO_WEAPON,
|
||||
children: Children::None,
|
||||
damage_type: DamageType::Melee,
|
||||
};
|
||||
|
||||
pub const BB_WW_1: Zombie = Zombie {
|
||||
family: BB_WEREWOLF,
|
||||
tier: 1,
|
||||
|
||||
speed: 0.3,
|
||||
armor: [
|
||||
WERE_HEAD,
|
||||
Chestplate(3,false,Leather(0x555555)),
|
||||
Leggings(2,false,Leather(0x555555)),
|
||||
Boots(1,false,Leather(0x555555)),
|
||||
],
|
||||
weapon: STONE_SWORD,
|
||||
children: Children::None,
|
||||
damage_type: DamageType::Melee,
|
||||
};
|
||||
|
||||
|
||||
|
||||
pub const BB_LILY: Zombie = Zombie {
|
||||
family: Family {
|
||||
family: "bb_lore",
|
||||
damage: 3,
|
||||
health: 55,
|
||||
follow_range: 35,
|
||||
base_armor: 2,
|
||||
},
|
||||
tier: 1,
|
||||
speed: 0.3,
|
||||
armor: [
|
||||
LILY_HEAD,
|
||||
CHAIN_CHESTPLATE,
|
||||
CHAIN_LEGGINGS,
|
||||
CHAIN_BOOTS
|
||||
],
|
||||
weapon: STONE_SWORD,
|
||||
children: Children::Single(&Horde {
|
||||
zombie: BB_ELLIE,
|
||||
count: 1,
|
||||
}, false),
|
||||
damage_type: DamageType::Melee,
|
||||
};
|
||||
pub const BB_ELLIE: Zombie = Zombie {
|
||||
family: Family {
|
||||
family: "bb_lore",
|
||||
damage: 4,
|
||||
health: 30,
|
||||
follow_range: 16,
|
||||
base_armor: 0,
|
||||
},
|
||||
tier: 0,
|
||||
speed: 0.38,
|
||||
armor: [
|
||||
NO_HELMET,
|
||||
NO_CHESTPLATE,
|
||||
NO_LEGGINGS,
|
||||
NO_BOOTS,
|
||||
],
|
||||
weapon: NO_WEAPON,
|
||||
children: Children::None,
|
||||
damage_type: DamageType::MeleeAbility(Ability::Single("poop")),
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue