From bba3711e9a01a130e6875677d58122d77c3e60eb Mon Sep 17 00:00:00 2001 From: u7121888 Date: Thu, 26 Oct 2023 19:03:58 +1100 Subject: [PATCH 1/7] Made chnages to add bounding animation and activate at right time. Still issues --- package-lock.json | 16 +++++++++++----- package.json | 5 +++-- src/style/styles.less | 18 ++++++++++++++++++ src/ui/button.ts | 3 +++ src/ui/interface.js | 10 ++++++++++ 5 files changed, 45 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index c6af2d2e5..384e64338 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,12 +12,13 @@ "@heroiclabs/nakama-js": "^2.0.1", "compression": "^1.7.4", "express": "^4.17.3", - "jquery": "^3.5.0", + "jquery": "^3.7.1", "jquery.transit": "0.9.12", "js-cookie": "^3.0.1", "node-emoji": "^1.10.0", "phaser-ce": "2.16.0", - "semver": "^7.5.2" + "semver": "^7.5.2", + "server.js": "^1.0.0" }, "devDependencies": { "@babel/core": "^7.21.4", @@ -9155,9 +9156,9 @@ } }, "node_modules/jquery": { - "version": "3.6.4", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.4.tgz", - "integrity": "sha512-v28EW9DWDFpzcD9O5iyJXg3R3+q+mET5JhnjJzQUZMHOv67bpSIHq81GEYpPNZHG+XXHsfSme3nxp/hndKEcsQ==" + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz", + "integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==" }, "node_modules/jquery.transit": { "version": "0.9.12", @@ -11461,6 +11462,11 @@ "node": ">= 0.8.0" } }, + "node_modules/server.js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/server.js/-/server.js-1.0.0.tgz", + "integrity": "sha512-fO4IvzkZ09bBB++XU/gWGuzxJs0OpghSd/34mlW8coMoakLzj/+W5d1pHX+I+7H52GkBKu96UQU0K5vptNjaqg==" + }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", diff --git a/package.json b/package.json index b446c2ad6..9adc3b50a 100644 --- a/package.json +++ b/package.json @@ -26,12 +26,13 @@ "@heroiclabs/nakama-js": "^2.0.1", "compression": "^1.7.4", "express": "^4.17.3", - "jquery": "^3.5.0", + "jquery": "^3.7.1", "jquery.transit": "0.9.12", "js-cookie": "^3.0.1", "node-emoji": "^1.10.0", "phaser-ce": "2.16.0", - "semver": "^7.5.2" + "semver": "^7.5.2", + "server.js": "^1.0.0" }, "devDependencies": { "@babel/core": "^7.21.4", diff --git a/src/style/styles.less b/src/style/styles.less index ea89dc73c..be8249dc5 100644 --- a/src/style/styles.less +++ b/src/style/styles.less @@ -377,6 +377,24 @@ cursor: help !important; } } + + + @keyframes bounce { + 0% { + transform: translateX(0); + } + 50% { + transform: translateX(10px); + } + 100% { + transform: translateX(0); + } + } + + &.potential { + animation: bounce 1s; + } + } #fullscreen { diff --git a/src/ui/button.ts b/src/ui/button.ts index 4acaf59ff..977846937 100644 --- a/src/ui/button.ts +++ b/src/ui/button.ts @@ -9,6 +9,7 @@ export const ButtonStateEnum = { hidden: 'hidden', noClick: 'noclick', slideIn: 'slideIn', + potential: 'potential', } as const; /** @@ -101,6 +102,8 @@ export class Button { slideIn: {}, hidden: {}, noclick: {}, + potential: {}, + }, }; diff --git a/src/ui/interface.js b/src/ui/interface.js index ef4e93d9a..9a78eace5 100644 --- a/src/ui/interface.js +++ b/src/ui/interface.js @@ -18,6 +18,7 @@ import { pretty as version } from '../utility/version'; import { capitalize } from '../utility/string'; import { throttle } from 'underscore'; import { DEBUG_DISABLE_HOTKEYS } from '../debug'; +import GoldenWyrm from '../abilities/Golden-Wyrm'; /** * Class UI @@ -255,6 +256,7 @@ export class UI { cursor: 'default', }, slideIn: {}, + potential: {}, }, }, { isAcceptingInput: () => this.interfaceAPI.isAcceptingInput }, @@ -286,6 +288,13 @@ export class UI { if (ability.require() == true && i != 0) { this.selectAbility(i); } + if(i == 2 && game.activeCreature == GoldenWyrm){ + if(game.activeCreature.abilities[3].isUpgraded() && + ability.require()){ + b.cssTransition('potential', 2000); + } + } + // Activate Ability game.activeCreature.abilities[i].use(); } else { @@ -342,6 +351,7 @@ export class UI { slideIn: { cursor: 'pointer', }, + potential: {}, }, }, { isAcceptingInput: () => this.interfaceAPI.isAcceptingInput }, From 2a3e7e3b98b4f08240f41cfcdc7af9fd04e6c8ae Mon Sep 17 00:00:00 2001 From: Mina928 A Date: Thu, 26 Oct 2023 08:49:59 +0000 Subject: [PATCH 2/7] Moved keyframes animation to appropriate place --- src/style/styles.less | 16 +++++++++++++++- src/ui/interface.js | 3 +-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/style/styles.less b/src/style/styles.less index be8249dc5..100c13c4b 100644 --- a/src/style/styles.less +++ b/src/style/styles.less @@ -392,7 +392,7 @@ } &.potential { - animation: bounce 1s; + animation: rightJump 1s infinite; } } @@ -1457,6 +1457,20 @@ span.pure { } } +@keyframes rightJump { + 0% { + transform: translateX(0); + } + 50% { + transform: translateX(10px); + } + 100% { + transform: translateX(0); + } +} + + + /*--------------Framed Modal------------------*/ /* Modal window with graphical border and close button. */ .framed-modal { diff --git a/src/ui/interface.js b/src/ui/interface.js index 9a78eace5..a3a8b77c0 100644 --- a/src/ui/interface.js +++ b/src/ui/interface.js @@ -18,7 +18,6 @@ import { pretty as version } from '../utility/version'; import { capitalize } from '../utility/string'; import { throttle } from 'underscore'; import { DEBUG_DISABLE_HOTKEYS } from '../debug'; -import GoldenWyrm from '../abilities/Golden-Wyrm'; /** * Class UI @@ -291,7 +290,7 @@ export class UI { if(i == 2 && game.activeCreature == GoldenWyrm){ if(game.activeCreature.abilities[3].isUpgraded() && ability.require()){ - b.cssTransition('potential', 2000); + b.changeState(ButtonStateEnum.potential); } } From f818301f1dcf72e246a9fd0bb278e1ea63fffaef Mon Sep 17 00:00:00 2001 From: Mina928 A Date: Thu, 26 Oct 2023 12:02:14 +0000 Subject: [PATCH 3/7] Button moves and stops moving accordingly. But only on clicks. --- src/style/styles.less | 4 ++++ src/ui/button.ts | 2 ++ src/ui/interface.js | 27 +++++++++++++++++++++++---- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/style/styles.less b/src/style/styles.less index 100c13c4b..12e6ae0d1 100644 --- a/src/style/styles.less +++ b/src/style/styles.less @@ -394,6 +394,10 @@ &.potential { animation: rightJump 1s infinite; } + &.potentialoff { + animation: none !important; + } + } diff --git a/src/ui/button.ts b/src/ui/button.ts index 977846937..8746c96bf 100644 --- a/src/ui/button.ts +++ b/src/ui/button.ts @@ -10,6 +10,7 @@ export const ButtonStateEnum = { noClick: 'noclick', slideIn: 'slideIn', potential: 'potential', + potentialoff: 'potentialoff' } as const; /** @@ -103,6 +104,7 @@ export class Button { hidden: {}, noclick: {}, potential: {}, + potentialoff: {}, }, }; diff --git a/src/ui/interface.js b/src/ui/interface.js index a3a8b77c0..fef7f3abb 100644 --- a/src/ui/interface.js +++ b/src/ui/interface.js @@ -256,6 +256,7 @@ export class UI { }, slideIn: {}, potential: {}, + potentialoff:{}, }, }, { isAcceptingInput: () => this.interfaceAPI.isAcceptingInput }, @@ -287,10 +288,14 @@ export class UI { if (ability.require() == true && i != 0) { this.selectAbility(i); } - if(i == 2 && game.activeCreature == GoldenWyrm){ - if(game.activeCreature.abilities[3].isUpgraded() && - ability.require()){ + + if(i == 1 && game.activeCreature.name == "Golden Wyrm"){ + if(game.activeCreature.abilities[2].isUpgraded() && + ability.require() && game.selectedAbility != ability){ b.changeState(ButtonStateEnum.potential); + } else{ + b.cssTransition(ButtonStateEnum.potentialoff); + b.changeState(ButtonStateEnum.normal); } } @@ -353,10 +358,23 @@ export class UI { potential: {}, }, }, - { isAcceptingInput: () => this.interfaceAPI.isAcceptingInput }, + { isAcceptingInput: () => { + this.interfaceAPI.isAcceptingInput }}, ); this.buttons.push(b); this.abilitiesButtons.push(b); + + //upgraded + /** + if(i == 2 && game.activeCreature.name == "Golden Wyrm"){ + b.changeState(ButtonStateEnum.potential); + + + if(game.activeCreature.abilities[].isUpgraded() && + ability.require()){ + b.changeState(ButtonStateEnum.potential); + } + }**/ } // ProgressBar @@ -1905,6 +1923,7 @@ export class UI { }, 1500); ab.setUpgraded(); // Set the ability to upgraded + } // Change the ability's frame when it gets upgraded From 8107e27db5670337ec2f76bfda829e3fffabc3a5 Mon Sep 17 00:00:00 2001 From: Mina928 A Date: Thu, 26 Oct 2023 23:58:23 +0000 Subject: [PATCH 4/7] Works however only after pressing another button first. Need to make the change instantly after upgrade --- src/style/styles.less | 13 ----------- src/ui/button.ts | 2 +- src/ui/interface.js | 52 +++++++++++++++++++++++-------------------- 3 files changed, 29 insertions(+), 38 deletions(-) diff --git a/src/style/styles.less b/src/style/styles.less index 12e6ae0d1..49eed6d49 100644 --- a/src/style/styles.less +++ b/src/style/styles.less @@ -378,19 +378,6 @@ } } - - @keyframes bounce { - 0% { - transform: translateX(0); - } - 50% { - transform: translateX(10px); - } - 100% { - transform: translateX(0); - } - } - &.potential { animation: rightJump 1s infinite; } diff --git a/src/ui/button.ts b/src/ui/button.ts index 8746c96bf..2a2e2adc2 100644 --- a/src/ui/button.ts +++ b/src/ui/button.ts @@ -209,7 +209,7 @@ export class Button { } }); - this.$button.removeClass('disabled glowing selected active noclick slideIn hidden'); + this.$button.removeClass('disabled glowing selected active noclick slideIn hidden potential'); wrapperElement && wrapperElement.removeClass('hidden'); this.$button.css(this.css.normal); diff --git a/src/ui/interface.js b/src/ui/interface.js index fef7f3abb..326d066ff 100644 --- a/src/ui/interface.js +++ b/src/ui/interface.js @@ -268,6 +268,8 @@ export class UI { { $button: $j('.ability[ability="' + i + '"]'), hasShortcut: true, + + click: () => { const game = this.game; if (this.selectedAbility != i) { @@ -289,18 +291,11 @@ export class UI { this.selectAbility(i); } - if(i == 1 && game.activeCreature.name == "Golden Wyrm"){ - if(game.activeCreature.abilities[2].isUpgraded() && - ability.require() && game.selectedAbility != ability){ - b.changeState(ButtonStateEnum.potential); - } else{ - b.cssTransition(ButtonStateEnum.potentialoff); - b.changeState(ButtonStateEnum.normal); - } - } - // Activate Ability game.activeCreature.abilities[i].use(); + + this.showBonusPotential(); + } else { // Cancel Ability this.closeDash(); @@ -363,18 +358,6 @@ export class UI { ); this.buttons.push(b); this.abilitiesButtons.push(b); - - //upgraded - /** - if(i == 2 && game.activeCreature.name == "Golden Wyrm"){ - b.changeState(ButtonStateEnum.potential); - - - if(game.activeCreature.abilities[].isUpgraded() && - ability.require()){ - b.changeState(ButtonStateEnum.potential); - } - }**/ } // ProgressBar @@ -685,6 +668,27 @@ export class UI { } } + + showBonusPotential(){ + + const game = this.game; + this.abilitiesButtons.forEach((btn) => { + const ability = game.activeCreature.abilities[btn.abilityId]; + + //The executioner Axes for Golden Wyrm jumps to the right + if( ability.used == false && + game.activeCreature.name == "Golden Wyrm" && + game.activeCreature.abilities[2].isUpgraded() && + ability.require() && + game.selectedAbility != ability && + btn.abilityId == 1 + ){ + btn.$button.addClass('potential') + btn.changeState(ButtonStateEnum.potential); + } + }); + } + showAbilityCosts(abilityId) { const game = this.game, creature = game.activeCreature, @@ -1853,6 +1857,7 @@ export class UI { this.changeAbilityButtons(); // Update upgrade info this.updateAbilityUpgrades(); + //this.showBonusPotential(); // Callback after final transition this.$activebox.children('#abilities').transition( { @@ -1922,8 +1927,7 @@ export class UI { } }, 1500); - ab.setUpgraded(); // Set the ability to upgraded - + ab.setUpgraded(); // Set the ability to upgraded } // Change the ability's frame when it gets upgraded From 38b3e813d54b47b585c398da180ed6f399d50a70 Mon Sep 17 00:00:00 2001 From: Mina928 A Date: Sun, 29 Oct 2023 03:12:31 +0000 Subject: [PATCH 5/7] New rigth bounce to show bonus onf Executioner Axe works --- src/ui/button.ts | 2 +- src/ui/interface.js | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/ui/button.ts b/src/ui/button.ts index 2a2e2adc2..528e6a8c6 100644 --- a/src/ui/button.ts +++ b/src/ui/button.ts @@ -209,7 +209,7 @@ export class Button { } }); - this.$button.removeClass('disabled glowing selected active noclick slideIn hidden potential'); + this.$button.removeClass('disabled glowing selected active noclick slideIn hidden potential potentialoff'); wrapperElement && wrapperElement.removeClass('hidden'); this.$button.css(this.css.normal); diff --git a/src/ui/interface.js b/src/ui/interface.js index 326d066ff..0b440476d 100644 --- a/src/ui/interface.js +++ b/src/ui/interface.js @@ -294,8 +294,6 @@ export class UI { // Activate Ability game.activeCreature.abilities[i].use(); - this.showBonusPotential(); - } else { // Cancel Ability this.closeDash(); @@ -670,22 +668,27 @@ export class UI { showBonusPotential(){ + //Shows bonus capability const game = this.game; this.abilitiesButtons.forEach((btn) => { const ability = game.activeCreature.abilities[btn.abilityId]; //The executioner Axes for Golden Wyrm jumps to the right - if( ability.used == false && + //Once Dragon Flight is upgraded + if(ability.used == false && game.activeCreature.name == "Golden Wyrm" && game.activeCreature.abilities[2].isUpgraded() && ability.require() && - game.selectedAbility != ability && + game.selectedAbility != 1 && btn.abilityId == 1 ){ btn.$button.addClass('potential') btn.changeState(ButtonStateEnum.potential); } + else{ + btn.changeState(ButtonStateEnum.normal); + } }); } @@ -1857,7 +1860,6 @@ export class UI { this.changeAbilityButtons(); // Update upgrade info this.updateAbilityUpgrades(); - //this.showBonusPotential(); // Callback after final transition this.$activebox.children('#abilities').transition( { @@ -1889,7 +1891,7 @@ export class UI { updateAbilityUpgrades() { const game = this.game, - creature = game.activeCreature; + creature = game.activeCreature; // Change ability buttons this.abilitiesButtons.forEach((btn) => { @@ -1970,6 +1972,7 @@ export class UI { $abilityInfo.append('
Upgrade : ' + ab.upgrade + '
'); } }); + this.showBonusPotential(); } checkAbilities() { @@ -1998,7 +2001,13 @@ export class UI { } if (ab.message == game.msg.abilities.passiveCycle) { this.abilitiesButtons[i].changeState(ButtonStateEnum.slideIn); - } else if (req && !ab.used && ab.trigger == 'onQuery') { + } else if(this.abilitiesButtons[i].state == ButtonStateEnum.potential){ + //Makes sure the right bounce is not stopped if ability not used yet + if(ab.used){ + this.abilitiesButtons[i].changeState(ButtonStateEnum.normal); + } + } + else if (req && !ab.used && ab.trigger == 'onQuery') { this.abilitiesButtons[i].changeState(ButtonStateEnum.slideIn); oneUsableAbility = true; } else if ( @@ -2033,6 +2042,8 @@ export class UI { } } + this.showBonusPotential(); + // No action possible if (!oneUsableAbility && game.activeCreature.remainingMove === 0) { //game.skipTurn( { tooltip: "Finished" } ); // Autoskip From fb4f76ce19228e9bba5d7f42ced030c5bd5c4148 Mon Sep 17 00:00:00 2001 From: Mina928 A Date: Sun, 29 Oct 2023 03:18:58 +0000 Subject: [PATCH 6/7] Removing an unused CSS class --- src/style/styles.less | 4 ---- src/ui/button.ts | 5 +---- src/ui/interface.js | 1 - 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/style/styles.less b/src/style/styles.less index 49eed6d49..d1189d851 100644 --- a/src/style/styles.less +++ b/src/style/styles.less @@ -381,10 +381,6 @@ &.potential { animation: rightJump 1s infinite; } - &.potentialoff { - animation: none !important; - } - } diff --git a/src/ui/button.ts b/src/ui/button.ts index 528e6a8c6..b59b9c897 100644 --- a/src/ui/button.ts +++ b/src/ui/button.ts @@ -10,7 +10,6 @@ export const ButtonStateEnum = { noClick: 'noclick', slideIn: 'slideIn', potential: 'potential', - potentialoff: 'potentialoff' } as const; /** @@ -104,8 +103,6 @@ export class Button { hidden: {}, noclick: {}, potential: {}, - potentialoff: {}, - }, }; @@ -209,7 +206,7 @@ export class Button { } }); - this.$button.removeClass('disabled glowing selected active noclick slideIn hidden potential potentialoff'); + this.$button.removeClass('disabled glowing selected active noclick slideIn hidden potential'); wrapperElement && wrapperElement.removeClass('hidden'); this.$button.css(this.css.normal); diff --git a/src/ui/interface.js b/src/ui/interface.js index 0b440476d..3ee4318cd 100644 --- a/src/ui/interface.js +++ b/src/ui/interface.js @@ -256,7 +256,6 @@ export class UI { }, slideIn: {}, potential: {}, - potentialoff:{}, }, }, { isAcceptingInput: () => this.interfaceAPI.isAcceptingInput }, From 2282726556e1fa5acdd293d8809fb5ba89f38eeb Mon Sep 17 00:00:00 2001 From: Mina928 A Date: Tue, 31 Oct 2023 02:35:50 +0000 Subject: [PATCH 7/7] Fixed ability to pop out when useable wihtout upgrade --- src/ui/interface.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/interface.js b/src/ui/interface.js index 3ee4318cd..0a3dc9008 100644 --- a/src/ui/interface.js +++ b/src/ui/interface.js @@ -686,7 +686,7 @@ export class UI { btn.changeState(ButtonStateEnum.potential); } else{ - btn.changeState(ButtonStateEnum.normal); + btn.$button.removeClass('potential') } }); }