killer archerfish (rework) with HAMMERS

This commit is contained in:
sunny-raindrops committed 2026-02-15 13:06:55 -08:00
1 parent db9f5bcc37
commit 6d8d8129fb
16 files changed
+93 -43

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

+38 -13
View File
@@ -5,41 +5,66 @@ using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Localization;
namespace CalamityMod.Items.Weapons.Ranged
{
public class Archerfish : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public static int AmmoSavedPercent = 33;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent);
public override void SetDefaults()
{
Item.width = 78;
Item.height = 36;
Item.damage = 16;
Item.DamageType = DamageClass.Ranged;
Item.useTime = 6;
Item.useAnimation = 6;
Item.channel = true;
Item.useTime = 11;
Item.useAnimation = 11;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 2.5f;
Item.knockBack = 2f;
Item.value = CalamityGlobalItem.RarityOrangeBuyPrice;
Item.rare = ItemRarityID.Orange;
Item.UseSound = null;
Item.UseSound = SoundID.Item85;
Item.autoReuse = true;
Item.noUseGraphic = true;
Item.shoot = ModContent.ProjectileType<ArcherfishHoldout>();
Item.shootSpeed = 2f;
Item.shoot = ModContent.ProjectileType<ArcherfishShot>();
Item.shootSpeed = 11f;
Item.useAmmo = AmmoID.Bullet;
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
public override bool RangedPrefix() => true; //Can't scale with attack speed, but should still be able to recieve Unreal
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.95f && player.ownedProjectileCounts[Item.shoot] > 0;
public override Vector2? HoldoutOffset() => new Vector2(-10, -5);
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
Projectile holdout = Projectile.NewProjectileDirect(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI);
holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero);
// Reposition to the gun's tip
Vector2 newPos = position + new Vector2(60f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation());
// Fires a spread of harmless bubbles
for (int i = 0; i < 4; i++)
{
Gore bubble = Gore.NewGorePerfect(source, newPos, velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * 0.5f, 411);
bubble.timeLeft = 6 + Main.rand.Next(4);
bubble.scale = Main.rand.NextFloat(0.6f, 0.8f);
bubble.type = Main.rand.NextBool(3) ? 412 : 411;
}
// Replaces standard bullets with water jets.
if (type == ProjectileID.Bullet)
Projectile.NewProjectile(source, newPos, velocity, Item.shoot, damage, knockback, player.whoAmI);
else
Projectile.NewProjectile(source, newPos, velocity, type, damage, knockback, player.whoAmI);
// Always fires a close range water blast.
int waterRingDamage = (int)(damage * 0.5f);
float boostedKB = knockback + 5f;
Projectile.NewProjectile(source, newPos, velocity * 0.5f, ModContent.ProjectileType<ArcherfishRing>(), waterRingDamage, boostedKB, player.whoAmI);
return false;
}
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= AmmoSavedPercent;
}
}
+5 -2
View File
@@ -8,6 +8,7 @@ using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Localization;
namespace CalamityMod.Items.Weapons.Ranged
{
@@ -15,11 +16,13 @@ namespace CalamityMod.Items.Weapons.Ranged
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public int sharkGunDamageScaling = 0;
public static int AmmoSavedPercent = 50;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent);
public override void SetDefaults()
{
Item.width = 102;
Item.height = 42;
Item.height = 43;
Item.damage = 58;
Item.DamageType = DamageClass.Ranged;
Item.useTime = 4;
@@ -39,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged
}
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
public override bool RangedPrefix() => true; //Can't scale with attack speed, but should still be able to recieve Unreal
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.95f && player.ownedProjectileCounts[Item.shoot] > 0;
public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0 && Main.rand.Next(100) >= AmmoSavedPercent;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
Projectile holdout = Projectile.NewProjectileDirect(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI);
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

+4 -1
View File
@@ -8,6 +8,7 @@ using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
@@ -15,6 +16,8 @@ namespace CalamityMod.Items.Weapons.Ranged
public class Seadragon : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public static int AmmoSavedPercent = 66;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent);
public override void SetDefaults()
{
@@ -41,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override Vector2? HoldoutOffset() => new Vector2(-10, 0);
public override bool RangedPrefix() => true; //Can't scale with attack speed, but should still be able to recieve Unreal
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.95f && player.ownedProjectileCounts[Item.shoot] > 0;
public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0 && Main.rand.Next(100) >= AmmoSavedPercent;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
Projectile holdout = Projectile.NewProjectileDirect(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI);
+4 -1
View File
@@ -6,6 +6,7 @@ using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
@@ -15,6 +16,8 @@ namespace CalamityMod.Items.Weapons.Ranged
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public int sharkGunDamageScaling = 0;
public static int AmmoSavedPercent = 66;
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(AmmoSavedPercent);
public override void SetStaticDefaults()
{
@@ -47,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
public override bool RangedPrefix() => true; //Can't scale with attack speed, but should still be able to recieve Unreal
public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.95f && player.ownedProjectileCounts[Item.shoot] > 0;
public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0 && Main.rand.Next(100) >= AmmoSavedPercent;
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
Projectile holdout = Projectile.NewProjectileDirect(source, position, velocity, Item.shoot, damage, knockback, player.whoAmI);
@@ -712,8 +712,10 @@ Megalodon: {
DisplayName: Megalodon
Tooltip:
'''
Rapidly fires alternating bullets and pressurized water jets
Water jets consume no ammo
Loads a 30 round magazine of bullets and pressurized water streams that are rapidly unleashed
After firing, the gun unleashes a powerful homing rocket before reloading
Rocket damage is based on how many shots hit
{$CommonItemTooltip.PercentChanceToSaveAmmo}
'''
}
@@ -1058,9 +1060,10 @@ Seadragon: {
DisplayName: Seadragon
Tooltip:
'''
Unleashes a deluge of alternating bullets and pressurized water jets
Additionally fires rockets and emits devastating muzzle blasts
Water jets consume no ammo
Loads a 50 round deluge of alternating bullets and pressurized water jets
Water jets summon small fish that swim around you
Once your mag runs empty, all fish rush towards the cursor before reloading
{$CommonItemTooltip.PercentChanceToSaveAmmo}
'''
}
@@ -1474,9 +1477,11 @@ Voidragon: {
DisplayName: Voidragon
Tooltip:
'''
Fires void blasts that explode every other shot
Shoots demon flame tentacles alongside every shot
Void blasts consume no ammo and bullets have a {0}% chance to save ammo
Loads a 50 round onslaught of alternating bullets and void blasts
Once your mag runs empty, the gun unleashes a jet of abyssal fire that annihilates anything in its path
The abyssal fire and lingering flames grow increasingly powerful with the amount of shots you hit
{$CommonItemTooltip.PercentChanceToSaveAmmo}
[c/620BB0: 'Fade to black']
'''
}
+1 -1
View File
@@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Magic
Vector2 origin = texture.Size() * 0.5f;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
float opacity = Utils.GetLerpValue(0f, 0.08f, LightPower, true) * Projectile.Opacity * 0.5f;
Color drawColor = new Color(236, 0, 68) * opacity;
Color drawColor = Projectile.localAI[0] == 2f ? new Color(236, 0, 68) : Color.Indigo * opacity;
Vector2 scale = Projectile.Size / texture.Size() * Projectile.scale;
Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, Projectile.rotation, origin, scale, SpriteEffects.None, 0);
+2
View File
@@ -9,6 +9,7 @@ using CalamityMod.Effects;
using CalamityMod.Enums;
using CalamityMod.Graphics.Metaballs;
using CalamityMod.Graphics.Primitives;
using CalamityMod.NPCs;
using CalamityMod.Packets.Entities;
using CalamityMod.Particles;
using CalamityMod.Utilities.Daybreak;
@@ -25,6 +26,7 @@ using Terraria.WorldBuilding;
namespace CalamityMod.Projectiles.Ranged
{
[PierceResistException]
public class AbyssalFire : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
+9 -12
View File
@@ -28,6 +28,15 @@ namespace CalamityMod.Projectiles.Ranged
public override void AI()
{
// Bubbles
if (Main.rand.NextBool())
{
Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f), 411);
bubble.timeLeft = 9 + Main.rand.Next(7);
bubble.scale = Main.rand.NextFloat(0.6f, 1f);
bubble.type = Main.rand.NextBool(3) ? 412 : 411;
}
// Water trail
for (int i = 0; i < 6; i++)
{
@@ -53,23 +62,11 @@ namespace CalamityMod.Projectiles.Ranged
{
target.AddBuff(BuffID.Wet, 120);
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
//Only increase damage on the first hit
if (Projectile.numHits == 0)
{
Player Owner = Main.player[Projectile.owner];
Owner.Calamity().sharkGunDamageScaling++;
}
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
target.AddBuff(BuffID.Wet, 120);
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
//Only increase damage on the first hit
if (Projectile.numHits == 0)
{
Player Owner = Main.player[Projectile.owner];
Owner.Calamity().sharkGunDamageScaling++;
}
}
}
}
+1 -1
View File
@@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Ranged
framesBetweenShots = 4;
OffsetLengthFromArm -= 3f;
//Here we detect which ammo the bullets will use
Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _, !Main.rand.NextBool(4));
Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _);
//Alternate between shooting bullets and water streams. We seperate it into two different projectiles due to the bullets needing to use a Global Projectile to track the damage multiplier
if (!swapType)
{
+8 -2
View File
@@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Ranged
SoundEngine.PlaySound(SoundID.Item149, Projectile.Center);
if (Main.netMode != NetmodeID.Server)
{
string goreType = Main.rand.NextBool() ? "EmptyAnimosityShell" : "EmptyAnimosityShell2";
string goreType = "SeadragonMag";
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity.RotatedBy(2f * -Owner.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find<ModGore>(goreType).Type);
}
//Set the scaling to 0 whenever it reloads
@@ -74,13 +74,19 @@ namespace CalamityMod.Projectiles.Ranged
framesBetweenShots = 3;
OffsetLengthFromArm -= 2f;
//Here we detect which ammo the bullets will use
Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _, !Main.rand.NextBool(4));
Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _);
//Alternate between shooting bullets and water streams. Despite not having damage scaling, the fish gain movement speed based on the scaling, so we still need a Global Projectile
if (!swapType)
{
Projectile scalingShot = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(1.5f)), bulletAMMO, Projectile.damage, Projectile.knockBack, Projectile.owner);
CalamityGlobalProjectile cgp = scalingShot.Calamity();
cgp.sharkBullets = true;
//Only eject casings from the gun if bullets are fired, preventing too many at once
if (Main.netMode != NetmodeID.Server)
{
string goreType = "SeadragonCasing";
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center + (-Projectile.velocity * 6), -Projectile.velocity * 4f, Mod.Find<ModGore>(goreType).Type);
}
}
if (swapType)
{
+5
View File
@@ -4,6 +4,7 @@ using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Dusts;
using CalamityMod.Packets.Entities;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
@@ -81,6 +82,10 @@ namespace CalamityMod.Projectiles.Ranged
blast.localAI[1] = debuffTime;
blast.timeLeft = 2;
blast.DamageType = Projectile.DamageType;
for (int i = 0; i < 2; i++)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(6f, 6f), ModContent.ProjectileType<RancorFog>(), 0, 0f, Projectile.owner, 0f, 2f);
}
#region Visuals and Sounds
SoundStyle fire = new("CalamityMod/Sounds/Item/OmicronBeam");
SoundEngine.PlaySound(fire with { Volume = 0.9f }, Projectile.Center);
+1 -1
View File
@@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Ranged
framesBetweenShots = 3;
OffsetLengthFromArm -= 2.5f;
//Here we detect which ammo the bullets will use
Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _, !Main.rand.NextBool(4));
Owner.PickAmmo(Owner.HeldItem, out int bulletAMMO, out float SpeedNoUse, out int bulletDamage, out float kBackNoUse, out _);
//Alternate between shooting bullets and void blasts. We seperate it into two different projectiles due to the bullets needing to use a Global Projectile to track the damage multiplier
if (!swapType)
{
@@ -75,7 +75,8 @@ namespace CalamityMod.Systems.Collections
/// Defaults to <see langword="false"/>.
/// </summary>
public static bool[] DoesNotGetHomingWithGrapeBeer = Factory.CreateBoolSet(ProjectileType<NukeOfBliss>(), ProjectileType<PrismaticEnergyBlast>(), ProjectileType<PrismEnergyBullet>(),
ProjectileType<PrismMine>(), ProjectileType<ScorchedEarthRocket>(), ProjectileType<UltimaRay>(), ProjectileType<SproutingArrowMain>());
ProjectileType<PrismMine>(), ProjectileType<ScorchedEarthRocket>(), ProjectileType<UltimaRay>(), ProjectileType<SproutingArrowMain>(), ProjectileType<MegalodonShot>(), ProjectileType<BlahajBlast>(),
ProjectileType<SeaDragonRocket>(), ProjectileType<VoidBlast>(), ProjectileType<AbyssalFire>());
/// <summary>
/// Determines what other projectiles this projectile will share ID-static immunity frames with. Defaults to -1, which means that it does not share immunity frames.<br/>