Add day/night cycle
parent
b04c7c8c3b
commit
5ef6f2da88
109
src/arena.ts
109
src/arena.ts
|
@ -15,6 +15,13 @@ import { BattlerIndex } from "./battle";
|
||||||
|
|
||||||
const WEATHER_OVERRIDE = WeatherType.NONE;
|
const WEATHER_OVERRIDE = WeatherType.NONE;
|
||||||
|
|
||||||
|
export enum TimeOfDay {
|
||||||
|
DAWN,
|
||||||
|
DAY,
|
||||||
|
DUSK,
|
||||||
|
NIGHT
|
||||||
|
}
|
||||||
|
|
||||||
export class Arena {
|
export class Arena {
|
||||||
public scene: BattleScene;
|
public scene: BattleScene;
|
||||||
public biomeType: Biome;
|
public biomeType: Biome;
|
||||||
|
@ -136,14 +143,15 @@ export class Arena {
|
||||||
case Species.VIVILLON:
|
case Species.VIVILLON:
|
||||||
return 0;
|
return 0;
|
||||||
case Species.LYCANROC:
|
case Species.LYCANROC:
|
||||||
switch (this.biomeType) {
|
const timeOfDay = this.getTimeOfDay();
|
||||||
case Biome.CAVE:
|
switch (timeOfDay) {
|
||||||
case Biome.ICE_CAVE:
|
case TimeOfDay.DAY:
|
||||||
case Biome.FAIRY_CAVE:
|
case TimeOfDay.DAWN:
|
||||||
|
return 0;
|
||||||
|
case TimeOfDay.DUSK:
|
||||||
return 2;
|
return 2;
|
||||||
default:
|
case TimeOfDay.NIGHT:
|
||||||
if (!this.isDaytime())
|
return 1;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
case Species.CALYREX:
|
case Species.CALYREX:
|
||||||
switch (this.biomeType) {
|
switch (this.biomeType) {
|
||||||
|
@ -297,27 +305,80 @@ export class Arena {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isDaytime(): boolean {
|
getTimeOfDay(): TimeOfDay {
|
||||||
switch (this.biomeType) {
|
switch (this.biomeType) {
|
||||||
case Biome.TOWN:
|
case Biome.ABYSS:
|
||||||
case Biome.PLAINS:
|
return TimeOfDay.NIGHT;
|
||||||
case Biome.GRASS:
|
}
|
||||||
case Biome.METROPOLIS:
|
|
||||||
case Biome.SEA:
|
const waveCycle = ((this.scene.currentBattle?.waveIndex || 0) + this.scene.getWaveCycleOffset()) % 40;
|
||||||
case Biome.BEACH:
|
|
||||||
case Biome.LAKE:
|
if (waveCycle < 15)
|
||||||
case Biome.MOUNTAIN:
|
return TimeOfDay.DAY;
|
||||||
case Biome.BADLANDS:
|
|
||||||
case Biome.DESERT:
|
if (waveCycle < 20)
|
||||||
case Biome.MEADOW:
|
return TimeOfDay.DAWN;
|
||||||
|
|
||||||
|
if (waveCycle < 35)
|
||||||
|
return TimeOfDay.NIGHT;
|
||||||
|
|
||||||
|
return TimeOfDay.DUSK;
|
||||||
|
}
|
||||||
|
|
||||||
|
isOutside(): boolean {
|
||||||
|
switch (this.biomeType) {
|
||||||
|
case Biome.SEABED:
|
||||||
|
case Biome.CAVE:
|
||||||
|
case Biome.ICE_CAVE:
|
||||||
|
case Biome.POWER_PLANT:
|
||||||
case Biome.DOJO:
|
case Biome.DOJO:
|
||||||
case Biome.CONSTRUCTION_SITE:
|
case Biome.FACTORY:
|
||||||
case Biome.ISLAND:
|
case Biome.ABYSS:
|
||||||
case Biome.SNOWY_FOREST:
|
case Biome.FAIRY_CAVE:
|
||||||
|
case Biome.TEMPLE:
|
||||||
|
case Biome.LABORATORY:
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDayTint(): [integer, integer, integer] {
|
||||||
|
switch (this.biomeType) {
|
||||||
|
case Biome.ABYSS:
|
||||||
|
return [ 64, 64, 64 ];
|
||||||
|
default:
|
||||||
|
return [ 128, 128, 128 ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getDuskTint(): [integer, integer, integer] {
|
||||||
|
if (!this.isOutside())
|
||||||
|
return [ 0, 0, 0 ];
|
||||||
|
|
||||||
|
switch (this.biomeType) {
|
||||||
|
default:
|
||||||
|
return [ 98, 48, 73 ].map(c => Math.round((c + 128) / 2)) as [integer, integer, integer];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getNightTint(): [integer, integer, integer] {
|
||||||
|
switch (this.biomeType) {
|
||||||
|
case Biome.ABYSS:
|
||||||
|
case Biome.SPACE:
|
||||||
|
case Biome.END:
|
||||||
|
return this.getDayTint();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.isOutside())
|
||||||
|
return [ 64, 64, 64 ];
|
||||||
|
|
||||||
|
switch (this.biomeType) {
|
||||||
|
default:
|
||||||
|
return [ 48, 48, 98 ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
applyTags(tagType: ArenaTagType | { new(...args: any[]): ArenaTag }, ...args: any[]): void {
|
applyTags(tagType: ArenaTagType | { new(...args: any[]): ArenaTag }, ...args: any[]): void {
|
||||||
const tags = typeof tagType === 'number'
|
const tags = typeof tagType === 'number'
|
||||||
? this.tags.filter(t => t.tagType === tagType)
|
? this.tags.filter(t => t.tagType === tagType)
|
||||||
|
@ -492,12 +553,12 @@ export class ArenaBase extends Phaser.GameObjects.Container {
|
||||||
|
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
|
||||||
this.base = scene.add.sprite(0, 0, 'plains_a');
|
this.base = scene.addFieldSprite(0, 0, 'plains_a');
|
||||||
this.base.setOrigin(0, 0);
|
this.base.setOrigin(0, 0);
|
||||||
|
|
||||||
this.props = !player ?
|
this.props = !player ?
|
||||||
new Array(3).fill(null).map(() => {
|
new Array(3).fill(null).map(() => {
|
||||||
const ret = scene.add.sprite(0, 0, 'plains_b');
|
const ret = scene.addFieldSprite(0, 0, 'plains_b');
|
||||||
ret.setOrigin(0, 0);
|
ret.setOrigin(0, 0);
|
||||||
ret.setVisible(false);
|
ret.setVisible(false);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -135,6 +135,7 @@ export class SelectStarterPhase extends BattlePhase {
|
||||||
this.scene.ui.setMode(Mode.MESSAGE).then(() => {
|
this.scene.ui.setMode(Mode.MESSAGE).then(() => {
|
||||||
SoundFade.fadeOut(this.scene, this.scene.sound.get('menu'), 500, true);
|
SoundFade.fadeOut(this.scene, this.scene.sound.get('menu'), 500, true);
|
||||||
this.scene.time.delayedCall(500, () => this.scene.playBgm());
|
this.scene.time.delayedCall(500, () => this.scene.playBgm());
|
||||||
|
this.scene.newBattle();
|
||||||
this.end();
|
this.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -335,7 +336,7 @@ export class EncounterPhase extends BattlePhase {
|
||||||
pokemon.resetBattleData();
|
pokemon.resetBattleData();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.scene.arena.trySetWeather(getRandomWeatherType(this.scene.arena.biomeType), false);
|
this.scene.arena.trySetWeather(getRandomWeatherType(this.scene.arena), false);
|
||||||
|
|
||||||
const enemyField = this.scene.getEnemyField();
|
const enemyField = this.scene.getEnemyField();
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
|
@ -489,7 +490,7 @@ export class NewBiomeEncounterPhase extends NextEncounterPhase {
|
||||||
pokemon.resetBattleData();
|
pokemon.resetBattleData();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.scene.arena.trySetWeather(getRandomWeatherType(this.scene.arena.biomeType), false);
|
this.scene.arena.trySetWeather(getRandomWeatherType(this.scene.arena), false);
|
||||||
|
|
||||||
const enemyField = this.scene.getEnemyField();
|
const enemyField = this.scene.getEnemyField();
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
|
@ -685,7 +686,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
||||||
}
|
}
|
||||||
|
|
||||||
summon(): void {
|
summon(): void {
|
||||||
const pokeball = this.scene.add.sprite(this.player ? 36 : 248, this.player ? 80 : 44, 'pb', 'pb');
|
const pokeball = this.scene.addFieldSprite(this.player ? 36 : 248, this.player ? 80 : 44, 'pb', 'pb');
|
||||||
pokeball.setVisible(false);
|
pokeball.setVisible(false);
|
||||||
pokeball.setOrigin(0.5, 0.625);
|
pokeball.setOrigin(0.5, 0.625);
|
||||||
this.scene.field.add(pokeball);
|
this.scene.field.add(pokeball);
|
||||||
|
@ -1953,6 +1954,7 @@ export class StatChangePhase extends PokemonPhase {
|
||||||
const pokemonMaskSprite = pokemon.maskSprite;
|
const pokemonMaskSprite = pokemon.maskSprite;
|
||||||
|
|
||||||
const statSprite = this.scene.add.tileSprite((this.player ? 106 : 236) * 6, ((this.player ? 148 : 84) + (levels.value >= 1 ? 160 : 0)) * 6, 156, 316, 'battle_stats', filteredStats.length > 1 ? 'mix' : BattleStat[filteredStats[0]].toLowerCase());
|
const statSprite = this.scene.add.tileSprite((this.player ? 106 : 236) * 6, ((this.player ? 148 : 84) + (levels.value >= 1 ? 160 : 0)) * 6, 156, 316, 'battle_stats', filteredStats.length > 1 ? 'mix' : BattleStat[filteredStats[0]].toLowerCase());
|
||||||
|
statSprite.setPipeline(this.scene.fieldSpritePipeline);
|
||||||
statSprite.setAlpha(0);
|
statSprite.setAlpha(0);
|
||||||
statSprite.setScale(6);
|
statSprite.setScale(6);
|
||||||
statSprite.setOrigin(0.5, 1);
|
statSprite.setOrigin(0.5, 1);
|
||||||
|
@ -2877,7 +2879,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||||
const fpOffset = pokemon.getFieldPositionOffset();
|
const fpOffset = pokemon.getFieldPositionOffset();
|
||||||
|
|
||||||
const pokeballAtlasKey = getPokeballAtlasKey(this.pokeballType);
|
const pokeballAtlasKey = getPokeballAtlasKey(this.pokeballType);
|
||||||
this.pokeball = this.scene.add.sprite(16, 80, 'pb', pokeballAtlasKey);
|
this.pokeball = this.scene.addFieldSprite(16, 80, 'pb', pokeballAtlasKey);
|
||||||
this.pokeball.setOrigin(0.5, 0.625);
|
this.pokeball.setOrigin(0.5, 0.625);
|
||||||
this.scene.field.add(this.pokeball);
|
this.scene.field.add(this.pokeball);
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ import AbilityBar from './ui/ability-bar';
|
||||||
import { BlockItemTheftAbAttr, DoubleBattleChanceAbAttr, applyAbAttrs, initAbilities } from './data/ability';
|
import { BlockItemTheftAbAttr, DoubleBattleChanceAbAttr, applyAbAttrs, initAbilities } from './data/ability';
|
||||||
import Battle, { BattleType, FixedBattleConfig, fixedBattles } from './battle';
|
import Battle, { BattleType, FixedBattleConfig, fixedBattles } from './battle';
|
||||||
import { GameMode } from './game-mode';
|
import { GameMode } from './game-mode';
|
||||||
|
import FieldSpritePipeline from './pipelines/field-sprite';
|
||||||
import SpritePipeline from './pipelines/sprite';
|
import SpritePipeline from './pipelines/sprite';
|
||||||
import PartyExpBar from './ui/party-exp-bar';
|
import PartyExpBar from './ui/party-exp-bar';
|
||||||
import { TrainerType, trainerConfigs } from './data/trainer-type';
|
import { TrainerType, trainerConfigs } from './data/trainer-type';
|
||||||
|
@ -122,6 +123,7 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
public seed: string;
|
public seed: string;
|
||||||
public waveSeed: string;
|
public waveSeed: string;
|
||||||
|
|
||||||
|
public fieldSpritePipeline: FieldSpritePipeline;
|
||||||
public spritePipeline: SpritePipeline;
|
public spritePipeline: SpritePipeline;
|
||||||
|
|
||||||
private bgm: AnySound;
|
private bgm: AnySound;
|
||||||
|
@ -389,6 +391,9 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
this.spritePipeline = new SpritePipeline(this.game);
|
this.spritePipeline = new SpritePipeline(this.game);
|
||||||
(this.renderer as Phaser.Renderer.WebGL.WebGLRenderer).pipelines.add('Sprite', this.spritePipeline);
|
(this.renderer as Phaser.Renderer.WebGL.WebGLRenderer).pipelines.add('Sprite', this.spritePipeline);
|
||||||
|
|
||||||
|
this.fieldSpritePipeline = new FieldSpritePipeline(this.game);
|
||||||
|
(this.renderer as Phaser.Renderer.WebGL.WebGLRenderer).pipelines.add('FieldSprite', this.fieldSpritePipeline);
|
||||||
|
|
||||||
this.time.delayedCall(20, () => this.launchBattle());
|
this.time.delayedCall(20, () => this.launchBattle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,8 +471,8 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
|
|
||||||
this.quickStart = this.quickStart || this.isButtonPressed(Button.QUICK_START);
|
this.quickStart = this.quickStart || this.isButtonPressed(Button.QUICK_START);
|
||||||
|
|
||||||
this.arenaBg = this.add.sprite(0, 0, 'plains_bg');
|
this.arenaBg = this.addFieldSprite(0, 0, 'plains_bg');
|
||||||
this.arenaBgTransition = this.add.sprite(0, 0, `plains_bg`);
|
this.arenaBgTransition = this.addFieldSprite(0, 0, `plains_bg`);
|
||||||
this.arenaPlayer = new ArenaBase(this, true);
|
this.arenaPlayer = new ArenaBase(this, true);
|
||||||
this.arenaPlayerTransition = new ArenaBase(this, true);
|
this.arenaPlayerTransition = new ArenaBase(this, true);
|
||||||
this.arenaEnemy = new ArenaBase(this, false);
|
this.arenaEnemy = new ArenaBase(this, false);
|
||||||
|
@ -489,7 +494,7 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
frameRate: 16
|
frameRate: 16
|
||||||
});
|
});
|
||||||
|
|
||||||
const trainer = this.add.sprite(0, 0, 'trainer_m');
|
const trainer = this.addFieldSprite(0, 0, 'trainer_m');
|
||||||
trainer.setOrigin(0.5, 1);
|
trainer.setOrigin(0.5, 1);
|
||||||
|
|
||||||
field.add(trainer);
|
field.add(trainer);
|
||||||
|
@ -532,7 +537,10 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
if (enableAuto)
|
if (enableAuto)
|
||||||
initAutoPlay.apply(this);
|
initAutoPlay.apply(this);
|
||||||
|
|
||||||
this.newBattle();
|
if (!this.quickStart)
|
||||||
|
this.pushPhase(new CheckLoadPhase(this));
|
||||||
|
else
|
||||||
|
this.pushPhase(new EncounterPhase(this));
|
||||||
|
|
||||||
this.shiftPhase();
|
this.shiftPhase();
|
||||||
});
|
});
|
||||||
|
@ -733,35 +741,30 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
|
|
||||||
//this.pushPhase(new TrainerMessageTestPhase(this));
|
//this.pushPhase(new TrainerMessageTestPhase(this));
|
||||||
|
|
||||||
if (!waveIndex) {
|
if (!waveIndex && lastBattle) {
|
||||||
const isNewBiome = !lastBattle || !(lastBattle.waveIndex % 10);
|
const isNewBiome = !(lastBattle.waveIndex % 10);
|
||||||
const resetArenaState = isNewBiome || this.currentBattle.battleType === BattleType.TRAINER;
|
const resetArenaState = isNewBiome || this.currentBattle.battleType === BattleType.TRAINER;
|
||||||
if (lastBattle) {
|
this.getEnemyParty().forEach(enemyPokemon => enemyPokemon.destroy());
|
||||||
this.getEnemyParty().forEach(enemyPokemon => enemyPokemon.destroy());
|
this.trySpreadPokerus();
|
||||||
this.trySpreadPokerus();
|
if (resetArenaState) {
|
||||||
if (resetArenaState) {
|
this.arena.removeAllTags();
|
||||||
this.arena.removeAllTags();
|
playerField.forEach((_, p) => this.unshiftPhase(new ReturnPhase(this, p)));
|
||||||
playerField.forEach((_, p) => this.unshiftPhase(new ReturnPhase(this, p)));
|
this.unshiftPhase(new ShowTrainerPhase(this));
|
||||||
this.unshiftPhase(new ShowTrainerPhase(this));
|
for (let pokemon of this.getParty()) {
|
||||||
for (let pokemon of this.getParty()) {
|
if (pokemon)
|
||||||
if (pokemon)
|
pokemon.resetBattleData();
|
||||||
pokemon.resetBattleData();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (this.gameMode === GameMode.CLASSIC && !isNewBiome)
|
}
|
||||||
this.pushPhase(new NextEncounterPhase(this));
|
if (this.gameMode === GameMode.CLASSIC && !isNewBiome)
|
||||||
else {
|
this.pushPhase(new NextEncounterPhase(this));
|
||||||
this.pushPhase(new SelectBiomePhase(this));
|
else {
|
||||||
this.pushPhase(new NewBiomeEncounterPhase(this));
|
this.pushPhase(new SelectBiomePhase(this));
|
||||||
|
this.pushPhase(new NewBiomeEncounterPhase(this));
|
||||||
|
|
||||||
const newMaxExpLevel = this.getMaxExpLevel();
|
const newMaxExpLevel = this.getMaxExpLevel();
|
||||||
if (newMaxExpLevel > maxExpLevel)
|
if (newMaxExpLevel > maxExpLevel)
|
||||||
this.pushPhase(new LevelCapPhase(this));
|
this.pushPhase(new LevelCapPhase(this));
|
||||||
}
|
}
|
||||||
} else if (!this.quickStart)
|
|
||||||
this.pushPhase(new CheckLoadPhase(this));
|
|
||||||
else
|
|
||||||
this.pushPhase(new EncounterPhase(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.currentBattle;
|
return this.currentBattle;
|
||||||
|
@ -813,6 +816,14 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
return this.arena.getSpeciesFormIndex(species);
|
return this.arena.getSpeciesFormIndex(species);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getWaveCycleOffset(): integer {
|
||||||
|
let ret = 0;
|
||||||
|
this.executeWithSeedOffset(() => {
|
||||||
|
ret = Utils.randSeedInt(8) * 5;
|
||||||
|
}, 0, this.seed.toString());
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
trySpreadPokerus(): void {
|
trySpreadPokerus(): void {
|
||||||
const party = this.getParty();
|
const party = this.getParty();
|
||||||
const infectedIndexes: integer[] = [];
|
const infectedIndexes: integer[] = [];
|
||||||
|
@ -841,7 +852,7 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
}
|
}
|
||||||
|
|
||||||
resetSeed(waveIndex?: integer): void {
|
resetSeed(waveIndex?: integer): void {
|
||||||
this.waveSeed = Utils.shiftCharCodes(this.seed, waveIndex || this.currentBattle.waveIndex);
|
this.waveSeed = Utils.shiftCharCodes(this.seed, waveIndex || this.currentBattle?.waveIndex || 0);
|
||||||
Phaser.Math.RND.sow([ this.waveSeed ]);
|
Phaser.Math.RND.sow([ this.waveSeed ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -854,6 +865,13 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
Phaser.Math.RND.state(state);
|
Phaser.Math.RND.state(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addFieldSprite(x: number, y: number, texture: string | Phaser.Textures.Texture, frame?: string | number): Phaser.GameObjects.Sprite {
|
||||||
|
const ret = this.add.sprite(x, y, texture, frame);
|
||||||
|
ret.setPipeline(this.fieldSpritePipeline);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
showFieldOverlay(duration: integer): Promise<void> {
|
showFieldOverlay(duration: integer): Promise<void> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
this.tweens.add({
|
this.tweens.add({
|
||||||
|
|
|
@ -762,7 +762,7 @@ export abstract class BattleAnim {
|
||||||
if ((isUser ? u : t) === sprites.length) {
|
if ((isUser ? u : t) === sprites.length) {
|
||||||
const spriteSource = isUser ? userSprite : targetSprite;
|
const spriteSource = isUser ? userSprite : targetSprite;
|
||||||
let sprite: Phaser.GameObjects.Sprite;
|
let sprite: Phaser.GameObjects.Sprite;
|
||||||
sprite = scene.add.sprite(0, 0, spriteSource.texture, spriteSource.frame.name);
|
sprite = scene.addFieldSprite(0, 0, spriteSource.texture, spriteSource.frame.name);
|
||||||
sprite.setPipeline(scene.spritePipeline, { tone: [ 0.0, 0.0, 0.0, 0.0 ], hasShadow: true });
|
sprite.setPipeline(scene.spritePipeline, { tone: [ 0.0, 0.0, 0.0, 0.0 ], hasShadow: true });
|
||||||
[ 'spriteColors', 'fusionSpriteColors' ].map(k => sprite.pipelineData[k] = (isUser ? user : target).getSprite().pipelineData[k]);
|
[ 'spriteColors', 'fusionSpriteColors' ].map(k => sprite.pipelineData[k] = (isUser ? user : target).getSprite().pipelineData[k]);
|
||||||
spriteSource.on('animationupdate', (_anim, frame) => sprite.setFrame(frame.textureFrame));
|
spriteSource.on('animationupdate', (_anim, frame) => sprite.setFrame(frame.textureFrame));
|
||||||
|
@ -787,7 +787,7 @@ export abstract class BattleAnim {
|
||||||
} else {
|
} else {
|
||||||
const sprites = spriteCache[AnimFrameTarget.GRAPHIC];
|
const sprites = spriteCache[AnimFrameTarget.GRAPHIC];
|
||||||
if (g === sprites.length) {
|
if (g === sprites.length) {
|
||||||
let newSprite: Phaser.GameObjects.Sprite = scene.add.sprite(0, 0, anim.graphic, 1);
|
let newSprite: Phaser.GameObjects.Sprite = scene.addFieldSprite(0, 0, anim.graphic, 1);
|
||||||
sprites.push(newSprite);
|
sprites.push(newSprite);
|
||||||
scene.field.add(newSprite);
|
scene.field.add(newSprite);
|
||||||
spritePriorities.push(1);
|
spritePriorities.push(1);
|
||||||
|
|
|
@ -11,6 +11,7 @@ import * as Utils from "../utils";
|
||||||
import { SpeciesFormKey } from "./pokemon-species";
|
import { SpeciesFormKey } from "./pokemon-species";
|
||||||
import { WeatherType } from "./weather";
|
import { WeatherType } from "./weather";
|
||||||
import { Biome } from "./biome";
|
import { Biome } from "./biome";
|
||||||
|
import { TimeOfDay } from "../arena";
|
||||||
|
|
||||||
export enum SpeciesWildEvolutionDelay {
|
export enum SpeciesWildEvolutionDelay {
|
||||||
NONE,
|
NONE,
|
||||||
|
@ -893,10 +894,10 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
||||||
new SpeciesEvolution(Species.CLAWITZER, 37, null, null)
|
new SpeciesEvolution(Species.CLAWITZER, 37, null, null)
|
||||||
],
|
],
|
||||||
[Species.TYRUNT]: [
|
[Species.TYRUNT]: [
|
||||||
new SpeciesEvolution(Species.TYRANTRUM, 39, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.MEDIUM)
|
new SpeciesEvolution(Species.TYRANTRUM, 39, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.getTimeOfDay() === TimeOfDay.DAY), SpeciesWildEvolutionDelay.MEDIUM)
|
||||||
],
|
],
|
||||||
[Species.AMAURA]: [
|
[Species.AMAURA]: [
|
||||||
new SpeciesEvolution(Species.AURORUS, 39, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.MEDIUM)
|
new SpeciesEvolution(Species.AURORUS, 39, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT), SpeciesWildEvolutionDelay.MEDIUM)
|
||||||
],
|
],
|
||||||
[Species.GOOMY]: [
|
[Species.GOOMY]: [
|
||||||
new SpeciesEvolution(Species.HISUI_SLIGGOO, 40, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.biomeType === Biome.RUINS), SpeciesWildEvolutionDelay.NEVER),
|
new SpeciesEvolution(Species.HISUI_SLIGGOO, 40, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.biomeType === Biome.RUINS), SpeciesWildEvolutionDelay.NEVER),
|
||||||
|
@ -939,7 +940,7 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
||||||
new SpeciesEvolution(Species.TOUCANNON, 36, null, null)
|
new SpeciesEvolution(Species.TOUCANNON, 36, null, null)
|
||||||
],
|
],
|
||||||
[Species.YUNGOOS]: [
|
[Species.YUNGOOS]: [
|
||||||
new SpeciesEvolution(Species.GUMSHOOS, 20, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.SHORT)
|
new SpeciesEvolution(Species.GUMSHOOS, 20, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.getTimeOfDay() === TimeOfDay.DAY), SpeciesWildEvolutionDelay.SHORT)
|
||||||
],
|
],
|
||||||
[Species.GRUBBIN]: [
|
[Species.GRUBBIN]: [
|
||||||
new SpeciesEvolution(Species.CHARJABUG, 20, null, null)
|
new SpeciesEvolution(Species.CHARJABUG, 20, null, null)
|
||||||
|
@ -957,7 +958,7 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
||||||
new SpeciesEvolution(Species.ARAQUANID, 22, null, null)
|
new SpeciesEvolution(Species.ARAQUANID, 22, null, null)
|
||||||
],
|
],
|
||||||
[Species.FOMANTIS]: [
|
[Species.FOMANTIS]: [
|
||||||
new SpeciesEvolution(Species.LURANTIS, 34, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.SHORT)
|
new SpeciesEvolution(Species.LURANTIS, 34, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.getTimeOfDay() === TimeOfDay.DAY), SpeciesWildEvolutionDelay.SHORT)
|
||||||
],
|
],
|
||||||
[Species.MORELULL]: [
|
[Species.MORELULL]: [
|
||||||
new SpeciesEvolution(Species.SHIINOTIC, 24, null, null)
|
new SpeciesEvolution(Species.SHIINOTIC, 24, null, null)
|
||||||
|
@ -987,14 +988,14 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
||||||
new SpeciesEvolution(Species.COSMOEM, 43, null, null)
|
new SpeciesEvolution(Species.COSMOEM, 43, null, null)
|
||||||
],
|
],
|
||||||
[Species.COSMOEM]: [
|
[Species.COSMOEM]: [
|
||||||
new SpeciesEvolution(Species.SOLGALEO, 53, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.biomeType !== Biome.SPACE && p.scene.arena.isDaytime()), null),
|
new SpeciesEvolution(Species.SOLGALEO, 53, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.biomeType !== Biome.SPACE && p.scene.arena.getTimeOfDay() === TimeOfDay.DAY), null),
|
||||||
new SpeciesEvolution(Species.LUNALA, 53, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.biomeType !== Biome.SPACE && !p.scene.arena.isDaytime()), null)
|
new SpeciesEvolution(Species.LUNALA, 53, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.biomeType !== Biome.SPACE && p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT), null)
|
||||||
],
|
],
|
||||||
[Species.MELTAN]: [
|
[Species.MELTAN]: [
|
||||||
new SpeciesEvolution(Species.MELMETAL, 48, null, null)
|
new SpeciesEvolution(Species.MELMETAL, 48, null, null)
|
||||||
],
|
],
|
||||||
[Species.ALOLA_RATTATA]: [
|
[Species.ALOLA_RATTATA]: [
|
||||||
new SpeciesEvolution(Species.ALOLA_RATICATE, 20, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.SHORT)
|
new SpeciesEvolution(Species.ALOLA_RATICATE, 20, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT), SpeciesWildEvolutionDelay.SHORT)
|
||||||
],
|
],
|
||||||
[Species.ALOLA_DIGLETT]: [
|
[Species.ALOLA_DIGLETT]: [
|
||||||
new SpeciesEvolution(Species.ALOLA_DUGTRIO, 26, null, null)
|
new SpeciesEvolution(Species.ALOLA_DUGTRIO, 26, null, null)
|
||||||
|
@ -1115,7 +1116,7 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
||||||
new SpeciesEvolution(Species.GALAR_LINOONE, 20, null, null)
|
new SpeciesEvolution(Species.GALAR_LINOONE, 20, null, null)
|
||||||
],
|
],
|
||||||
[Species.GALAR_LINOONE]: [
|
[Species.GALAR_LINOONE]: [
|
||||||
new SpeciesEvolution(Species.OBSTAGOON, 35, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.LONG)
|
new SpeciesEvolution(Species.OBSTAGOON, 35, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT), SpeciesWildEvolutionDelay.LONG)
|
||||||
],
|
],
|
||||||
[Species.GALAR_YAMASK]: [
|
[Species.GALAR_YAMASK]: [
|
||||||
new SpeciesEvolution(Species.RUNERIGUS, 34, null, null)
|
new SpeciesEvolution(Species.RUNERIGUS, 34, null, null)
|
||||||
|
@ -1215,7 +1216,7 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
||||||
new SpeciesEvolution(Species.GLIMMORA, 35, null, null)
|
new SpeciesEvolution(Species.GLIMMORA, 35, null, null)
|
||||||
],
|
],
|
||||||
[Species.GREAVARD]: [
|
[Species.GREAVARD]: [
|
||||||
new SpeciesEvolution(Species.HOUNDSTONE, 30, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.LONG)
|
new SpeciesEvolution(Species.HOUNDSTONE, 30, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT), SpeciesWildEvolutionDelay.LONG)
|
||||||
],
|
],
|
||||||
[Species.FRIGIBAX]: [
|
[Species.FRIGIBAX]: [
|
||||||
new SpeciesEvolution(Species.ARCTIBAX, 35, null, null)
|
new SpeciesEvolution(Species.ARCTIBAX, 35, null, null)
|
||||||
|
@ -1280,8 +1281,8 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
||||||
],
|
],
|
||||||
[Species.EEVEE]: [
|
[Species.EEVEE]: [
|
||||||
new SpeciesEvolution(Species.SYLVEON, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160 && !!p.getMoveset().find(m => m.getMove().type === Type.FAIRY)), SpeciesWildEvolutionDelay.MEDIUM),
|
new SpeciesEvolution(Species.SYLVEON, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160 && !!p.getMoveset().find(m => m.getMove().type === Type.FAIRY)), SpeciesWildEvolutionDelay.MEDIUM),
|
||||||
new SpeciesEvolution(Species.ESPEON, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160 && p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.MEDIUM),
|
new SpeciesEvolution(Species.ESPEON, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160 && p.scene.arena.getTimeOfDay() === TimeOfDay.DAY), SpeciesWildEvolutionDelay.MEDIUM),
|
||||||
new SpeciesEvolution(Species.UMBREON, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160 && !p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.MEDIUM),
|
new SpeciesEvolution(Species.UMBREON, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160 && p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT), SpeciesWildEvolutionDelay.MEDIUM),
|
||||||
new SpeciesEvolution(Species.VAPOREON, 1, EvolutionItem.WATER_STONE, null, SpeciesWildEvolutionDelay.MEDIUM),
|
new SpeciesEvolution(Species.VAPOREON, 1, EvolutionItem.WATER_STONE, null, SpeciesWildEvolutionDelay.MEDIUM),
|
||||||
new SpeciesEvolution(Species.JOLTEON, 1, EvolutionItem.THUNDER_STONE, null, SpeciesWildEvolutionDelay.MEDIUM),
|
new SpeciesEvolution(Species.JOLTEON, 1, EvolutionItem.THUNDER_STONE, null, SpeciesWildEvolutionDelay.MEDIUM),
|
||||||
new SpeciesEvolution(Species.FLAREON, 1, EvolutionItem.FIRE_STONE, null, SpeciesWildEvolutionDelay.MEDIUM),
|
new SpeciesEvolution(Species.FLAREON, 1, EvolutionItem.FIRE_STONE, null, SpeciesWildEvolutionDelay.MEDIUM),
|
||||||
|
@ -1319,13 +1320,13 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
||||||
new SpeciesEvolution(Species.DUDUNSPARCE, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.HYPER_DRILL).length > 0), SpeciesWildEvolutionDelay.VERY_LONG)
|
new SpeciesEvolution(Species.DUDUNSPARCE, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.HYPER_DRILL).length > 0), SpeciesWildEvolutionDelay.VERY_LONG)
|
||||||
],
|
],
|
||||||
[Species.GLIGAR]: [
|
[Species.GLIGAR]: [
|
||||||
new SpeciesEvolution(Species.GLISCOR, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.scene.arena.isDaytime() /* Razor fang at night*/), SpeciesWildEvolutionDelay.LONG)
|
new SpeciesEvolution(Species.GLISCOR, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT /* Razor fang at night*/), SpeciesWildEvolutionDelay.LONG)
|
||||||
],
|
],
|
||||||
[Species.SNEASEL]: [
|
[Species.SNEASEL]: [
|
||||||
new SpeciesEvolution(Species.WEAVILE, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.scene.arena.isDaytime() /* Razor claw at night*/), SpeciesWildEvolutionDelay.LONG)
|
new SpeciesEvolution(Species.WEAVILE, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT /* Razor claw at night*/), SpeciesWildEvolutionDelay.LONG)
|
||||||
],
|
],
|
||||||
[Species.URSARING]: [
|
[Species.URSARING]: [
|
||||||
new SpeciesEvolution(Species.URSALUNA, 1, EvolutionItem.MOON_STONE, new SpeciesEvolutionCondition((p: Pokemon) => !p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.VERY_LONG) //Ursaring does not evolve into Bloodmoon Ursaluna
|
new SpeciesEvolution(Species.URSALUNA, 1, EvolutionItem.MOON_STONE, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT), SpeciesWildEvolutionDelay.VERY_LONG) //Ursaring does not evolve into Bloodmoon Ursaluna
|
||||||
],
|
],
|
||||||
[Species.PILOSWINE]: [
|
[Species.PILOSWINE]: [
|
||||||
new SpeciesEvolution(Species.MAMOSWINE, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.ANCIENT_POWER).length > 0), SpeciesWildEvolutionDelay.VERY_LONG)
|
new SpeciesEvolution(Species.MAMOSWINE, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.ANCIENT_POWER).length > 0), SpeciesWildEvolutionDelay.VERY_LONG)
|
||||||
|
@ -1406,9 +1407,9 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
||||||
new SpeciesEvolution(Species.CRABOMINABLE, 1, EvolutionItem.ICE_STONE, null)
|
new SpeciesEvolution(Species.CRABOMINABLE, 1, EvolutionItem.ICE_STONE, null)
|
||||||
],
|
],
|
||||||
[Species.ROCKRUFF]: [
|
[Species.ROCKRUFF]: [
|
||||||
new SpeciesFormEvolution(Species.LYCANROC, '', 'midday', 25, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.isDaytime()), null),
|
new SpeciesFormEvolution(Species.LYCANROC, '', 'midday', 25, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.getTimeOfDay() === TimeOfDay.DAY), null),
|
||||||
new SpeciesFormEvolution(Species.LYCANROC, '', 'dusk', 25, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.getSpeciesFormIndex(p.species) === 2), null),
|
new SpeciesFormEvolution(Species.LYCANROC, '', 'dusk', 25, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.getSpeciesFormIndex(p.species) === 2), null),
|
||||||
new SpeciesFormEvolution(Species.LYCANROC, '', 'midnight', 25, null, new SpeciesEvolutionCondition((p: Pokemon) => !p.scene.arena.isDaytime()), null)
|
new SpeciesFormEvolution(Species.LYCANROC, '', 'midnight', 25, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT), null)
|
||||||
],
|
],
|
||||||
[Species.STEENEE]: [
|
[Species.STEENEE]: [
|
||||||
new SpeciesEvolution(Species.TSAREENA, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.STOMP).length > 0), SpeciesWildEvolutionDelay.LONG)
|
new SpeciesEvolution(Species.TSAREENA, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.STOMP).length > 0), SpeciesWildEvolutionDelay.LONG)
|
||||||
|
@ -1424,8 +1425,8 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
||||||
],
|
],
|
||||||
[Species.APPLIN]: [
|
[Species.APPLIN]: [
|
||||||
new SpeciesEvolution(Species.DIPPLIN, 1, EvolutionItem.LEAF_STONE, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.biomeType === Biome.ISLAND), SpeciesWildEvolutionDelay.LONG),
|
new SpeciesEvolution(Species.DIPPLIN, 1, EvolutionItem.LEAF_STONE, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.biomeType === Biome.ISLAND), SpeciesWildEvolutionDelay.LONG),
|
||||||
new SpeciesEvolution(Species.FLAPPLE, 1, EvolutionItem.LEAF_STONE, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.LONG),
|
new SpeciesEvolution(Species.FLAPPLE, 1, EvolutionItem.LEAF_STONE, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.getTimeOfDay() === TimeOfDay.DAY), SpeciesWildEvolutionDelay.LONG),
|
||||||
new SpeciesEvolution(Species.APPLETUN, 1, EvolutionItem.LEAF_STONE, new SpeciesEvolutionCondition((p: Pokemon) => !p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.LONG)
|
new SpeciesEvolution(Species.APPLETUN, 1, EvolutionItem.LEAF_STONE, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT), SpeciesWildEvolutionDelay.LONG)
|
||||||
],
|
],
|
||||||
[Species.CLOBBOPUS]: [
|
[Species.CLOBBOPUS]: [
|
||||||
new SpeciesEvolution(Species.GRAPPLOCT, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.TAUNT).length > 0), SpeciesWildEvolutionDelay.MEDIUM)
|
new SpeciesEvolution(Species.GRAPPLOCT, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.TAUNT).length > 0), SpeciesWildEvolutionDelay.MEDIUM)
|
||||||
|
@ -1455,7 +1456,7 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
||||||
new SpeciesEvolution(Species.OVERQWIL, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.BARB_BARRAGE).length > 0), SpeciesWildEvolutionDelay.LONG)
|
new SpeciesEvolution(Species.OVERQWIL, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.moveset.filter(m => m.moveId === Moves.BARB_BARRAGE).length > 0), SpeciesWildEvolutionDelay.LONG)
|
||||||
],
|
],
|
||||||
[Species.HISUI_SNEASEL]: [
|
[Species.HISUI_SNEASEL]: [
|
||||||
new SpeciesEvolution(Species.SNEASLER, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.isDaytime() /* Razor claw at day*/), SpeciesWildEvolutionDelay.LONG)
|
new SpeciesEvolution(Species.SNEASLER, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.scene.arena.getTimeOfDay() === TimeOfDay.DAY /* Razor claw at day*/), SpeciesWildEvolutionDelay.LONG)
|
||||||
],
|
],
|
||||||
[Species.CHARCADET]: [
|
[Species.CHARCADET]: [
|
||||||
new SpeciesEvolution(Species.ARMAROUGE, 1, EvolutionItem.FIRE_STONE, null, SpeciesWildEvolutionDelay.LONG),
|
new SpeciesEvolution(Species.ARMAROUGE, 1, EvolutionItem.FIRE_STONE, null, SpeciesWildEvolutionDelay.LONG),
|
||||||
|
@ -1582,10 +1583,10 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
||||||
new SpeciesEvolution(Species.MARILL, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160), SpeciesWildEvolutionDelay.SHORT)
|
new SpeciesEvolution(Species.MARILL, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160), SpeciesWildEvolutionDelay.SHORT)
|
||||||
],
|
],
|
||||||
[Species.BUDEW]: [
|
[Species.BUDEW]: [
|
||||||
new SpeciesEvolution(Species.ROSELIA, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160 && p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.SHORT)
|
new SpeciesEvolution(Species.ROSELIA, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160 && p.scene.arena.getTimeOfDay() === TimeOfDay.DAY), SpeciesWildEvolutionDelay.SHORT)
|
||||||
],
|
],
|
||||||
[Species.CHINGLING]: [
|
[Species.CHINGLING]: [
|
||||||
new SpeciesEvolution(Species.CHIMECHO, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160 && !p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.MEDIUM)
|
new SpeciesEvolution(Species.CHIMECHO, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160 && p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT), SpeciesWildEvolutionDelay.MEDIUM)
|
||||||
],
|
],
|
||||||
[Species.BUNEARY]: [
|
[Species.BUNEARY]: [
|
||||||
new SpeciesEvolution(Species.LOPUNNY, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160), SpeciesWildEvolutionDelay.MEDIUM)
|
new SpeciesEvolution(Species.LOPUNNY, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160), SpeciesWildEvolutionDelay.MEDIUM)
|
||||||
|
@ -1594,7 +1595,7 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
||||||
new SpeciesEvolution(Species.CHANSEY, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160), SpeciesWildEvolutionDelay.SHORT)
|
new SpeciesEvolution(Species.CHANSEY, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160), SpeciesWildEvolutionDelay.SHORT)
|
||||||
],
|
],
|
||||||
[Species.RIOLU]: [
|
[Species.RIOLU]: [
|
||||||
new SpeciesEvolution(Species.LUCARIO, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160 && p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.MEDIUM)
|
new SpeciesEvolution(Species.LUCARIO, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160 && p.scene.arena.getTimeOfDay() === TimeOfDay.DAY), SpeciesWildEvolutionDelay.MEDIUM)
|
||||||
],
|
],
|
||||||
[Species.WOOBAT]: [
|
[Species.WOOBAT]: [
|
||||||
new SpeciesEvolution(Species.SWOOBAT, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160), SpeciesWildEvolutionDelay.MEDIUM)
|
new SpeciesEvolution(Species.SWOOBAT, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160), SpeciesWildEvolutionDelay.MEDIUM)
|
||||||
|
@ -1612,7 +1613,7 @@ export const pokemonEvolutions: PokemonEvolutions = {
|
||||||
new SpeciesEvolution(Species.ALCREMIE, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160), SpeciesWildEvolutionDelay.MEDIUM)
|
new SpeciesEvolution(Species.ALCREMIE, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160), SpeciesWildEvolutionDelay.MEDIUM)
|
||||||
],
|
],
|
||||||
[Species.SNOM]: [
|
[Species.SNOM]: [
|
||||||
new SpeciesEvolution(Species.FROSMOTH, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160 && !p.scene.arena.isDaytime()), SpeciesWildEvolutionDelay.MEDIUM)
|
new SpeciesEvolution(Species.FROSMOTH, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160 && p.scene.arena.getTimeOfDay() === TimeOfDay.NIGHT), SpeciesWildEvolutionDelay.MEDIUM)
|
||||||
],
|
],
|
||||||
[Species.GIMMIGHOUL]: [
|
[Species.GIMMIGHOUL]: [
|
||||||
new SpeciesEvolution(Species.GHOLDENGO, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160), SpeciesWildEvolutionDelay.VERY_LONG)
|
new SpeciesEvolution(Species.GHOLDENGO, 1, null, new SpeciesEvolutionCondition((p: Pokemon) => p.friendship >= 160), SpeciesWildEvolutionDelay.VERY_LONG)
|
||||||
|
|
|
@ -197,21 +197,24 @@ interface WeatherPoolEntry {
|
||||||
weight: integer;
|
weight: integer;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getRandomWeatherType(biome: Biome): WeatherType {
|
export function getRandomWeatherType(arena: any /* Importing from arena causes a circular dependency */): WeatherType {
|
||||||
let weatherPool: WeatherPoolEntry[] = [];
|
let weatherPool: WeatherPoolEntry[] = [];
|
||||||
switch (biome) {
|
const hasSun = arena.getTimeOfDay() < 2;
|
||||||
|
switch (arena.biomeType) {
|
||||||
case Biome.GRASS:
|
case Biome.GRASS:
|
||||||
weatherPool = [
|
weatherPool = [
|
||||||
{ weatherType: WeatherType.NONE, weight: 7 },
|
{ weatherType: WeatherType.NONE, weight: 7 }
|
||||||
{ weatherType: WeatherType.SUNNY, weight: 3 }
|
|
||||||
];
|
];
|
||||||
|
if (hasSun)
|
||||||
|
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 3 });
|
||||||
break;
|
break;
|
||||||
case Biome.TALL_GRASS:
|
case Biome.TALL_GRASS:
|
||||||
weatherPool = [
|
weatherPool = [
|
||||||
{ weatherType: WeatherType.SUNNY, weight: 8 },
|
|
||||||
{ weatherType: WeatherType.RAIN, weight: 5 },
|
{ weatherType: WeatherType.RAIN, weight: 5 },
|
||||||
{ weatherType: WeatherType.FOG, weight: 2 }
|
{ weatherType: WeatherType.FOG, weight: 2 }
|
||||||
];
|
];
|
||||||
|
if (hasSun)
|
||||||
|
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 8 });
|
||||||
break;
|
break;
|
||||||
case Biome.FOREST:
|
case Biome.FOREST:
|
||||||
weatherPool = [
|
weatherPool = [
|
||||||
|
@ -235,9 +238,10 @@ export function getRandomWeatherType(biome: Biome): WeatherType {
|
||||||
case Biome.BEACH:
|
case Biome.BEACH:
|
||||||
weatherPool = [
|
weatherPool = [
|
||||||
{ weatherType: WeatherType.NONE, weight: 8 },
|
{ weatherType: WeatherType.NONE, weight: 8 },
|
||||||
{ weatherType: WeatherType.SUNNY, weight: 5 },
|
|
||||||
{ weatherType: WeatherType.RAIN, weight: 3 }
|
{ weatherType: WeatherType.RAIN, weight: 3 }
|
||||||
];
|
];
|
||||||
|
if (hasSun)
|
||||||
|
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 5 });
|
||||||
break;
|
break;
|
||||||
case Biome.LAKE:
|
case Biome.LAKE:
|
||||||
weatherPool = [
|
weatherPool = [
|
||||||
|
@ -259,15 +263,17 @@ export function getRandomWeatherType(biome: Biome): WeatherType {
|
||||||
case Biome.BADLANDS:
|
case Biome.BADLANDS:
|
||||||
weatherPool = [
|
weatherPool = [
|
||||||
{ weatherType: WeatherType.NONE, weight: 8 },
|
{ weatherType: WeatherType.NONE, weight: 8 },
|
||||||
{ weatherType: WeatherType.SUNNY, weight: 5 },
|
|
||||||
{ weatherType: WeatherType.SANDSTORM, weight: 2 }
|
{ weatherType: WeatherType.SANDSTORM, weight: 2 }
|
||||||
];
|
];
|
||||||
|
if (hasSun)
|
||||||
|
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 5 });
|
||||||
break;
|
break;
|
||||||
case Biome.DESERT:
|
case Biome.DESERT:
|
||||||
weatherPool = [
|
weatherPool = [
|
||||||
{ weatherType: WeatherType.SANDSTORM, weight: 2 },
|
{ weatherType: WeatherType.SANDSTORM, weight: 2 }
|
||||||
{ weatherType: WeatherType.SUNNY, weight: 1 }
|
|
||||||
];
|
];
|
||||||
|
if (hasSun)
|
||||||
|
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 2 });
|
||||||
break;
|
break;
|
||||||
case Biome.ICE_CAVE:
|
case Biome.ICE_CAVE:
|
||||||
weatherPool = [
|
weatherPool = [
|
||||||
|
@ -276,11 +282,13 @@ export function getRandomWeatherType(biome: Biome): WeatherType {
|
||||||
break;
|
break;
|
||||||
case Biome.MEADOW:
|
case Biome.MEADOW:
|
||||||
weatherPool = [
|
weatherPool = [
|
||||||
{ weatherType: WeatherType.SUNNY, weight: 1 }
|
{ weatherType: WeatherType.NONE, weight: 2 }
|
||||||
];
|
];
|
||||||
|
if (hasSun)
|
||||||
|
weatherPool.push({ weatherType: WeatherType.SUNNY, weight: 2 });
|
||||||
case Biome.VOLCANO:
|
case Biome.VOLCANO:
|
||||||
weatherPool = [
|
weatherPool = [
|
||||||
{ weatherType: WeatherType.SUNNY, weight: 1 }
|
{ weatherType: hasSun ? WeatherType.SUNNY : WeatherType.NONE, weight: 1 }
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case Biome.GRAVEYARD:
|
case Biome.GRAVEYARD:
|
||||||
|
|
|
@ -61,7 +61,7 @@ export class EvolutionPhase extends BattlePhase {
|
||||||
this.evolutionBgOverlay.setAlpha(0);
|
this.evolutionBgOverlay.setAlpha(0);
|
||||||
this.evolutionContainer.add(this.evolutionBgOverlay);
|
this.evolutionContainer.add(this.evolutionBgOverlay);
|
||||||
|
|
||||||
const getPokemonSprite = () => this.scene.add.sprite(this.evolutionBaseBg.displayWidth / 2, this.evolutionBaseBg.displayHeight / 2, `pkmn__sub`);
|
const getPokemonSprite = () => this.scene.addFieldSprite(this.evolutionBaseBg.displayWidth / 2, this.evolutionBaseBg.displayHeight / 2, `pkmn__sub`);
|
||||||
|
|
||||||
this.evolutionContainer.add((this.pokemonSprite = getPokemonSprite()));
|
this.evolutionContainer.add((this.pokemonSprite = getPokemonSprite()));
|
||||||
this.evolutionContainer.add((this.pokemonTintSprite = getPokemonSprite()));
|
this.evolutionContainer.add((this.pokemonTintSprite = getPokemonSprite()));
|
||||||
|
|
|
@ -0,0 +1,149 @@
|
||||||
|
import BattleScene from "../battle-scene";
|
||||||
|
import * as Utils from "../utils";
|
||||||
|
|
||||||
|
const spriteFragShader = `
|
||||||
|
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||||
|
precision highp float;
|
||||||
|
#else
|
||||||
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uniform sampler2D uMainSampler[%count%];
|
||||||
|
|
||||||
|
varying vec2 outTexCoord;
|
||||||
|
varying float outTexId;
|
||||||
|
varying float outTintEffect;
|
||||||
|
varying vec4 outTint;
|
||||||
|
|
||||||
|
uniform float time;
|
||||||
|
uniform int isOutside;
|
||||||
|
uniform vec3 dayTint;
|
||||||
|
uniform vec3 duskTint;
|
||||||
|
uniform vec3 nightTint;
|
||||||
|
|
||||||
|
float blendOverlay(float base, float blend) {
|
||||||
|
return base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend));
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 blendOverlay(vec3 base, vec3 blend) {
|
||||||
|
return vec3(blendOverlay(base.r,blend.r),blendOverlay(base.g,blend.g),blendOverlay(base.b,blend.b));
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 blendHardLight(vec3 base, vec3 blend) {
|
||||||
|
return blendOverlay(blend, base);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
vec4 texture;
|
||||||
|
|
||||||
|
%forloop%
|
||||||
|
|
||||||
|
vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);
|
||||||
|
|
||||||
|
// Multiply texture tint
|
||||||
|
vec4 color = texture * texel;
|
||||||
|
|
||||||
|
if (outTintEffect == 1.0) {
|
||||||
|
// Solid color + texture alpha
|
||||||
|
color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);
|
||||||
|
} else if (outTintEffect == 2.0) {
|
||||||
|
// Solid color, no texture
|
||||||
|
color = texel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Apply day/night tint */
|
||||||
|
if (color.a > 0.0) {
|
||||||
|
vec3 dayNightTint;
|
||||||
|
|
||||||
|
if (time < 0.25) {
|
||||||
|
dayNightTint = dayTint;
|
||||||
|
} else if (isOutside == 0 && time < 0.5) {
|
||||||
|
dayNightTint = mix(dayTint, nightTint, (time - 0.25) / 0.25);
|
||||||
|
} else if (time < 0.375) {
|
||||||
|
dayNightTint = mix(dayTint, duskTint, (time - 0.25) / 0.125);
|
||||||
|
} else if (time < 0.5) {
|
||||||
|
dayNightTint = mix(duskTint, nightTint, (time - 0.375) / 0.125);
|
||||||
|
} else if (time < 0.75) {
|
||||||
|
dayNightTint = nightTint;
|
||||||
|
} else if (isOutside == 0) {
|
||||||
|
dayNightTint = mix(nightTint, dayTint, (time - 0.75) / 0.25);
|
||||||
|
} else if (time < 0.875) {
|
||||||
|
dayNightTint = mix(nightTint, duskTint, (time - 0.75) / 0.125);
|
||||||
|
} else {
|
||||||
|
dayNightTint = mix(duskTint, dayTint, (time - 0.875) / 0.125);
|
||||||
|
}
|
||||||
|
|
||||||
|
color = vec4(blendHardLight(color.rgb, dayNightTint), color.a);
|
||||||
|
}
|
||||||
|
|
||||||
|
gl_FragColor = color;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const spriteVertShader = `
|
||||||
|
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||||
|
precision highp float;
|
||||||
|
#else
|
||||||
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uniform mat4 uProjectionMatrix;
|
||||||
|
|
||||||
|
attribute vec2 inPosition;
|
||||||
|
attribute vec2 inTexCoord;
|
||||||
|
attribute float inTexId;
|
||||||
|
attribute float inTintEffect;
|
||||||
|
attribute vec4 inTint;
|
||||||
|
|
||||||
|
varying vec2 outTexCoord;
|
||||||
|
varying float outTexId;
|
||||||
|
varying float outTintEffect;
|
||||||
|
varying vec4 outTint;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_Position = uProjectionMatrix * vec4(inPosition, 1.0, 1.0);
|
||||||
|
|
||||||
|
outTexCoord = inTexCoord;
|
||||||
|
outTexId = inTexId;
|
||||||
|
outTint = inTint;
|
||||||
|
outTintEffect = inTintEffect;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default class FieldSpritePipeline extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline {
|
||||||
|
constructor(game: Phaser.Game, config?: Phaser.Types.Renderer.WebGL.WebGLPipelineConfig) {
|
||||||
|
super(config || {
|
||||||
|
game: game,
|
||||||
|
name: 'field-sprite',
|
||||||
|
fragShader: spriteFragShader,
|
||||||
|
vertShader: spriteVertShader
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onPreRender(): void {
|
||||||
|
this.set1f('time', 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
onBind(gameObject: Phaser.GameObjects.GameObject): void {
|
||||||
|
super.onBind();
|
||||||
|
|
||||||
|
const sprite = (gameObject as Phaser.GameObjects.Sprite);
|
||||||
|
const scene = sprite.scene as BattleScene;
|
||||||
|
|
||||||
|
let time = scene.currentBattle?.waveIndex
|
||||||
|
? ((scene.currentBattle.waveIndex + scene.getWaveCycleOffset()) % 40) / 40 // ((new Date().getSeconds() * 1000 + new Date().getMilliseconds()) % 10000) / 10000
|
||||||
|
: Utils.getCurrentTime();
|
||||||
|
this.set1f('time', time);
|
||||||
|
this.set1i('isOutside', scene.arena.isOutside() ? 1 : 0);
|
||||||
|
this.set3fv('dayTint', scene.arena.getDayTint().map(c => c / 255));
|
||||||
|
this.set3fv('duskTint', scene.arena.getDuskTint().map(c => c / 255));
|
||||||
|
this.set3fv('nightTint', scene.arena.getNightTint().map(c => c / 255));
|
||||||
|
}
|
||||||
|
|
||||||
|
onBatch(gameObject: Phaser.GameObjects.GameObject): void {
|
||||||
|
if (gameObject)
|
||||||
|
this.flush();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
import Pokemon from "../pokemon";
|
import Pokemon from "../pokemon";
|
||||||
import Trainer from "../trainer";
|
import Trainer from "../trainer";
|
||||||
|
import FieldSpritePipeline from "./field-sprite";
|
||||||
|
|
||||||
const spriteFragShader = `
|
const spriteFragShader = `
|
||||||
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||||||
|
@ -16,6 +17,11 @@ varying vec2 outPosition;
|
||||||
varying float outTintEffect;
|
varying float outTintEffect;
|
||||||
varying vec4 outTint;
|
varying vec4 outTint;
|
||||||
|
|
||||||
|
uniform float time;
|
||||||
|
uniform int isOutside;
|
||||||
|
uniform vec3 dayTint;
|
||||||
|
uniform vec3 duskTint;
|
||||||
|
uniform vec3 nightTint;
|
||||||
uniform int hasShadow;
|
uniform int hasShadow;
|
||||||
uniform int yCenter;
|
uniform int yCenter;
|
||||||
uniform float vCutoff;
|
uniform float vCutoff;
|
||||||
|
@ -28,6 +34,18 @@ uniform ivec4 fusionSpriteColors[32];
|
||||||
|
|
||||||
const vec3 lumaF = vec3(.299, .587, .114);
|
const vec3 lumaF = vec3(.299, .587, .114);
|
||||||
|
|
||||||
|
float blendOverlay(float base, float blend) {
|
||||||
|
return base<0.5?(2.0*base*blend):(1.0-2.0*(1.0-base)*(1.0-blend));
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 blendOverlay(vec3 base, vec3 blend) {
|
||||||
|
return vec3(blendOverlay(base.r,blend.r),blendOverlay(base.g,blend.g),blendOverlay(base.b,blend.b));
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 blendHardLight(vec3 base, vec3 blend) {
|
||||||
|
return blendOverlay(blend, base);
|
||||||
|
}
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 texture;
|
vec4 texture;
|
||||||
|
@ -68,6 +86,31 @@ void main()
|
||||||
/* Apply tone */
|
/* Apply tone */
|
||||||
color.rgb += tone.rgb * (color.a / 255.0);
|
color.rgb += tone.rgb * (color.a / 255.0);
|
||||||
|
|
||||||
|
/* Apply day/night tint */
|
||||||
|
if (color.a > 0.0) {
|
||||||
|
vec3 dayNightTint;
|
||||||
|
|
||||||
|
if (time < 0.25) {
|
||||||
|
dayNightTint = dayTint;
|
||||||
|
} else if (isOutside == 0 && time < 0.5) {
|
||||||
|
dayNightTint = mix(dayTint, nightTint, (time - 0.25) / 0.25);
|
||||||
|
} else if (time < 0.375) {
|
||||||
|
dayNightTint = mix(dayTint, duskTint, (time - 0.25) / 0.125);
|
||||||
|
} else if (time < 0.5) {
|
||||||
|
dayNightTint = mix(duskTint, nightTint, (time - 0.375) / 0.125);
|
||||||
|
} else if (time < 0.75) {
|
||||||
|
dayNightTint = nightTint;
|
||||||
|
} else if (isOutside == 0) {
|
||||||
|
dayNightTint = mix(nightTint, dayTint, (time - 0.75) / 0.25);
|
||||||
|
} else if (time < 0.875) {
|
||||||
|
dayNightTint = mix(nightTint, duskTint, (time - 0.75) / 0.125);
|
||||||
|
} else {
|
||||||
|
dayNightTint = mix(duskTint, dayTint, (time - 0.875) / 0.125);
|
||||||
|
}
|
||||||
|
|
||||||
|
color = vec4(blendHardLight(color.rgb, dayNightTint), color.a);
|
||||||
|
}
|
||||||
|
|
||||||
if (hasShadow == 1) {
|
if (hasShadow == 1) {
|
||||||
float width = size.x - (yOffset / 2.0);
|
float width = size.x - (yOffset / 2.0);
|
||||||
|
|
||||||
|
@ -131,11 +174,11 @@ void main()
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export default class SpritePipeline extends Phaser.Renderer.WebGL.Pipelines.MultiPipeline {
|
export default class SpritePipeline extends FieldSpritePipeline {
|
||||||
private _tone: number[];
|
private _tone: number[];
|
||||||
|
|
||||||
constructor(game: Phaser.Game) {
|
constructor(game: Phaser.Game) {
|
||||||
super({
|
super(game, {
|
||||||
game: game,
|
game: game,
|
||||||
name: 'sprite',
|
name: 'sprite',
|
||||||
fragShader: spriteFragShader,
|
fragShader: spriteFragShader,
|
||||||
|
@ -146,6 +189,8 @@ export default class SpritePipeline extends Phaser.Renderer.WebGL.Pipelines.Mult
|
||||||
}
|
}
|
||||||
|
|
||||||
onPreRender(): void {
|
onPreRender(): void {
|
||||||
|
super.onPreRender();
|
||||||
|
|
||||||
this.set1i('hasShadow', 0);
|
this.set1i('hasShadow', 0);
|
||||||
this.set1i('yCenter', 0);
|
this.set1i('yCenter', 0);
|
||||||
this.set2f('relPosition', 0, 0);
|
this.set2f('relPosition', 0, 0);
|
||||||
|
@ -155,7 +200,7 @@ export default class SpritePipeline extends Phaser.Renderer.WebGL.Pipelines.Mult
|
||||||
}
|
}
|
||||||
|
|
||||||
onBind(gameObject: Phaser.GameObjects.GameObject): void {
|
onBind(gameObject: Phaser.GameObjects.GameObject): void {
|
||||||
super.onBind();
|
super.onBind(gameObject);
|
||||||
|
|
||||||
const sprite = (gameObject as Phaser.GameObjects.Sprite);
|
const sprite = (gameObject as Phaser.GameObjects.Sprite);
|
||||||
|
|
||||||
|
@ -188,11 +233,6 @@ export default class SpritePipeline extends Phaser.Renderer.WebGL.Pipelines.Mult
|
||||||
this.set4iv(`fusionSpriteColors`, flatFusionSpriteColors.flat());
|
this.set4iv(`fusionSpriteColors`, flatFusionSpriteColors.flat());
|
||||||
}
|
}
|
||||||
|
|
||||||
onBatch(gameObject: Phaser.GameObjects.GameObject): void {
|
|
||||||
if (gameObject)
|
|
||||||
this.flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
batchQuad(gameObject: Phaser.GameObjects.GameObject, x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number,
|
batchQuad(gameObject: Phaser.GameObjects.GameObject, x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number,
|
||||||
u0: number, v0: number, u1: number, v1: number, tintTL: number, tintTR: number, tintBL: number, tintBR: number, tintEffect: number | boolean,
|
u0: number, v0: number, u1: number, v1: number, tintTL: number, tintTR: number, tintBL: number, tintBR: number, tintEffect: number | boolean,
|
||||||
texture?: WebGLTexture, unit?: number): boolean {
|
texture?: WebGLTexture, unit?: number): boolean {
|
||||||
|
|
|
@ -183,7 +183,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
this.battleInfo.initInfo(this);
|
this.battleInfo.initInfo(this);
|
||||||
|
|
||||||
const getSprite = (hasShadow?: boolean) => {
|
const getSprite = (hasShadow?: boolean) => {
|
||||||
const ret = this.scene.add.sprite(0, 0, `pkmn__${this.isPlayer() ? 'back__' : ''}sub`);
|
const ret = this.scene.addFieldSprite(0, 0, `pkmn__${this.isPlayer() ? 'back__' : ''}sub`);
|
||||||
ret.setOrigin(0.5, 1);
|
ret.setOrigin(0.5, 1);
|
||||||
ret.setPipeline(this.scene.spritePipeline, { tone: [ 0.0, 0.0, 0.0, 0.0 ], hasShadow: !!hasShadow });
|
ret.setPipeline(this.scene.spritePipeline, { tone: [ 0.0, 0.0, 0.0, 0.0 ], hasShadow: !!hasShadow });
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -375,7 +375,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
initShinySparkle(): void {
|
initShinySparkle(): void {
|
||||||
const shinySparkle = this.scene.add.sprite(0, 0, 'shiny');
|
const shinySparkle = this.scene.addFieldSprite(0, 0, 'shiny');
|
||||||
shinySparkle.setVisible(false);
|
shinySparkle.setVisible(false);
|
||||||
shinySparkle.setOrigin(0.5, 1);
|
shinySparkle.setOrigin(0.5, 1);
|
||||||
const frameNames = this.scene.anims.generateFrameNames('shiny', { suffix: '.png', end: 34 });
|
const frameNames = this.scene.anims.generateFrameNames('shiny', { suffix: '.png', end: 34 });
|
||||||
|
@ -721,10 +721,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
|
|
||||||
let shinyThreshold = new Utils.IntegerHolder(32);
|
let shinyThreshold = new Utils.IntegerHolder(32);
|
||||||
if (thresholdOverride === undefined) {
|
if (thresholdOverride === undefined) {
|
||||||
if (!this.hasTrainer()) {
|
if (!this.hasTrainer())
|
||||||
this.scene.applyModifiers(ShinyRateBoosterModifier, true, shinyThreshold);
|
this.scene.applyModifiers(ShinyRateBoosterModifier, true, shinyThreshold);
|
||||||
console.log(shinyThreshold.value, 'SHINY THRESHOLD');
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
shinyThreshold.value = thresholdOverride;
|
shinyThreshold.value = thresholdOverride;
|
||||||
|
|
||||||
|
|
|
@ -427,7 +427,6 @@ export class GameData {
|
||||||
public exportData(dataType: GameDataType): void {
|
public exportData(dataType: GameDataType): void {
|
||||||
const dataKey: string = getDataTypeKey(dataType);
|
const dataKey: string = getDataTypeKey(dataType);
|
||||||
const dataStr = atob(localStorage.getItem(dataKey));
|
const dataStr = atob(localStorage.getItem(dataKey));
|
||||||
console.log(dataStr);
|
|
||||||
const encryptedData = AES.encrypt(dataStr, saveKey);
|
const encryptedData = AES.encrypt(dataStr, saveKey);
|
||||||
const blob = new Blob([ encryptedData.toString() ], {type: 'text/json'});
|
const blob = new Blob([ encryptedData.toString() ], {type: 'text/json'});
|
||||||
const link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
|
|
|
@ -26,7 +26,7 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
||||||
console.log(Object.keys(trainerPartyTemplates)[Object.values(trainerPartyTemplates).indexOf(this.getPartyTemplate())]);
|
console.log(Object.keys(trainerPartyTemplates)[Object.values(trainerPartyTemplates).indexOf(this.getPartyTemplate())]);
|
||||||
|
|
||||||
const getSprite = (hasShadow?: boolean) => {
|
const getSprite = (hasShadow?: boolean) => {
|
||||||
const ret = this.scene.add.sprite(0, 0, this.getKey());
|
const ret = this.scene.addFieldSprite(0, 0, this.getKey());
|
||||||
ret.setOrigin(0.5, 1);
|
ret.setOrigin(0.5, 1);
|
||||||
ret.setPipeline(this.scene.spritePipeline, { tone: [ 0.0, 0.0, 0.0, 0.0 ], hasShadow: !!hasShadow });
|
ret.setPipeline(this.scene.spritePipeline, { tone: [ 0.0, 0.0, 0.0, 0.0 ], hasShadow: !!hasShadow });
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -87,6 +87,11 @@ export function getFrameMs(frameCount: integer): integer {
|
||||||
return Math.floor((1 / 60) * 1000 * frameCount);
|
return Math.floor((1 / 60) * 1000 * frameCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getCurrentTime(): number {
|
||||||
|
const date = new Date();
|
||||||
|
return (((date.getHours() * 60 + date.getMinutes()) / 1440) + 0.675) % 1;
|
||||||
|
}
|
||||||
|
|
||||||
export function binToDec(input: string): integer {
|
export function binToDec(input: string): integer {
|
||||||
let place: integer[] = [];
|
let place: integer[] = [];
|
||||||
let binary: string[] = [];
|
let binary: string[] = [];
|
||||||
|
|
Loading…
Reference in New Issue