Merge branch 'master' of ssh://cryps.gg:40022/~/cryps
This commit is contained in:
commit
15bcd2b13f
@ -6,24 +6,17 @@ const CRYP_KEY_MAP = ['keydown_ONE', 'keydown_TWO', 'keydown_THREE'];
|
||||
const SKILL_KEY_MAP = ['keydown_Q', 'keydown_W', 'keydown_E', 'keydown_R'];
|
||||
const TARGET_KEY_MAP = ['keydown_SEVEN', 'keydown_EIGHT', 'keydown_NINE', 'keydown_ZERO'];
|
||||
|
||||
const CRYP_MARGIN = COMBAT.height() / 5;
|
||||
const TEXT_MARGIN = COMBAT.height() / 35;
|
||||
const TEAM_MARGIN = COMBAT.width() * 0.7;
|
||||
const CRYP_MARGIN = COMBAT.crypMargin();
|
||||
const TEXT_MARGIN = COMBAT.textMargin();
|
||||
const SKILL_WIDTH = COMBAT.width() / 10;
|
||||
const SKILL_HEIGHT = COMBAT.height() / 20;
|
||||
const SKILL_HEIGHT = COMBAT.height() / 30;
|
||||
|
||||
const skillPosition = (crypIter, skillIter) => {
|
||||
const skillTextX = COMBAT.width() / 3.8 + (SKILL_WIDTH + COMBAT.width() * 0.01) * skillIter;
|
||||
const skillTextY = TEXT_MARGIN * 5 + CRYP_MARGIN * crypIter;
|
||||
const skillTextX = COMBAT.width() / 3.8;
|
||||
const skillTextY = (TEXT_MARGIN * skillIter) * 1.5 + CRYP_MARGIN * crypIter + COMBAT.y() + COMBAT.height() * 0.07;
|
||||
return [skillTextX, skillTextY];
|
||||
};
|
||||
|
||||
const targetTextPosition = (crypIter, teamIter) => {
|
||||
const skillTextX = COMBAT.width() / 3.8 + 0.63 * TEAM_MARGIN * teamIter;
|
||||
const skillTextY = TEXT_MARGIN * 4 + CRYP_MARGIN * crypIter;
|
||||
return [ skillTextX, skillTextY ];
|
||||
};
|
||||
|
||||
const skillCheckHitBox = (scenePlugin, pointer) => {
|
||||
const { list } = scenePlugin.get('CombatHitBox').children;
|
||||
for (let i = 0; i < list.length; i += 1) {
|
||||
@ -221,70 +214,6 @@ class CombatSkills extends Phaser.Scene {
|
||||
return true;
|
||||
}
|
||||
|
||||
renderTargetPhase(game) {
|
||||
const { account } = this;
|
||||
const { keyboard } = this.input;
|
||||
|
||||
const skills = game.stack.filter(skill => skill.target_team_id === account.id);
|
||||
const friendlyCryps = game.teams.find(t => t.id === account.id).cryps;
|
||||
|
||||
skills.forEach((skill) => {
|
||||
const crypTeam = game.teams.find(t => t.cryps.find(c => c.id === skill.source_cryp_id));
|
||||
const cryp = crypTeam.cryps.find(c => c.id === skill.source_cryp_id);
|
||||
|
||||
// Draw the cryp name
|
||||
const { iter, team } = this.scene.get('CombatCryps').cryps.children.entries
|
||||
.find(c => c.cryp.id === cryp.id);
|
||||
|
||||
const skillPos = targetTextPosition(iter, team);
|
||||
const skillObj = new CrypSkill(this, skillPos[0], skillPos[1], skill, cryp);
|
||||
this.add.existing(skillObj);
|
||||
|
||||
// Don't add interaction for self_target skills
|
||||
const crypSkill = cryp.skills.find(s => s.skill === skill.skill);
|
||||
if (crypSkill.self_targeting) {
|
||||
skillObj.skillBox.setFillStyle(0xff0000);
|
||||
} else {
|
||||
this.input.setDraggable(skillObj);
|
||||
keyboard.on(
|
||||
TARGET_KEY_MAP[iter],
|
||||
() => this.mapTargetKeys(skillObj, game.id, friendlyCryps, iter),
|
||||
this
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
mapTargetKeys(button, gameId, friendlyCryps) {
|
||||
const { keyboard } = this.input;
|
||||
|
||||
CRYP_KEY_MAP.forEach(tKey => this.input.keyboard.removeListener(tKey));
|
||||
|
||||
// deselect any currently active button
|
||||
if (this.activeTarget) {
|
||||
this.activeTarget.deselect();
|
||||
}
|
||||
|
||||
button.select();
|
||||
this.activeTarget = button;
|
||||
|
||||
friendlyCryps.forEach((cryp, j) => {
|
||||
keyboard.on(
|
||||
CRYP_KEY_MAP[j],
|
||||
() => {
|
||||
this.game.events.emit('SEND_TARGET', gameId, cryp.id, button.skill);
|
||||
button.activate();
|
||||
this.activeTarget = null;
|
||||
},
|
||||
this
|
||||
);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
clearCrypActive(crypId) {
|
||||
this.scene.scene.children.list.forEach((s) => {
|
||||
if (s.cryp.id === crypId && s.state === 'activate') s.deselect();
|
||||
|
||||
@ -68,7 +68,7 @@ class StatBar extends Phaser.GameObjects.Graphics {
|
||||
} else {
|
||||
this.fillStyle(0x00ff00); // str8 up green
|
||||
}
|
||||
const statWidth = Math.floor(statBarWidth * statPercentage);
|
||||
const statWidth = statBarWidth * statPercentage;
|
||||
this.fillRect(statBarX + 2, statBarY + 2, statWidth, statBarHeight - 4);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user