fix(hs): make statues immune to friendly (same-team) damage

A player could destroy their own team's Heykel Savasi statue: the win-condition
attribution (OnDestructibleDied) trusts geometry alone (attacker = Opponent of
defender), and the old friendly-fire guard only covered Player targets, not
Destructible statues. Block same-team damage at the NPC damage intake instead
so only the enemy team can ever land a hit on a statue.
This commit is contained in:
Acentech Dev
2026-07-21 00:57:15 +03:00
parent e0fafe7e03
commit e6e93450b7
2 changed files with 16 additions and 0 deletions

View File

@@ -214,6 +214,14 @@ public class HeykelSavasiContext : MiniGameContext
/// <returns>The team of the player, or <see cref="HeykelSavasiTeam.None"/> if the player is not assigned to a team.</returns>
public HeykelSavasiTeam GetTeam(Player player) => this._teams.TryGetValue(player, out var team) ? team : HeykelSavasiTeam.None;
/// <summary>
/// Returns true if <paramref name="npc"/> is a Heykel Savasi statue belonging to the
/// same team as <paramref name="attacker"/> — such statues must be immune to friendly damage,
/// otherwise a player could destroy their own team's statue and credit the enemy.
/// </summary>
public bool IsFriendlyStatue(AttackableNpcBase npc, Player attacker)
=> this._statues.TryGetValue(npc, out var info) && info.Defender == this.GetTeam(attacker);
/// <summary>
/// Gets the base spawn gate for the given team.
/// </summary>

View File

@@ -109,6 +109,14 @@ public abstract class AttackableNpcBase : NonPlayerCharacter, IAttackable
return null;
}
// ADAMU-CUSTOM: Heykel Savasi -> a statue is immune to damage from its own team (only the enemy may break it).
if (attacker is Player heykelStatueAttacker
&& heykelStatueAttacker.CurrentMiniGame is MiniGames.HeykelSavasiContext heykelStatueGame
&& heykelStatueGame.IsFriendlyStatue(this, heykelStatueAttacker))
{
return null;
}
var hitInfo = await attacker.CalculateDamageAsync(this, skill, isCombo, damageFactor).ConfigureAwait(false);
if (skill?.Skill is not { } attackSkill || attackSkill.DamageType != DamageType.Fenrir)