本文整理匯總了C#中Server.MirObjects.MapObject.AddBuff方法的典型用法代碼示例。如果您正苦於以下問題:C# MapObject.AddBuff方法的具體用法?C# MapObject.AddBuff怎麽用?C# MapObject.AddBuff使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server.MirObjects.MapObject
的用法示例。
在下文中一共展示了MapObject.AddBuff方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: UltimateEnhancer
private void UltimateEnhancer(MapObject target, UserMagic magic, out bool cast)
{
cast = false;
if (target == null || !target.IsFriendlyTarget(this)) return;
UserItem item = GetAmulet(1);
if (item == null) return;
long expiretime = GetAttackPower(MinSC, MaxSC) * 2 + (magic.Level + 1) * 10;
int value = MaxSC >= 5 ? Math.Min(8, MaxSC / 5) : 1;
switch (target.Race)
{
case ObjectType.Monster:
case ObjectType.Player:
//Only targets
if (target.IsFriendlyTarget(this))
{
target.AddBuff(new Buff { Type = BuffType.UltimateEnhancer, Caster = this, ExpireTime = Envir.Time + expiretime * 1000, Values = new int[] { value } });
target.OperateTime = 0;
LevelMagic(magic);
ConsumeItem(item, 1);
cast = true;
}
break;
}
}
示例2: EnergyShield
private void EnergyShield(MapObject target, UserMagic magic, out bool cast)
{
cast = false;
if (!target.IsFriendlyTarget(this)) target = this; //offical is only party target
int duration = 30 + 50 * magic.Level;
int power = GetAttackPower(magic.GetPower(MinSC), magic.GetPower(MaxSC) + 1);
int chance = 9 - (Luck / 3 + magic.Level);
int[] values = { chance < 2 ? 2 : chance, power };
switch (target.Race)
{
case ObjectType.Player:
//Only targets
if (target.IsFriendlyTarget(this))
{
target.AddBuff(new Buff { Type = BuffType.EnergyShield, Caster = this, ExpireTime = Envir.Time + duration * 1000, Visible = true, Values = values });
target.OperateTime = 0;
LevelMagic(magic);
cast = true;
}
break;
}
}