Beispiel #1
0
        //public override bool PreAI()
        //{
        //	Player player = Main.player[projectile.owner];
        //	//player.BabyFaceMonster = false; // Relic from aiType
        //	return true;
        //}

        public override void AI()
        {
            Vector2 position = projectile.position;

            if (!firstTick)
            {
                //Main.NewText(firstTick);
                Projectile.NewProjectile(position.X, position.Y, 0, 0, ModContent.ProjectileType <BombBuddyDetector>(), 50, 0, projectile.owner);
                firstTick = true;
            }

            Player player = Main.player[projectile.owner];
            ExtraExplosivesPlayer modPlayer = player.GetModPlayer <ExtraExplosivesPlayer>();

            if (player.dead)
            {
                modPlayer.BombBuddy = false;
            }
            if (modPlayer.BombBuddy)
            {
                projectile.timeLeft = 2;
            }

            if (!player.HasBuff(ModContent.BuffType <BombBuddyBuff>()))
            {
                modPlayer.BombBuddy = false;
            }

            modPlayer.BuddyPos = position;
            //Main.NewText(modPlayer.BuddyPos);
        }
        //public override bool PreAI()
        //{
        //	Player player = Main.player[projectile.owner];
        //	//player.BabyFaceMonster = false; // Relic from aiType
        //	return true;
        //}

        public override void AI()
        {
            projectile.timeLeft = 5;
            Player player = Main.player[projectile.owner];
            ExtraExplosivesPlayer modPlayer = player.GetModPlayer <ExtraExplosivesPlayer>();

            projectile.position = modPlayer.BuddyPos;
            //Main.NewText(projectile.position);

            if (!player.HasBuff(ModContent.BuffType <BombBuddyBuff>()))
            {
                projectile.Kill();
            }

            //check for a hit
            if (hit)
            {
                projectile.ai[1]++;
            }

            //check for the end of the delay
            if (projectile.ai[1] >= 60)
            {
                projectile.Kill();
            }
        }
Beispiel #3
0
        public void ConfusedToggle(UIMouseEvent evt, UIElement listeningElement)
        {
            ExtraExplosivesPlayer mp = Main.LocalPlayer.EE();

            mp.RandomFuelConfused = !mp.RandomFuelConfused;
            ToggleConfused.RemoveAllChildren();
            ToggleConfused.Append(Confused);
            ToggleConfused.Append((mp.RandomFuelConfused) ? (UIText)(new Active()) : (UIText)(new Inactive()));
        }
Beispiel #4
0
        public void FrostburnToggle(UIMouseEvent evt, UIElement listeningElement)
        {
            ExtraExplosivesPlayer mp = Main.LocalPlayer.EE();

            mp.RandomFuelFrostburn = !mp.RandomFuelFrostburn;
            ToggleFrostburn.RemoveAllChildren();
            ToggleFrostburn.Append(Frostburn);
            ToggleFrostburn.Append((mp.RandomFuelFrostburn) ? (UIText)(new Active()) : (UIText)(new Inactive()));
        }
Beispiel #5
0
        public void OnFireToggle(UIMouseEvent evt, UIElement listeningElement)
        {
            ExtraExplosivesPlayer mp = Main.LocalPlayer.EE();

            mp.RandomFuelOnFire = !mp.RandomFuelOnFire;
            ToggleOnFire.RemoveAllChildren();
            ToggleOnFire.Append(OnFire);
            ToggleOnFire.Append((mp.RandomFuelOnFire) ? (UIText)(new Active()) : (UIText)(new Inactive()));
        }
Beispiel #6
0
        public void StickyGunpowderToggle(UIMouseEvent evt, UIElement listeningElement)
        {
            ExtraExplosivesPlayer mp = Main.LocalPlayer.EE();

            mp.StickyGunpowderActive = !mp.StickyGunpowderActive;
            ToggleStickyGunpowder.RemoveAllChildren();
            leftPage.RemoveChild(StickyGunpowderImage);
            leftPage.RemoveChild(StickyGunpowder_GreyscaleImage);
            leftPage.Append(mp.StickyGunpowderActive ? StickyGunpowderImage : StickyGunpowder_GreyscaleImage);
            ToggleStickyGunpowder.Append(StickyGunpowder);
            ToggleStickyGunpowder.Append(mp.StickyGunpowderActive ? (UIText) new Active() : (UIText) new Inactive());
        }
Beispiel #7
0
        public void MysteryBombToggle(UIMouseEvent evt, UIElement listeningElement)
        {
            ExtraExplosivesPlayer mp = Main.LocalPlayer.EE();

            mp.MysteryBombActive = !mp.MysteryBombActive;
            ToggleMysteryBomb.RemoveAllChildren();
            rightPage.RemoveChild(MysteryBombImage);
            rightPage.RemoveChild(MysteryBomb_GreyscaleImage);
            rightPage.Append((mp.MysteryBombActive) ? MysteryBombImage : MysteryBomb_GreyscaleImage);
            ToggleMysteryBomb.Append(MysteryBomb);
            ToggleMysteryBomb.Append((mp.MysteryBombActive) ? (UIText)(new Active()) : (UIText)(new Inactive()));
        }
Beispiel #8
0
        public void BombBagToggle(UIMouseEvent evt, UIElement listeningElement)
        {
            ExtraExplosivesPlayer mp = Main.LocalPlayer.EE();

            mp.BombBagActive = !mp.BombBagActive;
            ToggleBombBag.RemoveAllChildren();
            leftPage.RemoveChild(BombBagImage);
            leftPage.RemoveChild(BombBag_GreyscaleImage);
            leftPage.Append((mp.BombBagActive) ? BombBagImage : BombBag_GreyscaleImage);
            ToggleBombBag.Append(BombBag);
            ToggleBombBag.Append((mp.BombBagActive) ? (UIText) new Active() : (UIText) new Inactive());
        }
        public void CrossedWiresToggle(UIMouseEvent evt, UIElement listeningElement)
        {
            ExtraExplosivesPlayer mp = Main.LocalPlayer.EE();

            mp.CrossedWiresActive = !mp.CrossedWiresActive;
            ToggleCrossedWires.RemoveAllChildren();
            leftPage.RemoveChild(CrossedWiresImage);
            leftPage.RemoveChild(CrossedWires_GreyscaleImage);
            leftPage.Append((mp.CrossedWiresActive) ? CrossedWiresImage : CrossedWires_GreyscaleImage);
            ToggleCrossedWires.Append(CrossedWires);
            ToggleCrossedWires.Append((mp.CrossedWiresActive) ? (UIText) new Active() : (UIText) new Inactive());
        }
Beispiel #10
0
        public void ShortFuzeToggle(UIMouseEvent evt, UIElement listeningElement)
        {
            ExtraExplosivesPlayer mp = Main.LocalPlayer.EE();

            mp.ShortFuseActive = !mp.ShortFuseActive;
            ToggleShortFuze.RemoveAllChildren();
            rightPage.RemoveChild(ShortFuzeImage);
            rightPage.RemoveChild(ShortFuze_GreyscaleImage);
            rightPage.Append((mp.ShortFuseActive) ? ShortFuzeImage : ShortFuze_GreyscaleImage);
            ToggleShortFuze.Append(ShortFuze);
            ToggleShortFuze.Append((mp.ShortFuseActive) ? (UIText)(new Active()) : (UIText)(new Inactive()));
        }
Beispiel #11
0
        public void LightweightBombshellsToggle(UIMouseEvent evt, UIElement listeningElement)
        {
            ExtraExplosivesPlayer mp = Main.LocalPlayer.EE();

            mp.LightweightBombshellsActive = !mp.LightweightBombshellsActive;
            ToggleLightweightBombshells.RemoveAllChildren();
            rightPage.RemoveChild(LightweightBombshellsImage);
            rightPage.RemoveChild(LightweightBombshells_GreyscaleImage);
            rightPage.Append(mp.LightweightBombshellsActive ? LightweightBombshellsImage : LightweightBombshells_GreyscaleImage);
            ToggleLightweightBombshells.Append(LightweightBombshells);
            ToggleLightweightBombshells.Append(mp.LightweightBombshellsActive ? (UIText)(new Active()) : (UIText)(new Inactive()));
        }
Beispiel #12
0
        public void RandomFuelToggle(UIMouseEvent evt, UIElement listeningElement)
        {
            ExtraExplosivesPlayer mp = Main.LocalPlayer.EE();

            mp.RandomFuelActive = !mp.RandomFuelActive;
            ToggleRandomFuel.RemoveAllChildren();
            leftPage.RemoveChild(RandomFuelImage);
            leftPage.RemoveChild(RandomFuel_GreyscaleImage);
            leftPage.Append((mp.RandomFuelActive) ? RandomFuelImage : RandomFuel_GreyscaleImage);
            ToggleRandomFuel.Append(RandomFuel);
            ToggleRandomFuel.Append((mp.RandomFuelActive) ? (UIText)(new Active()) : (UIText)(new Inactive()));
        }
        public void ReactivePlatingToggle(UIMouseEvent evt, UIElement listeningElement)
        {
            ExtraExplosivesPlayer mp = Main.LocalPlayer.EE();

            mp.ReactivePlatingActive = !mp.ReactivePlatingActive;
            ToggleReactivePlating.RemoveAllChildren();
            rightPage.RemoveChild(ReactivePlatingImage);
            rightPage.RemoveChild(ReactivePlating_GreyscaleImage);
            rightPage.Append((mp.ReactivePlatingActive) ? ReactivePlatingImage : ReactivePlating_GreyscaleImage);
            ToggleReactivePlating.Append(ReactivePlating);
            ToggleReactivePlating.Append((mp.ReactivePlatingActive) ? (UIText)(new Active()) : (UIText)(new Inactive()));
        }
        public void GlowingCompoundToggle(UIMouseEvent evt, UIElement listeningElement)
        {
            ExtraExplosivesPlayer mp = Main.LocalPlayer.EE();

            mp.GlowingCompoundActive = !mp.GlowingCompoundActive;
            ToggleGlowingCompound.RemoveAllChildren();
            rightPage.RemoveChild(GlowingCompoundImage);
            rightPage.RemoveChild(GlowingCompound_GreyscaleImage);
            rightPage.Append((mp.GlowingCompoundActive) ? GlowingCompoundImage : GlowingCompound_GreyscaleImage);
            ToggleGlowingCompound.Append(GlowingCompound);
            ToggleGlowingCompound.Append((mp.GlowingCompoundActive) ? (UIText)(new Active()) : (UIText)(new Inactive()));
        }
        //public override bool PreAI()
        //{
        //    Player player = Main.player[projectile.owner];
        //    //player.BabyFaceMonster = false; // Relic from aiType
        //    return true;
        //}

        public override void AI()
        {
            projectile.timeLeft = 5;
            Player player = Main.player[projectile.owner];
            ExtraExplosivesPlayer modPlayer = player.GetModPlayer <ExtraExplosivesPlayer>();

            projectile.position = modPlayer.BuddyPos;
            //Main.NewText(projectile.position);

            if (!player.HasBuff(ModContent.BuffType <BombBuddyBuff>()))
            {
                projectile.Kill();
            }
        }
Beispiel #16
0
        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            ExtraExplosivesPlayer mp = player.EE();

            if (mp.BlastShieldingActive)
            {
                mp.BlastShielding = true;
            }
            if (mp.BombBagActive)
            {
                mp.BombBag = true;
            }
            if (mp.CrossedWiresActive)
            {
                mp.CrossedWires = true;
            }
            if (mp.GlowingCompoundActive)
            {
                mp.GlowingCompound = true;
            }
            if (mp.LightweightBombshellsActive)
            {
                mp.LightweightBombshells = true;
            }
            if (mp.MysteryBombActive)
            {
                mp.MysteryBomb = true;
            }
            if (mp.RandomFuelActive)
            {
                mp.RandomFuel = true;
            }
            if (mp.ReactivePlatingActive)
            {
                mp.ReactivePlating = true;
            }
            if (mp.ShortFuseActive)
            {
                mp.ShortFuse = true;
            }
            if (mp.StickyGunpowderActive)
            {
                mp.StickyGunpowder = true;
            }
            player.EE().AnarchistCookbook = true;
        }
Beispiel #17
0
        public override void ModifyTooltips(List <TooltipLine> tooltips)
        {
            ExtraExplosivesPlayer mp = Main.player[item.owner].EE();

            if (!mp.AlienExplosive &&
                !mp.LihzahrdFuzeset &&
                !mp.Bombshroom &&
                !mp.SupernaturalBomb)
            {
                var hintTooltipLine = new TooltipLine(mod, "hintTooltipLine", $"There still seem to be pages missing");
                hintTooltipLine.overrideColor = Color.LightSkyBlue;
                tooltips.Add(hintTooltipLine);
            }
            var extraTooltip = new TooltipLine(mod, "extraTooltip", $"Its more than just the sum of its parts");

            extraTooltip.overrideColor = Color.MediumVioletRed;
            tooltips.Add(extraTooltip);
        }
Beispiel #18
0
        public override void PostAI()
        {
            switch (projState)
            {
            case C4State.Airborne:
                if (projectile.owner == Main.myPlayer && c4Owner == null)
                {
                    c4Owner = Main.player[projectile.owner].GetModPlayer <ExtraExplosivesPlayer>();
                }
                break;

            case C4State.Frozen:
                projectile.position = positionToFreeze;
                projectile.velocity = Vector2.Zero;
                if (indicatorSoundInstance == null)
                {
                    indicatorSoundInstance = Main.PlaySound(indicatorSound, (int)projectile.Center.X, (int)projectile.Center.Y);
                }
                else if (indicatorSoundInstance.State != SoundState.Playing)        // else if needed to avoid a NullReferenceException
                {
                    indicatorSoundInstance.Play();
                }
                if (c4Owner != null && c4Owner.detonate)
                {
                    projState        = C4State.Primed;
                    projectile.ai[1] = 55;
                    Main.PlaySound(primedSound, (int)projectile.position.X, (int)projectile.position.Y);
                }
                break;

            case C4State.Primed:
                projectile.ai[1]--;
                if (projectile.ai[1] < 1)
                {
                    projState = C4State.Exploding;
                }
                break;

            case C4State.Exploding:
                projectile.Kill();
                break;
            }
        }
        public override void Kill(int timeLeft)
        {
            _projectileID = projectile.damage;

            ExtraExplosivesPlayer mp = Main.player[projectile.owner].EE();

            Vector2 position = projectile.Center;

            Main.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);

            Vector2 vel;
            int     spedX;
            int     spedY;
            int     cntr = 0;

            for (int x = -radius; x <= radius; x++)
            {
                for (int y = -radius; y <= radius; y++)
                {
                    int xPosition = (int)(x + position.X / 16.0f);
                    int yPosition = (int)(y + position.Y / 16.0f);

                    if (Math.Sqrt(x * x + y * y) <= radius + 0.5)   //this make so the explosion radius is a circle
                    {
                        //mod.Logger.Debug(projectile.damage);
                        if (WorldGen.TileEmpty(xPosition, yPosition))
                        {
                            spedX = Main.rand.Next(15) - 7;
                            spedY = Main.rand.Next(15) - 7;
                            if (spedX == 0)
                            {
                                spedX = 1;
                            }
                            if (spedY == 0)
                            {
                                spedY = 1;
                            }
                            //if (++cntr <= 100) Projectile.NewProjectile(position.X + x, position.Y + y, spedX, spedY, (int)projectile.knockBack, (int)((projectile.damage + Main.player[projectile.owner].EE().DamageBonus) * Main.player[projectile.owner].EE().DamageMulti), 20, projectile.owner, 0.0f, 0);
                            if (++cntr <= 100)
                            {
                                Projectile.NewProjectile(position.X + x, position.Y + y, spedX, spedY, (int)projectile.knockBack, (int)((projectile.damage + mp.DamageBonus) * mp.DamageMulti), 20, projectile.owner, 0.0f, 0);
                            }
                        }
                        else
                        {
                            spedX = Main.rand.Next(15) - 7;
                            spedY = Main.rand.Next(15) - 7;
                            if (spedX == 0)
                            {
                                spedX = 1;
                            }
                            if (spedY == 0)
                            {
                                spedY = 1;
                            }
                            if (++cntr <= 100)
                            {
                                Projectile.NewProjectile(position.X + x, position.Y + y, spedX, spedY, (int)projectile.knockBack, (int)((projectile.damage + mp.DamageBonus) * mp.DamageMulti), 20, projectile.owner, 0.0f, 0);
                            }
                        }
                    }
                }
            }

            DustEffects();
        }