for_draft

This commit is contained in:
Hyun Ahn 2023-11-22 05:01:32 +09:00
parent 79d0862d3f
commit 4094041981
3 changed files with 31 additions and 3 deletions

View File

@ -25,7 +25,7 @@ import { Gender } from "./data/gender";
import { Weather, WeatherType, getRandomWeatherType, getWeatherDamageMessage, getWeatherLapseMessage } from "./data/weather";
import { TempBattleStat } from "./data/temp-battle-stat";
import { ArenaTagType, ArenaTrapTag, TrickRoomTag } from "./data/arena-tag";
import { Abilities, CheckTrappedAbAttr, IgnoreOpponentStatChangesAbAttr, PostDefendAbAttr, PostSummonAbAttr, PostTurnAbAttr, PostWeatherLapseAbAttr, PreWeatherDamageAbAttr, ProtectStatAbAttr, StatChangeMultiplierAbAttr, SuppressWeatherEffectAbAttr, applyAbAttrs, applyCheckTrappedAbAttrs, applyPostDefendAbAttrs, applyPostSummonAbAttrs, applyPostTurnAbAttrs, applyPostWeatherLapseAbAttrs, applyPreStatChangeAbAttrs, applyPreWeatherEffectAbAttrs } from "./data/ability";
import { Abilities, CheckTrappedAbAttr, IgnoreOpponentStatChangesAbAttr, PostDefendAbAttr, PostSummonAbAttr, PostTurnAbAttr, PostWeatherLapseAbAttr, PreWeatherDamageAbAttr, ProtectStatAbAttr, StatChangeMultiplierAbAttr, LowerHpWeakerAbAttr, SuppressWeatherEffectAbAttr, applyAbAttrs, applyCheckTrappedAbAttrs, applyPostDefendAbAttrs, applyPostSummonAbAttrs, applyPostTurnAbAttrs, applyPostWeatherLapseAbAttrs, applyPreStatChangeAbAttrs, applyPreWeatherEffectAbAttrs } from "./data/ability";
import { Unlockables, getUnlockableName } from "./system/unlockables";
import { getBiomeKey } from "./arena";
import { BattleType, BattlerIndex, TurnCommand } from "./battle";
@ -2033,6 +2033,10 @@ export class DamagePhase extends PokemonPhase {
}
this.applyDamage();
const pokemon = this.getPokemon()
const stats = this.getPokemon().stats
applyAbAttrs(LowerHpWeakerAbAttr,pokemon , null, stats);
}
applyDamage() {

View File

@ -123,6 +123,29 @@ export class StabBoostAbAttr extends AbAttr {
}
}
export class LowerHpWeakerAbAttr extends AbAttr {
private hpLeft: integer;
constructor(hpLeft: integer) {
super(true)
this.hpLeft = hpLeft;
}
apply(pokemon: Pokemon, cancelled: Utils.BooleanHolder, args: any[]): boolean {
const hpRatio = pokemon.getHpRatio();
if (hpRatio <= this.hpLeft) {
args[0] *= 55.5
args[1] *= 55.5
args[2] *= 55.5
args[3] *= 55.5
}
return true;
}
}
export class ReceivedTypeDamageMultiplierAbAttr extends PreDefendAbAttr {
private moveType: Type;
private powerMultiplier: number;
@ -1507,7 +1530,8 @@ export function initAbilities() {
new Ability(Abilities.CONTRARY, "Contrary", "Makes stat changes have an opposite effect.", 5)
.attr(StatChangeMultiplierAbAttr, -1),
new Ability(Abilities.CURSED_BODY, "Cursed Body (N)", "May disable a move used on the Pokémon.", 5),
new Ability(Abilities.DEFEATIST, "Defeatist (N)", "Lowers stats when HP drops below half.", 5),
new Ability(Abilities.DEFEATIST, "Defeatist", "Lowers stats when HP drops below half.", 5)
.attr(LowerHpWeakerAbAttr, 0.5),
new Ability(Abilities.DEFIANT, "Defiant (N)", "Sharply raises Attack when the Pokémon's stats are lowered.", 5),
new Ability(Abilities.FLARE_BOOST, "Flare Boost (N)", "Powers up special attacks when burned.", 5),
new Ability(Abilities.FRIEND_GUARD, "Friend Guard (N)", "Reduces damage done to allies.", 5),

View File

@ -39,7 +39,7 @@ export enum FieldPosition {
RIGHT
}
const ABILITY_OVERRIDE = Abilities.NONE;
const ABILITY_OVERRIDE = Abilities.DEFEATIST;
const MOVE_OVERRIDE = Moves.NONE;
const OPP_ABILITY_OVERRIDE = Abilities.NONE;