diff --git a/src/GameLogic/MiniGames/HeykelSavasiContext.cs b/src/GameLogic/MiniGames/HeykelSavasiContext.cs index 2feb621..4f784e8 100644 --- a/src/GameLogic/MiniGames/HeykelSavasiContext.cs +++ b/src/GameLogic/MiniGames/HeykelSavasiContext.cs @@ -214,6 +214,14 @@ public class HeykelSavasiContext : MiniGameContext /// The team of the player, or if the player is not assigned to a team. public HeykelSavasiTeam GetTeam(Player player) => this._teams.TryGetValue(player, out var team) ? team : HeykelSavasiTeam.None; + /// + /// Returns true if is a Heykel Savasi statue belonging to the + /// same team as — such statues must be immune to friendly damage, + /// otherwise a player could destroy their own team's statue and credit the enemy. + /// + public bool IsFriendlyStatue(AttackableNpcBase npc, Player attacker) + => this._statues.TryGetValue(npc, out var info) && info.Defender == this.GetTeam(attacker); + /// /// Gets the base spawn gate for the given team. /// diff --git a/src/GameLogic/NPC/AttackableNpcBase.cs b/src/GameLogic/NPC/AttackableNpcBase.cs index 65e1625..bc3f6bf 100644 --- a/src/GameLogic/NPC/AttackableNpcBase.cs +++ b/src/GameLogic/NPC/AttackableNpcBase.cs @@ -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)