Skip to content

Commit 17b9bfb

Browse files
committed
fix: System attack
- Wrong variable - If ship.experience = 0, damage was always 0 - Add damage to ship.experience
1 parent 0a646b0 commit 17b9bfb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/game-logic/game-logic.service.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,10 @@ export class GameLogicService {
521521
variables: Partial<Record<Variable, number>>,
522522
jobs: JobDocument[],
523523
) {
524-
const attack = variables[`ships.${ship.type}.damage.system` as Variable] ?? variables[`ships.${ship.type}.damage.default` as Variable] ?? 0;
524+
const attack = variables[`ships.${ship.type}.attack.system` as Variable] ?? variables[`ships.${ship.type}.attack.default` as Variable] ?? 0;
525525
// The damage is calculated using A.attack.system / system.defense + log(A.experience)
526-
const damage = Math.max(attack / defense + Math.log(ship.experience), 0);
526+
const damage = Math.max(attack / defense + Math.log1p(ship.experience), 0);
527+
ship.experience += damage;
527528
system.health -= damage;
528529
if (system.health > 0) {
529530
return;

0 commit comments

Comments
 (0)