Salt Cure Full Implementation

pull/21/head
Matthew 2024-03-30 15:34:00 -04:00 committed by Samuel H
parent 4b772c903a
commit be3dd0edc1
5 changed files with 55 additions and 25 deletions

View File

@ -1520,6 +1520,7 @@ export default class BattleScene extends Phaser.Scene {
this.cameras.main.removePostPipeline('InvertPostFX');
}
/* Phase Functions */
getCurrentPhase(): Phase {
return this.currentPhase;
}

View File

@ -877,6 +877,37 @@ export class IgnoreAccuracyTag extends BattlerTag {
}
}
export class SaltCuredTag extends BattlerTag {
private sourceIndex: integer;
constructor(sourceId: integer) {
super(BattlerTagType.SALT_CURED, BattlerTagLapseType.AFTER_MOVE, 1, Moves.SALT_CURE, sourceId);
}
onAdd(pokemon: Pokemon): void {
super.onAdd(pokemon);
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ' is being salt cured!'));
this.sourceIndex = pokemon.scene.getPokemonById(this.sourceId).getBattlerIndex();
}
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
const ret = lapseType !== BattlerTagLapseType.CUSTOM || super.lapse(pokemon, lapseType);
if (ret) {
const source = pokemon.getOpponents().find(o => o.getBattlerIndex() === this.sourceIndex);
pokemon.scene.unshiftPhase(new CommonAnimPhase(pokemon.scene, source.getBattlerIndex(), pokemon.getBattlerIndex(), CommonAnim.SALT_CURE));
const pokemonSteelOrWater = pokemon.isOfType(Type.STEEL) || pokemon.isOfType(Type.WATER);
pokemon.damageAndUpdate(Math.max(Math.floor(pokemonSteelOrWater ? pokemon.getMaxHp() / 4 : pokemon.getMaxHp() / 8), 1));
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` is hurt by ${this.getMoveName()}!`));
}
return ret;
}
}
export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourceMove: Moves, sourceId: integer): BattlerTag {
switch (tagType) {
case BattlerTagType.RECHARGING:
@ -955,6 +986,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc
return new BattlerTag(BattlerTagType.BYPASS_SLEEP, BattlerTagLapseType.TURN_END, turnCount, sourceMove);
case BattlerTagType.IGNORE_FLYING:
return new BattlerTag(tagType, BattlerTagLapseType.TURN_END, turnCount, sourceMove);
case BattlerTagType.SALT_CURED:
return new SaltCuredTag(sourceId);
case BattlerTagType.NONE:
default:
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);

View File

@ -39,5 +39,6 @@ export enum BattlerTagType {
NO_CRIT = "NO_CRIT",
IGNORE_ACCURACY = "IGNORE_ACCURACY",
BYPASS_SLEEP = "BYPASS_SLEEP",
IGNORE_FLYING = "IGNORE_FLYING"
IGNORE_FLYING = "IGNORE_FLYING",
SALT_CURED = "SALT_CURED"
}

View File

@ -1888,27 +1888,18 @@ export class AddBattlerTagAttr extends MoveEffectAttr {
getTagTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
switch (this.tagType) {
case BattlerTagType.RECHARGING:
case BattlerTagType.PERISH_SONG:
return -16;
case BattlerTagType.FLINCHED:
return -5;
case BattlerTagType.CONFUSED:
return -5;
case BattlerTagType.INFATUATED:
case BattlerTagType.NIGHTMARE:
case BattlerTagType.DROWSY:
case BattlerTagType.NO_CRIT:
return -5;
case BattlerTagType.SEEDED:
return -3;
case BattlerTagType.NIGHTMARE:
return -5;
case BattlerTagType.SALT_CURED:
case BattlerTagType.FRENZY:
return -3;
case BattlerTagType.ENCORE:
return -2;
case BattlerTagType.INGRAIN:
return 3;
case BattlerTagType.AQUA_RING:
return 3;
case BattlerTagType.DROWSY:
return -5;
case BattlerTagType.TRAPPED:
case BattlerTagType.BIND:
case BattlerTagType.WRAP:
@ -1919,18 +1910,16 @@ export class AddBattlerTagAttr extends MoveEffectAttr {
case BattlerTagType.MAGMA_STORM:
case BattlerTagType.THUNDER_CAGE:
return -3;
case BattlerTagType.ENCORE:
return -2;
case BattlerTagType.INGRAIN:
case BattlerTagType.IGNORE_ACCURACY:
case BattlerTagType.AQUA_RING:
return 3;
case BattlerTagType.PROTECTED:
return 5;
case BattlerTagType.PERISH_SONG:
return -16;
case BattlerTagType.FLYING:
return 5;
case BattlerTagType.CRIT_BOOST:
return 5;
case BattlerTagType.NO_CRIT:
return -5;
case BattlerTagType.IGNORE_ACCURACY:
return 3;
}
}
@ -4686,7 +4675,9 @@ export function initMoves() {
.attr(ClearTerrainAttr),
new AttackMove(Moves.GLAIVE_RUSH, "Glaive Rush (P)", Type.DRAGON, MoveCategory.PHYSICAL, 120, 100, 5, "The user throws its entire body into a reckless charge. After this move is used, attacks on the user cannot miss and will inflict double damage until the user's next turn.", -1, 0, 9),
new StatusMove(Moves.REVIVAL_BLESSING, "Revival Blessing (N)", Type.NORMAL, -1, 1, "The user bestows a loving blessing, reviving a party Pokémon that has fainted and restoring half that Pokémon's max HP.", -1, 0, 9),
new AttackMove(Moves.SALT_CURE, "Salt Cure (P)", Type.ROCK, MoveCategory.PHYSICAL, 40, 100, 15, "The user salt cures the target, inflicting damage every turn. Steel and Water types are more strongly affected by this move.", -1, 0, 9),
new AttackMove(Moves.SALT_CURE, "Salt Cure", Type.ROCK, MoveCategory.PHYSICAL, 40, 100, 15, "The user salt cures the target, inflicting damage every turn. Steel and Water types are more strongly affected by this move.", -1, 0, 9)
.attr(AddBattlerTagAttr, BattlerTagType.SALT_CURED)
.condition((user, target, move) => !target.getTag(BattlerTagType.SALT_CURED)),
new AttackMove(Moves.TRIPLE_DIVE, "Triple Dive", Type.WATER, MoveCategory.PHYSICAL, 30, 95, 10, "The user performs a perfectly timed triple dive, hitting the target with splashes of water three times in a row.", -1, 0, 9)
.attr(MultiHitAttr, MultiHitType._3),
new AttackMove(Moves.MORTAL_SPIN, "Mortal Spin", Type.POISON, MoveCategory.PHYSICAL, 30, 100, 15, "The user performs a spin attack that can also eliminate the effects of such moves as Bind, Wrap, and Leech Seed. This also poisons opposing Pokémon.", 100, 0, 9)

View File

@ -72,20 +72,24 @@ export default class CommandUiHandler extends UiHandler {
if (button === Button.ACTION) {
switch (cursor) {
// Fight
case 0:
if ((this.scene.getCurrentPhase() as CommandPhase).checkFightOverride())
return true;
ui.setMode(Mode.FIGHT, (this.scene.getCurrentPhase() as CommandPhase).getFieldIndex());
success = true;
break;
// Ball
case 1:
ui.setModeWithoutClear(Mode.BALL);
success = true;
break;
// Pokemon
case 2:
ui.setMode(Mode.PARTY, PartyUiMode.SWITCH, (this.scene.getCurrentPhase() as CommandPhase).getPokemon().getFieldIndex(), null, PartyUiHandler.FilterNonFainted);
success = true;
break;
// Run
case 3:
(this.scene.getCurrentPhase() as CommandPhase).handleCommand(Command.RUN, 0);
success = true;