本文整理匯總了C#中Server.MirObjects.MonsterObject.Broadcast方法的典型用法代碼示例。如果您正苦於以下問題:C# MonsterObject.Broadcast方法的具體用法?C# MonsterObject.Broadcast怎麽用?C# MonsterObject.Broadcast使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server.MirObjects.MonsterObject
的用法示例。
在下文中一共展示了MonsterObject.Broadcast方法的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 });
}