mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-28 17:56:09 +00:00
Honey Gather and Pickup will only activate if the battle was won
This commit is contained in:
parent
33d8db73ef
commit
bb09fdacdf
@ -4112,9 +4112,13 @@ export class PostBattleAbAttr extends AbAttr {
|
||||
}
|
||||
|
||||
export class PostBattleLootAbAttr extends PostBattleAbAttr {
|
||||
/**
|
||||
* @param args - `[0]`: boolean for if the battle ended in a victory
|
||||
* @returns `true` if successful
|
||||
*/
|
||||
applyPostBattle(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
|
||||
const postBattleLoot = pokemon.scene.currentBattle.postBattleLoot;
|
||||
if (!simulated && postBattleLoot.length) {
|
||||
if (!simulated && postBattleLoot.length && args[0]) {
|
||||
const randItem = Utils.randSeedItem(postBattleLoot);
|
||||
//@ts-ignore - TODO see below
|
||||
if (pokemon.scene.tryTransferHeldItemModifier(randItem, pokemon, true, 1, true, undefined, false)) { // TODO: fix. This is a promise!?
|
||||
@ -4575,14 +4579,15 @@ export class MoneyAbAttr extends PostBattleAbAttr {
|
||||
/**
|
||||
* @param pokemon {@linkcode Pokemon} that is the user of this ability.
|
||||
* @param passive N/A
|
||||
* @param args N/A
|
||||
* @returns true
|
||||
* @param args - `[0]`: boolean for if the battle ended in a victory
|
||||
* @returns `true` if successful
|
||||
*/
|
||||
applyPostBattle(pokemon: Pokemon, passive: boolean, simulated: boolean, args: any[]): boolean {
|
||||
if (!simulated) {
|
||||
if (!simulated && args[0]) {
|
||||
pokemon.scene.currentBattle.moneyScattered += pokemon.scene.getWaveMoneyAmount(0.2);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4590,13 +4595,12 @@ export class MoneyAbAttr extends PostBattleAbAttr {
|
||||
* Applies a stat change after a Pokémon is summoned,
|
||||
* conditioned on the presence of a specific arena tag.
|
||||
*
|
||||
* @extends {PostSummonStatStageChangeAbAttr}
|
||||
* @extends PostSummonStatStageChangeAbAttr
|
||||
*/
|
||||
export class PostSummonStatStageChangeOnArenaAbAttr extends PostSummonStatStageChangeAbAttr {
|
||||
/**
|
||||
* The type of arena tag that conditions the stat change.
|
||||
* @private
|
||||
* @type {ArenaTagType}
|
||||
*/
|
||||
private tagType: ArenaTagType;
|
||||
|
||||
@ -4972,7 +4976,7 @@ class ForceSwitchOutHelper {
|
||||
pokemon.scene.clearEnemyHeldItemModifiers();
|
||||
|
||||
if (switchOutTarget.hp) {
|
||||
pokemon.scene.pushPhase(new BattleEndPhase(pokemon.scene));
|
||||
pokemon.scene.pushPhase(new BattleEndPhase(pokemon.scene, false));
|
||||
pokemon.scene.pushPhase(new NewBattlePhase(pokemon.scene));
|
||||
}
|
||||
}
|
||||
|
@ -6035,7 +6035,7 @@ export class ForceSwitchOutAttr extends MoveEffectAttr {
|
||||
user.scene.clearEnemyHeldItemModifiers();
|
||||
|
||||
if (switchOutTarget.hp) {
|
||||
user.scene.pushPhase(new BattleEndPhase(user.scene));
|
||||
user.scene.pushPhase(new BattleEndPhase(user.scene, false));
|
||||
user.scene.pushPhase(new NewBattlePhase(user.scene));
|
||||
}
|
||||
}
|
||||
|
@ -731,7 +731,7 @@ export function handleMysteryEncounterVictory(scene: BattleScene, addHealPhase:
|
||||
scene.pushPhase(new MysteryEncounterRewardsPhase(scene, addHealPhase));
|
||||
scene.pushPhase(new EggLapsePhase(scene));
|
||||
} else if (!scene.getEnemyParty().find(p => encounter.encounterMode !== MysteryEncounterMode.TRAINER_BATTLE ? p.isOnField() : !p?.isFainted(true))) {
|
||||
scene.pushPhase(new BattleEndPhase(scene));
|
||||
scene.pushPhase(new BattleEndPhase(scene, true));
|
||||
if (encounter.encounterMode === MysteryEncounterMode.TRAINER_BATTLE) {
|
||||
scene.pushPhase(new TrainerVictoryPhase(scene));
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ export class AttemptRunPhase extends PokemonPhase {
|
||||
enemyPokemon.trySetStatus(StatusEffect.FAINT);
|
||||
});
|
||||
|
||||
this.scene.pushPhase(new BattleEndPhase(this.scene));
|
||||
this.scene.pushPhase(new BattleEndPhase(this.scene, false));
|
||||
this.scene.pushPhase(new NewBattlePhase(this.scene));
|
||||
} else {
|
||||
playerPokemon.turnData.failedRunAway = true;
|
||||
|
@ -8,7 +8,7 @@ export class BattleEndPhase extends BattlePhase {
|
||||
/** If true, will increment battles won */
|
||||
isVictory: boolean;
|
||||
|
||||
constructor(scene: BattleScene, isVictory: boolean = true) {
|
||||
constructor(scene: BattleScene, isVictory: boolean) {
|
||||
super(scene);
|
||||
|
||||
this.isVictory = isVictory;
|
||||
@ -42,7 +42,7 @@ export class BattleEndPhase extends BattlePhase {
|
||||
}
|
||||
|
||||
for (const pokemon of this.scene.getPokemonAllowedInBattle()) {
|
||||
applyPostBattleAbAttrs(PostBattleAbAttr, pokemon);
|
||||
applyPostBattleAbAttrs(PostBattleAbAttr, pokemon, false, this.isVictory);
|
||||
}
|
||||
|
||||
if (this.scene.currentBattle.moneyScattered) {
|
||||
|
@ -41,7 +41,7 @@ export class VictoryPhase extends PokemonPhase {
|
||||
}
|
||||
|
||||
if (!this.scene.getEnemyParty().find(p => this.scene.currentBattle.battleType === BattleType.WILD ? p.isOnField() : !p?.isFainted(true))) {
|
||||
this.scene.pushPhase(new BattleEndPhase(this.scene));
|
||||
this.scene.pushPhase(new BattleEndPhase(this.scene, true));
|
||||
if (this.scene.currentBattle.battleType === BattleType.TRAINER) {
|
||||
this.scene.pushPhase(new TrainerVictoryPhase(this.scene));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user