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

Conversation

Mina928
Copy link

@Mina928 Mina928 commented Oct 29, 2023

This Pull Request adds a feature requested in Issue #1976

When the character Golden Wyrm gets an upgrade from their Dragon Flight ability, they get an attack bonus. The Executioner's Axe is the only ability able to make use of this bonus, and the issue suggested adding a visual indication of this bonus, by bouncing the relevant button a bit to the right.
This feature helps give player's a visual signal to remind them of the bonus they have.

There were few files that needed changes to make this possible:

  • src/style/styles.less: A new keyframes animation, and CSS class that plays that animation was added. This allowed the button state to be easily changed using the existing functions
  • src/ui/button.ts: The new CSS animation had to be setup and defined so the Button data type knew to expect it.
  • src/ui/interface.js: A new function showBonusPotential() was added to check for the requirements and play or stop the animation accordingly.
    • This function was then called in the usual abilities check function checkAbilities(), and the function where upgrades are processed updateAbilityUpgrades().
    • In the future this function can have additional if statements added to implement the new animation onto other abilities and situations.

@vercel
Copy link

vercel bot commented Oct 29, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
ancientbeast ✅ Ready (Inspect) Visit Preview Oct 31, 2023 2:45am

@ghost
Copy link

ghost commented Oct 29, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@DreadKnight
Copy link
Member

@Mina928 Heya! I've tested this and found some show stopper issues:

  • when abilities not upgraded, they don't reveal themselves when usable
  • Dragon Flight seems to be usable multiple times when not upgraded

@DreadKnight DreadKnight marked this pull request as draft October 30, 2023 01:17
@Mina928
Copy link
Author

Mina928 commented Oct 31, 2023

@DreadKnight Hello!
Thanks so much for the feedback, the first bug was due to a small change I forgot to make, after getting rid of one the CSS classes I defined for buttons. It is fixed now and the buttons should behave as expected.

I was not able to replicate the second bug. When I play it does not allow me to use Dragon Flight more than once each turn, both before and after upgrade. I also didn't write any code that should affect that button, but let me know if it still persists and I can look through and experiment with the code again.

@DreadKnight
Copy link
Member

@Mina928 Seems alright now, well done! Should have been marked as ready for review again 🐻

@DreadKnight DreadKnight marked this pull request as ready for review October 31, 2023 05:34
Copy link
Member

@DreadKnight DreadKnight left a comment

Choose a reason for hiding this comment

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

@Mina928 Now that the code was doing what issue requested, I've moved to reviewing the code itself. Some changes requested. Golden Wyrm's ability file should ask set a state that UI reacts to, not have UI await specific stuff.

"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?

@@ -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 "{"

@@ -658,6 +665,32 @@ export class UI {
}
}


showBonusPotential(){
//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 "//"

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.

const ability = game.activeCreature.abilities[btn.abilityId];

//The executioner Axes for Golden Wyrm jumps to the right
//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.

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".

@@ -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.

@@ -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 "{".

@@ -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){
//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 "//"

} 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){
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 ")"

@DreadKnight DreadKnight marked this pull request as draft November 13, 2023 19:18
@DreadKnight
Copy link
Member

@Mina928 Hey, can you poke at the requested changes and such so that we can resolve this one before it gets stale?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants