Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.18.3 #102

Merged
merged 7 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "izowave",
"description": "Isometric game. Build and defense in open world",
"version": "1.18.2",
"version": "1.18.3",
"keywords": [
"game",
"isometric",
Expand Down
15 changes: 8 additions & 7 deletions src/const/world/difficulty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const DIFFICULTY = {
PLAYER_STAMINA: 100, // Stamina
PLAYER_STAMINA_GROWTH: 0.2, // Growth stamina by upgrade (Quadratic)
PLAYER_STAMINA_EXPERIENCE_TO_UPGRADE: 60, // Experience need to upgrade stamina
PLAYER_EXPERIENCE_TO_UPGRADE_GROWTH: 0.8, // Growth experience need to upgrade (Quadratic)
PLAYER_EXPERIENCE_TO_UPGRADE_GROWTH: 1.0, // Growth experience need to upgrade (Quadratic)

/**
* Assistant
Expand Down Expand Up @@ -41,12 +41,12 @@ export const DIFFICULTY = {
SUPERSKILL_INVISIBLE_DURATION: 5000, // Invisible duration
SUPERSKILL_FROST_COST: 30, // Cost of use
SUPERSKILL_FROST_DURATION: 10000, // Frost duration
SUPERSKILL_FIRE_COST: 40, // Cost of use
SUPERSKILL_FIRE_COST: 45, // Cost of use
SUPERSKILL_FIRE_DURATION: 2000, // Fire duration
SUPERSKILL_FIRE_FORCE: 1.5, // Fire damage force
SUPERSKILL_RAGE_COST: 40, // Cost of use
SUPERSKILL_RAGE_COST: 45, // Cost of use
SUPERSKILL_RAGE_DURATION: 10000, // Rage duration
SUPERSKILL_COST_GROWTH: 0.2, // Growth cost by wave number (Linear)
SUPERSKILL_COST_GROWTH: 0.25, // Growth cost by wave number (Linear)
SUPERSKILL_UNLOCK_PER_WAVE: 3, // Period of superskill unlocking

/**
Expand All @@ -55,14 +55,14 @@ export const DIFFICULTY = {

WAVE_TIMELEFT: 10000, // Pause between waves
WAVE_TIMELEFT_GROWTH: 0.5, // Pause growth by wave number (Linear)
WAVE_TIMELEFT_GROWTH_MAX_LEVEL: 17, // Level for limit pause growth
WAVE_TIMELEFT_GROWTH_MAX_LEVEL: 11, // Level for limit pause growth
WAVE_ENEMIES_COUNT: 4, // Enemies count on first wave
WAVE_ENEMIES_COUNT_GROWTH: 0.27, // Enemies count growth by wave number (Quadratic Mixed)
WAVE_ENEMIES_SPAWN_PAUSE: 2000, // Pause between enemies spawn
WAVE_ENEMIES_SPAWN_PAUSE_GROWTH: -0.05, // Enemies spawn pause growth by wave number (Linear)
WAVE_ENEMIES_SPAWN_PAUSE_GROWTH_MAX_LEVEL: 11, // Level for limit spawn pause growth
WAVE_EXPERIENCE: 50, // Gained experience per complete wave
WAVE_EXPERIENCE_GROWTH: 0.2, // Experience amount growth by wave number (Quadratic)
WAVE_EXPERIENCE_GROWTH: 0.25, // Experience amount growth by wave number (Quadratic)

/**
* Crystals
Expand All @@ -73,6 +73,7 @@ export const DIFFICULTY = {
CRYSTAL_COUNT_GROWTH_MAX_LEVEL: 10, // Level for limit count growth
CRYSTAL_RESOURCES: 4, // Resources in crystal
CRYSTAL_RESOURCES_GROWTH: 0.8, // Resources amount growth by wave number (Linear)
CRYSTAL_RESOURCES_GROWTH_MAX_LEVEL: 12, // Level for limit resources growth

/**
* Enemies
Expand All @@ -90,7 +91,7 @@ export const DIFFICULTY = {
ENEMY_DAMAGE: 90, // Attack damage
ENEMY_DAMAGE_GROWTH: 0.32, // Damage growth by wave number (Linear)
ENEMY_KILL_EXPERIENCE: 10, // Gained experience per kill enemy
ENEMY_KILL_EXPERIENCE_GROWTH: 0.15, // Experience growth by wave number (Quadratic)
ENEMY_KILL_EXPERIENCE_GROWTH: 0.28, // Experience growth by wave number (Linear)

/**
* Builder
Expand Down
2 changes: 1 addition & 1 deletion src/const/world/entities/enemy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const ENEMY_REGENERATION_RADIUS = 100;

export const ENEMY_HEAL_TIMESTAMP_PAUSE = 1000;

export const ENEMY_HEAL_MULTIPLIER = 0.05;
export const ENEMY_HEAL_MULTIPLIER = 0.075;

export const ENEMY_SPREAD_DAMAGE_RADIUS = 60;

Expand Down
14 changes: 5 additions & 9 deletions src/game/scenes/world/effects/fx-manager.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { ENEMY_SIZE_PARAMS, ENEMY_TEXTURE_SIZE } from '~const/world/entities/enemy';
import { Environment } from '~lib/environment';
import { GameFlag, GameSettings } from '~type/game';
import { IWorld } from '~type/world';
import { EffectTexture, IParticlesParent, ParticlesTexture } from '~type/world/effects';
import { IFXManager } from '~type/world/effects/fx-manager';
import { IBuilding } from '~type/world/entities/building';
import { INPC } from '~type/world/entities/npc';
import { EnemyTexture, IEnemy } from '~type/world/entities/npc/enemy';
import { IEnemy } from '~type/world/entities/npc/enemy';
import { IPlayer } from '~type/world/entities/player';
import { ISprite } from '~type/world/entities/sprite';
import { PositionAtWorld } from '~type/world/level';
Expand Down Expand Up @@ -242,19 +241,16 @@ export class FXManager implements IFXManager {
return null;
}

// Native body.center isn't working at current state
const size = ENEMY_SIZE_PARAMS[ENEMY_TEXTURE_SIZE[parent.texture.key as EnemyTexture]];
const position: PositionAtWorld = {
x: parent.x,
y: parent.y - size.height / 2,
};
const duration = Math.min(700, parent.displayHeight * 17);
const scale = parent.displayWidth / 16;

return new Particles(parent, {
key: 'spawn',
texture: ParticlesTexture.BIT_SOFT,
position,
position: {
x: parent.x,
y: parent.body.y,
},
depth: parent.depth - 1,
params: {
duration,
Expand Down
31 changes: 16 additions & 15 deletions src/game/scenes/world/entities/building/building.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi
this.updateOutline();
this.updateIndicators();

if (this.scene.isModeActive(WorldMode.AUTO_REPAIR)) {
this.handleAutorepair();
}

// Catch focus by camera moving
if (this.toFocus) {
this.focus();
Expand All @@ -167,6 +171,12 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi
}
}

public handleAutorepair() {
if (this.live.health / this.live.maxHealth <= 0.5) {
this.repair(true);
}
}

public actionsAreaContains(position: PositionAtWorld) {
if (!this.active || !this.actionsArea) {
return false;
Expand Down Expand Up @@ -375,12 +385,6 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi
this.scene.sound.play(BuildingAudio.REPAIR);
}

private autoRepair() {
if (this.live.health / this.live.maxHealth <= 0.5) {
this.repair(true);
}
}

private upgradeHealth() {
const maxHealth = this.getMaxHealth();

Expand Down Expand Up @@ -497,8 +501,11 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi

this.scene.fx.createDamageEffect(this);

if (this.scene.isModeActive(WorldMode.AUTO_REPAIR)) {
this.autoRepair();
if (
this.scene.isModeActive(WorldMode.AUTO_REPAIR)
&& this.live.health / this.live.maxHealth <= 0.5
) {
this.repair(true);
}
}

Expand Down Expand Up @@ -837,18 +844,12 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi
}

private handleToggleModes() {
const handler = (mode: WorldMode, state: boolean) => {
const handler = (mode: WorldMode) => {
switch (mode) {
case WorldMode.BUILDING_INDICATORS: {
this.toggleIndicators();
break;
}
case WorldMode.AUTO_REPAIR: {
if (state) {
this.autoRepair();
}
break;
}
}
};

Expand Down
33 changes: 7 additions & 26 deletions src/game/scenes/world/entities/building/variants/ammunition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BUILDING_TILE } from '~const/world/entities/building';
import { progressionQuadratic } from '~lib/progression';
import { Tutorial } from '~lib/tutorial';
import { TutorialStep } from '~type/tutorial';
import { IWorld, WorldEvents, WorldMode } from '~type/world';
import { IWorld, WorldMode } from '~type/world';
import { EntityType } from '~type/world/entities';
import {
BuildingAudio,
Expand Down Expand Up @@ -61,8 +61,6 @@ export class BuildingAmmunition extends Building implements IBuildingAmmunition
value: () => this.ammo / this.maxAmmo,
});

this.handleToggleAutoAmmo();

Tutorial.Complete(TutorialStep.BUILD_AMMUNITION);

this.bindTutorialHint(
Expand Down Expand Up @@ -118,7 +116,7 @@ export class BuildingAmmunition extends Building implements IBuildingAmmunition

if (this.ammo === 0) {
if (this.scene.isModeActive(WorldMode.AUTO_REPAIR)) {
this.autoBuyAmmo();
this.buyAmmo(true);
} else {
if (this.scene.game.sound.getAll(BuildingAudio.OVER).length === 0) {
this.scene.game.sound.play(BuildingAudio.OVER);
Expand Down Expand Up @@ -174,12 +172,6 @@ export class BuildingAmmunition extends Building implements IBuildingAmmunition
Tutorial.Complete(TutorialStep.BUY_AMMO);
}

private autoBuyAmmo() {
if (this.ammo === 0) {
this.buyAmmo(true);
}
}

private getMaxAmmo() {
return progressionQuadratic({
defaultValue: DIFFICULTY.BUILDING_AMMUNITION_AMMO,
Expand All @@ -197,23 +189,12 @@ export class BuildingAmmunition extends Building implements IBuildingAmmunition
this.ammo += addedAmmo;
}

private handleToggleAutoAmmo() {
const handler = (mode: WorldMode, state: boolean) => {
switch (mode) {
case WorldMode.AUTO_REPAIR: {
if (state) {
this.autoBuyAmmo();
}
break;
}
}
};

this.scene.events.on(WorldEvents.TOGGLE_MODE, handler);
public handleAutorepair() {
super.handleAutorepair();

this.once(Phaser.GameObjects.Events.DESTROY, () => {
this.scene.events.off(WorldEvents.TOGGLE_MODE, handler);
});
if (this.ammo === 0) {
this.buyAmmo(true);
}
}

public getSavePayload() {
Expand Down
1 change: 1 addition & 0 deletions src/game/scenes/world/entities/crystal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export class Crystal extends Phaser.GameObjects.Image implements ICrystal, ITile
defaultValue: DIFFICULTY.CRYSTAL_RESOURCES,
scale: DIFFICULTY.CRYSTAL_RESOURCES_GROWTH,
level: this.scene.wave.number,
maxLevel: DIFFICULTY.CRYSTAL_RESOURCES_GROWTH_MAX_LEVEL,
});

return Phaser.Math.Between(
Expand Down
2 changes: 1 addition & 1 deletion src/game/scenes/world/entities/npc/variants/enemy/enemy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export class Enemy extends NPC implements IEnemy {
}

public onDead() {
const experience = progressionQuadratic({
const experience = progressionLinear({
defaultValue: DIFFICULTY.ENEMY_KILL_EXPERIENCE * this.might,
scale: DIFFICULTY.ENEMY_KILL_EXPERIENCE_GROWTH,
level: this.scene.wave.number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export class EnemyBerserk extends Enemy {

private healTimestamp: number = 0;

private healAmount: number = 0;

constructor(scene: IWorld, data: EnemyVariantData) {
super(scene, {
...data,
Expand All @@ -21,6 +23,8 @@ export class EnemyBerserk extends Enemy {
might: 1.7,
},
});

this.healAmount = Math.ceil(this.live.maxHealth * ENEMY_HEAL_MULTIPLIER);
}

public update() {
Expand All @@ -47,7 +51,7 @@ export class EnemyBerserk extends Enemy {
if (now >= this.healTimestamp) {
this.healTimestamp = now + ENEMY_HEAL_TIMESTAMP_PAUSE;

this.live.heal(this.live.maxHealth * ENEMY_HEAL_MULTIPLIER);
this.live.heal(this.healAmount);
}
}
}
1 change: 1 addition & 0 deletions src/game/scenes/world/entities/sprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export class Sprite extends Phaser.Physics.Arcade.Sprite implements ISprite {
this.addContainer();
this.addIndicatorsContainer();
this.addDebugPosition();
this.updateDimension();

this.live.on(LiveEvents.DAMAGE, this.onDamage.bind(this));
this.live.on(LiveEvents.DEAD, this.onDead.bind(this));
Expand Down