Add a few more components

This commit is contained in:
Timothy Warren 2022-01-25 13:45:44 -05:00
parent bd7fa27794
commit 1fb4bf293f
4 changed files with 29 additions and 3 deletions

View File

@ -433,3 +433,13 @@ pub struct ProvidesMana {
pub struct TeachesSpell { pub struct TeachesSpell {
pub spell: String, pub spell: String,
} }
#[derive(Component, Debug, Serialize, Deserialize, Clone)]
pub struct Slow {
pub initiative_penalty: f32,
}
#[derive(Component, Debug, Serialize, Deserialize, Clone)]
pub struct DamageOverTime {
pub damage: i32,
}

View File

@ -92,6 +92,7 @@ fn init_state() -> State {
Confusion, Confusion,
Consumable, Consumable,
CursedItem, CursedItem,
DamageOverTime,
Door, Door,
DMSerializationHelper, DMSerializationHelper,
Duration, Duration,
@ -136,6 +137,7 @@ fn init_state() -> State {
SimpleMarker<SerializeMe>, SimpleMarker<SerializeMe>,
SingleActivation, SingleActivation,
Skills, Skills,
Slow,
SpawnParticleBurst, SpawnParticleBurst,
SpawnParticleLine, SpawnParticleLine,
SpellTemplate, SpellTemplate,

View File

@ -293,6 +293,11 @@ macro_rules! apply_effects {
mana_amount: effect.1.parse::<i32>().unwrap(), mana_amount: effect.1.parse::<i32>().unwrap(),
}) })
} }
"teach_spell" => {
$eb = $eb.with(TeachesSpell {
spell: effect.1.to_string(),
})
}
"ranged" => { "ranged" => {
$eb = $eb.with(Ranged { $eb = $eb.with(Ranged {
range: effect.1.parse::<i32>().unwrap(), range: effect.1.parse::<i32>().unwrap(),
@ -322,9 +327,14 @@ macro_rules! apply_effects {
"particle" => $eb = $eb.with(parse_particle(&effect.1)), "particle" => $eb = $eb.with(parse_particle(&effect.1)),
"remove_curse" => $eb = $eb.with(ProvidesRemoveCurse {}), "remove_curse" => $eb = $eb.with(ProvidesRemoveCurse {}),
"identify" => $eb = $eb.with(ProvidesIdentification {}), "identify" => $eb = $eb.with(ProvidesIdentification {}),
"teach_spell" => { "slow" => {
$eb = $eb.with(TeachesSpell { $eb = $eb.with(Slow {
spell: effect.1.to_string(), initiative_penalty: effect.1.parse::<f32>().unwrap(),
})
}
"damage_over_time" => {
$eb = $eb.with(DamageOverTime {
damage: effect.1.parse::<i32>().unwrap(),
}) })
} }
_ => { _ => {

View File

@ -71,6 +71,7 @@ pub fn save_game(ecs: &mut World) {
Confusion, Confusion,
Consumable, Consumable,
CursedItem, CursedItem,
DamageOverTime,
Door, Door,
DMSerializationHelper, DMSerializationHelper,
Duration, Duration,
@ -114,6 +115,7 @@ pub fn save_game(ecs: &mut World) {
SerializationHelper, SerializationHelper,
SingleActivation, SingleActivation,
Skills, Skills,
Slow,
SpawnParticleBurst, SpawnParticleBurst,
SpawnParticleLine, SpawnParticleLine,
SpellTemplate, SpellTemplate,
@ -199,6 +201,7 @@ pub fn load_game(ecs: &mut World) {
Confusion, Confusion,
Consumable, Consumable,
CursedItem, CursedItem,
DamageOverTime,
Door, Door,
DMSerializationHelper, DMSerializationHelper,
Duration, Duration,
@ -241,6 +244,7 @@ pub fn load_game(ecs: &mut World) {
Renderable, Renderable,
SerializationHelper, SerializationHelper,
SingleActivation, SingleActivation,
Slow,
Skills, Skills,
SpawnParticleBurst, SpawnParticleBurst,
SpawnParticleLine, SpawnParticleLine,