Rework post summon logic

pull/2/head
Flashfyre 2023-07-04 17:50:51 -04:00
parent 1e8798b708
commit e46bb9fd50
3 changed files with 35 additions and 11 deletions

View File

@ -7,7 +7,7 @@ import { Command } from "./ui/command-ui-handler";
import { Stat } from "./data/pokemon-stat";
import { BerryModifier, ContactHeldItemTransferChanceModifier, ExpBalanceModifier, ExpBoosterModifier, ExpShareModifier, ExtraModifierModifier, FlinchChanceModifier, HealingBoosterModifier, HitHealModifier, LapsingPersistentModifier, MapModifier, MultipleParticipantExpBonusModifier, PokemonExpBoosterModifier, PokemonHeldItemModifier, PokemonInstantReviveModifier, SwitchEffectTransferModifier, TempBattleStatBoosterModifier, TurnHealModifier, TurnHeldItemTransferModifier } from "./modifier/modifier";
import PartyUiHandler, { PartyOption, PartyUiMode } from "./ui/party-ui-handler";
import { doPokeballBounceAnim, getPokeballAtlasKey, getPokeballCatchMultiplier, getPokeballName, getPokeballTintColor, PokeballType } from "./data/pokeball";
import { doPokeballBounceAnim, getPokeballAtlasKey, getPokeballCatchMultiplier, getPokeballTintColor, PokeballType } from "./data/pokeball";
import { CommonAnim, CommonBattleAnim, MoveAnim, initMoveAnim, loadMoveAnimAssets } from "./data/battle-anims";
import { StatusEffect, getStatusEffectActivationText, getStatusEffectCatchRateMultiplier, getStatusEffectHealText, getStatusEffectObtainText, getStatusEffectOverlapText } from "./data/status-effect";
import { SummaryUiMode } from "./ui/summary-ui-handler";
@ -78,6 +78,7 @@ export class CheckLoadPhase extends BattlePhase {
this.scene.pushPhase(new SummonPhase(this.scene, 0));
if (this.scene.currentBattle.double && this.scene.getParty().filter(p => !p.isFainted()).length > 1)
this.scene.pushPhase(new SummonPhase(this.scene, 1));
this.scene.getEnemyField().map(p => this.scene.pushPhase(new PostSummonPhase(this.scene, p.getBattlerIndex())));
super.end();
}
@ -277,8 +278,6 @@ export class EncounterPhase extends BattlePhase {
});
enemyField.forEach(enemyPokemon => this.scene.arena.applyTags(ArenaTrapTag, enemyPokemon));
enemyField.forEach(enemyPokemon => applyPostSummonAbAttrs(PostSummonAbAttr, enemyPokemon));
// TODO: Remove
//this.scene.unshiftPhase(new SelectModifierPhase(this.scene));
@ -353,6 +352,23 @@ export class NewBiomeEncounterPhase extends NextEncounterPhase {
}
}
export class PostSummonPhase extends PokemonPhase {
constructor(scene: BattleScene, battlerIndex: BattlerIndex) {
super(scene, battlerIndex);
}
start() {
super.start();
const pokemon = this.getPokemon();
this.scene.arena.applyTags(ArenaTrapTag, pokemon);
applyPostSummonAbAttrs(PostSummonAbAttr, pokemon);
this.end();
}
}
export class SelectBiomePhase extends BattlePhase {
constructor(scene: BattleScene) {
super(scene);
@ -544,6 +560,10 @@ export class SummonPhase extends PartyMemberPokemonPhase {
});
}
queuePostSummon() {
this.scene.pushPhase(new PostSummonPhase(this.scene, this.getPokemon().getBattlerIndex()));
}
end() {
const pokemon = this.getPokemon();
@ -552,9 +572,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
pokemon.resetTurnData();
this.scene.arena.applyTags(ArenaTrapTag, pokemon);
applyPostSummonAbAttrs(PostSummonAbAttr, pokemon);
this.queuePostSummon();
super.end();
}
@ -624,6 +642,10 @@ export class SwitchSummonPhase extends SummonPhase {
this.end();
}
queuePostSummon() {
this.scene.unshiftPhase(new PostSummonPhase(this.scene, this.getPokemon().getBattlerIndex()));
}
end() {
const pokemon = this.getPokemon();

View File

@ -1,13 +1,12 @@
import Phaser from 'phaser';
import { Biome } from './data/biome';
import UI from './ui/ui';
import { EncounterPhase, SummonPhase, NextEncounterPhase, NewBiomeEncounterPhase, SelectBiomePhase, MessagePhase, CheckLoadPhase, TurnInitPhase, ReturnPhase, ToggleDoublePositionPhase, CheckSwitchPhase } from './battle-phases';
import { EncounterPhase, SummonPhase, NextEncounterPhase, NewBiomeEncounterPhase, SelectBiomePhase, MessagePhase, CheckLoadPhase, TurnInitPhase, ReturnPhase, ToggleDoublePositionPhase, CheckSwitchPhase, PostSummonPhase } from './battle-phases';
import Pokemon, { PlayerPokemon, EnemyPokemon } from './pokemon';
import PokemonSpecies, { allSpecies, getPokemonSpecies, initSpecies } from './data/pokemon-species';
import * as Utils from './utils';
import { Modifier, ModifierBar, ConsumablePokemonModifier, ConsumableModifier, PokemonHpRestoreModifier, HealingBoosterModifier, PersistentModifier, PokemonHeldItemModifier, ModifierPredicate, DoubleBattleChanceBoosterModifier } from './modifier/modifier';
import { PokeballType } from './data/pokeball';
import { Species } from './data/species';
import { initAutoPlay } from './system/auto-play';
import { initCommonAnims, initMoveAnim, loadCommonAnimAssets, loadMoveAnimAssets, populateAnims } from './data/battle-anims';
import { BattlePhase } from './battle-phase';
@ -565,6 +564,8 @@ export default class BattleScene extends Phaser.Scene {
if (newDouble)
this.pushPhase(new CheckSwitchPhase(this, 1, newDouble));
}
this.getField().filter(p => p?.isActive(true)).map(p => this.pushPhase(new PostSummonPhase(this, p.getBattlerIndex())));
}
return this.currentBattle;

View File

@ -2648,10 +2648,11 @@ export function initMoves() {
new AttackMove(Moves.OUTRAGE, "Outrage", Type.DRAGON, MoveCategory.PHYSICAL, 120, 100, 10, 156, "User attacks for 2-3 turns but then becomes confused.", -1, 0, 2)
.attr(FrenzyAttr)
.attr(MissEffectAttr, frenzyMissFunc)
.attr(ConfuseAttr, true), // TODO: Update to still confuse if last hit misses
.attr(ConfuseAttr, true) // TODO: Update to still confuse if last hit misses
.target(MoveTarget.RANDOM_NEAR_ENEMY),
new StatusMove(Moves.SANDSTORM, "Sandstorm", Type.ROCK, -1, 10, 51, "Creates a sandstorm for 5 turns.", -1, 0, 2)
.attr(WeatherChangeAttr, WeatherType.SANDSTORM)
.target(MoveTarget.RANDOM_NEAR_ENEMY),
.target(MoveTarget.BOTH_SIDES),
new AttackMove(Moves.GIGA_DRAIN, "Giga Drain", Type.GRASS, MoveCategory.SPECIAL, 75, 100, 10, 111, "User recovers half the HP inflicted on opponent.", -1, 4, 2)
.attr(HitHealAttr),
new SelfStatusMove(Moves.ENDURE, "Endure (N)", Type.NORMAL, -1, 10, 47, "Always left with at least 1 HP, but may fail if used consecutively.", -1, 0, 2),
@ -2967,7 +2968,7 @@ export function initMoves() {
new AttackMove(Moves.PSYCHO_BOOST, "Psycho Boost", Type.PSYCHIC, MoveCategory.SPECIAL, 140, 90, 5, -1, "Sharply lowers user's Special Attack.", 100, 0, 3)
.attr(StatChangeAttr, BattleStat.SPATK, -2, true),
new SelfStatusMove(Moves.ROOST, "Roost", Type.FLYING, -1, 5, -1, "User recovers half of its max HP and loses the FLYING type temporarily.", -1, 0, 4)
.attr(HitHealAttr)
.attr(HealAttr)
.attr(AddBattlerTagAttr, BattlerTagType.IGNORE_FLYING, true, 1),
new SelfStatusMove(Moves.GRAVITY, "Gravity", Type.PSYCHIC, -1, 5, -1, "Prevents moves like FLY and BOUNCE and the Ability LEVITATE for 5 turns.", -1, 0, 4)
.attr(AddArenaTagAttr, ArenaTagType.GRAVITY, 5)