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 = {
TIMES: {
RESOLUTION_TIME_MS: 2000,
START_SKILL: 1000,
END_SKILL: 1000,
POST_SKILL: 1500,
START_SKILL: 750,
END_SKILL: 750,
POST_SKILL: 750,
},
ITEMS: {

View File

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