Fixed the interaction between Luxor's Gift and the titanium railgun

This commit is contained in:
NycroV authored and Cameron Ewell committed 2022-06-28 18:38:12 -04:00
1 parent ffa8f6303c
commit e8772b8fa2
2 files changed
+27 -6

No files matched your search

+12 -5
View File
@@ -281,12 +281,19 @@ namespace CalamityMod.Items
}
else if (item.CountsAsClass<RangedDamageClass>())
{
double rangedDamage = newDamage * 0.15;
if (rangedDamage >= 1D)
// This projectile is channeled and has no cooldown unless the gun fires
// The damage of the projectile is also always the max damage of the weapon, and the shot damage is calculated based off of that
// You can see how this may cause issues
// The projectile is fired inside of the scope's code instead
if (type != ModContent.ProjectileType<TitaniumRailgunScope>())
{
int projectile = Projectile.NewProjectile(source, position, velocity * 1.5f, ModContent.ProjectileType<LuxorsGiftRanged>(), (int)rangedDamage, 0f, player.whoAmI);
if (projectile.WithinBounds(Main.maxProjectiles))
Main.projectile[projectile].Calamity().forceClassless = true;
double rangedDamage = newDamage * 0.15;
if (rangedDamage >= 1D)
{
int projectile = Projectile.NewProjectile(source, position, velocity * 1.5f, ModContent.ProjectileType<LuxorsGiftRanged>(), (int)rangedDamage, 0f, player.whoAmI);
if (projectile.WithinBounds(Main.maxProjectiles))
Main.projectile[projectile].Calamity().forceClassless = true;
}
}
}
else if (item.CountsAsClass<MagicDamageClass>())
+15 -1
View File
@@ -113,7 +113,8 @@ namespace CalamityMod.Projectiles.Ranged
Owner.Calamity().GeneralScreenShakePower = 4f * ChargePercent;
// Spawn the laser
Projectile.NewProjectile(new EntitySource_ItemUse_WithAmmo(Owner, Owner.HeldItem, -1), Owner.MountedCenter + direction * WeaponLength, direction, ModContent.ProjectileType<TitaniumRailgunShot>(), (int)(Projectile.damage * ChargePercent), Projectile.knockBack * ChargePercent, Projectile.owner, ai1: ChargePercent);
int shotDamage = (int)(Projectile.damage * ChargePercent);
Projectile.NewProjectile(new EntitySource_ItemUse_WithAmmo(Owner, Owner.HeldItem, -1), Owner.MountedCenter + direction * WeaponLength, direction, ModContent.ProjectileType<TitaniumRailgunShot>(), shotDamage, Projectile.knockBack * ChargePercent, Projectile.owner, ai1: ChargePercent);
// Calculate the target end recoil and initial recoil based off of charge level
// Initial recoil is manually set to give a smoother recoil animation
@@ -129,6 +130,19 @@ namespace CalamityMod.Projectiles.Ranged
// Play a sound with volume scaling with charge percent
SoundEngine.PlaySound(SoundID.Item62 with { Volume = SoundID.Item62.Volume * ChargePercent }, Owner.MountedCenter);
// Summon Luxor's gift manually, as channeling tends to be.... unbalanced, to say the least, if you don't
if (Owner.Calamity().luxorsGift)
{
double rangedDamage = shotDamage * 0.15;
if (rangedDamage >= 1D)
{
float speed = 24f * ChargePercent;
int projectile = Projectile.NewProjectile(new EntitySource_ItemUse_WithAmmo(Owner, Owner.HeldItem, -1), Projectile.Center, direction * speed, ModContent.ProjectileType<LuxorsGiftRanged>(), (int)rangedDamage, 0f, Projectile.owner);
if (projectile.WithinBounds(Main.maxProjectiles))
Main.projectile[projectile].Calamity().forceClassless = true;
}
}
// Set the initial recoil, mark the projectile as fired, and set the target recoil
Owner.itemRotation = initialRecoil;
Charge = -1;