mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Attacks can now heal.
This commit is contained in:
parent
edcfcc31f6
commit
2b11ae6569
@ -148,6 +148,18 @@ impl Attack {
|
||||
kb_dir: *dir,
|
||||
});
|
||||
},
|
||||
AttackEffect::Heal(h) => {
|
||||
let change = HealthChange {
|
||||
amount: *h as i32,
|
||||
cause: HealthSource::Heal {
|
||||
by: Some(attacker_uid),
|
||||
},
|
||||
};
|
||||
server_events.push(ServerEvent::Damage {
|
||||
entity: target_entity,
|
||||
change,
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -211,6 +223,18 @@ impl Attack {
|
||||
kb_dir: *dir,
|
||||
});
|
||||
},
|
||||
AttackEffect::Heal(h) => {
|
||||
let change = HealthChange {
|
||||
amount: h as i32,
|
||||
cause: HealthSource::Heal {
|
||||
by: Some(attacker_uid),
|
||||
},
|
||||
};
|
||||
server_events.push(ServerEvent::Damage {
|
||||
entity: target_entity,
|
||||
change,
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -264,7 +288,7 @@ impl EffectComponent {
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub enum AttackEffect {
|
||||
//Heal(f32),
|
||||
Heal(f32),
|
||||
Buff(CombatBuff),
|
||||
Knockback(Knockback),
|
||||
EnergyReward(u32),
|
||||
|
@ -126,10 +126,8 @@ impl CharacterBehavior for Data {
|
||||
source: DamageSource::Energy,
|
||||
value: self.static_data.base_dps as f32 / self.static_data.tick_rate,
|
||||
};
|
||||
let heal = Damage {
|
||||
source: DamageSource::Healing,
|
||||
value: self.static_data.base_hps as f32 / self.static_data.tick_rate,
|
||||
};
|
||||
let heal = self.static_data.base_hps as f32 / self.static_data.tick_rate;
|
||||
let heal = AttackEffect::Heal(heal);
|
||||
let speed =
|
||||
self.static_data.range / self.static_data.beam_duration.as_secs_f32();
|
||||
|
||||
@ -139,7 +137,12 @@ impl CharacterBehavior for Data {
|
||||
let lifesteal = AttackEffect::Lifesteal(self.static_data.lifesteal_eff);
|
||||
let damage = DamageComponent::new(damage, Some(GroupTarget::OutOfGroup))
|
||||
.with_effect(lifesteal);
|
||||
let attack = Attack::default().with_damage(damage).with_effect(energy);
|
||||
let heal = EffectComponent::new(Some(GroupTarget::InGroup), heal)
|
||||
/*.with_requirement(CombatRequirement::SufficientEnergy(self.static_data.energy_cost))*/;
|
||||
let attack = Attack::default()
|
||||
.with_damage(damage)
|
||||
.with_effect(energy)
|
||||
.with_effect(heal);
|
||||
|
||||
let properties = beam::Properties {
|
||||
attack,
|
||||
|
@ -170,7 +170,7 @@ pub fn handle_beam(server: &mut Server, properties: beam::Properties, pos: Pos,
|
||||
let ecs = state.ecs();
|
||||
ecs.write_resource::<Vec<Outcome>>().push(Outcome::Beam {
|
||||
pos: pos.0,
|
||||
heal: false, //properties.lifesteal_eff > 0.0,
|
||||
heal: false, //properties.lifesteal_eff > 0.0, // Fix before merging
|
||||
});
|
||||
state.create_beam(properties, pos, ori).build();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user