Basic beam now generates combo. Healing beam now consumes combo, and requires combo to heal.

This commit is contained in:
Sam 2021-03-02 17:19:38 -05:00
parent 43874a4aa5
commit 18edc1092b
15 changed files with 57 additions and 22 deletions

View File

@ -2,7 +2,7 @@ HealingBeam(
buildup_duration: 0.25,
recover_duration: 0.25,
beam_duration: 1.0,
heal: 80,
heal: 40,
tick_rate: 2.0,
range: 25.0,
max_angle: 1.0,

View File

@ -2,7 +2,7 @@ BasicBeam(
buildup_duration: 0.25,
recover_duration: 0.25,
beam_duration: 1.0,
damage: 80,
damage: 40,
tick_rate: 2.0,
range: 25.0,
max_angle: 1.0,

View File

@ -2,7 +2,7 @@ BasicBeam(
buildup_duration: 0.25,
recover_duration: 0.25,
beam_duration: 1.0,
damage: 150,
damage: 50,
tick_rate: 3.0,
range: 20.0,
max_angle: 10.0,

View File

@ -2,7 +2,7 @@ BasicBeam(
buildup_duration: 0.5,
recover_duration: 0.5,
beam_duration: 1.0,
damage: 150,
damage: 50,
tick_rate: 3.0,
range: 20.0,
max_angle: 0.1,

View File

@ -2,7 +2,7 @@ BasicBeam(
buildup_duration: 0.25,
recover_duration: 0.25,
beam_duration: 1.0,
damage: 60,
damage: 30,
//base_hps: 60, Don't merge until this comment is removed
tick_rate: 2.0,
range: 25.0,

View File

@ -2,7 +2,7 @@ BasicBeam(
buildup_duration: 0.4,
recover_duration: 0.25,
beam_duration: 0.5,
damage: 150,
damage: 50,
tick_rate: 3.0,
range: 15.0,
max_angle: 22.5,

View File

@ -2,7 +2,7 @@ BasicBeam(
buildup_duration: 0.25,
recover_duration: 0.25,
beam_duration: 0.5,
damage: 9001,
damage: 3000,
tick_rate: 3.0,
range: 30.0,
max_angle: 1.0,

View File

@ -13,8 +13,8 @@ use crate::{
},
poise::PoiseChange,
skills::{SkillGroupKind, SkillSet},
Body, Energy, EnergyChange, EnergySource, Health, HealthChange, HealthSource, Inventory,
Stats,
Body, Combo, Energy, EnergyChange, EnergySource, Health, HealthChange, HealthSource,
Inventory, Stats,
},
event::ServerEvent,
uid::Uid,
@ -45,6 +45,7 @@ pub struct AttackerInfo<'a> {
pub entity: EcsEntity,
pub uid: Uid,
pub energy: Option<&'a Energy>,
pub combo: Option<&'a Combo>,
}
#[cfg(not(target_arch = "wasm32"))]
@ -229,7 +230,7 @@ impl Attack {
{
if match &effect.requirement {
Some(CombatRequirement::AnyDamage) => accumulated_damage > 0.0,
Some(CombatRequirement::SufficientEnergy(r)) => {
Some(CombatRequirement::Energy(r)) => {
if let Some(AttackerInfo {
entity,
energy: Some(e),
@ -252,6 +253,26 @@ impl Attack {
false
}
},
Some(CombatRequirement::Combo(r)) => {
if let Some(AttackerInfo {
entity,
combo: Some(c),
..
}) = attacker
{
let sufficient_combo = c.counter() >= *r;
if sufficient_combo {
emit(ServerEvent::ComboChange {
entity,
change: -(*r as i32),
});
}
sufficient_combo
} else {
false
}
},
None => true,
} {
match effect.effect {
@ -405,7 +426,8 @@ pub enum CombatEffect {
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum CombatRequirement {
AnyDamage,
SufficientEnergy(f32),
Energy(f32),
Combo(u32),
}
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, Serialize, Deserialize)]

View File

@ -132,7 +132,8 @@ impl CharacterBehavior for Data {
let attack = Attack::default()
.with_damage(damage)
.with_crit(crit_chance, crit_mult)
.with_effect(energy);
.with_effect(energy)
.with_combo_increment();
let properties = beam::Properties {
attack,

View File

@ -96,9 +96,8 @@ impl CharacterBehavior for Data {
Some(GroupTarget::InGroup),
CombatEffect::Heal(self.static_data.heal),
)
.with_requirement(CombatRequirement::SufficientEnergy(
self.static_data.energy_cost,
));
.with_requirement(CombatRequirement::Energy(self.static_data.energy_cost))
.with_requirement(CombatRequirement::Combo(1));
let attack = Attack::default().with_effect(heal);
let properties = beam::Properties {

View File

@ -1,8 +1,8 @@
use common::{
combat::{AttackerInfo, TargetInfo},
comp::{
Beam, BeamSegment, Body, Energy, Group, Health, HealthSource, Inventory, Last, Ori, Pos,
Scale, Stats,
Beam, BeamSegment, Body, Combo, Energy, Group, Health, HealthSource, Inventory, Last, Ori,
Pos, Scale, Stats,
},
event::{EventBus, ServerEvent},
resources::{DeltaTime, Time},
@ -35,6 +35,7 @@ pub struct ReadData<'a> {
groups: ReadStorage<'a, Group>,
energies: ReadStorage<'a, Energy>,
stats: ReadStorage<'a, Stats>,
combos: ReadStorage<'a, Combo>,
}
/// This system is responsible for handling beams that heal or do damage
@ -162,6 +163,7 @@ impl<'a> System<'a> for Sys {
entity,
uid,
energy: read_data.energies.get(entity),
combo: read_data.combos.get(entity),
});
let target_info = TargetInfo {

View File

@ -1,6 +1,9 @@
use common::{
combat::{AttackerInfo, TargetInfo},
comp::{Body, CharacterState, Energy, Group, Health, Inventory, Melee, Ori, Pos, Scale, Stats},
comp::{
Body, CharacterState, Combo, Energy, Group, Health, Inventory, Melee, Ori, Pos, Scale,
Stats,
},
event::{EventBus, ServerEvent},
uid::Uid,
util::Dir,
@ -27,6 +30,7 @@ pub struct ReadData<'a> {
char_states: ReadStorage<'a, CharacterState>,
server_bus: Read<'a, EventBus<ServerEvent>>,
stats: ReadStorage<'a, Stats>,
combos: ReadStorage<'a, Combo>,
}
/// This system is responsible for handling accepted inputs like moving or
@ -113,6 +117,7 @@ impl<'a> System<'a> for Sys {
entity: attacker,
uid: *uid,
energy: read_data.energies.get(attacker),
combo: read_data.combos.get(attacker),
});
let target_info = TargetInfo {

View File

@ -1,8 +1,8 @@
use common::{
combat::{AttackerInfo, TargetInfo},
comp::{
projectile, Energy, Group, HealthSource, Inventory, Ori, PhysicsState, Pos, Projectile,
Stats, Vel,
projectile, Combo, Energy, Group, HealthSource, Inventory, Ori, PhysicsState, Pos,
Projectile, Stats, Vel,
},
event::{EventBus, ServerEvent},
resources::DeltaTime,
@ -30,6 +30,7 @@ pub struct ReadData<'a> {
groups: ReadStorage<'a, Group>,
energies: ReadStorage<'a, Energy>,
stats: ReadStorage<'a, Stats>,
combos: ReadStorage<'a, Combo>,
}
/// This system is responsible for handling projectile effect triggers
@ -110,6 +111,7 @@ impl<'a> System<'a> for Sys {
entity,
uid,
energy: read_data.energies.get(entity),
combo: read_data.combos.get(entity),
}
});

View File

@ -1,8 +1,8 @@
use common::{
combat::{AttackerInfo, TargetInfo},
comp::{
Body, Energy, Group, Health, HealthSource, Inventory, Last, Ori, PhysicsState, Pos, Scale,
Shockwave, ShockwaveHitEntities, Stats,
Body, Combo, Energy, Group, Health, HealthSource, Inventory, Last, Ori, PhysicsState, Pos,
Scale, Shockwave, ShockwaveHitEntities, Stats,
},
event::{EventBus, ServerEvent},
resources::{DeltaTime, Time},
@ -36,6 +36,7 @@ pub struct ReadData<'a> {
physics_states: ReadStorage<'a, PhysicsState>,
energies: ReadStorage<'a, Energy>,
stats: ReadStorage<'a, Stats>,
combos: ReadStorage<'a, Combo>,
}
/// This system is responsible for handling accepted inputs like moving or
@ -184,6 +185,7 @@ impl<'a> System<'a> for Sys {
entity,
uid,
energy: read_data.energies.get(entity),
combo: read_data.combos.get(entity),
});
let target_info = TargetInfo {

View File

@ -676,6 +676,7 @@ pub fn handle_explosion(server: &Server, pos: Vec3<f32>, explosion: Explosion, o
},
RadiusEffect::Attack(attack) => {
let energies = &ecs.read_storage::<comp::Energy>();
let combos = &ecs.read_storage::<comp::Combo>();
for (entity_b, pos_b, _health_b, inventory_b_maybe, stats_b_maybe) in (
&ecs.entities(),
&ecs.read_storage::<comp::Pos>(),
@ -715,6 +716,7 @@ pub fn handle_explosion(server: &Server, pos: Vec3<f32>, explosion: Explosion, o
entity,
uid,
energy: energies.get(entity),
combo: combos.get(entity),
});
let target_info = combat::TargetInfo {