Ejemplo n.º 1
0
        public static void RECRUIT_ROTATINGFIRESHOT(SkillBaseEventArgs bargument)
        {
            int Lvldiff;

            SkillUsageEventArgs.SkillMatrix matrix;
            Actor asource = bargument.Sender as Actor;
            Actor atarget = bargument.Target as Actor;

            if (asource != null && atarget != null && bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                matrix        = arguments.GetDefaultSkillMatrix(asource, atarget);
                Lvldiff       = arguments.GetCappedLevelDifference(matrix);
                matrix[1, 3] += 100 + (50 * arguments.SkillLevel);
                matrix[4, 3] += (Lvldiff * 120);

                asource.Status.CurrentLp -= 1;
                if (arguments.IsMissed(matrix) || arguments.IsBlocked(matrix))
                {
                    return;
                }
                else
                {
                    arguments.Damage = arguments.GetDamage(matrix);
                    arguments.Damage = arguments.GetDefenseReduction(matrix, arguments.Damage);
                    arguments.IsCritical(matrix);
                }
            }
            else
            {
                bargument.Failed = true;
            }
        }
Ejemplo n.º 2
0
        public static void SWORDMAN_LONGSWORD(SkillBaseEventArgs bargument)
        {
            int Lvldiff;

            SkillUsageEventArgs.SkillMatrix matrix;
            Actor asource = bargument.Sender as Actor;
            Actor atarget = bargument.Target as Actor;

            if (asource != null && atarget != null && bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                Singleton.Additions.ApplyAddition(arguments.Addition, asource);
                matrix        = arguments.GetDefaultSkillMatrix(asource, atarget);
                Lvldiff       = arguments.GetCappedLevelDifference(matrix);
                matrix[4, 3] += (Lvldiff * 120);
                Singleton.Additions.DeapplyAddition(arguments.Addition, asource);

                if (arguments.IsMissed(matrix) || arguments.IsBlocked(matrix))
                {
                    return;
                }
                else
                {
                    arguments.CanCheckEquipmentDurabillity = true;
                    arguments.CanCheckWeaponDurabillity    = true;
                    arguments.Damage = arguments.GetDamage(matrix);
                    arguments.Damage = arguments.GetDefenseReduction(matrix, arguments.Damage);
                    arguments.IsCritical(matrix);
                }
            }
            else
            {
                bargument.Failed = true;
            }
        }
Ejemplo n.º 3
0
        private static void BaseMagicalAttack(SkillBaseEventArgs bargument)
        {
            int Lvldiff;

            SkillUsageEventArgs.SkillMatrix matrix;
            Actor asource = bargument.Sender as Actor;
            Actor atarget = bargument.Target as Actor;

            if (asource != null && atarget != null && bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                matrix        = arguments.GetMagicalSkillMatrix(asource, atarget);
                Lvldiff       = arguments.GetCappedLevelDifference(matrix);
                matrix[4, 3] += (Lvldiff * 120);
                matrix[0, 1]  = 0; matrix[1, 1] = 0;

                if (arguments.IsMissed(matrix) || arguments.IsBlocked(matrix))
                {
                    return;
                }
                else
                {
                    arguments.CanCheckEquipmentDurabillity = true;
                    arguments.CanCheckWeaponDurabillity    = true;
                    arguments.Damage = arguments.GetDamage(matrix);
                    arguments.Damage = arguments.GetDefenseReduction(matrix, arguments.Damage);
                    arguments.IsCritical(matrix);
                }
            }
            else
            {
                bargument.Failed = true;
            }
        }
Ejemplo n.º 4
0
        /// <remarks>
        /// Last time edited: 10-01-2008
        ///
        /// This script is invoked when player x uses his/hers
        /// promise stone. Basicly it's used to warp fast to your
        /// save location and warp back.
        ///
        /// Dungeon -> Village -> Dungeon: goes to dungeon lvl 1
        /// Village -> Village -> Village: stays on the current village
        /// Map -> Village -> Map: goes to the latest map restore point
        /// </remarks>
        public static void GENERAL_PROMISESTONE(SkillBaseEventArgs bargument)
        {
            if (bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                Character           current   = arguments.Sender as Character;
                Zone zone = current.currentzone;

                uint requiredzeny = (uint)((current.Level - 4) * 10);
                if (requiredzeny > current.ZENY)
                {
                    Common.Errors.GeneralErrorMessage(current, (uint)Generalerror.NotEnoughMoney);
                }

                WorldCoordinate lpos = current.lastlocation.map > 0 ? current.lastlocation : current.savelocation;
                WorldCoordinate spos = current.savelocation;
                if (current.currentzone.Type == ZoneType.Village)
                {
                    arguments.Failed = !CommonFunctions.Warp(current, lpos.map);
                }
                else
                {
                    arguments.Failed = !CommonFunctions.Warp(current, spos.map);
                }

                if (arguments.Failed == false)
                {
                    current.ZENY -= (uint)((current.Level - 4) * 10);
                    CommonFunctions.UpdateZeny(current);
                }
            }
        }
Ejemplo n.º 5
0
        public static void RECRUIT_LURINGSHOT(SkillBaseEventArgs bargument)
        {
            int Lvldiff;

            SkillUsageEventArgs.SkillMatrix matrix;
            Actor asource = bargument.Sender as Actor;
            Actor atarget = bargument.Target as Actor;

            if (asource != null && atarget != null && bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                matrix        = arguments.GetDefaultSkillMatrix(asource, atarget);
                Lvldiff       = arguments.GetCappedLevelDifference(matrix);
                matrix[4, 3] += (Lvldiff * 120);

                if (arguments.IsMissed(matrix) || arguments.IsBlocked(matrix))
                {
                    arguments.UpdateCancelAddition(1004901, 5000, 0, atarget);
                    return;
                }
                else
                {
                    arguments.CanCheckEquipmentDurabillity = true;
                    arguments.CanCheckWeaponDurabillity    = true;
                    arguments.Damage = 0;
                    arguments.Result = SkillBaseEventArgs.ResultType.NoDamage;
                    arguments.IsCritical(matrix);
                }
            }
            else
            {
                bargument.Failed = true;
            }
        }
Ejemplo n.º 6
0
        public static void ENCHANTER_CALLLIGHTING(SkillBaseEventArgs bargument)
        {
            int Lvldiff;

            SkillUsageEventArgs.SkillMatrix matrix;
            Actor asource = bargument.Sender as Actor;
            Actor atarget = bargument.Target as Actor;

            if (asource != null && atarget != null && bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                matrix        = arguments.GetDefaultSkillMatrix(asource, atarget);
                Lvldiff       = arguments.GetCappedLevelDifference(matrix);
                matrix[0, 3] += 70 + 30 * arguments.SkillLevel;
                matrix[1, 3] += 150 + (60 + (10 * arguments.SkillLevel));
                matrix[4, 3] += (Lvldiff * 120);

                if (arguments.IsMissed(matrix) || arguments.IsBlocked(matrix))
                {
                    return;
                }
                else
                {
                    arguments.CanCheckEquipmentDurabillity = true;
                    arguments.CanCheckWeaponDurabillity    = true;
                    arguments.Damage = arguments.GetDamage(matrix);
                    arguments.Damage = arguments.GetDefenseReduction(matrix, arguments.Damage);
                    arguments.IsCritical(matrix);
                }
            }
            else
            {
                bargument.Failed = true;
            }
        }
Ejemplo n.º 7
0
        public static void RECRUIT_AIMINGSHOT(SkillBaseEventArgs bargument)
        {
            int Lvldiff;

            SkillUsageEventArgs.SkillMatrix matrix;
            Actor asource = bargument.Sender as Actor;
            Actor atarget = bargument.Target as Actor;

            if (asource != null && atarget != null && bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                matrix        = arguments.GetDefaultSkillMatrix(asource, atarget);
                Lvldiff       = arguments.GetCappedLevelDifference(matrix);
                matrix[2, 3]  = 1200 + (int)((double)matrix[2, 3] * (double)((double)0.5 - ((double)0.05 * (double)arguments.SkillLevel)));
                matrix[4, 3] += (Lvldiff * 120);

                if (arguments.IsMissed(matrix) || arguments.IsBlocked(matrix))
                {
                    return;
                }
                else
                {
                    arguments.CanCheckEquipmentDurabillity = true;
                    arguments.CanCheckWeaponDurabillity    = true;
                    arguments.Damage = arguments.GetDamage(matrix);
                    arguments.Damage = arguments.GetDefenseReduction(matrix, arguments.Damage);
                    arguments.IsCritical(matrix);
                }
            }
            else
            {
                bargument.Failed = true;
            }
        }
Ejemplo n.º 8
0
        public static void SWORDMAN_COURAGEOUSASSAULT(SkillBaseEventArgs bargument)
        {
            int Lvldiff;

            SkillUsageEventArgs.SkillMatrix matrix;
            Actor asource = bargument.Sender as Actor;
            Actor atarget = bargument.Target as Actor;

            if (asource != null && atarget != null && bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                matrix        = arguments.GetDefaultSkillMatrix(asource, atarget);
                Lvldiff       = arguments.GetCappedLevelDifference(matrix);
                matrix[4, 3] += (Lvldiff * 120);

                if (arguments.IsMissed(matrix) || arguments.IsBlocked(matrix))
                {
                    return;
                }
                else
                {
                    arguments.CanCheckEquipmentDurabillity = true;
                    arguments.CanCheckWeaponDurabillity    = true;
                    arguments.Damage = arguments.GetDamage(matrix);
                    arguments.Damage = arguments.GetDefenseReduction(matrix, arguments.Damage);

                    switch (asource.Status.CurrentLp)
                    {
                    case 1:
                        arguments.Damage += (uint)(7 + arguments.SkillLevel);
                        break;

                    case 2:
                        arguments.Damage += (uint)(13 + arguments.SkillLevel * 2);
                        break;

                    case 3:
                        arguments.Damage += (uint)(21 + arguments.SkillLevel * 3);
                        break;

                    case 4:
                        arguments.Damage += (uint)(29 + arguments.SkillLevel * 4);
                        break;

                    case 5:
                        arguments.Damage += (uint)(37 + arguments.SkillLevel * 5);
                        break;
                    }

                    asource.Status.CurrentLp = 0;
                    asource.Status.Updates  |= 1;
                    arguments.IsCritical(matrix);
                }
            }
            else
            {
                bargument.Failed = true;
            }
        }
Ejemplo n.º 9
0
        public static void RECRUIT_POLLEOSHOT(SkillBaseEventArgs bargument)
        {
            int Lvldiff;

            SkillUsageEventArgs.SkillMatrix matrix;
            Actor asource = bargument.Sender as Actor;
            Actor atarget = bargument.Target as Actor;

            if (asource != null && atarget != null && bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                matrix        = arguments.GetDefaultSkillMatrix(asource, atarget);
                Lvldiff       = arguments.GetCappedLevelDifference(matrix);
                matrix[4, 3] += (Lvldiff * 120);

                switch (asource.Status.CurrentLp)
                {
                case 1:
                    matrix.matrix[1, 2] += (9 + 1 * arguments.SkillLevel);
                    break;

                case 2:
                    matrix.matrix[1, 2] += (19 + 2 * arguments.SkillLevel);
                    break;

                case 3:
                    matrix.matrix[1, 2] += (30 + 3 * arguments.SkillLevel);
                    break;

                case 4:
                    matrix.matrix[1, 2] += (42 + 4 * arguments.SkillLevel);
                    break;

                case 5:
                    matrix.matrix[1, 2] += (55 + 5 * arguments.SkillLevel);
                    break;
                }

                asource.Status.CurrentLp = 0;
                if (arguments.IsMissed(matrix) || arguments.IsBlocked(matrix))
                {
                    return;
                }
                else
                {
                    arguments.CanCheckEquipmentDurabillity = true;
                    arguments.CanCheckWeaponDurabillity    = true;
                    arguments.Damage = arguments.GetDamage(matrix);
                    arguments.Damage = arguments.GetDefenseReduction(matrix, arguments.Damage);
                    arguments.IsCritical(matrix);
                }
            }
            else
            {
                bargument.Failed = true;
            }
        }
Ejemplo n.º 10
0
 public static void RECRUIT_PREDATORFOCUS(SkillBaseEventArgs bargument)
 {
     if (bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
     {
         SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
         arguments.Result = SkillBaseEventArgs.ResultType.NoDamage;
         arguments.Damage = 0;
         Common.Skills.UpdateAddition(arguments.Target as Actor, arguments.Addition, 900000);
     }
 }
Ejemplo n.º 11
0
 public static void RECRUIT_TRACKING(SkillBaseEventArgs bargument)
 {
     if (bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
     {
         SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
         arguments.Result = Saga.SkillBaseEventArgs.ResultType.NoDamage;
         arguments.Damage = 0;
         arguments.Failed = false;
         Common.Skills.UpdateAddition(bargument.Target as Actor, arguments.Addition, 900000);
     }
 }
Ejemplo n.º 12
0
 public static void ENCHANTER_WEAPONBLESSING(SkillBaseEventArgs bargument)
 {
     if (bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
     {
         SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
         arguments.Result = Saga.SkillBaseEventArgs.ResultType.NoDamage;
         arguments.Damage = 0;
         arguments.Failed = false;
         Common.Skills.UpdateAddition(arguments.Target as Actor, arguments.Addition, 600000);
     }
 }
Ejemplo n.º 13
0
 public static void SWORDMAN_SHIELDBLOCK(SkillBaseEventArgs bargument)
 {
     if (bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
     {
         SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
         arguments.Result = Saga.SkillBaseEventArgs.ResultType.NoDamage;
         arguments.Damage = 0;
         arguments.Failed = false;
         Common.Skills.UpdateAddition(arguments.Target as Actor, arguments.Addition, 300000);
     }
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Use a offensive skills
        /// </summary>
        /// <param name="target"></param>
        /// <param name="source"></param>
        /// <param name="skillid"></param>
        /// <param name="skilltype"></param>
        /// <remarks>
        /// This functions is invoked by mob ai. The character has it's own skill handler
        /// inside the network client.
        /// </remarks>
        public static void OffensiveSkillUse(MapObject target, MapObject source, uint skillid, byte skilltype)
        {
            try
            {
                SkillUsageEventArgs argument = null;
                if (SkillUsageEventArgs.Create(skillid, source, target, out argument) && argument.Use())
                {
                    Predicate <Character> SendToCharacter = delegate(Character forwardTarget)
                    {
                        //Skill sucess
                        SMSG_OFFENSIVESKILL spkt = new SMSG_OFFENSIVESKILL();
                        spkt.SkillID     = skillid;
                        spkt.SkillType   = 1;
                        spkt.TargetActor = target.id;
                        spkt.SourceActor = source.id;
                        spkt.IsCritical  = (forwardTarget.id == source.id || forwardTarget.id == target.id) ? (byte)argument.Result : (byte)7;
                        spkt.Damage      = argument.Damage;
                        spkt.SessionId   = forwardTarget.id;
                        forwardTarget.client.Send((byte[])spkt);

                        //Process some general updates
                        if (forwardTarget._targetid == target.id)
                        {
                            Common.Actions.SelectActor(forwardTarget, target as Actor);
                        }
                        if (argument.TargetHasDied)
                        {
                            Common.Actions.UpdateStance(forwardTarget, target as Actor);
                        }
                        if (argument.TargetHasDied && MapObject.IsNpc(target))
                        {
                            Common.Actions.UpdateIcon(forwardTarget, target as BaseMob);
                        }
                        if (forwardTarget.id == target.id)
                        {
                            LifeCycle.Update(forwardTarget);
                        }

                        return(true);
                    };

                    Regiontree tree = source.currentzone.Regiontree;
                    foreach (Character forwardTarget in tree.SearchActors(source, SearchFlags.Characters))
                    {
                        SendToCharacter(forwardTarget);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 15
0
 public static void GENERAL_EMOTICON(SkillBaseEventArgs bargument)
 {
     if (bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
     {
         SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
         arguments.Result = SkillBaseEventArgs.ResultType.NoDamage;
         arguments.Damage = 0;
         arguments.CanCheckEquipmentDurabillity = false;
         arguments.CanCheckWeaponDurabillity    = false;
         arguments.Failed = false;
     }
 }
Ejemplo n.º 16
0
 public static void CLOWN_FRESHAIR(SkillBaseEventArgs bargument)
 {
     if (bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
     {
         SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
         arguments.Result = Saga.SkillBaseEventArgs.ResultType.NoDamage;
         arguments.Damage = 0;
         arguments.Failed = false;
         Common.Skills.UpdateAddition(bargument.Target as Actor, arguments.Addition, 600000);
         //Do lp effect
         Common.Skills.DoAddition(bargument.Sender as Actor, bargument.Target as Actor, 1003301);
     }
 }
Ejemplo n.º 17
0
        public static void NOVICE_TENSION(SkillBaseEventArgs bargument)
        {
            Actor asource = bargument.Sender as Actor;

            if (bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                Singleton.Additions.ApplyAddition(arguments.Addition, asource);
                arguments.Result = Saga.SkillBaseEventArgs.ResultType.NoDamage;
                arguments.Damage = 0;
                arguments.Failed = false;
                Singleton.Additions.DeapplyAddition(arguments.Addition, asource);
            }
        }
Ejemplo n.º 18
0
        public static void ENCHANTER_HEAL(SkillBaseEventArgs bargument)
        {
            Actor asource = bargument.Sender as Actor;
            Actor atarget = bargument.Target as Actor;

            if (bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                Singleton.Additions.ApplyAddition(arguments.Addition, atarget);
                arguments.Result = Saga.SkillBaseEventArgs.ResultType.Heal;
                arguments.Damage = 0;
                arguments.Failed = false;
                Singleton.Additions.DeapplyAddition(arguments.Addition, atarget);
            }
        }
Ejemplo n.º 19
0
 public static void THIEF_DISGUISE(SkillBaseEventArgs bargument)
 {
     if (bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
     {
         SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
         Actor starget = arguments.Sender as Actor;
         if (starget is Actor)
         {
             Common.Skills.UpdateAddition(starget, arguments.Addition, 240000);
         }
         else
         {
             arguments.Failed = true;
         }
     }
 }
Ejemplo n.º 20
0
        public static void GENERAL_OPENBOX(SkillBaseEventArgs bargument)
        {
            if (bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;

                if (arguments.Target is OpenBox)
                {
                    OpenBox current = arguments.Target as OpenBox;
                    arguments.Result = Saga.SkillBaseEventArgs.ResultType.NoDamage;
                    arguments.Damage = 0;
                    arguments.Failed = false;
                    current.OnOpenBox(arguments.Sender as Character);
                }
            }
        }
Ejemplo n.º 21
0
        public static void RECRUIT_FINALBLOW(SkillBaseEventArgs bargument)
        {
            int Lvldiff;

            SkillUsageEventArgs.SkillMatrix matrix;
            Actor asource = bargument.Sender as Actor;
            Actor atarget = bargument.Target as Actor;

            if (asource != null && atarget != null && bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                //Apply additions and deapply after
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                Singleton.Additions.ApplyAddition(arguments.Addition, asource);
                matrix = arguments.GetDefaultSkillMatrix(asource, atarget);
                Singleton.Additions.DeapplyAddition(arguments.Addition, asource);

                //Calculation
                Lvldiff       = arguments.GetCappedLevelDifference(matrix);
                matrix[4, 3] += (Lvldiff * 120);

                //Remove all LP
                asource.Status.CurrentLp = 0;
                asource.Status.Updates  |= 1;

                if (arguments.IsMissed(matrix) || arguments.IsBlocked(matrix))
                {
                    return;
                }
                else
                {
                    arguments.CanCheckEquipmentDurabillity = true;
                    arguments.CanCheckWeaponDurabillity    = true;
                    arguments.Damage = arguments.GetDamage(matrix);
                    arguments.Damage = arguments.GetDefenseReduction(matrix, arguments.Damage);
                    if (arguments.Damage >= atarget.Status.CurrentHp)
                    {
                        asource.Status.CurrentLp = 7;
                    }
                    arguments.IsCritical(matrix);
                }
            }
            else
            {
                bargument.Failed = true;
            }
        }
Ejemplo n.º 22
0
        public static void CLOWN_SELFHEAL(SkillBaseEventArgs bargument)
        {
            Actor asource = bargument.Sender as Actor;
            Actor atarget = bargument.Target as Actor;

            if (bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                Singleton.Additions.ApplyAddition(arguments.Addition, asource);
                arguments.Result = Saga.SkillBaseEventArgs.ResultType.Heal;
                arguments.Damage = 0;
                arguments.Failed = false;
                Singleton.Additions.DeapplyAddition(arguments.Addition, asource);
                //Do lp effect
                Common.Skills.DoAddition(bargument.Sender as Actor, bargument.Target as Actor, 1003301);
            }
        }
Ejemplo n.º 23
0
 public static void GENERAL_VADONMAGIC(SkillBaseEventArgs bargument)
 {
     if (bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
     {
         SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
         arguments.Result = Saga.SkillBaseEventArgs.ResultType.NoDamage;
         arguments.Damage = 0;
         if (arguments.Target.ModelId == 40004)
         {
             arguments.Failed = !Common.Items.GiveItem(arguments.Sender as Character, 0, 0);
         }
         else
         {
             arguments.Failed = true;
         }
     }
 }
Ejemplo n.º 24
0
        public static void THIEF_TEARINGWOUND(SkillBaseEventArgs bargument)
        {
            int  Lvldiff;
            int  rand;
            uint aID;

            SkillUsageEventArgs.SkillMatrix matrix;
            Actor asource = bargument.Sender as Actor;
            Actor atarget = bargument.Target as Actor;

            if (asource != null && atarget != null && bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                matrix        = arguments.GetDefaultSkillMatrix(asource, atarget);
                Lvldiff       = arguments.GetCappedLevelDifference(matrix);
                rand          = (15 * arguments.SkillLevel);
                aID           = (uint)(50551200 + arguments.SkillLevel);
                matrix[1, 2]  = (int)((double)(matrix[1, 2]) * (double)(0.7 + 0.05 * arguments.SkillLevel));
                matrix[2, 3]  = (int)((double)(matrix[2, 3]) * (double)(1.3 + 0.05 * arguments.SkillLevel));
                matrix[4, 3] += (Lvldiff * 120);

                if (arguments.IsMissed(matrix) || arguments.IsBlocked(matrix))
                {
                    return;
                }
                else
                {
                    arguments.CanCheckEquipmentDurabillity = true;
                    arguments.CanCheckWeaponDurabillity    = true;
                    arguments.DoLpIncrease(asource);
                    arguments.Damage = arguments.GetDamage(matrix);
                    arguments.Damage = arguments.GetDefenseReduction(matrix, arguments.Damage);
                    arguments.IsCritical(matrix);
                    if (arguments.SkillRand(rand))                               // 15% x SkillLVL chance
                    {
                        Common.Skills.UpdateAddition(atarget, (uint)aID, 10000); // Bleeding
                    }
                }
            }
            else
            {
                bargument.Failed = true;
            }
        }
Ejemplo n.º 25
0
        public static void THIEF_HEMORRAGE(SkillBaseEventArgs bargument)
        {
            int Lvldiff;

            SkillUsageEventArgs.SkillMatrix matrix;
            Actor asource = bargument.Sender as Actor;
            Actor atarget = bargument.Target as Actor;

            if (asource != null && atarget != null && bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                matrix        = arguments.GetDefaultSkillMatrix(asource, atarget);
                Lvldiff       = arguments.GetCappedLevelDifference(matrix);
                matrix[1, 2]  = (int)((double)(matrix[1, 2]) * (double)(0.7 + 0.05 * arguments.SkillLevel));
                matrix[2, 3]  = (int)((double)(matrix[2, 3]) * (double)(1.3 + 0.05 * arguments.SkillLevel));
                matrix[4, 3] += (Lvldiff * 120);

                if (arguments.IsMissed(matrix) || arguments.IsBlocked(matrix))
                {
                    return;
                }
                else
                {
                    if (Common.Skills.HasAddition(atarget, arguments.Addition))
                    {
                        Common.Skills.UpdateAddition(atarget, arguments.Addition, 30000);                         // Increase Timing of Bleeding
                        arguments.CanCheckEquipmentDurabillity = true;
                        arguments.CanCheckWeaponDurabillity    = true;
                        arguments.DoLpIncrease(asource);
                        arguments.Damage = arguments.GetDamage(matrix);
                        arguments.Damage = arguments.GetDefenseReduction(matrix, arguments.Damage);
                        arguments.IsCritical(matrix);
                    }
                    else
                    {
                        return;
                    }
                }
            }
            else
            {
                bargument.Failed = true;
            }
        }
Ejemplo n.º 26
0
        //Base Derived Members

        #region MabObject Members

        /// <summary>
        /// Occurs when a skill is used on this actor
        /// </summary>
        /// <param name="source">Source actor inflicting the skill</param>
        /// <param name="e">Argument with information</param>
        public override void OnSkillUsedByTarget(MapObject source, SkillBaseEventArgs argument)
        {
            try
            {
                if (argument.Context == SkillContext.SkillUse)
                {
                    SkillUsageEventArgs d = (SkillUsageEventArgs)argument;
                    //Add damage
                    if (argument.Result == SkillBaseEventArgs.ResultType.Normal || d.Result == SkillBaseEventArgs.ResultType.Critical)
                    {
                        damagetable.Add(source, d.Damage);
                    }
                }

                if (argument.SpellInfo.hate > 0)
                {
                    //Add hate
                    hatetable.Add(source, argument.SpellInfo.hate);

                    //Subscribe if not subscribed yet
                    if (this.BattleState.IsSubscribed == false)
                    {
                        SwitchSpeed(_RUNSPEED);
                        Saga.Tasks.BattleThread.Subscribe(this);
                    }

                    //Been Attacked
                    OnBeenAttacked(source);
                }
            }
            catch (Exception)
            {
                Trace.TraceError("Error casting skill on {0} from {1}", this, source);
            }
            finally
            {
                //Always call the base aprent
                base.OnSkillUsedByTarget(source, argument);
            }
        }
Ejemplo n.º 27
0
        public static void THIEF_FATALBLOW(SkillBaseEventArgs bargument)
        {
            int Lvldiff;
            int cLP;

            SkillUsageEventArgs.SkillMatrix matrix;
            Actor asource = bargument.Sender as Actor;
            Actor atarget = bargument.Target as Actor;

            if (asource != null && atarget != null && bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                Singleton.Additions.ApplyAddition(arguments.Addition, asource);
                matrix        = arguments.GetDefaultSkillMatrix(asource, atarget);
                Lvldiff       = arguments.GetCappedLevelDifference(matrix);
                cLP           = asource.Status.CurrentLp;
                matrix[1, 3]  = (int)((double)matrix[1, 3] * (1.45 + 0.05 * arguments.SkillLevel) + ((cLP * (30 * arguments.SkillLevel)) * 2));
                matrix[0, 3] *= (int)(matrix[0, 3] * 1.2);
                matrix[4, 3] += (Lvldiff * 120);
                Singleton.Additions.DeapplyAddition(arguments.Addition, asource);

                if (arguments.IsMissed(matrix) || arguments.IsBlocked(matrix))
                {
                    return;
                }
                else
                {
                    arguments.CanCheckEquipmentDurabillity = true;
                    arguments.CanCheckWeaponDurabillity    = true;
                    arguments.Damage = arguments.GetDamage(matrix);
                    arguments.Damage = arguments.GetDefenseReduction(matrix, arguments.Damage);
                    arguments.IsCritical(matrix);
                }
            }
            else
            {
                bargument.Failed = true;
            }
        }
Ejemplo n.º 28
0
        public static void RECRUIT_PIERCINGSHOT(SkillBaseEventArgs bargument)
        {
            int Lvldiff;

            SkillUsageEventArgs.SkillMatrix matrix;
            Actor asource = bargument.Sender as Actor;
            Actor atarget = bargument.Target as Actor;

            if (asource != null && atarget != null && bargument.Context == Saga.Enumarations.SkillContext.SkillUse)
            {
                SkillUsageEventArgs arguments = (SkillUsageEventArgs)bargument;
                matrix  = arguments.GetDefaultSkillMatrix(asource, atarget);
                Lvldiff = arguments.GetCappedLevelDifference(matrix);

                //Increase both Maximum and minimum attack of yourself and removes the armor
                matrix.matrix[0, 0] += matrix[3, 0];
                matrix.matrix[1, 0] += matrix[3, 0];
                matrix.matrix[3, 0]  = 0;
                matrix[4, 3]        += (Lvldiff * 120);

                if (arguments.IsMissed(matrix) || arguments.IsBlocked(matrix))
                {
                    return;
                }
                else
                {
                    arguments.Damage = arguments.GetDamage(matrix);
                    arguments.Damage = arguments.GetDefenseReduction(matrix, arguments.Damage);
                    arguments.IsCritical(matrix);
                }
            }
            else
            {
                bargument.Failed = true;
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Occurs when using an offensive skill
        /// </summary>
        /// <param name="cpkt"></param>
        private void CM_USEOFFENSIVESKILL(CMSG_OFFENSIVESKILL cpkt)
        {
            lock (this.character.cooldowncollection)
            {
                try
                {
                    MapObject           target;
                    uint                skillid   = cpkt.SkillID;
                    byte                skilltype = cpkt.SkillType;
                    SkillUsageEventArgs argument  = null;

                    bool cancast = Regiontree.TryFind(cpkt.TargetActor, this.character, out target) &&
                                   SkillUsageEventArgs.Create(skillid, this.character, target, out argument) &&
                                   argument.SpellInfo.casttime > -1 && (argument.SpellInfo.casttime == 0 || this.character._lastcastedskill == skillid) &&
                                   ((long)((uint)Environment.TickCount) - this.character._lastcastedtick) > 0 &&
                                   (argument.SpellInfo.delay == 0 || !this.character.cooldowncollection.IsCoolDown(skillid)) &&
                                   (argument.SpellInfo.maximumrange == 0 || argument.SpellInfo.IsInRangeOf((int)(Vector.GetDistance2D(this.character.Position, target.Position)))) &&
                                   argument.SpellInfo.requiredWeapons[this.character.weapons.GetCurrentWeaponType()] == 1 &&
                                   this.character.jlvl >= argument.SpellInfo.requiredJobs[this.character.job - 1] &&
                                   this.character.Status.CurrentLp >= (argument.SpellInfo.requiredlp == 6?1:argument.SpellInfo.requiredlp) &&
                                   argument.SpellInfo.IsTarget(this.character, target);

                    if (cancast && argument.Use())
                    {
                        //Clear casted skill
                        this.character._lastcastedskill = 0;
                        this.character._lastcastedtick  = Environment.TickCount;

                        //Set cooldown timer
                        int delay = (int)(argument.SpellInfo.delay - ((character.stats.Dexterity * 2) + (character.stats.Concentration * 2)));
                        if (delay > 0)
                        {
                            this.character.cooldowncollection.Add(skillid, delay);
                        }
                        this.character.cooldowncollection.Update();

                        //Use required sp points
                        if (argument.SpellInfo.SP > -1)
                        {
                            this.character.LASTSP_TICK = Environment.TickCount;
                            this.character.SP          = (ushort)(this.character.SP - argument.SpellInfo.SP);
                        }
                        //Set sp to 0
                        else if (argument.SpellInfo.SP == -1)
                        {
                            this.character.LASTSP_TICK = Environment.TickCount;
                            this.character.SP          = 0;
                        }

                        //Use required lp points
                        if (argument.SpellInfo.requiredlp == 6)
                        {
                            this.character._status.CurrentLp = 0;
                            this.character._status.Updates  |= 1;
                        }
                        else if (argument.SpellInfo.requiredlp > 0)
                        {
                            this.character._status.CurrentLp -= argument.SpellInfo.requiredlp;
                            this.character._status.Updates   |= 1;
                        }

                        //Add intergrated durabillity checks
                        if (argument.CanCheckWeaponDurabillity)
                        {
                            Common.Durabillity.DoWeapon(this.character);
                        }

                        //Skill sucess
                        Predicate <Character> SendToCharacter = delegate(Character forwardTarget)
                        {
                            //Skill sucess
                            SMSG_OFFENSIVESKILL spkt = new SMSG_OFFENSIVESKILL();
                            spkt.SkillID     = cpkt.SkillID;
                            spkt.SkillType   = cpkt.SkillType;
                            spkt.TargetActor = cpkt.TargetActor;
                            spkt.SourceActor = this.character.id;
                            spkt.IsCritical  = (forwardTarget.id == this.character.id || forwardTarget.id == target.id) ? (byte)argument.Result : (byte)7;
                            spkt.Damage      = argument.Damage;
                            spkt.SessionId   = forwardTarget.id;
                            forwardTarget.client.Send((byte[])spkt);

                            //Process some general updates
                            if (forwardTarget._targetid == target.id)
                            {
                                Common.Actions.SelectActor(forwardTarget, target as Actor);
                            }
                            if (argument.TargetHasDied)
                            {
                                Common.Actions.UpdateStance(forwardTarget, target as Actor);
                            }
                            if (argument.TargetHasDied && MapObject.IsNpc(target))
                            {
                                Common.Actions.UpdateIcon(forwardTarget, target as BaseMob);
                            }
                            return(true);
                        };

                        SendToCharacter(this.character);
                        Regiontree tree = this.character.currentzone.Regiontree;
                        foreach (Character forwardTarget in tree.SearchActors(this.character, SearchFlags.Characters))
                        {
                            if (forwardTarget.id == this.character.id)
                            {
                                continue;
                            }
                            SendToCharacter(forwardTarget);
                        }

                        //Always update myself and oponent if it's character
                        LifeCycle.Update(this.character);
                        if (MapObject.IsPlayer(target))
                        {
                            LifeCycle.Update(target as Character);
                        }
                    }
                    else
                    {
                        //Skill failed
                        SMSG_OFFENSIVESKILLFAILED spkt = new SMSG_OFFENSIVESKILLFAILED();
                        spkt.SkillID     = cpkt.SkillID;
                        spkt.SkillType   = cpkt.SkillType;
                        spkt.SourceActor = this.character.id;
                        spkt.SessionId   = this.character.id;
                        this.Send((byte[])spkt);
                    }
                }
                catch (Exception e)
                {
                    Trace.TraceError("Exception processing the skill {0}", e.ToString());

                    //Skill failed
                    SMSG_OFFENSIVESKILLFAILED spkt = new SMSG_OFFENSIVESKILLFAILED();
                    spkt.SkillID     = cpkt.SkillID;
                    spkt.SkillType   = cpkt.SkillType;
                    spkt.SourceActor = this.character.id;
                    spkt.SessionId   = this.character.id;
                    this.Send((byte[])spkt);
                }
            }
        }