Merge branch 'combos' of ssh://cryps.gg:40022/~/cryps into combos
This commit is contained in:
commit
3fc759f854
@ -175,8 +175,8 @@ module.exports = {
|
||||
{ name: 'Decay',
|
||||
description:
|
||||
'afflict a cryp with a blue damage based damage over time debuff' },
|
||||
{ name: 'Drain',
|
||||
description: 'drain hp from target cryp with a blue damage based debuff' },
|
||||
{ name: 'Siphon',
|
||||
description: 'siphon hp from target cryp with a blue damage based debuff' },
|
||||
{ name: 'Empower',
|
||||
description: 'increase the red damage dealt by a cryp' },
|
||||
{ name: 'Haste',
|
||||
|
||||
@ -847,7 +847,7 @@ mod tests {
|
||||
.learn(Skill::TestTouch)
|
||||
.learn(Skill::TestBlock)
|
||||
.learn(Skill::TestParry)
|
||||
.learn(Skill::TestDrain)
|
||||
.learn(Skill::TestSiphon)
|
||||
.learn(Skill::Empower)
|
||||
.learn(Skill::Stun)
|
||||
.learn(Skill::Block)
|
||||
@ -861,7 +861,7 @@ mod tests {
|
||||
.learn(Skill::TestTouch)
|
||||
.learn(Skill::TestBlock)
|
||||
.learn(Skill::TestParry)
|
||||
.learn(Skill::TestDrain)
|
||||
.learn(Skill::TestSiphon)
|
||||
.learn(Skill::Empower)
|
||||
.learn(Skill::Stun)
|
||||
.learn(Skill::Block)
|
||||
@ -1081,7 +1081,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn drain_test() {
|
||||
fn siphon_test() {
|
||||
let mut game = create_test_game();
|
||||
|
||||
let x_team = game.teams[0].clone();
|
||||
@ -1090,7 +1090,7 @@ mod tests {
|
||||
let x_cryp = x_team.cryps[0].clone();
|
||||
let y_cryp = y_team.cryps[0].clone();
|
||||
|
||||
let _x_drain_id = game.add_skill(x_team.id, x_cryp.id, Some(y_cryp.id), Skill::TestDrain).unwrap();
|
||||
let _x_siphon_id = game.add_skill(x_team.id, x_cryp.id, Some(y_cryp.id), Skill::TestSiphon).unwrap();
|
||||
let _y_touch_id = game.add_skill(y_team.id, y_cryp.id, Some(x_cryp.id), Skill::TestTouch).unwrap();
|
||||
|
||||
game.resolve_phase_start();
|
||||
@ -1100,7 +1100,7 @@ mod tests {
|
||||
|
||||
game.resolve_phase_start();
|
||||
|
||||
assert!(game.resolved.iter().any(|r| r.skill == Skill::DrainTick));
|
||||
assert!(game.resolved.iter().any(|r| r.skill == Skill::SiphonTick));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@ -938,7 +938,7 @@ mod tests {
|
||||
.learn(Skill::TestTouch)
|
||||
.learn(Skill::TestBlock)
|
||||
.learn(Skill::TestParry)
|
||||
.learn(Skill::TestDrain)
|
||||
.learn(Skill::TestSiphon)
|
||||
.learn(Skill::Empower)
|
||||
.learn(Skill::Block)
|
||||
.create();
|
||||
@ -950,7 +950,7 @@ mod tests {
|
||||
.learn(Skill::TestTouch)
|
||||
.learn(Skill::TestBlock)
|
||||
.learn(Skill::TestParry)
|
||||
.learn(Skill::TestDrain)
|
||||
.learn(Skill::TestSiphon)
|
||||
.learn(Skill::Empower)
|
||||
.learn(Skill::Block)
|
||||
.create();
|
||||
@ -1194,7 +1194,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn drain_test() {
|
||||
fn siphon_test() {
|
||||
let mut game = create_test_game();
|
||||
|
||||
let x_team = game.teams[0].clone();
|
||||
@ -1203,13 +1203,13 @@ mod tests {
|
||||
let x_cryp = x_team.cryps[0].clone();
|
||||
let y_cryp = y_team.cryps[0].clone();
|
||||
|
||||
let x_drain_id = game.add_skill(x_team.id, x_cryp.id, Some(y_team.id), Skill::TestDrain).unwrap();
|
||||
let x_siphon_id = game.add_skill(x_team.id, x_cryp.id, Some(y_team.id), Skill::TestSiphon).unwrap();
|
||||
let y_touch_id = game.add_skill(y_team.id, y_cryp.id, Some(x_team.id), Skill::TestTouch).unwrap();
|
||||
|
||||
game.target_phase_start();
|
||||
|
||||
game.add_target(x_team.id, x_cryp.id, y_touch_id).unwrap();
|
||||
game.add_target(y_team.id, y_cryp.id, x_drain_id).unwrap();
|
||||
game.add_target(y_team.id, y_cryp.id, x_siphon_id).unwrap();
|
||||
|
||||
game.resolve_phase_start();
|
||||
|
||||
@ -1218,7 +1218,7 @@ mod tests {
|
||||
|
||||
game.target_phase_start();
|
||||
|
||||
assert!(game.resolved.iter().any(|r| r.skill == Skill::DrainTick));
|
||||
assert!(game.resolved.iter().any(|r| r.skill == Skill::SiphonTick));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@ -291,7 +291,7 @@ impl Rpc {
|
||||
let cryp = cryp_spawn(CrypSpawnParams { name }, tx, &account)?;
|
||||
cryp_learn(CrypLearnParams { id: cryp.id, skill: Skill::Decay }, tx, &account)?;
|
||||
cryp_learn(CrypLearnParams { id: cryp.id, skill: Skill::Blast }, tx, &account)?;
|
||||
cryp_learn(CrypLearnParams { id: cryp.id, skill: Skill::Drain }, tx, &account)?;
|
||||
cryp_learn(CrypLearnParams { id: cryp.id, skill: Skill::Siphon }, tx, &account)?;
|
||||
|
||||
let name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
|
||||
let cryp = cryp_spawn(CrypSpawnParams { name }, tx, &account)?;
|
||||
|
||||
@ -125,9 +125,9 @@ pub enum Effect {
|
||||
Triage,
|
||||
Decay,
|
||||
Regen,
|
||||
Drain,
|
||||
Siphon,
|
||||
|
||||
SpeedDrain,
|
||||
SpeedSiphon,
|
||||
SpeedIncrease,
|
||||
|
||||
Ko,
|
||||
@ -249,9 +249,9 @@ impl Effect {
|
||||
Effect::Triage => Category::BlueBuff,
|
||||
Effect::Decay => Category::BlueDebuff,
|
||||
Effect::Regen => Category::BlueBuff,
|
||||
Effect::Drain => Category::BlueDebuff,
|
||||
Effect::Siphon => Category::BlueDebuff,
|
||||
|
||||
Effect::SpeedDrain => Category::BlueDebuff,
|
||||
Effect::SpeedSiphon => Category::BlueDebuff,
|
||||
Effect::SpeedIncrease => Category::BlueBuff,
|
||||
|
||||
Effect::Ko => Category::Ko,
|
||||
@ -283,7 +283,7 @@ impl Effect {
|
||||
|
||||
Effect::Triage => 3,
|
||||
Effect::Decay => 3,
|
||||
Effect::Drain => 2,
|
||||
Effect::Siphon => 2,
|
||||
|
||||
_ => {
|
||||
println!("{:?} does not have a duration", self);
|
||||
@ -360,8 +360,8 @@ pub enum Skill {
|
||||
Amplify,
|
||||
Decay, // dot
|
||||
DecayTick, // dot
|
||||
Drain,
|
||||
DrainTick,
|
||||
Siphon,
|
||||
SiphonTick,
|
||||
Curse,
|
||||
Plague, // aoe dot
|
||||
Ruin, // aoe
|
||||
@ -394,7 +394,7 @@ pub enum Skill {
|
||||
TestStun,
|
||||
TestBlock,
|
||||
TestParry,
|
||||
TestDrain,
|
||||
TestSiphon,
|
||||
}
|
||||
|
||||
impl Skill {
|
||||
@ -443,8 +443,8 @@ impl Skill {
|
||||
Skill::Amplify => Some(1),
|
||||
Skill::Decay => None, // dot
|
||||
Skill::DecayTick => None,
|
||||
Skill::Drain => Some(1),
|
||||
Skill::DrainTick => None,
|
||||
Skill::Siphon => Some(1),
|
||||
Skill::SiphonTick => None,
|
||||
Skill::Curse => Some(1),
|
||||
Skill::Plague => Some(1), // aoe dot
|
||||
Skill::Ruin => Some(2), // aoe
|
||||
@ -478,7 +478,7 @@ impl Skill {
|
||||
Skill::TestTouch => None,
|
||||
Skill::TestStun => None,
|
||||
Skill::TestBlock => None,
|
||||
Skill::TestDrain => None,
|
||||
Skill::TestSiphon => None,
|
||||
Skill::TestParry => None,
|
||||
}
|
||||
}
|
||||
@ -528,8 +528,8 @@ impl Skill {
|
||||
Skill::Amplify => Category::Blue,
|
||||
Skill::Decay => Category::Blue, // dot
|
||||
Skill::DecayTick => Category::BlueTick, // hot
|
||||
Skill::Drain => Category::Blue,
|
||||
Skill::DrainTick => Category::BlueTick, // hot
|
||||
Skill::Siphon => Category::Blue,
|
||||
Skill::SiphonTick => Category::BlueTick, // hot
|
||||
Skill::Curse => Category::Blue,
|
||||
Skill::Plague => Category::Blue, // aoe dot
|
||||
Skill::Ruin => Category::Blue, // aoe
|
||||
@ -566,7 +566,7 @@ impl Skill {
|
||||
Skill::TestStun => Category::Red,
|
||||
Skill::TestParry => Category::Red,
|
||||
Skill::TestBlock => Category::Red,
|
||||
Skill::TestDrain => Category::Blue,
|
||||
Skill::TestSiphon => Category::Blue,
|
||||
}
|
||||
}
|
||||
|
||||
@ -574,7 +574,7 @@ impl Skill {
|
||||
match self {
|
||||
Skill::TriageTick => true,
|
||||
Skill::DecayTick => true,
|
||||
Skill::DrainTick => true,
|
||||
Skill::SiphonTick => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
@ -607,8 +607,8 @@ impl Skill {
|
||||
|
||||
// general combat
|
||||
Skill::DecayTick => 2, // hot
|
||||
Skill::Drain => 2,
|
||||
Skill::DrainTick => 2, // hot
|
||||
Skill::Siphon => 2,
|
||||
Skill::SiphonTick => 2, // hot
|
||||
Skill::Hex => 2,
|
||||
Skill::Pause => 2, // extend durations
|
||||
Skill::Plague => 2, // aoe dot
|
||||
@ -644,7 +644,7 @@ impl Skill {
|
||||
Skill::TestStun => 5,
|
||||
Skill::TestBlock => 10,
|
||||
Skill::TestParry => 10,
|
||||
Skill::TestDrain => 10,
|
||||
Skill::TestSiphon => 10,
|
||||
}
|
||||
}
|
||||
|
||||
@ -715,8 +715,8 @@ impl Skill {
|
||||
Skill::Amplify => amplify(source, target, resolution), // increase magic damage
|
||||
Skill::Decay => decay(source, target, resolution), // dot
|
||||
Skill::DecayTick => decay_tick(source, target, resolution), // dot
|
||||
Skill::Drain => drain(source, target, resolution),
|
||||
Skill::DrainTick => drain_tick(source, target, resolution), // hot
|
||||
Skill::Siphon => siphon(source, target, resolution),
|
||||
Skill::SiphonTick => siphon_tick(source, target, resolution), // hot
|
||||
Skill::Curse => curse(source, target, resolution),
|
||||
Skill::Plague => panic!("nyi"), // dot that spreads every turn
|
||||
Skill::Ruin => panic!("nyi"), // aoe version of blast
|
||||
@ -751,7 +751,7 @@ impl Skill {
|
||||
Skill::TestStun => stun(source, target, resolution),
|
||||
Skill::TestBlock => block(source, target, resolution),
|
||||
Skill::TestParry => parry(source, target, resolution),
|
||||
Skill::TestDrain => drain(source, target, resolution),
|
||||
Skill::TestSiphon => siphon(source, target, resolution),
|
||||
}
|
||||
}
|
||||
|
||||
@ -915,28 +915,28 @@ fn curse(_cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Res
|
||||
return resolution;;
|
||||
}
|
||||
|
||||
fn drain(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
|
||||
let drain = CrypEffect {
|
||||
effect: Effect::Drain,
|
||||
duration: Effect::Drain.duration(),
|
||||
tick: Some(Cast::new_tick(cryp, target, Skill::DrainTick)),
|
||||
fn siphon(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
|
||||
let siphon = CrypEffect {
|
||||
effect: Effect::Siphon,
|
||||
duration: Effect::Siphon.duration(),
|
||||
tick: Some(Cast::new_tick(cryp, target, Skill::SiphonTick)),
|
||||
};
|
||||
resolution.results.push(target.add_effect(Skill::Drain, drain));
|
||||
resolution.results.push(target.add_effect(Skill::Siphon, siphon));
|
||||
return resolution;;
|
||||
}
|
||||
|
||||
fn drain_tick(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
|
||||
fn siphon_tick(cryp: &mut Cryp, target: &mut Cryp, mut resolution: Resolution) -> Resolution {
|
||||
let amount = cryp.blue_damage();
|
||||
let drain_damage = target.deal_blue_damage(Skill::DrainTick, amount);
|
||||
resolution.results.push(drain_damage.clone());
|
||||
let siphon_damage = target.deal_blue_damage(Skill::SiphonTick, amount);
|
||||
resolution.results.push(siphon_damage.clone());
|
||||
|
||||
match drain_damage {
|
||||
match siphon_damage {
|
||||
ResolutionResult::Damage { amount, mitigation, category: _, immunity } => {
|
||||
if !immunity.immune {
|
||||
resolution.results.push(cryp.heal(Skill::Heal, amount));
|
||||
}
|
||||
},
|
||||
_ => panic!("drain tick damage not dealt {:?}", drain_damage),
|
||||
_ => panic!("siphon tick damage not dealt {:?}", siphon_damage),
|
||||
}
|
||||
|
||||
return resolution;
|
||||
|
||||
@ -18,7 +18,7 @@ use rpc::{VboxStateParams, VboxAcceptParams, VboxDiscardParams, VboxCombineParam
|
||||
use skill::{Skill};
|
||||
use cryp::{cryp_get, cryp_write};
|
||||
|
||||
#[derive(Debug,Clone,Copy,PartialEq,Eq,Ord,PartialOrd,Serialize,Deserialize)]
|
||||
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
|
||||
pub enum Var {
|
||||
Blue,
|
||||
Green,
|
||||
@ -50,6 +50,8 @@ pub enum Var {
|
||||
Snare,
|
||||
Strangle,
|
||||
Strike,
|
||||
Siphon,
|
||||
Survival,
|
||||
Taunt,
|
||||
Throw,
|
||||
Toxic,
|
||||
@ -90,18 +92,17 @@ impl Var {
|
||||
Var::Snare => Ok(Skill::Snare),
|
||||
Var::Strangle => Ok(Skill::Strangle),
|
||||
// Var::Strike => Ok(Skill::Strike),
|
||||
// Var::Survival => Ok(Skill::Survival),
|
||||
// Var::Taunt => Ok(Skill::Taunt),
|
||||
Var::Throw => Ok(Skill::Throw),
|
||||
// Var::Toxic => Ok(Skill::Toxic),
|
||||
Var::Triage => Ok(Skill::Triage),
|
||||
|
||||
|
||||
_ => Err(err_msg("not a usable var"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug,Clone,Copy,PartialEq,Eq,Ord,PartialOrd,Serialize,Deserialize)]
|
||||
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
|
||||
enum ColourCode {
|
||||
RR,
|
||||
GG,
|
||||
@ -239,16 +240,16 @@ impl Vbox {
|
||||
ColourCode::RR => Var::Parry,
|
||||
ColourCode::GG => Var::Reflect,
|
||||
ColourCode::BB => Var::Toxic,
|
||||
ColourCode::RG => Var::Shield, //
|
||||
ColourCode::GB => return Err(err_msg("unhandled skill combo")),
|
||||
ColourCode::BR => Var::Taunt,
|
||||
ColourCode::RG => Var::Taunt,
|
||||
ColourCode::GB => Var::Shield,
|
||||
ColourCode::BR => return Err(err_msg("unhandled skill combo")),
|
||||
},
|
||||
Var::Buff => match colour_code {
|
||||
ColourCode::RR => Var::Empower,
|
||||
ColourCode::GG => Var::Triage,
|
||||
ColourCode::BB => Var::Amplify,
|
||||
ColourCode::RG => return Err(err_msg("unhandled skill combo")),
|
||||
ColourCode::GB => Var::Purify,
|
||||
ColourCode::RG => Var::Survival,
|
||||
ColourCode::GB => return Err(err_msg("unhandled skill combo")),
|
||||
ColourCode::BR => Var::Haste,
|
||||
},
|
||||
Var::Debuff => match colour_code {
|
||||
@ -256,16 +257,16 @@ impl Vbox {
|
||||
ColourCode::GG => Var::Purge,
|
||||
ColourCode::BB => Var::Curse,
|
||||
ColourCode::RG => return Err(err_msg("unhandled skill combo")),
|
||||
ColourCode::GB => return Err(err_msg("unhandled skill combo")),
|
||||
ColourCode::BR => Var::Slow, //
|
||||
ColourCode::GB => Var::Siphon,
|
||||
ColourCode::BR => Var::Slow,
|
||||
},
|
||||
Var::Stun => match colour_code {
|
||||
ColourCode::RR => Var::Strangle,
|
||||
ColourCode::GG => Var::Throw,
|
||||
ColourCode::BB => Var::Ruin,
|
||||
ColourCode::RG => Var::Silence, //
|
||||
ColourCode::GB => return Err(err_msg("unhandled skill combo")),
|
||||
ColourCode::BR => Var::Hex, //
|
||||
ColourCode::RG => return Err(err_msg("unhandled skill combo")),
|
||||
ColourCode::GB => Var::Silence,
|
||||
ColourCode::BR => Var::Hex,
|
||||
},
|
||||
_ => panic!("wrong base {:?}", base),
|
||||
};
|
||||
@ -308,7 +309,7 @@ pub fn vbox_write(vbox: Vbox, tx: &mut Transaction) -> Result<Vbox, Error> {
|
||||
let result = tx
|
||||
.query(query, &[&vbox_bytes, &vbox.id])?;
|
||||
|
||||
let _returned = result.iter().next().expect("no row returned");
|
||||
result.iter().next().ok_or(err_msg("no vbox row returned"))?;
|
||||
|
||||
// println!("{:?} wrote vbox", vbox.id);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user