mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-21 06:49:35 +02:00
basic mimicry implementation
This commit is contained in:
parent
b20ca6b1eb
commit
3283cdaeb6
@ -4679,6 +4679,47 @@ export class PreventBypassSpeedChanceAbAttr extends AbAttr {
|
||||
}
|
||||
}
|
||||
|
||||
export class TerrainEventTypeChangeAbAttr extends PostSummonAbAttr {
|
||||
constructor() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* This applies a terrain-based type change to the Pokemon.
|
||||
*/
|
||||
apply(pokemon: Pokemon, passive: boolean, simulated: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||
if (pokemon.isTerastallized()) {
|
||||
return false;
|
||||
}
|
||||
const currentTerrain = pokemon.scene.arena.getTerrainType();
|
||||
const typeChange: Type[] = [];
|
||||
if (currentTerrain !== TerrainType.NONE) {
|
||||
switch (currentTerrain) {
|
||||
case TerrainType.ELECTRIC:
|
||||
typeChange.push(Type.ELECTRIC);
|
||||
break;
|
||||
case TerrainType.MISTY:
|
||||
typeChange.push(Type.FAIRY);
|
||||
break;
|
||||
case TerrainType.GRASSY:
|
||||
typeChange.push(Type.GRASS);
|
||||
break;
|
||||
case TerrainType.PSYCHIC:
|
||||
typeChange.push(Type.PSYCHIC);
|
||||
break;
|
||||
default:
|
||||
pokemon.getTypes(false, false, true).forEach(t => {
|
||||
typeChange.push(t);
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
pokemon.summonData.types = typeChange;
|
||||
pokemon.updateInfo();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
async function applyAbAttrsInternal<TAttr extends AbAttr>(
|
||||
attrType: Constructor<TAttr>,
|
||||
pokemon: Pokemon | null,
|
||||
@ -5743,6 +5784,7 @@ export function initAbilities() {
|
||||
new Ability(Abilities.POWER_SPOT, 8)
|
||||
.attr(AllyMoveCategoryPowerBoostAbAttr, [ MoveCategory.SPECIAL, MoveCategory.PHYSICAL ], 1.3),
|
||||
new Ability(Abilities.MIMICRY, 8)
|
||||
.attr(TerrainEventTypeChangeAbAttr)
|
||||
.unimplemented(),
|
||||
new Ability(Abilities.SCREEN_CLEANER, 8)
|
||||
.attr(PostSummonRemoveArenaTagAbAttr, [ ArenaTagType.AURORA_VEIL, ArenaTagType.LIGHT_SCREEN, ArenaTagType.REFLECT ]),
|
||||
|
@ -10,7 +10,7 @@ import Move from "#app/data/move";
|
||||
import { ArenaTag, ArenaTagSide, ArenaTrapTag, getArenaTag } from "#app/data/arena-tag";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { Terrain, TerrainType } from "#app/data/terrain";
|
||||
import { applyPostTerrainChangeAbAttrs, applyPostWeatherChangeAbAttrs, PostTerrainChangeAbAttr, PostWeatherChangeAbAttr } from "#app/data/ability";
|
||||
import { applyAbAttrs, applyPostTerrainChangeAbAttrs, applyPostWeatherChangeAbAttrs, PostTerrainChangeAbAttr, PostWeatherChangeAbAttr, TerrainEventTypeChangeAbAttr } from "#app/data/ability";
|
||||
import Pokemon from "#app/field/pokemon";
|
||||
import Overrides from "#app/overrides";
|
||||
import { TagAddedEvent, TagRemovedEvent, TerrainChangedEvent, WeatherChangedEvent } from "#app/events/arena";
|
||||
@ -387,6 +387,7 @@ export class Arena {
|
||||
this.scene.getField(true).filter(p => p.isOnField()).map(pokemon => {
|
||||
pokemon.findAndRemoveTags(t => "terrainTypes" in t && !(t.terrainTypes as TerrainType[]).find(t => t === terrain));
|
||||
applyPostTerrainChangeAbAttrs(PostTerrainChangeAbAttr, pokemon, terrain);
|
||||
applyAbAttrs(TerrainEventTypeChangeAbAttr, pokemon, null, false);
|
||||
});
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user