Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Commit

Permalink
fix: flak jacket damage reduction
Browse files Browse the repository at this point in the history
  • Loading branch information
leia-uwu committed Oct 6, 2024
1 parent 02ced8b commit 41a0fb6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions server/src/game/objects/bullet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ export class Bullet {
damageType: this.damageType,
amount: multiplier * finalDamage,
dir: this.dir,
isExplosion: this.isShrapnel,
});
}
hit = col.collidable;
Expand Down
1 change: 1 addition & 0 deletions server/src/game/objects/explosion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export class ExplosionBarn {
source: explosion.source,
damageType: explosion.damageType,
dir: collision.dir,
isExplosion: true,
});
}

Expand Down
1 change: 1 addition & 0 deletions server/src/game/objects/gameObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface DamageParams {
gameSourceType?: string;
mapSourceType?: string;
source?: GameObject;
isExplosion?: boolean;
}

const MAX_ID = 65535;
Expand Down
6 changes: 1 addition & 5 deletions server/src/game/objects/player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1836,11 +1836,7 @@ export class Player extends BaseGameObject {
const gameSourceDef = GameObjectDefs[params.gameSourceType ?? ""];

if (this.hasPerk("flak_jacket")) {
const isExplosion =
gameSourceDef &&
(gameSourceDef.type === "explosion" ||
(gameSourceDef.type === "bullet" && gameSourceDef.shrapnel));
finalDamage *= isExplosion ? 0.1 : 0.9;
finalDamage *= params.isExplosion ? 0.1 : 0.9;
}

if (this.hasPerk("steelskin")) finalDamage *= 0.5;
Expand Down

0 comments on commit 41a0fb6

Please sign in to comment.