本文整理汇总了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;
}
}