當前位置: 首頁>>代碼示例>>C#>>正文


C# MapObject.AddBuff方法代碼示例

本文整理匯總了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;
            }
        }
開發者ID:thedeaths,項目名稱:official-mir2c-,代碼行數:27,代碼來源:PlayerObject.cs

示例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;
            }
        }
開發者ID:thedeaths,項目名稱:official-mir2c-,代碼行數:26,代碼來源:PlayerObject.cs


注:本文中的Server.MirObjects.MapObject.AddBuff方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。