[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:
parent
b2048148c9
commit
384f6e1fee
|
@ -3398,12 +3398,14 @@ export class EnemyPokemon extends Pokemon {
|
||||||
public aiType: AiType;
|
public aiType: AiType;
|
||||||
public bossSegments: integer;
|
public bossSegments: integer;
|
||||||
public bossSegmentIndex: integer;
|
public bossSegmentIndex: integer;
|
||||||
|
public readonly isPopulatedFromDataSource: boolean;
|
||||||
|
|
||||||
constructor(scene: BattleScene, species: PokemonSpecies, level: integer, trainerSlot: TrainerSlot, boss: boolean, dataSource: PokemonData) {
|
constructor(scene: BattleScene, species: PokemonSpecies, level: integer, trainerSlot: TrainerSlot, boss: boolean, dataSource: PokemonData) {
|
||||||
super(scene, 236, 84, species, level, dataSource?.abilityIndex, dataSource?.formIndex,
|
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);
|
dataSource?.gender, dataSource ? dataSource.shiny : false, dataSource ? dataSource.variant : undefined, null, dataSource ? dataSource.nature : undefined, dataSource);
|
||||||
|
|
||||||
this.trainerSlot = trainerSlot;
|
this.trainerSlot = trainerSlot;
|
||||||
|
this.isPopulatedFromDataSource = !!dataSource;
|
||||||
if (boss) {
|
if (boss) {
|
||||||
this.setBoss(boss, dataSource?.bossSegments);
|
this.setBoss(boss, dataSource?.bossSegments);
|
||||||
}
|
}
|
||||||
|
|
|
@ -870,7 +870,7 @@ export class EncounterPhase extends BattlePhase {
|
||||||
} else {
|
} else {
|
||||||
if (battle.enemyParty.filter(p => p.isBoss()).length > 1) {
|
if (battle.enemyParty.filter(p => p.isBoss()).length > 1) {
|
||||||
for (const enemyPokemon of battle.enemyParty) {
|
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.setBoss(true, Math.ceil(enemyPokemon.bossSegments * (enemyPokemon.getSpeciesForm().baseTotal / totalBst)));
|
||||||
enemyPokemon.initBattleInfo();
|
enemyPokemon.initBattleInfo();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue