Пример #1
0
 public override void HandleAttackResults(List <AttackResult> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic, Boolean p_isRanged)
 {
     if (p_isMagic)
     {
         return;
     }
     if (p_attackList == null)
     {
         return;
     }
     for (Int32 i = 0; i < p_attackList.Count; i++)
     {
         m_passedStrikes++;
         AttackResult attackResult = p_attackList[i];
         if (attackResult.Result == EResultType.HIT || attackResult.Result == EResultType.CRITICAL_HIT)
         {
             p_character.FightValues.GeneralBlockChance -= p_character.FightValues.GeneralBlockChance * m_staticData.GetValues(m_level)[0];
             if (m_isFirstStrike)
             {
                 AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);
                 p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
                 m_isFirstStrike = false;
             }
         }
         if ((m_passedStrikes == p_monster.CombatHandler.MeleeStrikes && !p_isRanged) || (m_passedStrikes == p_monster.CombatHandler.RangedStrikes && p_isRanged))
         {
             p_character.CalculateCurrentAttributes();
         }
     }
 }
Пример #2
0
        public override void HandleAttacks(List <Attack> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic)
        {
            if (p_monster.DistanceToParty > 1f)
            {
                return;
            }
            Party    party     = LegacyLogic.Instance.WorldManager.Party;
            Grid     grid      = LegacyLogic.Instance.MapLoader.Grid;
            Position position  = party.Position;
            Position position2 = position + EDirectionFunctions.GetLineOfSightDirection(p_monster.Position, party.Position);
            GridSlot slot      = grid.GetSlot(position2);

            if (slot == null)
            {
                return;
            }
            party.IsPushed = true;
            if (!slot.HasEntities && grid.CanMoveEntity(party, p_monster.Direction))
            {
                GridSlot slot2 = grid.GetSlot(position);
                slot2.RemoveEntity(party);
                party.Position = position2;
                grid.GetSlot(position2).AddEntity(party);
                MoveEntityEventArgs p_eventArgs = new MoveEntityEventArgs(position, position2);
                LegacyLogic.Instance.EventManager.InvokeEvent(party, EEventType.MOVE_ENTITY, p_eventArgs);
                LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ENTITY_ABILITY_ADDED, new AbilityEventArgs(p_monster, this));
                AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);
                LegacyLogic.Instance.ActionLog.PushEntry(p_args);
            }
            else
            {
                party.IsPushed = false;
            }
        }
        public override void HandleAttackResults(List <AttackResult> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic, Boolean p_isRanged)
        {
            AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);

            p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
            GridSlot             slot     = LegacyLogic.Instance.MapLoader.Grid.GetSlot(p_monster.Position);
            List <Monster>       list     = new List <Monster>();
            Party                party    = LegacyLogic.Instance.WorldManager.Party;
            IList <MovingEntity> entities = slot.Entities;

            for (Int32 i = 0; i < entities.Count; i++)
            {
                if (entities[i] != null && entities[i] != p_monster && entities[i] is Monster)
                {
                    list.Add((Monster)entities[i]);
                }
            }
            Int32 num = (Int32)m_staticData.GetValues(m_level)[0];

            for (Int32 j = 0; j < list.Count; j++)
            {
                list[j].ChangeHP(-num, null);
            }
            if (Position.Distance(party.Position, p_monster.Position) <= 1f)
            {
                for (Int32 k = 0; k < party.Members.Length; k++)
                {
                    if (party.Members[k] != null && !party.Members[k].ConditionHandler.HasCondition(ECondition.DEAD))
                    {
                        party.Members[k].ChangeHP(-num, p_monster);
                    }
                }
            }
            LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ENTITY_ABILITY_ADDED, new AbilityEventArgs(p_monster, this));
        }
Пример #4
0
        public override void HandleAttackResults(List <AttackResult> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic, Boolean p_isRanged)
        {
            if (p_attackList == null)
            {
                return;
            }
            AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);
            Boolean flag  = false;
            Boolean flag2 = true;

            if (p_isMagic && p_monster.SpellHandler.LastCastedSpell.TargetType == ETargetType.PARTY)
            {
                for (Int32 i = 0; i < p_monster.SpellHandler.SpellTargetList.Count; i++)
                {
                    p_monster.SpellHandler.SpellTargetList[i].ChangeMP(-(Int32)m_staticData.GetValues(m_level)[0]);
                }
                flag2 = false;
                flag  = (p_monster.SpellHandler.SpellTargetList.Count > 0);
            }
            if (flag2)
            {
                for (Int32 j = 0; j < p_attackList.Count; j++)
                {
                    if (p_attackList[j].Result == EResultType.HIT || p_attackList[j].Result == EResultType.CRITICAL_HIT)
                    {
                        p_character.ChangeMP(-(Int32)m_staticData.GetValues(m_level)[0]);
                        flag = true;
                    }
                }
            }
            if (flag)
            {
                p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
            }
        }
        public override void HandleAttackResults(List <AttackResult> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic, Boolean p_isRanged)
        {
            if (p_attackList == null)
            {
                return;
            }
            Single num = m_staticData.GetValues(m_level)[0] * 0.01f;

            for (Int32 i = 0; i < p_attackList.Count; i++)
            {
                AttackResult attackResult = p_attackList[i];
                for (Int32 j = 0; j < attackResult.DamageResults.Count; j++)
                {
                    DamageResult value = attackResult.DamageResults[j];
                    value.EffectiveValue          = (Int32)(value.EffectiveValue * m_percentValue + 0.5f);
                    attackResult.DamageResults[j] = value;
                }
                m_passedStrikes++;
                if (attackResult.Result != EResultType.BLOCK && attackResult.Result != EResultType.EVADE)
                {
                    if (m_percentValue == 1f && p_monster.CombatHandler.MeleeStrikes > m_passedStrikes)
                    {
                        AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);
                        p_monster.AbilityHandler.AddEntry(EExecutionPhase.AFTER_MONSTER_ATTACK, p_args);
                    }
                    m_percentValue += num;
                }
            }
        }
Пример #6
0
        public override void HandleAttackResults(List <AttackResult> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic, Boolean p_isRanged)
        {
            if (p_isMagic || p_attackList == null)
            {
                return;
            }
            Position position  = LegacyLogic.Instance.WorldManager.Party.Position;
            Position position2 = p_monster.Position;
            Boolean  flag      = LegacyLogic.Instance.MapLoader.Grid.LineOfSight(position, position2);
            Boolean  flag2     = false;

            foreach (AttackResult attackResult in p_attackList)
            {
                for (Int32 i = 0; i < attackResult.DamageResults.Count; i++)
                {
                    if (attackResult.DamageResults[i].Type == EDamageType.PHYSICAL && Position.Distance(position, position2) <= 1.5f && flag)
                    {
                        flag2 = true;
                        break;
                    }
                }
                if (flag2 && !p_monster.CounterAttack)
                {
                    p_monster.CounterAttack          = true;
                    p_character.CounterAttackMonster = p_monster;
                    AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);
                    LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ENTITY_ABILITY_ADDED, new AbilityEventArgs(p_monster, this));
                    p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
                    break;
                }
            }
        }
Пример #7
0
        public override void HandleAttackResults(List <AttackResult> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic, Boolean p_isRanged)
        {
            if (p_attackList == null)
            {
                return;
            }
            Single num = p_character.FightValues.Resistance[EDamageType.DARK].Value * 0.5f;

            if (Random.Range(0f, 100f) > num)
            {
                AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);
                for (Int32 i = 0; i < p_attackList.Count; i++)
                {
                    if (p_attackList[i].Result == EResultType.HIT && !p_isMagic)
                    {
                        Single num2 = Random.Range(0f, 1f);
                        if (num2 < m_staticData.GetValues(m_level)[0] * 0.01f)
                        {
                            p_character.ConditionHandler.AddCondition(ECondition.CONFUSED);
                            p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
                            break;
                        }
                    }
                    else if (p_attackList[i].Result == EResultType.CRITICAL_HIT && !p_isMagic)
                    {
                        p_character.ConditionHandler.AddCondition(ECondition.CONFUSED);
                        p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
                        break;
                    }
                }
            }
        }
Пример #8
0
        public override void HandleAttacks(List <Attack> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic)
        {
            if (p_attackList == null)
            {
                return;
            }
            AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);

            p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
            for (Int32 i = 0; i < p_attackList.Count; i++)
            {
                List <Damage> damages = p_attackList[i].Damages;
                Int32         j       = 0;
                Int32         count   = damages.Count;
                while (j < count)
                {
                    if (damages[j].Type == EDamageType.PHYSICAL)
                    {
                        Damage value = damages[j];
                        value.Value = (Int32)(value.Value * 0.5f);
                        damages[j]  = value;
                        Damage item = new Damage(EDamageType.FIRE, value.Value, value.CriticalBonusMod, 1f);
                        damages.Add(item);
                    }
                    j++;
                }
            }
        }
Пример #9
0
        public override void HandleAttacks(List <Attack> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic)
        {
            m_monster = p_monster;
            m_monster.AiHandler.Vanish();
            AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);

            LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ENTITY_ABILITY_ADDED, new AbilityEventArgs(p_monster, this));
            p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
        }
 public override void HandleAttacks(List <Attack> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic)
 {
     if (p_monster.CombatHandler.MeleeStrikes > 1 && !p_isMagic)
     {
         p_monster.DivideAttacksToPartyCharacters = true;
         AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);
         LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ENTITY_ABILITY_ADDED, new AbilityEventArgs(p_monster, this));
         p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
     }
 }
 public override void HandleAttacks(List <Attack> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic)
 {
     if (!p_monster.BuffHandler.HasBuff(EMonsterBuffType.SHADOW_CLOAK))
     {
         MonsterBuffShadowCloak p_buff = (MonsterBuffShadowCloak)BuffFactory.CreateMonsterBuff(EMonsterBuffType.SHADOW_CLOAK, 1f, m_level);
         p_monster.AddBuff(p_buff);
         AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);
         LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ENTITY_ABILITY_ADDED, new AbilityEventArgs(p_monster, this));
         p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
     }
 }
 public override void HandleAttackResults(List <AttackResult> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic, Boolean p_isRanged)
 {
     for (Int32 i = 0; i < p_attackList.Count; i++)
     {
         if ((p_attackList[i].Result == EResultType.HIT || p_attackList[i].Result == EResultType.CRITICAL_HIT) && m_isFirstStrike)
         {
             AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);
             p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
             m_isFirstStrike = false;
         }
     }
 }
 protected override void HandleMonsterBuffs(Character p_sorcerer, SpellEventArgs p_result, Monster p_target, Single p_magicFactor)
 {
     if (!p_target.AbilityHandler.HasAbility(EMonsterAbilityType.LARGE))
     {
         base.HandleMonsterBuffs(p_sorcerer, p_result, p_target, p_magicFactor);
     }
     else
     {
         MonsterAbilityBase        ability = p_target.AbilityHandler.GetAbility(EMonsterAbilityType.LARGE);
         AbilityTriggeredEventArgs p_args  = new AbilityTriggeredEventArgs(p_target, ability);
         p_target.AbilityHandler.AddEntry(ability.ExecutionPhase, p_args);
     }
 }
Пример #14
0
 public override Boolean IsForbiddenBuff(Int32 p_buffID, Monster p_monster, Boolean p_silent)
 {
     for (Int32 i = 0; i < m_staticData.GetValues(m_level).Length; i++)
     {
         if (p_buffID == (Int32)m_staticData.GetValues(m_level)[i])
         {
             if (!p_silent)
             {
                 AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);
                 p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
             }
             return(true);
         }
     }
     return(false);
 }
 public override void HandleAttackResults(List <AttackResult> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic, Boolean p_isRanged)
 {
     if (p_attackList == null)
     {
         return;
     }
     foreach (AttackResult attackResult in p_attackList)
     {
         if (attackResult.Result == EResultType.BLOCK || attackResult.Result == EResultType.EVADE)
         {
             p_monster.CombatHandler.MeleeStrikesRoundBonus += (Int32)m_staticData.GetValues(m_level)[0];
             AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);
             p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
         }
     }
 }
Пример #16
0
        public override void HandleAttacks(List <Attack> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic)
        {
            Single num = p_monster.CurrentHealth / (Single)p_monster.MaxHealth;

            if (num < 0.5f)
            {
                p_monster.CombatHandler.MeleeStrikes *= 2;
                AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);
                p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
                LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ENTITY_ABILITY_ADDED, new AbilityEventArgs(p_monster, this));
            }
            else
            {
                LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ENTITY_ABILITY_REMOVED, new AbilityEventArgs(p_monster, this));
            }
        }
Пример #17
0
        public override void HandleAttackResults(List <AttackResult> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic, Boolean p_isRanged)
        {
            AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);

            p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
            GridSlot             slot     = LegacyLogic.Instance.MapLoader.Grid.GetSlot(p_monster.Position);
            List <Monster>       list     = new List <Monster>();
            IList <MovingEntity> entities = slot.Entities;

            for (Int32 i = 0; i < entities.Count; i++)
            {
                if (entities[i] != null && entities[i] != p_monster && entities[i] is Monster)
                {
                    (entities[i] as Monster).AddBuff(BuffFactory.CreateMonsterBuff(EMonsterBuffType.HOUR_OF_JUSTICE, p_monster.MagicPower, m_level));
                }
            }
            LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ENTITY_ABILITY_ADDED, new AbilityEventArgs(p_monster, this));
        }
        public override void HandleAttackResults(List <AttackResult> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic, Boolean p_isRanged)
        {
            if (p_attackList == null)
            {
                return;
            }
            if (p_monster.DistanceToParty > 1.1f)
            {
                return;
            }
            AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);
            Single  num  = m_staticData.GetValues(m_level)[0] * 0.01f;
            Boolean flag = false;
            Int32   num2 = 0;

            foreach (AttackResult attackResult in p_attackList)
            {
                List <Damage> list  = new List <Damage>();
                Int32         num3  = 0;
                Int32[]       array = new Int32[8];
                for (Int32 i = 0; i < attackResult.DamageResults.Count; i++)
                {
                    Single num4 = attackResult.DamageResults[i].EffectiveValue;
                    array[(Int32)attackResult.DamageResults[i].Type] += (Int32)(num4 * num + 0.5f);
                    num3 += (Int32)(num4 * num + 0.5f);
                    flag  = true;
                    list.Add(new Damage(attackResult.DamageResults[i].Type, array[(Int32)attackResult.DamageResults[i].Type], 1f, 1f));
                }
                num2 += num3;
                attackResult.ReflectedDamage       = new Attack(1f, 0f, list);
                attackResult.ReflectedDamageSource = this;
            }
            if (flag && num2 > 0)
            {
                p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
                LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ENTITY_ABILITY_ADDED, new AbilityEventArgs(p_monster, this));
            }
        }
Пример #19
0
        public override void HandleAttackResults(List <AttackResult> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic, Boolean p_isRanged)
        {
            if (p_attackList == null)
            {
                return;
            }
            AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);

            for (Int32 i = 0; i < p_attackList.Count; i++)
            {
                if (p_attackList[i].Result == EResultType.HIT && !p_isMagic)
                {
                    Single num = Random.Range(0f, 1f);
                    if (num < m_staticData.GetValues(m_level)[0] * 0.01f)
                    {
                        p_character.ConditionHandler.AddCondition(ECondition.STUNNED);
                        LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ENTITY_ABILITY_ADDED, new AbilityEventArgs(p_monster, this));
                        if (p_character.ConditionHandler.HasCondition(ECondition.STUNNED))
                        {
                            p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
                        }
                        break;
                    }
                }
                else if (p_attackList[i].Result == EResultType.CRITICAL_HIT && !p_isMagic)
                {
                    p_character.ConditionHandler.AddCondition(ECondition.STUNNED);
                    LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ENTITY_ABILITY_ADDED, new AbilityEventArgs(p_monster, this));
                    if (p_character.ConditionHandler.HasCondition(ECondition.STUNNED))
                    {
                        p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
                    }
                    break;
                }
            }
        }
        public override void HandleAttacks(List <Attack> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic)
        {
            if (p_monster.CurrentHealth == p_monster.MaxHealth)
            {
                return;
            }
            AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);
            Int32 num = (Int32)(p_monster.MaxHealth * (m_staticData.GetValues(m_level)[0] * 0.01f));

            p_monster.ChangeHP(num, null);
            MonsterBuff p_buff = new MonsterBuff(20, p_monster.MagicPower);
            MonsterBuffDamageEntryEventArgs p_args2 = new MonsterBuffDamageEntryEventArgs(p_buff, p_monster, new AttackResult
            {
                Result        = EResultType.HEAL,
                DamageResults =
                {
                    new DamageResult(EDamageType.HEAL, num, 0, 1f)
                }
            });

            p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
            p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args2);
            LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ENTITY_ABILITY_ADDED, new AbilityEventArgs(p_monster, this));
        }
Пример #21
0
        public override void HandleAttacks(List <Attack> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic)
        {
            AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);

            p_monster.AbilityHandler.AddEntry(m_executionPhase, p_args);
        }
Пример #22
0
        public override void HandleAttacks(List <Attack> p_attackList, Monster p_monster, Character p_character, Boolean p_isMagic)
        {
            if (p_monster.DistanceToParty > 1f)
            {
                return;
            }
            Grid       grid      = LegacyLogic.Instance.MapLoader.Grid;
            Position   position  = LegacyLogic.Instance.WorldManager.Party.Position;
            EDirection direction = LegacyLogic.Instance.WorldManager.Party.Direction;
            EDirection p_dir     = (direction - EDirection.EAST != -1) ? (direction - 1) : EDirection.WEST;
            EDirection p_dir2    = (direction + 1 != EDirection.COUNT) ? (direction + 1) : EDirection.NORTH;
            Boolean    flag      = true;

            if (direction != EDirectionFunctions.GetOppositeDir(p_monster.Direction) && direction != p_monster.Direction)
            {
                p_dir  = direction;
                p_dir2 = EDirectionFunctions.GetOppositeDir(direction);
                flag   = false;
            }
            p_monster.CombatHandler.MeleeStrikes = 3;
            Position position2 = p_monster.Position;
            Position p_pos     = position + p_dir;
            Position position3 = position + p_dir2;
            Boolean  flag2     = Random.Range(0, 2) == 1;

            if (flag2)
            {
                if (grid.GetSlot(p_pos).AddEntity(p_monster))
                {
                    grid.GetSlot(position2).RemoveEntity(p_monster);
                    p_monster.Rotate(EDirectionFunctions.RotationCount(p_monster.Direction, EDirectionFunctions.GetOppositeDir(direction)), false);
                    if (flag)
                    {
                        p_monster.Rotate(-1, false);
                    }
                }
                else
                {
                    flag2 = false;
                }
            }
            if (!flag2)
            {
                if (Position.Distance(p_monster.Position, position3) < 2f)
                {
                    if (grid.GetSlot(position3).AddEntity(p_monster))
                    {
                        grid.GetSlot(position2).RemoveEntity(p_monster);
                        p_monster.Rotate(EDirectionFunctions.RotationCount(p_monster.Direction, EDirectionFunctions.GetOppositeDir(direction)), false);
                        if (flag)
                        {
                            p_monster.Rotate(1, false);
                        }
                    }
                }
                else if (grid.GetSlot(p_pos).AddEntity(p_monster))
                {
                    grid.GetSlot(position2).RemoveEntity(p_monster);
                    p_monster.Rotate(EDirectionFunctions.RotationCount(p_monster.Direction, EDirectionFunctions.GetOppositeDir(direction)), false);
                    if (flag)
                    {
                        p_monster.Rotate(-1, false);
                    }
                }
            }
            if (position2 != p_monster.Position)
            {
                MoveEntityEventArgs p_eventArgs = new MoveEntityEventArgs(position2, p_monster.Position);
                LegacyLogic.Instance.EventManager.InvokeEvent(p_monster, EEventType.MOVE_ENTITY, p_eventArgs);
                AbilityTriggeredEventArgs p_args = new AbilityTriggeredEventArgs(p_monster, this);
                LegacyLogic.Instance.ActionLog.PushEntry(p_args);
                LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ENTITY_ABILITY_ADDED, new AbilityEventArgs(p_monster, this));
            }
        }
        protected virtual void PushBack(Monster p_monster, SpellEventArgs p_result)
        {
            if (p_monster.CurrentHealth <= 0)
            {
                return;
            }
            if (p_monster.AbilityHandler.HasAbility(EMonsterAbilityType.LARGE) || p_monster.AbilityHandler.HasAbility(EMonsterAbilityType.BOSS) || p_monster.AbilityHandler.HasAbility(EMonsterAbilityType.STATIC_OBJECT) || p_monster.AbilityHandler.HasAbility(EMonsterAbilityType.SPIRIT_BOUND))
            {
                p_result.SpellTargets.Add(new PushedTarget(p_monster, p_monster.Position, false));
                if (p_monster.AbilityHandler.HasAbility(EMonsterAbilityType.LARGE))
                {
                    MonsterAbilityBase        ability = p_monster.AbilityHandler.GetAbility(EMonsterAbilityType.LARGE);
                    AbilityTriggeredEventArgs p_args  = new AbilityTriggeredEventArgs(p_monster, ability);
                    p_monster.AbilityHandler.AddEntry(ability.ExecutionPhase, p_args);
                }
                else if (p_monster.AbilityHandler.HasAbility(EMonsterAbilityType.BOSS))
                {
                    MonsterAbilityBase        ability2 = p_monster.AbilityHandler.GetAbility(EMonsterAbilityType.BOSS);
                    AbilityTriggeredEventArgs p_args2  = new AbilityTriggeredEventArgs(p_monster, ability2);
                    p_monster.AbilityHandler.AddEntry(ability2.ExecutionPhase, p_args2);
                }
                else if (p_monster.AbilityHandler.HasAbility(EMonsterAbilityType.STATIC_OBJECT))
                {
                    MonsterAbilityBase        ability3 = p_monster.AbilityHandler.GetAbility(EMonsterAbilityType.STATIC_OBJECT);
                    AbilityTriggeredEventArgs p_args3  = new AbilityTriggeredEventArgs(p_monster, ability3);
                    p_monster.AbilityHandler.AddEntry(ability3.ExecutionPhase, p_args3);
                }
                else if (p_monster.AbilityHandler.HasAbility(EMonsterAbilityType.SPIRIT_BOUND))
                {
                    MonsterAbilityBase        ability4 = p_monster.AbilityHandler.GetAbility(EMonsterAbilityType.SPIRIT_BOUND);
                    AbilityTriggeredEventArgs p_args4  = new AbilityTriggeredEventArgs(p_monster, ability4);
                    p_monster.AbilityHandler.AddEntry(ability4.ExecutionPhase, p_args4);
                }
                return;
            }
            Position   position  = p_monster.Position;
            Party      party     = LegacyLogic.Instance.WorldManager.Party;
            Grid       grid      = LegacyLogic.Instance.MapLoader.Grid;
            EDirection direction = EDirectionFunctions.GetDirection(party.Position, p_monster.Position);

            for (Int32 i = 0; i < m_PushCount; i++)
            {
                if (!grid.CanMoveEntity(p_monster, direction))
                {
                    break;
                }
                Position p_pos = p_monster.Position + direction;
                GridSlot slot  = grid.GetSlot(p_monster.Position);
                if (grid.GetSlot(p_pos).AddEntity(p_monster))
                {
                    if (party.SelectedMonster == p_monster)
                    {
                        party.SelectedMonster = null;
                    }
                    slot.RemoveEntity(p_monster);
                }
            }
            if (position != p_monster.Position)
            {
                p_result.SpellTargets.Add(new PushedTarget(p_monster, p_monster.Position, true));
            }
        }