fixed recharge event

This commit is contained in:
Mashy 2019-11-28 14:54:35 +10:00
parent 5e1b63108c
commit 51edec11fd
3 changed files with 32 additions and 16 deletions

View File

@ -30,7 +30,6 @@ Hexagon Set
- Increase intensity for each visit - Increase intensity for each visit
_mashy_ _mashy_
* add back combo preview
* floating combat text combat (start opposite hp and float towards it) to speed up animations * floating combat text combat (start opposite hp and float towards it) to speed up animations
* represent construct colours during game phase (try %bar or dots) * represent construct colours during game phase (try %bar or dots)
* buy from preview if you have the required bases in vbox / inventory * buy from preview if you have the required bases in vbox / inventory

View File

@ -160,9 +160,9 @@ function getText(resolution) {
if (type === 'Recharge') { if (type === 'Recharge') {
const { red, blue } = event; const { red, blue } = event;
if (red > 0 && blue > 0) return { text: [`+${red}R +${blue}B`, ''], css: 'rb' }; if (red > 0 && blue > 0) return { text: `+${red}R +${blue}B`, css: 'rb' };
if (red > 0) return { text: [`+${red}R`, ''], css: 'red' }; if (red > 0) return { text: `+${red}R`, css: 'red' };
if (blue > 0) return { text: [`+${blue}B`, ''], css: 'blue' }; if (blue > 0) return { text: `+${blue}B`, css: 'blue' };
return nullText; return nullText;
} }

View File

@ -23,22 +23,39 @@ class combatText extends preact.Component {
render(props) { render(props) {
const { construct, animText, itemInfo } = props; const { construct, animText, itemInfo } = props;
if (animText && animText.constructId === construct.id) { if (animText && animText.constructId === construct.id) {
const itemSource = itemInfo.combos.filter(c => c.item === removeTier(animText.skill)); const itemSourceDescription = () => {
const itemSourceInfo = itemSource.length const itemSource = itemInfo.combos.filter(c => c.item === removeTier(animText.skill));
? `${itemSource[0].components[0]} ${itemSource[0].components[1]} ${itemSource[0].components[2]}` const itemSourceInfo = itemSource.length
: false; ? `${itemSource[0].components[0]} ${itemSource[0].components[1]} ${itemSource[0].components[2]}`
const itemRegEx = /(Red|Blue|Green)/; : false;
const itemSourceDescription = reactStringReplace(itemSourceInfo, itemRegEx, match => shapes[match]()); const itemRegEx = /(Red|Blue|Green)/;
return reactStringReplace(itemSourceInfo, itemRegEx, match => shapes[match]());
};
return ( const animationTextHtml = () => {
<div class="combat-text"> // monkaW hack to make red / blue recharge work nicely
<h2> if (animText.css === 'rb') {
<span>{animText.skill}</span> const text = animText.text.split(' ');
</h2> return (
<span>{itemSourceDescription}</span> <h1>
<span class="red">{text[0]}</span>&nbsp;
<span class="blue">{text[1]}</span>
</h1>
);
}
return (
<h1 class={animText.css}> <h1 class={animText.css}>
<span>{animText.text}</span> <span>{animText.text}</span>
</h1> </h1>
);
};
return (
<div class="combat-text">
<h2><span>{animText.skill}</span></h2>
<span>{itemSourceDescription()}</span>
{animationTextHtml()}
</div> </div>
); );
} }