atomising item use: damage and healing, and refactors
This commit is contained in:
parent
6677181a4e
commit
911873127d
12 changed files with 176 additions and 48 deletions
|
|
@ -19,6 +19,7 @@ lazy_static! {
|
|||
|
||||
pub enum EffectType {
|
||||
Damage { amount: i32 },
|
||||
Healing { amount: i32 },
|
||||
Bloodstain,
|
||||
Particle { glyph: FontCharType, fg: RGB, bg: RGB, lifespan: f32, delay: f32 },
|
||||
EntityDeath,
|
||||
|
|
@ -95,6 +96,7 @@ fn affect_tile(ecs: &mut World, effect: &EffectSpawner, target: usize) {
|
|||
fn tile_effect_hits_entities(effect: &EffectType) -> bool {
|
||||
match effect {
|
||||
EffectType::Damage { .. } => true,
|
||||
EffectType::Healing { .. } => true,
|
||||
EffectType::RestoreNutrition { .. } => true,
|
||||
_ => false,
|
||||
}
|
||||
|
|
@ -104,6 +106,7 @@ fn tile_effect_hits_entities(effect: &EffectType) -> bool {
|
|||
fn affect_entity(ecs: &mut World, effect: &EffectSpawner, target: Entity) {
|
||||
match &effect.effect_type {
|
||||
EffectType::Damage { .. } => damage::inflict_damage(ecs, effect, target),
|
||||
EffectType::Healing { .. } => damage::heal_damage(ecs, effect, target),
|
||||
EffectType::Bloodstain { .. } => {
|
||||
if let Some(pos) = targeting::entity_position(ecs, target) {
|
||||
damage::bloodstain(ecs, pos)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue