move combat text

This commit is contained in:
Mashy 2019-07-01 23:10:04 +10:00
parent 9e5a612739
commit 3e8634e6c7
4 changed files with 8 additions and 16 deletions

View File

@ -206,7 +206,6 @@
font-size: 2em;
font-family: 'Jura';
position: absolute;
object-fit: contain;
top: 15%;
}

View File

@ -118,7 +118,6 @@ function animations(props) {
};
const combatAnim = anim(event.skill);
if (combatAnim) {
return (
<div class={'combat-anim'}>
@ -127,15 +126,6 @@ function animations(props) {
);
}
if (stages.includes('POST_SKILL')) {
const combatText = getCombatText(resolution);
return (
<div class={'combat-text'}>
{combatText}
</div>
);
}
return (
<div></div>);
}

View File

@ -2,7 +2,7 @@ const { connect } = require('preact-redux');
const preact = require('preact');
const range = require('lodash/range');
const { STATS, eventClasses } = require('../utils');
const { STATS, eventClasses, getCombatText } = require('../utils');
const { ConstructAvatar } = require('./construct');
const animations = require('./animations');
const shapes = require('./shapes');
@ -78,8 +78,8 @@ function GameConstruct(props) {
? construct.effects.map(c => <div key={c.effect}>{c.effect} - {c.duration}T</div>)
: <div>&nbsp;</div>;
const combatInfo = animations({ game, account, resolution, player, construct });
const combatAnim = animations({ game, account, resolution, player, construct });
const combatText = getCombatText(resolution, construct);
return (
<div
onClick={() => selectSkillTarget(construct.id)}
@ -89,7 +89,8 @@ function GameConstruct(props) {
{crypSkills}
<div class="stats"> {stats} </div>
<ConstructAvatar name={construct.name} id={construct.id} />
{combatInfo}
{combatAnim}
<div class={'combat-text'}> {combatText} </div>
<div class="effects"> {effects} </div>
</div>
);

View File

@ -200,8 +200,10 @@ function getCombatSequence(resolution) {
}
}
function getCombatText(resolution) {
function getCombatText(resolution, construct) {
if (!resolution) return false;
if (!resolution.stages.includes('POST_SKILL')) return false;
if (construct.id !== resolution.target.id) return false;
const [type, event] = resolution.event;
if (type === 'Ko') {