public override void AI()
        {
            if (!yoyosSpawned && projectile.owner == Main.myPlayer)
            {
                int maxYoyos = 5;
                for (int i = 0; i < maxYoyos; i++)
                {
                    float      radians = (360f / (float)maxYoyos) * i * (float)(Math.PI / 180);
                    Projectile yoyo    = FargoGlobalProjectile.NewProjectileDirectSafe(projectile.Center, Vector2.Zero, ModContent.ProjectileType <BlenderOrbital>(), projectile.damage, projectile.knockBack, projectile.owner, 5, radians);
                    yoyo.localAI[0] = projectile.whoAmI;
                }

                yoyosSpawned = true;
            }

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

            if (Main.player[projectile.owner].HeldItem.type == ModContent.ItemType <Items.Weapons.SwarmDrops.Blender>())
            {
                projectile.damage    = Main.player[projectile.owner].GetWeaponDamage(Main.player[projectile.owner].HeldItem);
                projectile.knockBack = Main.player[projectile.owner].GetWeaponKnockback(Main.player[projectile.owner].HeldItem, Main.player[projectile.owner].HeldItem.knockBack);
            }
        }
        public override void Kill(int timeLeft)
        {
            Vector2 position = Projectile.Center;

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

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            // All the way across
            for (int x = 1; x <= Main.maxTilesX; x++)
            {
                // Six down, last is platforms
                for (int y = -5; y <= 0; y++)
                {
                    int xPosition = x;
                    int yPosition = (int)(y + position.Y / 16.0f);

                    if (xPosition < 0 || xPosition >= Main.maxTilesX || yPosition < 0 || yPosition >= Main.maxTilesY)
                    {
                        continue;
                    }

                    Tile tile = Main.tile[xPosition, yPosition];

                    if (tile == null)
                    {
                        continue;
                    }

                    if (!FargoGlobalProjectile.OkayToDestroyTile(tile))
                    {
                        continue;
                    }

                    FargoGlobalTile.ClearEverything(xPosition, yPosition);

                    if (y == 0)
                    {
                        FargoGlobalTile.ClearEverything(xPosition, yPosition, false);
                        // Spawn platforms
                        WorldGen.PlaceTile(xPosition, yPosition, TileID.Platforms, false, false, -1, 13);
                        if (Main.netMode == NetmodeID.Server)
                        {
                            NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
                        }
                    }
                    else
                    {
                        if (!FargoGlobalProjectile.TileIsLiterallyAir(tile))
                        {
                            FargoGlobalTile.ClearEverything(xPosition, yPosition);
                        }
                    }
                }
            }
        }
Exemple #3
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)
        {
            int p = Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), type, damage, knockback, player.whoAmI);

            FargoGlobalProjectile.SplitProj(Main.projectile[p], Main.rand.Next(3, 6), MathHelper.Pi / 5, 1);

            return(false);
        }
Exemple #4
0
        public override void Kill(int timeLeft)
        {
            Vector2 position = Projectile.Center;

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

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            // Seven across
            for (int x = -3; x <= 3; x++)
            {
                for (int y = (int)(1 + position.Y / 16.0f); y <= (Main.maxTilesY - 40); y++)
                {
                    int xPosition = (int)(x + position.X / 16.0f);

                    if (xPosition < 0 || xPosition >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY)
                    {
                        continue;
                    }

                    Tile tile = Main.tile[xPosition, y];

                    if (tile == null)
                    {
                        continue;
                    }

                    if (!FargoGlobalProjectile.OkayToDestroyTile(tile))
                    {
                        continue;
                    }

                    FargoGlobalTile.ClearEverything(xPosition, y, false);

                    // Spawn structure
                    WorldGen.PlaceWall(xPosition, y, WallID.Stone);

                    if ((x == -3) || (x == 3))
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.GrayBrick);
                    }
                    else if ((x == -2 || x == 2) && (y % 10 == 0))
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.Torches);
                    }
                    else if (x == 0)
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.Rope);
                    }

                    NetMessage.SendTileSquare(-1, xPosition, y, 1);
                }
            }
        }
Exemple #5
0
        public override bool CheckDead(NPC npc)
        {
            Player      player    = Main.player[Main.myPlayer];
            FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>();

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

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

            if (modPlayer.WoodEnchant && npc.damage == 0 && !npc.townNPC && npc.lifeMax == 5)
            {
                Projectile.NewProjectile(npc.Center, new Vector2(0, -4), ProjectileID.LostSoulFriendly, 20, 0, Main.myPlayer);
            }

            if (Needles && npc.lifeMax > 1 && Main.rand.Next(2) == 0)
            {
                int dmg        = 15;
                int numNeedles = 8;

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

                Projectile[] projs = FargoGlobalProjectile.XWay(numNeedles, npc.Center, ProjectileID.PineNeedleFriendly, 5, modPlayer.HighestDamageTypeScaling(dmg), 5f);

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



            return(true);
        }
Exemple #6
0
 public override void Kill(int timeLeft)
 {
     if (projectile.owner == Main.myPlayer && projectile.localAI[1] == 1)
     {
         Projectile[] projs = FargoGlobalProjectile.XWay(Main.rand.Next(3, 7), projectile.Center, projectile.type, 6, projectile.damage, projectile.knockBack);
         foreach (Projectile proj in projs)
         {
             proj.localAI[1] = 2;
         }
     }
 }
Exemple #7
0
        public override void Kill(int timeLeft)
        {
            Main.PlaySound(SoundID.Item15, projectile.Center);
            Main.PlaySound(SoundID.Item14, projectile.Center);

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            Vector2 position = projectile.Center;
            int     radius   = 60; //bigger = boomer

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

                    if (xPosition < 0 || xPosition >= Main.maxTilesX || yPosition < 0 || yPosition >= Main.maxTilesY)
                    {
                        continue;
                    }

                    Tile tile = Main.tile[xPosition, yPosition];
                    if (tile == null)
                    {
                        continue;
                    }

                    if (!FargoGlobalProjectile.OkayToDestroyTile(tile))
                    {
                        continue;
                    }

                    FargoGlobalTile.FindChestTopLeft(xPosition, yPosition, true);

                    WorldGen.KillTile(xPosition, yPosition, noItem: true);
                    tile.liquid = 0;
                    tile.lava(false);
                    tile.honey(false);

                    if (Main.netMode == NetmodeID.Server)
                    {
                        NetMessage.sendWater(xPosition, yPosition);
                        NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
                    }
                }
            }

            Main.refreshMap = true;
        }
Exemple #8
0
        private void SpawnFire(FargoPlayer modPlayer)
        {
            int damage = 50;

            if (modPlayer.LifeForce || modPlayer.WizardEnchant)
            {
                damage *= 2;
            }

            //leave some fire behind
            Projectile[] fires = FargoGlobalProjectile.XWay(5, projectile.Center, ModContent.ProjectileType <PumpkinFlame>(), 3, modPlayer.HighestDamageTypeScaling(damage), 0);
            Main.PlaySound(SoundID.Item74, projectile.Center);
        }
        public override void Kill(int timeLeft)
        {
            Vector2 position = Projectile.Center;

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

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            //cavern height plus halfway to hell
            int yEndpoint = (int)(Main.rockLayer + (Main.maxTilesY - 200 - Main.rockLayer) / 2);

            // Five across
            for (int x = -2; x <= 2; x++)
            {
                for (int y = (int)(1 + position.Y / 16.0f); y <= yEndpoint; y++)
                {
                    int xPosition = (int)(x + position.X / 16.0f);

                    if (xPosition < 0 || xPosition >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY)
                    {
                        continue;
                    }

                    Tile tile = Main.tile[xPosition, y];

                    if (tile == null)
                    {
                        continue;
                    }

                    if (!FargoGlobalProjectile.OkayToDestroyTile(tile))
                    {
                        continue;
                    }

                    FargoGlobalTile.ClearEverything(xPosition, y, false);

                    if (x == 0)
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.Rope);
                    }

                    NetMessage.SendTileSquare(-1, xPosition, y, 1);
                }
            }
        }
Exemple #10
0
 private void spawnFire()
 {
     if (!hitSomething)
     {
         hitSomething = true;
         if (projectile.owner == Main.myPlayer)
         {
             Main.PlaySound(SoundID.Item74, projectile.Center);
             FargoGlobalProjectile.XWay(12, projectile.Center, ModContent.ProjectileType <EyeFireFriendly>(), 3, projectile.damage / 2, projectile.knockBack);
         }
         projectile.ai[0]     = 1;
         projectile.penetrate = 4;
         projectile.netUpdate = true;
     }
 }
        public override void AI()
        {
            if (!yoyosSpawned)
            {
                int maxYoyos = 5;
                for (int i = 0; i < maxYoyos; i++)
                {
                    float      radians = (360f / (float)maxYoyos) * i * (float)(Math.PI / 180);
                    Projectile yoyo    = FargoGlobalProjectile.NewProjectileDirectSafe(projectile.Center, Vector2.Zero, ModContent.ProjectileType <BlenderOrbital>(), projectile.damage, projectile.knockBack, projectile.owner, 5, radians);
                    yoyo.localAI[0] = projectile.whoAmI;
                }

                yoyosSpawned = true;
            }
        }
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockback)
        {
            damage = (int)(damage / 4.0 * 1.1);

            float minionSlotsUsed = 0;

            for (int i = 0; i < Main.maxProjectiles; i++)
            {
                if (Main.projectile[i].active && !Main.projectile[i].hostile && Main.projectile[i].owner == player.whoAmI && Main.projectile[i].minion)
                {
                    minionSlotsUsed += Main.projectile[i].minionSlots;
                }
            }

            float modifier = player.maxMinions - minionSlotsUsed + 1;

            if (modifier < 1)
            {
                modifier = 1;
            }
            if (modifier > 7)
            {
                modifier = 7;
            }

            if (modifier % 2 == 0)
            {
                float   spread    = MathHelper.ToRadians(80 / 3.5f);
                Vector2 baseSpeed = new Vector2(speedX, speedY).RotatedBy(spread * (-modifier / 2 + 0.5f)); //half offset for v spread
                for (int i = 0; i < modifier; i++)
                {
                    Projectile.NewProjectile(player.Center, baseSpeed.RotatedBy(spread * i), type, damage, knockback, player.whoAmI);
                }
            }
            else
            {
                int p = Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), type, damage, knockback, player.whoAmI);
                if (p != Main.maxProjectiles)
                {
                    float spread = MathHelper.ToRadians(80f / 7 * modifier * 2);
                    FargoGlobalProjectile.SplitProj(Main.projectile[p], (int)modifier, spread, 1);
                }
            }

            return(false);
        }
        public override bool CheckDead(NPC npc)
        {
            Player      player    = Main.player[Main.myPlayer];
            FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>();

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

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

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

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

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

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

            return(true);
        }
Exemple #14
0
        public override void Kill(int timeLeft)
        {
            SoundEngine.PlaySound(SoundID.Item15, Projectile.Center);
            SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            Vector2 position = Projectile.Center;
            int     radius   = 60; //bigger = boomer

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

                    if (xPosition < 0 || xPosition >= Main.maxTilesX || yPosition < 0 || yPosition >= Main.maxTilesY)
                    {
                        continue;
                    }

                    Tile tile = Main.tile[xPosition, yPosition];
                    if (tile == null)
                    {
                        continue;
                    }

                    if (!FargoGlobalProjectile.OkayToDestroyTile(tile) || FargoGlobalProjectile.TileIsLiterallyAir(tile))
                    {
                        continue;
                    }

                    FargoGlobalTile.ClearEverything(xPosition, yPosition);
                }
            }

            Main.refreshMap = true;
        }
        public override bool WingUpdate(int wings, Player player, bool inUse)
        {
            FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>();

            if (modPlayer.ChloroEnchant && player.GetToggleValue("Jungle") && inUse)
            {
                modPlayer.CanJungleJump = false;

                //spwn cloud
                if (modPlayer.JungleCD == 0)
                {
                    int dmg = (modPlayer.NatureForce || modPlayer.WizardEnchant) ? 150 : 75;
                    Main.PlaySound(SoundID.Item, (int)player.position.X, (int)player.position.Y, 62, 0.5f);
                    FargoGlobalProjectile.XWay(10, new Vector2(player.Center.X, player.Center.Y + (player.height / 2)), ProjectileID.SporeCloud, 3f, modPlayer.HighestDamageTypeScaling(dmg), 0f);

                    modPlayer.JungleCD = 8;
                }
            }

            return(base.WingUpdate(wings, player, inUse));
        }
Exemple #16
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)
        {
            int p = Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), type, damage, knockback, player.whoAmI);

            float spread = MathHelper.Pi / 8;

            if (numSpikes == 5)
            {
                spread = MathHelper.Pi / 5;
            }

            FargoGlobalProjectile.SplitProj(Main.projectile[p], numSpikes, spread, 1);

            numSpikes += 2;

            if (numSpikes > 5)
            {
                numSpikes = 3;
            }

            return(false);
        }
        public override bool CanUseItem(Item item, Player player)
        {
            FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>();

            if (modPlayer.IronGuard)
            {
                //Main.NewText($"iron {modPlayer.ironShieldCD}, {modPlayer.ironShieldTimer}");
                modPlayer.IronGuard          = false;
                modPlayer.wasHoldingShield   = false;
                player.shield_parry_cooldown = 0; //prevent that annoying tick sound
                //check is necessary so if player does a real parry then switches to right click weapon, using it won't reset cooldowns
                if (modPlayer.ironShieldCD == 40 && modPlayer.ironShieldTimer == 20)
                {
                    modPlayer.ironShieldCD    = 0;
                    modPlayer.ironShieldTimer = 0;
                }
            }

            //dont use hotkeys in stasis
            if (player.HasBuff(ModContent.BuffType <GoldenStasis>()))
            {
                if (item.type == ItemID.RodofDiscord)
                {
                    player.ClearBuff(ModContent.BuffType <Buffs.Souls.GoldenStasis>());
                }
                else
                {
                    return(false);
                }
            }

            if (FargoSoulsWorld.MasochistMode)
            {
                if (item.type == ItemID.RodofDiscord &&
                    (modPlayer.LihzahrdCurse ||
                     (Framing.GetTileSafely(Main.MouseWorld).wall == WallID.LihzahrdBrickUnsafe &&
                      !player.buffImmune[ModContent.BuffType <Buffs.Masomode.LihzahrdCurse>()])))
                {
                    return(false);
                }

                if (modPlayer.LihzahrdCurse &&
                    (item.type == ItemID.WireKite || item.type == ItemID.WireCutter))
                {
                    return(false);
                }
            }

            if (item.magic && player.GetModPlayer <FargoPlayer>().ReverseManaFlow)
            {
                int damage = (int)(item.mana / (1f - player.endurance) + player.statDefense);
                player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " was destroyed by their own magic."), damage, 0);
                player.immune     = false;
                player.immuneTime = 0;
            }

            if (modPlayer.BuilderMode && (item.createTile != -1 || item.createWall != -1) && item.type != ItemID.PlatinumCoin && item.type != ItemID.GoldCoin)
            {
                item.useTime      = 1;
                item.useAnimation = 1;
            }

            if (modPlayer.AdditionalAttacks && modPlayer.AdditionalAttacksTimer <= 0 && //non weapons and weapons with no ammo begone
                item.damage > 0 && player.HasAmmo(item, true) && !(item.mana > 0 && player.statMana < item.mana) &&
                item.type != ItemID.ExplosiveBunny && item.type != ItemID.Cannonball &&
                item.useTime > 0 && item.createTile == -1 && item.createWall == -1 && item.ammo == AmmoID.None && item.hammer == 0 && item.pick == 0 && item.axe == 0)
            {
                modPlayer.AdditionalAttacksTimer = 60;

                Vector2 position = player.Center;
                Vector2 velocity = Vector2.Normalize(Main.MouseWorld - position);

                if (modPlayer.BorealEnchant && player.GetToggleValue("Boreal") && player.whoAmI == Main.myPlayer)
                {
                    Vector2 vel = Vector2.Normalize(Main.MouseWorld - player.Center) * 17f;
                    int     p   = Projectile.NewProjectile(player.Center, vel, ProjectileID.SnowBallFriendly, (int)(item.damage * .5f), 1, Main.myPlayer);

                    int numSnowballs = 3;

                    if (modPlayer.WoodForce || modPlayer.WizardEnchant)
                    {
                        numSnowballs = 5;
                    }

                    if (p != 1000)
                    {
                        FargoGlobalProjectile.SplitProj(Main.projectile[p], numSnowballs, MathHelper.Pi / 10, 1);
                    }
                }

                if (modPlayer.CelestialRune && player.GetToggleValue("MasoCelest"))
                {
                    if (item.melee && item.pick == 0 && item.axe == 0 && item.hammer == 0) //fireball
                    {
                        Main.PlaySound(SoundID.Item34, position);
                        for (int i = 0; i < 3; i++)
                        {
                            Projectile.NewProjectile(position, velocity.RotatedByRandom(Math.PI / 6) * Main.rand.NextFloat(6f, 10f),
                                                     ModContent.ProjectileType <CelestialRuneFireball>(), (int)(50f * player.meleeDamage), 9f, player.whoAmI);
                        }
                    }
                    if (item.ranged) //lightning
                    {
                        float   ai1 = Main.rand.Next(100);
                        Vector2 vel = Vector2.Normalize(velocity.RotatedByRandom(Math.PI / 4)) * 7f;
                        Projectile.NewProjectile(position, vel, ModContent.ProjectileType <CelestialRuneLightningArc>(),
                                                 (int)(50f * player.rangedDamage), 1f, player.whoAmI, velocity.ToRotation(), ai1);
                    }
                    if (item.magic) //ice mist
                    {
                        Projectile.NewProjectile(position, velocity * 4.25f, ModContent.ProjectileType <CelestialRuneIceMist>(), (int)(50f * player.magicDamage), 4f, player.whoAmI);
                    }
                    if (item.thrown) //ancient vision
                    {
                        Projectile.NewProjectile(position, velocity * 16f, ModContent.ProjectileType <CelestialRuneAncientVision>(), (int)(50f * player.magicDamage), 0, player.whoAmI);
                    }
                }

                if (modPlayer.PumpkingsCape && player.GetToggleValue("MasoPump"))
                {
                    if (item.melee && item.pick == 0 && item.axe == 0 && item.hammer == 0) //flaming jack
                    {
                        float distance = 2000f;
                        int   target   = -1;
                        for (int i = 0; i < 200; i++)
                        {
                            if (Main.npc[i].active && Main.npc[i].CanBeChasedBy())
                            {
                                float newDist = Main.npc[i].Distance(player.Center);
                                if (newDist < distance)
                                {
                                    distance = newDist;
                                    target   = i;
                                }
                            }
                        }
                        if (target != -1)
                        {
                            Projectile.NewProjectile(position, velocity * 8f, ProjectileID.FlamingJack, (int)(75f * player.meleeDamage), 7.5f, player.whoAmI, target, 0f);
                        }
                    }
                    if (item.ranged) //jack o lantern
                    {
                        Projectile.NewProjectile(position, velocity * 11f, ProjectileID.JackOLantern, (int)(95f * player.rangedDamage), 8f, player.whoAmI);
                    }
                    if (item.magic) //bat scepter
                    {
                        for (int i = 0; i < 3; i++)
                        {
                            Vector2 newVel = velocity * 10f;
                            newVel.X += Main.rand.Next(-35, 36) * 0.02f;
                            newVel.Y += Main.rand.Next(-35, 36) * 0.02f;
                            Projectile.NewProjectile(position, newVel, ProjectileID.Bat, (int)(45f * player.magicDamage), 3f, player.whoAmI);
                        }
                    }
                }
            }

            //critter attack timer
            if (modPlayer.WoodEnchant && player.altFunctionUse == ItemAlternativeFunctionID.ActivatedAndUsed && item.makeNPC > 0)
            {
                if (modPlayer.CritterAttackTimer == 0)
                {
                    Vector2 vel = Vector2.Normalize(Main.MouseWorld - player.Center);
                    float   damageMultiplier = player.minionDamage;

                    int type           = -1;
                    int damage         = 0;
                    int attackCooldown = 0;

                    switch (item.type)
                    {
                    //case ItemID.Bunny:
                    //    type = ProjectileID.ExplosiveBunny;
                    //    damage = 10;
                    //    attackCooldown = 10;
                    //    break;

                    case ItemID.Bird:
                        type           = ModContent.ProjectileType <BirdProj>();
                        damage         = 15;
                        attackCooldown = 15;
                        break;

                    case ItemID.BlueJay:
                        type           = ModContent.ProjectileType <BlueJayProj>();
                        damage         = 10;
                        attackCooldown = 10;
                        break;

                    case ItemID.Cardinal:
                        type           = ModContent.ProjectileType <CardinalProj>();
                        damage         = 20;
                        attackCooldown = 20;
                        break;
                    }

                    if (type != -1)
                    {
                        Projectile.NewProjectile(player.Center, vel * 2f, type, damage, 2, player.whoAmI);
                        modPlayer.CritterAttackTimer = attackCooldown;
                    }
                }



                return(false);
            }

            if (item.type == ItemID.RodofDiscord)
            {
                if (FargoSoulsWorld.MasochistMode && EModeGlobalNPC.AnyBossAlive())
                {
                    player.AddBuff(ModContent.BuffType <Buffs.Masomode.ChaosLife>(), 30);
                    modPlayer.MaxLifeReduction += 100;

                    /*player.statLife -= player.statLifeMax2 / 5;
                     * PlayerDeathReason damageSource = PlayerDeathReason.ByOther(13);
                     * if (Main.rand.Next(2) == 0)
                     *  damageSource = PlayerDeathReason.ByOther(player.Male ? 14 : 15);
                     * if (player.statLife <= 0 && !player.chaosState) //since chaos state will check and kill anyway, avoid doublekill
                     *  player.KillMe(damageSource, 1, 0);
                     * player.lifeRegenCount = 0;
                     * player.lifeRegenTime = 0;*/
                }
            }

            return(true);
        }
Exemple #18
0
        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)
                {
                    FargoGlobalProjectile.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);
                }
            }
        }
Exemple #19
0
        public override bool CanUseItem(Item item, Player player)
        {
            FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>();

            //dont use hotkeys in stasis
            if (player.HasBuff(ModContent.BuffType <GoldenStasis>()))
            {
                if (item.type == ItemID.RodofDiscord)
                {
                    player.ClearBuff(ModContent.BuffType <Buffs.Souls.GoldenStasis>());
                }
                else
                {
                    return(false);
                }
            }

            if (FargoSoulsWorld.MasochistMode)
            {
                if (item.type == ItemID.RodofDiscord &&
                    (modPlayer.LihzahrdCurse ||
                     (Framing.GetTileSafely(Main.MouseWorld).wall == WallID.LihzahrdBrickUnsafe &&
                      !player.buffImmune[ModContent.BuffType <Buffs.Masomode.LihzahrdCurse>()])))
                {
                    return(false);
                }

                if (modPlayer.LihzahrdCurse &&
                    (item.type == ItemID.WireKite || item.type == ItemID.WireCutter))
                {
                    return(false);
                }
            }

            if (item.magic && player.GetModPlayer <FargoPlayer>().ReverseManaFlow)
            {
                int damage = (int)(item.mana / (1f - player.endurance) + player.statDefense);
                player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " was destroyed by their own magic."), damage, 0);
                player.immune     = false;
                player.immuneTime = 0;
            }

            if (modPlayer.BuilderMode && (item.createTile != -1 || item.createWall != -1) && item.type != ItemID.PlatinumCoin && item.type != ItemID.GoldCoin)
            {
                item.useTime      = 1;
                item.useAnimation = 1;
            }

            //non weapons and weapons with no ammo begone
            if (item.damage <= 0 || !player.HasAmmo(item, true) || (item.mana > 0 && player.statMana < item.mana))
            {
                return(true);
            }

            if (modPlayer.AdditionalAttacks && modPlayer.AdditionalAttacksTimer <= 0)
            {
                modPlayer.AdditionalAttacksTimer = 60;

                Vector2 position = player.Center;
                Vector2 velocity = Vector2.Normalize(Main.MouseWorld - position);

                if (modPlayer.BorealEnchant && SoulConfig.Instance.GetValue(SoulConfig.Instance.BorealSnowballs))
                {
                    Vector2 vel = Vector2.Normalize(Main.MouseWorld - player.Center) * 17f;
                    int     p   = Projectile.NewProjectile(player.Center, vel, ProjectileID.SnowBallFriendly, (int)(item.damage * .5f), 1, Main.myPlayer);

                    int numSnowballs = 3;

                    if (modPlayer.WoodForce || modPlayer.WizardEnchant)
                    {
                        numSnowballs = 5;
                    }

                    if (p != 1000)
                    {
                        FargoGlobalProjectile.SplitProj(Main.projectile[p], numSnowballs, MathHelper.Pi / 10, 1);
                    }
                }

                if (modPlayer.CelestialRune && SoulConfig.Instance.GetValue(SoulConfig.Instance.CelestialRune))
                {
                    if (item.melee && item.pick == 0 && item.axe == 0 && item.hammer == 0) //fireball
                    {
                        Main.PlaySound(SoundID.Item34, position);
                        for (int i = 0; i < 3; i++)
                        {
                            Projectile.NewProjectile(position, velocity.RotatedByRandom(Math.PI / 6) * Main.rand.NextFloat(6f, 10f),
                                                     ModContent.ProjectileType <CelestialRuneFireball>(), (int)(50f * player.meleeDamage), 9f, player.whoAmI);
                        }
                    }
                    if (item.ranged) //lightning
                    {
                        float   ai1 = Main.rand.Next(100);
                        Vector2 vel = Vector2.Normalize(velocity.RotatedByRandom(Math.PI / 4)) * 7f;
                        Projectile.NewProjectile(position, vel, ModContent.ProjectileType <CelestialRuneLightningArc>(),
                                                 (int)(50f * player.rangedDamage), 1f, player.whoAmI, velocity.ToRotation(), ai1);
                    }
                    if (item.magic) //ice mist
                    {
                        Projectile.NewProjectile(position, velocity * 4.25f, ModContent.ProjectileType <CelestialRuneIceMist>(), (int)(50f * player.magicDamage), 4f, player.whoAmI);
                    }
                    if (item.thrown) //ancient vision
                    {
                        Projectile.NewProjectile(position, velocity * 16f, ModContent.ProjectileType <CelestialRuneAncientVision>(), (int)(50f * player.magicDamage), 0, player.whoAmI);
                    }
                }

                if (modPlayer.PumpkingsCape && SoulConfig.Instance.GetValue(SoulConfig.Instance.PumpkingCape))
                {
                    if (item.melee && item.pick == 0 && item.axe == 0 && item.hammer == 0) //flaming jack
                    {
                        float distance = 2000f;
                        int   target   = -1;
                        for (int i = 0; i < 200; i++)
                        {
                            if (Main.npc[i].active && Main.npc[i].CanBeChasedBy())
                            {
                                float newDist = Main.npc[i].Distance(player.Center);
                                if (newDist < distance)
                                {
                                    distance = newDist;
                                    target   = i;
                                }
                            }
                        }
                        if (target != -1)
                        {
                            Projectile.NewProjectile(position, velocity * 8f, ProjectileID.FlamingJack, (int)(75f * player.meleeDamage), 7.5f, player.whoAmI, target, 0f);
                        }
                    }
                    if (item.ranged) //jack o lantern
                    {
                        Projectile.NewProjectile(position, velocity * 11f, ProjectileID.JackOLantern, (int)(95f * player.rangedDamage), 8f, player.whoAmI);
                    }
                    if (item.magic) //bat scepter
                    {
                        for (int i = 0; i < 3; i++)
                        {
                            Vector2 newVel = velocity * 10f;
                            newVel.X += Main.rand.Next(-35, 36) * 0.02f;
                            newVel.Y += Main.rand.Next(-35, 36) * 0.02f;
                            Projectile.NewProjectile(position, newVel, ProjectileID.Bat, (int)(45f * player.magicDamage), 3f, player.whoAmI);
                        }
                    }
                }
            }

            return(true);
        }
        public static void PlaceHouse(int x, int y, Vector2 position, int side, Player player)
        {
            int  xPosition = (int)((side * -1) + x + position.X / 16.0f);
            int  yPosition = (int)(y + position.Y / 16.0f);
            Tile tile      = Main.tile[xPosition, yPosition];

            // Testing for blocks that should not be destroyed
            if (!FargoGlobalProjectile.OkayToDestroyTile(tile))
            {
                return;
            }

            int wallType      = WallID.Wood;
            int tileType      = TileID.WoodBlock;
            int platformStyle = 0;

            if (player.ZoneDesert && !player.ZoneBeach)
            {
                wallType      = WallID.Cactus;
                tileType      = TileID.CactusBlock;
                platformStyle = 25;
            }
            else if (player.ZoneSnow)
            {
                wallType      = WallID.BorealWood;
                tileType      = TileID.BorealWood;
                platformStyle = 19;
            }
            else if (player.ZoneJungle)
            {
                wallType      = WallID.RichMaogany;
                tileType      = TileID.RichMahogany;
                platformStyle = 2;
            }
            else if (player.ZoneCorrupt)
            {
                wallType      = WallID.Ebonwood;
                tileType      = TileID.Ebonwood;
                platformStyle = 1;
            }
            else if (player.ZoneCrimson)
            {
                wallType      = WallID.Shadewood;
                tileType      = TileID.Shadewood;
                platformStyle = 5;
            }
            else if (player.ZoneBeach)
            {
                wallType      = WallID.PalmWood;
                tileType      = TileID.PalmWood;
                platformStyle = 17;
            }
            else if (player.ZoneHallow)
            {
                wallType      = WallID.Pearlwood;
                tileType      = TileID.Pearlwood;
                platformStyle = 3;
            }
            else if (player.ZoneGlowshroom)
            {
                wallType      = WallID.Mushroom;
                tileType      = TileID.MushroomBlock;
                platformStyle = 18;
            }
            else if (player.ZoneSkyHeight)
            {
                wallType      = WallID.DiscWall;
                tileType      = TileID.Sunplate;
                platformStyle = 22;
            }
            else if (player.ZoneUnderworldHeight)
            {
                wallType      = WallID.ObsidianBrick;
                tileType      = TileID.ObsidianBrick;
                platformStyle = 13;
            }

            //dont act if the right blocks already above
            if ((y == -5) && (tile.type == TileID.Platforms || tile.type == tileType))
            {
                return;
            }

            if (x == 10 * side || x == 1 * side)
            {
                //dont act on correct block above/below door, destroying them will break it
                if ((y == -4 || y == 0) && tile.type == tileType)
                {
                    return;
                }

                if ((y == -1 || y == -2 || y == -3) && (tile.type == TileID.ClosedDoor || tile.type == TileID.OpenDoor))
                {
                    return;
                }
            }
            else //for blocks besides those on the left/right edges where doors are placed, its okay to have platform as floor
            {
                if (y == 0 && (tile.type == TileID.Platforms || tile.type == tileType))
                {
                    return;
                }
            }

            //doing it this way so the code still runs to place bg walls behind open door
            if (!((x == 9 * side || x == 2 * side) && (y == -1 || y == -2 || y == -3) && tile.type == TileID.OpenDoor))
            {
                FargoGlobalTile.ClearEverything(xPosition, yPosition);
            }

            // Spawn walls
            if (y != -5 && y != 0 && x != (10 * side) && x != (1 * side))
            {
                WorldGen.PlaceWall(xPosition, yPosition, wallType);
                if (Main.netMode == NetmodeID.Server)
                {
                    NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
                }
            }

            //platforms on top
            if (y == -5 && Math.Abs(x) >= 3 && Math.Abs(x) <= 5)
            {
                WorldGen.PlaceTile(xPosition, yPosition, TileID.Platforms, style: platformStyle);
                if (Main.netMode == NetmodeID.Server)
                {
                    NetMessage.SendData(MessageID.TileChange, -1, -1, null, 1, xPosition, yPosition, TileID.Platforms, platformStyle);
                }
            }
            // Spawn border
            else if ((y == -5) || (y == 0) || (x == (10 * side)) || (x == (1 * side) && y == -4))
            {
                WorldGen.PlaceTile(xPosition, yPosition, tileType);
                if (Main.netMode == NetmodeID.Server)
                {
                    NetMessage.SendTileSquare(-1, xPosition, yPosition, 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)
        {
            //right click
            if (player.altFunctionUse == 2)
            {
                mode++;

                if (mode > 5)
                {
                    mode = 1;
                }

                SetUpItem();

                return(false);
            }

            switch (mode)
            {
            //melee
            case 1:
                Projectile.NewProjectile(position, new Vector2(speedX, speedY), mod.ProjectileType("PufferRang"), damage, knockBack, player.whoAmI);
                break;

            //range
            case 2:
                int num129 = Main.rand.Next(4, 6);
                for (int num130 = 0; num130 < num129; num130++)
                {
                    float num131 = (float)Main.mouseX + Main.screenPosition.X - position.X;
                    float num132 = (float)Main.mouseY + Main.screenPosition.Y - position.Y;
                    num131 += (float)Main.rand.Next(-40, 41) * 0.4f;
                    num132 += (float)Main.rand.Next(-40, 41) * 0.4f;
                    Projectile.NewProjectile(position, new Vector2(num131, num132), type, damage, knockBack, player.whoAmI);
                }
                break;

            //magic
            case 3:
                int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY), item.shoot = mod.ProjectileType("Bubble"), damage, knockBack, player.whoAmI);

                FargoGlobalProjectile.SplitProj(Main.projectile[p], 5);

                break;

            //summon
            case 4:
                Projectile.NewProjectile(position, new Vector2(speedX, speedY), mod.ProjectileType("FishMinion"), damage, knockBack, player.whoAmI);
                break;

            //throwing
            default:
                for (int i = 0; i < 10; i++)
                {
                    Projectile.NewProjectile(position, new Vector2(speedX + Main.rand.Next(-2, 2), speedY + Main.rand.Next(-2, 2)), mod.ProjectileType("SpikyLure"), damage, knockBack, player.whoAmI);
                }
                break;
            }

            return(false);
        }
        public override bool CanUseItem(Item item, Player player)
        {
            FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>();

            if (item.type == ItemID.PumpkinPie && player.statLife != player.statLifeMax2 && player.HasBuff(BuffID.PotionSickness))
            {
                return(false);
            }

            if (item.magic && player.GetModPlayer <FargoPlayer>().ReverseManaFlow)
            {
                player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " was destroyed by their own magic."), item.mana + item.damage, 0);
                player.immune     = false;
                player.immuneTime = 0;
            }

            //non weapons and weapons with no ammo begone
            if (item.damage <= 0 || !player.HasAmmo(item, true) || (item.mana > 0 && player.statMana < item.mana))
            {
                return(true);
            }

            if (modPlayer.BorealEnchant && ++modPlayer.BorealCount >= 4)
            {
                modPlayer.BorealCount = 0;
                if (Soulcheck.GetValue("Boreal Snowball Support"))
                {
                    Vector2 velocity = Vector2.Normalize(Main.MouseWorld - player.Center) * (item.shootSpeed > 0 ? item.shootSpeed : 10) * .75f;
                    int     p        = Projectile.NewProjectile(player.Center, velocity, ProjectileID.SnowBallFriendly, (int)(item.damage * .5f), 1, Main.myPlayer);
                    if (p != 1000 && (player.ZoneSnow || modPlayer.WoodForce))
                    {
                        FargoGlobalProjectile.SplitProj(Main.projectile[p], 5);
                    }
                }
            }

            if (modPlayer.AdditionalAttacks && modPlayer.AdditionalAttacksTimer <= 0)
            {
                modPlayer.AdditionalAttacksTimer = 60;

                Vector2 position = player.Center;
                Vector2 velocity = Vector2.Normalize(Main.MouseWorld - position);

                if (modPlayer.CelestialRune && Soulcheck.GetValue("Celestial Rune Support"))
                {
                    if (item.melee) //fireball
                    {
                        Main.PlaySound(SoundID.Item34, position);
                        for (int i = 0; i < 3; i++)
                        {
                            Projectile.NewProjectile(position, velocity.RotatedByRandom(Math.PI / 6) * Main.rand.NextFloat(6f, 10f),
                                                     mod.ProjectileType("CelestialRuneFireball"), (int)(50f * player.meleeDamage), 9f, player.whoAmI);
                        }
                    }
                    if (item.ranged) //lightning
                    {
                        float   ai1 = Main.rand.Next(100);
                        Vector2 vel = Vector2.Normalize(velocity.RotatedByRandom(Math.PI / 4)) * 7f;
                        Projectile.NewProjectile(position, vel, mod.ProjectileType("CelestialRuneLightningArc"),
                                                 (int)(50f * player.rangedDamage), 1f, player.whoAmI, velocity.ToRotation(), ai1);
                    }
                    if (item.magic) //ice mist
                    {
                        Projectile.NewProjectile(position, velocity * 4.25f, mod.ProjectileType("CelestialRuneIceMist"), (int)(50f * player.magicDamage), 4f, player.whoAmI);
                    }
                    if (item.thrown) //ancient vision
                    {
                        Projectile.NewProjectile(position, velocity * 16f, mod.ProjectileType("CelestialRuneAncientVision"), (int)(50f * player.thrownDamage), 0, player.whoAmI);
                    }
                }

                if (modPlayer.PumpkingsCape && Soulcheck.GetValue("Pumpking's Cape Support"))
                {
                    if (item.melee) //flaming jack
                    {
                        float distance = 2000f;
                        int   target   = -1;
                        for (int i = 0; i < 200; i++)
                        {
                            if (Main.npc[i].active && Main.npc[i].CanBeChasedBy())
                            {
                                float newDist = Main.npc[i].Distance(player.Center);
                                if (newDist < distance)
                                {
                                    distance = newDist;
                                    target   = i;
                                }
                            }
                        }
                        if (target != -1)
                        {
                            Projectile.NewProjectile(position, velocity * 8f, ProjectileID.FlamingJack, (int)(75f * player.meleeDamage), 7.5f, player.whoAmI, target, 0f);
                        }
                    }
                    if (item.ranged) //jack o lantern
                    {
                        Projectile.NewProjectile(position, velocity * 11f, ProjectileID.JackOLantern, (int)(95f * player.rangedDamage), 8f, player.whoAmI);
                    }
                    if (item.magic) //bat scepter
                    {
                        for (int i = 0; i < 3; i++)
                        {
                            Vector2 newVel = velocity * 10f;
                            newVel.X += Main.rand.Next(-35, 36) * 0.02f;
                            newVel.Y += Main.rand.Next(-35, 36) * 0.02f;
                            Projectile.NewProjectile(position, newVel, ProjectileID.Bat, (int)(45f * player.magicDamage), 3f, player.whoAmI);
                        }
                    }
                }
            }

            if (Fargowiltas.Instance.ThoriumLoaded)
            {
                ThoriumCanUse(player, item);
            }

            return(true);
        }
Exemple #23
0
        public override void Kill(int timeLeft)
        {
            Vector2 position = projectile.Center;

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

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            // Seven across
            for (int x = -3; x <= 3; x++)
            {
                for (int y = (int)(1 + position.Y / 16.0f); y <= (Main.maxTilesY - 40); y++)
                {
                    int xPosition = (int)(x + position.X / 16.0f);

                    if (xPosition < 0 || xPosition >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY)
                    {
                        continue;
                    }

                    Tile tile = Main.tile[xPosition, y];

                    if (tile == null)
                    {
                        continue;
                    }

                    if (!FargoGlobalProjectile.OkayToDestroyTile(tile))
                    {
                        continue;
                    }

                    FargoGlobalTile.ClearEverything(xPosition, y);

                    // Tile destroy

                    // WorldGen.KillTile(xPosition, y);
                    // WorldGen.KillWall(xPosition, y);
                    // Dust.NewDust(position, 22, 22, DustID.Smoke, 0.0f, 0.0f, 120);

                    // Kill liquids

                    /*if (tile != null)
                     * {
                     *  tile.liquid = 0;
                     *  tile.lava(false);
                     *  tile.honey(false);
                     *  if (Main.netMode == NetmodeID.Server)
                     *  {
                     *      NetMessage.sendWater(xPosition, y);
                     *  }
                     * }*/

                    // Spawn structure
                    WorldGen.PlaceWall(xPosition, y, WallID.Stone);

                    if ((x == -3) || (x == 3))
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.GrayBrick);
                    }

                    if ((x == -2 || x == 2) && (y % 10 == 0))
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.Torches);
                    }

                    if (x == 0)
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.Rope);
                    }

                    NetMessage.SendTileSquare(-1, xPosition, y, 1);
                }
            }
        }
        public override void AI()
        {
            Player      player    = Main.player[projectile.owner];
            FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>();

            projectile.timeLeft++;

            if (player.dead || !player.active || !modPlayer.SnowEnchant)
            {
                projectile.Kill();
            }

            if (player == Main.LocalPlayer)
            {
                projectile.Center = Main.MouseWorld;

                if (!player.GetToggleValue("Snow"))
                {
                    projectile.Kill();
                }
            }

            //dust
            int dist = 50;

            if (modPlayer.WizardEnchant || modPlayer.NatureForce)
            {
                dist = 100;
            }


            for (int i = 0; i < 15; i++)
            {
                Vector2 offset = new Vector2();
                double  angle  = Main.rand.NextDouble() * 2d * Math.PI;
                offset.X += (float)(Math.Sin(angle) * Main.rand.Next(dist + 1));
                offset.Y += (float)(Math.Cos(angle) * Main.rand.Next(dist + 1));
                Dust dust = Main.dust[Dust.NewDust(
                                          projectile.Center + offset - new Vector2(4, 4), 0, 0,
                                          76, 0, 0, 100, Color.White, .75f)];

                dust.noGravity = true;
            }

            //for (int i = 0; i < 20; i++)
            //{
            //    Vector2 offset = new Vector2();
            //    double angle = Main.rand.NextDouble() * 2d * Math.PI;
            //    offset.X += (float)(Math.Sin(angle) * dist);
            //    offset.Y += (float)(Math.Cos(angle) * dist);
            //    if (!Collision.SolidCollision(projectile.Center + offset - new Vector2(4, 4), 0, 0))
            //    {
            //        Dust dust = Main.dust[Dust.NewDust(
            //          projectile.Center + offset - new Vector2(4, 4), 0, 0,
            //          76, 0, 0, 100, Color.White, 1f
            //          )];
            //        dust.velocity = projectile.velocity;
            //        dust.noGravity = true;
            //    }
            //}



            for (int i = 0; i < Main.maxProjectiles; i++)
            {
                Projectile proj = Main.projectile[i];


                if (proj.active && proj.hostile && proj.damage > 0 && Vector2.Distance(projectile.Center, proj.Center) < dist)
                {
                    FargoGlobalProjectile globalProj = proj.GetGlobalProjectile <FargoGlobalProjectile>();
                    globalProj.ChilledProj  = true;
                    globalProj.ChilledTimer = 15;
                    projectile.netUpdate    = true;
                }
            }


            for (int i = 0; i < Main.maxNPCs; i++)
            {
                NPC npc = Main.npc[i];

                if (npc.active && !npc.friendly && npc.damage > 0 && Vector2.Distance(projectile.Center, npc.Center) < dist)
                {
                    npc.GetGlobalNPC <FargoSoulsGlobalNPC>().SnowChilled      = true;
                    npc.GetGlobalNPC <FargoSoulsGlobalNPC>().SnowChilledTimer = 15;
                    npc.netUpdate = true;
                }
            }
        }
Exemple #25
0
 public override void Kill(int timeLeft)
 {
     FargoGlobalProjectile.XWay(16, projectile.Center, ProjectileID.PineNeedleHostile, 5, projectile.damage, 0f);
 }
Exemple #26
0
 public override void Kill(int timeLeft)
 {
     FargoGlobalProjectile.XWay(4, projectile.position, mod.ProjectileType("WaterStream"), 5, projectile.damage / 2, projectile.knockBack / 2);
 }
Exemple #27
0
        public override void AI()
        {
            Player      player    = Main.player[projectile.owner];
            FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>();

            if (player.dead || !(modPlayer.AncientShadowEnchant || modPlayer.TerrariaSoul) || !SoulConfig.Instance.GetValue(SoulConfig.Instance.AncientShadow))
            {
                modPlayer.AncientShadowEnchant = false;
                projectile.Kill();
                return;
            }

            float num395 = Main.mouseTextColor / 200f - 0.35f;

            num395          *= 0.2f;
            projectile.scale = num395 + 0.95f;

            if (projectile.owner == Main.myPlayer)
            {
                //rotation mumbo jumbo
                float distanceFromPlayer = 150;

                Lighting.AddLight(projectile.Center, 0.1f, 0.4f, 0.2f);

                projectile.position    = player.Center + new Vector2(distanceFromPlayer, 0f).RotatedBy(projectile.ai[1]);
                projectile.position.X -= projectile.width / 2;
                projectile.position.Y -= projectile.height / 2;
                float rotation = 0.03f;
                projectile.ai[1] -= rotation;
                if (projectile.ai[1] > (float)Math.PI)
                {
                    projectile.ai[1]    -= 2f * (float)Math.PI;
                    projectile.netUpdate = true;
                }
                projectile.rotation = projectile.ai[1] + (float)Math.PI / 2f;


                //wait for CD
                if (projectile.ai[0] != 0f)
                {
                    projectile.ai[0] -= 1f;

                    if (projectile.ai[0] == 0)
                    {
                        const int num226 = 18; //dusts indicate charged up
                        for (int num227 = 0; num227 < num226; num227++)
                        {
                            Vector2 vector6 = Vector2.UnitX.RotatedBy(projectile.rotation) * 6f;
                            vector6 = vector6.RotatedBy(((num227 - (num226 / 2 - 1)) * 6.28318548f / num226), default(Vector2)) + projectile.Center;
                            Vector2 vector7 = vector6 - projectile.Center;
                            int     num228  = Dust.NewDust(vector6 + vector7, 0, 0, DustID.Shadowflame, 0f, 0f, 0, default(Color), 2f);
                            Main.dust[num228].noGravity = true;
                            Main.dust[num228].velocity  = vector7;
                        }
                    }

                    return;
                }


                for (int i = 0; i < Main.maxProjectiles; i++)
                {
                    Projectile proj = Main.projectile[i];

                    if (proj.active && proj.owner == projectile.owner && proj.type != mod.ProjectileType("AncientShadowBall") && !proj.minion && proj.damage > 0 && proj.Hitbox.Intersects(projectile.Hitbox))
                    {
                        FargoGlobalProjectile.XWay(10, projectile.Center, mod.ProjectileType("AncientShadowBall"), 6, 30, 0);
                        projectile.ai[0] = 300;

                        break;
                    }
                }
            }
        }