[Hotfix] Fix interactions of some moves not changing types (#3183)

This commit is contained in:
Adrian T. 2024-07-29 04:46:37 +08:00 committed by GitHub
parent 8a883ea079
commit a8adfc2476
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -717,9 +717,13 @@ export default class Move implements Localizable {
* @returns The calculated power of the move. * @returns The calculated power of the move.
*/ */
calculateBattlePower(source: Pokemon, target: Pokemon): number { 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); const typeChangeMovePowerMultiplier = new Utils.NumberHolder(1);
applyPreAttackAbAttrs(MoveTypeChangeAttr, source, target, this, typeChangeMovePowerMultiplier); applyPreAttackAbAttrs(MoveTypeChangeAttr, source, target, this, typeChangeMovePowerMultiplier);
const sourceTeraType = source.getTeraType(); const sourceTeraType = source.getTeraType();

View File

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