本文整理汇总了C#中Server.MirObjects.MonsterObject.BroadcastHealthChange方法的典型用法代码示例。如果您正苦于以下问题:C# MonsterObject.BroadcastHealthChange方法的具体用法?C# MonsterObject.BroadcastHealthChange怎么用?C# MonsterObject.BroadcastHealthChange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.MirObjects.MonsterObject
的用法示例。
在下文中一共展示了MonsterObject.BroadcastHealthChange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ElectricShock
private void ElectricShock(MonsterObject target, UserMagic magic)
{
if (target == null || !target.IsAttackTarget(this)) return;
if (Envir.Random.Next(4 - magic.Level) > 0)
{
if (Envir.Random.Next(2) == 0) LevelMagic(magic);
return;
}
LevelMagic(magic);
if (target.Master == this)
{
target.ShockTime = Envir.Time + (magic.Level * 5 + 10) * 1000;
target.Target = null;
return;
}
if (Envir.Random.Next(2) > 0)
{
target.ShockTime = Envir.Time + (magic.Level * 5 + 10) * 1000;
target.Target = null;
return;
}
if (target.Level > Level + 2 || !target.Info.CanTame) return;
if (Envir.Random.Next(Level + 20 + magic.Level * 5) <= target.Level + 10)
{
if (Envir.Random.Next(5) > 0 && target.Master == null)
{
target.RageTime = Envir.Time + (Envir.Random.Next(20) + 10) * 1000;
target.Target = null;
}
return;
}
if (Pets.Count(t => !t.Dead) >= magic.Level + 2) return;
int rate = (int)(target.MaxHP / 100);
if (rate <= 2) rate = 2;
else rate *= 2;
if (Envir.Random.Next(rate) != 0) return;
//else if (Envir.Random.Next(20) == 0) target.Die();
if (target.Master != null)
{
target.SetHP(target.MaxHP / 10);
target.Master.Pets.Remove(target);
}
else if (target.Respawn != null)
{
target.Respawn.Count--;
Envir.MonsterCount--;
CurrentMap.MonsterCount--;
target.Respawn = null;
}
target.Master = this;
//target.HealthChanged = true;
target.BroadcastHealthChange();
Pets.Add(target);
target.Target = null;
target.RageTime = 0;
target.ShockTime = 0;
target.OperateTime = 0;
target.MaxPetLevel = (byte)(1 + magic.Level * 2);
target.Broadcast(new S.ObjectName { ObjectID = target.ObjectID, Name = target.Name });
}