Merge branch 'bullet_balancing' into RangerAmmoChanges

This commit is contained in:
Storm2103 committed 2024-02-14 20:01:46 -06:00
commit 334d38dcf1
11 files changed
+280 -43

No files matched your search

+6
View File
@@ -308,6 +308,12 @@ namespace CalamityMod.CalPlayer
cgn.somaShredApplicator = Player.whoAmI;
}
// Similarly, all shots from Animosity are also marked
if (cgp.brimstoneBullets)
{
target.AddBuff(BuffType<BrimstoneFlames>(), 90);
}
ProjLifesteal(target, proj, damageDone, hit.Crit);
ProjOnHit(proj, target.Center, hit.Crit, target.IsAnEnemy(false));
NPCDebuffs(target, proj.CountsAsClass<MeleeDamageClass>(), proj.CountsAsClass<RangedDamageClass>(), proj.CountsAsClass<MagicDamageClass>(), proj.CountsAsClass<SummonDamageClass>(), proj.CountsAsClass<ThrowingDamageClass>(), proj.CountsAsClass<SummonMeleeSpeedDamageClass>(), true, proj.noEnchantments);
+1 -1
View File
@@ -18,7 +18,7 @@ namespace CalamityMod.Items.Ammo
{
Item.width = 8;
Item.height = 8;
Item.damage = 9;
Item.damage = 8;
Item.DamageType = DamageClass.Ranged;
Item.maxStack = 9999;
Item.consumable = true;
+1 -1
View File
@@ -18,7 +18,7 @@ namespace CalamityMod.Items.Ammo
{
Item.width = 8;
Item.height = 8;
Item.damage = 8;
Item.damage = 7;
Item.DamageType = DamageClass.Ranged;
Item.maxStack = 9999;
Item.consumable = true;
+2
View File
@@ -76,10 +76,12 @@ namespace CalamityMod.Items
{ ItemID.Code2, Do(AutoReuse, DamageExact(43)) },
{ ItemID.CorruptYoyo, Do(AutoReuse, DamageExact(20)) }, // Malaise
{ ItemID.CrimsonYoyo, Do(AutoReuse, DamageExact(20)) }, // Artery
{ ItemID.CrystalBullet, Do(DamageExact(8)) },
{ ItemID.CrystalDart, Do(DamageExact(20)) },
{ ItemID.CrystalSerpent, Do(DamageExact(45)) },
{ ItemID.CrystalStorm, Do(DamageExact(40)) },
{ ItemID.CursedArrow, Do(DamageExact(15)) },
{ ItemID.CursedBullet, Do(DamageExact(13)) },
{ ItemID.CursedDart, Do(DamageExact(25)) },
{ ItemID.Cutlass, Do(UseRatio(0.9f), DamageRatio(1.85f)) },
{ ItemID.DaedalusStormbow, Do(DamageExact(30)) },
+136 -37
View File
@@ -1,39 +1,54 @@
using Microsoft.Xna.Framework;
using System;
using CalamityMod.Projectiles;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Ranged
{
public class Animosity : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Ranged";
public override void SetStaticDefaults()
{
ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true;
}
public static readonly SoundStyle ShootAndReloadSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFireAndReload") { PitchVariance = 0.25f };
// Very cool sound and it would be a shame for it to not be used elsewhere, would be even better if a new sound is made
public float SniperDmgMult = 8f;
public float SniperCritMult = 1.2f;
public float SniperVelocityMult = 2f;
public new string LocalizationCategory => "Items.Weapons.Ranged";
//ITS MY REWORK SO I CAN PUT A REFERENCE: Shotgun full of hate, returns Animosity otherwise
public override LocalizedText DisplayName => Main.zenithWorld ? CalamityUtils.GetText("Items.Weapons.Ranged.Animosity.DisplayNameGfb") : CalamityUtils.GetText("Items.Weapons.Ranged.Animosity.DisplayName");
public override void SetStaticDefaults() => ItemID.Sets.ItemsThatAllowRepeatedRightClick[Item.type] = true;
public override void SetDefaults()
{
Item.width = 70;
Item.height = 18;
Item.damage = 33;
Item.damage = 47;
Item.DamageType = DamageClass.Ranged;
Item.useTime = 4;
Item.useAnimation = 12;
Item.reuseDelay = 15;
Item.useLimitPerAnimation = 3;
Item.width = 70;
Item.height = 18;
Item.scale = 0.85f;
Item.useTime = 30;
Item.reuseDelay = 10;
Item.useAnimation = 30;
Item.useStyle = ItemUseStyleID.Shoot;
Item.noMelee = true;
Item.knockBack = 2f;
Item.value = CalamityGlobalItem.Rarity7BuyPrice;
Item.rare = ItemRarityID.Lime;
Item.UseSound = SoundID.Item31;
Item.UseSound = null;
Item.autoReuse = true;
Item.shoot = ProjectileID.PurificationPowder;
Item.shootSpeed = 11f;
Item.shootSpeed = 6.5f;
Item.useAmmo = AmmoID.Bullet;
Item.crit = 8;
Item.Calamity().canFirePointBlankShots = true;
}
@@ -47,48 +62,132 @@ namespace CalamityMod.Items.Weapons.Ranged
return true;
}
public override float UseSpeedMultiplier(Player player)
{
if (player.altFunctionUse == 2)
return 1/2f;
return 1f;
}
public override bool CanUseItem(Player player)
{
if (player.altFunctionUse == 2)
{
Item.useTime = 4;
Item.reuseDelay = 13;
Item.useAnimation = 12;
Item.UseSound = SoundID.Item31;
Item.shootSpeed = 10f;
}
Item.reuseDelay = 5;
else
{
Item.useTime = 35;
Item.reuseDelay = 0;
Item.useAnimation = 35;
Item.UseSound = SoundID.Item40;
Item.shootSpeed = 15f;
}
Item.reuseDelay = 10;
return base.CanUseItem(player);
}
#region Shooting
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
//It should feel powerful but also not too much given feedback
if (player.altFunctionUse == 2)
{
float SpeedX = velocity.X + (float)Main.rand.Next(-10, 11) * 0.05f;
float SpeedY = velocity.Y + (float)Main.rand.Next(-10, 11) * 0.05f;
Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f);
return false;
player.Calamity().GeneralScreenShakePower = 2f;
SoundEngine.PlaySound(ShootAndReloadSound with { PitchVariance = 0.3f }, position);
//Shoot from muzzle
Vector2 nuzzlePos = player.MountedCenter + velocity*4f;
//The dmg mult has to be applied here otherwise the left click gets it instead (for one shot), and the crit needs to be applied down here too cuz otherwise it never affects the weapon
int p = Projectile.NewProjectile(source, nuzzlePos, velocity*SniperVelocityMult, ModContent.ProjectileType<AnimosityBullet>(), (int)(damage*SniperDmgMult), knockback, player.whoAmI);
Main.projectile[p].CritChance = (int)(Main.projectile[p].CritChance * SniperCritMult); //To support crit mults with decimals
if (Main.netMode != NetmodeID.Server)
{
// TO DO: Replace with actual bullet shells or used casings
Gore.NewGore(source, position, velocity.RotatedBy(2f * -player.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find<ModGore>("Polt5").Type);
}
}
else
{
Projectile.NewProjectile(source, position.X, position.Y, velocity.X, velocity.Y, ProjectileID.BulletHighVelocity, (int)(damage * 5.8f), knockback, player.whoAmI, 0f, 0f);
return false;
SoundEngine.PlaySound(SoundID.Item38 with { Volume = 0.8f, Pitch = 0.5f, PitchVariance = 0.3f}, position);
//Shoot from muzzle
Vector2 nuzzlePos = player.MountedCenter + velocity*4f;
// Fire a shotgun spread of bullets.
for (int i = 0; i < 6; ++i)
{
Vector2 randomVelocity = velocity.RotatedByRandom(MathHelper.ToRadians(i * 2.5f));
Projectile shot = Projectile.NewProjectileDirect(source, nuzzlePos, randomVelocity, type, damage, knockback, player.whoAmI);
CalamityGlobalProjectile cgp = shot.Calamity();
cgp.brimstoneBullets = true; //add a brimstone trail to all bullets
}
for (int i = 0; i <= 10; i++)
{
Dust dust = Dust.NewDustPerfect(nuzzlePos, 303, velocity.RotatedByRandom(MathHelper.ToRadians(7f)) * Main.rand.NextFloat(0.05f, 0.4f), 0, default, Main.rand.NextFloat(0.9f, 1.2f));
dust.noGravity = true;
dust.alpha = 150;
}
}
return false;
}
#endregion
#region Animations
public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true;
public override void UseStyle(Player player, Rectangle heldItemFrame)
{
player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X));
float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir;
Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 35f;
Vector2 itemSize = new Vector2(Item.width, Item.height);
Vector2 itemOrigin = new Vector2(-5, 6);
//Sniper's horizontal recoil; can be a bit subtle but it is noticeable
if (player.altFunctionUse == 2)
{
//Recoil:
int anim = 0;
for (int r = 0; r < Item.useAnimation; ++r)
{
if (anim == 10 && r < Item.useAnimation / 2) //animates every 10 frames so that the player notices a recoil because this happens way too fast
{
itemPosition.X -= player.direction * 0.025f;
itemPosition.Y -= player.direction * 0.025f;
anim = 0;
}
else if (anim == 10 && r > Item.useAnimation / 2)
{
itemPosition.X += player.direction * 0.025f;
itemPosition.Y += player.direction * 0.025f;
anim = 0;
}
++anim;
}
}
CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin);
base.UseStyle(player, heldItemFrame);
}
public override bool CanConsumeAmmo(Item ammo, Player player)
// Recoil + Not having the gun aim downwards
public override void UseItemFrame(Player player)
{
if (Main.rand.Next(0, 100) < 50)
return false;
return true;
player.ChangeDir(Math.Sign((player.Calamity().mouseWorld - player.Center).X));
float animProgress = 1 - player.itemTime / (float)player.itemTimeMax;
float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2;
if (animProgress < 0.5)
rotation += (player.altFunctionUse == 2 ? -1f : -0.45f) * (float)Math.Pow((0.5f - animProgress)/0.5f, 2) * player.direction;
player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); //must be here otherwise it will vibrate
//Reloads the gun
if (animProgress > 0.5f)
{
float backArmRotation = rotation + 0.52f * player.direction;
Player.CompositeArmStretchAmount stretch = ((float)Math.Sin(MathHelper.Pi * (animProgress - 0.5f) / 0.36f)).ToStretchAmount();
player.SetCompositeArmBack(true, stretch, backArmRotation);
}
}
#endregion
}
}
@@ -36,11 +36,11 @@ AngelicShotgun: {
Animosity: {
DisplayName: Animosity
DisplayNameGfb: Shotgun Full of Hate
Tooltip:
'''
Fires a powerful sniper round
Press <right> to fire a burst of bullets
50% chance to save ammo
Fires a shotgun blast with a tight spread which is imbued with Brimstone Flames
Press <right> to fire a powerful brimstone round that inflicts Whispering Death
'''
}
@@ -3,6 +3,7 @@ AdamAcceleratorBeam.DisplayName: Adamantite Particle Beam
AMR2.DisplayName: AMR
AMRShot.DisplayName: AMR
AngelicBeam.DisplayName: Angelic Beam
AnimosityBullet.DisplayName: Brimstone Round
AquaBlast.DisplayName: Aqua Blast
AquaBlastToxic.DisplayName: Aqua Blast Toxic
Aquashard.DisplayName: Aquashard
+13
View File
@@ -8,6 +8,7 @@ using CalamityMod.Items.Weapons.Magic;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent.Bestiary;
using Terraria.ID;
using Terraria.ModLoader;
@@ -16,6 +17,8 @@ namespace CalamityMod.NPCs.SulphurousSea
{
public class BelchingCoral : ModNPC
{
public static readonly SoundStyle SAXOPHONE = new("CalamityMod/Sounds/Item/Saxophone/Sax", 6);
public const float CheckDistance = 480f;
public override void SetStaticDefaults()
{
@@ -68,6 +71,16 @@ namespace CalamityMod.NPCs.SulphurousSea
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Top + new Vector2(0f, 6f), velocity, ModContent.ProjectileType<BelchingCoralSpike>(), 27, 3f);
}
}
if (Main.zenithWorld)
{
NPC.ai[1]++;
if (NPC.ai[1] > 27)
{
SoundEngine.PlaySound(SAXOPHONE, NPC.Center);
NPC.ai[1] = 0;
}
}
}
public override float SpawnChance(NPCSpawnInfo spawnInfo)
+19 -1
View File
@@ -9,6 +9,7 @@ using CalamityMod.Items.Accessories;
using CalamityMod.Items.Potions.Alcohol;
using CalamityMod.NPCs;
using CalamityMod.Particles;
using CalamityMod.Projectiles;
using CalamityMod.Projectiles.Boss;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Projectiles.Ranged;
@@ -58,7 +59,7 @@ namespace CalamityMod.Projectiles
// For every 100% critical strike chance over 100%, "supercrit" projectiles do a guaranteed +100% damage.
// They then take the remainder (e.g. the remaining 16%) and roll against that for a final +100% (like normal crits).
// For example if you have 716% critical strike chance, you are guaranteed +700% damage and then have a 16% chance for +800% damage instead.
// These are currently only enabled for Soma Prime, but any bullet fired from that gun can supercrit.
// An example of this is Soma Prime, but any bullet fired from that gun can supercrit when this bool is activated.
// Set this to -1 if you want the projectile to supercrit forever, and to any positive value to make it supercrit only x times
public int supercritHits = 0;
@@ -72,6 +73,9 @@ namespace CalamityMod.Projectiles
// If true, this projectile can apply the infinitely-stacking Shred debuff iconic to Soma Prime.
public bool appliesSomaShred = false;
// Adds Brimstone flames to bullets, currently only used by Animosity
public bool brimstoneBullets = false;
// If true, this projectile creates impact sparks upon hitting enemies
public bool deepcoreBullet = false;
@@ -2719,6 +2723,16 @@ namespace CalamityMod.Projectiles
{
CalamityUtils.HomeInOnNPC(projectile, !projectile.tileCollide, 300f, 12f, 20f);
}
if (brimstoneBullets)
{
PointParticle spark = new PointParticle(projectile.Center + projectile.velocity * 3, projectile.velocity, false, 2, 0.9f, Color.Crimson * 0.7f);
GeneralParticleHandler.SpawnParticle(spark);
Dust dust = Dust.NewDustPerfect(projectile.Center - projectile.velocity, Main.rand.NextBool(3) ? 90 : ModContent.DustType<BrimstoneFlame>(), projectile.velocity * Main.rand.NextFloat(0.05f, 0.9f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.5f, 1f);
}
}
}
#endregion
@@ -2956,6 +2970,10 @@ namespace CalamityMod.Projectiles
}
}
}
//Crystal bullet projectiles deal 50% of the bullet's damage which is absurd in vanilla, this nerfs them to 20%
if (projectile.type == ProjectileID.CrystalShard)
modifiers.SourceDamage *= 0.4f;
}
#endregion
+98
View File
@@ -0,0 +1,98 @@
using Microsoft.Xna.Framework;
using Terraria.Audio;
using Terraria.ID;
using Terraria;
using Terraria.ModLoader;
using CalamityMod.Dusts;
using CalamityMod.Particles;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using Microsoft.CodeAnalysis;
namespace CalamityMod.Projectiles.Ranged
{
internal class AnimosityBullet : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public ref float Time => ref Projectile.ai[0];
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15;
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
}
public override void SetDefaults()
{
Projectile.width = 18;
Projectile.height = 12;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.DamageType = DamageClass.Ranged;
Projectile.penetrate = 1;
Projectile.extraUpdates = 2;
Projectile.timeLeft = 300;
Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration;
}
public override void AI()
{
Projectile.scale = 1.4f;
Projectile.rotation = Projectile.velocity.ToRotation();
Time++;
// Lighting
Lighting.AddLight(Projectile.Center, 0.9f, 0f, 0.15f);
// Visuals
if (Time > 3f)
{
SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 1.8f, -Projectile.velocity * 0.01f, false, 11, 1.6f, Color.Red * 0.65f);
GeneralParticleHandler.SpawnParticle(spark);
}
for (int i = 0; i <= 2; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-0.5f, 0.5f), Main.rand.NextBool(3) ? 90 : 60, -Projectile.velocity.RotatedBy(-0.5) * Main.rand.NextFloat(0.05f, 0.2f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.5f, 1.1f);
Dust dust2 = Dust.NewDustPerfect(Projectile.Center + Projectile.velocity * Main.rand.NextFloat(-0.5f, 0.5f), Main.rand.NextBool(3) ? 90 : 60, -Projectile.velocity.RotatedBy(0.5) * Main.rand.NextFloat(0.05f, 0.2f));
dust2.noGravity = true;
dust2.scale = Main.rand.NextFloat(0.5f, 1.1f);
}
}
public override void Kill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.NPCDeath55 with { Pitch = -0.7f }, Projectile.Center);
//DesertProwelerSkullParticle is a placeholder, maybe replace with evil skull or broken heart (maybe both?, maybe one of Gfb?)
for (int i = 0; i <= 11; i++)
{
Particle skull = new DesertProwlerSkullParticle(Projectile.Center, new Vector2(2.5f, 2.5f).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f), Main.rand.NextBool() ? Color.Crimson : Color.DarkRed, Color.Red, Main.rand.NextFloat(0.2f, 0.9f), 175);
GeneralParticleHandler.SpawnParticle(skull);
}
for (int i = 0; i <= 25; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 90 : 60, new Vector2(0, -5).RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.1f, 1.9f));
dust.noGravity = false;
dust.scale = Main.rand.NextFloat(0.9f, 1.5f);
Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? 90 : 60, new Vector2(0, -2).RotatedByRandom(MathHelper.ToRadians(35f)) * Main.rand.NextFloat(0.1f, 1.9f));
dust2.noGravity = false;
dust2.scale = Main.rand.NextFloat(0.9f, 1.5f);
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 300);
target.AddBuff(ModContent.BuffType<WhisperingDeath>(), 120);
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Crimson * 0.45f, 1);
return true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B