put animation skill into state

This commit is contained in:
Mashy
2019-10-05 13:14:44 +10:00
parent c8dddcc094
commit 5fb7f157b4
7 changed files with 18 additions and 15 deletions
+6 -6
View File
@@ -9,8 +9,8 @@ const shapes = require('./shapes');
const { removeTier } = require('../utils');
const addState = connect(
({ game, account, animTarget, animating, itemInfo }) =>
({ game, account, animTarget, animating, itemInfo })
({ game, account, animSkill, animating, itemInfo }) =>
({ game, account, animSkill, animating, itemInfo })
);
class TargetSvg extends Component {
@@ -28,15 +28,15 @@ class TargetSvg extends Component {
}
render(props, state) {
const { game, account, animating, animTarget, itemInfo } = props;
const { game, account, animating, animSkill, itemInfo } = props;
const { width, height } = state;
if (!game) return false; // game will be null when battle ends
// resolutions happening
// just put skill name up
if (animating) {
if (!animTarget) return false;
const itemSource = itemInfo.combos.filter(c => c.item === removeTier(animTarget.skill));
if (!animSkill) return false;
const itemSource = itemInfo.combos.filter(c => c.item === removeTier(animSkill));
const itemSourceInfo = itemSource.length
? `${itemSource[0].components[0]} ${itemSource[0].components[1]} ${itemSource[0].components[2]}`
: false;
@@ -44,7 +44,7 @@ class TargetSvg extends Component {
const itemSourceDescription = reactStringReplace(itemSourceInfo, itemRegEx, match => shapes[match]());
return (
<div class="resolving-skill">
<h1>{animTarget.skill}</h1>
<h1>{animSkill}</h1>
<div> {itemSourceDescription} </div>
</div>
);