Skip to content

Commit

Permalink
Updated game balance
Browse files Browse the repository at this point in the history
  • Loading branch information
neki-dev committed Nov 3, 2023
1 parent 95212ab commit b4cc813
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/const/world/difficulty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ export const DIFFICULTY = {
PLAYER_HEALTH_GROWTH: 0.4, // Growth health by upgrade (Quadratic)
PLAYER_HEALTH_EXPERIENCE_TO_UPGRADE: 80, // Experience need to upgrade health
PLAYER_SPEED: 90, // Movement speed
PLAYER_SPEED_GROWTH: 0.04, // Growth speed by upgrade (Quadratic)
PLAYER_SPEED_EXPERIENCE_TO_UPGRADE: 60, // Experience need to upgrade speed
PLAYER_SPEED_GROWTH: 0.0556, // Growth speed by upgrade (Linear)
PLAYER_SPEED_EXPERIENCE_TO_UPGRADE: 80, // Experience need to upgrade speed
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.75, // Growth experience need to upgrade (Quadratic)
PLAYER_EXPERIENCE_TO_UPGRADE_GROWTH: 0.8, // Growth experience need to upgrade (Quadratic)

/**
* Assistant
Expand All @@ -23,7 +23,7 @@ export const DIFFICULTY = {
ASSISTANT_ATTACK_SPEED: 500, // Attack speed
ASSISTANT_ATTACK_DAMAGE: 15, // Attack damage
ASSISTANT_ATTACK_DAMAGE_GROWTH: 0.5, // Damage growth by upgrade level (Quadratic)
ASSISTANT_ATTACK_DAMAGE_EXPERIENCE_TO_UPGRADE: 60, // Experience need to upgrade attack damage
ASSISTANT_ATTACK_DAMAGE_EXPERIENCE_TO_UPGRADE: 70, // Experience need to upgrade attack damage
ASSISTANT_ATTACK_DISTANCE: 70, // Attack distance
ASSISTANT_ATTACK_DISTANCE_GROWTH: 0.15, // Attack distance growth by upgrade level (Quadratic)
ASSISTANT_ATTACK_DISTANCE_EXPERIENCE_TO_UPGRADE: 40, // Experience need to upgrade attack distance
Expand Down
17 changes: 8 additions & 9 deletions src/game/scenes/world/entities/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,34 +389,33 @@ export class Player extends Sprite implements IPlayer {
});
}

private getUpgradeNextValue(type: PlayerSkill, level?: number): number {
const nextLevel = level ?? this.upgradeLevel[type] + 1;

static GetUpgradeNextValue(type: PlayerSkill, level: number): number {
switch (type) {
case PlayerSkill.MAX_HEALTH: {
return progressionQuadratic({
defaultValue: DIFFICULTY.PLAYER_HEALTH,
scale: DIFFICULTY.PLAYER_HEALTH_GROWTH,
level: nextLevel,
level,
roundTo: 10,
});
}
case PlayerSkill.SPEED: {
return progressionQuadratic({
return progressionLinear({
defaultValue: DIFFICULTY.PLAYER_SPEED,
scale: DIFFICULTY.PLAYER_SPEED_GROWTH,
level: nextLevel,
level,
roundTo: 1,
});
}
case PlayerSkill.STAMINA: {
return progressionQuadratic({
defaultValue: DIFFICULTY.PLAYER_STAMINA,
scale: DIFFICULTY.PLAYER_STAMINA_GROWTH,
level: nextLevel,
level,
});
}
default: {
return nextLevel;
return level;
}
}
}
Expand All @@ -443,7 +442,7 @@ export class Player extends Sprite implements IPlayer {
}

private setSkillUpgrade(type: PlayerSkill, level: number) {
const nextValue = this.getUpgradeNextValue(type, level);
const nextValue = Player.GetUpgradeNextValue(type, level);

switch (type) {
case PlayerSkill.MAX_HEALTH: {
Expand Down

0 comments on commit b4cc813

Please sign in to comment.