Esempio n. 1
0
        protected override AttackResult DoAttackMonster(Character p_attacker, Monster p_target, Single p_magicPower)
        {
            Int32 num = 1;

            if (p_target != null)
            {
                GridSlot slot = LegacyLogic.Instance.MapLoader.Grid.GetSlot(p_target.Position);
                if (slot != null)
                {
                    num = slot.Entities.Count;
                }
                Single        criticalMagicHitChance   = p_attacker.FightValues.CriticalMagicHitChance;
                Single        magicalCriticalDamageMod = p_attacker.FightValues.MagicalCriticalDamageMod;
                EDamageType   edamageType = ESkillIDToEDamageType(m_staticData.SkillID);
                List <Damage> list        = new List <Damage>();
                for (Int32 i = 0; i < m_staticData.Damage.Length; i++)
                {
                    DamageData p_data = DamageData.Scale(m_staticData.Damage[i], p_magicPower);
                    Damage     item   = Damage.Create(p_data, magicalCriticalDamageMod);
                    if (item.Type == edamageType)
                    {
                        item.IgnoreResistance = p_attacker.SkillHandler.GetResistanceIgnoreValue(m_staticData.SkillID);
                    }
                    item.Value *= num;
                    list.Add(item);
                }
                Attack p_attack = new Attack(0f, criticalMagicHitChance, list);
                return(p_target.CombatHandler.AttackMonster(p_attacker, p_attack, false, true, edamageType, true, p_attacker.SkillHandler.GetResistanceIgnoreValue(m_staticData.SkillID)));
            }
            return(null);
        }
Esempio n. 2
0
        protected virtual AttackResult DoAttackMonster(Character p_sorcerer, Monster p_target, Single p_magicPower)
        {
            if (p_target == null)
            {
                return(null);
            }
            Single      criticalMagicHitChance   = p_sorcerer.FightValues.CriticalMagicHitChance;
            Single      magicalCriticalDamageMod = p_sorcerer.FightValues.MagicalCriticalDamageMod;
            EDamageType edamageType = ESkillIDToEDamageType(m_staticData.SkillID);
            Attack      attack      = new Attack(0f, criticalMagicHitChance);

            for (Int32 i = 0; i < m_staticData.Damage.Length; i++)
            {
                if (m_staticData.Damage[i].Type != EDamageType.HEAL)
                {
                    DamageData p_data = DamageData.Scale(m_staticData.Damage[i], p_magicPower);
                    Damage     item   = Damage.Create(p_data, magicalCriticalDamageMod);
                    if (item.Type == edamageType)
                    {
                        item.IgnoreResistance = p_sorcerer.SkillHandler.GetResistanceIgnoreValue(m_staticData.SkillID);
                    }
                    attack.Damages.Add(item);
                }
            }
            p_target.AbilityHandler.ExecuteAttack(p_sorcerer, attack, false, EExecutionPhase.ON_CHARACTER_ATTACKS_MONSTER_BEFORE_DAMAGE_REDUCTION);
            Boolean p_isMagic = m_staticData.SkillID != ESkillID.SKILL_WARFARE;

            return(p_target.CombatHandler.AttackMonster(p_sorcerer, attack, false, true, edamageType, p_isMagic, p_sorcerer.SkillHandler.GetResistanceIgnoreValue(m_staticData.SkillID)));
        }
Esempio n. 3
0
 protected Boolean Attack(List <Object> attackBuffer)
 {
     if (Controller.StaticID == 5)
     {
         GetAllTargetsInRange(attackBuffer, false, true);
     }
     else
     {
         GetAttackTargets(attackBuffer);
     }
     if (attackBuffer.Count > 0)
     {
         Damage[] array = new Damage[Brain.Data.DamageData.Length];
         for (Int32 i = 0; i < Brain.Data.DamageData.Length; i++)
         {
             DamageData p_data = DamageData.Scale(Brain.Data.DamageData[i], Brain.MagicFactor);
             array[i] = Damage.Create(p_data, 0f);
         }
         Attack  p_attack = new Attack(0f, 0f, array);
         Boolean flag     = false;
         SummonSpellEventArgs summonSpellEventArgs = new SummonSpellEventArgs();
         foreach (Object obj in attackBuffer)
         {
             BaseCombatHandler baseCombatHandler;
             if (obj is Character)
             {
                 flag = true;
                 Character character = (Character)obj;
                 baseCombatHandler = character.FightHandler;
             }
             else
             {
                 if (!(obj is Monster))
                 {
                     continue;
                 }
                 flag = true;
                 Monster monster = (Monster)obj;
                 baseCombatHandler = monster.CombatHandler;
                 if (Controller.StaticID == 3 && monster.AbilityHandler.HasAbility(EMonsterAbilityType.UNDEAD))
                 {
                     AttackResult attackResult = new AttackResult();
                     attackResult.Result = EResultType.IMMUNE;
                     summonSpellEventArgs.SpellTargets.Add(new AttackedTarget(obj, attackResult));
                     continue;
                 }
             }
             if (Controller.StaticData.DamageMod != EDamageMod.NONE && Controller.StaticData.DamageMod == EDamageMod.MultiplyByTargets)
             {
                 List <Damage> list = new List <Damage>();
                 foreach (Damage item in array)
                 {
                     var damage = item;
                     damage.Value *= attackBuffer.Count;
                     list.Add(damage);
                 }
                 p_attack = new Attack(0f, 0f, list);
             }
             AttackResult attackResult2 = baseCombatHandler.AttackEntity(p_attack, false, Brain.DamageType, Controller.StaticID == 6, Brain.IgnoreResistance, false);
             summonSpellEventArgs.SpellTargets.Add(new AttackedTarget(obj, attackResult2));
             if (attackResult2.Result != EResultType.EVADE)
             {
                 if (obj is Character)
                 {
                     Character character2 = (Character)obj;
                     character2.ApplyDamages(attackResult2, null);
                 }
                 else if (obj is Monster)
                 {
                     Monster monster2 = (Monster)obj;
                     monster2.ApplyDamages(attackResult2, Controller);
                 }
                 if (Controller.StaticData.MonsterBuffs[0] != EMonsterBuffType.NONE && obj is Monster)
                 {
                     Monster monster3 = (Monster)obj;
                     foreach (EMonsterBuffType p_type in Controller.StaticData.MonsterBuffs)
                     {
                         MonsterBuff p_buff = BuffFactory.CreateMonsterBuff(p_type, Brain.MagicFactor);
                         monster3.AddBuff(p_buff);
                     }
                 }
                 if (Controller.StaticData.PartyBuffs[0] != EPartyBuffs.NONE && obj is Character)
                 {
                     foreach (EPartyBuffs p_buffId in Controller.StaticData.PartyBuffs)
                     {
                         LegacyLogic.Instance.WorldManager.Party.Buffs.AddBuff(p_buffId, 1f);
                     }
                 }
                 if (Controller.StaticData.RemovedConditions[0] != ECondition.NONE && obj is Character)
                 {
                     Character character3 = (Character)obj;
                     foreach (ECondition p_condition in Controller.StaticData.RemovedConditions)
                     {
                         character3.ConditionHandler.RemoveCondition(p_condition);
                     }
                 }
             }
         }
         summonSpellEventArgs.Result = ((!flag) ? ESpellResult.NO_TARGET_FOUND : ESpellResult.OK);
         Controller.FeedActionLog(summonSpellEventArgs);
         LegacyLogic.Instance.EventManager.InvokeEvent(Controller, EEventType.SUMMON_CAST_SPELL, summonSpellEventArgs);
         return(flag);
     }
     return(false);
 }