コード例 #1
0
        private void HandlePhase1()
        {
            m_subStateFinished = false;
            switch (m_roundSubState)
            {
            case 1:
                if (!LegacyLogic.Instance.WorldManager.Party.InCombat)
                {
                    MonsterSpell p_spell = m_owner.SpellHandler.SelectSpellByID(37);
                    m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
                    CastSpell(p_spell);
                }
                else if (m_owner.Direction == EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position))
                {
                    m_roundSubState++;
                    m_subStateFinished = true;
                }
                else
                {
                    m_owner.Rotate(EDirectionFunctions.RotationCount(m_owner.Direction, EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position)), true);
                }
                break;

            case 2:
            case 3:
                if (LegacyLogic.Instance.WorldManager.Party.InCombat)
                {
                    m_owner.CombatHandler.CastSpell = false;
                    m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
                    m_owner.CombatHandler.DoAttack();
                    if (m_roundSubState == 3)
                    {
                        m_isFinished = true;
                    }
                }
                else
                {
                    m_subStateFinished = true;
                    m_isFinished       = true;
                    m_owner.m_stateMachine.ChangeState(Monster.EState.ACTION_FINISHED);
                }
                break;
            }
        }
コード例 #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;
            }
            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));
            }
        }
コード例 #3
0
        private void HandlePhase3()
        {
            m_subStateFinished = false;
            if (!m_strategyA)
            {
                switch (m_roundSubState)
                {
                case 0:
                    if (LegacyLogic.Instance.WorldManager.Party.InCombat)
                    {
                        if (m_owner.Direction != EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position))
                        {
                            m_owner.Rotate(EDirectionFunctions.RotationCount(m_owner.Direction, EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position)), true);
                        }
                        else
                        {
                            m_roundSubState++;
                            m_subStateFinished = true;
                        }
                    }
                    else
                    {
                        m_roundSubState++;
                        m_subStateFinished = true;
                    }
                    break;

                case 1:
                    if (!LegacyLogic.Instance.WorldManager.Party.InCombat)
                    {
                        m_strategyA     = true;
                        m_roundSubState = 0;
                    }
                    else if (!m_owner.BuffHandler.HasBuff(EMonsterBuffType.FLICKERING_LIGHT))
                    {
                        MonsterSpell p_spell = m_owner.SpellHandler.SelectSpellByID(36);
                        m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
                        CastSpell(p_spell);
                    }
                    else
                    {
                        m_owner.CombatHandler.CastSpell = false;
                        m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
                        m_owner.CombatHandler.DoAttack();
                    }
                    break;

                case 2:
                    m_owner.CombatHandler.CastSpell = false;
                    m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
                    m_owner.CombatHandler.DoAttack();
                    break;

                case 3:
                {
                    MonsterSpell p_spell2 = m_owner.SpellHandler.SelectSpellByID(37);
                    m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
                    CastSpell(p_spell2);
                    break;
                }
                }
                if (m_roundSubState >= 4)
                {
                    m_isFinished = true;
                    m_owner.m_stateMachine.ChangeState(Monster.EState.IDLE);
                    LegacyLogic.Instance.WorldManager.Party.InCombat = LegacyLogic.Instance.MapLoader.Grid.CheckInCombat(LegacyLogic.Instance.WorldManager.Party.Position);
                    m_strategyA = !m_strategyA;
                    return;
                }
            }
            if (m_strategyA)
            {
                switch (m_roundSubState)
                {
                case 0:
                    if (!m_owner.BuffHandler.HasBuff(EMonsterBuffType.FLICKERING_LIGHT))
                    {
                        MonsterSpell p_spell3 = m_owner.SpellHandler.SelectSpellByID(36);
                        m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
                        CastSpell(p_spell3);
                    }
                    else
                    {
                        m_roundSubState++;
                        m_subStateFinished = true;
                    }
                    break;

                case 1:
                    if (LegacyLogic.Instance.WorldManager.Party.InCombat || LegacyLogic.Instance.MapLoader.Grid.LineOfSight(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position))
                    {
                        if (m_owner.Direction != EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position))
                        {
                            m_owner.Rotate(EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position), true);
                        }
                        else
                        {
                            m_roundSubState++;
                            m_subStateFinished = true;
                        }
                    }
                    else
                    {
                        m_roundSubState++;
                        m_subStateFinished = true;
                    }
                    break;

                case 2:
                    if (!LegacyLogic.Instance.MapLoader.Grid.LineOfSight(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position))
                    {
                        MonsterSpell p_spell4 = m_owner.SpellHandler.SelectSpellByID(37);
                        m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
                        CastSpell(p_spell4);
                        m_castedFlicker = true;
                    }
                    else
                    {
                        MonsterSpell p_spell5 = m_owner.SpellHandler.SelectSpellByID(34);
                        m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
                        CastSpell(p_spell5);
                    }
                    break;

                case 3:
                    if (m_owner.Direction != EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position))
                    {
                        m_owner.Rotate(EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position), true);
                    }
                    if (LegacyLogic.Instance.MapLoader.Grid.LineOfSight(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position))
                    {
                        MonsterSpell p_spell6 = m_owner.SpellHandler.SelectSpellByID(34);
                        m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
                        CastSpell(p_spell6);
                    }
                    else
                    {
                        m_roundSubState++;
                        m_subStateFinished = true;
                    }
                    break;
                }
                if (m_roundSubState >= 4)
                {
                    m_isFinished = true;
                    m_owner.m_stateMachine.ChangeState(Monster.EState.IDLE);
                    m_strategyA = !m_strategyA;
                }
            }
        }
コード例 #4
0
        private void HandlePhase2()
        {
            m_subStateFinished = false;
            switch (m_roundSubState)
            {
            case 0:
                if (!m_owner.BuffHandler.HasBuff(EMonsterBuffType.FLICKERING_LIGHT))
                {
                    MonsterSpell p_spell = m_owner.SpellHandler.SelectSpellByID(36);
                    m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
                    m_castedFlickeringLight = true;
                    CastSpell(p_spell);
                }
                else
                {
                    m_roundSubState++;
                    m_subStateFinished = true;
                }
                break;

            case 1:
                if (!LegacyLogic.Instance.WorldManager.Party.InCombat)
                {
                    MonsterSpell p_spell2 = m_owner.SpellHandler.SelectSpellByID(37);
                    m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
                    CastSpell(p_spell2);
                }
                else
                {
                    m_roundSubState++;
                    m_subStateFinished = true;
                }
                break;

            case 2:
                if (m_owner.Direction != EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position))
                {
                    m_owner.Rotate(EDirectionFunctions.RotationCount(m_owner.Direction, EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position)), true);
                }
                else
                {
                    m_roundSubState++;
                    m_subStateFinished = true;
                }
                break;

            case 3:
                if (!m_castedFlickeringLight && LegacyLogic.Instance.WorldManager.Party.InCombat)
                {
                    MonsterSpell p_spell3 = m_owner.SpellHandler.SelectSpellByID(34);
                    m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
                    CastSpell(p_spell3);
                }
                else
                {
                    m_roundSubState++;
                    m_subStateFinished = true;
                }
                break;

            case 4:
                if (LegacyLogic.Instance.WorldManager.Party.InCombat)
                {
                    m_owner.CombatHandler.CastSpell = false;
                    m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING);
                    m_owner.CombatHandler.DoAttack();
                }
                else
                {
                    m_isFinished = true;
                    m_owner.m_stateMachine.ChangeState(Monster.EState.ACTION_FINISHED);
                }
                break;

            case 5:
                m_owner.m_stateMachine.ChangeState(Monster.EState.ACTION_FINISHED);
                m_isFinished = true;
                break;
            }
        }