50 lines
1.8 KiB
C#
50 lines
1.8 KiB
C#
public class MinEventActionAddBuffRebirth : MinEventActionBuffModifierBase
|
|
{
|
|
public override void Execute(MinEventParams _params)
|
|
{
|
|
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
|
|
|
bool flag = !_params.Self.isEntityRemote | _params.IsLocal;
|
|
int num = -1;
|
|
if (_params.Buff != null)
|
|
{
|
|
num = _params.Buff.InstigatorId;
|
|
}
|
|
if (num == -1)
|
|
{
|
|
num = _params.Self.entityId;
|
|
}
|
|
for (int i = 0; i < this.targets.Count; i++)
|
|
{
|
|
float num2 = 0f;
|
|
for (int j = 0; j < this.buffNames.Length; j++)
|
|
{
|
|
string name = this.buffNames[j];
|
|
if (BuffManager.GetBuff(name) != null)
|
|
{
|
|
if (this.buffOneOnly && this.buffWeights != null)
|
|
{
|
|
num2 += this.buffWeights[j];
|
|
if (num2 >= this.targets[i].rand.RandomFloat)
|
|
{
|
|
primaryPlayer.Buffs.AddBuff(name, num, flag && this.targets[i].isEntityRemote, false);
|
|
break;
|
|
}
|
|
}
|
|
else if (this.buffWeights != null)
|
|
{
|
|
if (this.buffWeights[j] >= this.targets[i].rand.RandomFloat)
|
|
{
|
|
primaryPlayer.Buffs.AddBuff(name, num, flag && this.targets[i].isEntityRemote, false);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
primaryPlayer.Buffs.AddBuff(name, num, flag && this.targets[i].isEntityRemote, false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|