From db3b6136cf0f37c46f94ac9b80480e44d1d8d34d Mon Sep 17 00:00:00 2001 From: neki-dev Date: Sun, 5 Nov 2023 16:46:30 +0300 Subject: [PATCH 1/7] Updated game balance --- src/const/world/difficulty.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/const/world/difficulty.ts b/src/const/world/difficulty.ts index 0520d73f..e10b98c6 100644 --- a/src/const/world/difficulty.ts +++ b/src/const/world/difficulty.ts @@ -55,7 +55,7 @@ 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 From 903ffb1ea69b5113fb8d8829e46a2c615486a736 Mon Sep 17 00:00:00 2001 From: neki-dev Date: Sun, 5 Nov 2023 17:01:09 +0300 Subject: [PATCH 2/7] Fixed bug with auto-repair and auto-buy ammo --- .../world/entities/building/building.ts | 32 ++++++++---------- .../entities/building/variants/ammunition.ts | 33 ++++--------------- 2 files changed, 20 insertions(+), 45 deletions(-) diff --git a/src/game/scenes/world/entities/building/building.ts b/src/game/scenes/world/entities/building/building.ts index 74b1c9a8..cfc7df5e 100644 --- a/src/game/scenes/world/entities/building/building.ts +++ b/src/game/scenes/world/entities/building/building.ts @@ -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(); @@ -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; @@ -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(); @@ -496,10 +500,6 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi } this.scene.fx.createDamageEffect(this); - - if (this.scene.isModeActive(WorldMode.AUTO_REPAIR)) { - this.autoRepair(); - } } private onDead() { @@ -837,25 +837,19 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi } private handleToggleModes() { - const handler = (mode: WorldMode, state: boolean) => { + const handlerToggle = (mode: WorldMode) => { switch (mode) { case WorldMode.BUILDING_INDICATORS: { this.toggleIndicators(); break; } - case WorldMode.AUTO_REPAIR: { - if (state) { - this.autoRepair(); - } - break; - } } }; - this.scene.events.on(WorldEvents.TOGGLE_MODE, handler); + this.scene.events.on(WorldEvents.TOGGLE_MODE, handlerToggle); this.once(Phaser.GameObjects.Events.DESTROY, () => { - this.scene.events.off(WorldEvents.TOGGLE_MODE, handler); + this.scene.events.off(WorldEvents.TOGGLE_MODE, handlerToggle); }); } diff --git a/src/game/scenes/world/entities/building/variants/ammunition.ts b/src/game/scenes/world/entities/building/variants/ammunition.ts index a0cd1bea..3a2bc8d6 100644 --- a/src/game/scenes/world/entities/building/variants/ammunition.ts +++ b/src/game/scenes/world/entities/building/variants/ammunition.ts @@ -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, @@ -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( @@ -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); @@ -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, @@ -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() { From fbe04f188962bce53840d58052c70556e579f2c0 Mon Sep 17 00:00:00 2001 From: neki-dev Date: Sun, 5 Nov 2023 17:01:42 +0300 Subject: [PATCH 3/7] (Update version) --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index a425fb06..84667b21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "izowave", - "version": "1.18.2", + "version": "1.18.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "izowave", - "version": "1.18.2", + "version": "1.18.3", "license": "GNU", "dependencies": { "events": "3.3.0", diff --git a/package.json b/package.json index 54922b9e..9807d571 100644 --- a/package.json +++ b/package.json @@ -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", From c829c549b80a690d5b9045bd06c9aa6c8c27f6ec Mon Sep 17 00:00:00 2001 From: neki-dev Date: Sun, 5 Nov 2023 17:25:45 +0300 Subject: [PATCH 4/7] Updated game balance --- src/const/world/difficulty.ts | 8 ++++---- src/const/world/entities/enemy.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/const/world/difficulty.ts b/src/const/world/difficulty.ts index e10b98c6..fc84859b 100644 --- a/src/const/world/difficulty.ts +++ b/src/const/world/difficulty.ts @@ -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 @@ -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 /** diff --git a/src/const/world/entities/enemy.ts b/src/const/world/entities/enemy.ts index 61adb53b..0947ccc2 100644 --- a/src/const/world/entities/enemy.ts +++ b/src/const/world/entities/enemy.ts @@ -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; From a9b06b1a4ff4bb838a0bfdcbcf154ec4d98e3e61 Mon Sep 17 00:00:00 2001 From: neki-dev Date: Sun, 5 Nov 2023 17:25:54 +0300 Subject: [PATCH 5/7] Minor fixes --- src/game/scenes/world/effects/fx-manager.ts | 14 +++++--------- .../scenes/world/entities/building/building.ts | 7 +++++++ src/game/scenes/world/entities/sprite.ts | 1 + 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/game/scenes/world/effects/fx-manager.ts b/src/game/scenes/world/effects/fx-manager.ts index 91f8ac6e..ca9b6bce 100644 --- a/src/game/scenes/world/effects/fx-manager.ts +++ b/src/game/scenes/world/effects/fx-manager.ts @@ -1,4 +1,3 @@ -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'; @@ -6,7 +5,7 @@ import { EffectTexture, IParticlesParent, ParticlesTexture } from '~type/world/e 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'; @@ -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, diff --git a/src/game/scenes/world/entities/building/building.ts b/src/game/scenes/world/entities/building/building.ts index cfc7df5e..cbc49be1 100644 --- a/src/game/scenes/world/entities/building/building.ts +++ b/src/game/scenes/world/entities/building/building.ts @@ -500,6 +500,13 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi } this.scene.fx.createDamageEffect(this); + + if ( + this.scene.isModeActive(WorldMode.AUTO_REPAIR) + && this.live.health / this.live.maxHealth <= 0.5 + ) { + this.repair(true); + } } private onDead() { diff --git a/src/game/scenes/world/entities/sprite.ts b/src/game/scenes/world/entities/sprite.ts index 96d08a43..e96892a3 100644 --- a/src/game/scenes/world/entities/sprite.ts +++ b/src/game/scenes/world/entities/sprite.ts @@ -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)); From 632ca7438baa728d97b50dc28f50d6fe32e02477 Mon Sep 17 00:00:00 2001 From: neki-dev Date: Sun, 5 Nov 2023 17:46:23 +0300 Subject: [PATCH 6/7] Updated game balance --- src/const/world/difficulty.ts | 5 +++-- src/game/scenes/world/entities/crystal.ts | 1 + src/game/scenes/world/entities/npc/variants/enemy/enemy.ts | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/const/world/difficulty.ts b/src/const/world/difficulty.ts index fc84859b..c1978677 100644 --- a/src/const/world/difficulty.ts +++ b/src/const/world/difficulty.ts @@ -62,7 +62,7 @@ export const DIFFICULTY = { 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 @@ -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 @@ -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 diff --git a/src/game/scenes/world/entities/crystal.ts b/src/game/scenes/world/entities/crystal.ts index 113b756a..318c2aad 100644 --- a/src/game/scenes/world/entities/crystal.ts +++ b/src/game/scenes/world/entities/crystal.ts @@ -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( diff --git a/src/game/scenes/world/entities/npc/variants/enemy/enemy.ts b/src/game/scenes/world/entities/npc/variants/enemy/enemy.ts index 779583f4..e4a06eb5 100644 --- a/src/game/scenes/world/entities/npc/variants/enemy/enemy.ts +++ b/src/game/scenes/world/entities/npc/variants/enemy/enemy.ts @@ -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, From 90a9d66c9ce56f4f7954c563c58e9b09883c54e8 Mon Sep 17 00:00:00 2001 From: neki-dev Date: Sun, 5 Nov 2023 17:47:54 +0300 Subject: [PATCH 7/7] Minor fixes --- src/game/scenes/world/entities/building/building.ts | 6 +++--- .../world/entities/npc/variants/enemy/variants/berserk.ts | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/game/scenes/world/entities/building/building.ts b/src/game/scenes/world/entities/building/building.ts index cbc49be1..9f3f4573 100644 --- a/src/game/scenes/world/entities/building/building.ts +++ b/src/game/scenes/world/entities/building/building.ts @@ -844,7 +844,7 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi } private handleToggleModes() { - const handlerToggle = (mode: WorldMode) => { + const handler = (mode: WorldMode) => { switch (mode) { case WorldMode.BUILDING_INDICATORS: { this.toggleIndicators(); @@ -853,10 +853,10 @@ export class Building extends Phaser.GameObjects.Image implements IBuilding, ITi } }; - this.scene.events.on(WorldEvents.TOGGLE_MODE, handlerToggle); + this.scene.events.on(WorldEvents.TOGGLE_MODE, handler); this.once(Phaser.GameObjects.Events.DESTROY, () => { - this.scene.events.off(WorldEvents.TOGGLE_MODE, handlerToggle); + this.scene.events.off(WorldEvents.TOGGLE_MODE, handler); }); } diff --git a/src/game/scenes/world/entities/npc/variants/enemy/variants/berserk.ts b/src/game/scenes/world/entities/npc/variants/enemy/variants/berserk.ts index 581c2042..13e4539e 100644 --- a/src/game/scenes/world/entities/npc/variants/enemy/variants/berserk.ts +++ b/src/game/scenes/world/entities/npc/variants/enemy/variants/berserk.ts @@ -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, @@ -21,6 +23,8 @@ export class EnemyBerserk extends Enemy { might: 1.7, }, }); + + this.healAmount = Math.ceil(this.live.maxHealth * ENEMY_HEAL_MULTIPLIER); } public update() { @@ -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); } } }