Files
zzz_REBIRTH__Utils/Scripts/MinEvents/NPCs/MinEventActionVerifyNPCActionsRebirth.cs
2025-06-04 16:44:53 +09:30

85 lines
3.5 KiB
C#

public class MinEventActionVerifyNPCActionsRebirth : MinEventActionRemoveBuff
{
public override void Execute(MinEventParams _params)
{
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute START");
var entity = _params.Self as EntityAlive;
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute BUF ENTITY: " + entity.EntityClass.entityClassName);
if (entity is EntityPlayerLocal)
{
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute ENTITY IS PLAYER");
EntityPlayerLocal ___entityPlayerLocal = (EntityPlayerLocal)entity;
float flMode = ___entityPlayerLocal.Buffs.GetCustomVar("varNPCModMode");
float flHalt = ___entityPlayerLocal.Buffs.GetCustomVar("varNPCModStopAttacking");
for (int j = 0; j < ___entityPlayerLocal.Companions.Count; j++)
{
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute j: " + j);
var entityNPC = ___entityPlayerLocal.Companions[j] as EntityNPCRebirth;
if (entityNPC != null)
{
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute entityNPC: " + entityNPC.EntityClass.entityClassName);
if (flMode == 0)
{
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 1");
entityNPC.Buffs.AddBuff("buffNPCModFullControlMode");
}
else
{
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 2");
entityNPC.Buffs.RemoveBuff("buffNPCModFullControlMode");
}
if (flHalt == 1)
{
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 3");
entityNPC.Buffs.AddBuff("buffNPCModStopAttacking");
}
else
{
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 4");
entityNPC.Buffs.RemoveBuff("buffNPCModStopAttacking");
}
}
}
}
else
{
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute ENTITY IS NPC");
EntityNPCRebirth entityNPC = (EntityNPCRebirth)entity;
if (entityNPC.LeaderUtils.Owner)
{
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 6");
float flMode = entityNPC.LeaderUtils.Owner.Buffs.GetCustomVar("varNPCModMode");
float flHalt = entityNPC.LeaderUtils.Owner.Buffs.GetCustomVar("varNPCModStopAttacking");
if (flMode == 0)
{
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 7");
entityNPC.Buffs.AddBuff("buffNPCModFullControlMode");
}
else
{
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 8");
entityNPC.Buffs.RemoveBuff("buffNPCModFullControlMode");
}
if (flHalt == 1)
{
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 9");
entityNPC.Buffs.AddBuff("buffNPCModStopAttacking");
}
else
{
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 10");
entityNPC.Buffs.RemoveBuff("buffNPCModStopAttacking");
}
}
}
}
}