self targeting client
This commit is contained in:
parent
b5191e5306
commit
09b6f455d3
@ -616,11 +616,11 @@ module.exports = {
|
|||||||
avoidQuotes: true,
|
avoidQuotes: true,
|
||||||
}],
|
}],
|
||||||
|
|
||||||
// suggest using arrow functions as callbacks
|
// // suggest using arrow functions as callbacks
|
||||||
'prefer-arrow-callback': ['error', {
|
// 'prefer-arrow-callback': ['error', {
|
||||||
allowNamedFunctions: false,
|
// allowNamedFunctions: false,
|
||||||
allowUnboundThis: true,
|
// allowUnboundThis: true,
|
||||||
}],
|
// }],
|
||||||
|
|
||||||
// suggest using of const declaration for variables that are never modified after declared
|
// suggest using of const declaration for variables that are never modified after declared
|
||||||
'prefer-const': ['error', {
|
'prefer-const': ['error', {
|
||||||
|
|||||||
@ -10,11 +10,16 @@ const addState = connect(
|
|||||||
|
|
||||||
function selectSkillTarget(targetTeamId) {
|
function selectSkillTarget(targetTeamId) {
|
||||||
if (activeSkill) {
|
if (activeSkill) {
|
||||||
return ws.sendGameSkill(game.id, activeSkill.crypId, targetTeamId, activeSkill.skill);
|
return ws.sendGameSkill(game.id, activeSkill.crypId, targetTeamId, activeSkill.skill.skill);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// intercept self casting skills
|
||||||
|
if (activeSkill && activeSkill.skill.self_targeting) {
|
||||||
|
ws.sendGameSkill(game.id, activeSkill.crypId, null, activeSkill.skill.skill);
|
||||||
|
}
|
||||||
|
|
||||||
function selectIncomingTarget(crypId) {
|
function selectIncomingTarget(crypId) {
|
||||||
if (activeIncoming) {
|
if (activeIncoming) {
|
||||||
return ws.sendGameTarget(game.id, crypId, activeIncoming);
|
return ws.sendGameTarget(game.id, crypId, activeIncoming);
|
||||||
@ -27,11 +32,11 @@ const addState = connect(
|
|||||||
|
|
||||||
function receiveDispatch(dispatch) {
|
function receiveDispatch(dispatch) {
|
||||||
function setActiveSkill(crypId, skill) {
|
function setActiveSkill(crypId, skill) {
|
||||||
dispatch(actions.setActiveSkill(crypId, skill))
|
dispatch(actions.setActiveSkill(crypId, skill));
|
||||||
}
|
}
|
||||||
|
|
||||||
function setActiveIncoming(skillId) {
|
function setActiveIncoming(skillId) {
|
||||||
dispatch(actions.setActiveIncoming(skillId))
|
dispatch(actions.setActiveIncoming(skillId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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 = game.skills.filter(s => s.target_team_id === playerTeam.id).map((inc) => {
|
const incoming = game.stack.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 (
|
||||||
@ -41,14 +41,14 @@ function GamePanel(props) {
|
|||||||
const skills = cryp.skills.map((skill, i) => {
|
const skills = cryp.skills.map((skill, i) => {
|
||||||
const hotkey = SKILL_HOT_KEYS[i];
|
const hotkey = SKILL_HOT_KEYS[i];
|
||||||
key.unbind(hotkey);
|
key.unbind(hotkey);
|
||||||
key(hotkey, () => setActiveSkill(cryp.id, skill.skill));
|
key(hotkey, () => setActiveSkill(cryp.id, skill));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
key={i}
|
key={i}
|
||||||
className="button is-dark"
|
className="button is-dark"
|
||||||
type="submit"
|
type="submit"
|
||||||
onClick={() => setActiveSkill(cryp.id, skill.skill)}
|
onClick={() => setActiveSkill(cryp.id, skill)}
|
||||||
>
|
>
|
||||||
({hotkey}) {skill.skill} {skill.cd && `(${skill.cd}T)`}
|
({hotkey}) {skill.skill} {skill.cd && `(${skill.cd}T)`}
|
||||||
</button>
|
</button>
|
||||||
@ -59,7 +59,6 @@ function GamePanel(props) {
|
|||||||
<div key={i}>{status} for {status.turns}T</div>
|
<div key={i}>{status} for {status.turns}T</div>
|
||||||
));
|
));
|
||||||
|
|
||||||
if (activeIncoming) console.log('should be a pointer');
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={cryp.id}
|
key={cryp.id}
|
||||||
|
|||||||
@ -288,6 +288,7 @@ pub fn cryp_spawn(params: CrypSpawnParams, tx: &mut Transaction, account: &Accou
|
|||||||
.named(¶ms.name)
|
.named(¶ms.name)
|
||||||
.level(10)
|
.level(10)
|
||||||
.learn(Skill::Stun)
|
.learn(Skill::Stun)
|
||||||
|
.learn(Skill::Block)
|
||||||
.set_account(account.id)
|
.set_account(account.id)
|
||||||
.create();
|
.create();
|
||||||
|
|
||||||
|
|||||||
@ -273,6 +273,10 @@ 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, skill_id: Uuid) -> Result<&mut Cast, Error> {
|
fn add_target(&mut self, team_id: Uuid, cryp_id: Uuid, skill_id: Uuid) -> Result<&mut Cast, Error> {
|
||||||
|
if self.phase != Phase::Target {
|
||||||
|
return Err(err_msg("game not in target phase"));
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// whose team is this?
|
// whose team is this?
|
||||||
let team = self.team_by_id(team_id);
|
let team = self.team_by_id(team_id);
|
||||||
@ -414,6 +418,10 @@ pub fn game_skill(params: GameSkillParams, tx: &mut Transaction, account: &Accou
|
|||||||
let game_bytes: Vec<u8> = returned.get("data");
|
let game_bytes: Vec<u8> = returned.get("data");
|
||||||
let mut game = from_slice::<Game>(&game_bytes)?;
|
let mut game = from_slice::<Game>(&game_bytes)?;
|
||||||
|
|
||||||
|
if game.phase != Phase::Skill {
|
||||||
|
return Err(err_msg("game not in skill phase"))
|
||||||
|
}
|
||||||
|
|
||||||
game.add_skill(account.id, params.cryp_id, params.target_team_id, params.skill)?;
|
game.add_skill(account.id, params.cryp_id, params.target_team_id, params.skill)?;
|
||||||
|
|
||||||
if game.skill_phase_finished() {
|
if game.skill_phase_finished() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user