add - for effect removal, anim text clean up

This commit is contained in:
Mashy 2019-12-20 11:42:54 +10:00
parent ecc6eebdbb
commit c9acab9def

View File

@ -41,36 +41,38 @@ class AnimText extends preact.Component {
const generateAnimText = () => {
const [type, event] = resolution.event;
if (type === 'Ko') return <h1><span>KO!</span></h1>;
if (type === 'Disable') {
const { disable } = event;
return <h1><span>{disable}</span></h1>;
}
if (type === 'Immunity') return <h1><span>IMMUNE</span></h1>;
if (type === 'Damage') {
const { mitigation, colour } = event;
let { amount } = event;
amount *= -1;
switch (type) {
case 'Damage': {
const { amount, mitigation, colour } = event;
const mitigationText = mitigation ? `(${mitigation})` : '';
return <h1><span class={colour.toLowerCase()}>{amount} {mitigationText} </span></h1>;
return <h1><span class={colour.toLowerCase()}>-{amount} {mitigationText} </span></h1>;
}
if (type === 'Healing') {
case 'Healing': {
const { amount, overhealing, colour } = event;
return <h1><span class={colour.toLowerCase()}>{amount} ({overhealing} OH)</span></h1>;
const overHealingText = overhealing ? `(${overhealing} OH)` : '';
return <h1><span class={colour.toLowerCase()}>+{amount} {overHealingText}</span></h1>;
}
if (type === 'Inversion') return <h1><span>INVERT</span></h1>;
if (type === 'Reflection') return <h1><span>REFLECT</span></h1>;
if (type === 'Effect') {
case 'Effect': {
const { effect, duration } = event;
return <h1><span>+{effect} {duration}T</span></h1>;
}
if (type === 'Removal') {
case 'Removal': {
const { effect } = event;
if (!effect) return <h1><span>Effect Removal</span></h1>;
return <h1><span>{effect}</span></h1>;
return <h1><span>-{effect}</span></h1>;
}
case 'Ko': return <h1><span>KO!</span></h1>;
case 'Reflection': return <h1><span>REFLECT</span></h1>;
default: return false;
}
return false;
};
// We don't send inversion / disable / immune event text
/* case 'Inversion': return <h1><span>INVERT</span></h1>;
case 'Disable': {
const { disable } = event;
return <h1><span>{disable}</span></h1>;
}
case 'Immunity': return <h1><span>IMMUNE</span></h1>; */
return (
<div class="combat-text">