Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implmented showcase ability bonus potential in Golden Wyrm (Issue #1976) #2523

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's with this package?

},
"devDependencies": {
"@babel/core": "^7.21.4",
Expand Down
19 changes: 19 additions & 0 deletions src/style/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,11 @@
cursor: help !important;
}
}

&.potential {
animation: rightJump 1s infinite;
}

}

#fullscreen {
Expand Down Expand Up @@ -1439,6 +1444,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 {
Expand Down
4 changes: 3 additions & 1 deletion src/ui/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const ButtonStateEnum = {
hidden: 'hidden',
noClick: 'noclick',
slideIn: 'slideIn',
potential: 'potential',
} as const;

/**
Expand Down Expand Up @@ -101,6 +102,7 @@ export class Button {
slideIn: {},
hidden: {},
noclick: {},
potential: {},
},
};

Expand Down Expand Up @@ -204,7 +206,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);

Expand Down
50 changes: 46 additions & 4 deletions src/ui/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ export class UI {
cursor: 'default',
},
slideIn: {},
potential: {},
},
},
{ isAcceptingInput: () => this.interfaceAPI.isAcceptingInput },
Expand All @@ -266,6 +267,8 @@ export class UI {
{
$button: $j('.ability[ability="' + i + '"]'),
hasShortcut: true,


click: () => {
const game = this.game;
if (this.selectedAbility != i) {
Expand All @@ -286,8 +289,10 @@ export class UI {
if (ability.require() == true && i != 0) {
this.selectAbility(i);
}

// Activate Ability
game.activeCreature.abilities[i].use();

} else {
// Cancel Ability
this.closeDash();
Expand Down Expand Up @@ -342,9 +347,11 @@ export class UI {
slideIn: {
cursor: 'pointer',
},
potential: {},
},
},
{ isAcceptingInput: () => this.interfaceAPI.isAcceptingInput },
{ isAcceptingInput: () => {
this.interfaceAPI.isAcceptingInput }},
);
this.buttons.push(b);
this.abilitiesButtons.push(b);
Expand Down Expand Up @@ -658,6 +665,32 @@ export class UI {
}
}


showBonusPotential(){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linting: space between "()" and "{"

//Shows bonus capability
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after "//"


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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be more generic, reusable for other abilities. Meaning no mention of specific unit and ability in interface.js.

//Once Dragon Flight is upgraded
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after "//".
Also, should be more generic, without specific ability name.

if(ability.used == false &&
game.activeCreature.name == "Golden Wyrm" &&
game.activeCreature.abilities[2].isUpgraded() &&
ability.require() &&
game.selectedAbility != 1 &&
btn.abilityId == 1
){
btn.$button.addClass('potential')
btn.changeState(ButtonStateEnum.potential);
}
else{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after "else".

btn.$button.removeClass('potential')
}
});
}

showAbilityCosts(abilityId) {
const game = this.game,
creature = game.activeCreature,
Expand Down Expand Up @@ -1857,7 +1890,7 @@ export class UI {

updateAbilityUpgrades() {
const game = this.game,
creature = game.activeCreature;
creature = game.activeCreature;

// Change ability buttons
this.abilitiesButtons.forEach((btn) => {
Expand Down Expand Up @@ -1895,7 +1928,7 @@ export class UI {
}
}, 1500);

ab.setUpgraded(); // Set the ability to upgraded
ab.setUpgraded(); // Set the ability to upgraded
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some tabs after comment it seems.

}

// Change the ability's frame when it gets upgraded
Expand Down Expand Up @@ -1938,6 +1971,7 @@ export class UI {
$abilityInfo.append('<div class="info upgrade">Upgrade : ' + ab.upgrade + '</div>');
}
});
this.showBonusPotential();
}

checkAbilities() {
Expand Down Expand Up @@ -1966,7 +2000,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){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space between ")" and "{".

//Makes sure the right bounce is not stopped if ability not used yet
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after "//"

if(ab.used){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after ")"

this.abilitiesButtons[i].changeState(ButtonStateEnum.normal);
}
}
else if (req && !ab.used && ab.trigger == 'onQuery') {
this.abilitiesButtons[i].changeState(ButtonStateEnum.slideIn);
oneUsableAbility = true;
} else if (
Expand Down Expand Up @@ -2001,6 +2041,8 @@ export class UI {
}
}

this.showBonusPotential();

// No action possible
if (!oneUsableAbility && game.activeCreature.remainingMove === 0) {
//game.skipTurn( { tooltip: "Finished" } ); // Autoskip
Expand Down