Laser Focus support, with the added BattlerTagTypes to support it (#103)

* Added a new BattlerTagType and support for Laser Focus

BattlerTagType.ALWAYS_CRIT

* Updated battler-tags to support ALWAYS_CRIT

* Added ALWAYS_CRIT = "ALWAYS_CRIT", for the updated battler-tag-type

* Updated the crit formula to include the new critAlways

* Updated crit logic to include critAlways, fixed indents
pull/107/head
EmoUsedHM01 2024-04-12 21:05:32 +01:00 committed by GitHub
parent dcb4688c76
commit 930c14fa62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 30 additions and 3 deletions

View File

@ -956,6 +956,12 @@ export class CritBoostTag extends BattlerTag {
}
}
export class AlwaysCritTag extends BattlerTag {
constructor(sourceMove: Moves) {
super(BattlerTagType.ALWAYS_CRIT, BattlerTagLapseType.TURN_END, 2, sourceMove);
}
}
export class IgnoreAccuracyTag extends BattlerTag {
constructor(sourceMove: Moves) {
super(BattlerTagType.IGNORE_ACCURACY, BattlerTagLapseType.TURN_END, 2, sourceMove);
@ -1077,6 +1083,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc
return new TypeBoostTag(tagType, sourceMove, Type.FIRE);
case BattlerTagType.CRIT_BOOST:
return new CritBoostTag(tagType, sourceMove);
case BattlerTagType.ALWAYS_CRIT:
return new AlwaysCritTag(tagType, sourceMove);
case BattlerTagType.NO_CRIT:
return new BattlerTag(tagType, BattlerTagLapseType.AFTER_MOVE, turnCount, sourceMove);
case BattlerTagType.IGNORE_ACCURACY:

View File

@ -41,6 +41,7 @@ export enum BattlerTagType {
HIDDEN = "HIDDEN",
FIRE_BOOST = "FIRE_BOOST",
CRIT_BOOST = "CRIT_BOOST",
ALWAYS_CRIT = "ALWAYS_CRIT",
NO_CRIT = "NO_CRIT",
IGNORE_ACCURACY = "IGNORE_ACCURACY",
BYPASS_SLEEP = "BYPASS_SLEEP",

View File

@ -2300,6 +2300,7 @@ export class AddBattlerTagAttr extends MoveEffectAttr {
case BattlerTagType.PROTECTED:
case BattlerTagType.FLYING:
case BattlerTagType.CRIT_BOOST:
case BattlerTagType.ALWAYS_CRIT:
return 5;
}
}
@ -2421,6 +2422,21 @@ export class IgnoreAccuracyAttr extends AddBattlerTagAttr {
}
}
export class AlwaysCritsAttr extends AddBattlerTagAttr {
constructor() {
super(BattlerTagType.ALWAYS_CRIT, true, false, 2);
}
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (!super.apply(user, target, move, args))
return false;
user.scene.queueMessage(getPokemonMessage(user, ` took aim\nat ${target.name}!`));
return true;
}
}
export class FaintCountdownAttr extends AddBattlerTagAttr {
constructor() {
super(BattlerTagType.PERISH_SONG, false, true, 4);
@ -4678,7 +4694,8 @@ export function initMoves() {
new StatusMove(Moves.TOXIC_THREAD, "Toxic Thread", Type.POISON, 100, 20, "The user shoots poisonous threads to poison the target and lower the target's Speed stat.", 100, 0, 7)
.attr(StatusEffectAttr, StatusEffect.POISON)
.attr(StatChangeAttr, BattleStat.SPD, -1),
new SelfStatusMove(Moves.LASER_FOCUS, "Laser Focus (N)", Type.NORMAL, -1, 30, "The user concentrates intensely. The attack on the next turn always results in a critical hit.", -1, 0, 7),
new SelfStatusMove(Moves.LASER_FOCUS, "Laser Focus", Type.NORMAL, -1, 30, "The user concentrates intensely. The attack on the next turn always results in a critical hit.", -1, 0, 7)
.attr(AddBattlerTagAttr, BattlerTagType.ALWAYS_CRIT, true, false),
new StatusMove(Moves.GEAR_UP, "Gear Up", Type.STEEL, -1, 20, "The user engages its gears to raise the Attack and Sp. Atk stats of ally Pokémon with the Plus or Minus Ability.", -1, 0, 7)
.attr(StatChangeAttr, [ BattleStat.ATK, BattleStat.SPATK ], 1, false, (user, target, move) => [ Abilities.PLUS, Abilities.MINUS ].includes(target.getAbility().id) || (target.canApplyPassive() && [ Abilities.PLUS, Abilities.MINUS ].includes(target.getPassiveAbility().id)))
.target(MoveTarget.USER_AND_ALLIES)

View File

@ -1174,8 +1174,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
power.value *= 1.5;
let isCritical: boolean;
const critOnly = new Utils.BooleanHolder(false);
const critAlways = source.getTag(BattlerTagType.ALWAYS_CRIT);
applyMoveAttrs(CritOnlyAttr, source, this, move, critOnly);
if (critOnly.value)
if (critOnly.value || critAlways)
isCritical = true;
else {
const critLevel = new Utils.IntegerHolder(0);
@ -2879,4 +2880,4 @@ export class PokemonMove {
getName(): string {
return this.getMove().name;
}
}
}