From f1ca34f93f048460b6bfd595989a1205830c705d Mon Sep 17 00:00:00 2001 From: Nathanael Overton Date: Tue, 24 Jun 2025 20:09:32 -0400 Subject: [PATCH] Initial See Taiga for a fully detailed explanation of the item. Base functionality minus visuals is complete. This currently has a placeholder sprite and will require particle effects to emulate crags lava. Currently the weapon instead shoots dust in a near-identical manner to the Acid Gun. --- CalamityMod.csproj | 3 + Items/Weapons/Ranged/SlagfireDouser.cs | 47 ++++++++ Items/Weapons/Ranged/SlagfireDouser.png | Bin 0 -> 597 bytes ...ods.CalamityMod.Items.Weapons.Ranged.hjson | 10 ++ .../Mods.CalamityMod.Projectiles.Ranged.hjson | 1 + Projectiles/Ranged/Slagfire.cs | 108 ++++++++++++++++++ 6 files changed, 169 insertions(+) create mode 100644 Items/Weapons/Ranged/SlagfireDouser.cs create mode 100644 Items/Weapons/Ranged/SlagfireDouser.png create mode 100644 Projectiles/Ranged/Slagfire.cs diff --git a/CalamityMod.csproj b/CalamityMod.csproj index 06a7b9a67d..512f3b69a0 100644 --- a/CalamityMod.csproj +++ b/CalamityMod.csproj @@ -7,6 +7,9 @@ AnyCPU latest + + + diff --git a/Items/Weapons/Ranged/SlagfireDouser.cs b/Items/Weapons/Ranged/SlagfireDouser.cs new file mode 100644 index 0000000000..89e71f0b55 --- /dev/null +++ b/Items/Weapons/Ranged/SlagfireDouser.cs @@ -0,0 +1,47 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class SlagfireDouser : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetDefaults() + { + Item.width = 104; + Item.height = 34; + Item.damage = 9; + Item.DamageType = DamageClass.Ranged; + Item.useTime = 4; + Item.useAnimation = 16; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.UseSound = SoundID.Item61; // Grenade Launcher, Chicken Cannon, etc + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.ArmorPenetration = 10; + Item.shootSpeed = 14f; + Item.reuseDelay = 12; + } + + public override Vector2? HoldoutOffset() => new Vector2(-16, 0); + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + + float SpeedX = velocity.X + (float)Main.rand.Next(-25, 26) * 0.04f; + float SpeedY = velocity.Y + (float)Main.rand.Next(-25, 26) * 0.04f; + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); + + return false; + } + } +} diff --git a/Items/Weapons/Ranged/SlagfireDouser.png b/Items/Weapons/Ranged/SlagfireDouser.png new file mode 100644 index 0000000000000000000000000000000000000000..49ea9a9b1007f845d6de000351a443fc732f635a GIT binary patch literal 597 zcmV-b0;>IqP)Px%4@pEpRA_8o+>JB z1rxkK&mJ;|_czU#cHX4>li=%+jv6GKrT6ikZ`%h*QTHb3CCHr jr9EBVv$1=ASJ=00000NkvXXu0mjf&#Mj3 literal 0 HcmV?d00001 diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index e1616d6e28..ec6e883cba 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -1124,6 +1124,16 @@ Shroomer: { Tooltip: Fires bullets and an extremely powerful homing mushroom } +SlagfireDouser: { + DisplayName: Slagfire Douser + Tooltip: + ''' + Lobs armor-penetrating lava in bursts + Armor-penetrating lava ignores 5 points of enemy defense + [c/FF9900:Capable of dousing townsfolk in lava too...] + ''' +} + SlagMagnum: { DisplayName: Slag Magnum Tooltip: Converts musket balls into fossil shards that split into additional shards on impact diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index c6be216f3d..db7827cc7b 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -262,3 +262,4 @@ LeviatitanMeteor.DisplayName: Leviatitan Meteor LeviatitanExplosion.DisplayName: Leviatitan Explosion SulphuricDrop.DisplayName: Sulphuric Drop AcidRocket.DisplayName: Acid Rocket +Slagfire.DisplayName: Slagfire diff --git a/Projectiles/Ranged/Slagfire.cs b/Projectiles/Ranged/Slagfire.cs new file mode 100644 index 0000000000..53c3b881f0 --- /dev/null +++ b/Projectiles/Ranged/Slagfire.cs @@ -0,0 +1,108 @@ +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.WorldBuilding; +namespace CalamityMod.Projectiles.Magic +{ + public class Slagfire : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 32; + Projectile.friendly = true; + Projectile.hostile = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.ignoreWater = true; + Projectile.extraUpdates = 1; + Projectile.tileCollide = false; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + } + + public override void AI() + { + Projectile.localAI[1]++; + if (Projectile.localAI[1] >= 4f) + { + Projectile.tileCollide = true; + } + Projectile.scale -= 0.001f; + if (Projectile.scale <= 0f) + { + Projectile.Kill(); + } + if (Projectile.localAI[0] <= 3f) + { + Projectile.localAI[0] += 1f; + return; + } + for (int i = 0; i < 3; i++) + { + Vector2 positionDelta = Projectile.velocity / 3f * i; + int spawnDelta = 14; + int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 1f); + Dust dust = Main.dust[dustIdx]; + dust.noGravity = true; + dust.velocity *= 0.1f; + dust.velocity += Projectile.velocity * 0.5f; + dust.position -= positionDelta; + } + if (Main.rand.NextBool(8)) + { + int spawnDelta = 16; + int dustIdx = Dust.NewDust(new Vector2(Projectile.position.X + spawnDelta, Projectile.position.Y + spawnDelta), Projectile.width - spawnDelta * 2, Projectile.height - spawnDelta * 2, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 0.5f); + Main.dust[dustIdx].velocity *= 0.25f; + Main.dust[dustIdx].velocity += Projectile.velocity * 0.5f; + } + + if (Projectile.localAI[1] >= 10f) + Projectile.velocity.Y += 0.075f; + } + + public override bool CanHitPlayer(Player target) + { + return false; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (target.type == NPCID.Guide) + { + modifiers.FinalDamage *= 10f; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damage) + { + if (target.type == NPCID.Guide) + { + + if (target.life <= 0) + { + for (int i = 0; i < 20; i++) + { + Dust.NewDustPerfect(target.Center, (int)CalamityDusts.Brimstone, + new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-4f, 4f)), + 150, default, 2f).noGravity = true; + } + + if (!NPC.AnyNPCs(NPCID.WallofFlesh)) // Don't spawn if Wall is already active + { + int playerIndex = Projectile.owner; + if (playerIndex >= 0 && Main.player[playerIndex].active) + { + NPC.SpawnOnPlayer(playerIndex, NPCID.WallofFlesh); // The game handles spawning logic by itself from here + } + } + } + } + } + } +}