combat events init

This commit is contained in:
ntr
2019-04-12 16:09:00 +10:00
parent c0303c5b61
commit 4a081d6ec1
18 changed files with 143 additions and 391 deletions
-3
View File
@@ -25,9 +25,6 @@
* resolve animations + effects
*SERVER*
cryp vbox
update defensives in skill.rs
consolidate buffs debuffs and disables
no more red/blue
+3 -3
View File
@@ -536,7 +536,7 @@ impl Cryp {
skill,
amount: delta,
mitigation: 0,
category: Category::GreenDamage,
colour: Category::GreenDamage,
});
}
}
@@ -584,7 +584,7 @@ impl Cryp {
skill,
amount: delta,
mitigation,
category: Category::RedDamage,
colour: Category::RedDamage,
});
},
true => {
@@ -653,7 +653,7 @@ impl Cryp {
skill,
amount: delta,
mitigation,
category: Category::BlueDamage,
colour: Category::BlueDamage,
});
},
true => {
+2 -2
View File
@@ -512,7 +512,7 @@ impl Game {
fn log_resolution(&mut self, speed: u64, resolution: &Resolution) -> &mut Game {
let Resolution { source, target, event } = resolution;
match event {
Event::Ko =>
Event::Ko { skill: _ }=>
self.log.push(format!("{:} KO!", target.name)),
Event::Disable { skill, disable } =>
@@ -527,7 +527,7 @@ impl Game {
self.log.push(format!("[{:}] {:} {:?} {:} - target is KO",
speed, source.name, skill, target.name)),
Event::Damage { skill, amount, mitigation, category: _ } =>
Event::Damage { skill, amount, mitigation, colour: _ } =>
self.log.push(format!("[{:}] {:} {:?} {:} {:} ({:} mitigated)",
speed, source.name, skill, target.name, amount, mitigation)),
+10 -10
View File
@@ -94,7 +94,7 @@ pub fn resolve(skill: Skill, source: &mut Cryp, target: &mut Cryp, mut resolutio
// have to think
for r in resolutions.clone() {
match r.event {
Event::Damage { amount, skill, mitigation: _, category: _ } => {
Event::Damage { amount, skill, mitigation: _, colour: _ } => {
if target.affected(Effect::Corrupt) {
resolutions = corruption(target, source, resolutions);
}
@@ -113,7 +113,7 @@ pub fn resolve(skill: Skill, source: &mut Cryp, target: &mut Cryp, mut resolutio
// i don't think we need to check the source being ko
if target.is_ko() {
resolutions.push(Resolution::new(source, target).event(Event::Ko));
resolutions.push(Resolution::new(source, target).event(Event::Ko { skill }));
target.effects.clear();
}
@@ -191,7 +191,7 @@ impl Resolution {
pub enum Event {
Disable { skill: Skill, disable: Disable },
Immunity { skill: Skill, immunity: Immunity },
Damage { skill: Skill, amount: u64, mitigation: u64, category: Category },
Damage { skill: Skill, amount: u64, mitigation: u64, colour: Category },
Healing { skill: Skill, amount: u64, overhealing: u64 },
Recharge { skill: Skill, red: u64, blue: u64 },
Inversion { skill: Skill },
@@ -200,8 +200,8 @@ pub enum Event {
Removal { effect: Effect },
Evasion { skill: Skill, evasion_rating: u64 },
TargetKo { skill: Skill },
Ko,
// skill not necessary but makes it neater as all events are arrays in js
Ko { skill: Skill },
Incomplete,
}
@@ -1058,7 +1058,7 @@ fn siphon_tick(source: &mut Cryp, target: &mut Cryp, mut results: Resolutions) -
for e in siphon_events {
match e {
Event::Damage { amount, mitigation: _, category: _, skill: _ } => {
Event::Damage { amount, mitigation: _, colour: _, skill: _ } => {
let dmg = source.deal_green_damage(Skill::Siphon, amount);
for e in dmg {
results.push(Resolution::new(source, target).event(e));
@@ -1168,7 +1168,7 @@ mod tests {
let Resolution { source: _, target: _, event } = results.remove(0);
match event {
Event::Damage { amount, mitigation: _, category: _, skill: _ } => assert_eq!(amount, 50),
Event::Damage { amount, mitigation: _, colour: _, skill: _ } => assert_eq!(amount, 50),
_ => panic!("not damage"),
};
}
@@ -1191,7 +1191,7 @@ mod tests {
let Resolution { source: _, target: _, event } = results.remove(0);
match event {
Event::Damage { amount, mitigation: _, category: _, skill: _ } => assert_eq!(amount, 1023),
Event::Damage { amount, mitigation: _, colour: _, skill: _ } => assert_eq!(amount, 1023),
_ => panic!("not damage"),
};
}
@@ -1273,7 +1273,7 @@ mod tests {
let Resolution { source: _, target: _, event } = results.remove(0);
match event {
Event::Damage { amount, mitigation: _, category: _, skill: _ } => assert_eq!(amount, 256),
Event::Damage { amount, mitigation: _, colour: _, skill: _ } => assert_eq!(amount, 256),
_ => panic!("not damage"),
};
}
@@ -1307,7 +1307,7 @@ mod tests {
let Resolution { source: _, target: _, event } = results.remove(0);
match event {
Event::Damage { amount, skill: _, mitigation: _, category: _} => assert_eq!(amount, 256),
Event::Damage { amount, skill: _, mitigation: _, colour: _} => assert_eq!(amount, 256),
_ => panic!("not damage siphon"),
};
+21 -21
View File
@@ -295,29 +295,29 @@ impl From<Skill> for Var {
impl From<Spec> for Var {
fn from(spec: Spec) -> Var {
match spec {
Spec::Speed => Var::Speed,
Spec::RedSpeedI => Var::RedSpeedI,
Spec::BlueSpeedI => Var::BlueSpeedI,
Spec::GreenSpeedI => Var::GreenSpeedI,
Spec::GRSpeedI => Var::GRSpeedI,
Spec::GBSpeedI => Var::GBSpeedI,
Spec::RBSpeedI => Var::RBSpeedI,
Spec::Speed => Var::Speed,
Spec::RedSpeedI => Var::RedSpeedI,
Spec::BlueSpeedI => Var::BlueSpeedI,
Spec::GreenSpeedI => Var::GreenSpeedI,
Spec::GRSpeedI => Var::GRSpeedI,
Spec::GBSpeedI => Var::GBSpeedI,
Spec::RBSpeedI => Var::RBSpeedI,
Spec::Damage => Var::Damage,
Spec::RedDamageI => Var::RedDamageI,
Spec::BlueDamageI => Var::BlueDamageI,
Spec::GreenDamageI => Var::GreenDamageI,
Spec::GRDI => Var::GRDI,
Spec::GBDI => Var::GBDI,
Spec::RBDI => Var::RBDI,
Spec::Damage => Var::Damage,
Spec::RedDamageI => Var::RedDamageI,
Spec::BlueDamageI => Var::BlueDamageI,
Spec::GreenDamageI => Var::GreenDamageI,
Spec::GRDI => Var::GRDI,
Spec::GBDI => Var::GBDI,
Spec::RBDI => Var::RBDI,
Spec::Life => Var::Life,
Spec::GRLI => Var::GRLI,
Spec::GBLI => Var::GBLI,
Spec::RBLI => Var::RBLI,
Spec::GreenLifeI => Var::GreenLifeI,
Spec::RedLifeI => Var::RedLifeI,
Spec::BlueLifeI => Var::BlueLifeI,
Spec::Life => Var::Life,
Spec::GRLI => Var::GRLI,
Spec::GBLI => Var::GBLI,
Spec::RBLI => Var::RBLI,
Spec::GreenLifeI => Var::GreenLifeI,
Spec::RedLifeI => Var::RedLifeI,
Spec::BlueLifeI => Var::BlueLifeI,
// _ => panic!("{:?} not implemented as a var", spec),
}
}