Наследование: MonoBehaviour
Пример #1
0
    public void Awake()
    {
        switch (m_MakeAIType)
        {
            case eAIType.NORMAL_AI:
                {
                    GameObject aiObject = new GameObject();
                    aiObject.name = m_MakeAIType.ToString("F");
                    m_AI = aiObject.AddComponent<NormalAI>();
                    aiObject.transform.SetParent(SelfTransform);
                }
                break;
            default:
                break;
        }

        m_AI.TargetComponent = this;

        GameCharacter gameCharacter = CharacterMgr.Instance.AddCharacter(m_TemplateKey);
        gameCharacter.TargetComponent = this;
        m_SelfCharater = gameCharacter;

        ////--
        // Actor -> Awake()
        for (int i = 0; i < gameCharacter.CHRACTER_TEMPLATE.LIST_SKILL.Count; i++)
        {
            SkillData skillData = SkillMgr.Instance.GetSkillData(gameCharacter.CHRACTER_TEMPLATE.LIST_SKILL[i]);
            gameCharacter.AddSkill(skillData);
        }

        if (m_bEnableBoard)
        {
            BaseBoard board = BoardMgr.Instance.AddBoard(this, eBoardType.BOARD_HP);
            board.SetData("HP", GetFactorData(eFactorData.MAX_HP), m_SelfCharater.m_CurrentHP);
        }

        ActorMgr.Instance.AddActor(this);
    }
Пример #2
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     ai = ai ?? animator.GetComponent<BaseAI>();
     ai.state = stateEnter;
 }
Пример #3
0
 // Start
 public void Enter(BaseAI owner)
 {
 }
Пример #4
0
 // Update
 public void Execute(BaseAI owner)
 {
     // Lerp position to target
     owner.transform.position = Vector3.Lerp(owner.transform.position, owner.target.position, Time.deltaTime);
     owner.transform.LookAt(owner.target); // Look at target
 }
Пример #5
0
 public void Exit(BaseAI owner)
 {
 }
        public static bool IsCharacterAWolf(BaseAI baseAI)
        {
            var baseAICharacter = baseAI.GetComponent <Character>();

            return(IsCharacterAWolf(baseAICharacter));
        }
Пример #7
0
        public override void AI()
        {
            Player player = Main.player[npc.target];

            if (Main.expertMode)
            {
                damage = npc.damage / 4;
            }
            else
            {
                damage = npc.damage / 2;
            }

            Vector2 wantedVelocity = player.Center - new Vector2(pos, 0);

            npc.direction = npc.spriteDirection = npc.position.X < player.position.X ? 1 : -1;

            if (SHADOWCONTER <= 0)
            {
                npc.dontTakeDamage = false;
                SHADOWCONTER       = 0;
                Shadowdashcounter  = 0;
            }

            if (Invisible)
            {
                if (npc.alpha < 255)
                {
                    npc.alpha += 5;
                }
                else
                {
                    npc.chaseable = false;
                    npc.alpha     = 255;
                }
            }
            else
            {
                if (npc.alpha > 0)
                {
                    npc.alpha -= 8;
                }
                else
                {
                    npc.chaseable = true;
                    npc.alpha     = 0;
                }
            }

            if (Main.netMode != 1)
            {
                internalAI[1]++;
                internalAI[5]++;
                internalAI[6]++;
                internalAI[7]++;
            }

            int InvisTimer1 = 1000;

            int InvisTimer2 = 1300;

            if (npc.life < npc.lifeMax * .66f)
            {
                InvisTimer1 = 800;

                InvisTimer2 = 1100;

                if (Main.expertMode)
                {
                    internalAI[6]++;
                }
            }
            if (npc.life < npc.lifeMax * .33f)
            {
                InvisTimer1 = 600;

                InvisTimer2 = 900;

                if (Main.expertMode)
                {
                    internalAI[6] += 2;
                }
            }
            if (internalAI[5] > InvisTimer1)
            {
                if (!Invisible)
                {
                    Invisible     = true;
                    npc.netUpdate = true;
                }
            }
            if (internalAI[5] > InvisTimer2 && internalAI[0] != AISTATE_Shadowkilling)
            {
                Invisible = false;
                Backstab();
                Vector2 targetCenter = player.position + new Vector2(player.width * 0.5f, player.height * 0.5f);
                Vector2 fireTarget   = npc.Center;
                int     projType     = ModContent.ProjectileType <WrathHarukaProj>();
                BaseAI.FireProjectile(targetCenter, fireTarget, projType, damage * 1, 0f, 14f);
                internalAI[0] = Main.rand.Next(2);
                internalAI[5] = 0;
            }

            if (internalAI[6] >= 6000)
            {
                internalAI[6] = 6000;
            }

            if (internalAI[7] >= 3000)
            {
                internalAI[7] = 3000;
            }

            if (Invisible)
            {
                npc.dontTakeDamage = true;
                internalAI[0]      = 3;
            }
            else
            {
                npc.dontTakeDamage = false;
            }

            if (npc.alpha >= 200)
            {
                npc.dontTakeDamage = true;
            }
            else
            {
                npc.dontTakeDamage = false;
            }

            if (Shadowkill && npc.alpha > 250)
            {
                internalAI[0] = AISTATE_Shadowkilling;
                internalAI[1] = 0;
                internalAI[2] = 0;
                internalAI[3] = 0;
                internalAI[5] = 0;
                Invisible     = false;
                npc.netUpdate = true;
            }

            if (ProjectileShoot == 0 || internalAI[0] == AISTATE_SLASH)
            {
                if (Main.netMode != 1)
                {
                    if (internalAI[1] > 4)
                    {
                        internalAI[1] = 0;
                        internalAI[2]++;
                    }
                }
            }
            else
            {
                if (Main.netMode != 1)
                {
                    if (internalAI[1] > 8)
                    {
                        internalAI[1] = 0;
                        internalAI[2]++;
                    }
                }
            }

            if (Main.expertMode && internalAI[0] != AISTATE_Shadowkilling && internalAI[0] != AISTATE_SPIN && SHADOWCONTER <= 0 && !Invisible)
            {
                for (int i = 0; i < 1000; i++)
                {
                    if (npc.Hitbox.Intersects(Main.projectile[i].Hitbox) && Main.projectile[i].friendly && Main.projectile[i].damage > 0)
                    {
                        if (internalAI[6] >= 2000)
                        {
                            Main.projectile[i].Kill();
                            internalAI[6] -= 2000;
                            strikebackproj++;
                            internalAI[0] = AISTATE_SPIN;
                        }
                        else if (internalAI[7] >= 3000)
                        {
                            internalAI[7] = 0;
                            SHADOWDOG     = true;
                        }
                        npc.netUpdate = true;
                        break;
                    }
                }
            }

            if (SHADOWDOG)
            {
                SHADOWCONTER++;
                npc.dontTakeDamage = true;
                internalAI[0]      = AISTATE_IDLE;
                if (InvisTimer1 - internalAI[5] <= 360)
                {
                    internalAI[5] -= 360;
                }
                if (internalAI[5] < 0)
                {
                    internalAI[5] = 0;
                }
                if (SHADOWCONTER >= 180)
                {
                    SHADOWDOG     = false;
                    internalAI[0] = AISTATE_SLASH;
                    if (internalAI[6] >= 800)
                    {
                        internalAI[0]  = AISTATE_SPIN;
                        internalAI[6] -= 800;
                    }
                    Shadowdashcounter = 0;
                }
            }


            if (internalAI[0] == AISTATE_IDLE)
            {
                if (Main.netMode != 1)
                {
                    internalAI[3]++;

                    if (internalAI[3] >= 90 && !Invisible && !SHADOWDOG)
                    {
                        internalAI[3] = 0;
                        internalAI[0] = Main.rand.Next(2);
                        if (internalAI[6] >= 1500 && Main.expertMode)
                        {
                            internalAI[6] -= 1500;
                            Shadowkill     = true;
                            Invisible      = true;
                        }
                        else if (Main.rand.Next(4) == 0 && internalAI[6] >= 500)
                        {
                            internalAI[0]  = AISTATE_SPIN;
                            internalAI[6] -= 500;
                        }
                        npc.ai        = new float[4];
                        npc.netUpdate = true;
                    }
                    else if (internalAI[3] >= 95)
                    {
                        internalAI[3] = 0;
                    }
                }

                if (internalAI[2] > 3 && Main.netMode != 1)
                {
                    internalAI[1] = 0;
                    internalAI[2] = 0;
                }
            }
            else if (internalAI[0] == AISTATE_PROJ)
            {
                if (ProjectileShoot == -1 && Main.netMode != 1)
                {
                    ProjectileShoot = Main.rand.Next(2);
                    npc.netUpdate   = true;
                }
                if (ProjectileShoot == 0)
                {
                    if (internalAI[2] == 5 && internalAI[1] == 3 && Main.netMode != 1)
                    {
                        repeat -= 1;
                        int     projType = mod.ProjectileType("HarukaKunai");
                        float   spread   = 45f * 0.0174f;
                        Vector2 dir      = Vector2.Normalize(player.Center - npc.Center);
                        dir *= 14f;
                        float  baseSpeed  = (float)Math.Sqrt((dir.X * dir.X) + (dir.Y * dir.Y));
                        double startAngle = Math.Atan2(dir.X, dir.Y) - .1d;
                        double deltaAngle = spread / 6f;
                        for (int i = 0; i < 3; i++)
                        {
                            double offsetAngle = startAngle + (deltaAngle * i);
                            Projectile.NewProjectile(npc.Center.X, npc.Center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), projType, damage * 1, 5, Main.myPlayer);
                        }
                    }
                    if ((internalAI[2] < 4 || internalAI[2] > 6) && Main.netMode != 1)
                    {
                        internalAI[1] = 0;
                        internalAI[2] = 4;
                    }
                    if (repeat <= 0)
                    {
                        npc.frameCounter = 0;
                        Frame            = 0;
                        if (Main.netMode != 1)
                        {
                            internalAI[0]    = 3;
                            internalAI[1]    = 0;
                            internalAI[2]    = 0;
                            internalAI[3]    = 0;
                            internalAI[4]    = 0;
                            ProjectileShoot -= 1;
                            repeat           = 12;
                            npc.ai           = new float[4];
                            npc.netUpdate    = true;
                        }
                    }
                }
                else if (ProjectileShoot == 1)
                {
                    internalAI[3]++;
                    if (Main.netMode != 1)
                    {
                        if (internalAI[3] == 100 || internalAI[3] == 200 || internalAI[3] == 299)
                        {
                            isSlashing = true;
                        }
                        if (isSlashing)
                        {
                            if (internalAI[2] < 7 || internalAI[2] > 9)
                            {
                                internalAI[1] = 0;
                                internalAI[2] = 7;
                                npc.netUpdate = true;
                            }
                        }
                        else
                        {
                            if (internalAI[2] > 3)
                            {
                                internalAI[1] = 0;
                                internalAI[2] = 0;
                                npc.netUpdate = true;
                            }
                        }
                    }

                    if (internalAI[2] == 8 && internalAI[1] == 4 && Main.netMode != 1)
                    {
                        Vector2 targetCenter = player.position + new Vector2(player.width * 0.5f, player.height * 0.5f);
                        Vector2 fireTarget   = npc.Center;
                        int     projType     = ModContent.ProjectileType <WrathHarukaProj>();
                        BaseAI.FireProjectile(targetCenter, fireTarget, projType, damage * 1, 0f, 14f);
                    }
                    if (isSlashing && internalAI[2] > 9)
                    {
                        isSlashing = false;
                    }
                    if (internalAI[3] > 300)
                    {
                        npc.frameCounter = 0;
                        Frame            = 0;
                        if (Main.netMode != 1)
                        {
                            internalAI[0]    = 3;
                            internalAI[1]    = 0;
                            internalAI[2]    = 0;
                            internalAI[3]    = 0;
                            internalAI[4]    = 0;
                            ProjectileShoot -= 1;
                            npc.ai           = new float[4];
                            npc.netUpdate    = true;
                        }
                    }
                }
            }
            else if (internalAI[0] == AISTATE_SLASH)
            {
                internalAI[3]++;

                if (SHADOWCONTER > 0)
                {
                    SHADOWCONTER--;
                }
                else
                {
                    if (internalAI[2] < 17)
                    {
                        internalAI[1] = 0;
                        internalAI[2] = 17;
                    }
                    if (internalAI[2] > 26)
                    {
                        internalAI[1]  = 0;
                        internalAI[2]  = 17;
                        internalAI[4] += 1;
                    }
                    if (internalAI[4] > 5)
                    {
                        npc.frameCounter = 0;
                        Frame            = 0;
                        if (Main.netMode != 1)
                        {
                            internalAI[0] = 3;
                            internalAI[1] = 0;
                            internalAI[2] = 0;
                            internalAI[3] = 0;
                            internalAI[4] = 0;
                            if (internalAI[6] >= 500 && Main.rand.Next(2) == 0)
                            {
                                internalAI[0]  = AISTATE_SPIN;
                                internalAI[6] -= 500;
                                npc.netUpdate  = true;
                            }
                            else
                            {
                                internalAI[0] = 3;
                                npc.netUpdate = true;
                            }
                            npc.ai = new float[4];
                        }
                    }
                }
            }
            else if (internalAI[0] == AISTATE_SPIN)
            {
                internalAI[4]++;

                if (SHADOWCONTER > 0)
                {
                    SHADOWCONTER--;
                }
                else
                {
                    if (internalAI[2] < 10)
                    {
                        internalAI[1] = 0;
                        internalAI[2] = 10;
                    }
                    if (internalAI[2] > 16)
                    {
                        internalAI[1] = 0;
                        internalAI[2] = 13;
                    }

                    if (internalAI[4] < 100)
                    {
                        SelectPoint = true;
                    }

                    if (InvisTimer1 - internalAI[5] <= 120)
                    {
                        internalAI[5] -= 120;
                    }

                    if (SelectPoint)
                    {
                        MovePoint   = player.Center;
                        SelectPoint = false;
                    }

                    if (strikebackproj != 0)
                    {
                        for (int i = 0; i < 1000; i++)
                        {
                            if (npc.Hitbox.Intersects(Main.projectile[i].Hitbox) && Main.projectile[i].friendly && Main.projectile[i].damage > 0)
                            {
                                strikebackproj++;
                                break;
                            }
                        }
                    }


                    if (internalAI[4] > 200)
                    {
                        npc.frameCounter = 0;
                        Frame            = 0;

                        if (internalAI[6] >= 2000 && Main.expertMode)
                        {
                            internalAI[6] -= 2000;
                            Shadowkill     = true;
                            Invisible      = true;
                            npc.netUpdate  = true;
                        }
                        else if (Main.rand.Next(2) == 0)
                        {
                            internalAI[0] = AISTATE_PROJ;
                            npc.netUpdate = true;
                        }
                        else
                        {
                            internalAI[0] = 3;
                            npc.netUpdate = true;
                        }

                        internalAI[1] = 0;
                        internalAI[2] = 0;
                        internalAI[3] = 0;
                        internalAI[4] = 0;
                        pos          *= -1f;
                        npc.ai        = new float[4];

                        int     projType = ModContent.ProjectileType <WrathHarukaProj>();
                        float   spread   = 45f * 0.0174f;
                        Vector2 dir      = Vector2.Normalize(player.Center - npc.Center);
                        dir *= 14f;
                        float  baseSpeed  = (float)Math.Sqrt((dir.X * dir.X) + (dir.Y * dir.Y));
                        double startAngle = Math.Atan2(dir.X, dir.Y) - .1d;
                        double deltaAngle = spread / 6f;
                        if (Main.netMode != 1)
                        {
                            for (int i = 0; i < 3; i++)
                            {
                                double offsetAngle = startAngle + (deltaAngle * i);
                                Projectile.NewProjectile(npc.Center.X, npc.Center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), projType, damage, 0, Main.myPlayer);
                            }
                            if (strikebackproj != 0)
                            {
                                startAngle -= .1d * (strikebackproj / 2);
                                deltaAngle  = spread / 3f;
                                for (int i = 0; i < strikebackproj; i++)
                                {
                                    double offsetAngle = startAngle + (deltaAngle * i);
                                    Projectile.NewProjectile(npc.Center.X, npc.Center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), mod.ProjectileType("HarukaArrow"), damage, 0, Main.myPlayer);
                                }
                            }
                        }
                        strikebackproj = 0;
                    }
                    else if (internalAI[4] > 100)
                    {
                        MovePoint = player.Center - new Vector2(pos * 1.5f, 0);
                    }
                }
            }
            else if (internalAI[0] == AISTATE_Shadowkilling)
            {
                ShadowNPC[0] = npc.whoAmI;
                internalAI[4]++;
                if (npc.alpha >= 255)
                {
                    SpawnClone = true;
                }
                Shadowkilling();
            }
            else
            {
                if (Main.netMode != 1)
                {
                    internalAI[0] = 3;
                    internalAI[1] = 0;
                    internalAI[2] = 0;
                    internalAI[3] = 0;
                    npc.ai        = new float[4];
                }
            }

            if (internalAI[0] == AISTATE_SLASH || internalAI[0] == AISTATE_SPIN) //Melee Damage/Speed boost
            {
                npc.damage  = 180;
                npc.defense = 300;
            }
            else if (internalAI[0] == AISTATE_Shadowkilling) //Melee Damage/Speed boost
            {
                npc.damage  = 150;
                npc.defense = 9999;
            }
            else //Reset Stats
            {
                npc.defense = npc.defDefense;
                npc.damage  = 80;
            }


            if (internalAI[0] == AISTATE_IDLE || internalAI[0] == AISTATE_PROJ || Invisible) //When charging the player
            {
                MoveToPoint(wantedVelocity);
            }
            else if (internalAI[0] == AISTATE_SPIN)
            {
                if (SHADOWCONTER > 0)
                {
                    LOOPPOINT(player.Center + new Vector2(500f, 0), player.Center - new Vector2(500f, 0));
                }
                else
                {
                    MoveToPoint(MovePoint);
                }
            }
            else if (internalAI[0] == AISTATE_SLASH) //When charging the player
            {
                if (SHADOWCONTER > 0)
                {
                    LOOPPOINT(player.Center + new Vector2(500f, 0), player.Center - new Vector2(500f, 0));
                }
                else
                {
                    MoveToPoint(player.Center);
                }
            }
            npc.rotation = 0;

            npc.noTileCollide = true;
        }
Пример #8
0
 public override void OnExitCombat()
 {
     BaseAI.LeaveFromaRange(GetID());
 }
Пример #9
0
 public CanMoveCondition(BaseAI baseAI)
 {
     MyAI = baseAI;
 }
 public FaceMoveDirectionTask(BaseAI baseAI)
 {
     Myai = baseAI;
 }
        // Token: 0x060017BB RID: 6075 RVA: 0x00066F64 File Offset: 0x00065164
        public CharacterMaster Perform()
        {
            TeamIndex teamIndex;

            if (this.teamIndexOverride != null)
            {
                teamIndex = this.teamIndexOverride.Value;
            }
            else
            {
                if (!this.summonerBodyObject)
                {
                    Debug.LogErrorFormat("Cannot spawn master {0}: No team specified.", new object[]
                    {
                        this.masterPrefab
                    });
                    return(null);
                }
                teamIndex = TeamComponent.GetObjectTeam(this.summonerBodyObject);
            }
            if (!this.ignoreTeamMemberLimit)
            {
                TeamDef teamDef = TeamCatalog.GetTeamDef(teamIndex);
                if (teamDef == null)
                {
                    Debug.LogErrorFormat("Attempting to spawn master {0} on TeamIndex.None. Is this intentional?", new object[]
                    {
                        this.masterPrefab
                    });
                    return(null);
                }
                if (teamDef != null && teamDef.softCharacterLimit <= TeamComponent.GetTeamMembers(teamIndex).Count)
                {
                    return(null);
                }
            }
            CharacterBody   characterBody   = null;
            CharacterMaster characterMaster = null;

            if (this.summonerBodyObject)
            {
                characterBody = this.summonerBodyObject.GetComponent <CharacterBody>();
            }
            if (characterBody)
            {
                characterMaster = characterBody.master;
            }
            GameObject      gameObject = UnityEngine.Object.Instantiate <GameObject>(this.masterPrefab, this.position, this.rotation);
            CharacterMaster component  = gameObject.GetComponent <CharacterMaster>();

            component.teamIndex = teamIndex;
            if (this.loadout != null)
            {
                component.SetLoadoutServer(this.loadout);
            }
            CharacterMaster characterMaster2 = characterMaster;

            if (characterMaster2 && characterMaster2.minionOwnership.ownerMaster)
            {
                characterMaster2 = characterMaster2.minionOwnership.ownerMaster;
            }
            component.minionOwnership.SetOwner(characterMaster2);
            if (this.summonerBodyObject)
            {
                AIOwnership component2 = gameObject.GetComponent <AIOwnership>();
                if (component2)
                {
                    if (characterMaster)
                    {
                        component2.ownerMaster = characterMaster;
                    }
                    CharacterBody component3 = this.summonerBodyObject.GetComponent <CharacterBody>();
                    if (component3)
                    {
                        CharacterMaster master = component3.master;
                        if (master)
                        {
                            component2.ownerMaster = master;
                        }
                    }
                }
                BaseAI component4 = gameObject.GetComponent <BaseAI>();
                if (component4)
                {
                    component4.leader.gameObject = this.summonerBodyObject;
                }
            }
            Action <CharacterMaster> action = this.preSpawnSetupCallback;

            if (action != null)
            {
                action(component);
            }
            NetworkServer.Spawn(gameObject);
            component.Respawn(this.position, this.rotation, false);
            return(component);
        }
Пример #12
0
        public override void AI()
        {
            Player p = Main.player[projectile.owner];

            BaseAI.AIBoomerang(projectile, ref projectile.ai, p.position, p.width, p.height, true, 28f, 45, 1.2f, .5f, false);
        }
Пример #13
0
 public override bool OnTileCollide(Vector2 oldVelocity)
 {
     BaseAI.TileCollideBoomerang(projectile, ref projectile.velocity, false);
     return(false);
 }
Пример #14
0
        public override void AI()
        {
            bool BlazeGrip = npc.type == ModContent.NPCType <BlazeGrip>();

            if (Main.expertMode)
            {
                damage = npc.damage / 4;
            }
            else
            {
                damage = npc.damage / 2;
            }
            npc.TargetClosest();
            Player targetPlayer = Main.player[npc.target];

            float ChangingPosX = 350f * (targetPlayer.Center.X > npc.Center.X? 1:-1);
            float ChangingPosY = 350f * (targetPlayer.Center.Y > npc.Center.Y? 1:-1);

            if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f)
            {
                npc.TargetClosest(false);
                DespawnHandler();
                return;
            }

            if (npc.ai[0] == 1)            //move to starting charge position
            {
                moveSpeed = 14f;
                Vector2 point = targetPlayer.Center + offsetBasePoint + new Vector2(0f, -ChangingPosY);
                MoveToPoint(point);
                internalAI[0]++;
                if (Main.netMode != 1 && (Vector2.Distance(npc.Center, point) < 10f || internalAI[0] > 100))
                {
                    npc.ai[0]     = 4;
                    npc.ai[1]     = 0;
                    npc.ai[2]     = 0;
                    npc.ai[3]     = 0;
                    internalAI[0] = 0;
                    internalAI[1] = 0;
                    internalAI[2] = 0;
                    npc.netUpdate = true;
                }
                BaseAI.LookAt(targetPlayer.Center, npc, 0, 0f, 0.1f, false);
            }
            else
            if (npc.ai[0] == 2)            //dive prepare
            {
                if (internalAI[2] >= 1)
                {
                    internalAI[2]++;
                }
                moveSpeed = 22f;
                Vector2 targetCenter = new Vector2(npc.ai[1], npc.ai[2]);
                Vector2 point        = targetCenter + new Vector2(ChangingPosX, ChangingPosY);
                Keepmove = point;
                if (Keepmove != new Vector2(0, 0))
                {
                    MoveToPoint(Keepmove);
                    if (Main.netMode != 1)
                    {
                        Main.PlaySound(SoundID.Roar, npc.position, 0);
                        npc.ai[0]     = 3;
                        npc.netUpdate = true;
                    }
                }
                else
                {
                    npc.ai[0]     = 0;
                    npc.ai[3]     = 0;
                    npc.netUpdate = true;
                }
                BaseAI.Look(npc, 0, 0f, 0.1f, false);
            }
            else
            if (npc.ai[0] == 3)            //diving
            {
                if (internalAI[2] >= 1)
                {
                    internalAI[2]++;
                }
                moveSpeed = 22f;
                MoveToPoint(Keepmove);
                if (Main.netMode != 1 && (Vector2.Distance(npc.Center, Keepmove) < 10f || npc.ai[3]++ > 60))
                {
                    npc.ai[0] = 2;
                    npc.ai[1] = targetPlayer.Center.X;
                    npc.ai[2] = targetPlayer.Center.Y;
                    npc.ai[3] = 0;
                    if (internalAI[1]++ > 4 && internalAI[2] == 0)
                    {
                        npc.ai[0]     = 0;
                        internalAI[1] = 0;
                    }
                    if (internalAI[2] > 200)
                    {
                        npc.ai[0]     = 6;
                        internalAI[1] = 0;
                        internalAI[2] = 0;
                    }
                    npc.netUpdate = true;
                }
            }
            else
            if (npc.ai[0] == 4) //Projectile skill
            {
                npc.direction = npc.spriteDirection = npc.position.X < targetPlayer.position.X ? -1 : 1;
                npc.rotation  = npc.DirectionTo(targetPlayer.Center).ToRotation() + (npc.position.X < targetPlayer.position.X ? 0 : (float)Math.PI);
                moveSpeed     = 14f;
                Vector2 point = targetPlayer.Center + offsetBasePoint + new Vector2(-ChangingPosX, 0);
                MoveToPoint(point);
                internalAI[0]++;
                if (internalAI[0] == 100 && Main.netMode != 1)
                {
                    if (BlazeGrip)
                    {
                        Projectile.NewProjectile(npc.Center + 50f * Vector2.Normalize(npc.DirectionTo(targetPlayer.Center)), new Vector2(0, 0), mod.ProjectileType("BlazeCloneClaw"), damage / 2, 0f, Main.myPlayer, npc.whoAmI, 0);
                        Projectile.NewProjectile(npc.Center + 50f * Vector2.Normalize(npc.DirectionTo(targetPlayer.Center)) + 200f * Vector2.Normalize(npc.DirectionTo(targetPlayer.Center).RotatedBy(Math.PI / 2)), new Vector2(0, 0), mod.ProjectileType("BlazeCloneClaw"), damage / 2, 0f, Main.myPlayer, npc.whoAmI, 1f);
                        Projectile.NewProjectile(npc.Center + 50f * Vector2.Normalize(npc.DirectionTo(targetPlayer.Center)) + 400f * Vector2.Normalize(npc.DirectionTo(targetPlayer.Center).RotatedBy(Math.PI / 2)), new Vector2(0, 0), mod.ProjectileType("BlazeCloneClaw"), damage / 2, 0f, Main.myPlayer, npc.whoAmI, 2f);
                        Projectile.NewProjectile(npc.Center + 50f * Vector2.Normalize(npc.DirectionTo(targetPlayer.Center)) - 200f * Vector2.Normalize(npc.DirectionTo(targetPlayer.Center).RotatedBy(Math.PI / 2)), new Vector2(0, 0), mod.ProjectileType("BlazeCloneClaw"), damage / 2, 0f, Main.myPlayer, npc.whoAmI, -1f);
                        Projectile.NewProjectile(npc.Center + 50f * Vector2.Normalize(npc.DirectionTo(targetPlayer.Center)) - 400f * Vector2.Normalize(npc.DirectionTo(targetPlayer.Center).RotatedBy(Math.PI / 2)), new Vector2(0, 0), mod.ProjectileType("BlazeCloneClaw"), damage / 2, 0f, Main.myPlayer, npc.whoAmI, -2f);
                    }
                    else
                    {
                        for (int m = 0; m < 16; m++)
                        {
                            Projectile.NewProjectile(npc.Center, new Vector2(0, 0), mod.ProjectileType("AbyssGripOrbiter"), npc.damage / 2, 0f, Main.myPlayer, npc.whoAmI, 2f * (float)Math.PI / 16 * m);
                        }
                    }
                }

                if (internalAI[0] > 200)
                {
                    if (Main.netMode != 1)
                    {
                        npc.ai[0]     = 5;
                        npc.ai[1]     = 0;
                        npc.ai[2]     = 0;
                        npc.ai[3]     = 0;
                        internalAI[0] = 0;
                        internalAI[1] = 0;
                        internalAI[2] = 0;
                    }
                    npc.netUpdate = true;
                }
            }
            else
            if (npc.ai[0] == 5) //Projectile skill2
            {
                if (BlazeGrip)
                {
                    if (internalAI[2] < 160)
                    {
                        BaseAI.LookAt(targetPlayer.Center, npc, 0, 0f, 0.1f, false);
                        moveSpeed = 18f;
                        Vector2 point = targetPlayer.Center + offsetBasePoint + new Vector2(0f, -ChangingPosY);
                        MoveToPoint(point);
                    }
                    else
                    {
                        npc.direction = npc.spriteDirection = npc.position.X < targetPlayer.position.X ? -1 : 1;
                        npc.rotation += (npc.DirectionTo(targetPlayer.Center).ToRotation() + (npc.position.X < targetPlayer.position.X ? 0 : (float)Math.PI)) / 100f;
                        npc.velocity  = new Vector2(0, 0);
                    }


                    internalAI[2]++;
                    if (internalAI[2] == 160 && Main.netMode != 1)
                    {
                        Vector2 dir        = Vector2.Normalize(targetPlayer.Center - npc.Center);
                        float   baseSpeed  = (float)Math.Sqrt((dir.X * dir.X) + (dir.Y * dir.Y));
                        double  startAngle = Math.Atan2(dir.X, dir.Y);
                        double  deltaAngle = 45f * 0.0174f;
                        for (int i = -1; i < 2; i++)
                        {
                            double  offsetAngle = startAngle + (deltaAngle * i);
                            Vector2 shootdir    = new Vector2(baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle));
                            Projectile.NewProjectile(npc.Center, Vector2.Normalize(shootdir), ModContent.ProjectileType <BlazeGripRay>(), npc.damage / 4, 0f, Main.myPlayer, i, npc.whoAmI);
                        }
                    }
                    if (internalAI[2] > 200)
                    {
                        npc.ai[0]     = 6;
                        npc.ai[1]     = 0;
                        npc.ai[2]     = 0;
                        npc.ai[3]     = 0;
                        internalAI[0] = 0;
                        internalAI[1] = 0;
                        internalAI[2] = 0;
                        npc.netUpdate = true;
                    }
                }
                else
                {
                    moveSpeed = 22f;
                    Vector2 targetCenter = npc.position;
                    Vector2 point        = targetCenter + new Vector2(ChangingPosX, ChangingPosY);
                    Keepmove = point;
                    if (Keepmove != new Vector2(0, 0))
                    {
                        MoveToPoint(Keepmove);
                        if (Main.netMode != 1)
                        {
                            Main.PlaySound(SoundID.Roar, npc.position, 0);
                            npc.ai[0] = 3;
                            internalAI[2]++;
                            internalAI[1] = 0;
                            npc.netUpdate = true;
                        }
                    }
                    else
                    {
                        Keepmove = targetCenter;
                    }
                }
            }
            else
            if (npc.ai[0] == 6) //Fire Projectile (Shen Grips)
            {
                internalAI[0]++;
                if (BlazeGrip && internalAI[0] < 40)
                {
                    npc.direction = npc.spriteDirection = npc.position.X < targetPlayer.position.X ? -1 : 1;
                    npc.rotation += (npc.DirectionTo(targetPlayer.Center).ToRotation() + (npc.position.X < targetPlayer.position.X ? 0 : (float)Math.PI)) / 100f;
                    npc.velocity  = new Vector2(0, 0);
                }
                else
                {
                    moveSpeed = 22f;
                    Vector2 point = targetPlayer.Center + offsetBasePoint + new Vector2(0f, -ChangingPosY);
                    MoveToPoint(point);
                }
                if (internalAI[0] == 40)
                {
                    BaseAI.FireProjectile(targetPlayer.Center, npc.Center, BlazeGrip ? ModContent.ProjectileType <BlazeBomb>() : ModContent.ProjectileType <AbyssalBomb>(), damage, 2, 9f, -1, Main.myPlayer);
                }
                if (internalAI[0] > 50)
                {
                    npc.ai[0]     = 2;
                    npc.ai[1]     = targetPlayer.Center.X;
                    npc.ai[2]     = targetPlayer.Center.Y;
                    npc.ai[3]     = 0;
                    internalAI[0] = 0;
                    internalAI[1] = 0;
                    internalAI[2] = 0;
                    npc.netUpdate = true;
                }
                BaseAI.LookAt(targetPlayer.Center, npc, 0, 0f, 0.1f, false);
            }
            else //standard movement
            {
                moveSpeed = 14f;
                Vector2 point = targetPlayer.Center + offsetBasePoint;
                MoveToPoint(point);
                if (Main.netMode != 1)
                {
                    npc.ai[1]++;
                    if (npc.ai[1] > 90)
                    {
                        npc.ai[0]     = 1;
                        npc.ai[1]     = 0;
                        npc.ai[2]     = 0;
                        npc.ai[3]     = 0;
                        internalAI[1] = 0;
                        internalAI[2] = 0;
                        npc.netUpdate = true;
                    }
                }
                BaseAI.LookAt(targetPlayer.Center, npc, 0, 0f, 0.1f, false);
            }
            if (npc.ai[0] == 0)
            {
                if (npc.alpha >= 50)
                {
                    npc.defense = 500;
                }
            }
            else
            {
                npc.alpha -= 5;
                if (npc.alpha <= 0)
                {
                    if (BlazeGrip)
                    {
                        npc.defense = 110;
                    }
                    else
                    {
                        npc.defense = 90;
                    }
                }
            }
        }