Titan Arm now properly yeets enemies at the speed of light.

The better Grand Dad
This commit is contained in:
termigator1359 authored and Cameron Ewell committed 2020-12-03 01:10:20 -05:00
1 parent b3700b6eac
commit 65d4aa61ba
1 file changed
+49 -9
+49 -9
View File
@@ -1,4 +1,6 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.NPCs;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -10,28 +12,66 @@ namespace CalamityMod.Items.Weapons.Melee
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Titan Arm");
Tooltip.SetDefault("Slap Hand but better");
Tooltip.SetDefault("Slap Hand but better\n" +
"Sends enemies straight to the stars at the speed of light");
}
public override void SetDefaults()
{
item.width = 46;
item.height = 58;
item.scale = 1.5f;
item.damage = 60;
item.crit += 96; //more knockback huehue
item.scale = 1.5f;
item.knockBack = 20f; //This number doesn't mean anything, but it's not 9001f because that caused bugs.
item.useAnimation = item.useTime = 12;
item.melee = true;
item.useTurn = true;
item.useAnimation = 12;
item.useStyle = ItemUseStyleID.SwingThrow;
item.useTime = 12;
item.knockBack = 9001f;
item.UseSound = SoundID.Item1;
item.autoReuse = true;
item.value = Item.buyPrice(0, 60, 0, 0);
item.useStyle = ItemUseStyleID.SwingThrow;
item.UseSound = SoundID.Item1;
item.rare = 7;
item.value = CalamityGlobalItem.Rarity7BuyPrice;
}
public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit)
{
if (target.knockBackResist <= 0f)
return;
// Manually doing knockback because it is capped in vanilla. This lets Titan Arm reach its full potential. =D
// This is modified vanilla code from StrikeNPC method in NPC.cs
// Extra Note: Will cause an out of bounds error on enemies that don't despawn and are affected. See Blue Cultist Archer.
float kbAmt = knockBack * 9001f * target.knockBackResist; //That obligatory over 9000 reference
if (crit)
kbAmt *= 1.4f;
if (player.direction < 0 && target.velocity.X > -kbAmt)
{
if (target.velocity.X > 0f)
target.velocity.X -= kbAmt;
target.velocity.X -= kbAmt;
if (target.velocity.X < -kbAmt)
target.velocity.X = -kbAmt;
}
else if (player.direction > 0 && target.velocity.X < kbAmt)
{
if (target.velocity.X < 0f)
target.velocity.X += kbAmt;
target.velocity.X += kbAmt;
if (target.velocity.X > kbAmt)
target.velocity.X = kbAmt;
}
float kbAmtY = target.noGravity ? kbAmt * -0.5f : kbAmt * -0.75f;
if (target.velocity.Y > kbAmtY)
{
target.velocity.Y += kbAmtY;
if (target.velocity.Y < kbAmtY)
target.velocity.Y = kbAmtY;
}
}
// Boosting crit in SetDefaults along with knockback seemed to severely inflate the reforging price. Guaranteed crits for more knockback.
public override void GetWeaponCrit(Player player, ref int crit) => crit = 100;
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<AstralInfectionDebuff>(), 120);