fix ability phase bug;
This commit is contained in:
parent
433b20fdb5
commit
5549e87fab
@ -21,7 +21,7 @@ function GamePanel(props) {
|
|||||||
|
|
||||||
const playerTeam = game.teams.find(t => t.id === account.id);
|
const playerTeam = game.teams.find(t => t.id === account.id);
|
||||||
|
|
||||||
const incoming = playerTeam.incoming.map((inc) => {
|
const incoming = game.skills.filter(s => s.target_team_id === playerTeam.id).map((inc) => {
|
||||||
key.unbind('1');
|
key.unbind('1');
|
||||||
key('1', () => setActiveIncoming(inc.id));
|
key('1', () => setActiveIncoming(inc.id));
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -99,6 +99,7 @@ function createSocket(store) {
|
|||||||
// Outgoing
|
// Outgoing
|
||||||
// -------------
|
// -------------
|
||||||
function send(msg) {
|
function send(msg) {
|
||||||
|
console.log('outgoing msg', msg);
|
||||||
msg.token = account && account.token;
|
msg.token = account && account.token;
|
||||||
ws.send(cbor.encode(msg));
|
ws.send(cbor.encode(msg));
|
||||||
}
|
}
|
||||||
@ -142,7 +143,7 @@ function createSocket(store) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sendGameTarget(gameId, crypId, skillId) {
|
function sendGameTarget(gameId, crypId, skillId) {
|
||||||
send({ method: 'game_target', params: { game_id: gameId, cryp_id: crypId, cast_id: skillId } });
|
send({ method: 'game_target', params: { game_id: gameId, cryp_id: crypId, skill_id: skillId } });
|
||||||
store.dispatch(actions.setActiveIncoming(null));
|
store.dispatch(actions.setActiveIncoming(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -219,7 +219,7 @@ impl Game {
|
|||||||
// for every team
|
// for every team
|
||||||
.all(|t| self.skills.iter()
|
.all(|t| self.skills.iter()
|
||||||
// the number of skills they have cast
|
// the number of skills they have cast
|
||||||
.filter(|s| s.target_team_id == t.id)
|
.filter(|s| s.source_team_id == t.id)
|
||||||
.collect::<Vec<&Cast>>()
|
.collect::<Vec<&Cast>>()
|
||||||
// should equal the number required this turn
|
// should equal the number required this turn
|
||||||
.len() == t.skills_required()
|
.len() == t.skills_required()
|
||||||
@ -228,6 +228,7 @@ impl Game {
|
|||||||
|
|
||||||
// move all skills into their target team's targets list
|
// move all skills into their target team's targets list
|
||||||
fn target_phase_start(&mut self) -> &mut Game {
|
fn target_phase_start(&mut self) -> &mut Game {
|
||||||
|
assert!(self.skill_phase_finished());
|
||||||
if self.phase != Phase::Skill {
|
if self.phase != Phase::Skill {
|
||||||
panic!("game not in skill phase");
|
panic!("game not in skill phase");
|
||||||
}
|
}
|
||||||
@ -260,7 +261,7 @@ impl Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// targets can only be added by the owner of the team
|
// targets can only be added by the owner of the team
|
||||||
fn add_target(&mut self, team_id: Uuid, cryp_id: Uuid, cast_id: Uuid) -> Result<&mut Cast, Error> {
|
fn add_target(&mut self, team_id: Uuid, cryp_id: Uuid, skill_id: Uuid) -> Result<&mut Cast, Error> {
|
||||||
{
|
{
|
||||||
// whose team is this?
|
// whose team is this?
|
||||||
let team = self.team_by_id(team_id);
|
let team = self.team_by_id(team_id);
|
||||||
@ -273,9 +274,9 @@ impl Game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set the target
|
// set the target
|
||||||
let cast = match self.skills.iter_mut().find(|s| s.id == cast_id) {
|
let cast = match self.skills.iter_mut().find(|s| s.id == skill_id) {
|
||||||
Some(c) => c,
|
Some(c) => c,
|
||||||
None => return Err(err_msg("cast_id not found")),
|
None => return Err(err_msg("skill_id not found")),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(cast.set_target(cryp_id))
|
Ok(cast.set_target(cryp_id))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user