Implement the secondary effect with Super Luck and Compound Eyes

This commit is contained in:
Ethan 2024-05-30 20:18:58 -04:00
parent 3f6e43a12d
commit 6dbebd815f
2 changed files with 18 additions and 3 deletions

View File

@ -17,7 +17,7 @@ import { Moves } from "./data/enums/moves";
import { allMoves } from "./data/move"; import { allMoves } from "./data/move";
import { ModifierPoolType, getDefaultModifierTypeForTier, getEnemyModifierTypesForWave, getLuckString, getLuckTextTint, getModifierPoolForType, getPartyLuckValue } from "./modifier/modifier-type"; import { ModifierPoolType, getDefaultModifierTypeForTier, getEnemyModifierTypesForWave, getLuckString, getLuckTextTint, getModifierPoolForType, getPartyLuckValue } from "./modifier/modifier-type";
import AbilityBar from "./ui/ability-bar"; import AbilityBar from "./ui/ability-bar";
import { BlockItemTheftAbAttr, DoubleBattleChanceAbAttr, IncrementMovePriorityAbAttr, PostBattleInitAbAttr, applyAbAttrs, applyPostBattleInitAbAttrs } from "./data/ability"; import { BlockItemTheftAbAttr, BonusItemChance, DoubleBattleChanceAbAttr, IncrementMovePriorityAbAttr, PostBattleInitAbAttr, applyAbAttrs, applyPostBattleInitAbAttrs } from "./data/ability";
import { allAbilities } from "./data/ability"; import { allAbilities } from "./data/ability";
import Battle, { BattleType, FixedBattleConfig, fixedBattles } from "./battle"; import Battle, { BattleType, FixedBattleConfig, fixedBattles } from "./battle";
import { GameMode, GameModes, gameModes } from "./game-mode"; import { GameMode, GameModes, gameModes } from "./game-mode";
@ -1960,6 +1960,9 @@ export default class BattleScene extends SceneBase {
const difficultyWaveIndex = this.gameMode.getWaveForDifficulty(this.currentBattle.waveIndex); const difficultyWaveIndex = this.gameMode.getWaveForDifficulty(this.currentBattle.waveIndex);
const isFinalBoss = this.gameMode.isWaveFinal(this.currentBattle.waveIndex); const isFinalBoss = this.gameMode.isWaveFinal(this.currentBattle.waveIndex);
let chances = Math.ceil(difficultyWaveIndex / 10); let chances = Math.ceil(difficultyWaveIndex / 10);
if (this.getPlayerPokemon().getAbility().hasAttr(BonusItemChance)) {
chances += Math.ceil(chances * 1.2);
}
if (isFinalBoss) { if (isFinalBoss) {
chances = Math.ceil(chances * 2.5); chances = Math.ceil(chances * 2.5);
} }

View File

@ -2010,6 +2010,17 @@ export class BonusCritAbAttr extends AbAttr {
} }
} }
/**
* If an ability has this tag, it will increase the chance of items by 20%.
* This is used in battle-scene.ts in generateEnemyModifiers.
*/
export class BonusItemChance extends AbAttr {
apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean | Promise<boolean> {
return true;
}
}
export class MultCritAbAttr extends AbAttr { export class MultCritAbAttr extends AbAttr {
public multAmount: number; public multAmount: number;
@ -3500,7 +3511,8 @@ export function initAbilities() {
new Ability(Abilities.CLOUD_NINE, 3) new Ability(Abilities.CLOUD_NINE, 3)
.attr(SuppressWeatherEffectAbAttr, true), .attr(SuppressWeatherEffectAbAttr, true),
new Ability(Abilities.COMPOUND_EYES, 3) new Ability(Abilities.COMPOUND_EYES, 3)
.attr(BattleStatMultiplierAbAttr, BattleStat.ACC, 1.3), .attr(BattleStatMultiplierAbAttr, BattleStat.ACC, 1.3)
.attr(BonusItemChance, false),
new Ability(Abilities.INSOMNIA, 3) new Ability(Abilities.INSOMNIA, 3)
.attr(StatusEffectImmunityAbAttr, StatusEffect.SLEEP) .attr(StatusEffectImmunityAbAttr, StatusEffect.SLEEP)
.attr(BattlerTagImmunityAbAttr, BattlerTagType.DROWSY) .attr(BattlerTagImmunityAbAttr, BattlerTagType.DROWSY)
@ -3776,7 +3788,7 @@ export function initAbilities() {
.attr(MoveAbilityBypassAbAttr), .attr(MoveAbilityBypassAbAttr),
new Ability(Abilities.SUPER_LUCK, 4) new Ability(Abilities.SUPER_LUCK, 4)
.attr(BonusCritAbAttr) .attr(BonusCritAbAttr)
.partial(), .attr(BonusItemChance, false),
new Ability(Abilities.AFTERMATH, 4) new Ability(Abilities.AFTERMATH, 4)
.attr(PostFaintContactDamageAbAttr,4) .attr(PostFaintContactDamageAbAttr,4)
.bypassFaint(), .bypassFaint(),