Beispiel #1
0
        public override void AI()
        {
            if (Main.expertMode)
            {
                damage = npc.damage / 4;
            }
            else
            {
                damage = npc.damage / 2;
            }
            AAModGlobalNPC.Rajah = npc.whoAmI;
            WeaponPos            = new Vector2(npc.Center.X + (npc.direction == 1 ? -78 : 78), npc.Center.Y - 9);
            StaffPos             = new Vector2(npc.Center.X + (npc.direction == 1 ? 78 : -78), npc.Center.Y - 9);
            if (Roaring)
            {
                roarTimer--;
            }

            if (Main.netMode != 1 && npc.type == ModContent.NPCType <SupremeRajah>() && isSupreme == false)
            {
                isSupreme     = true;
                npc.netUpdate = true;
            }

            if (isSupreme)
            {
                if (npc.ai[3] != 0 && !DefenseLine && !AAWorld.downedRajahsRevenge && Main.netMode != 1)
                {
                    DefenseLine = true;
                    BaseUtility.Chat("Rajah glows with furious energy as he attacks, strengthening his defenses", Color.MediumPurple);
                }
                if (npc.life <= npc.lifeMax / 7 && !SayLine && Main.netMode != 1)
                {
                    SayLine = true;
                    string Name;

                    int bunnyKills = NPC.killCount[Item.NPCtoBanner(NPCID.Bunny)];
                    if (bunnyKills >= 100 && !AAWorld.downedRajahsRevenge)
                    {
                        Name = "MUDERER";
                    }
                    else
                    {
                        if (Main.netMode != 0)
                        {
                            Name = "Terrarians";
                        }
                        else if (!AAWorld.downedRajahsRevenge)
                        {
                            Name = "Terrarian";
                        }
                        else
                        {
                            Name = Main.LocalPlayer.name;
                        }
                    }
                    if (Main.netMode != 1)
                    {
                        BaseUtility.Chat(Lang.BossChat("Rajah5") + Name.ToUpper() + Lang.BossChat("Rajah6"), 107, 137, 179);
                    }
                    music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/LastStand");
                }
            }

            Player player = Main.player[npc.target];

            if (npc.target >= 0 && Main.player[npc.target].dead)
            {
                npc.TargetClosest(true);
                if (Main.player[npc.target].dead)
                {
                    if (isSupreme)
                    {
                        if (Main.netMode != 1)
                        {
                            BaseUtility.Chat(Lang.BossChat("Rajah7"), 107, 137, 179);
                        }
                        if (Main.netMode != 1)
                        {
                            Projectile.NewProjectile(npc.position, npc.velocity, ModContent.ProjectileType <SupremeRajahBookIt>(), damage, 0, Main.myPlayer);
                        }
                    }
                    else
                    {
                        if (Main.netMode != 1)
                        {
                            BaseUtility.Chat(Lang.BossChat("Rajah2"), 107, 137, 179);
                        }
                        if (Main.netMode != 1)
                        {
                            Projectile.NewProjectile(npc.position, npc.velocity, ModContent.ProjectileType <RajahBookIt>(), damage, 0, Main.myPlayer);
                        }
                    }
                    npc.active        = false;
                    npc.noTileCollide = true;
                    npc.netUpdate     = true;
                    return;
                }
            }

            if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > 10000)
            {
                npc.TargetClosest(true);
                if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > 10000)
                {
                    if (Main.netMode != 1)
                    {
                        BaseUtility.Chat(Lang.BossChat("Rajah3"), 107, 137, 179);
                    }
                    if (Main.netMode != 1)
                    {
                        if (isSupreme)
                        {
                            Projectile.NewProjectile(npc.position, npc.velocity, ModContent.ProjectileType <SupremeRajahBookIt>(), damage, 0, Main.myPlayer); //Originally 100 damage
                        }
                        else
                        {
                            Projectile.NewProjectile(npc.position, npc.velocity, ModContent.ProjectileType <RajahBookIt>(), damage, 0, Main.myPlayer);
                        }
                    }
                    npc.active        = false;
                    npc.noTileCollide = true;
                    npc.netUpdate     = true;
                    return;
                }
            }


            if (player.Center.X < npc.Center.X)
            {
                npc.direction = 1;
            }
            else
            {
                npc.direction = -1;
            }
            if (player.Center.Y < npc.position.Y - 30f || TileBelowEmpty() ||
                !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) ||
                Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > 2000 || isDashing)
            {
                npc.noGravity = true;
                FlyAI();
            }
            else
            {
                npc.noTileCollide = false;
                npc.noGravity     = false;
                isDashing         = false;
                JumpAI();
            }

            if (npc.target <= 0 || npc.target == 255 || Main.player[npc.target].dead)
            {
                npc.TargetClosest(true);
            }

            if (Main.netMode != 1)
            {
                npc.ai[2]++;
                internalAI[3]++;
            }
            if (npc.ai[2] >= 500)
            {
                internalAI[3] = 0;
                npc.ai[2]     = 0;
                npc.ai[3]     = 0;
                npc.netUpdate = true;
            }
            else if (npc.ai[3] == 0 && npc.ai[2] >= ChangeRate())
            {
                if (Main.rand.Next(5) == 0)
                {
                    Roar(roarTimerMax);
                }
                if (Main.netMode != 1)
                {
                    internalAI[3] = 0;
                    npc.ai[2]     = 0;
                    if (ModSupport.GetMod("ThoriumMod") != null && Main.rand.Next(7) == 0)
                    {
                        npc.ai[3] = 7;
                    }
                    else
                    {
                        if (isSupreme)
                        {
                            npc.ai[3] = Main.rand.Next(7);
                        }
                        else
                        {
                            npc.ai[3] = Main.rand.Next(4);
                        }
                    }
                }
                npc.netUpdate = true;
            }

            if (Main.netMode != 1)
            {
                if (npc.ai[3] == 0) //Minion Phase
                {
                    if (internalAI[3] >= 80)
                    {
                        internalAI[3] = 0;
                        if (internalAI[1] == 0)
                        {
                            if (NPC.CountNPCS(ModContent.NPCType <RabbitcopterSoldier>()) + AAGlobalProjectile.CountProjectiles(ModContent.ProjectileType <BunnySummon1>()) < 5)
                            {
                                Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon1>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 200, (int)npc.Center.X + 200), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50));
                                Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon1>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 200, (int)npc.Center.X + 200), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50));
                                Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon1>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 200, (int)npc.Center.X + 200), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50));
                            }
                            npc.netUpdate = true;
                        }
                        else
                        {
                            if (npc.ai[1] > 2)
                            {
                                npc.ai[1] = 0;
                            }
                            if (npc.ai[1] == 0)
                            {
                                if (NPC.CountNPCS(ModContent.NPCType <RabbitcopterSoldier>()) + AAGlobalProjectile.CountProjectiles(ModContent.ProjectileType <BunnySummon1>()) < 5)
                                {
                                    Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon1>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50));
                                    Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon1>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50));
                                    Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon1>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50));
                                }
                            }
                            else if (npc.ai[1] == 1)
                            {
                                if (NPC.CountNPCS(ModContent.NPCType <BunnyBrawler>()) + AAGlobalProjectile.CountProjectiles(ModContent.ProjectileType <BunnySummon2>()) < 5)
                                {
                                    Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon2>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50));
                                    Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon2>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50));
                                }
                            }
                            else if (npc.ai[1] == 2)
                            {
                                if (NPC.CountNPCS(ModContent.NPCType <BunnyBattler>()) + AAGlobalProjectile.CountProjectiles(ModContent.ProjectileType <BunnySummon3>()) < 8)
                                {
                                    Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon3>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50));

                                    Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon3>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50));

                                    Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon3>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50));

                                    Projectile.NewProjectile(StaffPos, Vector2.Zero, ModContent.ProjectileType <BunnySummon3>(), 0, 0, Main.myPlayer, Main.rand.Next((int)npc.Center.X - 500, (int)npc.Center.X + 500), Main.rand.Next((int)npc.Center.Y - 200, (int)npc.Center.Y - 50));
                                }
                            }
                            npc.ai[1]    += 1;
                            npc.netUpdate = true;
                        }
                    }
                }
                else if (npc.ai[3] == 1) //Bunzooka
                {
                    if (internalAI[3] > 40)
                    {
                        internalAI[3] = 0;
                        int     Rocket = isSupreme ? ModContent.ProjectileType <RajahRocketEXR>() : ModContent.ProjectileType <RajahRocket>();
                        Vector2 dir    = Vector2.Normalize(player.Center - WeaponPos);
                        dir *= ProjSpeed();
                        Projectile.NewProjectile(WeaponPos.X, WeaponPos.Y, dir.X, dir.Y, Rocket, damage, 5, Main.myPlayer);
                        npc.netUpdate = true;
                    }
                }
                else if (npc.ai[3] == 2) //Royal Scepter
                {
                    int     carrots    = isSupreme ? 5 : 3;
                    int     carrotType = isSupreme ? mod.ProjectileType("CarrotEXR") : mod.ProjectileType("CarrotHostile");
                    float   spread     = 45f * 0.0174f;
                    Vector2 dir        = Vector2.Normalize(player.Center - WeaponPos);
                    dir *= ProjSpeed();
                    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 / carrots * 2;
                    if (internalAI[3] > 40)
                    {
                        internalAI[3] = 0;
                        for (int i = 0; i < carrots; i++)
                        {
                            double offsetAngle = startAngle + (deltaAngle * i);
                            Projectile.NewProjectile(WeaponPos.X, WeaponPos.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), carrotType, damage, 5, Main.myPlayer, 0);
                        }
                        npc.netUpdate = true;
                    }
                }
                else if (npc.ai[3] == 3) //Javelin
                {
                    int Javelin = isSupreme ? ModContent.ProjectileType <BaneTEXR>() : ModContent.ProjectileType <BaneR>();
                    if (internalAI[3] == (isSupreme ? 40 : 60))
                    {
                        Vector2 dir = Vector2.Normalize(player.position - WeaponPos);
                        dir *= ProjSpeed();
                        Projectile.NewProjectile(WeaponPos.X, WeaponPos.Y, dir.X, dir.Y, Javelin, damage, 5, Main.myPlayer);
                    }
                    if (internalAI[3] > (isSupreme ? 60 : 90))
                    {
                        internalAI[3] = 0;
                    }
                    npc.netUpdate = true;
                }
                else if (npc.ai[3] == 4) //Excalihare
                {
                    if (internalAI[3] > 40)
                    {
                        internalAI[3] = 0;
                        Vector2 dir = Vector2.Normalize(player.Center - WeaponPos);
                        dir *= ProjSpeed();
                        Projectile.NewProjectile(WeaponPos.X, WeaponPos.Y, dir.X, dir.Y, ModContent.ProjectileType <ExcalihareR>(), damage, 5, Main.myPlayer);
                        npc.netUpdate = true;
                    }
                }
                else if (npc.ai[3] == 5) //Fluffy Fury
                {
                    int     Arrows = Main.rand.Next(2, 4);
                    float   spread = 45f * 0.0174f;
                    Vector2 dir    = Vector2.Normalize(player.Center - WeaponPos);
                    dir *= ProjSpeed();
                    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 / (Arrows * 2);
                    if (internalAI[3] > 50)
                    {
                        internalAI[3] = 0;
                        for (int i = 0; i < Arrows; i++)
                        {
                            double offsetAngle = startAngle + (deltaAngle * i);
                            Projectile.NewProjectile(WeaponPos.X, WeaponPos.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), mod.ProjectileType("CarrowR"), damage, 5, Main.myPlayer);
                        }
                        npc.netUpdate = true;
                    }
                }
                else if (npc.ai[3] == 6) //Rabbits Wrath
                {
                    if (internalAI[3] > 5)
                    {
                        internalAI[3] = 0;
                        Vector2 vector12 = new Vector2(player.Center.X, player.Center.Y);
                        float   num75    = 14f;
                        for (int num120 = 0; num120 < 3; num120++)
                        {
                            Vector2 vector2 = player.Center + new Vector2(-(float)Main.rand.Next(0, 401) * player.direction, -600f);
                            vector2.Y -= 120 * num120;
                            Vector2 vector13 = vector12 - vector2;
                            if (vector13.Y < 0f)
                            {
                                vector13.Y *= -1f;
                            }
                            if (vector13.Y < 20f)
                            {
                                vector13.Y = 20f;
                            }
                            vector13.Normalize();
                            vector13 *= num75;
                            float num82   = vector13.X;
                            float num83   = vector13.Y;
                            float speedX5 = num82;
                            float speedY6 = num83 + Main.rand.Next(-40, 41) * 0.02f;
                            int   p       = Projectile.NewProjectile(vector2.X, vector2.Y, speedX5, speedY6, ModContent.ProjectileType <CarrotEXR>(), damage, 6, Main.myPlayer, 0, 0);
                            Main.projectile[p].tileCollide = false;
                        }
                        npc.netUpdate = true;
                    }
                }
                else if (npc.ai[3] == 7) //Carrot Farmer
                {
                    if (!AAGlobalProjectile.AnyProjectiles(ModContent.ProjectileType <CarrotFarmerR>()))
                    {
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ModContent.ProjectileType <CarrotFarmerR>(), damage, 3f, Main.myPlayer, npc.whoAmI);
                        npc.netUpdate = true;
                    }
                }
            }

            if (Main.expertMode)
            {
                if (npc.life < (npc.lifeMax * .85f)) //The lower the health, the more damage is done
                {
                    npc.damage = (int)(npc.defDamage * 1.1f);
                }
                if (npc.life < (npc.lifeMax * .7f))
                {
                    npc.damage = (int)(npc.defDamage * 1.3f);
                }
                if (npc.life < (npc.lifeMax * .65f))
                {
                    npc.damage = (int)(npc.defDamage * 1.5f);
                }
                if (npc.life < (npc.lifeMax * .4f))
                {
                    npc.damage = (int)(npc.defDamage * 1.7f);
                }
                if (npc.life < (npc.lifeMax * .25f))
                {
                    npc.damage = (int)(npc.defDamage * 1.9f);
                }
                if (npc.life < (npc.lifeMax / 7))
                {
                    npc.damage = (int)(npc.defDamage * 2.2f);
                }
            }
            else
            {
                if (npc.life == npc.lifeMax / 7)
                {
                    npc.damage = (int)(npc.defDamage * 1.5f);
                }
            }

            npc.rotation = 0;
        }
Beispiel #2
0
        public override void AI()
        {
            if (body == -1)
            {
                int npcID = BaseAI.GetNPC(npc.Center, mod.NPCType("Zero"), 1000, null);
                if (npcID >= 0)
                {
                    body = npcID;
                }
            }

            if (body == -1)
            {
                return;
            }

            NPC zero = Main.npc[body];

            if (zero == null || zero.life <= 0 || !zero.active || zero.type != mod.NPCType("Zero"))
            {
                npc.active = false; return;
            }

            for (int m = npc.oldPos.Length - 1; m > 0; m--)
            {
                npc.oldPos[m] = npc.oldPos[m - 1];
            }
            npc.oldPos[0] = npc.position;

            int probeNumber = ((Zero)zero.modNPC).WeaponCount;

            if (rotValue == -1f)
            {
                rotValue = npc.ai[0] % probeNumber * ((float)Math.PI * 2f / probeNumber);
            }
            rotValue += Main.expertMode ? .05f : 0f;
            while (rotValue > (float)Math.PI * 2f)
            {
                rotValue -= (float)Math.PI * 2f;
            }
            npc.Center = BaseUtility.RotateVector(zero.Center, zero.Center + new Vector2(((Zero)zero.modNPC).Distance, 0f), rotValue);

            if (Main.netMode != 1)
            {
                npc.ai[2]++;
            }

            Player player = Main.player[zero.target];

            int aiTimerFire = Main.expertMode ? 230 : 280;

            Vector2 vector2     = new Vector2(npc.position.X + (npc.width * 0.5f), npc.position.Y + (npc.height * 0.5f));
            float   num1        = Main.player[npc.target].position.X + (player.width / 2) - vector2.X;
            float   num2        = Main.player[npc.target].position.Y + (player.height / 2) - vector2.Y;
            float   NewRotation = (float)Math.Atan2(num2, num1);

            npc.rotation = MathHelper.Lerp(npc.rotation, NewRotation, 1f / 25f);

            if (npc.ai[2] >= aiTimerFire)
            {
                npc.ai[3]++;
                if (npc.ai[3] >= 210)
                {
                    npc.ai[2] = 0;
                    npc.ai[3] = 0;
                    if (Main.netMode != 1)
                    {
                        laser.Kill();
                    }
                }
                else if (!AAGlobalProjectile.AnyProjectiles(ModContent.ProjectileType <NovaRay>()) && Main.netMode != 1)
                {
                    laser          = Main.projectile[Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, ModContent.ProjectileType <NovaRay>(), (int)(npc.damage * 0.75f), 3f, Main.myPlayer, npc.whoAmI, 420)];
                    laser.velocity = BaseUtility.RotateVector(default, new Vector2(14f, 0f), laser.rotation);
Beispiel #3
0
        public override void AI()
        {
            Main.player[projectile.owner].direction = projectile.direction;
            Main.player[projectile.owner].heldProj  = projectile.whoAmI;
            Main.player[projectile.owner].itemTime  = Main.player[projectile.owner].itemAnimation;
            projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
            projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
            projectile.position  += projectile.velocity * projectile.ai[0];
            if (Main.rand.Next(5) == 0)
            {
                int DustType = ModContent.DustType <Dusts.AkumaADust>();
                if (Main.rand.Next(3) == 0)
                {
                    DustType = ModContent.DustType <Dusts.YamataADust>();
                }
                if (Main.rand.Next(3) == 1)
                {
                    DustType = ModContent.DustType <Dusts.Discord>();
                }
                Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, DustType, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
            }
            if (projectile.ai[0] == 0f)
            {
                projectile.ai[0]     = 3f;
                projectile.netUpdate = true;
            }
            if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
            {
                projectile.ai[0] -= 2.4f;
                if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner && !AAGlobalProjectile.AnyProjectiles(mod.ProjectileType("ChaosYariEXShot")))
                {
                    projectile.localAI[0] = 1f;
                    Projectile.NewProjectile(projectile.position.X, projectile.position.Y, projectile.velocity.X * 1.4f, projectile.velocity.Y * 1.4f, mod.ProjectileType("ChaosYariEXShot"), (int)((double)projectile.damage * 0.85f), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f);
                    Projectile.NewProjectile(Main.player[projectile.owner].position.X, Main.player[projectile.owner].position.Y, projectile.velocity.X * 1.3f, projectile.velocity.Y * 1.3f, mod.ProjectileType("ChaosYariEXShot"), (int)((double)projectile.damage * 0.85f), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f);
                }
            }
            else
            {
                projectile.ai[0] += 0.95f;
            }

            if (Main.player[projectile.owner].itemAnimation == 0)
            {
                projectile.Kill();
            }

            projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
            if (projectile.spriteDirection == -1)
            {
                projectile.rotation -= 1.57f;
            }
        }