diff --git a/CalamityMod.cs b/CalamityMod.cs index 883ccb4ef2..641bd5c8fd 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -1710,6 +1710,7 @@ namespace CalamityMod spikyBallList = new List() //There's more to come { + ModContent.ItemType() ModContent.ItemType() }; diff --git a/Items/Weapons/Rogue/HellsSun.cs b/Items/Weapons/Rogue/HellsSun.cs new file mode 100644 index 0000000000..43fcabf8f0 --- /dev/null +++ b/Items/Weapons/Rogue/HellsSun.cs @@ -0,0 +1,106 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class HellsSun : RogueWeapon + { + private static int damage = 250; + private static int knockBack = 5; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hell's Sun"); + Tooltip.SetDefault("Shoots a gravity-defying spiky ball. Stacks up to 10.\n" + + "Once stationary, periodically emits small suns that explode on hit\n" + + "Stealth strikes emit suns at a faster rate and last for a longer amount of time\n" + + "Right click to delete all existing spiky balls"); + } + + public override void SafeSetDefaults() + { + item.damage = damage; + item.Calamity().rogue = true; + item.noMelee = true; + item.noUseGraphic = true; + item.width = 1; + item.height = 1; + item.useTime = 15; + item.useAnimation = 15; + item.useStyle = 1; + item.knockBack = knockBack; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 10; + item.Calamity().postMoonLordRarity = 12;; + item.UseSound = SoundID.Item1; + item.maxStack = 10; + + item.shootSpeed = 5f; + item.shoot = ModContent.ProjectileType(); + + } + + public override bool CanUseItem(Player player) + { + if (player.altFunctionUse == 2) + { + return true; + } + else + { + int UseMax = item.stack - 1; + + if (player.ownedProjectileCounts[item.shoot] > UseMax) + { + return false; + } + else + { + return 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) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.killSpikyBalls = false; + if (player.altFunctionUse == 2) + { + modPlayer.killSpikyBalls = true; + return false; + } + if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + { + int stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + Main.projectile[stealth].penetrate = -1; + Main.projectile[stealth].timeLeft = 2400; + return false; + } + return true; + } + + public override bool AltFunctionUse(Player player) + { + return true; + } + + /*public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + + recipe.AddIngredient(ItemID.SpikyBall, 100); + recipe.AddIngredient(ModContent.ItemType(), 10); + r.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + }*/ + } +} diff --git a/Items/Weapons/Rogue/HellsSun.png b/Items/Weapons/Rogue/HellsSun.png new file mode 100644 index 0000000000..130f9037b4 Binary files /dev/null and b/Items/Weapons/Rogue/HellsSun.png differ diff --git a/Projectiles/Rogue/ExplosiveSun.cs b/Projectiles/Rogue/ExplosiveSun.cs new file mode 100644 index 0000000000..0da1cbeb43 --- /dev/null +++ b/Projectiles/Rogue/ExplosiveSun.cs @@ -0,0 +1,91 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.Buffs.DamageOverTime; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ExplosiveSun : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Explosive Sun"); + } + + public override void SetDefaults() + { + projectile.width = 22; + projectile.height = 22; + projectile.aiStyle = 115; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.light = 0.5f; + projectile.alpha = 50; + projectile.scale = 1.2f; + projectile.timeLeft = 600; + projectile.tileCollide = false; + projectile.Calamity().rogue = true; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + //Changes the texture of the projectile + if (projectile.ai[0] == 1f) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/ExplosiveSun2"); + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, 30, 30)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + if (projectile.ai[0] == 2f) + { + Texture2D texture = ModContent.GetTexture("CalamityMod/Projectiles/Rogue/ExplosiveSun3"); + Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, 34, 34)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2(texture.Width / 2f, 20 / 2f), projectile.scale, SpriteEffects.None, 0f); + return false; + } + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void Kill(int timeLeft) + { + projectile.position = projectile.Center; + projectile.width = projectile.height = 192; + projectile.position.X = projectile.position.X - (float)(projectile.width / 2); + projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); + projectile.maxPenetrate = -1; + projectile.penetrate = -1; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + projectile.damage /= 2; + projectile.Damage(); + if (Main.rand.NextBool(3)) + { + Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 14, 0.5f); + } + for (int num621 = 0; num621 < 5; num621++) + { + int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num622].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[num622].scale = 0.5f; + Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + } + } + for (int num623 = 0; num623 < 10; num623++) + { + int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 3f); + Main.dust[num624].noGravity = true; + Main.dust[num624].velocity *= 5f; + num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default, 2f); + Main.dust[num624].velocity *= 2f; + } + } + } +} diff --git a/Projectiles/Rogue/ExplosiveSun.png b/Projectiles/Rogue/ExplosiveSun.png new file mode 100644 index 0000000000..21391d0538 Binary files /dev/null and b/Projectiles/Rogue/ExplosiveSun.png differ diff --git a/Projectiles/Rogue/ExplosiveSun2.png b/Projectiles/Rogue/ExplosiveSun2.png new file mode 100644 index 0000000000..e30cba51d0 Binary files /dev/null and b/Projectiles/Rogue/ExplosiveSun2.png differ diff --git a/Projectiles/Rogue/ExplosiveSun3.png b/Projectiles/Rogue/ExplosiveSun3.png new file mode 100644 index 0000000000..31fd6c3f7b Binary files /dev/null and b/Projectiles/Rogue/ExplosiveSun3.png differ diff --git a/Projectiles/Rogue/HellsSunProj.cs b/Projectiles/Rogue/HellsSunProj.cs new file mode 100644 index 0000000000..dac4480671 --- /dev/null +++ b/Projectiles/Rogue/HellsSunProj.cs @@ -0,0 +1,95 @@ +using System; +using Terraria; +using Terraria.ID; +using Microsoft.Xna.Framework; +using Terraria.ModLoader; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; + +namespace CalamityMod.Projectiles.Rogue +{ + public class HellsSunProj : ModProjectile + { + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Hell's Sun"); + } + + public override void SetDefaults() + { + projectile.width = 15; + projectile.height = 15; + projectile.friendly = true; + projectile.Calamity().rogue = true; + projectile.tileCollide = false; + projectile.penetrate = 20; + projectile.timeLeft = 1200; + + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 30; + } + + public override void AI() + { + projectile.ai[0] += 1f; + + if (projectile.ai[0] >= 90f) + { + projectile.velocity.X *= 0.98f; + projectile.velocity.Y *= 0.98f; + projectile.localAI[1]++; + if (projectile.Calamity().stealthStrike == true) + { + if ((double) projectile.localAI[1] >= 15.0) + { + Vector2 velocity = projectile.velocity; + Vector2 vector2_1 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101)); + vector2_1.Normalize(); + Vector2 vector2_2 = vector2_1 * ((float) Main.rand.Next(10, 41) * 0.1f); + if (Main.rand.Next(3) == 0) + vector2_2 *= 2f; + Vector2 vector2_3 = velocity * 0.25f + vector2_2; + Vector2 vector2_5 = vector2_3 * 0.8f; + Projectile.NewProjectile(projectile.Center.X - vector2_5.X, projectile.Center.Y - vector2_5.Y, vector2_5.X, vector2_5.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, Main.rand.Next(3), 0.0f); + projectile.localAI[1] = 0.0f; + } + } + else + { + if ((double) projectile.localAI[1] >= 30.0) + { + Vector2 velocity = projectile.velocity; + Vector2 vector2_1 = new Vector2((float) Main.rand.Next(-100, 101), (float) Main.rand.Next(-100, 101)); + vector2_1.Normalize(); + Vector2 vector2_2 = vector2_1 * ((float) Main.rand.Next(10, 41) * 0.1f); + if (Main.rand.Next(3) == 0) + vector2_2 *= 2f; + Vector2 vector2_3 = velocity * 0.25f + vector2_2; + Vector2 vector2_5 = vector2_3 * 0.8f; + Projectile.NewProjectile(projectile.Center.X - vector2_5.X, projectile.Center.Y - vector2_5.Y, vector2_5.X, vector2_5.Y, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, Main.rand.Next(3), 0.0f); + projectile.localAI[1] = 0.0f; + } + } + } + else + { + projectile.rotation += 0.3f * (float)projectile.direction; + } + + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + if (modPlayer.killSpikyBalls == true) + { + projectile.active = false; + projectile.netUpdate = true; + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + } +} diff --git a/Projectiles/Rogue/HellsSunProj.png b/Projectiles/Rogue/HellsSunProj.png new file mode 100644 index 0000000000..130f9037b4 Binary files /dev/null and b/Projectiles/Rogue/HellsSunProj.png differ