Files
7d2dXG/Mods/zzz_REBIRTH__Utils/Scripts/MinEvents/MinEventActionTriggerRageAuras.cs
Nathaniel Cosford 062dfab2cd Patched
2025-05-30 01:04:40 +09:30

89 lines
2.9 KiB
C#

using System.Xml.Linq;
using UnityEngine.Scripting;
[Preserve]
public class MinEventActionTriggerRageAuras : MinEventActionBuffModifierBase
{
string strTriggerAction = "";
public override void Execute(MinEventParams _params)
{
//Log.Out("MinEventActionTriggerRageAuras-Execute 1");
bool flag = !_params.Self.isEntityRemote | _params.IsLocal;
int num = -1;
if (_params.Buff != null)
{
//Log.Out("MinEventActionTriggerRageAuras-Execute 2");
num = _params.Buff.InstigatorId;
}
if (num == -1)
{
//Log.Out("MinEventActionTriggerRageAuras-Execute 3");
num = _params.Self.entityId;
}
if (strTriggerAction == "self")
{
for (int i = 0; i < this.targets.Count; i++)
{
//Log.Out("MinEventActionTriggerRageAuras-Execute i: " + i);
RebirthUtilities.SetAuraChance(ItemClass.GetItem("meleeWpnBladeT0BoneKnife", false), "meleeWpnBladeT0BoneKnife", _params.Buff.InstigatorId, _params.Self.Buffs.GetCustomVar("$ActiveClass_FR"), this.targets[i].entityId, true, true, -1, true, true);
}
}
else
{
EntityPlayer player = (EntityPlayer)_params.Self;
if (player.Party != null)
{
if (player.Party.MemberList != null)
{
string optionAuraRange = RebirthVariables.customAuraRange;
for (int j = 0; j < player.Party.MemberList.Count; j++)
{
EntityPlayer partyMember = player.Party.MemberList[j] as EntityPlayer;
bool isWithinRange = Vector3.Distance(partyMember.position, player.position) < (float)GameStats.GetInt(EnumGameStats.PartySharedKillRange);
if (optionAuraRange == "always")
{
isWithinRange = true;
}
else if (optionAuraRange == "never")
{
isWithinRange = false;
}
if (partyMember.entityId != player.entityId && isWithinRange)
{
partyMember.Buffs.AddBuff("FuriousRamsayFullAura");
}
}
}
}
}
}
public override bool ParseXmlAttribute(XAttribute _attribute)
{
var flag = base.ParseXmlAttribute(_attribute);
if (flag) return true;
var name = _attribute.Name;
if (name == null)
{
return flag;
}
else if (name == "triggeraction")
{
strTriggerAction = _attribute.Value;
return true;
}
else
{
return false;
}
}
}