mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-30 10:46:05 +00:00
Add fell stingers effect (#202)
* Add Fell Stinger Effect * Update src/phases.ts
This commit is contained in:
parent
bb6bb1e6c1
commit
118c57ba75
@ -1561,6 +1561,29 @@ export class StatChangeAttr extends MoveEffectAttr {
|
||||
}
|
||||
}
|
||||
|
||||
export class PostVictoryStatChangeAttr extends MoveAttr {
|
||||
private stats: BattleStat[];
|
||||
private levels: integer;
|
||||
private condition: MoveConditionFunc;
|
||||
private showMessage: boolean;
|
||||
|
||||
constructor(stats: BattleStat | BattleStat[], levels: integer, selfTarget?: boolean, condition?: MoveConditionFunc, showMessage: boolean = true, firstHitOnly: boolean = false) {
|
||||
super();
|
||||
this.stats = typeof(stats) === 'number'
|
||||
? [ stats as BattleStat ]
|
||||
: stats as BattleStat[];
|
||||
this.levels = levels;
|
||||
this.condition = condition || null;
|
||||
this.showMessage = showMessage;
|
||||
}
|
||||
applyPostVictory(user: Pokemon, target: Pokemon, move: Move): void {
|
||||
if(this.condition && !this.condition(user, target, move))
|
||||
return false;
|
||||
const statChangeAttr = new StatChangeAttr(this.stats, this.levels, this.showMessage);
|
||||
statChangeAttr.apply(user, target, move);
|
||||
}
|
||||
}
|
||||
|
||||
export class AcupressureStatChangeAttr extends MoveEffectAttr {
|
||||
constructor() {
|
||||
super();
|
||||
@ -5565,7 +5588,7 @@ export function initMoves() {
|
||||
.attr(AddArenaTrapTagAttr, ArenaTagType.STICKY_WEB)
|
||||
.target(MoveTarget.ENEMY_SIDE),
|
||||
new AttackMove(Moves.FELL_STINGER, Type.BUG, MoveCategory.PHYSICAL, 50, 100, 25, -1, 0, 6)
|
||||
.partial(),
|
||||
.attr(PostVictoryStatChangeAttr, BattleStat.ATK, 3, true ),
|
||||
new AttackMove(Moves.PHANTOM_FORCE, Type.GHOST, MoveCategory.PHYSICAL, 90, 100, 10, -1, 0, 6)
|
||||
.attr(ChargeAttr, ChargeAnim.PHANTOM_FORCE_CHARGING, 'vanished\ninstantly!', BattlerTagType.HIDDEN)
|
||||
.ignoresProtect()
|
||||
|
@ -2,7 +2,7 @@ import BattleScene, { AnySound, bypassLogin, startingWave } from "./battle-scene
|
||||
import { default as Pokemon, PlayerPokemon, EnemyPokemon, PokemonMove, MoveResult, DamageResult, FieldPosition, HitResult, TurnMove } from "./field/pokemon";
|
||||
import * as Utils from './utils';
|
||||
import { Moves } from "./data/enums/moves";
|
||||
import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, applyFilteredMoveAttrs, HitsTagAttr, MissEffectAttr, MoveAttr, MoveEffectAttr, MoveFlags, MultiHitAttr, OverrideMoveEffectAttr, VariableAccuracyAttr, MoveTarget, OneHitKOAttr, getMoveTargets, MoveTargetSet, MoveEffectTrigger, CopyMoveAttr, AttackMove, SelfStatusMove, DelayedAttackAttr, RechargeAttr, PreMoveMessageAttr, HealStatusEffectAttr, IgnoreOpponentStatChangesAttr, NoEffectAttr, FixedDamageAttr, OneHitKOAccuracyAttr, ForceSwitchOutAttr, VariableTargetAttr } from "./data/move";
|
||||
import { allMoves, applyMoveAttrs, BypassSleepAttr, ChargeAttr, applyFilteredMoveAttrs, HitsTagAttr, MissEffectAttr, MoveAttr, MoveEffectAttr, MoveFlags, MultiHitAttr, OverrideMoveEffectAttr, VariableAccuracyAttr, MoveTarget, OneHitKOAttr, getMoveTargets, MoveTargetSet, MoveEffectTrigger, CopyMoveAttr, AttackMove, SelfStatusMove, DelayedAttackAttr, RechargeAttr, PreMoveMessageAttr, HealStatusEffectAttr, IgnoreOpponentStatChangesAttr, NoEffectAttr, FixedDamageAttr, PostVictoryStatChangeAttr, OneHitKOAccuracyAttr, ForceSwitchOutAttr, VariableTargetAttr } from "./data/move";
|
||||
import { Mode } from './ui/ui';
|
||||
import { Command } from "./ui/command-ui-handler";
|
||||
import { Stat } from "./data/pokemon-stat";
|
||||
@ -3142,8 +3142,16 @@ export class FaintPhase extends PokemonPhase {
|
||||
alivePlayField.forEach(p => applyPostKnockOutAbAttrs(PostKnockOutAbAttr, p, pokemon));
|
||||
if (pokemon.turnData?.attacksReceived?.length) {
|
||||
const defeatSource = this.scene.getPokemonById(pokemon.turnData.attacksReceived[0].sourceId);
|
||||
if (defeatSource?.isOnField())
|
||||
if (defeatSource?.isOnField()) {
|
||||
applyPostVictoryAbAttrs(PostVictoryAbAttr, defeatSource);
|
||||
const pvmove = allMoves[pokemon.turnData.attacksReceived[0].move];
|
||||
const pvattrs = pvmove.getAttrs(PostVictoryStatChangeAttr);
|
||||
if (pvattrs.length) {
|
||||
for (let pvattr of pvattrs) {
|
||||
pvattr.applyPostVictory(defeatSource, defeatSource, pvmove);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.player) {
|
||||
|
Loading…
Reference in New Issue
Block a user