Combat source / target text

This commit is contained in:
Mashy 2019-04-15 16:33:15 +10:00
parent 5681b43b04
commit a8cf47ff51
2 changed files with 19 additions and 14 deletions

View File

@ -1,9 +1,9 @@
module.exports = { module.exports = {
TIMES: { TIMES: {
RESOLUTION_TIME_MS: 2000, RESOLUTION_TIME_MS: 2000,
START_SKILL: 1000, START_SKILL: 750,
END_SKILL: 1000, END_SKILL: 750,
POST_SKILL: 1500, POST_SKILL: 750,
}, },
ITEMS: { ITEMS: {

View File

@ -32,7 +32,7 @@ const numSort = (k, desc) => {
}; };
}; };
const genAvatar = (name) => { const genAvatar = name => {
let hash = 0; let hash = 0;
if (name.length === 0) return hash; if (name.length === 0) return hash;
// Probs don't need to hash using the whole string // Probs don't need to hash using the whole string
@ -164,13 +164,16 @@ function eventClasses(resolution, cryp) {
function getCombatText(cryp, resolution) { function getCombatText(cryp, resolution) {
if (!resolution) return ''; if (!resolution) return '';
if (resolution.stage !== 'POST_SKILL') return '';
if (cryp.id !== resolution.target.id) return '';
const [type, event] = resolution.event; const [type, event] = resolution.event;
const source = cryp.id === resolution.source.id;
const target = cryp.id === resolution.target.id;
const startSkill = resolution.stage === 'START_SKILL';
const endSkill = resolution.stage === 'END_SKILL';
const postSkill = resolution.stage === 'POST_SKILL';
if (type === 'Ko') { if (type === 'Ko') {
return 'KO!'; if (postSkill && target) return 'KO!';
} }
if (type === 'Disable') { if (type === 'Disable') {
@ -179,7 +182,7 @@ function getCombatText(cryp, resolution) {
if (type === 'Immunity') { if (type === 'Immunity') {
const { skill, immunity } = event; const { skill, immunity } = event;
return 'IMMUNE'; if (postSkill && target) return 'IMMUNE';
} }
if (type === 'TargetKo') { if (type === 'TargetKo') {
@ -191,32 +194,34 @@ function getCombatText(cryp, resolution) {
const mitigationText = mitigation const mitigationText = mitigation
? `(${mitigation})` ? `(${mitigation})`
: ''; : '';
return `${amount} ${mitigationText}`; if (startSkill && source) return `${skill}`;
if (endSkill && target) return `${skill}`;
if (postSkill && target) return `${amount} ${mitigationText}`;
} }
if (type === 'Healing') { if (type === 'Healing') {
const { skill, amount, overhealing } = event; const { skill, amount, overhealing } = event;
return `${amount} (${overhealing}OH)`; if (postSkill && target) return `${amount} (${overhealing}OH)`;
} }
if (type === 'Inversion') { if (type === 'Inversion') {
const { skill } = event; const { skill } = event;
return 'INVERT'; if (postSkill && target) return 'INVERT';
} }
if (type === 'Reflection') { if (type === 'Reflection') {
const { skill } = event; const { skill } = event;
return 'REFLECT'; if (postSkill && target) return 'REFLECT';
} }
if (type === 'Effect') { if (type === 'Effect') {
const { skill, effect, duration } = event; const { skill, effect, duration } = event;
return `+ ${effect} ${duration}T`; if (postSkill && target) return `+ ${effect} ${duration}T`;
} }
if (type === 'Removal') { if (type === 'Removal') {
const { effect } = event; const { effect } = event;
return `- ${effect}`; if (postSkill && target) return `- ${effect}`;
} }