UPDATE: Added localisation to the trigger message
parent
38c8eb9396
commit
bb7493aa81
|
@ -56,11 +56,8 @@ export enum BattlerTagType {
|
||||||
CHARGED = "CHARGED",
|
CHARGED = "CHARGED",
|
||||||
GROUNDED = "GROUNDED",
|
GROUNDED = "GROUNDED",
|
||||||
MAGNET_RISEN = "MAGNET_RISEN",
|
MAGNET_RISEN = "MAGNET_RISEN",
|
||||||
<<<<<<< HEAD
|
|
||||||
STOCKPILE_ONE = "STOCKPILE_ONE",
|
STOCKPILE_ONE = "STOCKPILE_ONE",
|
||||||
STOCKPILE_TWO = "STOCKPILE_TWO",
|
STOCKPILE_TWO = "STOCKPILE_TWO",
|
||||||
STOCKPILE_THREE = "STOCKPILE_THREE"
|
STOCKPILE_THREE = "STOCKPILE_THREE",
|
||||||
=======
|
|
||||||
MINIMIZED = "MINIMIZED"
|
MINIMIZED = "MINIMIZED"
|
||||||
>>>>>>> 78f79653049baff0ec6514b743e5f602d43ad391
|
|
||||||
}
|
}
|
||||||
|
|
112
src/data/move.ts
112
src/data/move.ts
|
@ -4,7 +4,7 @@ import { BattleEndPhase, MovePhase, NewBattlePhase, PartyStatusCurePhase, Pokemo
|
||||||
import { BattleStat, getBattleStatName } from "./battle-stat";
|
import { BattleStat, getBattleStatName } from "./battle-stat";
|
||||||
import { EncoreTag } from "./battler-tags";
|
import { EncoreTag } from "./battler-tags";
|
||||||
import { BattlerTagType } from "./enums/battler-tag-type";
|
import { BattlerTagType } from "./enums/battler-tag-type";
|
||||||
import { getPokemonMessage } from "../messages";
|
import { getPokemonMessage, getPokemonPrefix } from "../messages";
|
||||||
import Pokemon, { AttackMoveResult, EnemyPokemon, HitResult, MoveResult, PlayerPokemon, PokemonMove, TurnMove } from "../field/pokemon";
|
import Pokemon, { AttackMoveResult, EnemyPokemon, HitResult, MoveResult, PlayerPokemon, PokemonMove, TurnMove } from "../field/pokemon";
|
||||||
import { StatusEffect, getStatusEffectHealText } from "./status-effect";
|
import { StatusEffect, getStatusEffectHealText } from "./status-effect";
|
||||||
import { Type } from "./type";
|
import { Type } from "./type";
|
||||||
|
@ -949,28 +949,27 @@ export class HealAttr extends MoveEffectAttr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Attribute used by the {@link Moves.STOCKPILE} to heal based on STOCKPILE stored*/
|
||||||
export class SwallowHealAttr extends HealAttr {
|
export class SwallowHealAttr extends HealAttr {
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
constructor() {
|
||||||
const stock = this.getStockpiles(user);
|
super(1, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
|
// uses the getStockpiles function to get number of STOCKPILE's stored
|
||||||
|
const stock = getStockpiles(user);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* if stock is:
|
||||||
|
* 1, then healing is 0.25 of health
|
||||||
|
* 2, then healing is 0.50 of health
|
||||||
|
* 3, then healing is 1.00 of health
|
||||||
|
*/
|
||||||
this.getHealRatio(stock >= 3 ? 1 : (stock * 0.25));
|
this.getHealRatio(stock >= 3 ? 1 : (stock * 0.25));
|
||||||
|
|
||||||
super.apply(user, target, move, args);
|
super.apply(user, target, move, args);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getStockpiles(user: Pokemon): integer {
|
|
||||||
let stock = 0;
|
|
||||||
const tagList = [BattlerTagType.STOCKPILE_ONE, BattlerTagType.STOCKPILE_TWO, BattlerTagType.STOCKPILE_THREE];
|
|
||||||
|
|
||||||
for (let x = 0 ; x < tagList.length ; x++){
|
|
||||||
if (user.getTag(tagList[x])){
|
|
||||||
stock++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return stock;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1866,8 +1865,11 @@ export class GrowthStatChangeAttr extends StatChangeAttr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Attribute for the stat changes for {@link Move.STOCKPILE}, {@link Move.SPIT_UP}, and {@link Move.SWALLOW}*/
|
||||||
export class StockpileStatChangeAttr extends StatChangeAttr {
|
export class StockpileStatChangeAttr extends StatChangeAttr {
|
||||||
private tagTypes = [BattlerTagType.STOCKPILE_ONE, BattlerTagType.STOCKPILE_TWO, BattlerTagType.STOCKPILE_THREE];
|
private tagTypes = [BattlerTagType.STOCKPILE_ONE, BattlerTagType.STOCKPILE_TWO, BattlerTagType.STOCKPILE_THREE];
|
||||||
|
// this will show if we will gain 1 stack of stats with Stockpile
|
||||||
|
// or lose stacks of stats with Spit Up or Swallow
|
||||||
private gainStats:boolean;
|
private gainStats:boolean;
|
||||||
|
|
||||||
constructor(gainStats:boolean = true) {
|
constructor(gainStats:boolean = true) {
|
||||||
|
@ -1880,12 +1882,15 @@ export class StockpileStatChangeAttr extends StatChangeAttr {
|
||||||
const stock = getStockpiles(user);
|
const stock = getStockpiles(user);
|
||||||
|
|
||||||
if (!this.gainStats) {
|
if (!this.gainStats) {
|
||||||
// levels become equal to the negative of stock
|
/**
|
||||||
|
* since the Pokemon will be losing stats in this if statement,
|
||||||
|
* {@link this.levels} become equal to the negative of stock
|
||||||
|
*/
|
||||||
this.levels = stock * -1;
|
this.levels = stock * -1;
|
||||||
|
|
||||||
// remove the stats equal to the number of stock
|
// remove the stats equal to the number of stocks
|
||||||
for (let tagType of this.tagTypes)
|
for (let tagType of this.tagTypes)
|
||||||
(this.selfTarget ? user : target).removeTag(tagType);
|
user.removeTag(tagType);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!super.apply(user, target, move, args))
|
if (!super.apply(user, target, move, args))
|
||||||
|
@ -2457,26 +2462,21 @@ export class WaterShurikenPowerAttr extends VariablePowerAttr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Attribute used by the {@link Moves.SPIT_UP} based on the number of stored STOCKPILE BattlerTagTypes*/
|
||||||
export class SpitUpPowerAttr extends VariablePowerAttr {
|
export class SpitUpPowerAttr extends VariablePowerAttr {
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
const power = args[0] as Utils.NumberHolder;
|
const power = args[0] as Utils.NumberHolder;
|
||||||
|
|
||||||
power.value = this.getPower(user, target, move);
|
/**
|
||||||
|
* if stock is:
|
||||||
|
* 1, then power is 100
|
||||||
|
* 2, then power is 100
|
||||||
|
* 3, then power is 100
|
||||||
|
*/
|
||||||
|
power.value = getStockpiles(user)*100;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPower(user: Pokemon, target: Pokemon, move: Move): number {
|
|
||||||
if (!!user.getTag(BattlerTagType.STOCKPILE_THREE)){
|
|
||||||
return 300;
|
|
||||||
} else if (!!user.getTag(BattlerTagType.STOCKPILE_TWO)){
|
|
||||||
return 200;
|
|
||||||
} else if (!!user.getTag(BattlerTagType.STOCKPILE_ONE)){
|
|
||||||
return 100;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class VariableAtkAttr extends MoveAttr {
|
export class VariableAtkAttr extends MoveAttr {
|
||||||
|
@ -3344,46 +3344,52 @@ export class FaintCountdownAttr extends AddBattlerTagAttr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
/** Attribute used by the {@link Moves.STOCKPILE} to add the STOCKPILE BattlerTagTypes*/
|
||||||
export class StockpileAttr extends AddBattlerTagAttr {
|
export class StockpileAttr extends AddBattlerTagAttr {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(BattlerTagType.STOCKPILE_THREE, true, false, 20, 20);
|
super(BattlerTagType.STOCKPILE_THREE, true, false, 20, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This changes {@link this.tagType} based on the {@link stock} of the user
|
||||||
|
* @param user is needed to retrieve how much stockpile the Pokemon has
|
||||||
|
* as well as its name for the message
|
||||||
|
*/
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
|
// uses the getStockpiles() method to see how many stock the Pokemon has right now
|
||||||
const stock = getStockpiles(user);
|
const stock = getStockpiles(user);
|
||||||
let stockType = BattlerTagType.STOCKPILE_THREE;
|
// boolean failsafe that the tag will not apply when inappropriate
|
||||||
let willFail = false;
|
let willFail = false;
|
||||||
|
|
||||||
|
// check how many stock the user has then change the tag based on that
|
||||||
|
// keep the STOCKPILE_THREE tag if the stock is 2 or more
|
||||||
switch (stock){
|
switch (stock){
|
||||||
case 0:
|
case 0:
|
||||||
stockType = BattlerTagType.STOCKPILE_ONE;
|
this.tagType = BattlerTagType.STOCKPILE_ONE;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
stockType = BattlerTagType.STOCKPILE_TWO;
|
this.tagType = BattlerTagType.STOCKPILE_TWO;
|
||||||
break;
|
break;
|
||||||
case 3:
|
|
||||||
willFail = true;
|
|
||||||
break
|
|
||||||
default:
|
default:
|
||||||
// keep it at STOCKPILE_THREE
|
if (stock == 3)
|
||||||
|
willFail = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tagType = stockType;
|
|
||||||
|
|
||||||
if (willFail || !super.apply(user, target, move, args))
|
if (willFail || !super.apply(user, target, move, args))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
user.scene.queueMessage(getPokemonMessage(target, `\nstockpiled ${stock+1}.`));
|
user.scene.queueMessage(this.getTriggerMessage(user, (stock+1)));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getTriggerMessage(pokemon: Pokemon, stockpileNumber: integer, ...args: any[]) {
|
||||||
|
return i18next.t('abilityTriggers:stockpile', {pokemonName: `${getPokemonPrefix(pokemon)}${pokemon.name}`, stockpileNumber: stockpileNumber});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
=======
|
|
||||||
/** Attribute used when a move hits a {@link BattlerTagType} for double damage */
|
/** Attribute used when a move hits a {@link BattlerTagType} for double damage */
|
||||||
>>>>>>> 78f79653049baff0ec6514b743e5f602d43ad391
|
|
||||||
export class HitsTagAttr extends MoveAttr {
|
export class HitsTagAttr extends MoveAttr {
|
||||||
/** The {@link BattlerTagType} this move hits */
|
/** The {@link BattlerTagType} this move hits */
|
||||||
public tagType: BattlerTagType;
|
public tagType: BattlerTagType;
|
||||||
|
@ -4356,6 +4362,11 @@ export class VariableTargetAttr extends MoveAttr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to get how many stockpiles a Pokemon has
|
||||||
|
* @param user to retrieve the BattlerTagTypes
|
||||||
|
* @returns number of stockpile BattleTagTypes on the Pokemon
|
||||||
|
*/
|
||||||
function getStockpiles(user: Pokemon) : integer {
|
function getStockpiles(user: Pokemon) : integer {
|
||||||
let s = 0;
|
let s = 0;
|
||||||
const stock = [BattlerTagType.STOCKPILE_ONE, BattlerTagType.STOCKPILE_TWO, BattlerTagType.STOCKPILE_THREE];
|
const stock = [BattlerTagType.STOCKPILE_ONE, BattlerTagType.STOCKPILE_TWO, BattlerTagType.STOCKPILE_THREE];
|
||||||
|
@ -5221,19 +5232,16 @@ export function initMoves() {
|
||||||
new SelfStatusMove(Moves.STOCKPILE, Type.NORMAL, -1, 20, -1, 0, 3)
|
new SelfStatusMove(Moves.STOCKPILE, Type.NORMAL, -1, 20, -1, 0, 3)
|
||||||
.attr(StockpileAttr)
|
.attr(StockpileAttr)
|
||||||
.attr(StockpileStatChangeAttr)
|
.attr(StockpileStatChangeAttr)
|
||||||
.condition(failOnMaxStockCondition)
|
.condition(failOnMaxStockCondition),
|
||||||
.partial(),
|
|
||||||
new AttackMove(Moves.SPIT_UP, Type.NORMAL, MoveCategory.SPECIAL, -1, 100, 10, -1, 0, 3)
|
new AttackMove(Moves.SPIT_UP, Type.NORMAL, MoveCategory.SPECIAL, -1, 100, 10, -1, 0, 3)
|
||||||
.attr(SpitUpPowerAttr)
|
.attr(SpitUpPowerAttr)
|
||||||
.attr(StockpileStatChangeAttr, false)
|
.attr(StockpileStatChangeAttr, false)
|
||||||
.condition(failOnNoStockCondition)
|
.condition(failOnNoStockCondition),
|
||||||
.partial(),
|
|
||||||
new SelfStatusMove(Moves.SWALLOW, Type.NORMAL, -1, 10, -1, 0, 3)
|
new SelfStatusMove(Moves.SWALLOW, Type.NORMAL, -1, 10, -1, 0, 3)
|
||||||
.attr(SwallowHealAttr, 1)
|
.attr(SwallowHealAttr)
|
||||||
.attr(StockpileStatChangeAttr, false)
|
.attr(StockpileStatChangeAttr, false)
|
||||||
.condition(failOnNoStockCondition)
|
.condition(failOnNoStockCondition)
|
||||||
.triageMove()
|
.triageMove(),
|
||||||
.partial(),
|
|
||||||
new AttackMove(Moves.HEAT_WAVE, Type.FIRE, MoveCategory.SPECIAL, 95, 90, 10, 10, 0, 3)
|
new AttackMove(Moves.HEAT_WAVE, Type.FIRE, MoveCategory.SPECIAL, 95, 90, 10, 10, 0, 3)
|
||||||
.attr(HealStatusEffectAttr, true, StatusEffect.FREEZE)
|
.attr(HealStatusEffectAttr, true, StatusEffect.FREEZE)
|
||||||
.attr(StatusEffectAttr, StatusEffect.BURN)
|
.attr(StatusEffectAttr, StatusEffect.BURN)
|
||||||
|
|
|
@ -2,4 +2,5 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
export const abilityTriggers: SimpleTranslationEntries = {
|
export const abilityTriggers: SimpleTranslationEntries = {
|
||||||
'blockRecoilDamage' : `{{pokemonName}} wurde durch {{abilityName}}\nvor Rückstoß geschützt!`,
|
'blockRecoilDamage' : `{{pokemonName}} wurde durch {{abilityName}}\nvor Rückstoß geschützt!`,
|
||||||
|
'stockpile' : `{{pokemonName}}\n hat {{stockpileNumber}} gehortet!`
|
||||||
} as const;
|
} as const;
|
||||||
|
|
|
@ -2,4 +2,5 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
export const abilityTriggers: SimpleTranslationEntries = {
|
export const abilityTriggers: SimpleTranslationEntries = {
|
||||||
'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`,
|
'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`,
|
||||||
|
'stockpile' : `{{pokemonName}}\n stockpiled {{stockpileNumber}}!`
|
||||||
} as const;
|
} as const;
|
|
@ -2,4 +2,5 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
export const abilityTriggers: SimpleTranslationEntries = {
|
export const abilityTriggers: SimpleTranslationEntries = {
|
||||||
'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`,
|
'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`,
|
||||||
|
'stockpile' : `{{pokemonName}}\n reservo {{stockpileNumber}}!`
|
||||||
} as const;
|
} as const;
|
|
@ -2,4 +2,5 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
export const abilityTriggers: SimpleTranslationEntries = {
|
export const abilityTriggers: SimpleTranslationEntries = {
|
||||||
'blockRecoilDamage' : `{{abilityName}}\nde {{pokemonName}} le protège du contrecoup !`,
|
'blockRecoilDamage' : `{{abilityName}}\nde {{pokemonName}} le protège du contrecoup !`,
|
||||||
|
'stockpile' : `{{pokemonName}}\n en a stocké {{stockpileNumber}}!`
|
||||||
} as const;
|
} as const;
|
||||||
|
|
|
@ -2,4 +2,5 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
export const abilityTriggers: SimpleTranslationEntries = {
|
export const abilityTriggers: SimpleTranslationEntries = {
|
||||||
'blockRecoilDamage' : `{{abilityName}} di {{pokemonName}}\nl'ha protetto dal contraccolpo!`,
|
'blockRecoilDamage' : `{{abilityName}} di {{pokemonName}}\nl'ha protetto dal contraccolpo!`,
|
||||||
|
'stockpile' : `{{pokemonName}}\n ne ha accumulati {{stockpileNumber}}!`
|
||||||
} as const;
|
} as const;
|
|
@ -0,0 +1,6 @@
|
||||||
|
import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
|
export const abilityTriggers: SimpleTranslationEntries = {
|
||||||
|
'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`,
|
||||||
|
'stockpile' : `{{pokemonName}}\n stockpiled {{stockpileNumber}}!`
|
||||||
|
} as const;
|
|
@ -2,4 +2,5 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n";
|
||||||
|
|
||||||
export const abilityTriggers: SimpleTranslationEntries = {
|
export const abilityTriggers: SimpleTranslationEntries = {
|
||||||
'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`,
|
'blockRecoilDamage' : `{{pokemonName}}'s {{abilityName}}\nprotected it from recoil!`,
|
||||||
|
'stockpile' : `{{pokemonName}}\n stockpiled {{stockpileNumber}}!`
|
||||||
} as const;
|
} as const;
|
Loading…
Reference in New Issue