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

[Hotfix] Fix interactions of moves that change type #3183

Merged
merged 1 commit into from
Jul 28, 2024
Merged
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
6 changes: 5 additions & 1 deletion src/data/move.ts
Original file line number Diff line number Diff line change
Expand Up @@ -717,9 +717,13 @@ export default class Move implements Localizable {
* @returns The calculated power of the move.
*/
calculateBattlePower(source: Pokemon, target: Pokemon): number {
const power = new Utils.NumberHolder(this.power);
if (this.category === MoveCategory.STATUS) {
return -1;
}

const power = new Utils.NumberHolder(this.power);
const typeChangeMovePowerMultiplier = new Utils.NumberHolder(1);

applyPreAttackAbAttrs(MoveTypeChangeAttr, source, target, this, typeChangeMovePowerMultiplier);

const sourceTeraType = source.getTeraType();
Expand Down
3 changes: 2 additions & 1 deletion src/field/pokemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1836,7 +1836,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
const types = this.getTypes(true, true);

const cancelled = new Utils.BooleanHolder(false);
const power = move.calculateBattlePower(source, this);
const typeless = move.hasAttr(TypelessAttr);

const typeMultiplier = new Utils.NumberHolder(!typeless && (moveCategory !== MoveCategory.STATUS || move.getAttrs(StatusMoveTypeImmunityAttr).find(attr => types.includes(attr.immuneType)))
? this.getAttackTypeEffectiveness(move, source, false, false)
: 1);
Expand All @@ -1861,7 +1863,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
case MoveCategory.PHYSICAL:
case MoveCategory.SPECIAL:
const isPhysical = moveCategory === MoveCategory.PHYSICAL;
const power = move.calculateBattlePower(source, this);
const sourceTeraType = source.getTeraType();

if (!typeless) {
Expand Down
Loading