remove self targeting
This commit is contained in:
parent
8cbaf2d597
commit
3cb15a8c1e
@ -92,13 +92,14 @@ function Play(args) {
|
||||
<section class="top">
|
||||
<div class="news">
|
||||
<h1>v{VERSION}</h1>
|
||||
<p>use the buttons on the right to join an instance.</p>
|
||||
<p>Use the buttons on the right to join an instance.</p>
|
||||
<p>
|
||||
select <b>PVP</b> to play against other players.<br />
|
||||
click <b>LEARN</b> to practice the game without time controls.
|
||||
Select <b>PVP</b> to play against other players.<br />
|
||||
Select <b>INVITE</b> then click <b>COPY LINK</b> to generate an instance invitation for a friend.<br />
|
||||
Click <b>LEARN</b> to practice the game without time controls.
|
||||
</p>
|
||||
<p>
|
||||
if you enjoy the game please support its development by <b>subscribing</b> or purchasing <b>credits</b>.<br />
|
||||
If you enjoy the game please support its development by <b>subscribing</b> or purchasing <b>credits</b>.<br />
|
||||
glhf
|
||||
</p>
|
||||
<p>--ntr & mashy</p>
|
||||
|
||||
@ -46,7 +46,6 @@ impl Colours {
|
||||
#[derive(Debug,Clone,Copy,PartialEq,Serialize,Deserialize)]
|
||||
pub struct ConstructSkill {
|
||||
pub skill: Skill,
|
||||
pub self_targeting: bool,
|
||||
pub cd: Cooldown,
|
||||
// used for Uon client
|
||||
pub disabled: bool,
|
||||
@ -56,7 +55,6 @@ impl ConstructSkill {
|
||||
pub fn new(skill: Skill) -> ConstructSkill {
|
||||
ConstructSkill {
|
||||
skill,
|
||||
self_targeting: skill.self_targeting(),
|
||||
cd: skill.base_cd(),
|
||||
disabled: false,
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ impl Game {
|
||||
target = find_target();
|
||||
}
|
||||
|
||||
pve_skills.push((mobs.id, mob.id, Some(target.id), s));
|
||||
pve_skills.push((mobs.id, mob.id, target.id, s));
|
||||
},
|
||||
None => continue,
|
||||
};
|
||||
@ -258,7 +258,7 @@ impl Game {
|
||||
self
|
||||
}
|
||||
|
||||
fn add_skill(&mut self, player_id: Uuid, source_construct_id: Uuid, target_construct_id: Option<Uuid>, skill: Skill) -> Result<&mut Game, Error> {
|
||||
fn add_skill(&mut self, player_id: Uuid, source_construct_id: Uuid, target_construct_id: Uuid, skill: Skill) -> Result<&mut Game, Error> {
|
||||
// check player in game
|
||||
self.player_by_id(player_id)?;
|
||||
|
||||
@ -266,17 +266,9 @@ impl Game {
|
||||
return Err(err_msg("game not in skill phase"));
|
||||
}
|
||||
|
||||
let final_target_id = match skill.self_targeting() {
|
||||
true => source_construct_id,
|
||||
false => match target_construct_id {
|
||||
Some(t) => t,
|
||||
None => return Err(err_msg("skill requires a target")),
|
||||
}
|
||||
};
|
||||
|
||||
// target checks
|
||||
{
|
||||
let target = match self.construct_by_id(final_target_id) {
|
||||
let target = match self.construct_by_id(target_construct_id) {
|
||||
Some(c) => c,
|
||||
None => return Err(err_msg("target construct not in game")),
|
||||
};
|
||||
@ -318,7 +310,7 @@ impl Game {
|
||||
self.stack.remove(s);
|
||||
}
|
||||
|
||||
let skill = Cast::new(source_construct_id, player_id, final_target_id, skill);
|
||||
let skill = Cast::new(source_construct_id, player_id, target_construct_id, skill);
|
||||
self.stack.push(skill);
|
||||
|
||||
return Ok(self);
|
||||
@ -887,7 +879,7 @@ fn game_json_file_write(g: &Game) -> Result<String, Error> {
|
||||
Ok(dest)
|
||||
}
|
||||
|
||||
pub fn game_skill(tx: &mut Transaction, account: &Account, game_id: Uuid, construct_id: Uuid, target_construct_id: Option<Uuid>, skill: Skill) -> Result<Game, Error> {
|
||||
pub fn game_skill(tx: &mut Transaction, account: &Account, game_id: Uuid, construct_id: Uuid, target_construct_id: Uuid, skill: Skill) -> Result<Game, Error> {
|
||||
let mut game = game_get(tx, game_id)?;
|
||||
|
||||
game.add_skill(account.id, construct_id, target_construct_id, skill)?;
|
||||
@ -1039,8 +1031,8 @@ mod tests {
|
||||
let x_construct = x_player.constructs[0].clone();
|
||||
let y_construct = y_player.constructs[0].clone();
|
||||
|
||||
game.add_skill(x_player.id, x_construct.id, Some(y_construct.id), Skill::Attack).unwrap();
|
||||
game.add_skill(y_player.id, y_construct.id, Some(x_construct.id), Skill::Attack).unwrap();
|
||||
game.add_skill(x_player.id, x_construct.id, y_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(y_player.id).unwrap();
|
||||
@ -1068,8 +1060,8 @@ mod tests {
|
||||
game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns();
|
||||
}
|
||||
|
||||
game.add_skill(x_player.id, x_construct.id, Some(y_construct.id), Skill::Stun).unwrap();
|
||||
game.add_skill(y_player.id, y_construct.id, Some(x_construct.id), Skill::Attack).unwrap();
|
||||
game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Stun).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(y_player.id).unwrap();
|
||||
@ -1105,8 +1097,8 @@ mod tests {
|
||||
// remove all mitigation
|
||||
game.player_by_id(x_player.id).unwrap().construct_by_id(x_construct.id).unwrap().red_life.force(0);
|
||||
|
||||
game.add_skill(x_player.id, x_construct.id, Some(y_construct.id), Skill::Stun).unwrap();
|
||||
game.add_skill(y_player.id, y_construct.id, Some(x_construct.id), Skill::Attack).unwrap();
|
||||
game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Stun).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(y_player.id).unwrap();
|
||||
@ -1135,8 +1127,8 @@ mod tests {
|
||||
assert!(game.player_by_id(y_player.id).unwrap().constructs[0].skill_on_cd(Skill::Stun).is_some());
|
||||
assert!(game.player_by_id(x_player.id).unwrap().constructs[0].skill_on_cd(Skill::Block).is_none());
|
||||
|
||||
game.add_skill(x_player.id, x_construct.id, Some(y_construct.id), Skill::Attack).unwrap();
|
||||
game.add_skill(y_player.id, y_construct.id, Some(x_construct.id), Skill::Attack).unwrap();
|
||||
game.add_skill(x_player.id, x_construct.id, y_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(y_player.id).unwrap();
|
||||
@ -1149,8 +1141,8 @@ mod tests {
|
||||
|
||||
// second round
|
||||
// now we block and it should go back on cd
|
||||
// game.add_skill(x_player.id, x_construct.id, Some(y_construct.id), Skill::Stun).unwrap();
|
||||
game.add_skill(y_player.id, y_construct.id, Some(x_construct.id), Skill::Attack).unwrap();
|
||||
// game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Stun).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(y_player.id).unwrap();
|
||||
@ -1179,8 +1171,8 @@ mod tests {
|
||||
game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns();
|
||||
}
|
||||
|
||||
game.add_skill(x_player.id, x_construct.id, None, Skill::Counter).unwrap();
|
||||
game.add_skill(y_player.id, y_construct.id, Some(x_construct.id), Skill::Stun).unwrap();
|
||||
game.add_skill(x_player.id, x_construct.id, x_construct.id, Skill::Counter).unwrap();
|
||||
game.add_skill(y_player.id, y_construct.id, x_construct.id, Skill::Stun).unwrap();
|
||||
|
||||
game.player_ready(x_player.id).unwrap();
|
||||
game.player_ready(y_player.id).unwrap();
|
||||
@ -1214,14 +1206,14 @@ mod tests {
|
||||
}
|
||||
|
||||
// apply buff
|
||||
game.add_skill(x_player.id, x_construct.id, Some(x_construct.id), Skill::Electrify).unwrap();
|
||||
game.add_skill(x_player.id, x_construct.id, x_construct.id, Skill::Electrify).unwrap();
|
||||
game.player_ready(x_player.id).unwrap();
|
||||
game.player_ready(y_player.id).unwrap();
|
||||
game = game.resolve_phase_start();
|
||||
assert!(game.construct_by_id(x_construct.id).unwrap().affected(Effect::Electric));
|
||||
|
||||
// attack and receive debuff
|
||||
game.add_skill(y_player.id, y_construct.id, Some(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(y_player.id).unwrap();
|
||||
game = game.resolve_phase_start();
|
||||
@ -1246,7 +1238,7 @@ mod tests {
|
||||
}
|
||||
|
||||
// apply buff
|
||||
game.add_skill(x_player.id, x_construct.id, Some(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(y_player.id).unwrap();
|
||||
game = game.resolve_phase_start();
|
||||
@ -1265,7 +1257,7 @@ mod tests {
|
||||
}
|
||||
|
||||
// attack and receive link hit
|
||||
game.add_skill(y_player.id, y_construct.id, Some(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(y_player.id).unwrap();
|
||||
game = game.resolve_phase_start();
|
||||
@ -1296,14 +1288,14 @@ mod tests {
|
||||
// }
|
||||
|
||||
// // apply buff
|
||||
// game.add_skill(x_player.id, x_construct.id, Some(x_construct.id), Skill::Absorb).unwrap();
|
||||
// game.add_skill(x_player.id, x_construct.id, x_construct.id, Skill::Absorb).unwrap();
|
||||
// game.player_ready(x_player.id).unwrap();
|
||||
// game.player_ready(y_player.id).unwrap();
|
||||
// game = game.resolve_phase_start();
|
||||
// assert!(game.construct_by_id(x_construct.id).unwrap().affected(Effect::Absorb));
|
||||
|
||||
// // attack and receive debuff
|
||||
// game.add_skill(y_player.id, y_construct.id, Some(x_construct.id), Skill::TestAttack).unwrap();
|
||||
// game.add_skill(y_player.id, y_construct.id, x_construct.id, Skill::TestAttack).unwrap();
|
||||
// game.player_ready(x_player.id).unwrap();
|
||||
// game.player_ready(y_player.id).unwrap();
|
||||
// game = game.resolve_phase_start();
|
||||
@ -1330,10 +1322,10 @@ mod tests {
|
||||
game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns();
|
||||
}
|
||||
|
||||
game.add_skill(i_player.id, i_construct.id, Some(x_construct.id), Skill::Attack).unwrap();
|
||||
game.add_skill(i_player.id, j_construct.id, Some(x_construct.id), Skill::Attack).unwrap();
|
||||
game.add_skill(x_player.id, x_construct.id, Some(i_construct.id), Skill::Ruin).unwrap();
|
||||
game.add_skill(x_player.id, y_construct.id, Some(i_construct.id), Skill::Attack).unwrap();
|
||||
game.add_skill(i_player.id, i_construct.id, x_construct.id, Skill::Attack).unwrap();
|
||||
game.add_skill(i_player.id, j_construct.id, x_construct.id, Skill::Attack).unwrap();
|
||||
game.add_skill(x_player.id, x_construct.id, i_construct.id, Skill::Ruin).unwrap();
|
||||
game.add_skill(x_player.id, y_construct.id, i_construct.id, Skill::Attack).unwrap();
|
||||
|
||||
game.player_ready(i_player.id).unwrap();
|
||||
game.player_ready(x_player.id).unwrap();
|
||||
@ -1380,10 +1372,10 @@ mod tests {
|
||||
game.construct_by_id(x_construct.id).unwrap().reduce_cooldowns();
|
||||
}
|
||||
|
||||
game.add_skill(i_player.id, i_construct.id, Some(x_construct.id), Skill::Attack).unwrap();
|
||||
game.add_skill(i_player.id, j_construct.id, Some(x_construct.id), Skill::Attack).unwrap();
|
||||
game.add_skill(x_player.id, x_construct.id, Some(i_construct.id), Skill::Intercept).unwrap();
|
||||
game.add_skill(x_player.id, y_construct.id, Some(i_construct.id), Skill::Attack).unwrap();
|
||||
game.add_skill(i_player.id, i_construct.id, x_construct.id, Skill::Attack).unwrap();
|
||||
game.add_skill(i_player.id, j_construct.id, x_construct.id, Skill::Attack).unwrap();
|
||||
game.add_skill(x_player.id, x_construct.id, i_construct.id, Skill::Intercept).unwrap();
|
||||
game.add_skill(x_player.id, y_construct.id, i_construct.id, Skill::Attack).unwrap();
|
||||
|
||||
game.player_ready(i_player.id).unwrap();
|
||||
game.player_ready(x_player.id).unwrap();
|
||||
@ -1411,10 +1403,10 @@ mod tests {
|
||||
let x_construct = x_player.constructs[0].clone();
|
||||
let y_construct = x_player.constructs[1].clone();
|
||||
|
||||
game.add_skill(i_player.id, i_construct.id, Some(x_construct.id), Skill::Attack).unwrap()
|
||||
.add_skill(i_player.id, j_construct.id, Some(x_construct.id), Skill::Attack).unwrap()
|
||||
.add_skill(x_player.id, x_construct.id, Some(i_construct.id), Skill::Attack).unwrap()
|
||||
.add_skill(x_player.id, y_construct.id, Some(i_construct.id), Skill::Attack).unwrap()
|
||||
game.add_skill(i_player.id, i_construct.id, x_construct.id, Skill::Attack).unwrap()
|
||||
.add_skill(i_player.id, j_construct.id, x_construct.id, Skill::Attack).unwrap()
|
||||
.add_skill(x_player.id, x_construct.id, i_construct.id, Skill::Attack).unwrap()
|
||||
.add_skill(x_player.id, y_construct.id, i_construct.id, Skill::Attack).unwrap()
|
||||
.player_ready(i_player.id).unwrap()
|
||||
.player_ready(x_player.id).unwrap();
|
||||
|
||||
@ -1430,10 +1422,10 @@ mod tests {
|
||||
assert!(game.player_by_id(x_player.id).unwrap().skills_required() == 2);
|
||||
|
||||
// add some more skills
|
||||
game.add_skill(i_player.id, j_construct.id, Some(x_construct.id), Skill::Attack).unwrap();
|
||||
game.add_skill(x_player.id, x_construct.id, Some(j_construct.id), Skill::Attack).unwrap();
|
||||
game.add_skill(x_player.id, y_construct.id, Some(j_construct.id), Skill::Attack).unwrap();
|
||||
assert!(game.add_skill(x_player.id, x_construct.id, Some(i_construct.id), Skill::Attack).is_err());
|
||||
game.add_skill(i_player.id, j_construct.id, x_construct.id, Skill::Attack).unwrap();
|
||||
game.add_skill(x_player.id, x_construct.id, j_construct.id, Skill::Attack).unwrap();
|
||||
game.add_skill(x_player.id, y_construct.id, j_construct.id, Skill::Attack).unwrap();
|
||||
assert!(game.add_skill(x_player.id, x_construct.id, i_construct.id, Skill::Attack).is_err());
|
||||
|
||||
game.player_ready(i_player.id).unwrap();
|
||||
game.player_ready(x_player.id).unwrap();
|
||||
@ -1475,7 +1467,7 @@ mod tests {
|
||||
}
|
||||
|
||||
// apply buff
|
||||
game.add_skill(x_player.id, x_construct.id, Some(y_construct.id), Skill::Decay).unwrap();
|
||||
game.add_skill(x_player.id, x_construct.id, y_construct.id, Skill::Decay).unwrap();
|
||||
game.player_ready(x_player.id).unwrap();
|
||||
game.player_ready(y_player.id).unwrap();
|
||||
game = game.resolve_phase_start();
|
||||
@ -1490,7 +1482,7 @@ mod tests {
|
||||
game.resolved.clear();
|
||||
|
||||
// remove
|
||||
game.add_skill(y_player.id, y_construct.id, Some(y_construct.id), Skill::Purify).unwrap();
|
||||
game.add_skill(y_player.id, y_construct.id, y_construct.id, Skill::Purify).unwrap();
|
||||
game.player_ready(x_player.id).unwrap();
|
||||
game.player_ready(y_player.id).unwrap();
|
||||
game = game.resolve_phase_start();
|
||||
@ -1503,14 +1495,14 @@ mod tests {
|
||||
}
|
||||
};
|
||||
|
||||
game.add_skill(y_player.id, x_construct.id, Some(y_construct.id), Skill::Siphon).unwrap();
|
||||
game.add_skill(y_player.id, x_construct.id, y_construct.id, Skill::Siphon).unwrap();
|
||||
game.player_ready(x_player.id).unwrap();
|
||||
game.player_ready(y_player.id).unwrap();
|
||||
game = game.resolve_phase_start();
|
||||
|
||||
game.resolved.clear();
|
||||
|
||||
game.add_skill(y_player.id, y_construct.id, Some(y_construct.id), Skill::Purify).unwrap();
|
||||
game.add_skill(y_player.id, y_construct.id, y_construct.id, Skill::Purify).unwrap();
|
||||
game.player_ready(x_player.id).unwrap();
|
||||
game.player_ready(y_player.id).unwrap();
|
||||
game = game.resolve_phase_start();
|
||||
|
||||
@ -82,7 +82,7 @@ pub enum RpcRequest {
|
||||
|
||||
GameState { id: Uuid },
|
||||
GameReady { id: Uuid },
|
||||
GameSkill { game_id: Uuid, construct_id: Uuid, target_construct_id: Option<Uuid>, skill: Skill },
|
||||
GameSkill { game_id: Uuid, construct_id: Uuid, target_construct_id: Uuid, skill: Skill },
|
||||
GameSkillClear { game_id: Uuid },
|
||||
|
||||
AccountState {},
|
||||
|
||||
@ -1213,20 +1213,6 @@ impl Skill {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn self_targeting(&self) -> bool {
|
||||
match self {
|
||||
Skill::Block |
|
||||
Skill::Sustain|
|
||||
Skill::SustainPlus |
|
||||
Skill::SustainPlusPlus |
|
||||
Skill::Counter|
|
||||
Skill::CounterPlus |
|
||||
Skill::CounterPlusPlus => true,
|
||||
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn defensive(&self) -> bool {
|
||||
let mut rng = thread_rng();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user