157 lines
6.8 KiB
C#
157 lines
6.8 KiB
C#
using Audio;
|
|
using System.Collections.Generic;
|
|
using System.Xml.Linq;
|
|
|
|
public class MinEventActionAoEEffectRebirth : MinEventActionRemoveBuff
|
|
{
|
|
private string strEffect = "";
|
|
private string strDistance = "";
|
|
private string strHeight = "";
|
|
private string strSound = "";
|
|
public int minMax = 40;
|
|
|
|
public override void Execute(MinEventParams _params)
|
|
{
|
|
///Log.Out("MinEventActionAoEEffectRebirth-Execute START");
|
|
|
|
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
|
{
|
|
///Log.Out("MinEventActionAoEEffectRebirth-Execute IS CLIENT");
|
|
return;
|
|
}
|
|
|
|
Vector3 transformPos = MinEventParams.CachedEventParam.Position;
|
|
|
|
bool canPlaySound = false;
|
|
|
|
if (strEffect == "MindControl")
|
|
{
|
|
///Log.Out("MinEventActionAoEEffectRebirth-Execute 1");
|
|
List<Entity> entitiesInBounds = GameManager.Instance.World.GetEntitiesInBounds(typeof(EntityZombieSDX), BoundsUtils.BoundsForMinMax(transformPos.x - this.minMax, transformPos.y - 50, transformPos.z - this.minMax, transformPos.x + this.minMax, transformPos.y + 30, transformPos.z + this.minMax), new List<Entity>());
|
|
//List<Entity> entitiesInBounds2 = GameManager.Instance.World.GetEntitiesInBounds(typeof(EntityZombieCopRebirth), BoundsUtils.BoundsForMinMax(transformPos.x - this.minMax, transformPos.y - 50, transformPos.z - this.minMax, transformPos.x + this.minMax, transformPos.y + 30, transformPos.z + this.minMax), new List<Entity>());
|
|
|
|
var player = _params.Self as EntityPlayer;
|
|
|
|
if (player)
|
|
{
|
|
///Log.Out("MinEventActionAoEEffectRebirth-Execute player: " + player.name);
|
|
|
|
int progressionLevel = 0;
|
|
|
|
ProgressionValue progressionValue = player.Progression.GetProgressionValue("FuriousRamsayPerkBlackMagic");
|
|
if (progressionValue != null)
|
|
{
|
|
///Log.Out("MinEventActionAoEEffectRebirth-Execute 2");
|
|
progressionLevel = progressionValue.Level;
|
|
}
|
|
else
|
|
{
|
|
///Log.Out("MinEventActionAoEEffectRebirth-Execute 3");
|
|
return;
|
|
}
|
|
|
|
///Log.Out("MinEventActionAoEEffectRebirth-Execute 4");
|
|
if (entitiesInBounds != null && entitiesInBounds.Count > 0)
|
|
{
|
|
for (int i = 0; i < entitiesInBounds.Count; i++)
|
|
{
|
|
EntityZombieSDX entity = (EntityZombieSDX)entitiesInBounds[i];
|
|
///Log.Out("===============================================================");
|
|
///Log.Out("MinEventActionAoEEffectRebirth-Execute 5 entity: " + entity.EntityClass.entityClassName);
|
|
|
|
if (entity != null)
|
|
{
|
|
///Log.Out("MinEventActionAoEEffectRebirth-Execute 6");
|
|
bool isFeral = entity.HasAnyTags(FastTags<TagGroup.Global>.Parse("feral"));
|
|
bool isRadiated = entity.HasAnyTags(FastTags<TagGroup.Global>.Parse("radiated"));
|
|
bool isTainted = entity.HasAnyTags(FastTags<TagGroup.Global>.Parse("tainted"));
|
|
bool isBear = entity.HasAnyTags(FastTags<TagGroup.Global>.Parse("bear"));
|
|
|
|
bool isBoss = entity.HasAnyTags(FastTags<TagGroup.Global>.Parse("boss"));
|
|
bool hasMindControl1 = entity.Buffs.HasBuff("FuriousRamsayRangedMindControlBuffTier1");
|
|
bool hasMindControl2 = entity.Buffs.HasBuff("FuriousRamsayRangedMindControlBuffTier2");
|
|
bool hasMindControl3 = entity.Buffs.HasBuff("FuriousRamsayRangedMindControlBuffTier3");
|
|
bool hasBossBuff = entity.Buffs.HasBuff("FuriousRamsayBossBuff");
|
|
|
|
bool canExecute = (!isBoss &&
|
|
!hasMindControl1 &&
|
|
!hasMindControl2 &&
|
|
!hasMindControl3 &&
|
|
!isTainted &&
|
|
!hasBossBuff
|
|
);
|
|
|
|
string buff = "FuriousRamsayRangedMindControlBuffTier3";
|
|
|
|
if (progressionLevel < 4)
|
|
{
|
|
canExecute = canExecute &&
|
|
(!isFeral &&
|
|
!isRadiated &&
|
|
!isBear
|
|
);
|
|
buff = "FuriousRamsayRangedMindControlBuffTier1";
|
|
}
|
|
else if (progressionLevel >= 4 && progressionLevel < 7)
|
|
{
|
|
canExecute = canExecute &&
|
|
(!isRadiated &&
|
|
!isBear
|
|
);
|
|
buff = "FuriousRamsayRangedMindControlBuffTier2";
|
|
}
|
|
|
|
if (canExecute)
|
|
{
|
|
///Log.Out("MinEventActionAoEEffectRebirth-Execute 7");
|
|
entity.Buffs.AddBuff("FuriousRamsayMindControlBonus" + progressionLevel);
|
|
entity.Buffs.AddBuff(buff);
|
|
entity.Buffs.AddBuff("FuriousRamsayMindControlParticle");
|
|
canPlaySound = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (strSound.Trim().Length > 0 && canPlaySound)
|
|
{
|
|
///Log.Out("MinEventActionAoEEffectRebirth-Execute PLAY SOUND");
|
|
Manager.BroadcastPlay(strSound);
|
|
}
|
|
///Log.Out("MinEventActionAoEEffectRebirth-Execute END");
|
|
}
|
|
|
|
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 == "effect")
|
|
{
|
|
strEffect = _attribute.Value;
|
|
return true;
|
|
}
|
|
else if (name == "minMax")
|
|
{
|
|
minMax = int.Parse(_attribute.Value);
|
|
return true;
|
|
}
|
|
else if (name == "sound")
|
|
{
|
|
strSound = _attribute.Value;
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
} |