[Bug] add flag to know if pokemon was populated from data-source to fix boss segments for endless double bosses (#2672)

also reverted previous change as this was breaking for non-session-restored fights
This commit is contained in:
flx-sta 2024-06-27 16:55:27 -07:00 committed by GitHub
parent b2048148c9
commit 384f6e1fee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -3398,12 +3398,14 @@ export class EnemyPokemon extends Pokemon {
public aiType: AiType;
public bossSegments: integer;
public bossSegmentIndex: integer;
public readonly isPopulatedFromDataSource: boolean;
constructor(scene: BattleScene, species: PokemonSpecies, level: integer, trainerSlot: TrainerSlot, boss: boolean, dataSource: PokemonData) {
super(scene, 236, 84, species, level, dataSource?.abilityIndex, dataSource?.formIndex,
dataSource?.gender, dataSource ? dataSource.shiny : false, dataSource ? dataSource.variant : undefined, null, dataSource ? dataSource.nature : undefined, dataSource);
this.trainerSlot = trainerSlot;
this.isPopulatedFromDataSource = !!dataSource;
if (boss) {
this.setBoss(boss, dataSource?.bossSegments);
}

View File

@ -870,7 +870,7 @@ export class EncounterPhase extends BattlePhase {
} else {
if (battle.enemyParty.filter(p => p.isBoss()).length > 1) {
for (const enemyPokemon of battle.enemyParty) {
if (enemyPokemon.isBoss()) {
if (enemyPokemon.isBoss() && !enemyPokemon.isPopulatedFromDataSource) {
enemyPokemon.setBoss(true, Math.ceil(enemyPokemon.bossSegments * (enemyPokemon.getSpeciesForm().baseTotal / totalBst)));
enemyPokemon.initBattleInfo();
}