From 7b054340d41196b17255434bac5763f66a3ec9ea Mon Sep 17 00:00:00 2001 From: Mashy Date: Fri, 8 Nov 2019 13:01:28 +1000 Subject: [PATCH] add ko event back but doing it right --- client/assets/styles/colours.less | 9 +++++++++ client/assets/styles/game.less | 4 ++++ client/src/animations.utils.jsx | 2 +- client/src/components/game.construct.jsx | 3 ++- server/src/skill.rs | 2 +- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/client/assets/styles/colours.less b/client/assets/styles/colours.less index f3ea9020..8b4447ab 100644 --- a/client/assets/styles/colours.less +++ b/client/assets/styles/colours.less @@ -181,3 +181,12 @@ button { color: @blue; } } + +@keyframes target-ko { + 0% { + opacity: 100%; + } + 100% { + opacity: 20%; + } +} \ No newline at end of file diff --git a/client/assets/styles/game.less b/client/assets/styles/game.less index 69147c45..ef57d19b 100644 --- a/client/assets/styles/game.less +++ b/client/assets/styles/game.less @@ -201,6 +201,10 @@ font-size: 100%; } + &.ko-transition { + animation: target-ko 1s ease-in-out 0s 1; + } + &.ko { animation: none; opacity: 0.20; diff --git a/client/src/animations.utils.jsx b/client/src/animations.utils.jsx index f749e43f..ad926a8f 100644 --- a/client/src/animations.utils.jsx +++ b/client/src/animations.utils.jsx @@ -111,7 +111,7 @@ function getText(resolution) { function generatePostSkill() { const [type, event] = resolution.event; if (type === 'Ko') { - return { text: 'KO!', css: 'ko' }; + return { text: 'KO!', css: 'ko-transition' }; } if (type === 'Disable') { diff --git a/client/src/components/game.construct.jsx b/client/src/components/game.construct.jsx index 35c328c4..68df7d47 100644 --- a/client/src/components/game.construct.jsx +++ b/client/src/components/game.construct.jsx @@ -117,7 +117,8 @@ class GameConstruct extends Component { setGameEffectInfo, } = this.props; - const ko = construct.green_life.value === 0 ? 'ko' : ''; + const koEvent = animText ? animText.text === 'KO!' && animText.constructId === construct.id : false; + const ko = construct.green_life.value === 0 && !koEvent ? 'ko' : ''; const classes = eventClasses(animating, animFocus, construct, animText); const stats = ['RedLife', 'GreenLife', 'BlueLife'].map((s, j) => ( diff --git a/server/src/skill.rs b/server/src/skill.rs index f0c5fe16..33f7ea3c 100644 --- a/server/src/skill.rs +++ b/server/src/skill.rs @@ -353,8 +353,8 @@ fn post_resolve(_skill: Skill, game: &mut Game, mut resolutions: Resolutions) -> }; if target.is_ko() { - // resolutions.push(Resolution::new(&source, &target).event(Event::Ko()).stages(EventStages::PostOnly)); target.effects.clear(); + resolutions.push(Resolution::new(&source, &target).event(Event::Ko()).stages(EventStages::PostOnly)); } game.update_construct(&mut source);