Skip to content

Commit 6cdaabf

Browse files
authored
feat: (Day) Add option to allow safe zones to consider any player friendly (AscensionGameDev#2071)
* feat: (Day) Add option to enable friendly fire in safe map zones for non party/guildies * chore: (Day) Code review * chore: Code review
1 parent 80f4a95 commit 6cdaabf

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Intersect (Core)/Config/CombatOptions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,10 @@ public partial class CombatOptions
7373
/// If enabled, this makes it so a player casting a friendly spell on a hostile target instead casts the spell upon themselves
7474
/// </summary>
7575
public bool EnableAutoSelfCastFriendlySpellsWhenTargetingHostile { get; set; } = false;
76+
77+
/// <summary>
78+
/// If enabled, this allows players to cast friendly spells on players who aren't in their guild or party
79+
/// </summary>
80+
public bool EnableAllPlayersFriendlyInSafeZone { get; set; } = false;
7681
}
7782
}

Intersect.Server.Core/Entities/Player.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5124,7 +5124,22 @@ public override bool IsAllyOf(Entity otherEntity)
51245124

51255125
public virtual bool IsAllyOf(Player otherPlayer)
51265126
{
5127-
return this.InParty(otherPlayer) || this == otherPlayer;
5127+
if (Id == otherPlayer.Id)
5128+
{
5129+
return true;
5130+
}
5131+
5132+
if (InParty(otherPlayer))
5133+
{
5134+
return true;
5135+
}
5136+
5137+
if (IsInGuild && otherPlayer?.Guild?.Id == Guild.Id)
5138+
{
5139+
return true;
5140+
}
5141+
5142+
return Map?.ZoneType == MapZone.Safe && Options.Instance.CombatOpts.EnableAllPlayersFriendlyInSafeZone;
51285143
}
51295144

51305145
public override bool CanCastSpell(SpellBase spell, Entity target, bool checkVitalReqs, out SpellCastFailureReason reason)

0 commit comments

Comments
 (0)