Add components for handling natural attacks
This commit is contained in:
parent
5b227115db
commit
2785eb10f1
@ -322,6 +322,21 @@ pub struct Pools {
|
||||
pub level: i32,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct NaturalAttack {
|
||||
pub name: String,
|
||||
pub damage_n_dice: i32,
|
||||
pub damage_die_type: i32,
|
||||
pub damage_bonus: i32,
|
||||
pub hit_bonus: i32,
|
||||
}
|
||||
|
||||
#[derive(Component, Serialize, Deserialize, Clone)]
|
||||
pub struct NaturalAttackDefense {
|
||||
pub armor_class: Option<i32>,
|
||||
pub attacks: Vec<NaturalAttack>,
|
||||
}
|
||||
|
||||
// Serialization helper code. We need to implement ConvertSaveLoad for each type that contains an
|
||||
// Entity.
|
||||
|
||||
|
@ -537,6 +537,7 @@ fn main() -> ::rltk::BError {
|
||||
Attributes,
|
||||
Skills,
|
||||
Pools,
|
||||
NaturalAttackDefense,
|
||||
);
|
||||
|
||||
gs.ecs.insert(SimpleMarkerAllocator::<SerializeMe>::new());
|
||||
|
@ -18,6 +18,7 @@ pub struct Mob {
|
||||
pub hp: Option<i32>,
|
||||
pub mana: Option<i32>,
|
||||
pub equipped: Option<Vec<String>>,
|
||||
pub natural: Option<MobNature>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
@ -27,3 +28,16 @@ pub struct MobAttributes {
|
||||
pub quickness: Option<i32>,
|
||||
pub intelligence: Option<i32>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct MobNatural {
|
||||
pub armor_class: Option<i32>,
|
||||
pub attacks: Option<Vec<NaturalAttack>>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct NaturalAttack {
|
||||
pub name: String,
|
||||
pub hit_bonus: i32,
|
||||
pub damage: String,
|
||||
}
|
||||
|
@ -94,6 +94,7 @@ pub fn save_game(ecs: &mut World) {
|
||||
Attributes,
|
||||
Skills,
|
||||
Pools,
|
||||
NaturalAttackDefense,
|
||||
);
|
||||
}
|
||||
|
||||
@ -190,6 +191,7 @@ pub fn load_game(ecs: &mut World) {
|
||||
Attributes,
|
||||
Skills,
|
||||
Pools,
|
||||
NaturalAttackDefense,
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user