mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 07:22:19 +02:00
Minor changes for double battles
This commit is contained in:
parent
c123119d48
commit
51f51acc08
@ -193,10 +193,10 @@ export class EncounterPhase extends BattlePhase {
|
|||||||
|
|
||||||
const battle = this.scene.currentBattle;
|
const battle = this.scene.currentBattle;
|
||||||
|
|
||||||
battle.enemyLevels.forEach((_, e) => {
|
battle.enemyLevels.forEach((level, e) => {
|
||||||
const enemySpecies = this.scene.randomSpecies(battle.waveIndex, battle.enemyLevels[e], true);
|
const enemySpecies = this.scene.randomSpecies(battle.waveIndex, level, true);
|
||||||
if (!this.loaded)
|
if (!this.loaded)
|
||||||
battle.enemyField[e] = new EnemyPokemon(this.scene, enemySpecies, battle.enemyLevels[e]);
|
battle.enemyField[e] = new EnemyPokemon(this.scene, enemySpecies, level);
|
||||||
const enemyPokemon = this.scene.getEnemyField()[e];
|
const enemyPokemon = this.scene.getEnemyField()[e];
|
||||||
enemyPokemon.resetSummonData();
|
enemyPokemon.resetSummonData();
|
||||||
|
|
||||||
@ -208,11 +208,16 @@ export class EncounterPhase extends BattlePhase {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Promise.all(loadEnemyAssets).then(() => {
|
Promise.all(loadEnemyAssets).then(() => {
|
||||||
battle.enemyField.forEach(enemyPokemon => {
|
battle.enemyField.forEach((enemyPokemon, e) => {
|
||||||
this.scene.field.add(enemyPokemon);
|
this.scene.field.add(enemyPokemon);
|
||||||
if (this.scene.getPlayerPokemon().visible)
|
if (this.scene.getPlayerPokemon().visible)
|
||||||
this.scene.field.moveBelow(enemyPokemon, this.scene.getPlayerPokemon());
|
this.scene.field.moveBelow(enemyPokemon, this.scene.getPlayerPokemon());
|
||||||
enemyPokemon.tint(0, 0.5);
|
enemyPokemon.tint(0, 0.5);
|
||||||
|
if (battle.enemyField.length > 1) {
|
||||||
|
enemyPokemon.x += 32 * (e ? 1 : -1);
|
||||||
|
if (!e)
|
||||||
|
enemyPokemon.y += 8 * (e ? 1 : -1);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.loaded) {
|
if (!this.loaded) {
|
||||||
@ -239,7 +244,7 @@ export class EncounterPhase extends BattlePhase {
|
|||||||
const enemyField = this.scene.getEnemyField();
|
const enemyField = this.scene.getEnemyField();
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: [ this.scene.arenaEnemy, enemyField, this.scene.arenaPlayer, this.scene.trainer ].flat(),
|
targets: [ this.scene.arenaEnemy, enemyField, this.scene.arenaPlayer, this.scene.trainer ].flat(),
|
||||||
x: (_target, _key, value, fieldIndex: integer) => fieldIndex < 2 ? value + 300 : value - 300,
|
x: (_target, _key, value, fieldIndex: integer) => fieldIndex < 1 + (enemyField.length) ? value + 300 : value - 300,
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
onComplete: () => {
|
onComplete: () => {
|
||||||
enemyField.forEach(enemyPokemon => {
|
enemyField.forEach(enemyPokemon => {
|
||||||
@ -463,6 +468,16 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
|||||||
|
|
||||||
const playerPokemon = this.getPokemon();
|
const playerPokemon = this.getPokemon();
|
||||||
|
|
||||||
|
if (this.fieldIndex === 1) {
|
||||||
|
this.scene.tweens.add({
|
||||||
|
targets: this.scene.getPlayerField(),
|
||||||
|
ease: 'Sine.easeOut',
|
||||||
|
duration: 250,
|
||||||
|
x: (_target, _key, value: number, fieldIndex: integer) => value + 32 * (fieldIndex ? 1 : -1),
|
||||||
|
y: (_target, _key, value: number, fieldIndex: integer) => value + 8 * (fieldIndex ? 1 : -1)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
pokeball.setVisible(true);
|
pokeball.setVisible(true);
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: pokeball,
|
targets: pokeball,
|
||||||
@ -1196,7 +1211,7 @@ abstract class MoveEffectPhase extends PokemonPhase {
|
|||||||
if (target.hp)
|
if (target.hp)
|
||||||
applyPostDefendAbAttrs(PostDefendAbAttr, target, user, this.move, result);
|
applyPostDefendAbAttrs(PostDefendAbAttr, target, user, this.move, result);
|
||||||
if (this.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT))
|
if (this.move.getMove().hasFlag(MoveFlags.MAKES_CONTACT))
|
||||||
this.scene.applyModifiers(ContactHeldItemTransferChanceModifier, this.player, user);
|
this.scene.applyModifiers(ContactHeldItemTransferChanceModifier, this.player, user, target.getFieldIndex());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.end();
|
this.end();
|
||||||
|
@ -480,7 +480,8 @@ export class TurnHealModifier extends PokemonHeldItemModifier {
|
|||||||
|
|
||||||
if (pokemon.getHpRatio() < 1) {
|
if (pokemon.getHpRatio() < 1) {
|
||||||
const scene = pokemon.scene;
|
const scene = pokemon.scene;
|
||||||
scene.unshiftPhase(new PokemonHealPhase(scene, pokemon.isPlayer(), Math.max(Math.floor(pokemon.getMaxHp() / 16) * this.stackCount, 1), getPokemonMessage(pokemon, `'s ${this.type.name}\nrestored its HP a little!`), true));
|
scene.unshiftPhase(new PokemonHealPhase(scene, pokemon.isPlayer(), pokemon.getFieldIndex(),
|
||||||
|
Math.max(Math.floor(pokemon.getMaxHp() / 16) * this.stackCount, 1), getPokemonMessage(pokemon, `'s ${this.type.name}\nrestored its HP a little!`), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -509,7 +510,8 @@ export class HitHealModifier extends PokemonHeldItemModifier {
|
|||||||
|
|
||||||
if (pokemon.turnData.damageDealt && pokemon.getHpRatio() < 1) {
|
if (pokemon.turnData.damageDealt && pokemon.getHpRatio() < 1) {
|
||||||
const scene = pokemon.scene;
|
const scene = pokemon.scene;
|
||||||
scene.unshiftPhase(new PokemonHealPhase(scene, pokemon.isPlayer(), Math.max(Math.floor(pokemon.turnData.damageDealt / 8) * this.stackCount, 1), getPokemonMessage(pokemon, `'s ${this.type.name}\nrestored its HP a little!`), true));
|
scene.unshiftPhase(new PokemonHealPhase(scene, pokemon.isPlayer(), pokemon.getFieldIndex(),
|
||||||
|
Math.max(Math.floor(pokemon.turnData.damageDealt / 8) * this.stackCount, 1), getPokemonMessage(pokemon, `'s ${this.type.name}\nrestored its HP a little!`), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1001,7 +1003,7 @@ export abstract class HeldItemTransferModifier extends PokemonHeldItemModifier {
|
|||||||
|
|
||||||
apply(args: any[]): boolean {
|
apply(args: any[]): boolean {
|
||||||
const pokemon = args[0] as Pokemon;
|
const pokemon = args[0] as Pokemon;
|
||||||
const targetPokemon = pokemon.getOpponent();
|
const targetPokemon = pokemon.getOpponent(args.length > 1 ? args[1] as integer : !pokemon.scene.currentBattle.double ? 0 : Utils.randInt(2));
|
||||||
if (!targetPokemon)
|
if (!targetPokemon)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import { BattlerTag, BattlerTagLapseType, BattlerTagType, TypeBoostTag, getBattl
|
|||||||
import { Species } from './data/species';
|
import { Species } from './data/species';
|
||||||
import { WeatherType } from './data/weather';
|
import { WeatherType } from './data/weather';
|
||||||
import { TempBattleStat } from './data/temp-battle-stat';
|
import { TempBattleStat } from './data/temp-battle-stat';
|
||||||
import { ArenaTagType, GravityTag, WeakenMoveTypeTag } from './data/arena-tag';
|
import { ArenaTagType, WeakenMoveTypeTag } from './data/arena-tag';
|
||||||
import { Biome } from './data/biome';
|
import { Biome } from './data/biome';
|
||||||
import { Abilities, Ability, BattleStatMultiplierAbAttr, BlockCritAbAttr, PreApplyBattlerTagAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, abilities, applyBattleStatMultiplierAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs } from './data/ability';
|
import { Abilities, Ability, BattleStatMultiplierAbAttr, BlockCritAbAttr, PreApplyBattlerTagAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, abilities, applyBattleStatMultiplierAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs } from './data/ability';
|
||||||
import PokemonData from './system/pokemon-data';
|
import PokemonData from './system/pokemon-data';
|
||||||
|
Loading…
Reference in New Issue
Block a user