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

Improve Stellar handling #605

Merged
merged 10 commits into from
Mar 21, 2024
Merged

Improve Stellar handling #605

merged 10 commits into from
Mar 21, 2024

Conversation

Zrp200
Copy link
Contributor

@Zrp200 Zrp200 commented Mar 15, 2024

Currently, Tera Stellar is shown in too many cases. When it's active, it is always shown, but this is misleading:

  • When using a move other than tera blast, it only applies on the first time, otherwise it's identical to not being there at all
  • It does nothing defensively, outside of giving a weakness to Stellar type attacks

Even in the case of Tera Blast, the first use has a different stab modifier, but both cases just display 'Tera Stellar' and 100 BP, which is incorrect --- the same description should ideally always yield the same numbers.

Tera Blast remains as a special case
…because of it

Tera Blast remains as a special case
- note that this still doesn't work for enabling stat drops on the calc, due to move handling of dropsStats ignoring the argument of timesUsed if dropsStats is not true at time of method call
@Zrp200
Copy link
Contributor Author

Zrp200 commented Mar 15, 2024

The only hitch is that you still can't specify timesUsed in the calculator for Tera Blast Stellar.

var dropsStats =
This doesn't apply in this case, since dropsStats is only set after the calculation starts. A workaround solution is possible, but
this.timesUsed = (this.dropsStats && options.timesUsed) || 1;
prevents actual passing of the parameter to begin with, haha. Still looking into this, however.

* logic is entirely in shared_controls.js via overrides; removed the override in gen789.ts
* also slightly refactored getMoveDetails to have less duplication. It also now takes the tera type as an argument, since it handles tera blast now.
@thejetou
Copy link
Collaborator

The only hitch is that you still can't specify timesUsed in the calculator for Tera Blast Stellar.

var dropsStats =

This doesn't apply in this case, since dropsStats is only set after the calculation starts. A workaround solution is possible, but

this.timesUsed = (this.dropsStats && options.timesUsed) || 1;

prevents actual passing of the parameter to begin with, haha. Still looking into this, however.

Hm, I think a good solution would be to set an overrides of self.boosts to Move if the move is Tera Blast Stellar in shared_controls.js.

src/js/shared_controls.js Outdated Show resolved Hide resolved
@Zrp200
Copy link
Contributor Author

Zrp200 commented Mar 16, 2024 via email

@Zrp200
Copy link
Contributor Author

Zrp200 commented Mar 17, 2024

The only hitch is that you still can't specify timesUsed in the calculator for Tera Blast Stellar.

var dropsStats =

This doesn't apply in this case, since dropsStats is only set after the calculation starts. A workaround solution is possible, but

this.timesUsed = (this.dropsStats && options.timesUsed) || 1;

prevents actual passing of the parameter to begin with, haha. Still looking into this, however.

Hm, I think a good solution would be to set an overrides of self.boosts to Move if the move is Tera Blast Stellar in shared_controls.js.

Is this not what the current implementation does?

if (moveName === 'Tera Blast') {

calc/src/mechanics/gen789.ts Outdated Show resolved Hide resolved
Comment on lines +1071 to +1075
var statDrops = moveInfo.find('.stat-drops');
var dropsStats = statDrops.is(':visible');
if (isStellar !== dropsStats) {
// update stat drop dropdown here
if (isStellar) statDrops.show(); else statDrops.hide();
Copy link
Collaborator

@thejetou thejetou Mar 18, 2024

Choose a reason for hiding this comment

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

Suggested change
var statDrops = moveInfo.find('.stat-drops');
var dropsStats = statDrops.is(':visible');
if (isStellar !== dropsStats) {
// update stat drop dropdown here
if (isStellar) statDrops.show(); else statDrops.hide();
var statDrops = moveInfo.find('.stat-drops');
var dropsStats = statDrops.is(':visible');
if (isStellar !== dropsStats) {
isStellar ? statDrops.show() : statDrops.hide();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What does this do? This results in an error, since you cut out statDrops entirely, plus I don't understand why you converted an if statement to a tertiary operator.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, I didn't see that statDrops is used in dropsStats too. I'll edit that out.

If the if statement is simple enough it's just more concise to write is a ternary expression which is why I converted it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reverted the implementation, since doing this violates the linter, and it also messed with some of the formatting.

calc/src/desc.ts Outdated Show resolved Hide resolved
@thejetou thejetou merged commit 01467a8 into smogon:master Mar 21, 2024
2 checks passed
@thejetou
Copy link
Collaborator

Thank you!

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