Fix Last Respects and Supreme Overlord (#9111)

This commit is contained in:
kittenchilly
2022-12-04 11:46:28 -06:00
committed by GitHub
parent 93a0a0f61c
commit 30c41dcfbf
6 changed files with 15 additions and 9 deletions

View File

@@ -1684,6 +1684,7 @@ export const Formats: FormatList = [
this.runEvent('BeforeFaint', pokemon, faintData.source, faintData.effect)) {
this.add('faint', pokemon);
pokemon.side.pokemonLeft--;
if (pokemon.side.totalFainted < 100) pokemon.side.totalFainted++;
this.runEvent('Faint', pokemon, faintData.source, faintData.effect);
this.singleEvent('End', pokemon.getAbility(), pokemon.abilityState, pokemon);
pokemon.clearVolatile(false);

View File

@@ -4294,17 +4294,18 @@ export const Abilities: {[abilityid: string]: AbilityData} = {
},
supremeoverlord: {
onStart(pokemon) {
const faintedAllies = pokemon.side.pokemon.filter(ally => ally.fainted).length;
if (faintedAllies) {
if (pokemon.side.totalFainted) {
this.add('-activate', pokemon, 'ability: Supreme Overlord');
this.effectState.fallen = Math.min(pokemon.side.totalFainted, 5);
}
},
onBasePower(basePower, source, target, move) {
const faintedAllies = Math.min(5, source.side.pokemon.filter(ally => ally.fainted).length);
if (faintedAllies) return this.chainModify(1 + (0.1 * faintedAllies));
},
onAllyFaint() {
this.add('-activate', this.effectState.target, 'ability: Supreme Overlord');
onBasePowerPriority: 21,
onBasePower(basePower, attacker, defender, move) {
if (this.effectState.fallen) {
const powMod = [4096, 4506, 4915, 5325, 5734, 6144];
this.debug(`Supreme Overlord boost: ${powMod[this.effectState.fallen]}/4096`);
return this.chainModify([powMod[this.effectState.fallen], 4096]);
}
},
name: "Supreme Overlord",
rating: 3.5,

View File

@@ -530,6 +530,7 @@ export const Scripts: ModdedBattleScriptsData = {
this.runEvent('BeforeFaint', pokemon, faintData.source, faintData.effect)) {
this.add('faint', pokemon);
pokemon.side.pokemonLeft--;
if (pokemon.side.totalFainted < 100) pokemon.side.totalFainted++;
this.runEvent('Faint', pokemon, faintData.source, faintData.effect);
this.singleEvent('End', pokemon.getAbility(), pokemon.abilityState, pokemon);
pokemon.clearVolatile(false);

View File

@@ -10194,7 +10194,7 @@ export const Moves: {[moveid: string]: MoveData} = {
accuracy: 100,
basePower: 50,
basePowerCallback(pokemon, target, move) {
return 50 + 50 * pokemon.side.pokemon.filter(ally => ally.fainted).length;
return 50 + 50 * pokemon.side.totalFainted;
},
category: "Physical",
name: "Last Respects",

View File

@@ -2307,6 +2307,7 @@ export class Battle {
this.runEvent('BeforeFaint', pokemon, faintData.source, faintData.effect)) {
this.add('faint', pokemon);
if (pokemon.side.pokemonLeft) pokemon.side.pokemonLeft--;
if (pokemon.side.totalFainted < 100) pokemon.side.totalFainted++;
this.runEvent('Faint', pokemon, faintData.source, faintData.effect);
this.singleEvent('End', pokemon.getAbility(), pokemon.abilityState, pokemon);
pokemon.clearVolatile(false);

View File

@@ -84,6 +84,7 @@ export class Side {
faintedLastTurn: Pokemon | null;
faintedThisTurn: Pokemon | null;
totalFainted: number;
/** only used by Gen 1 Counter */
lastSelectedMove: ID = '';
@@ -134,6 +135,7 @@ export class Side {
this.pokemonLeft = this.pokemon.length;
this.faintedLastTurn = null;
this.faintedThisTurn = null;
this.totalFainted = 0;
this.zMoveUsed = false;
this.dynamaxUsed = this.battle.gen !== 8;