remove some cruft

This commit is contained in:
ntr
2018-10-29 16:56:43 +11:00
parent 5549e87fab
commit 28238ee812
6 changed files with 73 additions and 106 deletions
+9 -3
View File
@@ -21,7 +21,7 @@ pub struct CrypSkill {
impl CrypSkill {
pub fn new(skill: Skill) -> CrypSkill {
let turns = match skill {
let cd = match skill {
Skill::Attack => None,
Skill::Block => Some(1),
Skill::Dodge => Some(1),
@@ -33,7 +33,7 @@ impl CrypSkill {
CrypSkill {
skill,
cd: turns,
cd,
}
}
@@ -49,6 +49,7 @@ impl CrypSkill {
pub enum Status {
Stunned,
Silenced,
Blocking,
}
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
@@ -264,7 +265,7 @@ impl Cryp {
return roll;
}
pub fn stun(&mut self, roll: Roll) -> &mut Cryp {
pub fn stun(&mut self, _roll: Roll) -> &mut Cryp {
self.statuses.push(CrypStatus { status: Status::Stunned, turns: 1 });
self
}
@@ -274,6 +275,11 @@ impl Cryp {
self
}
pub fn block(&mut self, _roll: Roll) -> &mut Cryp {
self.statuses.push(CrypStatus { status: Status::Blocking, turns: 1 });
self
}
}
pub fn cryp_get(tx: &mut Transaction, id: Uuid, account_id: Uuid) -> Result<Cryp, Error> {
+25
View File
@@ -316,6 +316,8 @@ impl Game {
let mut target = self.cryp_by_id(skill.target_cryp_id.unwrap()).unwrap().clone();
let resolution = skill.resolve(&mut source, &mut target);
// do something with resolution
self.update_cryp(&mut source);
self.update_cryp(&mut target);
}
@@ -785,4 +787,27 @@ mod tests {
assert!(game.team_by_id(y_team.id).cryps[0].skill_on_cd(Skill::Block).is_some());
println!("{:#?}", game);
}
#[test]
fn block_test() {
let mut game = create_test_game();
let x_team = game.teams[0].clone();
let y_team = game.teams[1].clone();
let x_cryp = x_team.cryps[0].clone();
let y_cryp = y_team.cryps[0].clone();
let x_block_id = game.add_skill(x_team.id, x_cryp.id, y_team.id, Skill::TestTouch).unwrap();
let y_attack_id = game.add_skill(y_team.id, y_cryp.id, x_team.id, Skill::TestTouch).unwrap();
game.target_phase_start();
game.add_target(x_team.id, x_cryp.id, y_attack_id).unwrap();
game.add_target(y_team.id, y_cryp.id, x_block_id).unwrap();
game.damage_phase_start();
println!("{:#?}", game);
}
}
+1 -1
View File
@@ -55,7 +55,7 @@ impl Cast {
// the real deal
Skill::Stun => target.stun(roll),
Skill::Attack => target.attack(roll),
Skill::Block => target,
Skill::Block => target.block(roll),
Skill::Heal => target,
Skill::Dodge => target,