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 { ModifierPoolType, getDefaultModifierTypeForTier, getEnemyModifierTypesForWave, getLuckString, getLuckTextTint, getModifierPoolForType, getPartyLuckValue } from "./modifier/modifier-type";
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 Battle, { BattleType, FixedBattleConfig, fixedBattles } from "./battle";
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 isFinalBoss = this.gameMode.isWaveFinal(this.currentBattle.waveIndex);
let chances = Math.ceil(difficultyWaveIndex / 10);
if (this.getPlayerPokemon().getAbility().hasAttr(BonusItemChance)) {
chances += Math.ceil(chances * 1.2);
}
if (isFinalBoss) {
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 {
public multAmount: number;
@ -3500,7 +3511,8 @@ export function initAbilities() {
new Ability(Abilities.CLOUD_NINE, 3)
.attr(SuppressWeatherEffectAbAttr, true),
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)
.attr(StatusEffectImmunityAbAttr, StatusEffect.SLEEP)
.attr(BattlerTagImmunityAbAttr, BattlerTagType.DROWSY)
@ -3776,7 +3788,7 @@ export function initAbilities() {
.attr(MoveAbilityBypassAbAttr),
new Ability(Abilities.SUPER_LUCK, 4)
.attr(BonusCritAbAttr)
.partial(),
.attr(BonusItemChance, false),
new Ability(Abilities.AFTERMATH, 4)
.attr(PostFaintContactDamageAbAttr,4)
.bypassFaint(),