diff --git a/common/physics.weapon.aura.ts b/common/physics.weapon.aura.ts index 7fcf84f..240ea58 100644 --- a/common/physics.weapon.aura.ts +++ b/common/physics.weapon.aura.ts @@ -31,7 +31,8 @@ export function handleAuraWeaponCollisions( type: "weaponCollision", damagedPlayerId: otherPlayer.id, playerId: player.id, - amount: otherPlayerWeaponDamage / elapsedTime, + amount: + (otherPlayerWeaponDamage * weapon.damageMultiplier) / elapsedTime, }); } diff --git a/common/types/weapon.ts b/common/types/weapon.ts index 750bd5c..555f9bd 100644 --- a/common/types/weapon.ts +++ b/common/types/weapon.ts @@ -48,12 +48,17 @@ export type AuraWeapon = BaseWeapon & { * The radius the aura extends from the player. */ radiusFromPlayer: number; + /** + * A multiplier on the damage dealt by the aura to other players. + */ + damageMultiplier: number; }; export function makeAuraWeapon(): AuraWeapon { return { type: "aura", - playerCollisionWeightMultiplier: 3, + playerCollisionWeightMultiplier: 2, radiusFromPlayer: 5, + damageMultiplier: 1.5, }; } diff --git a/server/logic/room-controller.base.ts b/server/logic/room-controller.base.ts index 96ebc80..5b24176 100644 --- a/server/logic/room-controller.base.ts +++ b/server/logic/room-controller.base.ts @@ -113,6 +113,14 @@ export class BaseRoomController implements RoomController { const damagedPlayer = this.room.players[damage.damagedPlayerId]; assert(damagedPlayer, "Damaged player not found"); + if ( + damage.type === "playerCollision" && + damagedPlayer.weapon.type === "aura" + ) { + // Players with aura weapons are immune to player collisions + continue; + } + // TODO: Ignore damage if damaged by same source in the last N milliseconds damagedPlayer.health -= damage.amount;