misc function changes
This commit is contained in:
parent
a8672bbd45
commit
63966ee59c
@ -133,31 +133,27 @@ function renderCryp(scene, group, cryp, skills, game, team, iter) {
|
|||||||
return crypSpawn;
|
return crypSpawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderSkills(scene, group, cryp, account, game, team, iter) {
|
function renderSkills(scene, group, cryp, game, team, iter) {
|
||||||
const nameTextPosition = skillTextPosition(iter, 0);
|
|
||||||
const skillList = [];
|
const skillList = [];
|
||||||
if (scene.registry.get('resolve')) return true;
|
const nameTextPosition = skillTextPosition(iter, 0);
|
||||||
if (game.phase === 'Skill' && cryp.account === account.id) {
|
|
||||||
if (cryp.hp.base === 0) return true;
|
const addSkill = (skill, i) => {
|
||||||
const crypName = scene.add.text(nameTextPosition[0], nameTextPosition[1], cryp.name, TEXT.HEADER);
|
if (i === 0) group.add(scene.add.text(nameTextPosition[0], nameTextPosition[1], cryp.name, TEXT.HEADER));
|
||||||
crypName.text = cryp.name;
|
const skillTextPos = skillTextPosition(iter, i + 2);
|
||||||
cryp.skills.forEach((skill, i) => {
|
const skillObj = new CrypSkill(scene, skillTextPos[0], skillTextPos[1], team, skill, cryp);
|
||||||
const skillText = skillTextPosition(iter, i + 2);
|
group.add(scene.add.existing(skillObj));
|
||||||
const skillObj = new CrypSkill(scene, skillText[0], skillText[1], team, skill, cryp);
|
|
||||||
scene.add.existing(skillObj);
|
|
||||||
skillList.push(skillObj);
|
skillList.push(skillObj);
|
||||||
group.addMultiple([crypName, skillObj]);
|
};
|
||||||
});
|
|
||||||
} else if (game.phase === 'Target' && cryp.account !== account.id) {
|
if (scene.registry.get('resolve')) return true;
|
||||||
|
if (game.phase === 'Skill' && cryp.account === scene.account.id) {
|
||||||
|
if (cryp.hp.base === 0) return true;
|
||||||
|
cryp.skills.forEach(addSkill);
|
||||||
|
} else if (game.phase === 'Target' && cryp.account !== scene.account.id) {
|
||||||
const blockSkill = game.stack.find(skill => skill.source_cryp_id === cryp.id);
|
const blockSkill = game.stack.find(skill => skill.source_cryp_id === cryp.id);
|
||||||
// cryp not casting this turn
|
// cryp not casting this turn
|
||||||
if (!blockSkill) return false;
|
if (!blockSkill) return false;
|
||||||
const crypName = scene.add.text(nameTextPosition[0], nameTextPosition[1], cryp.name, TEXT.HEADER);
|
addSkill(blockSkill, 0);
|
||||||
const skillText = skillTextPosition(iter, 2);
|
|
||||||
const skillObj = new CrypSkill(scene, skillText[0], skillText[1], team, blockSkill, cryp);
|
|
||||||
scene.add.existing(skillObj);
|
|
||||||
skillList.push(skillObj);
|
|
||||||
group.addMultiple([crypName, skillObj]);
|
|
||||||
}
|
}
|
||||||
return skillList;
|
return skillList;
|
||||||
}
|
}
|
||||||
@ -165,9 +161,8 @@ function renderSkills(scene, group, cryp, account, game, team, iter) {
|
|||||||
class DrawCrypTeams extends Phaser.GameObjects.Group {
|
class DrawCrypTeams extends Phaser.GameObjects.Group {
|
||||||
constructor(scene, game) {
|
constructor(scene, game) {
|
||||||
super(scene);
|
super(scene);
|
||||||
const account = scene.registry.get('account');
|
|
||||||
const renderTeam = (cryp, iter, team) => {
|
const renderTeam = (cryp, iter, team) => {
|
||||||
const skillsObj = renderSkills(scene, this, cryp, account, game, team, iter);
|
const skillsObj = renderSkills(scene, this, cryp, game, team, iter);
|
||||||
const crypObj = renderCryp(scene, this, cryp, skillsObj, game, team, iter);
|
const crypObj = renderCryp(scene, this, cryp, skillsObj, game, team, iter);
|
||||||
const addKeys = (game.phase === 'Skill' && !team) || (game.phase === 'Target' && team);
|
const addKeys = (game.phase === 'Skill' && !team) || (game.phase === 'Target' && team);
|
||||||
if (addKeys) scene.crypKeyHandler(crypObj, iter);
|
if (addKeys) scene.crypKeyHandler(crypObj, iter);
|
||||||
|
|||||||
@ -41,16 +41,12 @@ class Combat extends Phaser.Scene {
|
|||||||
this.registry.set('activeSkill', null);
|
this.registry.set('activeSkill', null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const logX = COMBAT.LOG.x();
|
|
||||||
const logY = COMBAT.LOG.y();
|
|
||||||
const logWidth = COMBAT.LOG.width();
|
|
||||||
this.skills = new CombatSkills(this);
|
this.skills = new CombatSkills(this);
|
||||||
this.logIter = 0; this.resolvedIter = 0;
|
this.logIter = 0; this.resolvedIter = 0;
|
||||||
this.registry.set('resolve', false);
|
this.registry.set('resolve', false);
|
||||||
this.account = this.registry.get('account');
|
this.account = this.registry.get('account');
|
||||||
this.log = this.add.text(logX, logY, '', TEXT.NORMAL);
|
this.log = this.add.text(COMBAT.LOG.x(), COMBAT.LOG.y(), '', TEXT.NORMAL);
|
||||||
this.log.setWordWrapWidth(logWidth);
|
this.log.setWordWrapWidth(COMBAT.LOG.width());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -58,8 +58,7 @@ function animatePhase(scene, group, game, delay) {
|
|||||||
function combatRender(scene, game, group) {
|
function combatRender(scene, game, group) {
|
||||||
const skill = randomSkill();
|
const skill = randomSkill();
|
||||||
const resolved = game.resolved[scene.resolvedIter];
|
const resolved = game.resolved[scene.resolvedIter];
|
||||||
const account = scene.registry.get('account');
|
const target = resolved.source_team_id === scene.account.id;
|
||||||
const target = resolved.source_team_id === account.id;
|
|
||||||
const delay = DELAYS[skill];
|
const delay = DELAYS[skill];
|
||||||
scene.time.delayedCall(DELAYS.MOVE_CREEP, () => {
|
scene.time.delayedCall(DELAYS.MOVE_CREEP, () => {
|
||||||
scene.skills[skill](target);
|
scene.skills[skill](target);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user