From a55fd9834ad8e238cbeb8826a10adf7d3f1e44a0 Mon Sep 17 00:00:00 2001 From: Mashy Date: Thu, 19 Dec 2019 15:35:10 +1000 Subject: [PATCH] animation construct ko --- client/src/components/game.construct.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/src/components/game.construct.jsx b/client/src/components/game.construct.jsx index 68e53cad..a5c163c2 100644 --- a/client/src/components/game.construct.jsx +++ b/client/src/components/game.construct.jsx @@ -59,11 +59,16 @@ class GameConstruct extends preact.Component { player, } = this.props; - const ko = construct.green_life.value === 0 ? 'ko' : ''; + // construct green_life comes from game state and won't update during animations + // treat the construct as ko for the remainder of the anims if ko event occurs + const ko = construct.green_life.value === 0 || this.ko ? 'ko' : ''; const koEvent = () => { if (resolution) { const [type, variant] = resolution.event; - if (variant.construct === construct.id && type === 'Ko') return 'ko-transition'; + if (variant.construct === construct.id && type === 'Ko') { + this.ko = true; + return 'ko-transition'; + } } return ''; };