Implement Forewarn, Frisk, and BattlerTags for Magnet Rise (WIP) (#241)
* Implement Forewarn, Frisk, and BattlerTags for Magnet Rise (WIP)pull/322/head^2
parent
e02b85629f
commit
4163005f12
|
@ -1785,6 +1785,53 @@ function getAnticipationCondition(): AbAttrCondition {
|
|||
};
|
||||
}
|
||||
|
||||
export class ForewarnAbAttr extends PostSummonAbAttr {
|
||||
constructor() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
applyPostSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
|
||||
let maxPowerSeen = 0;
|
||||
let maxMove = "";
|
||||
let movePower = 0;
|
||||
for (let opponent of pokemon.getOpponents()) {
|
||||
for (let move of opponent.moveset) {
|
||||
if (move.getMove() instanceof StatusMove) {
|
||||
movePower = 1;
|
||||
} else if (move.getMove().findAttr(attr => attr instanceof OneHitKOAttr)) {
|
||||
movePower = 150;
|
||||
} else if (move.getMove().id === Moves.COUNTER || move.getMove().id === Moves.MIRROR_COAT || move.getMove().id === Moves.METAL_BURST) {
|
||||
movePower = 120;
|
||||
} else if (move.getMove().power === -1) {
|
||||
movePower = 80;
|
||||
} else {
|
||||
movePower = move.getMove().power;
|
||||
}
|
||||
|
||||
if (movePower > maxPowerSeen) {
|
||||
maxPowerSeen = movePower;
|
||||
maxMove = move.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
pokemon.scene.queueMessage(getPokemonMessage(pokemon, " was forewarned about " + maxMove + "!"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export class FriskAbAttr extends PostSummonAbAttr {
|
||||
constructor() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
applyPostSummon(pokemon: Pokemon, passive: boolean, args: any[]): boolean {
|
||||
for (let opponent of pokemon.getOpponents()) {
|
||||
pokemon.scene.queueMessage(getPokemonMessage(pokemon, " frisked " + opponent.name + "\'s " + opponent.getAbility().name + "!"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export class PostWeatherChangeAbAttr extends AbAttr {
|
||||
applyPostWeatherChange(pokemon: Pokemon, passive: boolean, weather: WeatherType, args: any[]): boolean {
|
||||
return false;
|
||||
|
@ -2854,7 +2901,7 @@ export function initAbilities() {
|
|||
new Ability(Abilities.ANTICIPATION, 4)
|
||||
.conditionalAttr(getAnticipationCondition(), PostSummonMessageAbAttr, (pokemon: Pokemon) => getPokemonMessage(pokemon, ' shuddered!')),
|
||||
new Ability(Abilities.FOREWARN, 4)
|
||||
.unimplemented(),
|
||||
.attr(ForewarnAbAttr),
|
||||
new Ability(Abilities.UNAWARE, 4)
|
||||
.attr(IgnoreOpponentStatChangesAbAttr)
|
||||
.ignorable(),
|
||||
|
@ -2883,7 +2930,7 @@ export function initAbilities() {
|
|||
new Ability(Abilities.HONEY_GATHER, 4)
|
||||
.unimplemented(),
|
||||
new Ability(Abilities.FRISK, 4)
|
||||
.unimplemented(),
|
||||
.attr(FriskAbAttr),
|
||||
new Ability(Abilities.RECKLESS, 4)
|
||||
.attr(MovePowerBoostAbAttr, (user, target, move) => move.getAttrs(RecoilAttr).length && move.id !== Moves.STRUGGLE, 1.2),
|
||||
new Ability(Abilities.MULTITYPE, 4)
|
||||
|
|
|
@ -984,6 +984,19 @@ export class HideSpriteTag extends BattlerTag {
|
|||
}
|
||||
}
|
||||
|
||||
export class TypeImmuneTag extends BattlerTag {
|
||||
public immuneType: Type;
|
||||
constructor(tagType: BattlerTagType, sourceMove: Moves, immuneType: Type, length: number) {
|
||||
super(tagType, BattlerTagLapseType.TURN_END, 1, sourceMove);
|
||||
}
|
||||
}
|
||||
|
||||
export class MagnetRisenTag extends TypeImmuneTag {
|
||||
constructor(tagType: BattlerTagType, sourceMove: Moves) {
|
||||
super(tagType, sourceMove, Type.GROUND, 5);
|
||||
}
|
||||
}
|
||||
|
||||
export class TypeBoostTag extends BattlerTag {
|
||||
public boostedType: Type;
|
||||
public boostValue: number;
|
||||
|
@ -1211,6 +1224,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc
|
|||
return new CursedTag(sourceId);
|
||||
case BattlerTagType.CHARGED:
|
||||
return new TypeBoostTag(tagType, sourceMove, Type.ELECTRIC, 2, true);
|
||||
case BattlerTagType.MAGNET_RISEN:
|
||||
return new MagnetRisenTag(tagType, sourceMove);
|
||||
case BattlerTagType.NONE:
|
||||
default:
|
||||
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
||||
|
|
|
@ -54,5 +54,6 @@ export enum BattlerTagType {
|
|||
SALT_CURED = "SALT_CURED",
|
||||
CURSED = "CURSED",
|
||||
CHARGED = "CHARGED",
|
||||
GROUNDED = "GROUNDED"
|
||||
GROUNDED = "GROUNDED",
|
||||
MAGNET_RISEN = "MAGNET_RISEN"
|
||||
}
|
||||
|
|
|
@ -4895,6 +4895,10 @@ export function initMoves() {
|
|||
new SelfStatusMove(Moves.AQUA_RING, Type.WATER, -1, 20, -1, 0, 4)
|
||||
.attr(AddBattlerTagAttr, BattlerTagType.AQUA_RING, true, true),
|
||||
new SelfStatusMove(Moves.MAGNET_RISE, Type.ELECTRIC, -1, 10, -1, 0, 4)
|
||||
.attr(AddBattlerTagAttr, BattlerTagType.MAGNET_RISEN, true, true)
|
||||
.condition((user, target, move) => !user.scene.arena.getTag(ArenaTagType.GRAVITY) &&
|
||||
!user.getTag(BattlerTagType.IGNORE_FLYING) && !user.getTag(BattlerTagType.INGRAIN) &&
|
||||
!user.getTag(BattlerTagType.MAGNET_RISEN))
|
||||
.unimplemented(),
|
||||
new AttackMove(Moves.FLARE_BLITZ, Type.FIRE, MoveCategory.PHYSICAL, 120, 100, 15, 10, 0, 4)
|
||||
.attr(RecoilAttr, false, 0.33)
|
||||
|
|
Loading…
Reference in New Issue