Esempio n. 1
0
        public override void NPCLoot()
        {
            Item staritem = new Item();

            staritem.SetDefaults(mod.ItemType("twilightShard"));
            staritem.stack = Main.rand.Next(5, 25);
            player.GetItem(15, staritem);

            int randItem = Main.rand.Next(3);

            switch (randItem)
            {
            default:
                break;

            case 0:
                Item.NewItem(npc.getRect(), mod.ItemType("Keyblade_Kingdom"));
                break;

            case 1:
                Item.NewItem(npc.getRect(), mod.ItemType("orgCoat"));
                break;

            case 2:
                Item.NewItem(npc.getRect(), mod.ItemType("seasaltIcecream"));
                break;
            }

            Conversation[] conv = new Conversation[] { new Conversation("Good fight, but I still went easy on you", Color.Yellow, 50000, "Xion") };
            DialogSystem.AddConversation(conv);
        }
Esempio n. 2
0
 public override bool CheckDead()
 {
     if (!NPC.downedMoonlord)
     {
         if (NPC.timeLeft > 20 && !defeated)
         {
             Conversation[] conv = new Conversation[] { new Conversation("Good fight, but I still went easy on you", Color.Yellow, DialogSystem.BOSS_DIALOGTIME, "Xion") };
             DialogSystem.AddConversation(conv);
         }
     }
     else
     {
         if (!defeated)
         {
             ProjectileSource_NPC s = new ProjectileSource_NPC(NPC);
             Projectile.NewProjectile(s, Main.player[NPC.target].Center, Vector2.Zero, ModContent.ProjectileType <FinalXionSpawnProjectile>(), 0, 0);
             NPC.timeLeft = (NPC.timeLeft > 5) ? 1 : NPC.timeLeft;
             defeated     = true;
             defeatTime   = 0;
         }
     }
     KingdomWorld.downedXionPhases[1] = true;
     defeated = true;
     NPC.life = 1;
     return(false);
 }
Esempio n. 3
0
        public override void AI()
        {
            npc.velocity = Vector2.Zero;
            npc.TargetClosest();
            Target();
            DespawnHandler();

            if (npc.timeLeft <= 10)
            {
                return;
            }

            if (defeated)
            {
                npc.velocity = Vector2.Zero;
                defeatTime--;
                if (defeatTime <= 0)
                {
                    npc.life     = -1;
                    npc.timeLeft = 1;
                    defeatTime   = 1000;
                }

                return;
            }

            for (int i = 0; i < armProj.Length; i++)
            {
                if (armProj[i] == -1)
                {
                    npc.Center = player.Center + new Vector2(0, -300);
                    Conversation[] conv = new Conversation[] { new Conversation("Let's get serious!", Color.Yellow, 50000, "Xion") };
                    DialogSystem.AddConversation(conv);
                    armProj[i] = Projectile.NewProjectile(npc.Center, npc.velocity, mod.ProjectileType("xion_finalPhase_arms"), attacksDamage[curAttack], 1);
                    Projectile.NewProjectile(npc.Center, Vector2.Zero, mod.ProjectileType("darkPortal"), 0, 0);
                }
                else
                {
                    Main.projectile[armProj[i]].timeLeft = 5;
                    switch (i)
                    {
                    case 0:
                        Main.projectile[armProj[i]].Center          = new Vector2(npc.Center.X - 157f, npc.Center.Y - 295f);
                        Main.projectile[armProj[i]].spriteDirection = 1;
                        Main.projectile[armProj[i]].rotation        = -(float)Math.PI / 2;
                        break;

                    case 1:
                        Main.projectile[armProj[i]].Center          = new Vector2(npc.Center.X + 157f, npc.Center.Y - 295f);
                        Main.projectile[armProj[i]].spriteDirection = -1;
                        Main.projectile[armProj[i]].rotation        = (float)Math.PI / 2;
                        break;
                    }
                }
            }

            Attacks();
        }
Esempio n. 4
0
 public override void OnRespawn(Player player)
 {
     if (!playerDied)
     {
         Conversation[] conv = new Conversation[] { new Conversation("So you can come back from death? How can you do that?", Color.Blue, DialogSystem.NPC_DIALOGTIME, "Sora") };
         DialogSystem.AddConversation(conv);
         playerDied = true;
     }
 }
Esempio n. 5
0
        public override void AI()
        {
            NPC.velocity = Vector2.Zero;
            NPC.TargetClosest();
            Target();
            DespawnHandler();

            if (NPC.timeLeft <= 10)
            {
                return;
            }

            if (defeated)
            {
                NPC.velocity = Vector2.Zero;
                defeatTime--;
                if (defeatTime <= 0)
                {
                    NPC.life     = -1;
                    NPC.timeLeft = 1;
                    defeatTime   = 1000;
                }

                return;
            }

            for (int i = 0; i < armProj.Length; i++)
            {
                if (armProj[i] == -1)
                {
                    Conversation[] conv = new Conversation[] { new Conversation("NO HOLDING BACK!!!", Color.Yellow, DialogSystem.BOSS_DIALOGTIME, "Xion") };
                    DialogSystem.AddConversation(conv);
                    armProj[i] = Projectile.NewProjectile(s, NPC.Center, NPC.velocity, ModContent.ProjectileType <Projectiles.BossStuff.xion_finalPhase_arms>(), attacksDamage[curAttack], 1);
                    Projectile.NewProjectile(s, NPC.Center, Vector2.Zero, ModContent.ProjectileType <Projectiles.darkPortal>(), 0, 0);
                }
                else
                {
                    Main.projectile[armProj[i]].timeLeft = 5;
                    switch (i)
                    {
                    case 0:
                        Main.projectile[armProj[i]].Center          = new Vector2(NPC.Center.X - 157f, NPC.Center.Y - 295f);
                        Main.projectile[armProj[i]].spriteDirection = 1;
                        Main.projectile[armProj[i]].rotation        = -(float)Math.PI / 2;
                        break;

                    case 1:
                        Main.projectile[armProj[i]].Center          = new Vector2(NPC.Center.X + 157f, NPC.Center.Y - 295f);
                        Main.projectile[armProj[i]].spriteDirection = -1;
                        Main.projectile[armProj[i]].rotation        = (float)Math.PI / 2;
                        break;
                    }
                }
            }

            Attacks();
        }
Esempio n. 6
0
        public override void DespawnQuote()
        {
            Conversation[] conv;

            switch (Main.rand.Next(0, 4))
            {
            default:
            case 0:
                conv = new Conversation[] { new Conversation("Sorry, kid. No one axes Axel", Color.Red, DialogSystem.BOSS_DIALOGTIME, "Axel") };
                break;

            case 1:
                conv = new Conversation[] { new Conversation("Don't say I didn't warn you!", Color.Red, DialogSystem.BOSS_DIALOGTIME, "Axel") };
                break;
            }
            DialogSystem.AddConversation(conv);
        }
Esempio n. 7
0
 void DespawnHandler()
 {
     if (!player.active || player.dead || player.statLife == 0)
     {
         npc.TargetClosest(false);
         player = Main.player[npc.target];
         if (!player.active || player.dead || player.statLife == 0)
         {
             npc.velocity = new Vector2(0, 100000);
             if (npc.timeLeft > 10)
             {
                 npc.timeLeft = 1;
                 Conversation[] conv = new Conversation[] { new Conversation("No good", Color.Yellow, 50000, "Xion") };
                 DialogSystem.AddConversation(conv);
             }
         }
     }
 }
Esempio n. 8
0
 void DespawnHandler()
 {
     if (!player.active || player.dead || player.statLife == 0)
     {
         NPC.TargetClosest(false);
         player = Main.player[NPC.target];
         if (!player.active || player.dead || player.statLife == 0)
         {
             NPC.velocity = new Vector2(0, 100000);
             if (NPC.timeLeft > 10)
             {
                 NPC.timeLeft = 1;
                 Conversation[] conv = new Conversation[] { new Conversation("Try again", Color.Yellow, DialogSystem.BOSS_DIALOGTIME, "Xion") };
                 DialogSystem.AddConversation(conv);
             }
         }
     }
 }
Esempio n. 9
0
 public override bool CheckDead()
 {
     if (!defeated)
     {
         //if (!NPC.downedMoonlord)
         {
             if (NPC.timeLeft > 20 && !defeated)
             {
                 NPC.NPCLoot();
                 Conversation[] conv = new Conversation[] { new Conversation("Can't... keep... fighting...", Color.Yellow, DialogSystem.BOSS_DIALOGTIME, "Xion") };
                 DialogSystem.AddConversation(conv);
             }
         }
         KingdomWorld.downedXionPhases[2] = true;
         defeated = true;
         NPC.life = 1;
     }
     return(false);
 }
Esempio n. 10
0
        public override void OnEnterWorld(Player player)
        {
            PartyMemberLogic.Reset();

            if (!playerCreated)
            {
                playerCreated = true;
                Conversation[] conv = new Conversation[] { new Conversation("", Color.Blue, DialogSystem.NPC_DIALOGTIME, ""), new Conversation("I need your help, we'll talk soon", Color.Blue, DialogSystem.NPC_DIALOGTIME, "Sora"), new Conversation("I've given you the power to use a Keyblade", Color.Blue, DialogSystem.NPC_DIALOGTIME, "Sora"), new Conversation("I hope to meet you soon", Color.Blue, DialogSystem.NPC_DIALOGTIME, "Sora") };
                DialogSystem.AddConversation(conv);
            }
            else
            {
                Conversation[] conv = new Conversation[] { new Conversation("I trully hope to meet you soon", Color.Blue, DialogSystem.NPC_DIALOGTIME, "Sora") };
                DialogSystem.AddConversation(conv);
            }

            if (MathHelp.Magnitude(originalSpawnPoint) == 0)
            {
                originalSpawnPoint = player.position;
            }
        }
Esempio n. 11
0
        public void GetPartyMember(int npcNum)
        {
            if (npcNum < Main.maxNPCs && Main.npc[npcNum].active && Main.npc[npcNum].townNPC)
            {
                NPC npc = Main.npc[npcNum];
                if (PartyMemberLogic.IsPartyMember(Main.npc[npcNum].type) >= 0)
                {
                    Conversation conv = new Conversation(GetMemberDialog(npc.type), Color.White, DialogSystem.NPC_DIALOGTIME, npc.GivenOrTypeName);
                    DialogSystem.AddConversation(conv);

                    PartyMemberLogic.RemovePartyMember(npc.type);
                    npc.color = Color.White;
                    npc.Teleport(new Vector2(npc.homeTileX * 16, npc.homeTileY * 16 - npc.height) - npc.velocity);
                    npc.velocity = new Vector2();
                }
                else
                {
                    Conversation conv = new Conversation(GetMemberDialog(npc.type, true), Color.White, DialogSystem.NPC_DIALOGTIME, npc.GivenOrTypeName);
                    DialogSystem.AddConversation(conv);
                    PartyMemberLogic.AddPartyMember(npc.type, Player.name);
                }
            }
        }
Esempio n. 12
0
 public override bool CheckDead()
 {
     if (!defeated)
     {
         if (!Main.hardMode)
         {
             if (NPC.timeLeft > 20)
             {
                 Conversation[] conv = new Conversation[] { new Conversation("Maybe I'll fight you for real next time.", Color.Yellow, DialogSystem.BOSS_DIALOGTIME, "Xion") };
                 DialogSystem.AddConversation(conv);
             }
         }
         else
         {
             NPC.NewNPC((int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType <xion_secondPhase>(), Target: NPC.target);
             NPC.timeLeft = (NPC.timeLeft > 5) ? 1 : NPC.timeLeft - 1;
             defeatTime   = 0;
         }
     }
     defeated = true;
     KingdomWorld.downedXionPhases[0] = true;
     NPC.life = 1;
     return(false);
 }
Esempio n. 13
0
 public override void DefeatQuote()
 {
     Conversation[] conv = new Conversation[] { new Conversation("How did this happen...?", Color.Red, DialogSystem.BOSS_DIALOGTIME, "Axel") };
     DialogSystem.AddConversation(conv);
 }
Esempio n. 14
0
        public override void AI()
        {
            npc.velocity = Vector2.Zero;
            npc.TargetClosest();
            Target();
            DespawnHandler();

            if (npc.timeLeft <= 10)
            {
                return;
            }

            if (defeated)
            {
                defeatTime--;
                if (defeatTime == 5)
                {
                    Projectile.NewProjectile(npc.Center, Vector2.Zero, mod.ProjectileType("darkPortal"), 0, 0);
                }
                else if (defeatTime <= 0)
                {
                    npc.life     = -1;
                    npc.timeLeft = 1;
                    defeatTime   = 1000;
                }

                return;
            }


            if (keyProj == -1)
            {
                npc.Center = player.Center + new Vector2(0, -300);
                Conversation[] conv = new Conversation[] { new Conversation("NO HOLDING BACK!", Color.Yellow, 50000, "Xion") };

                if (KingdomWorld.downedXionPhases[0])
                {
                    conv[0].dialog = "Let's go again!";
                }
                else if (KingdomWorld.downedXionPhases[1])
                {
                    conv[0].dialog = "Come on!";
                }

                DialogSystem.AddConversation(conv);
                keyProj = Projectile.NewProjectile(npc.Center, npc.velocity, mod.ProjectileType("EnemyKingdomKey"), attacksDamage[curAttack], 1);
                Projectile.NewProjectile(npc.Center, Vector2.Zero, mod.ProjectileType("darkPortal"), 0, 0);
            }
            else
            {
                Main.projectile[keyProj].timeLeft = 5;
            }

            if (player != null && player.active)
            {
                if (attackCooldown > 0)
                {
                    attackCooldown--;
                    npc.velocity = Vector2.Zero;
                    npc.ai[0]    = 0;
                    npc.ai[1]    = 0;
                    Main.projectile[keyProj].Center   = new Vector2((npc.spriteDirection - 1) * 17.5f + npc.Center.X, npc.Center.Y + 5);
                    Main.projectile[keyProj].rotation = (npc.spriteDirection > 0) ? 0.25f : 4.5f;
                }
                else
                {
                    switch (curAttack)
                    {
                    case 0:
                        npc.velocity = Vector2.Zero;
                        npc.ai[0]   += attackSpeed * attackSpeedMult;
                        if (npc.ai[0] > 50)
                        {
                            curAttack  = nextAttack;
                            nextAttack = Main.rand.Next(1, 5);
                            CheckCurAttack();
                        }
                        else
                        {
                            for (int i = 0; i < Main.rand.Next(0, 2); i++)
                            {
                                Dust.NewDust(AttackPos(nextAttack), npc.width, npc.height, DustID.GoldCoin);
                            }
                        }
                        break;

                    case 1:
                        npc.velocity = Vector2.Zero;
                        Attack(100);
                        break;

                    case 2:
                        npc.velocity = new Vector2(30, 0);
                        Attack(100);
                        break;

                    case 3:
                        npc.velocity = new Vector2(-30, 0);
                        Attack(75);
                        break;

                    case 4:
                        npc.velocity = new Vector2(0, 30);
                        Attack(100);
                        break;
                    }
                }
            }
        }
Esempio n. 15
0
        public override void AI()
        {
            NPC.TargetClosest();
            Target();
            DespawnHandler();

            if (NPC.timeLeft <= 10)
            {
                return;
            }
            if (hitRecoil > 0)
            {
                hitRecoil--;
                return;
            }
            NPC.velocity = Vector2.Zero;

            if (defeated)
            {
                defeatTime--;
                if (defeatTime == 5)
                {
                    Projectile.NewProjectile(s, NPC.Center, Vector2.Zero, ModContent.ProjectileType <Projectiles.darkPortal>(), 0, 0);
                    NPC.NPCLoot();
                }
                else if (defeatTime <= 0)
                {
                    NPC.life     = -1;
                    NPC.timeLeft = 1;
                    defeatTime   = 1000;
                }

                return;
            }


            if (keyProj == -1)
            {
                NPC.Center = player.Center + new Vector2(0, -300);
                Conversation[] conv = new Conversation[] { new Conversation("NO HOLDING BACK!", Color.Yellow, DialogSystem.BOSS_DIALOGTIME, "Xion") };

                if (KingdomWorld.downedXionPhases[0])
                {
                    conv[0].dialog = "Let's go again!";
                }
                else if (KingdomWorld.downedXionPhases[1])
                {
                    conv[0].dialog = "Come on!";
                }

                DialogSystem.AddConversation(conv);
                keyProj = Projectile.NewProjectile(s, NPC.Center, NPC.velocity, ModContent.ProjectileType <Projectiles.EnemyKingdomKey>(), attacksDamage[curAttack], 1);
                Projectile.NewProjectile(s, NPC.Center, Vector2.Zero, ModContent.ProjectileType <Projectiles.darkPortal>(), 0, 0);
            }
            else
            {
                if (Main.projectile[keyProj].type != ModContent.ProjectileType <Projectiles.EnemyKingdomKey>())
                {
                    keyProj = Projectile.NewProjectile(s, NPC.Center, NPC.velocity, ModContent.ProjectileType <Projectiles.EnemyKingdomKey>(), attacksDamage[curAttack], 1);
                }
                Main.projectile[keyProj].timeLeft = 5;
            }

            if (player != null && player.active)
            {
                if (attackCooldown > 0)
                {
                    attackCooldown--;
                    NPC.velocity = Vector2.Zero;
                    NPC.ai[0]    = 0;
                    NPC.ai[1]    = 0;
                    Main.projectile[keyProj].Center   = new Vector2((NPC.spriteDirection - 1) * 17.5f + NPC.Center.X, NPC.Center.Y + 5);
                    Main.projectile[keyProj].rotation = (NPC.spriteDirection > 0) ? 0.25f : 4.5f;
                }
                else
                {
                    switch (curAttack)
                    {
                    case 0:
                        NPC.velocity = Vector2.Zero;
                        NPC.ai[0]   += attackSpeed * attackSpeedMult;
                        if (NPC.ai[0] > 50)
                        {
                            curAttack  = nextAttack;
                            nextAttack = Main.rand.Next(1, 5);
                            CheckCurAttack();
                            hitCombo = 0;
                        }
                        else
                        {
                            for (int i = 0; i < Main.rand.Next(0, 2); i++)
                            {
                                Dust.NewDust(AttackPos(nextAttack), NPC.width, NPC.height, DustID.GoldCoin);
                            }
                        }
                        break;

                    case 1:
                        NPC.velocity = Vector2.Zero;
                        Attack(100);
                        break;

                    case 2:
                        NPC.velocity = new Vector2(30, 0);
                        Attack(100);
                        break;

                    case 3:
                        NPC.velocity = new Vector2(-30, 0);
                        Attack(75);
                        break;

                    case 4:
                        NPC.velocity = new Vector2(0, 30);
                        Attack(100);
                        break;
                    }
                }
            }
        }
Esempio n. 16
0
        public override void AI()
        {
            hitRecoil--;
            if (hitRecoil > 0)
            {
                NPC.velocity *= 0.75f;
                NPC.rotation += 0.1f * -NPC.direction;
                return;
            }
            else if (hitRecoil <= -90)
            {
                hitCombo = 0;
            }

            NPC.rotation      = 0;
            NPC.noTileCollide = true;
            NPC.noGravity     = true;

            NPC.TargetClosest(true);

            for (int i = 0; i < weaponProj.Length; i++)
            {
                if (weaponProj[i] == -1)
                {
                    NPC.Center = Main.player[NPC.target].Center + new Vector2(0, -300);

                    Conversation[] conv = new Conversation[] { new Conversation("Get a load of this!", Color.Yellow, DialogSystem.BOSS_DIALOGTIME, "Xigbar") };
                    DialogSystem.AddConversation(conv);

                    weaponProj[i] = Projectile.NewProjectile(s, NPC.Center, NPC.velocity, weaponType, attacksDamage[curAttack], 1);
                    Projectile.NewProjectile(s, NPC.Center, Vector2.Zero, ModContent.ProjectileType <Projectiles.darkPortal>(), 0, 0);
                }
                else
                {
                    if (Main.projectile[weaponProj[i]].type != weaponType || !Main.projectile[weaponProj[i]].active)
                    {
                        weaponProj[i] = Projectile.NewProjectile(s, NPC.Center, NPC.velocity, weaponType, attacksDamage[curAttack], 1);
                    }
                    Main.projectile[weaponProj[i]].timeLeft = 5;
                }
            }

            if (NPC.target >= 0)
            {
                DespawnHandler(Main.player[NPC.target]);

                if (NPC.timeLeft <= 10)
                {
                    return;
                }

                if (defeated)
                {
                    NPC.velocity = Vector2.Zero;
                    for (int i = 0; i < weaponProj.Length; i++)
                    {
                        Main.projectile[weaponProj[i]].Center   = HoldWeaponPoint();
                        Main.projectile[weaponProj[i]].rotation = (float)Math.PI * ((NPC.spriteDirection - 1) / 2);
                    }
                    defeatTime--;
                    if (defeatTime == 5)
                    {
                        Projectile.NewProjectile(s, NPC.Center, Vector2.Zero, ModContent.ProjectileType <Projectiles.darkPortal>(), 0, 0);
                        NPC.NPCLoot();
                    }
                    else if (defeatTime <= 0)
                    {
                        NPC.life     = -1;
                        NPC.timeLeft = 1;
                        defeatTime   = 1000;
                    }

                    return;
                }

                if (Main.player[NPC.target].Center.Y < NPC.Center.Y - 200)
                {
                    NPC.Center = new Vector2(Main.player[NPC.target].Center.X, Main.screenPosition.Y + NPC.height);
                }

                switch (curAttack)
                {
                case 0:
                    NPC.velocity = Vector2.Zero;
                    for (int i = 0; i < weaponProj.Length; i++)
                    {
                        if (MathHelp.Magnitude(Main.projectile[weaponProj[i]].Center - NPC.Center) < 5)
                        {
                            Main.projectile[weaponProj[i]].Center = HoldWeaponPoint();
                        }
                        else
                        {
                            Main.projectile[weaponProj[i]].velocity = Vector2.Lerp(Main.projectile[weaponProj[i]].velocity, MathHelp.Normalize(NPC.Center - Main.projectile[weaponProj[i]].Center) * 5, 0.5f);
                        }
                        Main.projectile[weaponProj[i]].rotation = (float)Math.PI * ((NPC.spriteDirection - 1) / 2);
                    }
                    NPC.ai[0]++;
                    if (NPC.ai[0] > 90)
                    {
                        curAttack = Main.rand.Next(1, 5);
                        CheckCurAttack();
                    }
                    break;

                case 1:

                    if (NPC.ai[1] == 1)
                    {
                        NPC.Center = Main.player[NPC.target].Center + new Vector2(200 * NPC.spriteDirection, -100);
                    }
                    else if (NPC.ai[1] < 20)
                    {
                        for (int i = 0; i < weaponProj.Length; i++)
                        {
                            Main.projectile[weaponProj[i]].Center   = HoldWeaponPoint();
                            Main.projectile[weaponProj[i]].rotation = (float)Math.PI * ((NPC.spriteDirection - 1) / 2);
                        }
                    }
                    else
                    {
                        Vector2 playerOffsetToGun;
                        for (int i = 0; i < weaponProj.Length; i++)
                        {
                            playerOffsetToGun = Main.player[NPC.target].Center - Main.projectile[weaponProj[i]].Center;
                            Main.projectile[weaponProj[i]].Center   = HoldWeaponPoint();
                            Main.projectile[weaponProj[i]].rotation = MathHelp.DegreeToQuat(Math.Atan2(playerOffsetToGun.Y, playerOffsetToGun.X));
                        }
                        if (NPC.ai[1] > 30 && (NPC.ai[1]) % 10 == 0)
                        {
                            playerOffsetToGun = Main.player[NPC.target].Center - NPC.Center;
                            int proj = Projectile.NewProjectile(s, NPC.Center, MathHelp.Normalize(playerOffsetToGun) * 13, ProjectileID.JestersArrow, attacksDamage[1], 1);
                            Main.projectile[proj].hostile  = true;
                            Main.projectile[proj].friendly = false;
                        }
                    }

                    NPC.velocity       /= 2;
                    NPC.spriteDirection = -NPC.spriteDirection;
                    NPC.rotation        = (float)Math.PI;


                    AttackTimerCheck(30 + 60);
                    break;

                case 2:


                    if (NPC.ai[1] == 1)
                    {
                        NPC.Center = Main.player[NPC.target].Center + new Vector2(350 * NPC.spriteDirection, 0);
                    }
                    else if (NPC.ai[1] < 20)
                    {
                        for (int i = 0; i < weaponProj.Length; i++)
                        {
                            Main.projectile[weaponProj[i]].Center   = HoldWeaponPoint();
                            Main.projectile[weaponProj[i]].rotation = (float)Math.PI * ((NPC.spriteDirection - 1) / 2);
                        }
                    }
                    else
                    {
                        Vector2 playerOffsetToGun;
                        for (int i = 0; i < weaponProj.Length; i++)
                        {
                            playerOffsetToGun = Main.player[NPC.target].Center - Main.projectile[weaponProj[i]].Center;
                            Main.projectile[weaponProj[i]].Center   = HoldWeaponPoint();
                            Main.projectile[weaponProj[i]].rotation = Math.Abs(MathHelp.DegreeToQuat(Math.Atan2(playerOffsetToGun.Y, playerOffsetToGun.X)));
                        }
                        if (NPC.ai[1] > 30 && (NPC.ai[1]) % 10 == 0)
                        {
                            playerOffsetToGun = Main.player[NPC.target].Center - NPC.Center;
                            int proj = Projectile.NewProjectile(s, NPC.Center, MathHelp.Normalize(playerOffsetToGun) * 13, ProjectileID.JestersArrow, attacksDamage[1], 1);
                            Main.projectile[proj].hostile  = true;
                            Main.projectile[proj].friendly = false;
                        }
                    }

                    NPC.velocity   = new Vector2(2.5f, 0) * NPC.spriteDirection;
                    NPC.velocity.Y = 0;

                    AttackTimerCheck(100);

                    break;

                case 3:


                    for (int i = 0; i < weaponProj.Length; i++)
                    {
                        Main.projectile[weaponProj[i]].Center          = HoldWeaponPoint();
                        Main.projectile[weaponProj[i]].rotation        = 0;
                        Main.projectile[weaponProj[i]].spriteDirection = NPC.spriteDirection;
                    }

                    if (NPC.ai[1] == 1)
                    {
                        NPC.Center = Main.player[NPC.target].Center + new Vector2(-250, -300);

                        bool projectileStillSpawned = false;
                        for (int i = 0; i < Main.maxProjectiles; i++)
                        {
                            if (Main.projectile[i].active && Main.projectile[i].type == ModContent.ProjectileType <Projectiles.BossStuff.xigbar_missile>())
                            {
                                projectileStillSpawned = true;
                            }
                        }
                        if (projectileStillSpawned)
                        {
                            curAttack = 1;
                            CheckCurAttack();
                            break;
                        }

                        attackProjectiles = new int[] {
                            Projectile.NewProjectile(s, NPC.Center, new Vector2(5 * NPC.spriteDirection, 0), ModContent.ProjectileType <Projectiles.BossStuff.xigbar_missile>(), attacksDamage[3], 2, ai0: NPC.spriteDirection)
                        };
                    }
                    if (NPC.ai[1] < 75)
                    {
                        for (int i = 0; i < attackProjectiles.Length; i++)
                        {
                            Main.projectile[attackProjectiles[i]].Center = HoldWeaponPoint();
                        }
                    }
                    if (NPC.ai[1] == 99)
                    {
                        for (int i = 0; i < weaponProj.Length; i++)
                        {
                            Main.projectile[weaponProj[i]].spriteDirection = 1;
                        }
                    }
                    AttackTimerCheck(100);
                    break;

                case 4:
                    for (int i = 0; i < weaponProj.Length; i++)
                    {
                        Main.projectile[weaponProj[i]].Center   = HoldWeaponPoint();
                        Main.projectile[weaponProj[i]].rotation = (float)Math.PI / 2;
                    }

                    if (NPC.ai[1] <= 30)
                    {
                        NPC.Center = Main.player[NPC.target].Center + new Vector2(0, -250);
                    }
                    else
                    {
                        if (NPC.ai[1] % 10 == 0)
                        {
                            int proj = Projectile.NewProjectile(s, NPC.Center, new Vector2(Main.rand.NextFloat(-2f, 2f), 15), ProjectileID.JestersArrow, attacksDamage[4], 1);
                            Main.projectile[proj].hostile  = true;
                            Main.projectile[proj].friendly = false;
                        }
                    }

                    AttackTimerCheck(120);
                    break;

                case 5:
                    break;

                case 6:
                    break;

                case 7:
                    break;

                case 8:
                    break;

                case 9:

                    NPC.velocity = Vector2.Zero;

                    if (NPC.ai[1] == 1)
                    {
                        NPC.Center = Main.player[NPC.target].Center + new Vector2(350 * -NPC.direction, 150);
                    }

                    AttackTimerCheck(90);
                    break;
                }
            }
            else
            {
                NPC.TargetClosest(false);
                if (NPC.target < 0)
                {
                    if (NPC.timeLeft >= 10)
                    {
                        NPC.timeLeft = 1;
                        DespawnQuote();
                    }
                }
            }
        }
Esempio n. 17
0
 public override void DespawnQuote()
 {
     Conversation[] conv = new Conversation[] { new Conversation("You had your fun?", Color.Yellow, DialogSystem.BOSS_DIALOGTIME, "Xigbar") };
     DialogSystem.AddConversation(conv);
 }
Esempio n. 18
0
 public override void DefeatQuote()
 {
     Conversation[] conv = new Conversation[] { new Conversation("Hey, not bad!", Color.Yellow, DialogSystem.BOSS_DIALOGTIME, "Xigbar") };
     DialogSystem.AddConversation(conv);
 }
Esempio n. 19
0
        public override void AI()
        {
            hitRecoil--;
            if (hitRecoil > 0)
            {
                for (int i = 0; i < weaponProj.Length; i++)
                {
                    Main.projectile[weaponProj[i]].timeLeft = 0;
                }
                NPC.rotation += 0.3f * -NPC.direction;
                return;
            }
            else if (hitRecoil <= -90)
            {
                hitCombo = 0;
            }

            NPC.rotation      = 0;
            NPC.noTileCollide = false;

            NPC.TargetClosest(true);


            for (int i = 0; i < weaponProj.Length; i++)
            {
                if (weaponProj[i] == -1)
                {
                    NPC.Center = Main.player[NPC.target].Center + new Vector2(0, -300);

                    Conversation[] conv = new Conversation[] { new Conversation("You asked for it", Color.Red, DialogSystem.BOSS_DIALOGTIME, "Axel") };
                    DialogSystem.AddConversation(conv);

                    weaponProj[i] = Projectile.NewProjectile(s, NPC.Center, NPC.velocity, weaponType, attacksDamage[curAttack], 1);
                    Projectile.NewProjectile(s, NPC.Center, Vector2.Zero, ModContent.ProjectileType <Projectiles.darkPortal>(), 0, 0);
                }
                else
                {
                    if (Main.projectile[weaponProj[i]].type != weaponType || !Main.projectile[weaponProj[i]].active)
                    {
                        weaponProj[i] = Projectile.NewProjectile(s, NPC.Center, NPC.velocity, weaponType, attacksDamage[curAttack], 1);
                    }
                    Main.projectile[weaponProj[i]].timeLeft = 5;
                }
                Projectiles.BossStuff.AxelChakrams chakram = (Projectiles.BossStuff.AxelChakrams)Main.projectile[weaponProj[i]].ModProjectile;
                chakram.bossOwner = NPC.whoAmI;
            }

            if (NPC.target >= 0)
            {
                DespawnHandler(Main.player[NPC.target]);

                if (NPC.timeLeft <= 10)
                {
                    return;
                }

                if (defeated)
                {
                    defeatTime--;
                    if (defeatTime == 5)
                    {
                        Projectile.NewProjectile(s, NPC.Center, Vector2.Zero, ModContent.ProjectileType <Projectiles.darkPortal>(), 0, 0);
                        NPC.NPCLoot();
                    }
                    else if (defeatTime <= 0)
                    {
                        NPC.life     = -1;
                        NPC.timeLeft = 1;
                        defeatTime   = 1000;
                    }

                    return;
                }

                if (Main.player[NPC.target].Center.Y < NPC.Center.Y - 200)
                {
                    NPC.Center = new Vector2(Main.player[NPC.target].Center.X, Main.screenPosition.Y + NPC.height);
                }
                for (int i = 0; i < weaponProj.Length; i++)
                {
                    Main.projectile[weaponProj[i]].damage = attacksDamage[curAttack];
                }

                switch (curAttack)
                {
                case 0:
                    NPC.velocity = Vector2.Zero;
                    for (int i = 0; i < weaponProj.Length; i++)
                    {
                        if (MathHelp.Magnitude(Main.projectile[weaponProj[i]].Center - NPC.Center) < 5)
                        {
                            Main.projectile[weaponProj[i]].Center = HoldWeaponPoint();
                        }
                        else
                        {
                            Main.projectile[weaponProj[i]].velocity = Vector2.Lerp(Main.projectile[weaponProj[i]].velocity, MathHelp.Normalize(NPC.Center - Main.projectile[weaponProj[i]].Center) * 5, 0.5f);
                        }
                        Main.projectile[weaponProj[i]].rotation = 0;
                    }
                    NPC.ai[0]++;
                    if (NPC.ai[0] > 90)
                    {
                        NPC.ai[0] = 0;
                        curAttack = Main.rand.Next(1, 4);
                    }
                    break;

                case 1:

                    Vector2 offset = Vector2.Zero;

                    //Chakrams
                    if (NPC.ai[1] < 21)
                    {
                        for (int i = 0; i < weaponProj.Length; i++)
                        {
                            Main.projectile[weaponProj[i]].Center = HoldWeaponPoint();
                        }
                    }
                    else
                    {
                        for (int i = 0; i < weaponProj.Length; i++)
                        {
                            if (NPC.ai[1] > 21 + i * 3)
                            {
                                Main.projectile[weaponProj[i]].velocity = MathHelp.Normalize(Main.player[NPC.target].Center - Main.projectile[weaponProj[i]].Center) * 2;

                                Main.projectile[weaponProj[i]].rotation += 0.4f;
                            }
                            else
                            {
                                Main.projectile[weaponProj[i]].Center = HoldWeaponPoint();
                            }
                        }
                    }

                    //Axel himself dashing
                    if (NPC.ai[1] < 15)
                    {
                        if (NPC.ai[1] <= 1 + attackSpeed * attackSpeedMult)
                        {
                            NPC.ai[0] = MathHelp.Sign(Main.player[NPC.target].Center.X - NPC.Center.X);
                        }

                        NPC.noTileCollide = true;

                        offset = Main.player[NPC.target].Center - NPC.Center;
                        offset = offset + new Vector2(0, NPC.height + Main.player[NPC.target].height / 2);

                        NPC.velocity = offset * 0.25f;
                    }
                    else if (NPC.ai[1] < 30)
                    {
                        NPC.noTileCollide = true;

                        offset = Main.player[NPC.target].Center - NPC.Center;
                        offset = offset + new Vector2((NPC.width * 2 + Main.player[NPC.target].width * 2) * NPC.ai[0], -40);

                        NPC.velocity = offset * 0.25f;
                    }
                    else
                    {
                        NPC.noTileCollide = false;
                        NPC.velocity      = offset;
                    }

                    //flaming aspect
                    for (int i = 0; i < 2; i++)
                    {
                        Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, SpeedY: Main.rand.Next(-5, 5), newColor: Color.Red);
                    }

                    AttackTimerCheck(50);

                    break;

                case 2:

                    NPC.Center += new Vector2(NPC.direction * 1, 0);

                    if (NPC.ai[1] < 40)
                    {
                        Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch);
                        for (int i = 0; i < weaponProj.Length; i++)
                        {
                            if (Vector2.Distance(HoldWeaponPoint(), Main.projectile[weaponProj[i]].Center) > 3)
                            {
                                Main.projectile[weaponProj[i]].velocity = MathHelp.Normalize(HoldWeaponPoint() - Main.projectile[weaponProj[i]].Center) * 3;
                            }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < weaponProj.Length; i++)
                        {
                            if (NPC.ai[1] % 40 < 20)
                            {
                                if (NPC.ai[1] % 40 > i * 3)
                                {
                                    Main.projectile[weaponProj[i]].velocity  = MathHelp.Normalize(Main.player[NPC.target].Center - Main.projectile[weaponProj[i]].Center) * 5;
                                    Main.projectile[weaponProj[i]].rotation -= 0.4f;
                                }
                                else if (Vector2.Distance(HoldWeaponPoint(), Main.projectile[weaponProj[i]].Center) > 3)
                                {
                                    Main.projectile[weaponProj[i]].velocity = MathHelp.Normalize(HoldWeaponPoint() - Main.projectile[weaponProj[i]].Center) * 3;
                                }
                            }
                            else if (Vector2.Distance(HoldWeaponPoint(), Main.projectile[weaponProj[i]].Center) > 3)
                            {
                                Main.projectile[weaponProj[i]].velocity = MathHelp.Normalize(HoldWeaponPoint() - Main.projectile[weaponProj[i]].Center) * 5;
                            }
                        }
                    }

                    AttackTimerCheck(160);
                    break;

                case 3:

                    for (int i = 0; i < weaponProj.Length; i++)
                    {
                        if (NPC.ai[1] > i * 3)
                        {
                            Main.projectile[weaponProj[i]].velocity  = MathHelp.Normalize(Main.player[NPC.target].Center + new Vector2(20 * i, 0) - Main.projectile[weaponProj[i]].Center) * 3;
                            Main.projectile[weaponProj[i]].rotation += 0.4f;
                        }
                        else if (Vector2.Distance(HoldWeaponPoint(), Main.projectile[weaponProj[i]].Center) > 3)
                        {
                            Main.projectile[weaponProj[i]].velocity = MathHelp.Normalize(HoldWeaponPoint() - Main.projectile[weaponProj[i]].Center) * 3;
                        }
                    }

                    if (NPC.ai[1] == 40)
                    {
                        for (int i = 0; i < weaponProj.Length; i++)
                        {
                            Main.projectile[weaponProj[i]].velocity = (Main.player[NPC.target].Center + new Vector2(20 * i, 0) - Main.projectile[weaponProj[i]].Center) * 2;
                        }
                    }

                    AttackTimerCheck(80);
                    break;

                case 4:

                    offset = Vector2.Zero;

                    //Chakrams
                    for (int i = 0; i < weaponProj.Length; i++)
                    {
                        if (NPC.ai[1] > i * 3)
                        {
                            Main.projectile[weaponProj[i]].velocity = MathHelp.Normalize(Main.player[NPC.target].Center - Main.projectile[weaponProj[i]].Center) * 3;

                            Main.projectile[weaponProj[i]].rotation += 0.7f;
                        }
                        else if (Vector2.Distance(HoldWeaponPoint(), Main.projectile[weaponProj[i]].Center) > 3)
                        {
                            Main.projectile[weaponProj[i]].velocity = MathHelp.Normalize(HoldWeaponPoint() - Main.projectile[weaponProj[i]].Center) * 3;
                        }
                    }

                    //Axel himself dashing
                    if (NPC.ai[1] < 2)
                    {
                        if (NPC.ai[1] <= 1 + attackSpeed * attackSpeedMult)
                        {
                            NPC.ai[0] = MathHelp.Sign(Main.player[NPC.target].Center.X - NPC.Center.X);
                        }

                        NPC.noTileCollide = true;

                        offset = Main.player[NPC.target].Center - NPC.Center;
                        offset = offset + new Vector2(0, NPC.height + Main.player[NPC.target].height / 2);

                        NPC.velocity = offset * 0.5f;
                    }
                    else if (NPC.ai[1] < 8)
                    {
                        NPC.noTileCollide = true;

                        offset = Main.player[NPC.target].Center - NPC.Center;
                        offset = offset + new Vector2((NPC.width * 2 + Main.player[NPC.target].width * 2) * NPC.ai[0], -40);

                        NPC.velocity = offset * 0.5f;
                    }
                    else
                    {
                        NPC.noTileCollide = false;
                        NPC.velocity      = offset;
                    }

                    //flaming aspect
                    for (int i = 0; i < 2; i++)
                    {
                        Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, SpeedY: Main.rand.Next(-5, 5), newColor: Color.Red);
                    }

                    AttackTimerCheck(25);

                    break;
                }
            }
        }