[Bug] Fix console error from undefined stockpilingTag (#4118)

This commit is contained in:
Adrian T. 2024-09-09 11:50:47 +08:00 committed by GitHub
parent 68b956cbe6
commit 06f98f6737
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3472,7 +3472,7 @@ export class SpitUpPowerAttr extends VariablePowerAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const stockpilingTag = user.getTag(StockpilingTag);
if (stockpilingTag !== null && stockpilingTag.stockpiledCount > 0) {
if (stockpilingTag && stockpilingTag.stockpiledCount > 0) {
const power = args[0] as Utils.IntegerHolder;
power.value = this.multiplier * stockpilingTag.stockpiledCount;
return true;
@ -3490,7 +3490,7 @@ export class SwallowHealAttr extends HealAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const stockpilingTag = user.getTag(StockpilingTag);
if (stockpilingTag !== null && stockpilingTag?.stockpiledCount > 0) {
if (stockpilingTag && stockpilingTag.stockpiledCount > 0) {
const stockpiled = stockpilingTag.stockpiledCount;
let healRatio: number;