Пример #1
0
 public static uint MagicalAttack(ref Actor sActor, ref Actor dActor, uint damage, AttackElements element, ref Map.SkillArgs args)
 {
     //TODO:
     //Damage calculation and magical resists.
     if (args.isCritical == Map.SkillArgs.AttackResult.Critical)
     {
         damage = damage * 2;
         args.damage = damage;
     }
     SkillAttack(ref sActor, ref dActor, damage, ref args);
     return damage;
 }
Пример #2
0
        public static uint PhysicalAttack(ref Actor sActor, ref Actor dActor, uint damage, AttackElements element,ref Map.SkillArgs args)
        {
            //Real damage calculation
            if (element != AttackElements.NATRAL)
            {
                if (damage > (uint.MaxValue / 2)) damage = 0;
                if (args.isCritical == Map.SkillArgs.AttackResult.Critical)
                {
                    damage = damage * 2;
                    args.damage = damage;
                }
                float reduced;
                if (dActor.BattleStatus.def < 1000)
                {
                    reduced = ((float)(dActor.BattleStatus.def) / 1000) * damage;
                    damage -= (uint)reduced;
                    args.damage = damage;
                }
                else
                {
                    damage = 0;
                    args.damage = 0;
                    args.isCritical = Map.SkillArgs.AttackResult.Block;
                }
            }
            //Shield Block: Damage reduction
            if (sActor.BattleStatus.Additions.ContainsKey("ShieldBlock"))
            {
                damage = (uint)(damage * 0.7);
            }
            //Shiel Block: Attack reflection
            if (dActor.BattleStatus.Additions.ContainsKey("ShieldBlock"))
            {
                Addition addition = dActor.BattleStatus.Additions["ShieldBlock"];

                Map.SkillArgs newarg = new Map.SkillArgs(args.skillType, args.isCritical, (uint)SkillIDs.ShieldBlock, sActor.id, 0);
                Map map;
                newarg.damage = (uint)(damage * (0.07 + 0.03));
                if (MapManager.Instance.GetMap(dActor.mapID, out map))
                {
                    map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.SKILL, newarg, dActor, true);
                    SkillAttack(ref dActor, ref sActor, newarg.damage, ref newarg);
                }
            }
            SkillAttack(ref sActor, ref dActor, damage, ref args);
            return damage;
        }
Пример #3
0
 private void ParseData()
 {
     Id = ReadByte(EnemyOffsets.Id);
     foreach (var s in DataInterpreter.ConvertElements(RawAttackElement))
     {
         AttackElements.Add(s);
     }
     foreach (var s in DataInterpreter.ConvertElements(RawWeakness))
     {
         ElementalWeaknesses.Add(s);
     }
     foreach (var s in DataInterpreter.ConvertElements(RawResistance))
     {
         ElementalResistances.Add(s);
     }
     foreach (var s in DataInterpreter.ConvertElements(RawAbsorb))
     {
         ElementalAbsorbs.Add(s);
     }
     foreach (var s in DataInterpreter.ConvertElements(RawImmunity))
     {
         ElementalImmunities.Add(s);
     }
 }
Пример #4
0
 public static uint MagicalAttack(ref Actor sActor, ref Actor dActor, uint damage, AttackElements element, ref Map.SkillArgs args)
 {
     //TODO:
     //Damage calculation and magical resists.
     if (args.isCritical == Map.SkillArgs.AttackResult.Critical)
     {
         damage      = damage * 2;
         args.damage = damage;
     }
     SkillAttack(ref sActor, ref dActor, damage, ref args);
     return(damage);
 }
Пример #5
0
        public static uint PhysicalAttack(ref Actor sActor, ref Actor dActor, uint damage, AttackElements element, ref Map.SkillArgs args)
        {
            //Real damage calculation
            if (element != AttackElements.NATRAL)
            {
                if (damage > (uint.MaxValue / 2))
                {
                    damage = 0;
                }
                if (args.isCritical == Map.SkillArgs.AttackResult.Critical)
                {
                    damage      = damage * 2;
                    args.damage = damage;
                }
                float reduced;
                if (dActor.BattleStatus.def < 1000)
                {
                    reduced     = ((float)(dActor.BattleStatus.def) / 1000) * damage;
                    damage     -= (uint)reduced;
                    args.damage = damage;
                }
                else
                {
                    damage          = 0;
                    args.damage     = 0;
                    args.isCritical = Map.SkillArgs.AttackResult.Block;
                }
            }
            //Shield Block: Damage reduction
            if (sActor.BattleStatus.Additions.ContainsKey("ShieldBlock"))
            {
                damage = (uint)(damage * 0.7);
            }
            //Shiel Block: Attack reflection
            if (dActor.BattleStatus.Additions.ContainsKey("ShieldBlock"))
            {
                Addition addition = dActor.BattleStatus.Additions["ShieldBlock"];

                Map.SkillArgs newarg = new Map.SkillArgs(args.skillType, args.isCritical, (uint)SkillIDs.ShieldBlock, sActor.id, 0);
                Map           map;
                newarg.damage = (uint)(damage * (0.07 + 0.03));
                if (MapManager.Instance.GetMap(dActor.mapID, out map))
                {
                    map.SendEventToAllActorsWhoCanSeeActor(Map.EVENT_TYPE.SKILL, newarg, dActor, true);
                    SkillAttack(ref dActor, ref sActor, newarg.damage, ref newarg);
                }
            }
            SkillAttack(ref sActor, ref dActor, damage, ref args);
            return(damage);
        }