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.
This commit is contained in:
Nathanael Overton committed 2025-06-24 20:09:32 -04:00
1 parent ac255745cf
commit f1ca34f93f
6 files changed
+169

No files matched your search

+3
View File
@@ -7,6 +7,9 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<None Remove="Items\Weapons\Ranged\SlagfireDouser.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="tModLoader.CodeAssist" Version="0.1.5" />
</ItemGroup>
+47
View File
@@ -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<Slagfire>();
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;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

@@ -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
@@ -262,3 +262,4 @@ LeviatitanMeteor.DisplayName: Leviatitan Meteor
LeviatitanExplosion.DisplayName: Leviatitan Explosion
SulphuricDrop.DisplayName: Sulphuric Drop
AcidRocket.DisplayName: Acid Rocket
Slagfire.DisplayName: Slagfire
+108
View File
@@ -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
}
}
}
}
}
}
}