compiling"

This commit is contained in:
ntr 2019-09-16 20:02:03 +10:00
parent 48a3f75f0c
commit 2876b24cb3
5 changed files with 61 additions and 85 deletions

View File

@ -74,7 +74,6 @@
grid-template-areas: grid-template-areas:
"skills " "skills "
"effects"; "effects";
width: 100%;
} }
.right { .right {
@ -198,12 +197,12 @@
} }
.combat-anim { .combat-anim {
max-width: 100%; display: flex;
flex-flow: column;
} }
.combat-anim svg { .combat-anim svg {
height: 100%; flex: 1
width: 100%;
} }
.game-construct.red-damage { .game-construct.red-damage {

View File

@ -53,6 +53,7 @@ function createSocket(store) {
timeout - TIMES.POST_SKILL_DURATION_MS timeout - TIMES.POST_SKILL_DURATION_MS
); );
} }
return false;
return setTimeout(() => { return setTimeout(() => {
store.dispatch(actions.setAnimSource(null)); store.dispatch(actions.setAnimSource(null));
store.dispatch(actions.setAnimTarget(null)); store.dispatch(actions.setAnimTarget(null));

View File

@ -1221,55 +1221,55 @@ mod tests {
assert!(game.construct_by_id(y_construct.id).unwrap().affected(Effect::Electrocute)); assert!(game.construct_by_id(y_construct.id).unwrap().affected(Effect::Electrocute));
} }
#[test] // #[test]
fn link_test() { // fn link_test() {
let mut game = create_test_game(); // let mut game = create_test_game();
let x_player = game.players[0].clone(); // let x_player = game.players[0].clone();
let y_player = game.players[1].clone(); // let y_player = game.players[1].clone();
let x_construct = x_player.constructs[0].clone(); // let x_construct = x_player.constructs[0].clone();
let y_construct = y_player.constructs[0].clone(); // let y_construct = y_player.constructs[0].clone();
game.construct_by_id(x_construct.id).unwrap().learn_mut(Skill::Link); // game.construct_by_id(x_construct.id).unwrap().learn_mut(Skill::Link);
while game.construct_by_id(x_construct.id).unwrap().skill_on_cd(Skill::Link).is_some() { // while game.construct_by_id(x_construct.id).unwrap().skill_on_cd(Skill::Link).is_some() {
game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns(); // game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns();
} // }
// apply buff // // apply buff
game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Link).unwrap(); // game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Link).unwrap();
game.player_ready(x_player.id).unwrap(); // game.player_ready(x_player.id).unwrap();
game.player_ready(y_player.id).unwrap(); // game.player_ready(y_player.id).unwrap();
game = game.resolve_phase_start(); // game = game.resolve_phase_start();
assert!(game.construct_by_id(x_construct.id).unwrap().affected(Effect::Link)); // assert!(game.construct_by_id(x_construct.id).unwrap().affected(Effect::Link));
let Resolution { source: _, target: _, event, stages: _ } = game.resolved.pop().unwrap(); // let Resolution { source: _, target: _, event, stages: _ } = game.resolved.pop().unwrap();
match event { // match event {
Event::Effect { effect, skill: _, duration: _, construct_effects: _ } => assert_eq!(effect, Effect::Link), // Event::Effect { effect, skill: _, duration: _, construct_effects: _ } => assert_eq!(effect, Effect::Link),
_ => panic!("not siphon"), // _ => panic!("not siphon"),
}; // };
let Resolution { source: _, target: _, event, stages: _ } = game.resolved.pop().unwrap(); // let Resolution { source: _, target: _, event, stages: _ } = game.resolved.pop().unwrap();
match event { // match event {
Event::Recharge { red: _, blue: _, skill: _ } => (), // Event::Recharge { red: _, blue: _, skill: _ } => (),
_ => panic!("link result was not recharge"), // _ => panic!("link result was not recharge"),
} // }
// attack and receive link hit // // attack and receive link hit
game.add_skill(y_player.id, y_construct.id, x_construct.id, Skill::Attack).unwrap(); // game.add_skill(y_player.id, y_construct.id, x_construct.id, Skill::Attack).unwrap();
game.player_ready(x_player.id).unwrap(); // game.player_ready(x_player.id).unwrap();
game.player_ready(y_player.id).unwrap(); // game.player_ready(y_player.id).unwrap();
game = game.resolve_phase_start(); // game = game.resolve_phase_start();
let Resolution { source: _, target, event, stages: _ } = game.resolved.pop().unwrap(); // let Resolution { source: _, target, event, stages: _ } = game.resolved.pop().unwrap();
assert_eq!(target.id, y_construct.id); // assert_eq!(target.id, y_construct.id);
match event { // match event {
Event::Damage { amount, skill: _, mitigation: _, colour: _} => // Event::Damage { amount, skill: _, mitigation: _, colour: _} =>
assert_eq!(amount, x_construct.red_power().pct(Skill::Attack.multiplier()) >> 1), // assert_eq!(amount, x_construct.red_power().pct(Skill::Attack.multiplier()) >> 1),
_ => panic!("not damage link"), // _ => panic!("not damage link"),
}; // };
} // }
// #[test] // #[test]
// fn absorb_test() { // fn absorb_test() {

View File

@ -273,12 +273,12 @@ mod tests {
// hieroglyph(); // hieroglyph();
// } // }
#[test] // #[test]
fn shapes_img_test() { // fn shapes_img_test() {
for i in 0..100 { // for i in 0..100 {
shapes_write(Uuid::new_v4()).unwrap(); // shapes_write(Uuid::new_v4()).unwrap();
} // }
} // }
} }

View File

@ -177,10 +177,6 @@ pub fn resolve(skill: Skill, source: &mut Construct, target: &mut Construct, mut
Skill::HealPlus | Skill::HealPlus |
Skill::HealPlusPlus => heal(source, target, resolutions, skill), Skill::HealPlusPlus => heal(source, target, resolutions, skill),
Skill::Hex|
Skill::HexPlus |
Skill::HexPlusPlus => hex(source, target, resolutions, skill),
Skill::Absorb| Skill::Absorb|
Skill::AbsorbPlus | Skill::AbsorbPlus |
Skill::AbsorbPlusPlus => absorb(source, target, resolutions, skill), Skill::AbsorbPlusPlus => absorb(source, target, resolutions, skill),
@ -552,12 +548,6 @@ pub enum Skill {
#[serde(rename = "Decay++")] #[serde(rename = "Decay++")]
DecayPlusPlus, DecayPlusPlus,
Hex,
#[serde(rename = "Hex+")]
HexPlus,
#[serde(rename = "Hex++")]
HexPlusPlus,
Haste, Haste,
#[serde(rename = "Haste+")] #[serde(rename = "Haste+")]
HastePlus, HastePlus,
@ -878,10 +868,6 @@ impl Skill {
Skill::HastePlusPlus => vec![ConstructEffect {effect: Effect::Haste, duration: 4, Skill::HastePlusPlus => vec![ConstructEffect {effect: Effect::Haste, duration: 4,
meta: Some(EffectMeta::Multiplier(225)), tick: None }], meta: Some(EffectMeta::Multiplier(225)), tick: None }],
Skill::Hex => vec![ConstructEffect {effect: Effect::Hex, duration: 2, meta: None, tick: None}],
Skill::HexPlus => vec![ConstructEffect {effect: Effect::Hex, duration: 3, meta: None, tick: None}],
Skill::HexPlusPlus => vec![ConstructEffect {effect: Effect::Hex, duration: 4, meta: None, tick: None}],
Skill::Absorb => vec![ConstructEffect {effect: Effect::Absorb, duration: 2, Skill::Absorb => vec![ConstructEffect {effect: Effect::Absorb, duration: 2,
meta: Some(EffectMeta::Skill(Skill::Absorption)), tick: None}], meta: Some(EffectMeta::Skill(Skill::Absorption)), tick: None}],
Skill::AbsorbPlus => vec![ConstructEffect {effect: Effect::Absorb, duration: 3, Skill::AbsorbPlus => vec![ConstructEffect {effect: Effect::Absorb, duration: 3,
@ -1064,10 +1050,6 @@ impl Skill {
Skill::BanishPlus => Some(1), Skill::BanishPlus => Some(1),
Skill::BanishPlusPlus => Some(1), Skill::BanishPlusPlus => Some(1),
Skill::Hex=> Some(1),
Skill::HexPlus => Some(2),
Skill::HexPlusPlus => Some(2),
Skill::Haste=> Some(2), Skill::Haste=> Some(2),
Skill::HastePlus => Some(2), Skill::HastePlus => Some(2),
Skill::HastePlusPlus => Some(2), Skill::HastePlusPlus => Some(2),
@ -1585,12 +1567,6 @@ fn ruin(source: &mut Construct, target: &mut Construct, mut results: Resolutions
return results;; return results;;
} }
fn hex(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions {
results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect()[0])));
return results;;
}
fn absorb(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions { fn absorb(source: &mut Construct, target: &mut Construct, mut results: Resolutions, skill: Skill) -> Resolutions {
results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect()[0]))); results.push(Resolution::new(source, target).event(target.add_effect(skill, skill.effect()[0])));
return results;; return results;;
@ -1724,6 +1700,7 @@ fn purge(source: &mut Construct, target: &mut Construct, mut results: Resolution
.event(Event::Removal { effect: ce.effect, construct_effects: target.effects.clone() })); .event(Event::Removal { effect: ce.effect, construct_effects: target.effects.clone() }));
} }
let effect = skill.effect()[0];
results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)).stages(EventStages::PostOnly)); results.push(Resolution::new(source, target).event(target.add_effect(skill, effect)).stages(EventStages::PostOnly));
/*let mut turns = 1; /*let mut turns = 1;
@ -1734,7 +1711,6 @@ fn purge(source: &mut Construct, target: &mut Construct, mut results: Resolution
} }
if turns > 1 { if turns > 1 {
let mut effect = skill.effect()[0];
effect.duration = effect.duration * turns; effect.duration = effect.duration * turns;
}*/ }*/
@ -1845,7 +1821,7 @@ mod tests {
sustain(&mut y.clone(), &mut y, vec![], Skill::Sustain); sustain(&mut y.clone(), &mut y, vec![], Skill::Sustain);
assert!(y.affected(Effect::Sustain)); assert!(y.affected(Effect::Sustain));
let mut results = hex(&mut x, &mut y, vec![], Skill::Hex); let mut results = blast(&mut x, &mut y, vec![], Skill::Blast);
let Resolution { source: _, target: _, event, stages: _ } = results.remove(0); let Resolution { source: _, target: _, event, stages: _ } = results.remove(0);
match event { match event {
Event::Immunity { skill: _, immunity } => assert!(immunity.contains(&Effect::Sustain)), Event::Immunity { skill: _, immunity } => assert!(immunity.contains(&Effect::Sustain)),