commit
80ee155d06
117
src/data/move.ts
117
src/data/move.ts
|
@ -842,25 +842,25 @@ export class HealAttr extends MoveEffectAttr {
|
||||||
|
|
||||||
export class SwallowHealAttr extends HealAttr {
|
export class SwallowHealAttr extends HealAttr {
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
const s = this.getStockpiles(user);
|
const stock = this.getStockpiles(user);
|
||||||
|
|
||||||
this.getHealRatio(s > 2 ? 1 : (s * 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 {
|
getStockpiles(user: Pokemon): integer {
|
||||||
let s = 0;
|
let stock = 0;
|
||||||
const stock = [BattlerTagType.STOCKPILE_ONE, BattlerTagType.STOCKPILE_TWO, BattlerTagType.STOCKPILE_THREE];
|
const tagList = [BattlerTagType.STOCKPILE_ONE, BattlerTagType.STOCKPILE_TWO, BattlerTagType.STOCKPILE_THREE];
|
||||||
|
|
||||||
for (let x = 0 ; x < stock.length ; x++){
|
for (let x = 0 ; x < tagList.length ; x++){
|
||||||
if (user.getTag(stock[x])){
|
if (user.getTag(tagList[x])){
|
||||||
s++;
|
stock++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return s;
|
return stock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1704,36 +1704,32 @@ export class GrowthStatChangeAttr extends StatChangeAttr {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class StockpileStatChangeAttr extends StatChangeAttr {
|
export class StockpileStatChangeAttr extends StatChangeAttr {
|
||||||
constructor(move: string = "Stockpile") {
|
private tagTypes = [BattlerTagType.STOCKPILE_ONE, BattlerTagType.STOCKPILE_TWO, BattlerTagType.STOCKPILE_THREE];
|
||||||
let l = 1;
|
private gainStats:boolean;
|
||||||
|
|
||||||
if (move === "Spit-Up" || move === "Swallow"){
|
constructor(gainStats:boolean = true) {
|
||||||
l = -1;
|
super([ BattleStat.DEF, BattleStat.SPDEF ], 1, true);
|
||||||
}
|
|
||||||
|
|
||||||
super([ BattleStat.ATK, BattleStat.SPATK ], l, true);
|
this.gainStats = gainStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean | Promise<boolean> {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean | Promise<boolean> {
|
||||||
|
const stock = getStockpiles(user);
|
||||||
|
|
||||||
|
if (!this.gainStats) {
|
||||||
|
// levels become equal to the negative of stock
|
||||||
|
this.levels = stock * -1;
|
||||||
|
|
||||||
|
// remove the stats equal to the number of stock
|
||||||
|
for (let tagType of this.tagTypes)
|
||||||
|
(this.selfTarget ? user : target).removeTag(tagType);
|
||||||
|
}
|
||||||
|
|
||||||
if (!super.apply(user, target, move, args))
|
if (!super.apply(user, target, move, args))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
this.levels = this.levels < 0 ? (this.getStockpiles(user) * -1) : 1;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getStockpiles(user: Pokemon): integer {
|
|
||||||
let s = 0;
|
|
||||||
const stock = [BattlerTagType.STOCKPILE_ONE, BattlerTagType.STOCKPILE_TWO, BattlerTagType.STOCKPILE_THREE];
|
|
||||||
|
|
||||||
for (let x = 0 ; x < stock.length ; x++){
|
|
||||||
if (user.getTag(stock[x])){
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class HalfHpStatMaxAttr extends StatChangeAttr {
|
export class HalfHpStatMaxAttr extends StatChangeAttr {
|
||||||
|
@ -3086,12 +3082,13 @@ export class FaintCountdownAttr extends AddBattlerTagAttr {
|
||||||
|
|
||||||
export class StockpileAttr extends AddBattlerTagAttr {
|
export class StockpileAttr extends AddBattlerTagAttr {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(BattlerTagType.STOCKPILE_THREE, true, true, 20, 20);
|
super(BattlerTagType.STOCKPILE_THREE, true, false, 20, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
const stock = this.getStockpiles(user);
|
const stock = getStockpiles(user);
|
||||||
let stockType = BattlerTagType.STOCKPILE_THREE;
|
let stockType = BattlerTagType.STOCKPILE_THREE;
|
||||||
|
let willFail = false;
|
||||||
|
|
||||||
switch (stock){
|
switch (stock){
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -3099,28 +3096,24 @@ export class StockpileAttr extends AddBattlerTagAttr {
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
stockType = BattlerTagType.STOCKPILE_TWO;
|
stockType = BattlerTagType.STOCKPILE_TWO;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
willFail = true;
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
// keep it at STOCKPILE_THREE
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!super.apply(user, target, move, args))
|
this.tagType = stockType;
|
||||||
|
|
||||||
|
if (willFail || !super.apply(user, target, move, args))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
user.scene.queueMessage(getPokemonMessage(target, `\nstockpiled ${stock+1}.`));
|
user.scene.queueMessage(getPokemonMessage(target, `\nstockpiled ${stock+1}.`));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getStockpiles(user: Pokemon): integer {
|
|
||||||
let s = 0;
|
|
||||||
const stock = [BattlerTagType.STOCKPILE_ONE, BattlerTagType.STOCKPILE_TWO, BattlerTagType.STOCKPILE_THREE];
|
|
||||||
|
|
||||||
for (let x = 0 ; x < stock.length ; x++){
|
|
||||||
if (user.getTag(stock[x])){
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class HitsTagAttr extends MoveAttr {
|
export class HitsTagAttr extends MoveAttr {
|
||||||
|
@ -4093,12 +4086,29 @@ export class VariableTargetAttr extends MoveAttr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getStockpiles(user: Pokemon) : integer {
|
||||||
|
let s = 0;
|
||||||
|
const stock = [BattlerTagType.STOCKPILE_ONE, BattlerTagType.STOCKPILE_TWO, BattlerTagType.STOCKPILE_THREE];
|
||||||
|
|
||||||
|
for (let x = 0 ; x < stock.length ; x++){
|
||||||
|
if (user.getTag(stock[x])){
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
const failOnGravityCondition: MoveConditionFunc = (user, target, move) => !user.scene.arena.getTag(ArenaTagType.GRAVITY);
|
const failOnGravityCondition: MoveConditionFunc = (user, target, move) => !user.scene.arena.getTag(ArenaTagType.GRAVITY);
|
||||||
|
|
||||||
const failOnBossCondition: MoveConditionFunc = (user, target, move) => !target.isBossImmune();
|
const failOnBossCondition: MoveConditionFunc = (user, target, move) => !target.isBossImmune();
|
||||||
|
|
||||||
const failOnMaxCondition: MoveConditionFunc = (user, target, move) => !target.isMax();
|
const failOnMaxCondition: MoveConditionFunc = (user, target, move) => !target.isMax();
|
||||||
|
|
||||||
|
const failOnMaxStockCondition: MoveConditionFunc = (user, target, move) => getStockpiles(user) != 3;
|
||||||
|
|
||||||
|
const failOnNoStockCondition: MoveConditionFunc = (user, target, move) => getStockpiles(user) != 0;
|
||||||
|
|
||||||
const failIfDampCondition: MoveConditionFunc = (user, target, move) => {
|
const failIfDampCondition: MoveConditionFunc = (user, target, move) => {
|
||||||
const cancelled = new Utils.BooleanHolder(false);
|
const cancelled = new Utils.BooleanHolder(false);
|
||||||
user.scene.getField(true).map(p=>applyAbAttrs(FieldPreventExplosiveMovesAbAttr, p, cancelled));
|
user.scene.getField(true).map(p=>applyAbAttrs(FieldPreventExplosiveMovesAbAttr, p, cancelled));
|
||||||
|
@ -4935,25 +4945,18 @@ export function initMoves() {
|
||||||
.partial(),
|
.partial(),
|
||||||
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, 'Stockpile')
|
.attr(StockpileStatChangeAttr)
|
||||||
|
.condition(failOnMaxStockCondition)
|
||||||
.partial(),
|
.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, 'Spit-Up')
|
.attr(StockpileStatChangeAttr, false)
|
||||||
.attr(RemoveBattlerTagAttr, [
|
.condition(failOnNoStockCondition)
|
||||||
BattlerTagType.STOCKPILE_ONE,
|
|
||||||
BattlerTagType.STOCKPILE_TWO,
|
|
||||||
BattlerTagType.STOCKPILE_THREE,
|
|
||||||
], true)
|
|
||||||
.partial(),
|
.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, 1)
|
||||||
.attr(StockpileStatChangeAttr, 'Swallow')
|
.attr(StockpileStatChangeAttr, false)
|
||||||
.attr(RemoveBattlerTagAttr, [
|
.condition(failOnNoStockCondition)
|
||||||
BattlerTagType.STOCKPILE_ONE,
|
|
||||||
BattlerTagType.STOCKPILE_TWO,
|
|
||||||
BattlerTagType.STOCKPILE_THREE,
|
|
||||||
], true)
|
|
||||||
.triageMove()
|
.triageMove()
|
||||||
.partial(),
|
.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)
|
||||||
|
|
Loading…
Reference in New Issue