Implements cursed body (#227)

* implements cursed body

* 30 percent chance to proc

* check if max

* removes unimplemented tag

* bypasses faint

* un-disable message specifies pokemon name

* adds prefix to un-disable message

* space issue
This commit is contained in:
alpaca 2024-05-08 20:25:16 -04:00 committed by GitHub
parent 94da7838f8
commit aeab9d78ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 39 additions and 8 deletions

View File

@ -860,6 +860,36 @@ export class PostDefendAbilityGiveAbAttr extends PostDefendAbAttr {
} }
} }
export class PostDefendMoveDisableAbAttr extends PostDefendAbAttr {
private chance: integer;
private attacker: Pokemon;
private move: PokemonMove;
constructor(chance: integer) {
super();
this.chance = chance;
}
applyPostDefend(pokemon: Pokemon, passive: boolean, attacker: Pokemon, move: PokemonMove, hitResult: HitResult, args: any[]): boolean {
if (!attacker.summonData.disabledMove) {
if (move.getMove().checkFlag(MoveFlags.MAKES_CONTACT, attacker, pokemon) && (this.chance === -1 || pokemon.randSeedInt(100) < this.chance) && !attacker.isMax()) {
this.attacker = attacker;
this.move = move;
attacker.summonData.disabledMove = move.moveId;
attacker.summonData.disabledTurns = 4;
return true;
}
}
return false;
}
getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string {
return getPokemonMessage(this.attacker, `'s ${this.move.getName()}\nwas disabled!`);
}
}
export class PostStatChangeStatChangeAbAttr extends PostStatChangeAbAttr { export class PostStatChangeStatChangeAbAttr extends PostStatChangeAbAttr {
private condition: PokemonStatChangeCondition; private condition: PokemonStatChangeCondition;
private statsToChange: BattleStat[]; private statsToChange: BattleStat[];
@ -3076,7 +3106,8 @@ export function initAbilities() {
.attr(BattleStatMultiplierAbAttr, BattleStat.SPATK, 0.5) .attr(BattleStatMultiplierAbAttr, BattleStat.SPATK, 0.5)
.condition((pokemon) => pokemon.getHpRatio() <= 0.5), .condition((pokemon) => pokemon.getHpRatio() <= 0.5),
new Ability(Abilities.CURSED_BODY, 5) new Ability(Abilities.CURSED_BODY, 5)
.unimplemented(), .attr(PostDefendMoveDisableAbAttr, 30)
.bypassFaint(),
new Ability(Abilities.HEALER, 5) new Ability(Abilities.HEALER, 5)
.unimplemented(), .unimplemented(),
new Ability(Abilities.FRIEND_GUARD, 5) new Ability(Abilities.FRIEND_GUARD, 5)

View File

@ -46,7 +46,7 @@ export const battle: SimpleTranslationEntries = {
"runAwayCannotEscape": 'You can\'t escape!', "runAwayCannotEscape": 'You can\'t escape!',
"escapeVerbSwitch": "auswechseln", "escapeVerbSwitch": "auswechseln",
"escapeVerbFlee": "flucht", "escapeVerbFlee": "flucht",
"notDisabled": "{{moveName}} ist\nnicht mehr deaktiviert!", "notDisabled": "{{pokemonName}}'s {{moveName}} ist\nnicht mehr deaktiviert!",
"skipItemQuestion": "Are you sure you want to skip taking an item?", "skipItemQuestion": "Are you sure you want to skip taking an item?",
"eggHatching": "Oh?", "eggHatching": "Oh?",
"ivScannerUseQuestion": "Use IV Scanner on {{pokemonName}}?" "ivScannerUseQuestion": "Use IV Scanner on {{pokemonName}}?"

View File

@ -46,7 +46,7 @@ export const battle: SimpleTranslationEntries = {
"runAwayCannotEscape": 'You can\'t escape!', "runAwayCannotEscape": 'You can\'t escape!',
"escapeVerbSwitch": "switching", "escapeVerbSwitch": "switching",
"escapeVerbFlee": "fleeing", "escapeVerbFlee": "fleeing",
"notDisabled": "{{moveName}} is disabled\nno more!", "notDisabled": "{{pokemonName}}'s {{moveName}} is disabled\nno more!",
"skipItemQuestion": "Are you sure you want to skip taking an item?", "skipItemQuestion": "Are you sure you want to skip taking an item?",
"eggHatching": "Oh?", "eggHatching": "Oh?",
"ivScannerUseQuestion": "Use IV Scanner on {{pokemonName}}?" "ivScannerUseQuestion": "Use IV Scanner on {{pokemonName}}?"

View File

@ -46,7 +46,7 @@ export const battle: SimpleTranslationEntries = {
"runAwayCannotEscape": "¡No has podido escapar!", "runAwayCannotEscape": "¡No has podido escapar!",
"escapeVerbSwitch": "cambiar", "escapeVerbSwitch": "cambiar",
"escapeVerbFlee": "huir", "escapeVerbFlee": "huir",
"notDisabled": "¡El movimiento {{moveName}}\nya no está anulado!", "notDisabled": "¡El movimiento {{moveName}} de {{pokemonName}}\nya no está anulado!",
"skipItemQuestion": "¿Estás seguro de que no quieres coger un objeto?", "skipItemQuestion": "¿Estás seguro de que no quieres coger un objeto?",
"eggHatching": "¿Y esto?", "eggHatching": "¿Y esto?",
"ivScannerUseQuestion": "¿Quieres usar el Escáner de IVs en {{pokemonName}}?" "ivScannerUseQuestion": "¿Quieres usar el Escáner de IVs en {{pokemonName}}?"

View File

@ -46,7 +46,7 @@ export const battle: SimpleTranslationEntries = {
"runAwayCannotEscape": "Fuite impossible !", "runAwayCannotEscape": "Fuite impossible !",
"escapeVerbSwitch": "le changement", "escapeVerbSwitch": "le changement",
"escapeVerbFlee": "la fuite", "escapeVerbFlee": "la fuite",
"notDisabled": "{{moveName}} nest plus sous entrave !", "notDisabled": "{{pokemonName}}'s {{moveName}} nest plus sous entrave !",
"skipItemQuestion": "Êtes-vous sûr·e de ne pas vouloir prendre dobjet ?", "skipItemQuestion": "Êtes-vous sûr·e de ne pas vouloir prendre dobjet ?",
"eggHatching": "Oh ?", "eggHatching": "Oh ?",
"ivScannerUseQuestion": "Utiliser le Scanner dIV sur {{pokemonName}} ?" "ivScannerUseQuestion": "Utiliser le Scanner dIV sur {{pokemonName}} ?"

View File

@ -46,7 +46,7 @@ export const battle: SimpleTranslationEntries = {
"runAwayCannotEscape": 'Non puoi fuggire!', "runAwayCannotEscape": 'Non puoi fuggire!',
"escapeVerbSwitch": "cambiando", "escapeVerbSwitch": "cambiando",
"escapeVerbFlee": "fuggendo", "escapeVerbFlee": "fuggendo",
"notDisabled": "{{moveName}} non è più\ndisabilitata!", "notDisabled": "{{pokemonName}}'s {{moveName}} non è più\ndisabilitata!",
"skipItemQuestion": "Sei sicuro di non voler prendere nessun oggetto?", "skipItemQuestion": "Sei sicuro di non voler prendere nessun oggetto?",
"eggHatching": "Oh?", "eggHatching": "Oh?",
"ivScannerUseQuestion": "Vuoi usare lo scanner di IV su {{pokemonName}}?" "ivScannerUseQuestion": "Vuoi usare lo scanner di IV su {{pokemonName}}?"

View File

@ -23,7 +23,7 @@ import { FusePokemonModifierType, ModifierPoolType, ModifierType, ModifierTypeFu
import SoundFade from "phaser3-rex-plugins/plugins/soundfade"; import SoundFade from "phaser3-rex-plugins/plugins/soundfade";
import { BattlerTagLapseType, EncoreTag, HideSpriteTag as HiddenTag, ProtectedTag, TrappedTag } from "./data/battler-tags"; import { BattlerTagLapseType, EncoreTag, HideSpriteTag as HiddenTag, ProtectedTag, TrappedTag } from "./data/battler-tags";
import { BattlerTagType } from "./data/enums/battler-tag-type"; import { BattlerTagType } from "./data/enums/battler-tag-type";
import { getPokemonMessage } from "./messages"; import { getPokemonMessage, getPokemonPrefix } from "./messages";
import { Starter } from "./ui/starter-select-ui-handler"; import { Starter } from "./ui/starter-select-ui-handler";
import { Gender } from "./data/gender"; import { Gender } from "./data/gender";
import { Weather, WeatherType, getRandomWeatherType, getTerrainBlockMessage, getWeatherDamageMessage, getWeatherLapseMessage } from "./data/weather"; import { Weather, WeatherType, getRandomWeatherType, getTerrainBlockMessage, getWeatherDamageMessage, getWeatherLapseMessage } from "./data/weather";
@ -2046,7 +2046,7 @@ export class TurnEndPhase extends FieldPhase {
pokemon.lapseTags(BattlerTagLapseType.TURN_END); pokemon.lapseTags(BattlerTagLapseType.TURN_END);
if (pokemon.summonData.disabledMove && !--pokemon.summonData.disabledTurns) { if (pokemon.summonData.disabledMove && !--pokemon.summonData.disabledTurns) {
this.scene.pushPhase(new MessagePhase(this.scene, i18next.t('battle:notDisabled', { moveName: allMoves[pokemon.summonData.disabledMove].name }))); this.scene.pushPhase(new MessagePhase(this.scene, i18next.t('battle:notDisabled', { pokemonName: `${getPokemonPrefix(pokemon)}${pokemon.name}`, moveName: allMoves[pokemon.summonData.disabledMove].name })));
pokemon.summonData.disabledMove = Moves.NONE; pokemon.summonData.disabledMove = Moves.NONE;
} }