public override void AI()
        {
            NPC npc = FargoSoulsUtil.NPCExists(Projectile.ai[1], ModContent.NPCType <NPCs.MutantBoss.MutantBoss>());

            if (npc != null && npc.ai[0] == 10)
            {
                Projectile.alpha -= 17;
                if (Projectile.alpha < 0)
                {
                    Projectile.alpha = 0;
                }
                Projectile.Center = npc.Center;
            }
            else
            {
                Projectile.ai[1]    = -1;
                Projectile.velocity = Vector2.Zero;
                Projectile.alpha   += 9;
                if (Projectile.alpha > 255)
                {
                    Projectile.Kill();
                    return;
                }
            }

            Projectile.timeLeft = 2;
            Projectile.scale    = (1f - Projectile.alpha / 255f);
            Projectile.ai[0]   -= rotationPerTick;
            if (Projectile.ai[0] < PI)
            {
                Projectile.ai[0]    += 2f * PI;
                Projectile.netUpdate = true;
            }

            Projectile.frameCounter++;
            if (Projectile.frameCounter >= 6)
            {
                Projectile.frameCounter = 0;
                Projectile.frame++;
                if (Projectile.frame > 1)
                {
                    Projectile.frame = 0;
                }
            }
        }
        public override void AI()
        {
            NPC npc = FargoSoulsUtil.NPCExists(Projectile.ai[0]);

            if (npc == null || !npc.CanBeChasedBy())
            {
                Projectile.Kill();
                return;
            }

            Projectile.Bottom = npc.Top + 0.1f * Vector2.UnitY * npc.height;

            if (Projectile.localAI[0] == 0)
            {
                Projectile.localAI[0] = 1;
                Dusts();
            }
        }
Exemple #3
0
        public override void HitEffect(NPC npc, int hitDirection, double damage)
        {
            base.HitEffect(npc, hitDirection, damage);

            if (!FargoSoulsWorld.SwarmActive)
            {
                NPC cultist = FargoSoulsUtil.NPCExists(npc.ai[3], NPCID.CultistBoss);

                //yes, this spawns two clones without the check
                if (cultist != null && NPC.CountNPCS(npc.type) < (FargoSoulsWorld.MasochistModeReal ? Math.Min(TotalCultistCount + 1, 12) : TotalCultistCount))
                {
                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        FargoSoulsUtil.NewNPCEasy(cultist.GetSource_FromAI(), npc.Center, NPCID.CultistBossClone, 0, npc.ai[0], npc.ai[1], npc.ai[2], npc.ai[3], npc.target);
                    }
                }
            }
        }
Exemple #4
0
        public override void AI()
        {
            NPC npc = FargoSoulsUtil.NPCExists(Projectile.ai[0], ModContent.NPCType <NPCs.MutantBoss.MutantBoss>());

            if (npc != null && npc.ai[0] == 36)//(npc.ai[0] == 35 || npc.ai[0] == 38))
            {
                Projectile.timeLeft        = 2;
                Projectile.Center          = npc.Center;
                Projectile.position.X     += Projectile.width / 2 * npc.spriteDirection;
                Projectile.spriteDirection = npc.spriteDirection;
                Projectile.rotation        = (float)Math.PI / 4 * Projectile.spriteDirection;
            }
            else
            {
                Projectile.Kill();
                return;
            }
        }
        public override void AI(NPC npc)
        {
            base.AI(npc);

            if (++Counter >= 300 && Counter % 20 == 0)
            {
                int t = npc.HasPlayerTarget ? npc.target : npc.FindClosestPlayer();
                if (t != -1 && npc.Distance(Main.player[t].Center) < 800 && Main.netMode != NetmodeID.MultiplayerClient)
                {
                    FargoSoulsUtil.NewNPCEasy(npc.GetSource_FromAI(), npc.Center, NPCID.BurningSphere);
                }
            }

            if (Counter > 420)
            {
                Counter = 0;
            }
        }
Exemple #6
0
        public override void Kill(int timeLeft)
        {
            base.Kill(timeLeft);

            NPC npc = FargoSoulsUtil.NPCExists(Projectile.ai[1], ModContent.NPCType <NPCs.DeviBoss.DeviBoss>());

            if (npc != null)
            {
                if (Main.netMode != NetmodeID.MultiplayerClient)
                {
                    Projectile.NewProjectile(Projectile.InheritSource(Projectile), Projectile.Center, -Vector2.UnitY, ModContent.ProjectileType <DeviDeathray>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
                    if (Main.player[npc.target].Center.Y > Projectile.Center.Y)
                    {
                        Projectile.NewProjectile(Projectile.InheritSource(Projectile), Projectile.Center, Vector2.UnitY, ModContent.ProjectileType <DeviDeathray>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
                    }
                }
            }
        }
Exemple #7
0
        public override void AI()
        {
            NPC npc = FargoSoulsUtil.NPCExists(projectile.ai[1], ModContent.NPCType <NPCs.MutantBoss.MutantBoss>());

            if (npc != null)
            {
                projectile.alpha -= 4;
                if (projectile.alpha < 0)
                {
                    projectile.alpha = 0;
                }
                projectile.Center = npc.Center;
            }
            else
            {
                projectile.velocity = Vector2.Zero;
                projectile.alpha   += 2;
                if (projectile.alpha > 255)
                {
                    projectile.Kill();
                    return;
                }
            }

            projectile.timeLeft = 2;
            projectile.scale    = (1f - projectile.alpha / 255f) * 0.5f;
            projectile.ai[0]   += rotationPerTick;
            if (projectile.ai[0] > PI)
            {
                projectile.ai[0]    -= 2f * PI;
                projectile.netUpdate = true;
            }

            projectile.frameCounter++;
            if (projectile.frameCounter >= 6)
            {
                projectile.frameCounter = 0;
                projectile.frame++;
                if (projectile.frame > 1)
                {
                    projectile.frame = 0;
                }
            }
        }
        public override void AI()
        {
            //dust!

            /*int dustId = Dust.NewDust(projectile.position, projectile.width / 2, projectile.height + 5, 56, projectile.velocity.X * 0.2f,
             *  projectile.velocity.Y * 0.2f, 100, default(Color), .5f);
             * Main.dust[dustId].noGravity = true;
             * int dustId3 = Dust.NewDust(projectile.position, projectile.width / 2, projectile.height + 5, 56, projectile.velocity.X * 0.2f,
             *  projectile.velocity.Y * 0.2f, 100, default(Color), .5f);
             * Main.dust[dustId3].noGravity = true;*/

            if (++projectile.localAI[0] == 20)
            {
                //projectile.localAI[0] = 0;

                NPC n = FargoSoulsUtil.NPCExists(FargoSoulsUtil.FindClosestHostileNPC(projectile.Center, 1500));
                if (n == null)
                {
                    projectile.Kill();
                }
                else
                {
                    projectile.velocity = projectile.DirectionTo(n.Center + n.velocity * Main.rand.NextFloat(60)) * 32f;
                }
            }

            if (projectile.alpha > 0)
            {
                projectile.alpha -= 20;
                if (projectile.alpha < 0)
                {
                    projectile.alpha = 0;
                }
            }
            projectile.scale = 1f - projectile.alpha / 255f;
            if (++projectile.frameCounter >= 6)
            {
                projectile.frameCounter = 0;
                if (++projectile.frame > 1)
                {
                    projectile.frame = 0;
                }
            }
        }
Exemple #9
0
        public override void AI()
        {
            if (Projectile.localAI[0] == 0)
            {
                for (int i = 0; i < 5; i++)
                {
                    int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch,
                                         Projectile.velocity.X, Projectile.velocity.Y, 0, default(Color), 1.5f);
                    Main.dust[d].velocity *= 6f;
                }
            }

            if (FargoSoulsUtil.BossIsAlive(ref EModeGlobalNPC.championBoss, ModContent.NPCType <NPCs.Champions.ShadowChampion>()) &&
                Main.npc[EModeGlobalNPC.championBoss].localAI[3] > 1)
            {
                Projectile.tileCollide = false;
            }

            if (++Projectile.localAI[0] > 30 && Projectile.localAI[0] < 120)
            {
                Projectile.velocity *= Projectile.ai[0];
            }

            if (Projectile.localAI[0] > 60 && Projectile.localAI[0] < 180)
            {
                if (FargoSoulsUtil.BossIsAlive(ref EModeGlobalNPC.championBoss, ModContent.NPCType <NPCs.Champions.ShadowChampion>()))
                {
                    float   rotation    = Projectile.velocity.ToRotation();
                    Vector2 vel         = Main.player[Main.npc[EModeGlobalNPC.championBoss].target].Center - Projectile.Center;
                    float   targetAngle = vel.ToRotation();
                    Projectile.velocity = new Vector2(Projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, Projectile.ai[1]));
                }
            }

            Projectile.rotation = Projectile.velocity.ToRotation() + (float)Math.PI / 2;

            int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height,
                                     DustID.Torch, Projectile.velocity.X, Projectile.velocity.Y, 100, new Color(), 1.2f);

            Main.dust[index].position  = (Main.dust[index].position + Projectile.Center) / 2f;
            Main.dust[index].noGravity = true;
            Main.dust[index].velocity  = Main.dust[index].velocity * 0.3f;
            Main.dust[index].velocity  = Main.dust[index].velocity - Projectile.velocity * 0.1f;
        }
Exemple #10
0
        public override bool CheckDead(NPC npc)
        {
            Player      player    = Main.player[Main.myPlayer];
            FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>();

            if (TimeFrozen)
            {
                npc.life = 1;
                return(false);
            }

            /*if (npc.boss && FargoSoulsUtil.BossIsAlive(ref mutantBoss, ModContent.NPCType<MutantBoss.MutantBoss>()) && npc.type != ModContent.NPCType<MutantBoss.MutantBoss>())
             * {
             *  npc.active = false;
             *  Main.PlaySound(npc.DeathSound, npc.Center);
             *  return false;
             * }*/

            if (Needles && npc.lifeMax > 1 && Main.rand.NextBool() && npc.type != ModContent.NPCType <SuperDummy>())
            {
                int dmg        = 15;
                int numNeedles = 8;

                if (modPlayer.LifeForce || modPlayer.WizardEnchant)
                {
                    dmg        = 50;
                    numNeedles = 16;
                }

                Projectile[] projs = FargoSoulsUtil.XWay(numNeedles, npc.Center, ModContent.ProjectileType <CactusNeedle>(), 5, modPlayer.HighestDamageTypeScaling(dmg), 5f);

                for (int i = 0; i < projs.Length; i++)
                {
                    if (projs[i] == null)
                    {
                        continue;
                    }
                    Projectile p = projs[i];
                    p.GetGlobalProjectile <FargoGlobalProjectile>().CanSplit = false;
                }
            }

            return(true);
        }
Exemple #11
0
 public override void OnHitPlayer(Player target, int damage, bool crit)
 {
     if (FargoSoulsUtil.BossIsAlive(ref EModeGlobalNPC.deviBoss, mod.NPCType("DeviBoss")))
     {
         target.AddBuff(mod.BuffType("Berserked"), 240);
         target.AddBuff(mod.BuffType("MutantNibble"), 240);
         target.AddBuff(mod.BuffType("Guilty"), 240);
         target.AddBuff(mod.BuffType("Lovestruck"), 240);
         target.AddBuff(mod.BuffType("Rotting"), 240);
     }
     else
     {
         for (int i = 0; i < 5; i++)
         {
             int d = Main.rand.Next(Fargowiltas.DebuffIDs.Count);
             target.AddBuff(Fargowiltas.DebuffIDs[d], 240);
         }
     }
 }
        public override bool UseItem(Player player)
        {
            if (!FargoSoulsUtil.AnyBossAlive())
            {
                FargoSoulsWorld.MasochistModeReal = !FargoSoulsWorld.MasochistModeReal;
                FargoSoulsWorld.EternityMode      = true;
                Main.expertMode = true;

                Main.PlaySound(SoundID.Roar, (int)player.position.X, (int)player.position.Y, 0);

                FargoSoulsUtil.PrintText(FargoSoulsWorld.MasochistModeReal ? "The difficulty got real!" : "The difficulty got fake!", new Color(255, 51, 153));

                if (Main.netMode == NetmodeID.Server)
                {
                    NetMessage.SendData(MessageID.WorldData); //sync world
                }
            }
            return(true);
        }
Exemple #13
0
        public override void AI(NPC npc)
        {
            base.AI(npc);

            if (++Counter > 360)
            {
                Counter = 0;
                if (Main.netMode != NetmodeID.MultiplayerClient && npc.HasPlayerTarget && npc.Distance(Main.player[npc.target].Center) < 800)
                {
                    Vector2 vel = (Main.player[npc.target].Center - npc.Center) / 60f;
                    if (vel.Length() < 12f)
                    {
                        vel = Vector2.Normalize(vel) * 12f;
                    }
                    Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, vel, ModContent.ProjectileType <HorsemansBlade>(),
                                             FargoSoulsUtil.ScaledProjectileDamage(npc.damage, 0.8f), 0f, Main.myPlayer, npc.target);
                }
            }
        }
Exemple #14
0
        public override void AI()
        {
            if (--projectile.ai[1] < 0 && projectile.ai[1] > -60)
            {
                Player p = FargoSoulsUtil.PlayerExists(projectile.ai[0]);
                if (p != null)
                {
                    Vector2 target = p.Center;

                    if (Math.Abs(p.Center.Y - projectile.Center.Y) > 250)
                    {
                        Vector2 distance = target - projectile.Center;

                        double angle = distance.ToRotation() - projectile.velocity.ToRotation();
                        if (angle > Math.PI)
                        {
                            angle -= 2.0 * Math.PI;
                        }
                        if (angle < -Math.PI)
                        {
                            angle += 2.0 * Math.PI;
                        }

                        projectile.velocity = projectile.velocity.RotatedBy(angle * 0.2);
                    }
                    else
                    {
                        projectile.ai[1] = -60;
                    }
                }
                else
                {
                    projectile.ai[0] = Player.FindClosest(projectile.Center, 0, 0);
                }
            }

            if (projectile.ai[1] < 0)
            {
                projectile.velocity = Vector2.Normalize(projectile.velocity) * MathHelper.Lerp(projectile.velocity.Length(), 10f, 0.035f);
            }

            base.AI();
        }
Exemple #15
0
        public override void AI()
        {
            //the important part
            NPC npc = FargoSoulsUtil.NPCExists(Projectile.ai[0], ModContent.NPCType <NPCs.MutantBoss.MutantBoss>());

            if (npc != null)
            {
                if (Projectile.localAI[0] == 0)
                {
                    Projectile.localAI[0] = 1;
                    Projectile.localAI[1] = Projectile.DirectionFrom(npc.Center).ToRotation();
                }

                Vector2 offset = new Vector2(Projectile.ai[1], 0).RotatedBy(npc.ai[3] + Projectile.localAI[1]);
                Projectile.Center = npc.Center + offset;
            }
            else
            {
                Projectile.Kill();
                return;
            }

            //not important part
            if (Projectile.alpha > 0)
            {
                Projectile.alpha -= 10;
                if (Projectile.alpha < 0)
                {
                    Projectile.alpha = 0;
                }
            }

            Projectile.scale = Projectile.Opacity;

            if (++Projectile.frameCounter >= 6)
            {
                Projectile.frameCounter = 0;
                if (++Projectile.frame > 1)
                {
                    Projectile.frame = 0;
                }
            }
        }
        public override void AI()
        {
            if (++projectile.localAI[0] == 0)
            {
                for (int index1 = 0; index1 < 30; ++index1)
                {
                    int index2 = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool() ? 107 : 157, 0f, 0f, 0, new Color(), 2f);
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 5f;
                }
            }

            Lighting.AddLight(projectile.Center, 0.1f, 0.4f, 0.2f);
            projectile.scale  = (Main.mouseTextColor / 200f - 0.35f) * 0.2f + 0.95f;
            projectile.scale *= 1.5f;

            int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[0], ModContent.ProjectileType <MutantBoss.MutantMark2>());

            if (byUUID != -1)
            {
                Vector2 offset = new Vector2(100, 0).RotatedBy(projectile.ai[1]);
                projectile.Center = Main.projectile[byUUID].Center + offset;

                projectile.localAI[1] = Math.Max(0, 150 - Main.projectile[byUUID].ai[1]) / 150; //rampup
                if (projectile.localAI[1] > 1f)                                                 //clamp it for use in draw
                {
                    projectile.localAI[1] = 1f;
                }
                projectile.ai[1] += 0.15f * projectile.localAI[1];
            }

            projectile.rotation = projectile.ai[1] + (float)Math.PI / 2f;

            if (projectile.localAI[0] > 20)
            {
                projectile.localAI[0] = 1;
                NPC plantera = FargoSoulsUtil.NPCExists(NPC.plantBoss, NPCID.Plantera);
                if (plantera != null && projectile.Distance(plantera.Center) < 1600f && Main.netMode != NetmodeID.MultiplayerClient)
                {
                    Projectile.NewProjectile(projectile.Center, 4f * projectile.ai[1].ToRotationVector2(), ModContent.ProjectileType <CrystalLeafShot>(), projectile.damage, projectile.knockBack, projectile.owner);
                }
            }
        }
        public override void AI()
        {
            if (--projectile.ai[1] < 0)
            {
                NPC n = FargoSoulsUtil.NPCExists(projectile.ai[0]);
                if (n != null && !n.friendly)
                {
                    for (int i = 0; i < 3; i++) //make up for real spectre bolt having 3 extraUpdates
                    {
                        Vector2 change = projectile.DirectionTo(n.Center) * 2f;
                        projectile.velocity = (projectile.velocity * 29f + change) / 30f;
                    }

                    if (projectile.Colliding(projectile.Hitbox, n.Hitbox)) //die and feed it
                    {
                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            n.life += projectile.damage;
                            n.HealEffect(projectile.damage);
                            if (n.life > n.lifeMax)
                            {
                                n.life = n.lifeMax;
                            }
                            projectile.Kill();
                        }
                    }
                }
                else
                {
                    projectile.Kill();
                }
            }

            for (int i = 0; i < 3; i++) //make up for real spectre bolt having 3 extraUpdates
            {
                projectile.position += projectile.velocity;
            }

            if (projectile.velocity != Vector2.Zero)
            {
                projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2;
            }
        }
        public override bool CheckDead(NPC npc)
        {
            if (npc.ai[1] != 2f && !FargoSoulsWorld.SwarmActive)
            {
                SoundEngine.PlaySound(SoundID.Roar, npc.Center);
                npc.life = npc.lifeMax / 630;
                if (npc.life < 100)
                {
                    npc.life = 100;
                }
                npc.defDefense = 9999;
                npc.defense    = 9999;
                npc.defDamage *= 13;
                npc.damage    *= 13;
                npc.ai[1]      = 2f;
                npc.netUpdate  = true;

                if (!HasSaidEndure)
                {
                    HasSaidEndure = true;
                    string text = Language.GetTextValue($"Mods.{mod.Name}.Message.SkeletronGuardian");
                    FargoSoulsUtil.PrintLocalization($"{npc.FullName} {text}", new Color(175, 75, 255));
                }

                if (!FargoSoulsWorld.MasochistModeReal)
                {
                    for (int i = 0; i < Main.maxNPCs; i++) //kill limbs while going dg
                    {
                        if (Main.npc[i].active &&
                            (Main.npc[i].type == NPCID.PrimeCannon || Main.npc[i].type == NPCID.PrimeLaser || Main.npc[i].type == NPCID.PrimeSaw || Main.npc[i].type == NPCID.PrimeVice) &&
                            Main.npc[i].ai[1] == npc.whoAmI)
                        {
                            Main.npc[i].life = 0;
                            Main.npc[i].HitEffect();
                            Main.npc[i].checkDead();
                        }
                    }
                }
                return(false);
            }

            return(base.CheckDead(npc));
        }
        public override void AI()
        {
            NPC npc = FargoSoulsUtil.NPCExists(Projectile.ai[0], NPCID.BigMimicJungle);

            if (npc == null)
            {
                Projectile.Kill();
                return;
            }

            Projectile.rotation   = Projectile.DirectionFrom(npc.Center).ToRotation() + MathHelper.Pi;
            Projectile.localAI[0] = npc.Center.X;
            Projectile.localAI[1] = npc.Center.Y;

            if (Projectile.velocity == Vector2.Zero)
            {
                Projectile.frame = 0;
                //Projectile.timeLeft--;
            }
            else
            {
                Projectile.velocity *= 1.005f;
                Projectile.rotation  = Projectile.velocity.ToRotation() + MathHelper.Pi;

                if (npc.HasPlayerTarget && Projectile.Distance(npc.Center) > npc.Distance(Main.player[npc.target].Center))
                {
                    Tile tile = Framing.GetTileSafely(Projectile.Center);
                    if (tile.HasUnactuatedTile && Main.tileSolid[tile.TileType])
                    {
                        Projectile.velocity = Vector2.Zero;
                    }
                }

                if (++Projectile.frameCounter > 3 * (Projectile.extraUpdates + 1))
                {
                    Projectile.frameCounter = 0;
                    if (++Projectile.frame >= Main.projFrames[Projectile.type])
                    {
                        Projectile.frame = 0;
                    }
                }
            }
        }
 public override void OnHitPlayer(Player target, int damage, bool crit)
 {
     if (FargoSoulsUtil.BossIsAlive(ref EModeGlobalNPC.deviBoss, ModContent.NPCType <NPCs.DeviBoss.DeviBoss>()))
     {
         target.AddBuff(ModContent.BuffType <Berserked>(), 240);
         target.AddBuff(ModContent.BuffType <MutantNibble>(), 240);
         target.AddBuff(ModContent.BuffType <Guilty>(), 240);
         target.AddBuff(ModContent.BuffType <Lovestruck>(), 240);
         target.AddBuff(ModContent.BuffType <Rotting>(), 240);
     }
     else
     {
         for (int i = 0; i < 5; i++)
         {
             int d = Main.rand.Next(FargowiltasSouls.DebuffIDs.Count);
             target.AddBuff(FargowiltasSouls.DebuffIDs[d], 240);
         }
     }
 }
        public override void AI()
        {
            int byUUID = FargoSoulsUtil.GetByUUIDReal(projectile.owner, (int)projectile.ai[0], ModContent.ProjectileType <MutantTrueEyeR>());

            if (byUUID != -1)
            {
                if (projectile.timeLeft > 295)
                {
                    if (Main.projectile[byUUID].ai[1] == 0f) //stop following true eye if true eye lost target & isn't preparing to charge
                    {
                        projectile.ai[0]     = -1f;
                        projectile.velocity  = Vector2.Zero;
                        projectile.netUpdate = true;
                    }
                    else
                    {
                        projectile.velocity = Main.projectile[byUUID].velocity;
                    }
                }
            }

            if (projectile.alpha > 200)
            {
                projectile.alpha = 200;
            }
            projectile.alpha -= 5;
            if (projectile.alpha < 0)
            {
                projectile.alpha = 0;
            }
            projectile.scale = 1f - projectile.alpha / 255f;

            projectile.frameCounter++;
            if (projectile.frameCounter >= 6)
            {
                projectile.frameCounter = 0;
                projectile.frame++;
                if (projectile.frame > 1)
                {
                    projectile.frame = 0;
                }
            }
        }
Exemple #22
0
        public override void AI()
        {
            if (!yoyosSpawned && Projectile.owner == Main.myPlayer)
            {
                float localAI1 = 0;

                for (int i = 0; i < Main.maxProjectiles; i++)
                {
                    if (Main.projectile[i].active && Main.projectile[i].friendly && Main.projectile[i].owner == Projectile.owner && Main.projectile[i].type == ModContent.ProjectileType <BlenderOrbital>())
                    {
                        localAI1 = Main.projectile[i].localAI[1] + MathHelper.Pi;
                        break;
                    }
                }

                int maxYoyos = 5;
                for (int i = 0; i < maxYoyos; i++)
                {
                    float      radians = (360f / (float)maxYoyos) * i * (float)(Math.PI / 180);
                    Projectile yoyo    = FargoSoulsUtil.NewProjectileDirectSafe(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero,
                                                                                ModContent.ProjectileType <BlenderOrbital>(), Projectile.damage, Projectile.knockBack, Projectile.owner, i, radians);
                    if (yoyo != null)
                    {
                        yoyo.localAI[0] = Projectile.identity;
                        yoyo.localAI[1] = localAI1;
                    }
                }

                yoyosSpawned = true;
            }

            if (soundtimer > 0)
            {
                soundtimer--;
            }

            if (Main.player[Projectile.owner].HeldItem.type == ModContent.ItemType <Items.Weapons.SwarmDrops.Blender>())
            {
                Projectile.damage    = Main.player[Projectile.owner].GetWeaponDamage(Main.player[Projectile.owner].HeldItem);
                Projectile.knockBack = Main.player[Projectile.owner].GetWeaponKnockback(Main.player[Projectile.owner].HeldItem, Main.player[Projectile.owner].HeldItem.knockBack);
            }
        }
        public override bool CheckDead(NPC npc)
        {
            if (npc.ai[1] != 2f && !FargoSoulsWorld.SwarmActive)
            {
                Main.PlaySound(SoundID.Roar, (int)npc.position.X, (int)npc.position.Y, 0);
                npc.life = npc.lifeMax / 630;
                if (npc.life < 100)
                {
                    npc.life = 100;
                }
                npc.defDefense = 9999;
                npc.defense    = 9999;
                npc.defDamage *= 13;
                npc.damage    *= 13;
                npc.ai[1]      = 2f;
                npc.netUpdate  = true;

                if (!HasSaidEndure)
                {
                    HasSaidEndure = true;
                    FargoSoulsUtil.PrintText("Skeletron Prime has entered Dungeon Guardian form!", new Color(175, 75, 255));
                }

                if (!FargoSoulsWorld.MasochistModeReal)
                {
                    for (int i = 0; i < Main.maxNPCs; i++) //kill limbs while going dg
                    {
                        if (Main.npc[i].active &&
                            (Main.npc[i].type == NPCID.PrimeCannon || Main.npc[i].type == NPCID.PrimeLaser || Main.npc[i].type == NPCID.PrimeSaw || Main.npc[i].type == NPCID.PrimeVice) &&
                            Main.npc[i].ai[1] == npc.whoAmI)
                        {
                            Main.npc[i].life = 0;
                            Main.npc[i].HitEffect();
                            Main.npc[i].checkDead();
                        }
                    }
                }
                return(false);
            }

            return(base.CheckDead(npc));
        }
Exemple #24
0
        public override void AI()
        {
            Projectile.spriteDirection = -Math.Sign(Projectile.velocity.X);
            Projectile.rotation        = Projectile.velocity.ToRotation();
            if (Projectile.spriteDirection > 0)
            {
                Projectile.rotation += MathHelper.Pi;
            }

            if (++Projectile.frameCounter > 4)
            {
                Projectile.frame++;
                Projectile.frameCounter = 0;
            }
            if (Projectile.frame >= 4)
            {
                Projectile.frame = 0;
            }

            NPC npc = FargoSoulsUtil.NPCExists(Projectile.ai[0]);

            if (npc != null && npc.CanBeChasedBy())
            {
                if (Projectile.Distance(npc.Center) < Math.Max(npc.width, npc.height) / 2)
                {
                    Projectile.ai[0]     = -1;
                    Projectile.netUpdate = true;
                }
                else
                {
                    Projectile.velocity = Projectile.velocity.Length() * Projectile.DirectionTo(npc.Center);
                }

                Projectile.ai[1] = 1;
            }
            else if (Projectile.ai[1] == 0 && ++Projectile.localAI[0] == 22)
            {
                Projectile.ai[0]     = FargoSoulsUtil.FindClosestHostileNPCPrioritizingMinionFocus(Projectile, 1220);
                Projectile.ai[1]     = 1;
                Projectile.netUpdate = true;
            }
        }
        public static void BorealSnowballs(FargoSoulsPlayer modPlayer, int damage)
        {
            Player player = modPlayer.Player;

            Vector2 vel            = Vector2.Normalize(Main.MouseWorld - player.Center) * 17f;
            int     snowballDamage = damage / 2;

            if (!modPlayer.TerrariaSoul)
            {
                snowballDamage = Math.Min(snowballDamage, FargoSoulsUtil.HighestDamageTypeScaling(player, modPlayer.WoodForce ? 300 : 20));
            }
            int p = Projectile.NewProjectile(player.GetSource_Misc(""), player.Center, vel, ProjectileID.SnowBallFriendly, snowballDamage, 1, Main.myPlayer);

            int numSnowballs = modPlayer.WoodForce ? 5 : 3;

            if (p != Main.maxProjectiles)
            {
                FargoSoulsGlobalProjectile.SplitProj(Main.projectile[p], numSnowballs, MathHelper.Pi / 10, 1);
            }
        }
Exemple #26
0
        public override void OnKill(NPC npc)
        {
            base.OnKill(npc);

            switch (npc.type)
            {
            case NPCID.SmallSlimedZombie:
            case NPCID.SlimedZombie:
            case NPCID.BigSlimedZombie:
            case NPCID.ArmedZombieSlimed:
                if (Main.rand.NextBool() && Main.netMode != NetmodeID.MultiplayerClient)
                {
                    FargoSoulsUtil.NewNPCEasy(npc.GetSource_FromAI(), npc.Center, NPCID.BlueSlime);
                }
                break;

            default:
                break;
            }
        }
        public override void Kill(int timeLeft)
        {
            SoundEngine.PlaySound(SoundID.NPCDeath52, Projectile.Center);

            if (Projectile.owner == Main.myPlayer)
            {
                int proj2 = ModContent.ProjectileType <TopHatSquirrelLaser>();

                FargoSoulsUtil.XWay(16, Projectile.GetSource_FromThis(), Projectile.Center, proj2, Projectile.velocity.Length() * 2f, Projectile.damage * 4, Projectile.knockBack);

                for (int i = 0; i < 50; i++)
                {
                    Vector2 pos = Projectile.Center + Vector2.Normalize(Projectile.velocity) * Main.rand.NextFloat(600, 1800) +
                                  Vector2.Normalize(Projectile.velocity.RotatedBy(MathHelper.Pi / 2)) * Main.rand.NextFloat(-900, 900);

                    Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, -Projectile.velocity * Main.rand.NextFloat(2f, 3f), proj2,
                                             Projectile.damage * 4, Projectile.knockBack, Main.myPlayer);
                }
            }
        }
Exemple #28
0
        public override void AI()
        {
            if (FargoSoulsUtil.BossIsAlive(ref EModeGlobalNPC.abomBoss, ModContent.NPCType <NPCs.AbomBoss.AbomBoss>()) &&
                !Main.npc[EModeGlobalNPC.abomBoss].dontTakeDamage)
            {
                if (Projectile.localAI[0] == 0)
                {
                    Projectile.localAI[0] = Main.rand.NextBool() ? -1 : 1;
                    Projectile.rotation   = Main.rand.NextFloat(2 * MathHelper.Pi);
                }

                int modifier = Math.Min(60, 70 - Projectile.timeLeft);

                Projectile.scale = 1.5f - 0.5f / 60f * modifier; //start big, shrink down

                Projectile.velocity = Vector2.Zero;

                if (++Projectile.localAI[1] < 15)
                {
                    Projectile.rotation += MathHelper.ToRadians(12) * Projectile.localAI[0];
                }
            }

            if (Projectile.timeLeft < 10) //fade in and out
            {
                Projectile.alpha += 26;
            }
            else
            {
                Projectile.alpha -= 26;
            }

            if (Projectile.alpha < 0)
            {
                Projectile.alpha = 0;
            }
            else if (Projectile.alpha > 255)
            {
                Projectile.alpha = 255;
            }
        }
Exemple #29
0
        public override void AI()
        {
            base.AI();

            if (++Projectile.ai[1] < 75) //straight accel
            {
                Projectile.velocity *= 1.06f;
            }

            Player target = FargoSoulsUtil.PlayerExists(Projectile.ai[0]);

            if (target != null)
            {
                float   rotation    = Projectile.velocity.ToRotation();
                Vector2 vel         = target.Center - Projectile.Center;
                float   targetAngle = vel.ToRotation();

                //if reti alive and player isnt behind projectile
                if (FargoSoulsUtil.BossIsAlive(ref EModeGlobalNPC.retiBoss, NPCID.Retinazer) &&
                    System.Math.Abs(MathHelper.WrapAngle(targetAngle - rotation)) < MathHelper.PiOver2)
                {
                    const float deadZone = 600;
                    const float maxHomingRampupDistance = 1800;
                    const float maxLerp = 0.5f;

                    float ratio = (Main.npc[EModeGlobalNPC.retiBoss].Distance(target.Center) - deadZone) / (maxHomingRampupDistance - deadZone);
                    ratio *= ratio; //so the lerp effect ramps up much more violently at distance
                    if (ratio < 0)
                    {
                        ratio = 0;
                    }
                    if (ratio > 1)
                    {
                        ratio = 1;
                    }

                    float lerp = maxLerp * ratio;
                    Projectile.velocity = new Vector2(Projectile.velocity.Length(), 0f).RotatedBy(rotation.AngleLerp(targetAngle, lerp));
                }
            }
        }
        public override bool PreAI(NPC npc)
        {
            bool result = base.PreAI(npc);

            if (FargoSoulsWorld.SwarmActive)
            {
                return(result);
            }

            npc.damage    = 0;
            npc.defDamage = 0;

            NPC plantera = FargoSoulsUtil.NPCExists(NPC.plantBoss, NPCID.Plantera);

            if (plantera != null && plantera.life < plantera.lifeMax / 2 && plantera.HasValidTarget)
            {
                if (npc.Distance(Main.player[plantera.target].Center) > 600)
                {
                    Vector2 targetPos = Main.player[plantera.target].Center / 16; //pick a new target pos near player
                    targetPos.X += Main.rand.Next(-25, 26);
                    targetPos.Y += Main.rand.Next(-25, 26);

                    Tile tile = Framing.GetTileSafely((int)targetPos.X, (int)targetPos.Y);
                    npc.localAI[0] = 600; //reset vanilla timer for picking new block
                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        npc.netUpdate = true;
                    }

                    npc.ai[0] = targetPos.X;
                    npc.ai[1] = targetPos.Y;
                }

                if (npc.Distance(new Vector2(npc.ai[0] * 16 + 8, npc.ai[1] * 16 + 8)) > 32)
                {
                    npc.position += npc.velocity;
                }
            }

            return(result);
        }