Add Pokeball release animations and Fairy Feather item
This commit is contained in:
parent
f342ea8e67
commit
9037562c5c
|
@ -0,0 +1,209 @@
|
||||||
|
{
|
||||||
|
"textures": [
|
||||||
|
{
|
||||||
|
"image": "pb_particles.png",
|
||||||
|
"format": "RGBA8888",
|
||||||
|
"size": {
|
||||||
|
"w": 66,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"scale": 1,
|
||||||
|
"frames": [
|
||||||
|
{
|
||||||
|
"filename": "0.png",
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": false,
|
||||||
|
"sourceSize": {
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"spriteSourceSize": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"frame": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "1.png",
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": true,
|
||||||
|
"sourceSize": {
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"spriteSourceSize": {
|
||||||
|
"x": 2,
|
||||||
|
"y": 0,
|
||||||
|
"w": 4,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"frame": {
|
||||||
|
"x": 8,
|
||||||
|
"y": 0,
|
||||||
|
"w": 4,
|
||||||
|
"h": 8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "2.png",
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": false,
|
||||||
|
"sourceSize": {
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"spriteSourceSize": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"frame": {
|
||||||
|
"x": 12,
|
||||||
|
"y": 0,
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "3.png",
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": true,
|
||||||
|
"sourceSize": {
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"spriteSourceSize": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 2,
|
||||||
|
"w": 8,
|
||||||
|
"h": 4
|
||||||
|
},
|
||||||
|
"frame": {
|
||||||
|
"x": 20,
|
||||||
|
"y": 0,
|
||||||
|
"w": 8,
|
||||||
|
"h": 4
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "4.png",
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": false,
|
||||||
|
"sourceSize": {
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"spriteSourceSize": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"frame": {
|
||||||
|
"x": 28,
|
||||||
|
"y": 0,
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "5.png",
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": false,
|
||||||
|
"sourceSize": {
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"spriteSourceSize": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"frame": {
|
||||||
|
"x": 36,
|
||||||
|
"y": 0,
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "6.png",
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": false,
|
||||||
|
"sourceSize": {
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"spriteSourceSize": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"frame": {
|
||||||
|
"x": 44,
|
||||||
|
"y": 0,
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "7.png",
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": false,
|
||||||
|
"sourceSize": {
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"spriteSourceSize": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"frame": {
|
||||||
|
"x": 52,
|
||||||
|
"y": 0,
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "8.png",
|
||||||
|
"rotated": false,
|
||||||
|
"trimmed": true,
|
||||||
|
"sourceSize": {
|
||||||
|
"w": 8,
|
||||||
|
"h": 8
|
||||||
|
},
|
||||||
|
"spriteSourceSize": {
|
||||||
|
"x": 1,
|
||||||
|
"y": 1,
|
||||||
|
"w": 6,
|
||||||
|
"h": 6
|
||||||
|
},
|
||||||
|
"frame": {
|
||||||
|
"x": 60,
|
||||||
|
"y": 0,
|
||||||
|
"w": 6,
|
||||||
|
"h": 6
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"meta": {
|
||||||
|
"app": "https://www.codeandweb.com/texturepacker",
|
||||||
|
"version": "3.0",
|
||||||
|
"smartupdate": "$TexturePacker:SmartUpdate:3d90a35bb4610decd755ab4f161b7b2e:b268210eb2ee2dfe30b1474128e3a256:6439796039cb76db5f241df91ac447de$"
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 311 B |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 32 KiB |
Binary file not shown.
After Width: | Height: | Size: 448 B |
|
@ -0,0 +1,176 @@
|
||||||
|
import BattleScene from "./battle-scene";
|
||||||
|
import { PokeballType } from "./data/pokeball";
|
||||||
|
import * as Utils from "./utils";
|
||||||
|
|
||||||
|
export function addPokeballOpenParticles(scene: BattleScene, x: number, y: number, pokeballType: PokeballType): void {
|
||||||
|
switch (pokeballType) {
|
||||||
|
case PokeballType.POKEBALL:
|
||||||
|
doDefaultPbOpenParticles(scene, x, y, 48);
|
||||||
|
break;
|
||||||
|
case PokeballType.GREAT_BALL:
|
||||||
|
doDefaultPbOpenParticles(scene, x, y, 96);
|
||||||
|
break;
|
||||||
|
case PokeballType.ULTRA_BALL:
|
||||||
|
doUbOpenParticles(scene, x, y);
|
||||||
|
break;
|
||||||
|
case PokeballType.MASTER_BALL:
|
||||||
|
doMbOpenParticles(scene, x, y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function doDefaultPbOpenParticles(scene: BattleScene, x: number, y: number, radius: number) {
|
||||||
|
const pbOpenParticlesFrameNames = scene.anims.generateFrameNames('pb_particles', { start: 0, end: 3, suffix: '.png' });
|
||||||
|
scene.anims.create({
|
||||||
|
key: 'pb_open_particle',
|
||||||
|
frames: pbOpenParticlesFrameNames,
|
||||||
|
frameRate: 16,
|
||||||
|
repeat: -1
|
||||||
|
});
|
||||||
|
|
||||||
|
const addParticle = (index: integer) => {
|
||||||
|
const particle = scene.add.sprite(x, y, 'pb_open_particle');
|
||||||
|
scene.field.add(particle);
|
||||||
|
const angle = index * 45;
|
||||||
|
const [ xCoord, yCoord ] = [ radius * Math.cos(angle * Math.PI / 180), radius * Math.sin(angle * Math.PI / 180) ];
|
||||||
|
scene.tweens.add({
|
||||||
|
targets: particle,
|
||||||
|
x: x + xCoord,
|
||||||
|
y: y + yCoord,
|
||||||
|
duration: 575
|
||||||
|
});
|
||||||
|
particle.play({
|
||||||
|
key: 'pb_open_particle',
|
||||||
|
startFrame: (index + 3) % 4
|
||||||
|
});
|
||||||
|
scene.tweens.add({
|
||||||
|
targets: particle,
|
||||||
|
delay: 500,
|
||||||
|
duration: 75,
|
||||||
|
alpha: 0,
|
||||||
|
ease: 'Sine.easeIn',
|
||||||
|
onComplete: () => particle.destroy()
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
let particleCount = 0;
|
||||||
|
scene.time.addEvent({
|
||||||
|
delay: 20,
|
||||||
|
repeat: 16,
|
||||||
|
callback: () => addParticle(++particleCount)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function doUbOpenParticles(scene: BattleScene, x: number, y: number) {
|
||||||
|
let particles: Phaser.GameObjects.Image[] = [];
|
||||||
|
for (let i = 0; i < 10; i++)
|
||||||
|
particles.push(doFanOutParticle(scene, i * 25, x, y, 1, 1, 5, 8));
|
||||||
|
|
||||||
|
scene.tweens.add({
|
||||||
|
targets: particles,
|
||||||
|
delay: 750,
|
||||||
|
duration: 250,
|
||||||
|
alpha: 0,
|
||||||
|
ease: 'Sine.easeIn',
|
||||||
|
onComplete: () => {
|
||||||
|
for (let particle of particles)
|
||||||
|
particle.destroy();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function doMbOpenParticles(scene: BattleScene, x: number, y: number) {
|
||||||
|
let particles: Phaser.GameObjects.Image[] = [];
|
||||||
|
for (let j = 0; j < 2; j++) {
|
||||||
|
for (let i = 0; i < 8; i++)
|
||||||
|
particles.push(doFanOutParticle(scene, i * 32, x, y, j ? 1 : 2, j ? 2 : 1, 8, 4));
|
||||||
|
|
||||||
|
scene.tweens.add({
|
||||||
|
targets: particles,
|
||||||
|
delay: 750,
|
||||||
|
duration: 250,
|
||||||
|
alpha: 0,
|
||||||
|
ease: 'Sine.easeIn',
|
||||||
|
onComplete: () => {
|
||||||
|
for (let particle of particles)
|
||||||
|
particle.destroy();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function doFanOutParticle(scene: BattleScene, trigIndex: integer, x: integer, y: integer, xSpeed: integer, ySpeed: integer, angle: integer, frameIndex: integer): Phaser.GameObjects.Image {
|
||||||
|
let f = 0;
|
||||||
|
|
||||||
|
const particle = scene.add.image(x, y, 'pb_particles', `${frameIndex}.png`);
|
||||||
|
scene.field.add(particle);
|
||||||
|
|
||||||
|
const updateParticle = () => {
|
||||||
|
if (!particle.scene)
|
||||||
|
return particleTimer.remove();
|
||||||
|
particle.x = x + sin(trigIndex, f * xSpeed);
|
||||||
|
particle.y = y + cos(trigIndex, f * ySpeed);
|
||||||
|
trigIndex = (trigIndex + angle);
|
||||||
|
f++;
|
||||||
|
};
|
||||||
|
|
||||||
|
const particleTimer = scene.tweens.addCounter({
|
||||||
|
repeat: -1,
|
||||||
|
duration: Utils.getFrameMs(1),
|
||||||
|
onRepeat: () => {
|
||||||
|
updateParticle();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return particle;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addPokeballCaptureStars(scene: BattleScene, pokeball: Phaser.GameObjects.Sprite): void {
|
||||||
|
const addParticle = () => {
|
||||||
|
const particle = scene.add.sprite(pokeball.x, pokeball.y, 'pb_particles', '4.png');
|
||||||
|
particle.setOrigin(pokeball.originX, pokeball.originY);
|
||||||
|
particle.setAlpha(0.5);
|
||||||
|
scene.field.add(particle);
|
||||||
|
|
||||||
|
scene.tweens.add({
|
||||||
|
targets: particle,
|
||||||
|
y: pokeball.y - 10,
|
||||||
|
ease: 'Sine.easeOut',
|
||||||
|
duration: 250,
|
||||||
|
onComplete: () => {
|
||||||
|
scene.tweens.add({
|
||||||
|
targets: particle,
|
||||||
|
y: pokeball.y,
|
||||||
|
alpha: 0,
|
||||||
|
ease: 'Sine.easeIn',
|
||||||
|
duration: 250
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const dist = Utils.randGauss(25);
|
||||||
|
scene.tweens.add({
|
||||||
|
targets: particle,
|
||||||
|
x: pokeball.x + dist,
|
||||||
|
duration: 500
|
||||||
|
});
|
||||||
|
|
||||||
|
scene.tweens.add({
|
||||||
|
targets: particle,
|
||||||
|
alpha: 0,
|
||||||
|
delay: 425,
|
||||||
|
duration: 75,
|
||||||
|
onComplete: () => particle.destroy()
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
new Array(3).fill(null).map(() => addParticle());
|
||||||
|
}
|
||||||
|
|
||||||
|
export function sin(index: integer, amplitude: integer): number {
|
||||||
|
return amplitude * Math.sin(index * (Math.PI / 128));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function cos(index: integer, amplitude: integer): number {
|
||||||
|
return amplitude * Math.cos(index * (Math.PI / 128));
|
||||||
|
}
|
|
@ -38,6 +38,7 @@ import { Egg } from "./data/egg";
|
||||||
import { vouchers } from "./system/voucher";
|
import { vouchers } from "./system/voucher";
|
||||||
import { loggedInUser, updateUserInfo } from "./account";
|
import { loggedInUser, updateUserInfo } from "./account";
|
||||||
import { GameDataType } from "./system/game-data";
|
import { GameDataType } from "./system/game-data";
|
||||||
|
import { addPokeballCaptureStars, addPokeballOpenParticles } from "./anims";
|
||||||
|
|
||||||
export class LoginPhase extends BattlePhase {
|
export class LoginPhase extends BattlePhase {
|
||||||
private showText: boolean;
|
private showText: boolean;
|
||||||
|
@ -842,6 +843,7 @@ export class SummonPhase extends PartyMemberPokemonPhase {
|
||||||
this.scene.field.moveBelow(pokemon, playerPokemon);
|
this.scene.field.moveBelow(pokemon, playerPokemon);
|
||||||
this.scene.currentBattle.seenEnemyPartyMemberIds.add(pokemon.id);
|
this.scene.currentBattle.seenEnemyPartyMemberIds.add(pokemon.id);
|
||||||
}
|
}
|
||||||
|
addPokeballOpenParticles(this.scene, pokemon.x, pokemon.y - 16, pokemon.pokeball);
|
||||||
this.scene.updateModifiers(this.player);
|
this.scene.updateModifiers(this.player);
|
||||||
pokemon.showInfo();
|
pokemon.showInfo();
|
||||||
pokemon.playAnim();
|
pokemon.playAnim();
|
||||||
|
@ -3000,6 +3002,7 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||||
this.scene.time.delayedCall(300, () => {
|
this.scene.time.delayedCall(300, () => {
|
||||||
this.scene.field.moveBelow(this.pokeball as Phaser.GameObjects.GameObject, pokemon);
|
this.scene.field.moveBelow(this.pokeball as Phaser.GameObjects.GameObject, pokemon);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: this.pokeball,
|
targets: this.pokeball,
|
||||||
x: { value: 236 + fpOffset[0], ease: 'Linear' },
|
x: { value: 236 + fpOffset[0], ease: 'Linear' },
|
||||||
|
@ -3010,9 +3013,12 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||||
this.scene.time.delayedCall(17, () => this.pokeball.setTexture('pb', `${pokeballAtlasKey}_open`));
|
this.scene.time.delayedCall(17, () => this.pokeball.setTexture('pb', `${pokeballAtlasKey}_open`));
|
||||||
this.scene.playSound('pb_rel');
|
this.scene.playSound('pb_rel');
|
||||||
pokemon.tint(getPokeballTintColor(this.pokeballType));
|
pokemon.tint(getPokeballTintColor(this.pokeballType));
|
||||||
|
|
||||||
|
addPokeballOpenParticles(this.scene, this.pokeball.x, this.pokeball.y, this.pokeballType);
|
||||||
|
|
||||||
this.scene.tweens.add({
|
this.scene.tweens.add({
|
||||||
targets: pokemon,
|
targets: pokemon,
|
||||||
duration: 250,
|
duration: 500,
|
||||||
ease: 'Sine.easeIn',
|
ease: 'Sine.easeIn',
|
||||||
scale: 0.25,
|
scale: 0.25,
|
||||||
y: 20,
|
y: 20,
|
||||||
|
@ -3052,8 +3058,31 @@ export class AttemptCapturePhase extends PokemonPhase {
|
||||||
shakeCounter.stop();
|
shakeCounter.stop();
|
||||||
this.failCatch(shakeCount);
|
this.failCatch(shakeCount);
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
this.scene.playSound('pb_lock')
|
this.scene.playSound('pb_lock');
|
||||||
|
addPokeballCaptureStars(this.scene, this.pokeball);
|
||||||
|
|
||||||
|
const pbTint = this.scene.add.sprite(this.pokeball.x, this.pokeball.y, 'pb', 'pb');
|
||||||
|
pbTint.setOrigin(this.pokeball.originX, this.pokeball.originY);
|
||||||
|
pbTint.setTintFill(0);
|
||||||
|
pbTint.setAlpha(0);
|
||||||
|
this.scene.field.add(pbTint);
|
||||||
|
this.scene.tweens.add({
|
||||||
|
targets: pbTint,
|
||||||
|
alpha: 0.375,
|
||||||
|
duration: 200,
|
||||||
|
easing: 'Sine.easeOut',
|
||||||
|
onComplete: () => {
|
||||||
|
this.scene.tweens.add({
|
||||||
|
targets: pbTint,
|
||||||
|
alpha: 0,
|
||||||
|
duration: 200,
|
||||||
|
easing: 'Sine.easeIn',
|
||||||
|
onComplete: () => pbTint.destroy()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onComplete: () => this.catch()
|
onComplete: () => this.catch()
|
||||||
});
|
});
|
||||||
|
|
|
@ -301,6 +301,7 @@ export default class BattleScene extends Phaser.Scene {
|
||||||
this.loadImage(`pkmn__sub`, 'pokemon', 'sub.png');
|
this.loadImage(`pkmn__sub`, 'pokemon', 'sub.png');
|
||||||
this.loadAtlas('battle_stats', 'effects');
|
this.loadAtlas('battle_stats', 'effects');
|
||||||
this.loadAtlas('shiny', 'effects');
|
this.loadAtlas('shiny', 'effects');
|
||||||
|
this.loadAtlas('pb_particles', 'effects');
|
||||||
this.loadImage('evo_sparkle', 'effects');
|
this.loadImage('evo_sparkle', 'effects');
|
||||||
this.load.video('evo_bg', 'images/effects/evo_bg.mp4', true);
|
this.load.video('evo_bg', 'images/effects/evo_bg.mp4', true);
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { Mode } from "./ui/ui";
|
||||||
import { LearnMovePhase } from "./battle-phases";
|
import { LearnMovePhase } from "./battle-phases";
|
||||||
import { SpeciesFormKey } from "./data/pokemon-species";
|
import { SpeciesFormKey } from "./data/pokemon-species";
|
||||||
import { achvs } from "./system/achv";
|
import { achvs } from "./system/achv";
|
||||||
|
import { cos, sin } from "./anims";
|
||||||
|
|
||||||
export class EvolutionPhase extends BattlePhase {
|
export class EvolutionPhase extends BattlePhase {
|
||||||
private partyMemberIndex: integer;
|
private partyMemberIndex: integer;
|
||||||
|
@ -251,14 +252,6 @@ export class EvolutionPhase extends BattlePhase {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
sin(index: integer, amplitude: integer): number {
|
|
||||||
return amplitude * Math.sin(index * (Math.PI / 128));
|
|
||||||
}
|
|
||||||
|
|
||||||
cos(index: integer, amplitude: integer): number {
|
|
||||||
return amplitude * Math.cos(index * (Math.PI / 128));
|
|
||||||
}
|
|
||||||
|
|
||||||
doSpiralUpward() {
|
doSpiralUpward() {
|
||||||
let f = 0;
|
let f = 0;
|
||||||
|
|
||||||
|
@ -381,8 +374,8 @@ export class EvolutionPhase extends BattlePhase {
|
||||||
const updateParticle = () => {
|
const updateParticle = () => {
|
||||||
if (!f || particle.y > 8) {
|
if (!f || particle.y > 8) {
|
||||||
particle.setPosition(initialX, 88 - (f * f) / 80);
|
particle.setPosition(initialX, 88 - (f * f) / 80);
|
||||||
particle.y += this.sin(trigIndex, amp) / 4;
|
particle.y += sin(trigIndex, amp) / 4;
|
||||||
particle.x += this.cos(trigIndex, amp);
|
particle.x += cos(trigIndex, amp);
|
||||||
particle.setScale(1 - (f / 80));
|
particle.setScale(1 - (f / 80));
|
||||||
trigIndex += 4;
|
trigIndex += 4;
|
||||||
if (f & 1)
|
if (f & 1)
|
||||||
|
@ -417,9 +410,9 @@ export class EvolutionPhase extends BattlePhase {
|
||||||
const updateParticle = () => {
|
const updateParticle = () => {
|
||||||
if (!f || particle.y < 88) {
|
if (!f || particle.y < 88) {
|
||||||
particle.setPosition(initialX, 8 + (f * f) / 5);
|
particle.setPosition(initialX, 8 + (f * f) / 5);
|
||||||
particle.y += this.sin(trigIndex, amp) / 4;
|
particle.y += sin(trigIndex, amp) / 4;
|
||||||
particle.x += this.cos(trigIndex, amp);
|
particle.x += cos(trigIndex, amp);
|
||||||
amp = 8 + this.sin(f * 4, 40);
|
amp = 8 + sin(f * 4, 40);
|
||||||
f++;
|
f++;
|
||||||
} else {
|
} else {
|
||||||
particle.destroy();
|
particle.destroy();
|
||||||
|
@ -449,8 +442,8 @@ export class EvolutionPhase extends BattlePhase {
|
||||||
const updateParticle = () => {
|
const updateParticle = () => {
|
||||||
if (amp > 8) {
|
if (amp > 8) {
|
||||||
particle.setPosition(initialX, initialY);
|
particle.setPosition(initialX, initialY);
|
||||||
particle.y += this.sin(trigIndex, amp);
|
particle.y += sin(trigIndex, amp);
|
||||||
particle.x += this.cos(trigIndex, amp);
|
particle.x += cos(trigIndex, amp);
|
||||||
amp -= speed;
|
amp -= speed;
|
||||||
trigIndex += 4;
|
trigIndex += 4;
|
||||||
} else {
|
} else {
|
||||||
|
@ -486,7 +479,7 @@ export class EvolutionPhase extends BattlePhase {
|
||||||
yOffset++;
|
yOffset++;
|
||||||
if (trigIndex < 128) {
|
if (trigIndex < 128) {
|
||||||
particle.setPosition(initialX + (speed * f) / 3, initialY + yOffset);
|
particle.setPosition(initialX + (speed * f) / 3, initialY + yOffset);
|
||||||
particle.y += -this.sin(trigIndex, amp);
|
particle.y += -sin(trigIndex, amp);
|
||||||
if (f > 108)
|
if (f > 108)
|
||||||
particle.setScale((1 - (f - 108) / 20));
|
particle.setScale((1 - (f - 108) / 20));
|
||||||
trigIndex++;
|
trigIndex++;
|
||||||
|
|
|
@ -313,7 +313,7 @@ function getAttackTypeBoosterItemName(type: Type) {
|
||||||
case Type.DARK:
|
case Type.DARK:
|
||||||
return 'Black Glasses';
|
return 'Black Glasses';
|
||||||
case Type.FAIRY:
|
case Type.FAIRY:
|
||||||
return 'Clefairy Doll';
|
return 'Fairy Feather';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
20
src/utils.ts
20
src/utils.ts
|
@ -33,18 +33,18 @@ export function clampInt(value: integer, min: integer, max: integer): integer {
|
||||||
return Math.min(Math.max(value, min), max);
|
return Math.min(Math.max(value, min), max);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function randGauss(value: number): number {
|
export function randGauss(stdev: number, mean: number = 0): number {
|
||||||
let rand = 0;
|
const u = 1 - Math.random();
|
||||||
for(var i = value; i > 0; i--)
|
const v = Math.random();
|
||||||
rand += Math.random();
|
const z = Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v);
|
||||||
return rand / value;
|
return z * stdev + mean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function randSeedGauss(value: number): number {
|
export function randSeedGauss(stdev: number, mean: number = 0): number {
|
||||||
let rand = 0;
|
const u = 1 - Phaser.Math.RND.realInRange(0, 1);
|
||||||
for(var i = value; i > 0; i--)
|
const v = Phaser.Math.RND.realInRange(0, 1);
|
||||||
rand += Phaser.Math.RND.realInRange(0, 1);
|
const z = Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v);
|
||||||
return rand / value;
|
return z * stdev + mean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function padInt(value: integer, length: integer, padWith?: string): string {
|
export function padInt(value: integer, length: integer, padWith?: string): string {
|
||||||
|
|
Loading…
Reference in New Issue