示例#1
0
        public override bool PreAI(NPC npc)
        {
            EModeGlobalNPC.betsyBoss = npc.whoAmI;

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

            if (FargoSoulsWorld.MasochistModeReal)
            {
                for (int i = 0; i < 3; i++)
                {
                    Rectangle rectangle = new Rectangle((int)Main.screenPosition.X + Main.screenWidth / 3, (int)Main.screenPosition.Y + Main.screenHeight / 3, Main.screenWidth / 3, Main.screenHeight / 3);
                    CombatText.NewText(rectangle, new Color(100 + Main.rand.Next(150), 100 + Main.rand.Next(150), 100 + Main.rand.Next(150)), Main.rand.Next(new List <string> {
                        "CRINGE",
                        "NOT POGGERS",
                        "MONKAS",
                        "SHOW WINGS",
                        "AERIAL BANE POG",
                        "REAL BOSS WHEN?",
                        "#NOTMYMASOMODE",
                        "OOA BAD ANYWAY",
                        "COPE MALD SEETHE",
                        "GET REAL",
                        "GET FAKE",
                        "POGGERS",
                        "ResidentSleeper",
                        "If you can read this say 22",
                        "GuraSit",
                        "play calamity",
                        "play thorium",
                        "hardcore 1hp challenge when?",
                        "now do it with a copper shortsword",
                        "Zenith Yoyo?",
                        "guys how do i beat moon lord",
                        "GUYS I GOT TERRAPRISMA",
                        "how do i install this update",
                        "Hi YouTube!",
                        "<Message was deleted by staff>",
                        $"<User {Main.rand.Next(10)}{Main.rand.Next(10)}{Main.rand.Next(10)}{Main.rand.Next(10)}{Main.rand.Next(10)} was banned>",
                        $"<User {Main.rand.Next(10)}{Main.rand.Next(10)}{Main.rand.Next(10)}{Main.rand.Next(10)}{Main.rand.Next(10)} was muted>",
                    }), Main.rand.NextBool(), Main.rand.NextBool());
                }

                if (Main.rand.NextBool(30) && npc.HasPlayerTarget)
                {
                    switch (Main.rand.Next(12))
                    {
                    case 0:
                        if (!Main.dedServ)
                        {
                            Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Thunder").WithVolume(1f).WithPitchVariance(-0.5f), Main.player[npc.target].Center);
                        }
                        break;

                    case 1:
                        Main.PlaySound(SoundID.Roar, Main.player[npc.target].Center, 2);     //arte scream
                        break;

                    case 2:
                        Main.PlaySound(SoundID.Roar, Main.player[npc.target].Center, 0);
                        break;

                    case 3:
                        Main.PlaySound(SoundID.ForceRoar, Main.player[npc.target].Center, -1);     //eoc roar
                        break;

                    case 4:
                        if (!Main.dedServ)
                        {
                            Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Monster94"), Main.player[npc.target].Center);
                        }
                        break;

                    case 5:
                        if (!Main.dedServ)
                        {
                            Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Monster5").WithVolume(1.5f), Main.player[npc.target].Center);
                        }
                        break;

                    case 6:
                        if (!Main.dedServ)
                        {
                            Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Thunder").WithVolume(1.5f).WithPitchVariance(1.5f), Main.player[npc.target].Center);
                        }
                        break;

                    case 7:
                        if (!Main.dedServ)
                        {
                            Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Zombie_104"), Main.player[npc.target].Center);
                        }
                        break;

                    case 8:
                        if (!Main.dedServ)
                        {
                            Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Monster70"), Main.player[npc.target].Center);
                        }
                        break;

                    case 9:
                        if (!Main.dedServ)
                        {
                            Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Railgun"), Main.player[npc.target].Center);
                        }
                        break;

                    case 10:
                        if (!Main.dedServ)
                        {
                            Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Navi"), Main.player[npc.target].Center);
                        }
                        break;

                    case 11:
                        if (!Main.dedServ)
                        {
                            Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/ZaWarudo").WithVolume(1.5f), Main.player[npc.target].Center);
                        }
                        break;

                    default:
                        Main.PlaySound(SoundID.NPCDeath10, Main.player[npc.target].Center);
                        break;
                    }
                }
            }

            if (!InPhase2 && npc.life < npc.lifeMax / 2)
            {
                InPhase2 = true;
                Main.PlaySound(SoundID.Roar, npc.Center, 0);
            }

            if (npc.ai[0] == 6f) //when approaching for roar
            {
                if (npc.ai[1] == 0f)
                {
                    npc.position += npc.velocity;
                }
                else if (npc.ai[1] == 1f)
                {
                    DoFuryRingAttack = true;
                }
            }

            if (DoFuryRingAttack)
            {
                npc.velocity = Vector2.Zero;

                if (FuryRingTimer == 0)
                {
                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <GlowRingHollow>(), npc.damage / 3, 0f, Main.myPlayer, 4);
                    }
                }

                FuryRingTimer++;
                if (FuryRingTimer % 2 == 0)
                {
                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        Projectile.NewProjectile(npc.Center, -Vector2.UnitY.RotatedBy(2 * Math.PI / 30 * FuryRingShotRotationCounter), ModContent.ProjectileType <BetsyFury>(), npc.damage / 3, 0f, Main.myPlayer, npc.target);
                        Projectile.NewProjectile(npc.Center, -Vector2.UnitY.RotatedBy(2 * Math.PI / 30 * -FuryRingShotRotationCounter), ModContent.ProjectileType <BetsyFury>(), npc.damage / 3, 0f, Main.myPlayer, npc.target);
                    }
                    FuryRingShotRotationCounter++;
                }
                if (FuryRingTimer > (InPhase2 ? 90 : 30) + 2)
                {
                    DoFuryRingAttack            = false;
                    InFuryRingAttackCooldown    = true;
                    FuryRingTimer               = 0;
                    FuryRingShotRotationCounter = 0;
                }

                EModeGlobalNPC.Aura(npc, 1200, BuffID.WitheredWeapon, true, 226);
                EModeGlobalNPC.Aura(npc, 1200, BuffID.WitheredArmor, true, 226);
            }

            if (InFuryRingAttackCooldown)
            {
                EModeGlobalNPC.Aura(npc, 1200, BuffID.WitheredWeapon, true, 226);
                EModeGlobalNPC.Aura(npc, 1200, BuffID.WitheredArmor, true, 226);

                if (++FuryRingShotRotationCounter > 90)
                {
                    InFuryRingAttackCooldown    = false;
                    FuryRingTimer               = 0;
                    FuryRingShotRotationCounter = 0;
                }
                npc.position -= npc.velocity * 0.5f;
                if (FuryRingTimer % 2 == 0)
                {
                    return(false);
                }
            }

            if (!DD2Event.Ongoing && npc.HasPlayerTarget && (!Main.player[npc.target].active || Main.player[npc.target].dead || npc.Distance(Main.player[npc.target].Center) > 3000))
            {
                int p = Player.FindClosest(npc.Center, 0, 0); //extra despawn code for when summoned outside event
                if (p < 0 || !Main.player[p].active || Main.player[p].dead || npc.Distance(Main.player[p].Center) > 3000)
                {
                    npc.active = false;
                }
            }

            EModeUtils.DropSummon(npc, ModContent.ItemType <BetsyEgg>(), FargoSoulsWorld.downedBetsy, ref DroppedSummon, NPC.downedGolemBoss);

            return(true);
        }
        public void DoApoco(NPC npc, Projectile projectile, Player player, Item item, ref int damage, ref float knockback, ref bool crit, int bitBoldedEffects = 7, bool always = false)
        {
            bool effectSound     = (bitBoldedEffects & (1 << 1 - 1)) != 0;
            bool effectText      = (bitBoldedEffects & (1 << 2 - 1)) != 0;
            bool effectShockwave = (bitBoldedEffects & (1 << 3 - 1)) != 0;

            SGAPlayer moddedplayer = player.GetModPlayer <SGAPlayer>();
            int       chance       = -1;

            if (projectile != null)
            {
                if (projectile.melee)
                {
                    chance = 0;
                }
                if (projectile.ranged)
                {
                    chance = 1;
                }
                if (projectile.magic)
                {
                    chance = 2;
                }
                if (projectile.thrown || projectile.Throwing().thrown)
                {
                    chance = 3;
                }
            }
            if (item != null)
            {
                if (item.melee)
                {
                    chance = 0;
                }
                if (item.ranged)
                {
                    chance = 1;
                }
                if (item.magic)
                {
                    chance = 2;
                }
                if (item.thrown || item.Throwing().thrown)
                {
                    chance = 3;
                }
            }
            if (npc != null && (always || chance > -1))
            {
                double chanceboost = 0;
                if (projectile != null)
                {
                    chanceboost += projectile.GetGlobalProjectile <SGAprojectile>().extraApocoChance;
                }

                if (always || (crit && Main.rand.Next(0, 100) < (moddedplayer.apocalypticalChance[chance] + chanceboost)))
                {
                    if (moddedplayer.HoE && projectile != null)
                    {
                        float ammount = damage;
                        if (moddedplayer.lifestealentropy > 0)
                        {
                            projectile.vampireHeal((int)((ammount * moddedplayer.apocalypticalStrength)), npc.Center);
                            moddedplayer.lifestealentropy -= ammount;
                        }
                    }

                    if (moddedplayer.ninjaSash > 2)
                    {
                        for (int i = 0; i < Main.maxProjectiles; i += 1)
                        {
                            Projectile proj = Main.projectile[i];
                            if (proj.active && proj.owner == player.whoAmI)
                            {
                                if (proj.Throwing().thrown || proj.thrown)
                                {
                                    proj.SGAProj().Embue(projectile);
                                }
                            }
                        }
                    }

                    if (moddedplayer.SybariteGem)
                    {
                        float mul     = moddedplayer.apocalypticalStrength * (((float)damage * 3f) / (float)npc.lifeMax);
                        int   ammount = (int)((float)npc.value * mul);


                        Vector2 pos = new Vector2((int)npc.position.X, (int)npc.position.Y);
                        pos += new Vector2(Main.rand.Next(npc.width), Main.rand.Next(npc.height));
                        SGAUtils.SpawnCoins(pos, ammount, 10f + Math.Min(3f * mul, 20f));
                    }

                    if (moddedplayer.dualityshades)
                    {
                        int ammo = 0;
                        for (int i = 0; i < 4; i += 1)
                        {
                            if (moddedplayer.ammoinboxes[i] > 0)
                            {
                                int  ammox = moddedplayer.ammoinboxes[i];
                                Item itemx = new Item();
                                itemx.SetDefaults(ammox);
                                if (itemx.ammo == AmmoID.Bullet)
                                {
                                    ammo = ammox;
                                    break;
                                }
                            }
                        }
                        if (ammo > 0)
                        {
                            Item itemy = new Item();
                            itemy.SetDefaults(ammo);
                            int shootype = itemy.shoot;

                            for (int i = 128; i < 260; i += 128)
                            {
                                Vector2 anglez = new Vector2(Main.rand.Next(-8000, 8000), Main.rand.Next(-8000, 8000));
                                anglez.Normalize();

                                Main.PlaySound(SoundID.Item, (int)((npc.Center.X) + (anglez.X * i)), (int)((npc.Center.Y) + (anglez.Y * i)), 25, 0.5f, Main.rand.NextFloat(-0.9f, -0.25f));

                                int thisoned = Projectile.NewProjectile(npc.Center + (anglez * i), anglez * -16f, shootype, (int)(damage * 1.50f * moddedplayer.apocalypticalStrength), 0f, Main.myPlayer);
                                Main.projectile[thisoned].ranged = false;


                                for (float gg = 4f; gg > 0.25f; gg -= 0.15f)
                                {
                                    int  dustIndex = Dust.NewDust(npc.Center + new Vector2(-8, -8) + (anglez * i), 16, 16, DustID.AncientLight, -anglez.X * gg, -anglez.Y * gg, 150, Color.Purple, 3f);
                                    Dust dust      = Main.dust[dustIndex];
                                    dust.noGravity = true;
                                }

                                player.ConsumeItemRespectInfiniteAmmoTypes(ammo);
                            }
                        }
                    }

                    if (moddedplayer.RadSuit)
                    {
                        //IrradiatedAmmount = Math.Max(IrradiatedAmmount, 25);

                        IrradiatedExplosion(npc, (int)(damage * 1f * moddedplayer.apocalypticalStrength));

                        SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_DarkMageHealImpact, (int)npc.Center.X, (int)npc.Center.Y);
                        if (sound != null)
                        {
                            sound.Pitch += 0.525f;
                        }

                        int proj;

                        if (projectile != null)
                        {
                            proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType <RadioactivePool>(), (int)(damage * 0.5f * moddedplayer.apocalypticalStrength), projectile.knockBack, projectile.owner);
                        }
                        else
                        {
                            proj = Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <RadioactivePool>(), (int)(damage * 0.5f * moddedplayer.apocalypticalStrength), knockback, player.whoAmI);
                        }

                        Main.projectile[proj].width    += 80;
                        Main.projectile[proj].height   += 80;
                        Main.projectile[proj].timeLeft += (int)(30 * moddedplayer.apocalypticalStrength);
                        Main.projectile[proj].Center   -= new Vector2(40, 40);
                        Main.projectile[proj].netUpdate = true;
                    }

                    if (moddedplayer.CalamityRune)
                    {
                        Main.PlaySound(SoundID.Item45, npc.Center);
                        int boom = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("BoulderBlast"), (int)((damage * 2) * moddedplayer.apocalypticalStrength), knockback * 2f, player.whoAmI, 0f, 0f);
                        Main.projectile[boom].usesLocalNPCImmunity = true;
                        Main.projectile[boom].localNPCHitCooldown  = -1;
                        Main.projectile[boom].netUpdate            = true;
                        IdgProjectile.AddOnHitBuff(boom, BuffID.Daybreak, (int)(60f * moddedplayer.apocalypticalStrength));
                        IdgProjectile.AddOnHitBuff(boom, mod.BuffType("EverlastingSuffering"), (int)(400f * moddedplayer.apocalypticalStrength));
                    }

                    damage = (int)(damage * (3f + (moddedplayer.apocalypticalStrength - 1f)));

                    if (moddedplayer.magatsuSet && npc.HasBuff(ModContent.BuffType <Watched>()))
                    {
                        Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <Items.Armors.Magatsu.ExplosionDarkSectorEye>(), 0, 0);

                        Point location;

                        if (projectile != null)
                        {
                            location = new Point((int)projectile.Center.X, (int)projectile.Center.Y);
                        }
                        else
                        {
                            location = new Point((int)npc.Center.X, (int)npc.Center.Y);
                        }

                        SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_WyvernScream, (int)location.X, (int)location.Y);
                        if (sound != null)
                        {
                            sound.Pitch = 0.925f;
                        }

                        foreach (NPC enemy in Main.npc.Where(testby => testby.active && !testby.dontTakeDamage && !testby.friendly && testby != npc && (testby.Center - npc.Center).LengthSquared() < 400 * 400))
                        {
                            int damazz = Main.DamageVar(damage);
                            enemy.StrikeNPC(damazz, 16, -enemy.spriteDirection, true);

                            if (Main.netMode != 0)
                            {
                                NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, damazz, 16f, (float)1, 0, 0, 0);
                            }
                        }
                    }

                    if (effectText)
                    {
                        CombatText.NewText(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height), Color.DarkRed, "Apocalyptical!", true, false);
                    }
                    if (SGAConfigClient.Instance.EpicApocalypticals)
                    {
                        if (effectShockwave)
                        {
                            RippleBoom.MakeShockwave(npc.Center, 8f, 1f, 10f, 60, 1f);
                            if (SGAmod.ScreenShake < 32)
                            {
                                SGAmod.AddScreenShake(24f, 1200, player.Center);
                            }
                        }
                        if (effectSound)
                        {
                            Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/crit_hit").WithVolume(.7f).WithPitchVariance(.25f), npc.Center);
                        }
                    }
                }
            }
        }
示例#3
0
        public void CheckRecords(NPC npc, int recordIndex)
        {
            Player       player    = Main.LocalPlayer;
            PlayerAssist modPlayer = player.GetModPlayer <PlayerAssist>();

            if (!npc.playerInteraction[Main.myPlayer])
            {
                return;                                                    // Player must have contributed to the boss fight
            }
            bool      newRecordSet = false;
            BossStats bossStats    = modPlayer.AllBossRecords[recordIndex].stat;

            int durationAttempt     = modPlayer.RecordTimers[recordIndex];
            int currentBestDuration = bossStats.durationBest;

            int hitsTakenAttempt     = modPlayer.AttackCounter[recordIndex];
            int currentBestHitsTaken = bossStats.hitsTakenBest;

            int dodgeTimeAttempt     = modPlayer.DodgeTimer[recordIndex];
            int currentBestDodgeTime = bossStats.dodgeTimeBest;

            int brinkAttempt       = modPlayer.BrinkChecker[recordIndex];
            int maxLifeAttempt     = modPlayer.MaxHealth[recordIndex];
            int currentBestBrink   = bossStats.healthLossBest;
            int currentBestMaxLife = bossStats.healthAtStart;

            // Setup player's last fight attempt numbers
            modPlayer.durationLastFight   = durationAttempt;
            modPlayer.hitsTakenLastFight  = hitsTakenAttempt;
            modPlayer.healthLossLastFight = brinkAttempt;

            bossStats.kills++;             // Kills always go up, since comparing only occurs if boss was defeated

            // If the player has beaten their best record, we change BEST to PREV and make the current attempt the new BEST
            // Otherwise, just overwrite PREV with the current attempt
            if (durationAttempt < currentBestDuration || currentBestDuration <= 0)
            {
                bossStats.durationPrev = currentBestDuration;
                bossStats.durationBest = durationAttempt;
                newRecordSet           = true;
            }
            else
            {
                bossStats.durationPrev = durationAttempt;
            }

            // Empty check should be less than 0 because 0 is achievable (No Hit)
            if (hitsTakenAttempt < currentBestHitsTaken || currentBestHitsTaken < 0)
            {
                bossStats.hitsTakenPrev = currentBestHitsTaken;
                bossStats.hitsTakenBest = hitsTakenAttempt;
                newRecordSet            = true;
            }
            else
            {
                bossStats.hitsTakenPrev = hitsTakenAttempt;
            }

            // This is an extra record based on Hits Taken. Only overwrite if time is higher than previous.
            if (dodgeTimeAttempt > currentBestDodgeTime || currentBestDodgeTime <= 0)
            {
                bossStats.dodgeTimeBest = dodgeTimeAttempt;
            }

            if (brinkAttempt < currentBestBrink || currentBestBrink <= 0)
            {
                bossStats.healthLossPrev    = currentBestBrink;
                bossStats.healthLossBest    = brinkAttempt;
                bossStats.healthAtStartPrev = currentBestMaxLife;
                bossStats.healthAtStart     = maxLifeAttempt;
                newRecordSet = true;
            }
            else
            {
                bossStats.healthLossPrev    = brinkAttempt;
                bossStats.healthAtStartPrev = maxLifeAttempt;
            }

            // If a new record was made, notify the player
            if (newRecordSet)
            {
                modPlayer.hasNewRecord[recordIndex] = true;
                // Compare records to World Records. Logically, you can only beat the world records if you have beaten your own record
                // TODO: Move World Record texts to Multiplayer exclusively. Check should still happen.
                string message = CheckWorldRecords(recordIndex) ? "World Record!" : "New Record!";
                CombatText.NewText(player.getRect(), Color.LightYellow, message, true);
            }
        }
示例#4
0
        public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
        {
            bool failed = false;

            if (rnd.NextDouble() <= this.dodgeChance)
            {
                this.player.immune     = true;
                this.player.immuneTime = 40;
                CombatText.NewText(new Rectangle((int)this.player.position.X, (int)this.player.position.Y + 10, 100, 100), Color.Lime, "Dodged");
                Main.PlaySound(2, this.player.position);
                playSound = false;
                genGore   = false;
                failed    = true;
                return(false);
            }

            if (rnd.NextDouble() <= this.blockChance)
            {
                this.player.immune     = true;
                this.player.immuneTime = 40;
                CombatText.NewText(new Rectangle((int)this.player.position.X, (int)this.player.position.Y + 10, 100, 100), Color.Lime, "Blocked");
                Main.PlaySound(37, this.player.position);
                playSound = false;
                genGore   = false;
                failed    = true;
                return(false);
            }

            if (this.player.statLife - damage <= 0 && this.player.FindBuffIndex(mod.BuffType <StaticField>()) != -1 && this.HasSkill("High-Voltage Field") && this.player.FindBuffIndex(mod.BuffType <FieldSickness>()) == -1)
            {
                this.player.immune     = true;
                this.player.immuneTime = 120;
                this.player.statLife   = 50;
                this.player.AddBuff(mod.BuffType <FieldSickness>(), 18000);
                CombatText.NewText(new Rectangle((int)this.player.position.X, (int)this.player.position.Y + 10, 100, 100), Color.Lime, "Defibrillated");
                Main.PlaySound(37, this.player.position);
                failed = true;
                return(false);
            }

            if (failed && this.HasSkill("Strengthen"))
            {
                this.player.AddBuff(mod.BuffType <Strengthened>(), 18000);
            }

            if (this.strengthened)
            {
                damage -= (int)(damage * 0.15f * this.SkillLevels["Strengthen"]);
                this.player.ClearBuff(mod.BuffType <Strengthened>());
            }

            if (this.energized)
            {
                int sparkRange = 10;
                Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/Electricity"), this.player.position);
                for (int i = 0; i < 360; i += 72)
                {
                    double  angle         = i * Math.PI / 180;
                    Vector2 sparkTarget   = new Vector2(this.player.position.X + sparkRange * (float)Math.Cos(angle), this.player.position.Y + sparkRange * (float)Math.Sin(angle));
                    Vector2 sparkVelocity = sparkTarget - this.player.position;

                    int   v        = 3;
                    float speedMul = v / sparkVelocity.Length();
                    sparkVelocity.X = speedMul * sparkVelocity.X;
                    sparkVelocity.Y = speedMul * sparkVelocity.Y;
                    Projectile spark = Projectile.NewProjectileDirect(this.player.position, sparkVelocity, mod.ProjectileType <ElectricSpark>(), (int)Math.Ceiling(10 * this.level * 0.05f), 40, this.player.whoAmI);
                    spark.penetrate = 1;
                }
            }

            return(true);
        }
示例#5
0
        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            if (!Fargowiltas.Instance.ThoriumLoaded)
            {
                return;
            }

            ThoriumPlayer thoriumPlayer = player.GetModPlayer <ThoriumPlayer>(thorium);

            if (Soulcheck.GetValue("Cyber Punk States"))
            {
                //cyber set bonus, good lord
                thoriumPlayer.cyberHeadAllowed = false;
                thoriumPlayer.cyberBodyAllowed = false;
                thoriumPlayer.cyberLegsAllowed = false;
                thoriumPlayer.cyberBard        = true;
                for (int i = 0; i < 255; i++)
                {
                    Player player2 = Main.player[i];
                    if (player2.active && Vector2.Distance(player2.Center, player.Center) < 400f)
                    {
                        if (thoriumPlayer.cyberBardValue == 0)
                        {
                            if (thoriumPlayer.empowerDamage < 2)
                            {
                                CombatText.NewText(new Rectangle((int)player2.position.X, (int)player2.position.Y - 10, player2.width, player2.height), new Color(255, 0, 0), "+8% damage", false, false);
                                thoriumPlayer.empowerDamage = 2;
                            }
                            if (thoriumPlayer.empowerCriticalStrike < 2)
                            {
                                CombatText.NewText(new Rectangle((int)player2.position.X, (int)player2.position.Y - 10, player2.width, player2.height), new Color(255, 215, 75), "+8% critical strike chance", false, false);
                                thoriumPlayer.empowerCriticalStrike = 2;
                            }
                            if (thoriumPlayer.empowerDamage == 2)
                            {
                                thoriumPlayer.empowerTimerDamage = 60;
                            }
                            if (thoriumPlayer.empowerCriticalStrike == 2)
                            {
                                thoriumPlayer.empowerTimerCriticalStrike = 60;
                            }
                        }
                        if (thoriumPlayer.cyberBardValue == 1)
                        {
                            if (thoriumPlayer.empowerAttackSpeed < 2)
                            {
                                CombatText.NewText(new Rectangle((int)player2.position.X, (int)player2.position.Y, player2.width, player2.height), new Color(225, 150, 50), "+8% attack speed", false, false);
                                thoriumPlayer.empowerAttackSpeed = 2;
                            }
                            if (thoriumPlayer.empowerMovementSpeed < 2)
                            {
                                CombatText.NewText(new Rectangle((int)player2.position.X, (int)player2.position.Y, player2.width, player2.height), new Color(102, 255, 0), "+15% movement speed", false, false);
                                thoriumPlayer.empowerMovementSpeed = 2;
                            }
                            if (thoriumPlayer.empowerAttackSpeed == 2)
                            {
                                thoriumPlayer.empowerTimerAttackSpeed = 60;
                            }
                            if (thoriumPlayer.empowerMovementSpeed == 2)
                            {
                                thoriumPlayer.empowerTimerMovementSpeed = 60;
                            }
                        }
                        if (thoriumPlayer.cyberBardValue == 2)
                        {
                            if (thoriumPlayer.empowerLifeRegen < 2)
                            {
                                CombatText.NewText(new Rectangle((int)player2.position.X, (int)player2.position.Y - 10, player2.width, player2.height), new Color(255, 100, 175), "+2 life/sec", false, false);
                                thoriumPlayer.empowerLifeRegen = 2;
                            }
                            if (thoriumPlayer.empowerManaRegen < 2)
                            {
                                CombatText.NewText(new Rectangle((int)player2.position.X, (int)player2.position.Y, player2.width, player2.height), new Color(102, 102, 255), "+4 mana/sec", false, false);
                                thoriumPlayer.empowerManaRegen = 2;
                            }
                            if (thoriumPlayer.empowerLifeRegen == 2)
                            {
                                thoriumPlayer.empowerTimerLifeRegen = 60;
                            }
                            if (thoriumPlayer.empowerManaRegen == 2)
                            {
                                thoriumPlayer.empowerTimerManaRegen = 60;
                            }
                        }
                        if (thoriumPlayer.cyberBardValue == 3)
                        {
                            if (thoriumPlayer.empowerDamageReduction < 2)
                            {
                                CombatText.NewText(new Rectangle((int)player2.position.X, (int)player2.position.Y - 10, player2.width, player2.height), new Color(100, 175, 255), "+8% damage reduction", false, false);
                                thoriumPlayer.empowerDamageReduction = 2;
                            }
                            if (thoriumPlayer.empowerDefense < 2)
                            {
                                CombatText.NewText(new Rectangle((int)player2.position.X, (int)player2.position.Y, player2.width, player2.height), new Color(160, 160, 160), "+8 defense", false, false);
                                thoriumPlayer.empowerDefense = 2;
                            }
                            if (thoriumPlayer.empowerDamageReduction == 2)
                            {
                                thoriumPlayer.empowerTimerDamageReduction = 60;
                            }
                            if (thoriumPlayer.empowerDefense == 2)
                            {
                                thoriumPlayer.empowerTimerDefense = 60;
                            }
                        }
                    }
                }
            }

            //auto tuner
            thoriumPlayer.autoTunerBool = true;
            //music player
            thoriumPlayer.musicPlayer = true;
            thoriumPlayer.MP3Damage   = 2;
        }
示例#6
0
        public override void AI()
        {
            Player  player = Main.player[npc.target];
            Vector2 target = npc.HasPlayerTarget ? player.Center : Main.npc[npc.target].Center;

            npc.rotation  = 0.0f;
            npc.netAlways = true;
            npc.TargetClosest(true);
            if (npc.life >= npc.lifeMax)
            {
                npc.life = npc.lifeMax;
            }
            if (npc.target < 0 || npc.target == 255 || player.dead || !player.active)
            {
                npc.TargetClosest(false);
                npc.direction  = 1;
                npc.velocity.Y = npc.velocity.Y - 0.1f;
                if (npc.timeLeft > 10)
                {
                    npc.timeLeft = 10;
                    return;
                }
            }
            if (this.stunned)
            {
                npc.velocity.Y = 0.0f;
                npc.velocity.X = 0.0f;
                ++this.stunnedTimer;
                if (this.stunnedTimer >= 105)
                {
                    this.stunned      = false;
                    this.stunnedTimer = 0;
                }
            }
            if (!this.secondState)
            {
                float distance = 250.0f;
                float k        = 1.26f;
                for (int count = 0; count < 10; count++)
                {
                    Vector2 spawn = npc.Center + distance * (count * k).ToRotationVector2();
                    NPC.NewNPC((int)spawn.X, (int)spawn.Y, ModContent.NPCType <ProtectiveStone>(), 0, npc.whoAmI, 0.0f, count, 0.0f, 255);
                }
                this.secondState = true;
            }
            ++this.ai;
            npc.ai[0] = ai * 1f;
            int  velocity = (int)((double)npc.ai[0] / 50f);
            bool speedB   = (npc.life <= npc.lifeMax * 0.6 ? true : false);
            int  speedV   = (int)(speedB ? 6f : 0f);

            if (npc.ai[0] < 350.0 && !this.stunned)
            {
                this.frame = 0;
                AntiarisHelper.MoveTowards(npc, target, (int)(Vector2.Distance(target, npc.Center) > 300 ? (Main.expertMode ? 24f : 20f) : (Main.expertMode ? 9f : 7f)) + speedV, 30f);
                for (int k = 0; k < 5 * (npc.ai[0] / 50); k++)
                {
                    float scale = 0.4f;
                    if (npc.ai[0] % 2 == 1)
                    {
                        scale = 0.65f;
                    }
                    int index2 = Dust.NewDust(npc.Center + new Vector2(0.0f, -20f), 24, 24, 60, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, new Color(), 1f);
                    Main.dust[index2].position  -= new Vector2(2f);
                    Main.dust[index2].noGravity  = true;
                    Main.dust[index2].scale      = scale;
                    Main.dust[index2].customData = npc;
                }
                npc.netUpdate = true;
                if (npc.ai[0] % 349.0 == 0)
                {
                    this.healTime += 1;
                }
            }
            else if (npc.ai[0] >= 350.0 && npc.ai[0] < 450.0)
            {
                this.stunned = true;
                this.frame   = 2;
                AntiarisHelper.MoveTowards(npc, target, (int)(Vector2.Distance(target, npc.Center) > 300 ? (Main.expertMode ? 24f : 20f) : (Main.expertMode ? 9f : 7f)) + speedV, 30f);
                for (int k = 0; k < 2 * (npc.ai[0] / 45); k++)
                {
                    float scale = 0.65f;
                    if (npc.ai[0] % 2 == 1)
                    {
                        scale = 0.81f;
                    }
                    int index2 = Dust.NewDust(npc.Center + new Vector2(0.0f, -20f), 24, 24, 60, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, new Color(), 1f);
                    Main.dust[index2].position  -= new Vector2(2f);
                    Main.dust[index2].noGravity  = true;
                    Main.dust[index2].scale      = scale;
                    Main.dust[index2].customData = npc;
                }
                player.AddBuff(ModContent.BuffType <Injured>(), Main.expertMode ? 560 : 420, true);
                npc.netUpdate = true;
            }
            if (npc.ai[0] >= 450.0)
            {
                this.frame   = 1;
                this.stunned = false;
                npc.defense  = 40;
                if (!this.fastSpeed)
                {
                    if (Main.rand.Next(2) == 0)
                    {
                        this.fastSpeed = true;
                        npc.ai[2]      = 0f;
                    }
                    else
                    {
                        this.fastSpeed = true;
                        npc.ai[2]      = 1f;
                    }
                }
                else
                {
                    if (npc.ai[2] == 0.0)
                    {
                        if ((double)npc.ai[0] % 50 == 0)
                        {
                            float speed = 21f + speedV;
                            if (Main.expertMode)
                            {
                                speed = 25f + speedV;
                            }
                            Vector2 vector_      = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
                            float   x            = player.position.X + player.width / 2 - vector_.X;
                            float   y            = player.position.Y + player.height / 2 - vector_.Y;
                            float   distanse     = (float)Math.Sqrt(x * (double)x + y * (double)y);
                            float   resuceFactor = speed / distanse;
                            npc.velocity.X = x * resuceFactor;
                            npc.velocity.Y = y * resuceFactor;
                        }
                    }
                    else
                    {
                        npc.alpha = 180;
                        if ((double)npc.ai[0] % 35 == 0)
                        {
                            float speed = 28f + speedV;
                            if (Main.expertMode)
                            {
                                speed = 30f + speedV;
                            }
                            Vector2 vector_      = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
                            float   x            = player.position.X + player.width / 2 - vector_.X;
                            float   y            = player.position.Y + player.height / 2 - vector_.Y;
                            float   distanse     = (float)Math.Sqrt(x * (double)x + y * (double)y);
                            float   resuceFactor = speed / distanse;
                            npc.velocity.X = x * resuceFactor;
                            npc.velocity.Y = y * resuceFactor;
                        }
                    }
                }
                npc.netUpdate = true;
            }
            else
            {
                npc.defense = 22;
            }
            if (npc.ai[0] >= 650.0)
            {
                this.ai        = 0;
                npc.alpha      = 0;
                npc.ai[2]      = 0;
                this.fastSpeed = false;
            }
            if (npc.life <= npc.lifeMax * 0.333)
            {
                npc.alpha   = 0;
                this.ai     = 0;
                this.frame  = 0;
                npc.ai[1]  += 1 + (npc.life <= npc.lifeMax * 0.111 ? 1 : (npc.life <= npc.lifeMax * 0.222 ? 1 : 0));
                npc.defense = 25;
                if (npc.ai[1] < 200.0)
                {
                    this.frame     = 2;
                    npc.velocity.X = 0f;
                    npc.velocity.Y = 0f;
                }
                if (npc.ai[1] < 200.0)
                {
                    for (int k = 0; k < 3 * (npc.ai[1] / 50); k++)
                    {
                        float scale = 0.81f;
                        if (npc.ai[0] % 2 == 1)
                        {
                            scale = 1f;
                        }
                        int index2 = Dust.NewDust(npc.Center + new Vector2(0.0f, -20f), 24, 24, 60, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, new Color(), 1f);
                        Main.dust[index2].position  -= new Vector2(2f);
                        Main.dust[index2].noGravity  = true;
                        Main.dust[index2].scale      = scale;
                        Main.dust[index2].customData = npc;
                    }
                }
                if (npc.ai[1] % 200.0 == 0 && npc.ai[1] <= 399.0)
                {
                    this.attackTimer += 1;
                    if (this.attackTimer <= 2)
                    {
                        Vector2 shootPos   = npc.Center;
                        float   inaccuracy = 10f * (npc.life / npc.lifeMax);
                        Vector2 shootVel   = target - shootPos + new Vector2(Main.rand.NextFloat(-inaccuracy, inaccuracy), Main.rand.NextFloat(-inaccuracy, inaccuracy));
                        shootVel.Normalize();
                        shootVel *= 14f;
                        SoundEngine.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 88);
                        for (int k = 0; k < (Main.expertMode ? 5 : 3); k++)
                        {
                            Projectile.NewProjectile(shootPos.X + -100 * npc.direction + Main.rand.Next(-40, 41), shootPos.Y - Main.rand.Next(-50, 40), shootVel.X, shootVel.Y, ModContent.ProjectileType <GolemCrystal>(), npc.damage / 3, 5f);
                        }
                    }
                    else
                    {
                        if (Main.expertMode)
                        {
                            for (int i = 0; i < 7; i++)
                            {
                                Projectile.NewProjectile((int)((player.position.X - 50) + Main.rand.Next(100)), (int)((player.position.Y - 50) + Main.rand.Next(100)), 0.0f, 0.0f, ModContent.ProjectileType <TowerKeeper1Sheet>(), npc.damage / 3, 4.5f);
                            }
                        }
                        for (int k = 0; k < (Main.expertMode ? 8 : 5); k++)
                        {
                            Vector2 shootPos = player.position + new Vector2(Main.rand.Next(-300, 300), -1000);
                            Vector2 shootVel = new Vector2(Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(9f, 14f));
                            Projectile.NewProjectile(shootPos, shootVel, ModContent.ProjectileType <GolemCrystal>(), npc.damage / 3, 4.5f);
                        }
                        SoundEngine.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 88);
                        this.attackTimer = 0;
                    }
                }
                if (npc.ai[1] > 200.0)
                {
                    AntiarisHelper.MoveTowards(npc, player.Center, 8f + (npc.life <= npc.lifeMax * 0.111 ? 3 : (npc.life <= npc.lifeMax * 0.222 ? 2 : 0)), 8f + (npc.life <= npc.lifeMax * 0.111 ? 3 : (npc.life <= npc.lifeMax * 0.222 ? 2 : 0)));
                }
                if (npc.ai[1] >= 350f)
                {
                    npc.ai[1] = 0f;
                }
                npc.netUpdate = true;
            }
            if (npc.life <= npc.lifeMax * 0.135)
            {
                this.frame   = 1;
                this.stunned = false;
                if (!this.secondState2)
                {
                    float distance = 160f;
                    float k        = 1.26f;
                    for (int count = 0; count < 10; count++)
                    {
                        Vector2 spawn = npc.Center + distance * (count * k).ToRotationVector2();
                        NPC.NewNPC((int)spawn.X, (int)spawn.Y, ModContent.NPCType <ProtectiveStone>(), 0, npc.whoAmI, 0.0f, count, 0.0f, 255);
                    }
                    this.secondState2 = true;
                }
                if (NPC.AnyNPCs(ModContent.NPCType <ProtectiveStone2>()))
                {
                    //if ((double)this.ai % 215.0 == 0.0)
                    this.stunned = true;
                    if (Main.rand.Next(5) == 0)
                    {
                        Projectile.NewProjectile((int)((npc.position.X - 500) + Main.rand.Next(1000)), (int)((npc.position.Y - 500) + Main.rand.Next(1000)), 0.0f, 0.0f, ModContent.ProjectileType <TowerKeeper2Sheet>(), npc.damage / 3, 4.5f);
                    }
                    npc.dontTakeDamage = true;
                }
                else
                {
                    if (Main.expertMode)
                    {
                        this.stunned = false;
                        npc.alpha    = 255;
                        if ((double)npc.ai[0] % 120 == 0)
                        {
                            float speed = 24.0f + speedV;
                            if (Main.expertMode)
                            {
                                speed = 26.0f + speedV;
                            }
                            Vector2 vector_      = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
                            float   x            = player.position.X + player.width / 2 - vector_.X;
                            float   y            = player.position.Y + player.height / 2 - vector_.Y;
                            float   distanse     = (float)Math.Sqrt(x * (double)x + y * (double)y);
                            float   resuceFactor = speed / distanse;
                            npc.velocity.X = x * resuceFactor;
                            npc.velocity.Y = y * resuceFactor;
                        }
                    }
                    if (Main.rand.Next(5) == 0)
                    {
                        Projectile.NewProjectile((int)((npc.position.X - 500) + Main.rand.Next(1000)), (int)((npc.position.Y - 500) + Main.rand.Next(1000)), 0.0f, 0.0f, ModContent.ProjectileType <TowerKeeperSheet>(), npc.damage / 3, 4.5f);
                    }
                    npc.dontTakeDamage = false;
                }
            }
            if (this.healTime >= 3)
            {
                ++this.healTimeKey;
                if (this.healTimeKey >= 120)
                {
                    npc.life += (int)(620 * (Main.expertMode ? 1.5f : 1f));
                    CombatText.NewText(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height), new Color(71, 180, 71), "+" + (int)(350 * (Main.expertMode ? 1.5f : 1f)), false, false);
                    Main.LocalPlayer.statLife -= 50;
                    this.healTime              = 0;
                    this.healTimeKey           = 0;
                    npc.netUpdate              = true;
                }
            }
            if (this.checkDead)
            {
                this.ai        = 0;
                npc.ai[0]      = 0;
                npc.ai[1]      = 0;
                npc.velocity.X = npc.velocity.Y = 0f;
                ++this.deadTimer;
                this.frame = 0;
                for (int k = 0; k < 5 * (this.deadTimer / 50); k++)
                {
                    npc.dontTakeDamage = true;
                    float scale = 0.81f;
                    if (npc.ai[0] % 2 == 1)
                    {
                        scale = 1f;
                    }
                    int index2 = Dust.NewDust(npc.Center + new Vector2(0.0f, -20f), 24, 24, 60, npc.velocity.X / 2f, npc.velocity.Y / 2f, 0, new Color(), 1f);
                    Main.dust[index2].position  -= new Vector2(2f);
                    Main.dust[index2].noGravity  = true;
                    Main.dust[index2].scale      = scale;
                    Main.dust[index2].customData = npc;
                }
                if (this.deadTimer == 100)
                {
                    SoundEngine.PlaySound(mod.GetLegacySoundSlot(Terraria.ModLoader.SoundType.Custom, "Sounds/NPCs/TowerKeeperDeath"), npc.position);
                }
                if (this.deadTimer >= 300)
                {
                    this.frame = 1;
                    if (this.deadTimer >= 400)
                    {
                        npc.life = 0;
                        npc.HitEffect(0, 1337);
                        npc.checkDead();
                        SoundEngine.PlaySound(4, (int)npc.position.X, (int)npc.position.Y, 43);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore1"), 1f);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore4"), 1f);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore4"), 1f);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore4"), 1f);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore5"), 1f);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore5"), 1f);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore5"), 1f);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore2"), 1f);
                        Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/TowerKeeperGore3"), 1f);
                    }
                }
                if (this.deadTimer >= 0)
                {
                    Main.musicFade[Main.curMusic] = 1f / (float)(this.deadTimer / 15 * 0.5f);
                }
            }
        }
示例#7
0
        public override bool AnimateTurn(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                         PokemonData deffender, BattleState state, bool opponent)
        {
            if (AnimationFrame == 1) //At initial frame we pan camera to attacker
            {
                TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);
            }
            else if (AnimationFrame == 140) //Move animation begin after 140 frames
            {
                BattleMode.UI.splashText.SetText("");

                Vector2 vel = (target.projectile.position + (target.projectile.Size / 2)) - (mon.projectile.position + (mon.projectile.Size / 2));
                vel.Normalize();
                vel *= 15;
                int id = Projectile.NewProjectile(mon.projectile.position, vel,
                                                  ProjectileID.DD2PhoenixBowShot, 0, 0);
                Main.projectile[id].maxPenetrate = 99;
                Main.projectile[id].penetrate    = 99;
                Main.projectile[id].tileCollide  = false;

                if (attacker.CustomData.ContainsKey(PROJID_KEY))
                {
                    attacker.CustomData[PROJID_KEY] = id.ToString();
                }
                else
                {
                    attacker.CustomData.Add(PROJID_KEY, id.ToString());
                }
            }
            else if (AnimationFrame == 260)//At Last frame we destroy new proj
            {
                InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                var id = int.Parse(attacker.CustomData[PROJID_KEY]);
                if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                {
                    CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                }
                Main.projectile[id].timeLeft = 0;
                Main.projectile[id].active   = false;
                BattleMode.queueEndMove      = true;
            }
            else if (AnimationFrame > 140 && AnimationFrame < 261)
            {
                var id = int.Parse(attacker.CustomData[PROJID_KEY]);
                //Vector2 vel = (target.projectile.position + (target.projectile.Size / 2)) - (mon.projectile.position + (mon.projectile.Size / 2));
                //var l = vel.Length();
                //vel.Normalize();
                //Main.projectile[id].position = mon.projectile.position + (vel * (l * (AnimationFrame / 120)));
                Main.projectile[id].position = Interpolation.ValueAt(AnimationFrame, mon.projectile.position, target.projectile.position, 140, 260,
                                                                     Easing.Out);
                TerramonMod.ZoomAnimator.ScreenPosX(Main.projectile[id].position.X, 1, Easing.None);
                TerramonMod.ZoomAnimator.ScreenPosY(Main.projectile[id].position.Y, 1, Easing.None);
            }

            // This should be at the very bottom of AnimateTurn() in every move.
            if (BattleMode.moveEnd)
            {
                AnimationFrame     = 0;
                BattleMode.moveEnd = false;
                return(false);
            }

            // IGNORE EVERYTHING BELOW WHEN MAKING YOUR OWN MOVES.
            if (AnimationFrame > 1810)
            {
                return(false);
            }

            return(true);
        }
示例#8
0
        public override void AI()
        {
            if (npc.localAI[3] == 0) //just spawned
            {
                npc.TargetClosest(false);
                Movement(Main.player[npc.target].Center, 0.8f, 32f);
                if (npc.Distance(Main.player[npc.target].Center) < 2000)
                    npc.localAI[3] = 1;
                else
                    return;

                if (Main.netMode != NetmodeID.MultiplayerClient)
                {
                    if (FargoSoulsWorld.MasochistMode)
                        Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType<LifeRitual>(), npc.damage / 2, 0f, Main.myPlayer, 0f, npc.whoAmI);
                }
            }

            EModeGlobalNPC.championBoss = npc.whoAmI;

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

            if (npc.HasValidTarget && npc.Distance(player.Center) < 2500)
                npc.timeLeft = 600;

            switch ((int)npc.ai[0])
            {
                case -3: //final phase
                    if (!Main.dayTime || !player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 2500f) //despawn code
                    {
                        npc.TargetClosest(false);
                        if (npc.timeLeft > 30)
                            npc.timeLeft = 30;

                        npc.noTileCollide = true;
                        npc.noGravity = true;
                        npc.velocity.Y -= 1f;

                        break;
                    }

                    npc.velocity = Vector2.Zero;

                    npc.ai[1] -= (float)Math.PI * 2 / 447;
                    npc.ai[3] += (float)Math.PI * 2 / 447; //spin deathrays both ways

                    if (--npc.ai[2] < 0)
                    {
                        npc.localAI[1] = npc.localAI[1] == 0 ? 1 : 0;
                        npc.ai[2] = npc.localAI[1] == 1 ? 90 : 30;

                        if (npc.ai[1] < 360 && Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            int type = npc.localAI[1] == 1 ? ModContent.ProjectileType<LifeDeathraySmall2>() : ModContent.ProjectileType<LifeDeathray2>();
                            int max = 3;
                            for (int i = 0; i < max; i++)
                            {
                                float offset = (float)Math.PI * 2 / max * i;
                                Projectile.NewProjectile(npc.Center, Vector2.UnitX.RotatedBy(npc.ai[3] + offset),
                                    type, npc.damage / 4, 0f, Main.myPlayer, (float)Math.PI * 2 / 447, npc.whoAmI);
                                Projectile.NewProjectile(npc.Center, Vector2.UnitX.RotatedBy(npc.ai[1] + offset),
                                    type, npc.damage / 4, 0f, Main.myPlayer, -(float)Math.PI * 2 / 447, npc.whoAmI);
                            }
                        }
                    }

                    if (--npc.localAI[0] < 0)
                    {
                        npc.localAI[0] = 47;
                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            int max = 14;
                            float rotation = Main.rand.NextFloat((float)Math.PI * 2);
                            for (int i = 0; i < max; i++)
                            {
                                Projectile.NewProjectile(npc.Center, new Vector2(4f, 0).RotatedBy(rotation + Math.PI / max * 2 * i),
                                    ModContent.ProjectileType<ChampionBee>(), npc.damage / 4, 0f, Main.myPlayer);
                            }
                        }
                    }
                    break;

                case -2: //final phase transition
                    npc.velocity *= 0.97f;

                    if (npc.ai[1] > 180)
                    {
                        npc.localAI[0] = 0;
                        npc.localAI[2] = 2;
                    }

                    if (++npc.ai[1] == 180) //heal up
                    {
                        Main.PlaySound(SoundID.Roar, npc.Center, 2); //arte scream

                        int heal = npc.lifeMax / 3 - npc.life;
                        npc.life += heal;
                        CombatText.NewText(npc.Hitbox, CombatText.HealLife, heal);

                        const int num226 = 80;
                        for (int num227 = 0; num227 < num226; num227++)
                        {
                            Vector2 vector6 = Vector2.UnitX * 40f;
                            vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + npc.Center;
                            Vector2 vector7 = vector6 - npc.Center;
                            int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 174, 0f, 0f, 0, default(Color), 3f);
                            Main.dust[num228].noGravity = true;
                            Main.dust[num228].velocity = vector7;
                        }
                    }
                    else if (npc.ai[1] > 240)
                    {
                        npc.ai[0] = -3;
                        npc.ai[1] = npc.DirectionTo(player.Center).ToRotation();
                        npc.ai[2] = 0;
                        npc.ai[3] = npc.DirectionTo(player.Center).ToRotation();
                        npc.netUpdate = true;
                    }
                    break;

                case -1: //heal
                    npc.velocity *= 0.97f;

                    if (npc.ai[1] > 180)
                        npc.localAI[2] = 1;

                    if (++npc.ai[1] == 180) //heal up
                    {
                        Main.PlaySound(SoundID.Roar, npc.Center, 2); //arte scream

                        int heal = npc.lifeMax - npc.life;
                        npc.life += heal;
                        CombatText.NewText(npc.Hitbox, CombatText.HealLife, heal);

                        const int num226 = 80;
                        for (int num227 = 0; num227 < num226; num227++)
                        {
                            Vector2 vector6 = Vector2.UnitX * 40f;
                            vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + npc.Center;
                            Vector2 vector7 = vector6 - npc.Center;
                            int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 174, 0f, 0f, 0, default(Color), 3f);
                            Main.dust[num228].noGravity = true;
                            Main.dust[num228].velocity = vector7;
                        }
                    }
                    else if (npc.ai[1] > 240)
                    {
                        npc.ai[0] = npc.ai[3];
                        npc.ai[1] = 0;
                        npc.ai[2] = 0;
                        npc.ai[3] = 0;
                        npc.netUpdate = true;
                    }
                    break;

                case 0: //float over player
                    if (!Main.dayTime || !player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 2500f) //despawn code
                    {
                        npc.TargetClosest(false);
                        if (npc.timeLeft > 30)
                            npc.timeLeft = 30;

                        npc.noTileCollide = true;
                        npc.noGravity = true;
                        npc.velocity.Y -= 1f;

                        break;
                    }
                    
                    targetPos = player.Center;
                    targetPos.Y -= 275;
                    if (npc.Distance(targetPos) > 50)
                        Movement(targetPos, 0.18f, 24f, true);
                    if (npc.Distance(player.Center) < 200) //try to avoid contact damage
                        Movement(targetPos, 0.24f, 24f, true);

                    if (++npc.ai[1] > 150)
                    {
                        npc.TargetClosest();
                        npc.ai[0]++;
                        npc.ai[1] = 0;
                        npc.ai[2] = 0;
                        npc.ai[3] = 0;
                        npc.netUpdate = true;
                    }

                    if (npc.localAI[2] == 0 && npc.life < npc.lifeMax / 3)
                    {
                        float buffer = npc.ai[0];
                        npc.ai[0] = -1;
                        npc.ai[1] = 0;
                        npc.ai[2] = 0;
                        npc.ai[3] = buffer;
                        npc.netUpdate = true;
                    }

                    if (npc.localAI[2] == 1 && npc.life < npc.lifeMax / 3 && FargoSoulsWorld.MasochistMode)
                    {
                        npc.ai[0] = -2;
                        npc.ai[1] = 0;
                        npc.ai[2] = 0;
                        npc.ai[3] = 0;
                        npc.netUpdate = true;
                    }
                    break;

                case 1: //boundary
                    npc.velocity *= 0.95f;
                    if (++npc.ai[1] > (npc.localAI[2] == 1 ? 2 : 3))
                    {
                        Main.PlaySound(SoundID.Item12, npc.Center);
                        npc.ai[1] = 0;
                        npc.ai[2] -= (float)Math.PI / 4 / 457 * npc.ai[3];
                        if (npc.ai[2] < -(float)Math.PI)
                            npc.ai[2] += (float)Math.PI * 2;
                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            int max = npc.localAI[2] == 1 ? 5 : 4;
                            for (int i = 0; i < max; i++)
                            {
                                Projectile.NewProjectile(npc.Center, new Vector2(6f, 0).RotatedBy(npc.ai[2] + Math.PI / max * 2 * i),
                                    ModContent.ProjectileType<ChampionBee>(), npc.damage / 4, 0f, Main.myPlayer);
                            }
                        }
                    }
                    if (++npc.ai[3] > 300)
                    {
                        npc.TargetClosest();
                        npc.ai[0]++;
                        npc.ai[1] = 0;
                        npc.ai[2] = 0;
                        npc.ai[3] = 0;
                        npc.netUpdate = true;
                    }
                    break;

                case 2:
                    if (npc.ai[3] == 0)
                    {
                        if (!player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 2500f) //despawn code
                        {
                            npc.TargetClosest(false);
                            if (npc.timeLeft > 30)
                                npc.timeLeft = 30;

                            npc.noTileCollide = true;
                            npc.noGravity = true;
                            npc.velocity.Y -= 1f;

                            return;
                        }

                        if (npc.ai[2] == 0)
                            npc.ai[2] = npc.Center.Y; //store arena height
                        
                        if (npc.Center.Y > npc.ai[2] + 1000) //now below arena, track player
                        {
                            targetPos = new Vector2(player.Center.X, npc.ai[2] + 1100);
                            Movement(targetPos, 1.2f, 24f);

                            if (Math.Abs(player.Center.X - npc.Center.X) < npc.width / 2
                                && ++npc.ai[1] > (npc.localAI[2] == 1 ? 30 : 60)) //in position under player
                            {
                                Main.PlaySound(SoundID.Item92, npc.Center);

                                npc.ai[3]++;
                                npc.ai[1] = 0;
                                npc.netUpdate = true;
                            }
                        }
                        else //drop below arena
                        {
                            npc.velocity.X *= 0.95f;
                            npc.velocity.Y += 0.6f;
                        }
                    }
                    else
                    {
                        npc.velocity.X = 0;
                        npc.velocity.Y = -36f;

                        if (++npc.ai[1] > 1) //spawn pixies
                        {
                            npc.ai[1] = 0;
                            npc.localAI[0] = npc.localAI[0] == 1 ? -1 : 1; //alternate sides
                            if (Main.netMode != NetmodeID.MultiplayerClient)
                            {
                                int n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType<LesserFairy>(), npc.whoAmI, Target: npc.target);
                                if (n != Main.maxNPCs)
                                {
                                    Main.npc[n].velocity = 5f * Vector2.UnitX.RotatedBy(Math.PI * (Main.rand.NextDouble() - 0.5));
                                    Main.npc[n].velocity.X *= npc.localAI[0];

                                    if (Main.netMode == NetmodeID.Server)
                                    {
                                        NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                                    }
                                }
                            }
                        }

                        if (npc.Center.Y < player.Center.Y - 600) //dash ended
                        {
                            npc.velocity.Y *= -0.25f;
                            npc.localAI[0] = 0f;

                            npc.TargetClosest();
                            npc.ai[0]++;
                            npc.ai[1] = 0;
                            npc.ai[2] = 0;
                            npc.ai[3] = 0;
                            npc.netUpdate = true;
                        }
                    }
                    break;

                case 3:
                    goto case 0;

                case 4: //beetle swarm
                    npc.velocity *= 0.9f;

                    if (npc.ai[3] == 0)
                        npc.ai[3] = npc.Center.X < player.Center.X ? -1 : 1;

                    if (++npc.ai[2] > (npc.localAI[2] == 1 ? 35 : 45))
                    {
                        npc.ai[2] = 0;
                        Main.PlaySound(SoundID.Item92, npc.Center);

                        if (npc.localAI[0] > 0)
                            npc.localAI[0] = -1;
                        else
                            npc.localAI[0] = 1;

                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            Vector2 projTarget = npc.Center;
                            projTarget.X += 1200 * npc.ai[3];
                            projTarget.Y += 1200 * -npc.localAI[0];
                            for (int i = 0; i < 20; i++)
                            {
                                projTarget.Y += 250 * npc.localAI[0];
                                Vector2 speed = (projTarget - npc.Center) / 40;
                                float ai0 = (npc.localAI[2] == 1 ? 9 : 6) * -npc.ai[3]; //x speed of beetles
                                float ai1 = 6 * -npc.localAI[0]; //y speed of beetles
                                Projectile.NewProjectile(npc.Center, speed, ModContent.ProjectileType<ChampionBeetle>(), npc.damage / 4, 0f, Main.myPlayer, ai0, ai1);
                            }
                        }
                    }

                    if (++npc.ai[1] > 360)
                    {
                        npc.localAI[0] = 0;

                        npc.TargetClosest();
                        npc.ai[0]++;
                        npc.ai[1] = 0;
                        npc.ai[2] = 0;
                        npc.ai[3] = 0;
                        npc.netUpdate = true;
                    }
                    break;

                case 5:
                    goto case 0;

                case 6:
                    npc.velocity *= 0.98f;

                    if (++npc.ai[2] > 60)
                    {
                        if (++npc.ai[3] > (npc.localAI[2] == 1 ? 4 : 7)) //spray fireballs that home down
                        {
                            npc.ai[3] = 0;
                            if (Main.netMode != NetmodeID.MultiplayerClient)
                            {
                                //spawn anywhere above self
                                Vector2 target = new Vector2(Main.rand.NextFloat(1000), 0).RotatedBy(Main.rand.NextDouble() * -Math.PI);
                                Vector2 speed = 2 * target / 60;
                                float acceleration = -speed.Length() / 60;
                                Projectile.NewProjectile(npc.Center, speed, ModContent.ProjectileType<LifeFireball>(),
                                    npc.damage / 4, 0f, Main.myPlayer, 60f, acceleration);
                            }
                        }

                        if (npc.ai[2] > (npc.localAI[2] == 1 ? 120 : 100))
                        {
                            npc.netUpdate = true;
                            npc.ai[2] = 0;
                        }
                    }

                    if (++npc.ai[1] > 480)
                    {
                        npc.TargetClosest();
                        npc.ai[0]++;
                        npc.ai[1] = 0;
                        npc.ai[2] = 0;
                        npc.ai[3] = 0;
                        npc.netUpdate = true;
                    }
                    break;

                case 7:
                    goto case 0;

                case 8:
                    goto case 2;

                case 9: //deathray spin
                    npc.velocity *= 0.95f;

                    npc.ai[3] +=  (float)Math.PI * 2 / (npc.localAI[2] == 1 ? -300 : 360);

                    if (--npc.ai[2] < 0)
                    {
                        npc.ai[2] = 60;
                        npc.localAI[1] = npc.localAI[1] == 0 ? 1 : 0;

                        if (npc.ai[1] < 360 && Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            int type = npc.localAI[1] == 1 ? ModContent.ProjectileType<LifeDeathraySmall>() : ModContent.ProjectileType<LifeDeathray>();
                            int max = npc.localAI[2] == 1 ? 6 : 4;
                            for (int i = 0; i < max; i++)
                            {
                                float offset = (float)Math.PI * 2 / max * i;
                                Projectile.NewProjectile(npc.Center, Vector2.UnitX.RotatedBy(npc.ai[3] + offset),
                                    type, npc.damage / 4, 0f, Main.myPlayer, offset, npc.whoAmI);
                            }
                        }
                    }

                    if (++npc.ai[1] > 390)
                    {
                        npc.TargetClosest();
                        npc.ai[0]++;
                        npc.ai[1] = 0;
                        npc.ai[2] = 0;
                        npc.ai[3] = 0;
                        npc.localAI[1] = 0;
                        npc.netUpdate = true;
                    }
                    break;

                case 10:
                    goto case 0;

                case 11: //cactus mines
                    npc.velocity *= 0.98f;

                    if (++npc.ai[2] > (npc.localAI[2] == 1 ? 75 : 100))
                    {
                        if (++npc.ai[3] > 5) //spray mines that home down
                        {
                            npc.ai[3] = 0;

                            Main.PlaySound(SoundID.Item12, npc.Center);

                            if (Main.netMode != NetmodeID.MultiplayerClient)
                            {
                                Vector2 target = player.Center - npc.Center;
                                target.X += Main.rand.Next(-75, 76);
                                target.Y += Main.rand.Next(-75, 76);

                                Vector2 speed = 2 * target / 90;
                                float acceleration = -speed.Length() / 90;

                                Projectile.NewProjectile(npc.Center, speed, ModContent.ProjectileType<CactusMine>(),
                                    npc.damage / 4, 0f, Main.myPlayer, 0f, acceleration);
                            }
                        }

                        if (npc.ai[2] > 130)
                        {
                            npc.netUpdate = true;
                            npc.ai[2] = 0;
                        }
                    }

                    if (++npc.ai[1] > 480)
                    {
                        npc.TargetClosest();
                        npc.ai[0]++;
                        npc.ai[1] = 0;
                        npc.ai[2] = 0;
                        npc.ai[3] = 0;
                        npc.netUpdate = true;
                    }
                    break;

                default:
                    npc.ai[0] = 0;
                    goto case 0;
            }

            for (int i = 0; i < 3; i++)
            {
                int d = Dust.NewDust(npc.position, npc.width, npc.height, 87, 0f, 0f, 0, default(Color), 1.5f);
                Main.dust[d].noGravity = true;
                Main.dust[d].velocity *= 4f;
            }
        }
示例#9
0
        public override void AI()
        {
            if (!npc.HasPlayerTarget)
            {
                npc.TargetClosest();
            }

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

            BaseAI.AIFlier(npc, ref npc.ai, true, 0.15f, 0.08f, 8f, 7f, false, 300);

            if (npc.alpha > 0)
            {
                npc.alpha -= 4;
            }
            else
            {
                npc.alpha = 0;
            }

            if (npc.ai[3]++ > 30 && Main.netMode != 1)
            {
                int     projType = ModContent.ProjectileType <SeraphFeather>();
                float   spread   = 30f * 0.0174f;
                Vector2 dir      = Vector2.Normalize(player.Center - npc.Center);
                dir *= 14f;
                float  baseSpeed  = (float)Math.Sqrt((dir.X * dir.X) + (dir.Y * dir.Y));
                double startAngle = Math.Atan2(dir.X, dir.Y) - .1d;
                double deltaAngle = spread / 6f;
                for (int i = 0; i < 3; i++)
                {
                    double offsetAngle = startAngle + (deltaAngle * i);
                    Projectile.NewProjectile(npc.Center.X, npc.Center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), projType, npc.damage / 4, 2, Main.myPlayer);
                }
                npc.ai[3]     = 0;
                npc.netUpdate = true;
            }

            if (!player.GetModPlayer <AAPlayer>().ZoneAcropolis || player.dead)
            {
                npc.TargetClosest();
                if (!player.GetModPlayer <AAPlayer>().ZoneAcropolis || player.dead)
                {
                    if (!player.GetModPlayer <AAPlayer>().ZoneAcropolis)
                    {
                        CombatText.NewText(npc.Hitbox, Color.CadetBlue, SeraphBitching(), true);
                    }
                    else if (player.dead)
                    {
                        CombatText.NewText(npc.Hitbox, Color.CadetBlue, SeraphBitchingKill(), true);
                    }
                    for (int a = 0; a < 8; a++)
                    {
                        Dust.NewDust(npc.Center, 60, 40, ModContent.DustType <Feather>(), Main.rand.Next(-1, 2), 1, 0);
                    }
                    BaseAI.KillNPC(npc);
                }
            }

            npc.spriteDirection = npc.direction;
            npc.rotation        = npc.velocity.X * 0.05f;
        }
示例#10
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            if (shieldLife < 0 && projectile.timeLeft > EXPLOSIONTIME)
            {
                projectile.timeLeft = EXPLOSIONTIME;
            }

            Vector2 direction = Main.MouseWorld - player.Center;

            direction.Normalize();

            projectile.rotation = direction.ToRotation();

            shieldSpring *= 0.9f;

            projectile.Center = player.Center + (direction * MathHelper.Lerp(35, 26, shieldSpring));

            if (player.GetModPlayer <GeomancerPlayer>().storedGem == StoredGem.Topaz || player.GetModPlayer <GeomancerPlayer>().storedGem == StoredGem.All)
            {
                if (projectile.timeLeft > EXPLOSIONTIME)
                {
                    projectile.timeLeft = EXPLOSIONTIME + 2;
                }
            }
            else
            {
                projectile.active = false;
            }

            if (projectile.timeLeft > EXPLOSIONTIME)
            {
                for (int k = 0; k < Main.maxProjectiles; k++)
                {
                    var proj = Main.projectile[k];

                    if (proj.active && proj.hostile && proj.damage > 1 && proj.Hitbox.Intersects(projectile.Hitbox))
                    {
                        var diff = (proj.damage / 2) - shieldLife;

                        if (diff <= 0)
                        {
                            shieldSpring    = 1;
                            proj.penetrate -= 1;
                            proj.friendly   = true;
                            player.GetModPlayer <ShieldPlayer>().Shield -= proj.damage / 2;
                            CombatText.NewText(projectile.Hitbox, Color.Yellow, proj.damage / 2);
                        }
                        else
                        {
                            CombatText.NewText(projectile.Hitbox, Color.Yellow, proj.damage / 2);
                            proj.damage        -= (int)shieldLife;
                            shieldPlayer.Shield = shieldPlayer.MaxShield - 100;
                            projectile.timeLeft = EXPLOSIONTIME;
                            return;
                        }
                    }
                }
            }
            else
            {
                /*float progress = EXPLOSIONTIME - projectile.timeLeft;
                 *
                 * float deviation = (float)Math.Sqrt(progress) * 0.08f;
                 * projectile.rotation += Main.rand.NextFloat(-deviation,deviation);
                 *
                 * Vector2 dustDir = Main.rand.NextFloat(6.28f).ToRotationVector2();
                 * Dust.NewDustPerfect(projectile.Center - (dustDir * 50), DustID.TopazBolt, dustDir * 10, 0, default, (float)Math.Sqrt(progress) * 0.3f).noGravity = true;*/
            }
        }
示例#11
0
        private void Movement()
        {
            const float MoveSpeed = 1f;

            if (IsBeingTalkedTo() || AttackTimer > 5)
            {
                npc.velocity.X *= 0.96f;
                movementTimer   = 50;
                movementDir     = 0f;
                return;
            }

            if (Teleport-- > 0)
            {
                if (Teleport > 50)
                {
                    npc.alpha += 2;
                    AttackTimer--;
                }

                movementDir   = 0f;
                movementTimer = 100;

                if (Teleport == 195)
                {
                    CombatText.NewText(new Rectangle((int)npc.Center.X, (int)npc.Center.Y - 40, npc.width, 20), Color.LightGoldenrodYellow, "I sense a call...");
                }

                if (Teleport == 50)
                {
                    const float SwirlSize = 1.664f;
                    const float Degrees   = 2.5f;

                    npc.Center = new Vector2(TeleportX, TeleportY);
                    npc.alpha  = 0;

                    float Closeness = 50f;

                    for (float swirlDegrees = Degrees; swirlDegrees < 160 + Degrees; swirlDegrees += 7f)
                    {
                        Closeness -= SwirlSize;                         //It closes in
                        double radians = MathHelper.ToRadians(swirlDegrees);

                        for (int i = 0; i < 4; ++i)                         //Spawn dust
                        {
                            Vector2 offset = new Vector2(Closeness).RotatedBy(radians + (MathHelper.PiOver2 * i));
                            int     d      = Dust.NewDust(npc.Center + offset, 2, 2, DustID.GoldCoin, 0, 0);
                            Main.dust[d].noGravity = true;
                        }
                    }
                    Main.PlaySound(SoundID.DD2_DarkMageCastHeal, npc.Center);
                }
            }

            int tileDist = GetTileAt(0, out bool liquid);

            HandleFloatHeight(tileDist);

            if (!liquid)
            {
                GetTileAt(-1, out bool left);
                GetTileAt(1, out bool right);

                movementTimer--;
                if (movementTimer < 0)
                {
                    var options = new List <float> {
                        0f
                    };

                    if (!left)
                    {
                        options.Add(-MoveSpeed);
                    }

                    if (!right)
                    {
                        options.Add(MoveSpeed);
                    }

                    if (movementDir == 0)
                    {
                        movementDir = Main.rand.Next(options);
                    }
                    else
                    {
                        movementDir = 0f;
                    }

                    movementTimer = movementDir == 0f ? Main.rand.Next(200, 300) : Main.rand.Next(300, 400);

                    NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI);
                }

                if (movementDir < 0f && left)
                {
                    movementDir = 0f;
                }
                else if (movementDir > 0f && right)
                {
                    movementDir = 0f;
                }
            }
            else
            {
                ScanForLand();
            }

            npc.velocity.X = movementDir == 0f ? npc.velocity.X * 0.98f : movementDir;

            if ((movementDir == 0f && Math.Abs(npc.velocity.X) < 0.15f) || IsBeingTalkedTo())
            {
                if (npc.DistanceSQ(NearestPlayer.Center) < 400 * 400)
                {
                    npc.direction = npc.spriteDirection = NearestPlayer.Center.X < npc.Center.X ? -1 : 1;
                }
            }
            else
            {
                npc.direction = npc.spriteDirection = npc.velocity.X < 0 ? -1 : 1;
            }
        }
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Vector2 muzzleOffset = Vector2.Normalize(new Vector2(speedX, speedY - 2)) * 38f;

            if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0))
            {
                position += muzzleOffset;
            }
            float  spread      = MathHelper.ToRadians(4f);       //45 degrees converted to radians
            float  baseSpeed   = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
            double baseAngle   = Math.Atan2(speedX, speedY);
            double randomAngle = baseAngle + (Main.rand.NextFloat() - 0.5f) * spread;

            speedX = baseSpeed * (float)Math.Sin(randomAngle);
            speedY = baseSpeed * (float)Math.Cos(randomAngle);
            if (magazine == 1)
            {
                item.useStyle = 1;
                Main.PlaySound(new Terraria.Audio.LegacySoundStyle(2, 1));
                item.noUseGraphic = true;
                if (throwType == 1)
                {
                    type = mod.ProjectileType("SureshotMIRV");
                }
                if (throwType == 2)
                {
                    type = mod.ProjectileType("SureshotBounce");
                }
                if (throwType == 3)
                {
                    type = mod.ProjectileType("SureshotLegs");
                }
                if (throwType == 4)
                {
                    type = mod.ProjectileType("SureshotGrenade");
                }
                if (throwType == 5)
                {
                    type = mod.ProjectileType("SureshotSticky");
                }
                CombatText.NewText(new Rectangle((int)player.position.X, (int)player.position.Y - 10, player.width, player.height), new Color(255, 255, 255, 100),
                                   "Reloading!");
                Main.PlaySound(SoundLoader.customSoundType, player.position, mod.GetSoundSlot(SoundType.Custom, "Sounds/Reload"));
                item.reuseDelay = 30;
            }
            else
            {
                item.noUseGraphic = false;
                item.useStyle     = 5;
                item.reuseDelay   = 0;
            }
            if (magazine <= 1)
            {
                for (int index1 = 0; index1 < 5; ++index1)
                {
                    int index2 = Dust.NewDust(player.position, player.width, player.height, 263, 0.0f, 0.0f, (int)byte.MaxValue, new Color(), (float)GloriousGuns.instance.gloriousRNG.Next(20, 26) * 0.1f);
                    Main.dust[index2].noLight   = true;
                    Main.dust[index2].noGravity = true;
                    Main.dust[index2].velocity *= 0.5f;
                    Main.dust[index2].scale    *= .6f;
                }
                item.noUseGraphic = true;
                magazine          = maxBullets;
            }
            magazine--;
            int projectileCorrosived = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI);

            Main.projectile[projectileCorrosived].GetGlobalProjectile <GloriousGunsGProj>().shotFromAcidWeaponCommon = true;
            return(false);
        }
示例#13
0
        public override void AI()
        {
            if (npc.life < npc.lifeMax / 2)
            {
                PhaseValueOrSomethingIDK = 1;
            }

            npc.TargetClosest(true);
            npc.spriteDirection = npc.direction;

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

            SpeeeeedValue = SpeeeenBool ? 5 : 7;

            Vector2 moveTo = player.Center - npc.Center;

            moveTo.Normalize();
            moveTo = moveTo * SpeeeeedValue;

            npc.velocity = moveTo;

            if (++SpeeeeenTimer % 180 == 0)
            {
                if (SpeeeenBool)
                {
                    SpeeeenBool = true;
                }
                else
                {
                    SpeeeenBool = false;
                }
            }

            if (SpeeeenBool)
            {
                npc.rotation += npc.velocity.X * 0.1f;
            }

            if (PhaseValueOrSomethingIDK == 0)
            {
                if (++AtttaackTimer >= 250)
                {
                    for (int i = 0; i < Main.rand.Next(10, 20); i++)
                    {
                        Projectile.NewProjectile(npc.Center.X - Main.rand.Next(-600, 600), npc.Center.Y - Main.screenHeight / 2 - 60, moveTo.X * 1.5f, moveTo.Y * 1.5f, ModContent.ProjectileType <Projectiles.rum>(), 35, 2);
                    }

                    AtttaackTimer = 0;
                }
            }
            else if (PhaseValueOrSomethingIDK == 1)
            {
                GameCrashCounter++;

                if (GameCrashCounter == 1)
                {
                    CombatText.NewText(npc.Hitbox, Color.DarkRed, "Kill me in 2 minute or you get booted", dramatic: true);
                }

                if (GameCrashCounter == 3600)
                {
                    CombatText.NewText(npc.Hitbox, Color.DarkRed, "One minute kill me or terraria go back to menu", dramatic: true);
                }

                if (GameCrashCounter == 7140)
                {
                    CombatText.NewText(npc.Hitbox, Color.DarkRed, "You are going to brazil", dramatic: true);
                }

                if (GameCrashCounter == 7200)
                {
                    CombatText.NewText(npc.Hitbox, Color.DarkRed, "Whoops gotta save your stuff first", dramatic: true);
                }

                if (GameCrashCounter == 7300)
                {
                    CombatText.NewText(npc.Hitbox, Color.DarkRed, "PASTA LA VISTA!!!!!", dramatic: true);
                }

                if (GameCrashCounter >= 7320)
                {
                    Main.SaveSettings();

                    if (Main.netMode == NetmodeID.SinglePlayer)
                    {
                        WorldFile.CacheSaveTime();
                    }

                    Main.invasionProgress            = 0;
                    Main.invasionProgressDisplayLeft = 0;
                    Main.invasionProgressAlpha       = 0f;
                    Main.menuMode = 10;
                    Main.gameMenu = true;
                    Main.StopTrackedSounds();
                    CaptureInterface.ResetFocus();
                    Main.ActivePlayerFileData.StopPlayTimer();

                    Player.SavePlayer(Main.ActivePlayerFileData, false);

                    if (Main.netMode == NetmodeID.SinglePlayer)
                    {
                        WorldFile.saveWorld();
                    }
                    else
                    {
                        Netplay.disconnect = true;
                        Main.netMode       = NetmodeID.SinglePlayer;
                    }

                    Main.fastForwardTime = false;
                    Main.UpdateSundial();
                    Main.menuMode = 0;
                }

                if (++AtttaackTimer >= 40)
                {
                    Projectile.NewProjectile(npc.Center, moveTo * 4, ModContent.ProjectileType <Projectiles.beer>(), 50, 3);

                    AtttaackTimer = 0;
                }
            }
        }
示例#14
0
        public void BeCompanionCube()
        {
            Player player = Main.player[projectile.owner];
            Color  color;

            color = Lighting.GetColor((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16);
            Vector3 vector3_1 = color.ToVector3();

            color = Lighting.GetColor((int)player.Center.X / 16, (int)player.Center.Y / 16);
            Vector3 vector3_2 = color.ToVector3();

            if (vector3_1.Length() < 0.15f && vector3_2.Length() < 0.15)
            {
                notlocalai1 += 1;
            }
            else if (notlocalai1 > 0)
            {
                notlocalai1 -= 1;
            }

            notlocalai1 = MathHelper.Clamp(notlocalai1, -3600f, 600);

            if (notlocalai1 > Main.rand.Next(300, 600) && !player.immune)
            {
                notlocalai1 = Main.rand.Next(30) * -10 - 300;

                switch (Main.rand.Next(3))
                {
                case 0:     //stab
                    if (projectile.owner == Main.myPlayer)
                    {
                        Main.PlaySound(SoundID.Item1, projectile.Center);
                        player.Hurt(Terraria.DataStructures.PlayerDeathReason.ByOther(6), 777, 0, false, false, false, -1);
                        player.immune     = false;
                        player.immuneTime = 0;
                    }
                    break;

                case 1:     //spawn mutant
                    if (Main.netMode != NetmodeID.MultiplayerClient)
                    {
                        int n = NPC.NewNPC((int)projectile.Center.X, (int)projectile.Center.Y, ModContent.NPCType <NPCs.MutantBoss.MutantBoss>());
                        if (Main.netMode == NetmodeID.Server)
                        {
                            NetMessage.BroadcastChatMessage(Terraria.Localization.NetworkText.FromLiteral("Mutant has awoken!"), new Color(175, 75, 255));
                            if (n != Main.maxNPCs)
                            {
                                NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                            }
                        }
                        else
                        {
                            Main.NewText("Mutant has awoken!", 175, 75, 255);
                        }
                    }
                    break;

                default:
                    if (projectile.owner == Main.myPlayer)
                    {
                        CombatText.NewText(projectile.Hitbox, Color.LimeGreen, "You think you're safe?");
                    }
                    break;
                }
            }
        }
示例#15
0
        public override void Update(NPC npc, ref int buffIndex)
        {
            Timer++;
            for (int i = 0; i < NPC.maxBuffs; i++)
            {
                if (npc.buffType[i] == BuffType <Antibody>())
                {
                    npc.DelBuff(buffIndex);
                    buffIndex--;
                    return;
                }
            }
            if (npc.type != NPCID.TargetDummy && npc.GetGlobalNPC <EntrogicNPC>().buffOwner != -1)
            {
                Main.player[npc.GetGlobalNPC <EntrogicNPC>().buffOwner].GetModPlayer <EntrogicPlayer>().PlagueNPCAmount++;
            }
            if (npc.lifeRegen > 0)
            {
                npc.lifeRegen = 0;
            }

            if (Main.rand.NextBool(20))
            {
                foreach (NPC target in Main.npc)
                {
                    if (target.active && target.whoAmI != npc.whoAmI && !target.friendly && npc.Distance(target.Center) <= 16f * 16f && !target.buffImmune[Type] && !(target.type != NPCID.TargetDummy && npc.type == NPCID.TargetDummy))
                    {
                        target.AddBuff(Type, Main.rand.Next(4, 9 + 1) * 60);
                        target.GetGlobalNPC <EntrogicNPC>().buffOwner = npc.GetGlobalNPC <EntrogicNPC>().buffOwner;
                    }
                }
            }

            if (/*Timer % 10 == 0 && */ Main.rand.NextBool(34 * 3) && !npc.dontTakeDamage)
            {
                int amount = (int)(npc.lifeMax / 390f) + (Main.hardMode ? 6 : 3);
                if (npc.boss)
                {
                    amount = (Main.hardMode ? 9 : 4) + (int)(npc.lifeMax / 620f);
                }
                amount *= 3;
                if (npc.type != NPCID.TargetDummy)
                {
                    npc.life -= amount;
                }
                int life = CombatText.NewText(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height), CombatText.LifeRegenNegative, amount, false, true);
                if (Main.netMode == NetmodeID.Server && life != 100)
                {
                    CombatText combatText = Main.combatText[life];
                    NetMessage.SendData(MessageID.CombatTextInt, -1, -1, null, (int)combatText.color.PackedValue, combatText.position.X, combatText.position.Y, amount);
                }
                float antiPossibility = 0.07f;
                antiPossibility += npc.life / npc.lifeMax * 0.17f;
                if (npc.boss)
                {
                    antiPossibility *= 1.8f;
                }
                if (Main.rand.NextFloat() < antiPossibility * 2f)
                {
                    npc.AddBuff(BuffType <Antibody>(), Main.rand.Next(4, 9) * 60);
                }
                // 处理NPC死亡
                if (npc.life > 0 || npc.immortal)
                {
                    return;
                }
                npc.life = 1;
                if (Main.netMode != NetmodeID.MultiplayerClient)
                {
                    npc.StrikeNPCNoInteraction(9999, 0f, 0);
                    if (Main.netMode == NetmodeID.Server)
                    {
                        NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, 9999f);
                    }
                }
            }
        }
示例#16
0
        public override void AI(NPC npc)
        {
            base.AI(npc);
            Player player = Main.player[Main.myPlayer];

            if (SuffWorld.ExpiryModeIsActive)
            {
                if (npc.type == NPCID.Creeper)
                {
                    counterToCellSplit++;
                    if (npc.active)
                    {
                        if (npc.justHit)
                        {
                            counterToCellSplit -= 500;
                        }
                        if (counterToCellSplit == 3600)
                        {
                            if (Main.rand.NextFloat() <= 0.6f)
                            {
                                CombatText.NewText(npc.Hitbox, Color.Brown, "Split!");
                                Gore.NewGore(new Vector2(npc.Center.X, npc.Center.Y), Vector2.Zero, 402);
                                NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Creeper);
                                counterToCellSplit = 0;
                            }
                        }
                    }
                }
            }
            if (npc.FullName.Contains("Bat"))
            {
                if (SuffWorld.ExpiryModeIsActive)
                {
                    if (npc.collideX)
                    {
                        npc.velocity.X = npc.oldVelocity.X * -1.5f;
                        if (npc.direction == -1 && npc.velocity.X > 0f && npc.velocity.X < 2f)
                        {
                            npc.velocity.X = 3f;
                        }
                        if (npc.direction == 1 && npc.velocity.X < 0f && npc.velocity.X > -2f)
                        {
                            npc.velocity.X = -3f;
                        }
                    }
                    if (npc.collideY)
                    {
                        npc.velocity.Y = npc.oldVelocity.Y * -1.5f;
                        if (npc.velocity.Y > 0f && npc.velocity.Y < 1f)
                        {
                            npc.velocity.Y = 2f;
                        }
                        if (npc.velocity.Y < 0f && npc.velocity.Y > -1f)
                        {
                            npc.velocity.Y = -2f;
                        }
                    }
                }
                // Basically just you know, make bouncing even better :byeah:
            }
            List <int> Jellies = new List <int>
            {
                NPCID.PinkJellyfish,
                NPCID.BlueJellyfish,
                NPCID.GreenJellyfish,
                NPCID.BloodJelly,
            };

            if (SuffWorld.ExpiryModeIsActive)
            {
                if (Jellies.Contains(npc.type))
                {
                    bool shockMidDash = false;
                    if (npc.wet && npc.ai[1] == 1f)
                    {
                        shockMidDash = true;
                    }
                    else
                    {
                        npc.dontTakeDamage = false;
                    }
                    if (npc.wet)
                    {
                        if (npc.target >= 0 && Main.player[npc.target].wet && !Main.player[npc.target].dead && (Main.player[npc.target].Center - npc.Center).Length() < 300f)
                        {
                            if (npc.ai[1] == 0f)
                            {
                                npc.ai[2] += 3f;
                            }
                            else
                            {
                                npc.ai[2] -= 0.5f;
                            }
                        }
                        if (shockMidDash)
                        {
                            npc.dontTakeDamage = true;
                            npc.ai[2]         += 1f;
                            if (npc.ai[2] >= 120f)
                            {
                                npc.ai[1] = 0f;
                            }
                        }
                        else
                        {
                            npc.ai[2] += 1f;
                            if (npc.ai[2] >= 240f)
                            {
                                npc.ai[1] = 1f;
                                npc.ai[2] = 0f;
                            }
                        }
                    }
                    else
                    {
                        npc.ai[1] = 0f;
                        npc.ai[2] = 0f;
                    }
                }
            }
            if (npc.type == NPCID.GreenSlime ||
                npc.type == NPCID.BlueSlime ||
                npc.type == NPCID.PurpleSlime ||
                npc.type == NPCID.YellowSlime ||
                npc.type == NPCID.RedSlime ||
                npc.type == NPCID.BlackSlime ||
                npc.type == NPCID.Pinky ||
                npc.type == NPCID.MotherSlime ||
                npc.type == NPCID.BabySlime ||
                npc.type == NPCID.IceSlime ||
                npc.type == NPCID.SandSlime ||
                npc.type == NPCID.DungeonSlime ||
                npc.type == NPCID.UmbrellaSlime ||
                npc.type == NPCID.SlimeRibbonGreen ||
                npc.type == NPCID.SlimeRibbonRed ||
                npc.type == NPCID.SlimeRibbonYellow ||
                npc.type == NPCID.SlimeRibbonWhite ||
                npc.type == NPCID.SlimeMasked)
            {
                if (SuffWorld.ExpiryModeIsActive)
                {
                    if (!npc.wet && !Main.player[npc.target].npcTypeNoAggro[npc.type])
                    {
                        ;
                        if (npc.Distance(Main.player[npc.target].Center) < 300f && npc.velocity.Y == 0f)
                        {
                            npc.ai[0] = -1f;
                            if (npc.velocity.Y == 0f)
                            {
                                npc.velocity.X = npc.velocity.X * 1.2f;
                            }
                            if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == -1f)
                            {
                                for (int i = 0; i < 10; i++)
                                {
                                    Vector2 velocity = new Vector2(i - 4, -1f);
                                    npc.velocity.X *= 2.5f + Utils.NextFloat(Main.rand, -2f, 5f);
                                    npc.velocity.Y *= 2.5f + Utils.NextFloat(Main.rand, -1.5f, -0.5f);
                                    npc.velocity.Normalize();
                                    npc.velocity  *= 2f + Utils.NextFloat(Main.rand, -1.5f, 0.75f);
                                    npc.localAI[0] = -1f;
                                }
                            }
                        }
                    }
                }
            }
            if (npc.type == NPCID.ChaosBall || npc.type == NPCID.WaterSphere || npc.type == NPCID.BurningSphere)
            {
                if (SuffWorld.ExpiryModeIsActive)
                {
                    npc.velocity.X = npc.velocity.X * 1.025f;
                    npc.velocity.Y = npc.velocity.Y * 1.025f;
                }
            }
            if (npc.type == NPCID.DarkCaster || npc.type == NPCID.DiabolistRed || npc.type == NPCID.DiabolistWhite || npc.type == NPCID.GoblinSorcerer || npc.type == NPCID.FireImp)
            {
                if (SuffWorld.ExpiryModeIsActive)
                {
                    if (npc.ai[0] == 0f)
                    {
                        npc.ai[0] = 1f;
                    }
                }
            }
            if (npc.aiStyle == NPCAIStyleID.Fighter)
            {
            }
            if (npc.FullName.Contains("Zombie"))
            {
                if (!player.GetModPlayer <InfiniteSuffPlayer>().NPC_AttractLocally&& !player.GetModPlayer <InfiniteSuffPlayer>().NPC_RepulseLocally)
                {
                    if (SuffWorld.ExpiryModeIsActive)
                    {
                        if (npc.velocity.Y == 0)
                        {
                            if (npc.direction == 1)
                            {
                                if (npc.life >= npc.lifeMax / 2)
                                {
                                    npc.velocity.X++;
                                    if (npc.velocity.X > 2)
                                    {
                                        npc.velocity.X = 2;
                                    }
                                }
                                else if (npc.life < npc.lifeMax / 2)
                                {
                                    npc.velocity.X++;
                                    if (npc.velocity.X > 4)
                                    {
                                        npc.velocity.X = 4;
                                    }
                                }
                            }
                            if (npc.direction == -1)
                            {
                                if (npc.life >= npc.lifeMax / 2)
                                {
                                    npc.velocity.X--;
                                    if (npc.velocity.X < 2)
                                    {
                                        npc.velocity.X = -2;
                                    }
                                }
                                else if (npc.life < npc.lifeMax / 2)
                                {
                                    npc.velocity.X--;
                                    if (npc.velocity.X < 4)
                                    {
                                        npc.velocity.X = -4;
                                    }
                                }
                            }
                        }
                    }
                }
                if (npc.type == NPCID.Spazmatism)
                {
                    if (SuffWorld.ExpiryModeIsActive)
                    {
                        npc.ai[10]++;
                        if (npc.ai[10] == 200)
                        {
                            if (!player.dead)
                            {
                                Vector2 position          = npc.Center;
                                float   numberProjectiles = 6f;
                                float   rotation          = MathHelper.ToRadians(180f);
                                int     i = 0;
                                while (i < numberProjectiles)
                                {
                                    Vector2 perturbedSpeed = Utils.RotatedBy(new Vector2(npc.velocity.X + Math.Abs(npc.velocity.X) + 25f, npc.velocity.Y + Math.Abs(npc.velocity.Y) + 25f), MathHelper.Lerp(-rotation, rotation, i / (numberProjectiles - 1f)), default) * 0.2f;
                                    Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ProjectileID.CursedFlameHostile, player.HeldItem.damage, 0, player.whoAmI, 0f, 0f);
                                    i++;
                                }
                            }
                            npc.ai[10] = 0;
                        }
                    }
                }
                if (npc.type == NPCID.Retinazer)
                {
                    if (SuffWorld.ExpiryModeIsActive)
                    {
                        npc.ai[10]++;
                        if (npc.ai[10] == 240)
                        {
                            if (!player.dead)
                            {
                                Vector2 position          = npc.Center;
                                float   numberProjectiles = 6f;
                                float   rotation          = MathHelper.ToRadians(180f);
                                int     i = 0;
                                while (i < numberProjectiles)
                                {
                                    Vector2 perturbedSpeed = Utils.RotatedBy(new Vector2(npc.velocity.X + Math.Abs(npc.velocity.X) + 25f, npc.velocity.Y + Math.Abs(npc.velocity.Y) + 25f), MathHelper.Lerp(-rotation, rotation, i / (numberProjectiles - 1f)), default) * 0.2f;
                                    Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, ProjectileID.EyeLaser, player.HeldItem.damage, 0, player.whoAmI, 0f, 0f);
                                    i++;
                                }
                            }
                            npc.ai[10] = 0;
                        }
                    }
                }
            }
            NetMessage.SendData(MessageID.SyncNPC, number: npc.whoAmI);
            if (player.GetModPlayer <InfiniteSuffPlayer>().NPC_RepulseLocally)
            {
                if (!npc.friendly && npc.CanBeChasedBy() && !npc.boss && (npc.type != NPCID.GolemFistLeft && npc.type != NPCID.SolarCrawltipedeBody && npc.type != NPCID.SolarCrawltipedeTail && npc.type != NPCID.WaterSphere && npc.type != NPCID.ChaosBall))
                {
                    if (!GetInstance <ExpiryModeMod>().MagnetRange_IsInfinite)
                    {
                        if (npc.Distance(Main.MouseWorld) <= 120f)
                        {
                            if (!GetInstance <ExpiryModeMod>().MagnetRange_IsInfinite)
                            {
                                if (player.direction == Math.Sign(npc.Center.X - player.Center.X))
                                {
                                    if (npc.Distance(Main.MouseWorld) <= 80f)
                                    {
                                        CombatText.NewText(npc.Hitbox, Color.Red, "-", true, true);
                                    }
                                    float rotation = Utils.ToRotation(new Vector2(Main.mouseX + Main.screenPosition.X, Main.mouseY + Main.screenPosition.Y) - npc.position);
                                    npc.velocity -= Utils.ToRotationVector2(rotation);
                                }
                            }
                        }
                    }
                    if (GetInstance <ExpiryModeMod>().MagnetRange_IsInfinite)
                    {
                        if (GetInstance <ExpiryModeMod>().MagnetRange_IsInfinite)
                        {
                            if (player.direction == Math.Sign(npc.Center.X - player.Center.X))
                            {
                                if (npc.Distance(Main.MouseWorld) <= 80f)
                                {
                                    CombatText.NewText(npc.Hitbox, Color.Red, "-", true, true);
                                }
                                float rotation = Utils.ToRotation(new Vector2(Main.mouseX + Main.screenPosition.X, Main.mouseY + Main.screenPosition.Y) - npc.position);
                                npc.velocity -= Utils.ToRotationVector2(rotation);
                            }
                        }
                    }
                }
            }
            if (player.GetModPlayer <InfiniteSuffPlayer>().NPC_AttractLocally)
            {
                if (!npc.friendly && npc.CanBeChasedBy() && !npc.boss && (npc.type != NPCID.GolemFistLeft && npc.type != NPCID.SolarCrawltipedeBody && npc.type != NPCID.SolarCrawltipedeTail && npc.type != NPCID.WaterSphere && npc.type != NPCID.ChaosBall))
                {
                    if (!GetInstance <ExpiryModeMod>().MagnetRange_IsInfinite)
                    {
                        if (npc.Distance(Main.MouseWorld) <= 120f)
                        {
                            if (player.direction == Math.Sign(npc.Center.X - player.Center.X))
                            {
                                if (npc.Distance(Main.MouseWorld) <= 80f)
                                {
                                    CombatText.NewText(npc.Hitbox, Color.LightBlue, "+", true, true);
                                }
                                float rotation = Utils.ToRotation(new Vector2(Main.mouseX + Main.screenPosition.X, Main.mouseY + Main.screenPosition.Y) - npc.position);
                                npc.velocity += Utils.ToRotationVector2(rotation);
                            }
                        }
                    }
                    else if (GetInstance <ExpiryModeMod>().MagnetRange_IsInfinite)
                    {
                        if (player.direction == Math.Sign(npc.Center.X - player.Center.X))
                        {
                            if (npc.Distance(Main.MouseWorld) <= 80f)
                            {
                                CombatText.NewText(npc.Hitbox, Color.LightBlue, "+", true, true);
                            }
                            float rotation = Utils.ToRotation(new Vector2(Main.mouseX + Main.screenPosition.X, Main.mouseY + Main.screenPosition.Y) - npc.position);
                            npc.velocity += Utils.ToRotationVector2(rotation);
                        }
                    }
                }
            }
        }
        public override void AI()
        {
            NPC fishron = FargoSoulsUtil.NPCExists(Projectile.ai[1], NPCID.DukeFishron);

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

            Projectile.Center = fishron.Center;

            if (Projectile.localAI[0] == 0f)
            {
                Projectile.localAI[0] = 1f;
                if (EModeGlobalNPC.fishBossEX != fishron.whoAmI)
                {
                    fishron.GetEModeNPCMod <DukeFishron>().IsEX = true;
                    fishron.GivenName   = "Duke Fishron EX";
                    fishron.defDamage   = (int)(fishron.defDamage * 1.5);
                    fishron.defDefense *= 2;
                    fishron.buffImmune[ModContent.BuffType <FlamesoftheUniverse>()] = true;
                    fishron.buffImmune[ModContent.BuffType <LightningRod>()]        = true;
                }
                Projectile.netUpdate = true;
            }

            if (Projectile.localAI[1] == 0f)
            {
                Projectile.alpha -= 17;
                if (fishron.ai[0] % 5 == 1f)
                {
                    Projectile.localAI[1] = 1f;
                }
            }
            else
            {
                Projectile.alpha += 9;
            }

            if (Projectile.alpha < 0)
            {
                Projectile.alpha = 0;
            }
            if (Projectile.alpha > 255)
            {
                if (fishron.ai[0] < 4f && Main.netMode == NetmodeID.Server) //ensure synchronized max life(?)
                {
                    var netMessage = Mod.GetPacket();
                    netMessage.Write((byte)FargowiltasSouls.PacketID.SyncFishronEXLife);
                    netMessage.Write((int)Projectile.ai[1]);
                    netMessage.Write((int)Projectile.ai[0] * 25);
                    netMessage.Send();
                }
                Projectile.Kill();
                return;
            }
            Projectile.scale     = 1f - Projectile.alpha / 255f;
            Projectile.rotation += (float)Math.PI / 70f;

            if (Projectile.alpha == 0)
            {
                for (int index1 = 0; index1 < 2; ++index1)
                {
                    float num   = Main.rand.Next(2, 4);
                    float scale = Projectile.scale * 0.6f;
                    if (index1 == 1)
                    {
                        scale *= 0.42f;
                        num   *= -0.75f;
                    }
                    Vector2 vector21 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));
                    vector21.Normalize();
                    int index21 = Dust.NewDust(Projectile.Center, 0, 0, 135, 0f, 0f, 100, new Color(), 2f);
                    Main.dust[index21].noGravity = true;
                    Main.dust[index21].noLight   = true;
                    Main.dust[index21].position += vector21 * 204f * scale;
                    Main.dust[index21].velocity  = vector21 * -num;
                    if (Main.rand.NextBool(8))
                    {
                        Main.dust[index21].velocity *= 2f;
                        Main.dust[index21].scale    += 0.5f;
                    }
                }
            }

            //while fishron is first spawning, has made the noise, and every 6 ticks
            if (fishron.ai[0] < 4f && Projectile.timeLeft <= 240 && Projectile.timeLeft >= 180)// && Projectile.timeLeft % 6 == 0)
            {
                fishron.GetGlobalNPC <FargoSoulsGlobalNPC>().MutantNibble = false;
                fishron.GetGlobalNPC <FargoSoulsGlobalNPC>().LifePrevious = int.MaxValue;
                while (fishron.buffType[0] != 0)
                {
                    fishron.DelBuff(0);
                }

                fishron.lifeMax = (int)Projectile.ai[0] * 5000; //10;
                if (fishron.lifeMax <= 0)
                {
                    fishron.lifeMax = int.MaxValue;
                }
                int heal = /*9*/ /*49*/ /*499999*/ (int)(fishron.lifeMax / 30 /*10*/ * Main.rand.NextFloat(1f, 1.1f));
                fishron.life += heal;
                if (fishron.life > fishron.lifeMax)
                {
                    fishron.life = fishron.lifeMax;
                }
                CombatText.NewText(fishron.Hitbox, CombatText.HealLife, heal);
                fishron.netUpdate = true;
            }

            int     num1    = (300 - Projectile.timeLeft) / 60;
            float   num2    = Projectile.scale * 0.4f;
            float   num3    = Main.rand.Next(1, 3);
            Vector2 vector2 = new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11));

            vector2.Normalize();
            int index2 = Dust.NewDust(Projectile.Center, 0, 0, 135, 0f, 0f, 100, new Color(), 2f);

            Main.dust[index2].noGravity = true;
            Main.dust[index2].noLight   = true;
            Main.dust[index2].velocity  = vector2 * num3;
            if (Main.rand.NextBool())
            {
                Main.dust[index2].velocity *= 2f;
                Main.dust[index2].scale    += 0.5f;
            }
            Main.dust[index2].fadeIn = 2f;

            Lighting.AddLight(Projectile.Center, 0.4f, 0.9f, 1.1f);
        }
示例#18
0
        public override void Update(Player player, SkillData rawdata)
        {
            AvariceData data = (AvariceData)rawdata;

            if (data.ChestX == 0)
            {
                data.ChestX = -1;
                data.ChestY = -1;
            }
            if (data.ChestX == -1 || data.ChestY == -1)
            {
                if (data.AvariceCooldown > 0)
                {
                    data.AvariceCooldown--;
                }
                else
                {
                    int PlayerX = (int)player.Center.X / 16, PlayerY = (int)player.Center.Y / 16;
                    for (int i = 0; i < data.Level; i++)
                    {
                        int CheckX = PlayerX + Main.rand.Next(-(20 + 2 * data.Level), 21 + 2 * data.Level), CheckY = PlayerY + Main.rand.Next(-(10 + data.Level), 11 + data.Level);
                        if (CheckX >= Main.leftWorld && CheckX + 1 < Main.rightWorld && CheckY >= Main.topWorld && CheckY + 1 < Main.bottomWorld && (Math.Abs(PlayerX - CheckX) >= 6 ||
                                                                                                                                                     Math.Abs(PlayerY - CheckY) >= 6))
                        {
                            Tile tile = Framing.GetTileSafely(CheckX, CheckY);
                            if (tile.active() && tile.type == Terraria.ID.TileID.Containers)
                            {
                                int  ChestPos   = Chest.FindChest(CheckX, CheckY);
                                bool ValidChest = ChestPos > -1 && ChestPos < Main.maxChests && Main.chest[ChestPos].item.Any(x => x.accessory || x.damage > 0 || x.value >= 10000);
                                if (tile.frameX >= 18)
                                {
                                    CheckX--;
                                }
                                if (tile.frameY % 36 >= 18)
                                {
                                    CheckY--;
                                }
                                if (ValidChest)
                                {
                                    data.ChestX = CheckX;
                                    data.ChestY = CheckY;
                                    if (player.whoAmI == Main.myPlayer)
                                    {
                                        CombatText.NewText(player.getRect(), Color.LightCyan, "Chest Nearby!", true);
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                int PlayerX = (int)player.Center.X / 16, PlayerY = (int)player.Center.Y / 16;
                if (Math.Abs(PlayerX - data.ChestX) >= 30 || Math.Abs(PlayerY - data.ChestY) >= 25 || player.chest == Chest.FindChest(data.ChestX, data.ChestY))
                {
                    data.ChestX          = data.ChestY = -1;
                    data.AvariceCooldown = 60 * 30;
                }
                else
                {
                    Lighting.AddLight((data.ChestX + 1), (data.ChestY + 1), 0.8f, 0.8f, 0.8f);
                }
            }
        }
        public override void AI()
        {
            Lighting.AddLight(npc.Center, new Vector3(1, 1, 0.8f));

            GlobalTimer++;                                    //tick our timer up constantly
            AttackTimer++;                                    //tick up our attack timer

            if (npc.ai[0] == (int)OvergrowBossPhase.Struggle) //when the boss is trapped before spawning the first time
            {
                if (spawnPoint == Vector2.Zero)
                {
                    spawnPoint = npc.Center; //sets the boss' home
                }
                npc.velocity.Y = (float)Math.Sin((GlobalTimer % 120) / 120f * 6.28f) * 0.6f;

                if (!Main.npc.Any(n => n.active && n.type == NPCType <OvergrowBossAnchor>())) //once the chains are broken
                {
                    npc.velocity *= 0;
                    npc.Center    = spawnPoint;
                    GlobalTimer   = 0;

                    StarlightPlayer mp = Main.LocalPlayer.GetModPlayer <StarlightPlayer>();
                    mp.ScreenMoveTime   = 860;
                    mp.ScreenMoveTarget = npc.Center;
                    mp.ScreenMovePan    = npc.Center + new Vector2(0, -100);

                    Phase = (int)OvergrowBossPhase.spawnAnimation;
                }
            }

            if (Phase == (int)OvergrowBossPhase.spawnAnimation) //the boss' spawn animation.
            {
                if (GlobalTimer == 1)
                {
                    music = mod.GetSoundSlot(SoundType.Music, "Sounds/Music/OvergrowBoss");
                }

                if (GlobalTimer <= 120)
                {
                    npc.position.Y--;
                }

                if (GlobalTimer == 120)
                {
                    StarlightWorld.Flag(WorldFlags.OvergrowBossFree);
                }

                if (GlobalTimer == 500)
                {
                    string message = "Faerie Guardian";
                    if (Main.rand.Next(10000) == 0)
                    {
                        message = "Titty Elongator"; // Yep
                    }
                    UILoader.GetUIState <TextCard>().Display("Eggshells", message, null, 220);
                }

                if (GlobalTimer >= 860)
                {
                    Phase = (int)OvergrowBossPhase.Setup;
                }
            }

            if (Phase == (int)OvergrowBossPhase.Setup)
            {
                npc.boss = true;

                int index = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCType <OvergrowBossFlail>()); //spawn the flail after intro
                (Main.npc[index].modNPC as OvergrowBossFlail).parent = this;                                 //set the flail's parent
                flail = Main.npc[index].modNPC as OvergrowBossFlail;                                         //tells the boss what flail it owns

                Phase       = (int)OvergrowBossPhase.FirstAttack;                                            //move on to the first attack phase
                GlobalTimer = 0;                                                                             //reset our timer
                npc.ai[3]   = 0;                                                                             //reset our attack timer
            }

            if (flail == null)
            {
                return;                                      //at this point, our boss should have her flail. if for some reason she dosent, this is a safety check
            }
            if (Phase == (int)OvergrowBossPhase.FirstAttack) //the first attacking phase
            {
                //attack pattern advancement logic
                if (AttackTimer == 1)
                {
                    RandomizeTarget();
                    if (AttackPhase == 1)
                    {
                        AttackPhase++;                   //tick up an additional time so that we dont use 2 alternate attacks in a row. TODO: Should make a cleaner way to do this.
                    }
                    AttackPhase++;
                    if (AttackPhase == 1 && Main.rand.Next(2) == 0)
                    {
                        AttackPhase++;
                    }
                    if (AttackPhase > 6)
                    {
                        AttackPhase = 0;
                    }

                    if (flail.npc.life <= 1) //move to next phase once the flail is depleated
                    {
                        Phase       = (int)OvergrowBossPhase.FirstToss;
                        AttackPhase = 0;
                        ResetAttack();
                        //foreach (Projectile proj in Main.projectile.Where(p => p.type == ProjectileType<Projectiles.Dummies.OvergrowBossPitDummy>())) proj.ai[1] = 1; //opens the pits
                    }
                }
                switch (AttackPhase) //attack pattern
                {
                case 0: Phase1Spin(); break;

                case 1: Phase1Bolts(); break;     //______randonly picks between these two

                case 2: Phase1Trap(); break;      //___|

                case 3: Phase1Toss(); break;

                case 4: Phase1Toss(); break;

                case 5: Phase1Bolts(); break;

                case 6: Phase1Toss(); break;
                }
            }

            if (Phase == (int)OvergrowBossPhase.FirstToss)
            {
                RapidToss();                                            //toss rapidly till thrown into a pit
            }
            if (Phase == (int)OvergrowBossPhase.Stun)
            {
                if (GlobalTimer == 1)
                {
                    npc.alpha = 255;

                    for (int k = 0; k < 100; k++)
                    {
                        Dust d = Dust.NewDustPerfect(npc.Center, 1 /*DustType<>()*/, Vector2.One.RotatedByRandom(Math.PI) * Main.rand.NextFloat(5));
                        d.customData = npc.Center;
                    }

                    npc.Center      = spawnPoint + new Vector2(0, 320);
                    flail.npc.ai[0] = 1;
                }

                if (GlobalTimer >= 120)
                {
                    npc.alpha = 0;
                    if (npc.Hitbox.Intersects(flail.npc.Hitbox))
                    {
                        flail.npc.ai[0]          = 0;
                        flail.npc.ai[3]          = 1;
                        flail.npc.velocity      *= 0;
                        flail.npc.life           = flail.npc.lifeMax;
                        flail.npc.dontTakeDamage = false;
                        flail.npc.friendly       = false;

                        npc.life -= 20000;
                        Phase     = (int)OvergrowBossPhase.SecondAttack;
                        ResetAttack();

                        CombatText.NewText(npc.Hitbox, Color.Red, 20000, true);
                        Main.PlaySound(SoundID.DD2_BetsyScream, npc.Center);
                        Main.LocalPlayer.GetModPlayer <StarlightPlayer>().Shake += 30;

                        for (int k = 0; k < 100; k++)
                        {
                            Dust d = Dust.NewDustPerfect(flail.npc.Center, DustType <Dusts.Stone>(), Vector2.One.RotatedByRandom(Math.PI) * Main.rand.NextFloat(5));
                        }
                    }
                }
            }
        }
示例#20
0
        public override void AI()
        {
            Player player = Main.player[npc.target];

            if (MonolithCounter > 600)
            {
                if (!NPC.AnyNPCs(mod.NPCType("MutationMonolith")))
                {
                    NPC.NewNPC((int)npc.position.X, (int)npc.position.Y + 50, mod.NPCType("MutationMonolith"));
                }
                if (Main.expertMode && Main.rand.Next(3) == 0)
                {
                    if (NPC.CountNPCS(mod.NPCType("CoreSentinel")) < 4)
                    {
                        NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("CoreSentinel"));
                    }
                }
                MonolithCounter = 0;
            }
            if (MovementCounter == 1)
            {
                randx = player.Center.X + Main.rand.Next(-500, 500);
                randy = player.Center.Y + Main.rand.Next(-500, -100);
            }
            if (MovementCounter < 40)
            {
                moveTo = new Vector2(randx, randy);
            }
            if (MovementCounter == 40)
            {
                randx = player.Center.X + Main.rand.Next(-100, 100);
                randy = player.Center.Y + Main.rand.Next(-250, -200);
            }
            if (MovementCounter > 40 && MovementCounter < 80)
            {
                moveTo = new Vector2(randx, randy);
            }
            if (MovementCounter == 80)
            {
                AttackChoice = Main.rand.Next(5);
            }
            if (MovementCounter > 80)
            {
                if (AttackChoice == 0) // Concentrated Beam
                {
                    if (MovementCounter > 80 && MovementCounter < 160)
                    {
                        pcent = player.Center;
                    }
                    if (MovementCounter > 80 && MovementCounter < 240)
                    {
                        Vector2 heading = pcent - npc.Center;
                        heading.Normalize();
                        heading *= new Vector2(30, 30).Length();
                        float speedX = heading.X;
                        float speedY = heading.Y;
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, speedX, speedY, mod.ProjectileType("WarningBeam"), 0, 0);
                        Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 28);
                    }
                    if (MovementCounter == 240)
                    {
                        Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 124);
                    }
                    if (MovementCounter > 240)
                    {
                        Vector2 heading = pcent - npc.Center;
                        heading.Normalize();
                        heading *= new Vector2(20, 20).Length();
                        float speedX = heading.X;
                        float speedY = heading.Y;
                        Projectile.NewProjectile(npc.Center.X + Main.rand.Next(-30, 30), npc.Center.Y + Main.rand.Next(-30, 30), speedX, speedY, mod.ProjectileType("Splitter"), Main.expertMode ? 35 : 48, 0);
                        Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 75);
                    }
                    if (MovementCounter == 300)
                    {
                        MovementCounter = 0;
                    }
                }
                else // Uneven Spread
                {
                    if (MovementCounter == 82)
                    {
                        spinrand = Main.rand.Next(360);
                        Spin     = spinrand;
                        for (int k = 0; k < 16; k++)
                        {
                            Spin += 15;                                                                                               // Rotation Variable
                            float   rotation       = MathHelper.ToRadians(Spin);                                                      // Set the actual rotation counts
                            Vector2 perturbedSpeed = new Vector2(180, 180).RotatedBy(MathHelper.Lerp(-rotation, rotation, 16)) * .2f; // Adjust the rotation on the projectile
                            Projectile.NewProjectile(npc.Center, perturbedSpeed, mod.ProjectileType("WarningBeam"), 30, 0);
                        }
                    }
                    if (MovementCounter == 190 && !Main.expertMode || MovementCounter == 160 && Main.expertMode)
                    {
                        Spin            = spinrand;
                        MovementCounter = 0;
                        for (int k = 0; k < 16; k++)
                        {
                            Spin += 15;                                                                                             // Rotation Variable
                            float   rotation       = MathHelper.ToRadians(Spin);                                                    // Set the actual rotation counts
                            Vector2 perturbedSpeed = new Vector2(80, 80).RotatedBy(MathHelper.Lerp(-rotation, rotation, 16)) * .2f; // Adjust the rotation on the projectile
                            Projectile.NewProjectile(npc.Center, perturbedSpeed, 438, Main.expertMode ? 13 : 20, 0);
                        }
                    }
                }
            }
            // Move time.
            float   speed     = 30f;
            Vector2 move      = moveTo - npc.Center;
            float   magnitude = (float)Math.Sqrt(move.X * move.X + move.Y * move.Y);

            if (magnitude > speed)
            {
                move *= speed / magnitude;
            }
            float turnResistance = 1f;

            move      = (npc.velocity * turnResistance + move) / (turnResistance + 1f);
            magnitude = (float)Math.Sqrt(move.X * move.X + move.Y * move.Y);
            if (magnitude > speed)
            {
                move *= speed / magnitude;
            }
            npc.velocity = move;

            // Increase counters + check for the monolith heal
            MovementCounter += 1;
            if (Main.expertMode)
            {
                MovementCounter += 1; // Does speeding through phases faster make something harder? Probably.
            }
            if (NPC.AnyNPCs(mod.NPCType("MutationMonolith")))
            {
                monolith += 1;
                if (monolith > 180)
                {
                    if (npc.life < npc.lifeMax - 50)
                    {
                        npc.life += 50;
                    }
                    CombatText.NewText(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height), new Color(0f, 255f, 0f), "50", false, false);
                    monolith = 0;
                }
                int dust = Dust.NewDust(npc.position, npc.width, npc.height, 6, 0f, 0f, 50, default(Color), 1f);
            }
            MonolithCounter += 1;
            npc.netUpdate    = true; // For a *tiny* bit of multiplayer compatibility.
        }
        private void ThoriumModifyNPC(NPC target, Item item, int damage, bool crit)
        {
            ThoriumPlayer thoriumPlayer = player.GetModPlayer <ThoriumPlayer>();

            if (FungusEnchant && !ThoriumSoul && Main.rand.Next(5) == 0)
            {
                target.AddBuff(thorium.BuffType("Mycelium"), 120);
            }

            if (TideTurnerEnchant)
            {
                //tide turner daggers
                if (SoulConfig.Instance.GetValue(SoulConfig.Instance.thoriumToggles.TideDaggers) && player.ownedProjectileCounts[thorium.ProjectileType("TideDagger")] < 24 && target.type != NPCID.TargetDummy && Main.rand.Next(5) == 0)
                {
                    FargoDLCGlobalProjectile.XWay(4, player.position, thorium.ProjectileType("TideDagger"), 3, (int)(item.damage * 0.75), 3);
                    Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 43, 1f, 0f);
                }
                //mini crits
                if (thoriumPlayer.tideOrb > 0 && !crit)
                {
                    float num  = 30f;
                    int   num2 = 0;
                    while ((float)num2 < num)
                    {
                        Vector2 vector = Vector2.UnitX * 0f;
                        vector += -Utils.RotatedBy(Vector2.UnitY, (double)((float)num2 * (6.28318548f / num)), default(Vector2)) * new Vector2(12f, 12f);
                        vector  = Utils.RotatedBy(vector, (double)Utils.ToRotation(target.velocity), default(Vector2));
                        int num3 = Dust.NewDust(target.Center, 0, 0, 176, 0f, 0f, 0, default(Color), 1f);
                        Main.dust[num3].scale     = 1.5f;
                        Main.dust[num3].noGravity = true;
                        Main.dust[num3].position  = target.Center + vector;
                        Main.dust[num3].velocity  = target.velocity * 0f + Utils.SafeNormalize(vector, Vector2.UnitY) * 1f;
                        int num4 = num2;
                        num2 = num4 + 1;
                    }
                    crit   = true;
                    damage = (int)((double)damage * 0.75);
                    thoriumPlayer.tideOrb--;
                }
            }

            if (AssassinEnchant)
            {
                //assassin duplicate damage
                if (SoulConfig.Instance.GetValue(SoulConfig.Instance.thoriumToggles.AssassinDamage) && Utils.NextFloat(Main.rand) < 0.1f)
                {
                    Main.PlaySound(SoundID.Item, (int)target.position.X, (int)target.position.Y, 92, 1f, 0f);
                    Projectile.NewProjectile((float)((int)target.Center.X), (float)((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("MeteorPlasmaDamage"), (int)((float)item.damage * 1.15f), 0f, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile((float)((int)target.Center.X), (float)((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("MeteorPlasma"), 0, 0f, Main.myPlayer, 0f, 0f);
                }
                //insta kill
                if (target.type != NPCID.TargetDummy && target.lifeMax < 100000 && Utils.NextFloat(Main.rand) < 0.05f)
                {
                    if ((target.boss || NPCID.Sets.BossHeadTextures[target.type] > -1) && target.life < target.lifeMax * 0.05)
                    {
                        CombatText.NewText(new Rectangle((int)target.position.X, (int)target.position.Y, target.width, target.height), new Color(135, 255, 45), "ERADICATED", false, false);
                        Projectile.NewProjectile(((int)target.Center.X), ((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("MeteorPlasmaDamage"), (int)(target.lifeMax * 1.25f), 0f, Main.myPlayer, 0f, 0f);
                        Projectile.NewProjectile(((int)target.Center.X), ((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("MeteorPlasma"), 0, 0f, Main.myPlayer, 0f, 0f);
                    }
                    else if (NPCID.Sets.BossHeadTextures[target.type] < 0)
                    {
                        CombatText.NewText(new Rectangle((int)target.position.X, (int)target.position.Y, target.width, target.height), new Color(135, 255, 45), "ERADICATED", false, false);
                        Projectile.NewProjectile(((int)target.Center.X), ((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("MeteorPlasmaDamage"), (int)(target.lifeMax * 1.25f), 0f, Main.myPlayer, 0f, 0f);
                        Projectile.NewProjectile(((int)target.Center.X), ((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("MeteorPlasma"), 0, 0f, Main.myPlayer, 0f, 0f);
                    }
                }
            }

            if (PyroEnchant)
            {
                //pyro
                target.AddBuff(24, 300, true);
                target.AddBuff(thorium.BuffType("Singed"), 300, true);

                if (SoulConfig.Instance.GetValue(SoulConfig.Instance.thoriumToggles.PyromancerBursts))
                {
                    Projectile.NewProjectile(((int)target.Center.X), ((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("PyroBurst"), 100, 1f, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(((int)target.Center.X), ((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("PyroExplosion2"), 0, 0f, Main.myPlayer, 0f, 0f);
                }
            }

            if (BronzeEnchant && SoulConfig.Instance.GetValue(SoulConfig.Instance.thoriumToggles.BronzeLightning) && Main.rand.Next(5) == 0)
            {
                target.immune[player.whoAmI] = 5;
                Projectile.NewProjectile(target.Center.X, target.Center.Y - 600f, 0f, 15f, thorium.ProjectileType("LightStrike"), (int)(item.damage / 4), 1f, player.whoAmI, 0f, 0f);
            }

            //malignant
            if (MalignantEnchant && crit)
            {
                target.AddBuff(24, 900, true);
                target.AddBuff(thorium.BuffType("lightCurse"), 900, true);
                for (int i = 0; i < 8; i++)
                {
                    int num5 = Dust.NewDust(target.position, target.width, target.height, 127, (float)Main.rand.Next(-6, 6), (float)Main.rand.Next(-10, 10), 0, default(Color), 1.2f);
                    Main.dust[num5].noGravity = true;
                }
                for (int j = 0; j < 8; j++)
                {
                    int num6 = Dust.NewDust(target.position, target.width, target.height, 65, (float)Main.rand.Next(-6, 6), (float)Main.rand.Next(-10, 10), 0, default(Color), 1.2f);
                    Main.dust[num6].noGravity = true;
                }
            }

            //white dwarf
            if (WhiteDwarfEnchant && SoulConfig.Instance.GetValue(SoulConfig.Instance.thoriumToggles.WhiteDwarf) && crit)
            {
                Main.PlaySound(SoundID.Item, (int)target.position.X, (int)target.position.Y, 92, 1f, 0f);
                Projectile.NewProjectile((float)((int)target.Center.X), (float)((int)target.Center.Y), 0f, 0f, thorium.ProjectileType("WhiteFlare"), (int)((float)target.lifeMax * 0.001f), 0f, Main.myPlayer, 0f, 0f);
            }

            //yew wood
            if (YewEnchant && SoulConfig.Instance.GetValue(SoulConfig.Instance.thoriumToggles.YewCrits) && !crit)
            {
                thoriumPlayer.yewChargeTimer = 120;
                if (player.ownedProjectileCounts[thorium.ProjectileType("YewVisual")] < 1)
                {
                    Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, thorium.ProjectileType("YewVisual"), 0, 0f, player.whoAmI, 0f, 0f);
                }
                if (thoriumPlayer.yewCharge < 4)
                {
                    thoriumPlayer.yewCharge++;
                }
                else
                {
                    crit   = true;
                    damage = (int)((double)damage * 0.75);
                    thoriumPlayer.yewCharge = 0;
                }
            }

            if (CryoEnchant && SoulConfig.Instance.GetValue(SoulConfig.Instance.thoriumToggles.CryoDamage))
            {
                target.AddBuff(ModContent.BuffType <EnemyFrozen>(), 120, false);
                Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType <ReactionNitrogen>(), 0, 0f, Main.myPlayer, 0f, 0f);
            }

            if (WarlockEnchant && SoulConfig.Instance.GetValue(SoulConfig.Instance.thoriumToggles.WarlockWisps))
            {
                //warlock
                if (crit && player.ownedProjectileCounts[thorium.ProjectileType("ShadowWisp")] < 15)
                {
                    Projectile.NewProjectile((float)((int)target.Center.X), (float)((int)target.Center.Y), 0f, -2f, thorium.ProjectileType("ShadowWisp"), (int)((float)item.damage * 0.75f), 0f, Main.myPlayer, 0f, 0f);
                }
            }
        }
示例#22
0
        public override void AI()
        {
            AzercadmiumGlobalNPC.titanBoss = npc.whoAmI;
            if (AzercadmiumWorld.devastation)
            {
                difficultyBonus = 60;
            }
            else if (Main.expertMode)
            {
                difficultyBonus = 30;
            }
            else
            {
                difficultyBonus = 0;
            }
            Timer++;
            npc.TargetClosest(true);
            if (movement)
            {
                npc.velocity = Vector2.Normalize(npc.Center - Main.player[npc.target].Center) * -moveSpeed;
            }
            target = Main.player[npc.target];

            if (Main.player[npc.target].statLife < 1)
            {
                npc.TargetClosest(true);
                if (Main.player[npc.target].statLife < 1)
                {
                    if (flee == 0)
                    {
                        flee++;
                    }
                }
                else
                {
                    flee = 0;
                }
            }
            if (flee >= 1)
            {
                flee++;
                npc.noTileCollide = true;
                npc.velocity.Y    = -10f;
                if (flee >= 450)
                {
                    npc.active = false;
                }
            }
            if (Timer % 6 == 0)
            {
                animationTimer++;
            }
            if (animationTimer > 3)
            {
                animationTimer = 0;
            }
            if (!spawnPortals && npc.life < npc.lifeMax * 0.5f)
            {
                npc.frame.Y = animationTimer * 124 + 496;
            }
            else
            {
                npc.frame.Y = animationTimer * 124;
            }

            npc.rotation = npc.velocity.X * 0.05f;

            if (!spawnPortals && npc.life < npc.lifeMax * 0.5f)
            {
                if (canAttack == true)
                {
                    attackTimer = 0;
                }
                movement           = false;
                attackDone         = true;
                canAttack          = false;
                npc.velocity      /= 2;
                npc.dontTakeDamage = true;
                if (attackTimer == 0)
                {
                    npc.defense = 40;
                    CombatText.NewText(npc.getRect(), Color.LightGray, "Activating clones...");
                }
                attackTimer++;
                Lighting.AddLight(npc.Center, new Vector3(87, 0, 236));
                if (attackTimer == 120)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 40, ModContent.NPCType <TitanClone>(), 0, i);
                    }
                }
                if (attackTimer == 150)
                {
                    movement           = true;
                    canAttack          = true;
                    attackDone         = true;
                    spawnPortals       = true;
                    npc.dontTakeDamage = false;
                }
            }

            if (attackDone && canAttack)
            {
                attackTimer = 0;
                attackDone  = false;
                int attackMax = 5;
                if (npc.life < npc.lifeMax * 0.75f)
                {
                    attackMax = 6;
                }
                if (npc.life < npc.lifeMax * 0.5f)
                {
                    attackMax = 8;
                }
                if (npc.life < npc.lifeMax * 0.25f)
                {
                    attackMax = 9;
                }
                while (attack == oldAttack)
                {
                    attack = Main.rand.Next(0, attackMax);
                }
                if (attack == 5)
                {
                    attackRand = Main.rand.Next(2, 7);
                }
                rotation  = 0;
                oldAttack = attack;
            }
            if (attack == 0 && canAttack)
            {
                attackTimer++;
                if (attackTimer < 15)
                {
                    npc.velocity /= 2;
                    //movement = false;
                }
                //else if (attack > 29) movement = true;
                if (attackTimer == 15)
                {
                    if (npc.life < npc.lifeMax * 0.5f)
                    {
                        for (int i = 0; i < 12; i++)
                        {
                            Projectile.NewProjectile(npc.Center, new Vector2(0, 6).RotatedBy(Math.PI * 0.1666666 * i), ModContent.ProjectileType <TitanBlast>(), 23, 0f, Main.myPlayer);
                        }
                    }
                    else
                    {
                        for (int i = 0; i < 8; i++)
                        {
                            Projectile.NewProjectile(npc.Center, new Vector2(0, 6).RotatedBy(Math.PI * 0.25 * i), ModContent.ProjectileType <TitanBlast>(), 23, 0f, Main.myPlayer);
                        }
                    }
                }
                if (attackTimer == 150)                 //90
                {
                    attackDone = true;
                }
            }
            if (attack == 1 && canAttack)
            {
                if (attackTimer == 0)
                {
                    Projectile.NewProjectile(new Vector2(npc.Center.X - 200, npc.Center.Y), new Vector2(0, 0), mod.ProjectileType("TitaniumSwordHostile"), 37, 0f, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(new Vector2(npc.Center.X + 200, npc.Center.Y), new Vector2(0, 0), mod.ProjectileType("TitaniumSwordHostile"), 37, 0f, Main.myPlayer, 0f, 0f);
                }
                if (attackTimer == 90)
                {
                    Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y - 200), new Vector2(0, 0), mod.ProjectileType("TitaniumSwordHostile"), 37, 0f, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y + 200), new Vector2(0, 0), mod.ProjectileType("TitaniumSwordHostile"), 37, 0f, Main.myPlayer, 0f, 0f);
                }
                if (attackTimer == 180)
                {
                    Projectile.NewProjectile(new Vector2(npc.Center.X - 200, npc.Center.Y), new Vector2(0, 0), mod.ProjectileType("TitaniumSwordHostile"), 37, 0f, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(new Vector2(npc.Center.X + 200, npc.Center.Y), new Vector2(0, 0), mod.ProjectileType("TitaniumSwordHostile"), 37, 0f, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y - 200), new Vector2(0, 0), mod.ProjectileType("TitaniumSwordHostile"), 37, 0f, Main.myPlayer, 0f, 0f);
                    Projectile.NewProjectile(new Vector2(npc.Center.X, npc.Center.Y + 200), new Vector2(0, 0), mod.ProjectileType("TitaniumSwordHostile"), 37, 0f, Main.myPlayer, 0f, 0f);
                }
                attackTimer++;
                if (attackTimer >= 300)                 //240
                {
                    attackDone = true;
                }
            }
            if (attack == 2 && canAttack)
            {
                movement = false;
                attackTimer++;
                if (attackTimer % 100 == 1)
                {
                    float   num320   = 9f;
                    Vector2 vector36 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
                    num321 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector36.X;
                    num322 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector36.Y;
                    float num323 = (float)Math.Sqrt((double)(num321 * num321 + num322 * num322));
                    num323         = num320 / num323;
                    num321        *= num323;
                    num322        *= num323;
                    npc.velocity.X = num321 * 1.75f;
                    npc.velocity.Y = num322 * 1.75f;                     //4
                }
                if (attackTimer % 100 < 60)
                {
                    npc.velocity.X = num321 * 1.75f;                     //4
                    npc.velocity.Y = num322 * 1.75f;                     //4
                }
                else
                {
                    movement = true;
                }
                if (attackTimer % 20 == 0)
                {
                    Projectile.NewProjectile(npc.Center, new Vector2(0, 0), ModContent.ProjectileType <TitanMine>(), 25, 0f, Main.myPlayer);
                }
                if ((attackTimer >= 100 && npc.life > npc.lifeMax * 0.5f) || attackTimer >= 300)
                {
                    movement   = true;
                    attackDone = true;
                }
            }
            if (attack == 3 && canAttack)
            {
                attackTimer++;
                if (attackTimer == 1 && !(NPC.CountNPCS(ModContent.NPCType <TitanTracker>()) > 15))
                {
                    for (int i = 0; i < 3; i++)
                    {
                        NPC.NewNPC((int)npc.Center.X + (i - 1) * 40, (int)npc.Center.Y + (i - 1) * 40, ModContent.NPCType <TitanTracker>());
                    }
                }
                if (attackTimer >= 120 || NPC.CountNPCS(ModContent.NPCType <TitanTracker>()) > 15)                //60
                {
                    attackDone = true;
                }
            }
            if (attack == 4 && canAttack)
            {
                attackTimer++;
                float   num291   = 10f;             //7f
                Vector2 vector33 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
                float   num292   = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector33.X;
                float   num293   = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector33.Y;
                float   num294   = (float)Math.Sqrt((double)(num292 * num292 + num293 * num293));
                num294  = num291 / num294;
                num292 *= num294;
                num293 *= num294;
                Vector2 velocity = new Vector2(num292, num293);
                if (attackTimer == 1)
                {
                    Main.PlaySound(SoundID.Item12);
                    if (npc.life < npc.lifeMax * 0.5f)
                    {
                        for (int i = -30; i <= 30; i += 5)
                        {
                            Vector2 velocity2 = velocity.RotatedBy(i * 2 / Math.PI);
                            Projectile.NewProjectile(vector33.X, vector33.Y, velocity2.X, velocity2.Y, ModContent.ProjectileType <TitanEnergyBeam>(), 29, 0f, Main.myPlayer);
                        }
                    }
                    else
                    {
                        for (int i = -20; i <= 20; i += 5)
                        {
                            Vector2 velocity2 = velocity.RotatedBy(i * 2 / Math.PI);
                            Projectile.NewProjectile(vector33.X, vector33.Y, velocity2.X, velocity2.Y, ModContent.ProjectileType <TitanEnergyBeam>(), 29, 0f, Main.myPlayer);
                        }
                    }
                }
                if (attackTimer > 120)
                {
                    attackDone = true;
                }
            }
            if (attack == 5 && canAttack)
            {
                attackTimer++;
                int num = 5;
                if (npc.life < npc.lifeMax * 0.75f)
                {
                    num = 6;
                }
                if (npc.life < npc.lifeMax * 0.5f)
                {
                    num = 8;
                }
                if (npc.life < npc.lifeMax * 0.25f)
                {
                    num = 10;
                }
                if (npc.life < npc.lifeMax * 0.125f)
                {
                    num = 12;
                }
                if (Main.expertMode)
                {
                    num += 2;
                }
                if (AzercadmiumWorld.devastation)
                {
                    num += 2;
                }
                if (attackTimer % 60 == 1)
                {
                    for (int i = 0; i < num; i++)
                    {
                        Projectile.NewProjectile(npc.Center, new Vector2(0, 2).RotatedBy(Math.PI * Main.rand.NextFloat(0, 3) * i), ModContent.ProjectileType <TitanShard>(), 23, 0f, Main.myPlayer);
                    }
                }
                if (attackTimer == attackRand * 60)
                {
                    attackDone = true;
                }
            }
            if (attack == 6 && canAttack)
            {
                attackTimer++;
                float   num291   = 10f;             //7f
                Vector2 vector33 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
                float   num292   = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector33.X;
                float   num293   = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector33.Y;
                float   num294   = (float)Math.Sqrt((double)(num292 * num292 + num293 * num293));
                num294  = num291 / num294;
                num292 *= num294;
                num293 *= num294;
                Vector2 velocity = new Vector2(num292, num293);
                int     maxShots = 8;
                if (npc.life < npc.lifeMax * 0.5f)
                {
                    maxShots = 10;
                }
                if (npc.life < npc.lifeMax * 0.25f)
                {
                    maxShots = 12;
                }
                if (npc.life < npc.lifeMax * 0.125f)
                {
                    maxShots = 14;
                }
                if (attackTimer == 1)
                {
                    if (npc.life < npc.lifeMax * 0.5f)
                    {
                        for (int i = 0; i <= maxShots; i += 1)
                        {
                            Vector2 velocity2 = velocity.RotatedBy(Main.rand.Next(-30, 31) * Math.PI / 180);
                            Projectile.NewProjectile(vector33.X, vector33.Y, velocity2.X * 0.6f, velocity2.Y * 0.6f, ModContent.ProjectileType <TitanBlast>(), 29, 0f, Main.myPlayer);
                        }
                    }
                }
                if (attackTimer > 120)
                {
                    attackDone = true;
                }
            }
            if (attack == 7 && canAttack)
            {
                attackTimer++;
                if (attackTimer < 15)
                {
                    npc.velocity /= 2;
                    movement      = false;
                }
                if (attackTimer == 60)
                {
                    Projectile.NewProjectile(new Vector2(npc.Center.X + 12, npc.Center.Y - 20), new Vector2(0, 3).RotatedBy(rotation * Math.PI / 180), ModContent.ProjectileType <TitanShard>(), 36, 0f, Main.myPlayer);
                    rotation   += 20;
                    attackTimer = 56;
                    if (rotation == 380)
                    {
                        rotation    = 10;
                        attackTimer = 0;
                    }
                    if (rotation >= 380)
                    {
                        attackTimer = 61;
                    }
                }
                if (attackTimer == 120)
                {
                    attackDone = true;
                    movement   = true;
                }
            }
            if (attack == 8 && canAttack)
            {
                attackTimer++;
                if (attackTimer < 45)
                {
                    npc.velocity /= 2;
                    movement      = false;
                }
                float   num291   = 2f;             //7f
                Vector2 vector33 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f);
                float   num292   = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector33.X;
                float   num293   = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - vector33.Y;
                float   num294   = (float)Math.Sqrt((double)(num292 * num292 + num293 * num293));
                num294  = num291 / num294;
                num292 *= num294;
                num293 *= num294;
                Vector2 velocity = new Vector2(num292, num293);
                if (attackTimer % 5 == 0 && attackTimer <= 280)
                {
                    Projectile.NewProjectile(vector33.X, vector33.Y, velocity.X, velocity.Y, ModContent.ProjectileType <TitanShard>(), 32, 0f, Main.myPlayer);
                }
                if (attackTimer == 300)
                {
                    attackDone = true;
                    movement   = true;
                }
            }
        }
示例#23
0
 public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
 {
     type = mod.ProjectileType("Gyrojet_Torgue");
     for (int index = 0; index < 58; ++index)
     {
         if (player.inventory[index].ammo == item.useAmmo && player.inventory[index].stack > 1)
         {
             player.inventory[index].stack -= 1;
             break;
         }
     }
     {
         Vector2 muzzleOffset = Vector2.Normalize(new Vector2(speedX, speedY - 2)) * 38f;
         if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0))
         {
             position += muzzleOffset;
         }
         float  spread      = MathHelper.ToRadians(4f); //45 degrees converted to radians
         float  baseSpeed   = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
         double baseAngle   = Math.Atan2(speedX, speedY);
         double randomAngle = baseAngle + (Main.rand.NextFloat() - 0.5f) * spread;
         speedX = baseSpeed * (float)Math.Sin(randomAngle);
         speedY = baseSpeed * (float)Math.Cos(randomAngle);
         if (magazine <= 0)
         {
             for (int index1 = 0; index1 < 200; index1++)
             {
                 if (Main.projectile[index1].active && Main.projectile[index1].type == mod.ProjectileType("Gyrojet_Torgue"))
                 {
                     Main.projectile[index1].Kill();
                 }
             }
         }
         if (magazine <= 0)
         {
             Main.PlaySound(SoundLoader.customSoundType, player.position, mod.GetSoundSlot(SoundType.Custom, "Sounds/Reload"));
             magazine = maxBullets;
             Main.PlaySound(new Terraria.Audio.LegacySoundStyle(2, 1));
             CombatText.NewText(new Rectangle((int)player.position.X, (int)player.position.Y - 10, player.width, player.height), new Color(255, 255, 255, 100),
                                "Reloading!");
             for (int index1 = 0; index1 < 5; ++index1)
             {
                 int index2 = Dust.NewDust(player.position, player.width, player.height, 263, 0.0f, 0.0f, (int)byte.MaxValue, new Color(), (float)GloriousGuns.instance.gloriousRNG.Next(20, 26) * 0.1f);
                 Main.dust[index2].noLight   = true;
                 Main.dust[index2].noGravity = true;
                 Main.dust[index2].velocity *= 0.5f;
                 Main.dust[index2].scale    *= .6f;
             }
             item.reuseDelay = 120;
         }
         else
         {
             item.noUseGraphic = false;
             item.useStyle     = 5;
             item.reuseDelay   = 0;
         }
         magazine--;
         int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI);
         Main.projectile[proj].GetGlobalProjectile <GloriousGunsGProj>().shotFromShockWeaponCommon = true;
         for (int index1 = 0; index1 < 5; ++index1)
         {
             int index2 = Dust.NewDust(position, item.width - 66, item.height - 22, 127, 0.0f, 0.0f, (int)byte.MaxValue, new Color(), (float)GloriousGuns.instance.gloriousRNG.Next(20, 26) * 0.1f);
             Main.dust[index2].noLight   = true;
             Main.dust[index2].noGravity = true;
             Main.dust[index2].velocity *= 0.5f;
             Main.dust[index2].scale    *= .6f;
         }
     }
     return(false);
 }
示例#24
0
        public override void AI()
        {
            if (npc.localAI[3] == 0) //just spawned
            {
                npc.TargetClosest(false);
                Movement(Main.player[npc.target].Center, 0.8f, 32f);
                if (npc.Distance(Main.player[npc.target].Center) < 1500)
                {
                    npc.localAI[3] = 1;
                }
                else
                {
                    return;
                }

                if (Main.netMode != NetmodeID.MultiplayerClient)
                {
                    int n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <EarthChampionHand>(), npc.whoAmI, 0, 0, npc.whoAmI, 1);
                    if (n < Main.maxNPCs)
                    {
                        Main.npc[n].velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(32f);
                        if (Main.netMode == NetmodeID.Server)
                        {
                            NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                        }
                    }

                    n = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <EarthChampionHand>(), npc.whoAmI, 0, 0, npc.whoAmI, -1);
                    if (n < Main.maxNPCs)
                    {
                        Main.npc[n].velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(32f);
                        if (Main.netMode == NetmodeID.Server)
                        {
                            NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, n);
                        }
                    }
                }
            }

            EModeGlobalNPC.championBoss = npc.whoAmI;

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

            if (npc.HasValidTarget && npc.Distance(player.Center) < 2500 && player.ZoneUnderworldHeight)
            {
                npc.timeLeft = 600;
            }

            npc.dontTakeDamage = false;

            switch ((int)npc.ai[0])
            {
            case -1:
                npc.localAI[2] = 1;

                //npc.dontTakeDamage = true;
                npc.ai[1]++;

                npc.velocity *= 0.95f;

                /*if (npc.ai[1] < 120)
                 * {
                 *  targetPos = player.Center;
                 *  targetPos.Y -= 375;
                 *  if (npc.Distance(targetPos) > 50)
                 *      Movement(targetPos, 0.6f, 24f, true);
                 * }
                 * else*/
                if (npc.ai[1] == 120)     //begin healing
                {
                    Main.PlaySound(SoundID.NPCDeath10, npc.Center);

                    const int num226 = 80;
                    for (int num227 = 0; num227 < num226; num227++)
                    {
                        Vector2 vector6 = Vector2.UnitX * 40f;
                        vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + npc.Center;
                        Vector2 vector7 = vector6 - npc.Center;
                        int     num228  = Dust.NewDust(vector6 + vector7, 0, 0, 174, 0f, 0f, 0, default(Color), 3f);
                        Main.dust[num228].noGravity = true;
                        Main.dust[num228].velocity  = vector7;
                    }
                }
                else if (npc.ai[1] > 120)     //healing
                {
                    npc.velocity *= 0.9f;

                    int heal = (int)(npc.lifeMax / 2 / 120 * Main.rand.NextFloat(1f, 1.5f));
                    npc.life += heal;
                    if (npc.life > npc.lifeMax)
                    {
                        npc.life = npc.lifeMax;
                    }
                    CombatText.NewText(npc.Hitbox, CombatText.HealLife, heal);

                    for (int i = 0; i < 5; i++)
                    {
                        int d = Dust.NewDust(npc.Center, 0, 0, 174, 0f, 0f, 0, default(Color), 1.5f);
                        Main.dust[d].noGravity = true;
                        Main.dust[d].velocity *= 8f;
                    }

                    if (npc.ai[1] > 240)
                    {
                        npc.ai[0]++;
                        npc.ai[1]     = 0;
                        npc.ai[2]     = 0;
                        npc.netUpdate = true;
                    }
                }
                break;

            case 0:                               //float over player
                if (!player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 2500f ||
                    !player.ZoneUnderworldHeight) //despawn code
                {
                    npc.TargetClosest(false);
                    if (npc.timeLeft > 30)
                    {
                        npc.timeLeft = 30;
                    }

                    npc.noTileCollide = true;
                    npc.noGravity     = true;
                    npc.velocity.Y   += 1f;

                    return;
                }
                else
                {
                    targetPos    = player.Center;
                    targetPos.Y -= 325;
                    if (npc.Distance(targetPos) > 50)
                    {
                        Movement(targetPos, 0.4f, 24f, true);
                    }
                }

                if (npc.localAI[2] == 0 && npc.life < npc.lifeMax / 2)
                {
                    npc.ai[0] = -1;
                    npc.ai[1] = 0;
                    npc.ai[2] = 0;
                    npc.ai[3] = 0;

                    for (int i = 0; i < Main.maxNPCs; i++)     //find hands, update
                    {
                        if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType <EarthChampionHand>() && Main.npc[i].ai[2] == npc.whoAmI)
                        {
                            Main.npc[i].ai[0]      = -1;
                            Main.npc[i].ai[1]      = 0;
                            Main.npc[i].localAI[0] = 0;
                            Main.npc[i].localAI[1] = 0;
                            Main.npc[i].netUpdate  = true;
                        }
                    }
                }
                break;

            case 1:                               //fireballs
                if (!player.active || player.dead || Vector2.Distance(npc.Center, player.Center) > 2500f ||
                    !player.ZoneUnderworldHeight) //despawn code
                {
                    npc.TargetClosest(false);
                    if (npc.timeLeft > 30)
                    {
                        npc.timeLeft = 30;
                    }

                    npc.noTileCollide = true;
                    npc.noGravity     = true;
                    npc.velocity.Y   += 1f;

                    return;
                }
                else
                {
                    targetPos = player.Center;
                    for (int i = 0; i < 22; i++)     //collision check above player's head
                    {
                        targetPos.Y -= 16;
                        Tile tile = Framing.GetTileSafely(targetPos);     //if solid, stay below it
                        if (tile.active() && !tile.inActive() && Main.tileSolid[tile.type] && !Main.tileSolidTop[tile.type])
                        {
                            targetPos.Y += 50 + 16;
                            break;
                        }
                    }
                    if (npc.Distance(targetPos) > 50)
                    {
                        Movement(targetPos, 0.2f, 24f, true);
                    }

                    if (++npc.ai[2] > 75)
                    {
                        npc.ai[2] = 0;
                        if (Main.netMode != NetmodeID.MultiplayerClient)     //shoot spread of fireballs
                        {
                            for (int i = -1; i <= 1; i++)
                            {
                                Projectile.NewProjectile(npc.Center + Vector2.UnitY * 60,
                                                         (npc.localAI[2] == 1 ? 12 : 8) * npc.DirectionTo(player.Center).RotatedBy(MathHelper.ToRadians(8 * i)),
                                                         ProjectileID.Fireball, npc.damage / 4, 0f, Main.myPlayer);
                            }
                        }
                    }

                    if (++npc.ai[1] > 480)
                    {
                        npc.ai[0]++;
                        npc.ai[1]     = 0;
                        npc.netUpdate = true;
                    }
                }

                if (npc.localAI[2] == 0 && npc.life < npc.lifeMax / 2)
                {
                    npc.ai[0] = -1;
                    npc.ai[1] = 0;
                    npc.ai[2] = 0;
                    npc.ai[3] = 0;

                    for (int i = 0; i < Main.maxNPCs; i++)     //find hands, update
                    {
                        if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType <EarthChampionHand>() && Main.npc[i].ai[2] == npc.whoAmI)
                        {
                            Main.npc[i].ai[0]      = -1;
                            Main.npc[i].ai[1]      = 0;
                            Main.npc[i].localAI[0] = 0;
                            Main.npc[i].localAI[1] = 0;
                            Main.npc[i].netUpdate  = true;
                        }
                    }
                }
                break;

            default:
                npc.ai[0] = 0;
                goto case 0;
            }
        }
示例#25
0
        public override void Update(Player player, SkillData rawdata)
        {
            SoulRageData data = (SoulRageData)rawdata;

            if (rawdata.Step == 0 && rawdata.Time == 0)
            {
                Vector2 CheckPosition = GetMousePositionInTheWorld;
                data.targets.Clear();
                const float Distance   = 300f;
                int         MaxTargets = 3 + data.Level / 3;
                TargetTranslator.Translator[] Targets = rawdata.GetPossibleTargets(false).ToArray();
                foreach (TargetTranslator.Translator target in Targets)
                {
                    float MyDistance = (target.Center - CheckPosition).Length();
                    if (MyDistance < Distance)
                    {
                        data.targets.Add(new SoulRageData.Victim()
                        {
                            Target = target
                        });
                        if (data.targets.Count >= MaxTargets)
                        {
                            break;
                        }
                    }
                }

                /*foreach (TargetTranslator.Translator target in Targets)
                 * {
                 *  data.targets.Add(new SoulRageData.Victim() { Target = target });
                 * }*/
                if (data.targets.Count == 0)
                {
                    rawdata.EndUse(true);
                    CombatText.NewText(player.getRect(), Color.Red, "No Target near the mouse.");
                    return;
                }
            }
            const int   ShotDelay = 15;
            const float ShotSpeed = 0.9f;
            int         ShotCount = 1 + data.Level / 2;

            if (data.Time >= ShotDelay)
            {
                if (data.Step < ShotCount)
                {
                    foreach (SoulRageData.Victim victim in data.targets)
                    {
                        if (victim.Target == null)
                        {
                            continue;
                        }
                        Vector2 SpawnPosition = player.Center;
                        Vector2 ShotDirection = new Vector2(-30 * player.direction, (data.Step - (ShotCount * 0.5f)) * 20);
                        //ShotDirection.Normalize();
                        SoulShotInfo Shot = new SoulShotInfo()
                        {
                            Position = SpawnPosition, Velocity = ShotDirection
                        };
                        victim.SoulsPosition.Add(Shot);
                        //Projectile proj = Projectile.NewProjectileDirect(SpawnPosition, ShotDirection * ShotSpeed, 297, data.GetMagicDamage(0, 1.2f + 0.22f * data.Level, player), 4f, player.whoAmI);
                        //proj.tileCollide = false;
                    }
                }
                data.ChangeStep();
            }
            bool HasSoulActive = false;

            foreach (SoulRageData.Victim victim in data.targets)
            {
                if (victim.Target != null && (!victim.Target.IsActive() || victim.Target.IsDead()))
                {
                    victim.Target = null;
                }
                for (int s = 0; s < victim.SoulsPosition.Count; s++)
                {
                    SoulShotInfo shot          = victim.SoulsPosition[s];
                    Vector2      MoveDirection = Vector2.Zero;
                    shot.Velocity *= 0.9f;
                    if (victim.Target != null)
                    {
                        MoveDirection = (victim.Target.Center + victim.Target.Velocity) - shot.Position;
                    }
                    MoveDirection.Normalize();
                    shot.Velocity += MoveDirection * ShotSpeed;
                    if (shot.Velocity.Length() > 12)
                    {
                        shot.Velocity.Normalize();
                        shot.Velocity *= 12;
                    }
                    if (victim.Target != null && (victim.Target.Center - shot.Position).Length() < shot.Velocity.Length() * 2)
                    {
                        if (data.HurtTarget(victim.Target, data.GetMagicDamage(0, 1.2f + 0.22f * data.Level, player), player.Center.X < victim.Target.Center.X ? 1 : -1, 4f, 4) != 0)
                        {
                            victim.SoulsPosition.RemoveAt(s);
                        }
                    }
                    else
                    {
                        shot.Position += shot.Velocity;
                        shot.LifeTime++;
                        if (shot.LifeTime >= 210)
                        {
                            victim.SoulsPosition.RemoveAt(s);
                        }
                        else
                        {
                            HasSoulActive = true;
                            if (shot.SoulFade <= 4)
                            {
                                shot.SoulFade++;
                            }
                            else
                            {
                                for (int effect = 0; effect < 5; effect++)
                                {
                                    int dustid = Dust.NewDust(shot.Position, 8, 8, 175, 0f, 0f, 100, default(Color), 2f);
                                    Main.dust[dustid].noGravity = true;
                                    Dust dust = Main.dust[dustid];
                                    dust.velocity *= 0f;
                                }
                            }
                        }
                    }
                }
            }
            if (data.Step > 0 && !HasSoulActive)
            {
                data.EndUse();
            }
        }
示例#26
0
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Vector2 origVect = new Vector2(speedX, speedY);

            SMGBullets--;
            Vector2 muzzleOffset = Vector2.Normalize(new Vector2(speedX, speedY - 2)) * 38f;

            if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0))
            {
                position += muzzleOffset;
            }
            float  spread      = MathHelper.ToRadians(23f);       //45 degrees converted to radians
            float  baseSpeed   = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
            double baseAngle   = Math.Atan2(speedX, speedY);
            double randomAngle = baseAngle + (Main.rand.NextFloat() - 0.5f) * spread;

            speedX = baseSpeed * (float)Math.Sin(randomAngle);
            speedY = baseSpeed * (float)Math.Cos(randomAngle);
            int projectileSlagd = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI);

            Main.projectile[projectileSlagd].GetGlobalProjectile <GloriousGunsGProj>().shotFromSlagWeaponCommon = true;
            if (SMGBullets == 1)
            {
                CombatText.NewText(new Rectangle((int)player.position.X, (int)player.position.Y - 20, player.width, player.height), new Color(255, 255, 255, 100),
                                   "Reloading!");
                Main.PlaySound(SoundLoader.customSoundType, player.position, mod.GetSoundSlot(SoundType.Custom, "Sounds/Reload"));
                item.reuseDelay = 90;
            }
            else
            {
                item.reuseDelay = 0;
            }
            if (SMGBullets <= 1)
            {
                SMGBullets = SMGBulletsMax;
            }
            if (Main.mouseRight)
            {
                if (SMGBullets > 3)
                {
                    SMGBullets--;
                }
                for (int index = 0; index < 58; ++index)
                {
                    if (player.inventory[index].ammo == item.useAmmo && player.inventory[index].stack > 1)
                    {
                        player.inventory[index].stack -= 1;
                        break;
                    }
                }
                Main.PlaySound(new Terraria.Audio.LegacySoundStyle(2, 11));
                if (Main.rand.Next(2) == 1)
                {
                    newVect = origVect.RotatedBy(System.Math.PI / (Main.rand.Next(82, 400) / 14));
                }
                else
                {
                    newVect = origVect.RotatedBy(-System.Math.PI / (Main.rand.Next(82, 400) / 14));
                }
                int        proj2    = Projectile.NewProjectile(position.X, position.Y, newVect.X, newVect.Y, type, damage, 0, player.whoAmI);
                Projectile newProj2 = Main.projectile[proj2];
                Main.projectile[proj2].GetGlobalProjectile <GloriousGunsGProj>().shotFromSlagWeaponCommon = true;
            }
            return(false);
        }
        public void DoModifies(NPC npc, Player player, Projectile projectile, Item item, ref int sourcedamage, ref float knockback, ref bool crit)
        {
            SGAPlayer moddedplayer = player.GetModPlayer <SGAPlayer>();
            int       damage       = (int)(sourcedamage * damagemul);

            Projectile held = null;

            if (projectile != null)
            {
                float resist = npc.SGANPCs().pierceResist;
                if ((projectile.penetrate < 0 || projectile.penetrate > 3) && resist < 1)
                {
                    damage       = (int)(damage * resist);
                    sourcedamage = damage;
                }


                if (crit && moddedplayer.molotovLimit > 0 && projectile.Throwing().thrown)
                {
                    crit = (Main.rand.Next(10) == 0);
                }

                if (player != null && player.heldProj >= 0)
                {
                    held = Main.projectile[player.heldProj];
                }

                if (projectile.trap)
                {
                    damage += (int)(sourcedamage * (player.SGAPly().TrapDamageMul - 1f));
                }
            }

            DoApoco(npc, projectile, player, item, ref damage, ref knockback, ref crit);

            if (moddedplayer != null)
            {
                if (moddedplayer.acidSet.Item1)
                {
                    reducedDefense += (npc.poisoned ? 5 : 0) + (npc.venom ? 5 : 0) + (acidburn ? 5 : 0);
                }
            }

            damage += (int)(Math.Min(npc.defense, reducedDefense) / 2);

            if (Gourged)
            {
                damage += npc.defense / 4;
            }
            if (Sodden)
            {
                damage += (int)((float)sourcedamage * 0.33f);
            }

            if (moddedplayer != null)
            {
                if (moddedplayer.PrimordialSkull)
                {
                    if (npc.HasBuff(BuffID.OnFire))
                    {
                        damage += (int)(sourcedamage * 0.25);
                    }
                }

                if (npc.HasBuff(BuffID.Midas))
                {
                    damage += (int)(sourcedamage * 0.15f);
                }
            }

            if (item != null)
            {
                if (item.pick + item.axe + item.hammer > 0)
                {
                    if (player.HasBuff(ModContent.BuffType <TooltimePotionBuff>()))
                    {
                        knockback += 50f;
                    }
                }
            }

            if (projectile != null)
            {
                SGAprojectile modeproj   = projectile.GetGlobalProjectile <SGAprojectile>();
                Player        P          = Main.player[projectile.owner];
                bool          trapdamage = false;
                if (projectile.trap)
                {
                    trapdamage = true;
                }

                if (trapdamage)
                {
                    float totaldamage = 0f;
                    //damage += (int)((npc.defense * moddedplayer.TrapDamageAP) / 2.00);
                    totaldamage += moddedplayer.TrapDamageAP;
                    if (moddedplayer.JaggedWoodenSpike)
                    {
                        totaldamage += 0.4f;
                        //damage += (int)((npc.defense*0.4)/2.00);
                    }
                    if (moddedplayer.JuryRiggedSpikeBuckler)
                    {
                        //damage += (int)(damage * 0.1);
                        totaldamage += 0.1f;
                        //damage += (int)((npc.defense * 0.1) / 2.00);
                    }
                    totaldamage = Math.Min(totaldamage, 1f);
                    if (moddedplayer.GoldenCog)
                    {
                        npc.life = npc.life - (int)(damage * 0.10);
                        if (Main.netMode == 2)
                        {
                            NetMessage.SendData(23, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0);
                        }
                    }
                    damage += (int)((npc.defense * totaldamage) / 2.00);
                }

                if (moddedplayer.beefield > 0 && (projectile.type == ProjectileID.Bee || projectile.type == ProjectileID.GiantBee))
                {
                    damage += (int)(Math.Min(moddedplayer.beedamagemul, 10f + (moddedplayer.beedamagemul / 50f)) * 1.5f);
                }

                if (modeproj.myplayer != null)
                {
                    P = modeproj.myplayer;
                }

                if (P != null)
                {
                    if (moddedplayer.CirnoWings == true && projectile.coldDamage)
                    {
                        damage += (int)((float)sourcedamage * 0.20f);
                    }
                }
            }

            if (moddedplayer.MisterCreeperset && item != null)
            {
                if (item.shoot < 1 && item.melee)
                {
                    if (player.velocity.Y > 1)
                    {
                        crit = true;
                    }
                }
            }

            if (moddedplayer.Blazewyrmset)
            {
                if (npc.HasBuff(mod.BuffType("ThermalBlaze")) && ((item != null && item.melee) || (projectile != null && projectile.melee)))
                {
                    damage += (int)(sourcedamage * 0.20f);
                }
            }

            if (moddedplayer.alkalescentHeart)
            {
                damage += (int)(sourcedamage * (0f + (npc.HasBuff(ModContent.BuffType <AcidBurn>()) ? 0.15f : (npc.HasBuff(BuffID.Venom) ? 0.10f : (npc.HasBuff(BuffID.Poisoned) ? 0.05f : 0)))));
            }

            SGAPlayer sgaply = player.SGAPly();

            if (sgaply.snakeEyes.Item1)
            {
                bool falsecrit = crit;
                if (!crit && Main.rand.Next(100) == 0)
                {
                    CombatText.NewText(npc.Hitbox, Color.Red, "False Crit", false, false);
                    falsecrit = true;
                }
                sgaply.snakeEyes.Item2 = falsecrit ? 0 : Math.Min(sgaply.snakeEyes.Item2 + 1, 100);
                damage += (int)(sourcedamage * (0f + (sgaply.snakeEyes.Item2 / 100f)));
            }

            if ((Main.netMode < 1 || SGAmod.SkillRun > 1) && SGAmod.SkillRun > 0)
            {
                if (sgaply.skillMananger == null)
                {
                    return;
                }

                if (item != null)
                {
                    sgaply.skillMananger.OnEnemyDamage(ref damage, ref crit, ref knockback, item, null);
                }
                if (projectile != null)
                {
                    sgaply.skillMananger.OnEnemyDamage(ref damage, ref crit, ref knockback, null, projectile);
                }
            }

            if (petrified)
            {
                if (player != null && (item?.pick > 0 || (projectile != null && player.heldProj >= 0 && player.heldProj == projectile.whoAmI && player.HeldItem.pick > 0)))
                {
                    damage = (int)(damage * 3f);
                    crit   = true;
                    Main.PlaySound(SoundID.Tink, (int)npc.Center.X, (int)npc.Center.Y, 0, 1, 0.25f);
                }
                else
                {
                    damage = (int)(damage * 0.25f);
                }
            }

            DoModifiesLateEvent?.Invoke(npc, player, projectile, item, ref sourcedamage, ref damage, ref knockback, ref crit);

            LifeSteal(npc, player, ref damage, ref knockback, ref crit);
            OnCrit(npc, projectile, player, item, ref damage, ref knockback, ref crit);

            sourcedamage = damage;
        }
示例#28
0
        public override void AI()
        {
            if (!justSpawnedArmModules)
            {
                if (npc.life < npc.lifeMax / 2)
                {
                    NPC.NewNPC((int)npc.position.X - 200, (int)npc.position.Y - 100, ModContent.NPCType <AtlasSaw>());
                    NPC.NewNPC((int)npc.position.X + 200, (int)npc.position.Y - 100, ModContent.NPCType <AtlasSlicers>());
                    NPC.NewNPC((int)npc.position.X - 100, (int)npc.position.Y, ModContent.NPCType <AtlasVice>());
                    NPC.NewNPC((int)npc.position.X + 100, (int)npc.position.Y, ModContent.NPCType <AtlasVice>());
                }
                else
                {
                    NPC.NewNPC((int)npc.position.X - 200, (int)npc.position.Y, ModContent.NPCType <AtlasCannon>());
                    NPC.NewNPC((int)npc.position.X + 200, (int)npc.position.Y, ModContent.NPCType <AtlasLaser>());
                }
                justSpawnedArmModules = true;
            }

            if (doAtlasAttack)
            {
                Vector2 direction = Main.player[npc.target].Center - npc.Center;
                direction.Normalize();
                direction.X *= 8.5f;
                direction.Y *= 8.5f;
                int amountOfProjectiles;

                Timer++;
                if (npc.life < npc.lifeMax / 2)
                {
                    if (!phase2Init)
                    {
                        CombatText.NewText(npc.Hitbox, Color.Red, "DEPLOYING MELEE MODULES...", dramatic: true);
                        justSpawnedArmModules = false;
                        phase2Init            = true;
                    }

                    if (Timer == 100 || Timer == 105 || Timer == 110 || Timer == 115 || Timer == 120 || Timer == 125 || Timer == 130 || Timer == 135 || Timer == 140 || Timer == 145 || Timer == 150)
                    {
                        amountOfProjectiles = 1;
                        for (int i = 0; i < amountOfProjectiles; ++i)
                        {
                            float A      = (float)Main.rand.Next(-200, 200) * 0.01f;
                            float B      = (float)Main.rand.Next(-200, 200) * 0.01f;
                            int   damage = Main.expertMode ? 125 : 150;
                            if (Main.netMode != NetmodeID.MultiplayerClient)
                            {
                                Main.PlaySound(SoundID.DD2_KoboldExplosion, npc.position);
                            }
                            Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X + A, direction.Y + B, ModContent.ProjectileType <AtlasMissile>(), damage, 1, Main.myPlayer, 0, 0);
                        }
                    }
                    if (Timer == 160)
                    {
                        Main.PlaySound(SoundID.Item11, npc.position);
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 12, 0, ModContent.ProjectileType <AtlasSpike>(), 6, 0, Main.myPlayer, 0f, 0f);
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, -4, 4, ModContent.ProjectileType <AtlasSpike>(), 6, 0, Main.myPlayer, 0f, 0f);
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 4, -4, ModContent.ProjectileType <AtlasSpike>(), 6, 0, Main.myPlayer, 0f, 0f);
                    }
                }
                else
                {
                    if (Timer == 100 || Timer == 110 || Timer == 120 || Timer == 130 || Timer == 140 || Timer == 150)
                    {
                        amountOfProjectiles = 4;
                        for (int i = 0; i < amountOfProjectiles; ++i)
                        {
                            float A      = (float)Main.rand.Next(-200, 200) * 0.01f;
                            float B      = (float)Main.rand.Next(-200, 200) * 0.01f;
                            int   damage = Main.expertMode ? 100 : 102;
                            if (Main.netMode != NetmodeID.MultiplayerClient)
                            {
                                Projectile.NewProjectile(npc.Center.X, npc.Center.Y, direction.X + A, direction.Y + B, ModContent.ProjectileType <AtlasSpike>(), damage, 1, Main.myPlayer, 0, 0);
                            }
                        }
                    }
                }
                if (Timer == 180)
                {
                    Timer = 0;
                }
            }

            /*if (!claws && Main.netMode != NetmodeID.MultiplayerClient)
             * {
             *  npc.TargetClosest(true);
             *  claws = true;
             *  NPC aClaw = Main.npc[NPC.NewNPC((int)(npc.position.X + (float)(npc.width * 2)), (int)npc.position.Y + npc.height * 2, ModContent.NPCType<AtlasClaw>(), 0, 0f, 0f, 0f, 0f, 255)];
             *  aClaw.ai[0] = 1f;
             *  aClaw.ai[1] = (float)npc.whoAmI;
             *  aClaw.target = npc.target;
             *  aClaw.netUpdate = true;
             *  aClaw = Main.npc[NPC.NewNPC((int)(npc.position.X + (float)(npc.width * 2)), (int)npc.position.Y + npc.height * 2, ModContent.NPCType<AtlasClaw>(), 0, 0f, 0f, 0f, 0f, 255)];
             *  aClaw.ai[0] = -1f;
             *  aClaw.ai[1] = (float)npc.whoAmI;
             *  aClaw.target = npc.target;
             *  aClaw.netUpdate = true;
             * }*/
        }
示例#29
0
        public override void AI()
        {
            string SoulReturned = Language.GetTextValue("Mods.Antiaris.SoulReturned");
            Player owner        = null;

            if (projectile.owner != -1)
            {
                owner = Main.player[projectile.owner];
            }
            else if (projectile.owner == 255)
            {
                owner = Main.LocalPlayer;
            }
            var player = owner;

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

            var ProjRectangle   = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, 28, 30);
            var NPCRectangle    = new Rectangle();
            var PlayerRectangle = new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height);

            foreach (NPC npc in Main.npc)
            {
                if (npc.type == mod.NPCType("DeadlyJones"))
                {
                    NPCRectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, 40, 58);
                }
                if (ProjRectangle.Intersects(NPCRectangle))
                {
                    if (!intersects)
                    {
                        intersects = true;
                        projectile.Kill();
                        int heal = player.statLife / 2;
                        CombatText.NewText(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height), Color.LightGreen, heal, false, false);
                        CombatText.NewText(new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height), Color.Red, heal, false, false);
                        player.statLife -= heal;
                        if (npc.life < npc.lifeMax)
                        {
                            npc.life += heal;
                        }
                    }
                }
                if (ProjRectangle.Intersects(PlayerRectangle))
                {
                    returnTimer++;
                    if (returnTimer == 6000)
                    {
                        projectile.Kill();
                        CombatText.NewText(new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height), Color.Cyan, SoulReturned, false, false);
                    }
                }
            }
        }
示例#30
0
        public override void NPCLoot(NPC npc)
        {
            GNPC info = npc.GetGlobalNPC <GNPC>();

            if (info.deathMarkOwner >= 0)
            {
                Player player = Main.player[info.deathMarkOwner];
                int    index  = player.FindBuffIndex(mod.BuffType("ActiveCooldown"));
                player.buffTime[index] = 1;
            }
            if (!npc.boss)
            {
                return;
            }
            for (int i = 0; i < 256; i++)
            {
                if (Main.player[i].active)
                {
                    Player  p       = Main.player[i];
                    MPlayer player  = (MPlayer)(p.GetModPlayer(mod, "MPlayer"));
                    int     msgType = 0;
                    if (npc.type == 4 && !player.killedEye)
                    {
                        player.killedEye = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                        msgType = 1;
                    }
                    if ((npc.type == 13 || npc.type == 14 || npc.type == 15 || npc.type == 266) && !player.killedWormOrBrain)
                    {
                        player.killedWormOrBrain = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                        msgType = 2;
                    }
                    if (npc.type == 35 && !player.killedSkelly)
                    {
                        player.killedSkelly = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                        msgType = 3;
                    }
                    if (npc.type == NPCID.QueenBee && !player.killedBee)
                    {
                        msgType          = 4;
                        player.killedBee = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.KingSlime && !player.killedSlime)
                    {
                        msgType            = 5;
                        player.killedSlime = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.WallofFlesh && !player.killedWall)
                    {
                        msgType           = 6;
                        player.killedWall = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.TheDestroyer && !player.killedDestroyer)
                    {
                        msgType = 7;
                        player.killedDestroyer = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if ((npc.type == 125 || npc.type == 126) && !player.killedTwins)
                    {
                        msgType            = 8;
                        player.killedTwins = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.SkeletronPrime && !player.killedPrime)
                    {
                        msgType            = 9;
                        player.killedPrime = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.Plantera && !player.killedPlant)
                    {
                        msgType            = 10;
                        player.killedPlant = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.Golem && !player.killedGolem)
                    {
                        msgType            = 11;
                        player.killedGolem = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.DukeFishron && !player.killedFish)
                    {
                        msgType           = 12;
                        player.killedFish = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.CultistBoss && !player.killedCultist)
                    {
                        msgType = 13;
                        player.killedCultist = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (npc.type == NPCID.MoonLordCore && !player.killedMoon)
                    {
                        msgType           = 14;
                        player.killedMoon = true;
                        CombatText.NewText(new Rectangle((int)p.position.X, (int)p.position.Y - 50, p.width, p.height), new Color(255, 255, 255, 255), "LEVEL UP!", true);
                    }
                    if (msgType > 0)
                    {
                        var netMessage = mod.GetPacket();
                        netMessage.Write("Level");
                        netMessage.Write(p.whoAmI);
                        netMessage.Write(msgType);
                        netMessage.Send();
                    }
                }
            }
        }