Reworked Fallen Paladin's Hammer

FPH is now thrown like Pwnagehammer and after hitting the enemy will home back in on the player. It no longer explodes on hit, but after three successful hits a phantom hammer will shoot out of the player and fly at the last enemy hit, dealing huge damage and massive AoE.

Also adjusted Pwnagehammer's "gong" to be a bit louder.
This commit is contained in:
Xyk committed 2023-07-17 02:29:58 -07:00
1 parent 6c2e943f48
commit 0bb775f6bb
10 files changed
+331 -95

No files matched your search

+1
View File
@@ -192,6 +192,7 @@ namespace CalamityMod.CalPlayer
#region Timer and Counter
public int gaelSwipes = 0;
public int PHAThammer = 0;
public int gaelRageAttackCooldown = 0;
public int hideOfDeusMeleeBoostTimer = 0;
public int nebulaManaNerfCounter = 0;
+5 -4
View File
@@ -10,16 +10,17 @@ namespace CalamityMod.Items.Weapons.Melee
public class FallenPaladinsHammer : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
public static float Speed = 28.8f;
public override void SetDefaults()
{
Item.width = 14;
Item.damage = 87;
Item.damage = 444;
Item.noMelee = true;
Item.noUseGraphic = true;
Item.autoReuse = true;
Item.useAnimation = 13;
Item.useAnimation = Item.useTime = 57;
Item.useStyle = ItemUseStyleID.Swing;
Item.useTime = 13;
Item.knockBack = 20f;
Item.UseSound = SoundID.Item1;
Item.DamageType = DamageClass.MeleeNoSpeed;
@@ -27,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee
Item.value = CalamityGlobalItem.RarityYellowBuyPrice;
Item.rare = ItemRarityID.Yellow;
Item.shoot = ModContent.ProjectileType<FallenPaladinsHammerProj>();
Item.shootSpeed = 14f;
Item.shootSpeed = Speed;
}
public override void AddRecipes()
@@ -456,7 +456,11 @@ Exoblade: {
FallenPaladinsHammer: {
DisplayName: Fallen Paladin's Hammer
Tooltip: Explodes on enemy hits
Tooltip:
'''
Throws a heavy, gravity-affected hammer that will return to you after striking an enemy
Every third time the hammer returns, a spectral hammer will be summoned which violently explodes upon hitting an enemy
'''
}
FaultLine: {
@@ -349,4 +349,5 @@ SmokingCometYoyo.DisplayName: Smoking Comet
SolarFlareYoyo.DisplayName: Solar Flare
SulphurousGrabberYoyo.DisplayName: Sulphurous Grabber Yoyo
VerdantYoyo.DisplayName: Verdant
YinYoyo.DisplayName: Yin-Yo
YinYoyo.DisplayName: Yin-Yo
FallenPaladinsHammerEcho.DisplayName: Fallen Paladins Hammer Echo
@@ -0,0 +1,154 @@
using System;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Melee
{
public class FallenPaladinsHammerEcho : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public static readonly SoundStyle SlamHamSound = new("CalamityMod/Sounds/Item/FallenPaladinsHammerBigImpact") { Volume = 1f};
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
//This is all copied straight from PwnagehammerEcho with some minor edits.
public override void SetDefaults()
{
Projectile.width = 40;
Projectile.height = 40;
Projectile.aiStyle = 0;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.MeleeNoSpeed;
Projectile.penetrate = 1;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(255, 48, 48, 255);
}
public override void AI()
{
Projectile.ai[0] += 1f;
if (Projectile.ai[0] < 42f)
{
Projectile.velocity *= 0.9575f;
Projectile.rotation += MathHelper.ToRadians(Projectile.ai[0] * 0.5f) * Projectile.localAI[0];
}
else if (Projectile.ai[0] < 44f)
{
Projectile.extraUpdates = 1;
if (Projectile.ai[1] < 0f)
{
Projectile.Kill();
return;
}
NPC target = Main.npc[(int)Projectile.ai[1]];
if (!target.CanBeChasedBy(Projectile, false) || !target.active)
Projectile.Kill();
else
{
float velConst = 12f;
Projectile.velocity = new Vector2((target.Center.X - Projectile.Center.X) / velConst, (target.Center.Y - Projectile.Center.Y) / velConst);
Projectile.rotation += MathHelper.ToRadians(48f) * Projectile.localAI[0];
}
}
if (Main.rand.NextBool(2))
{
Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.position.X, Projectile.position.Y) + offset, DustID.RedTorch, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f);
dust.noGravity = true;
}
if (Main.rand.NextBool(6))
{
Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.position.X, Projectile.position.Y) + offset, DustID.RedTorch, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f);
dust.noGravity = true;
}
}
public override bool? CanHitNPC(NPC target)
{
if (Projectile.ai[0] <= 42f)
return false;
return null;
}
public override bool CanHitPvp(Player target) => Projectile.ai[0] > 42f;
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
Projectile.localAI[0] = target.whoAmI;
}
public override bool PreKill(int timeLeft)
{
Player player = Main.player[Projectile.owner];
//This is what we call fucking IMPACT.
SoundEngine.PlaySound(SlamHamSound, Projectile.Center);
float numberOfDusts = 65f;
float rotFactor = 360f / numberOfDusts;
for (int i = 0; i < numberOfDusts; i++)
{
float rot = MathHelper.ToRadians(i * rotFactor);
Vector2 offset = new Vector2(25f, 0).RotatedBy(rot);
Vector2 velOffset = new Vector2(18.5f, 0).RotatedBy(rot);
int dust = Dust.NewDust(Projectile.position + offset, Projectile.width, Projectile.height, 182, velOffset.X, velOffset.Y);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity = velOffset;
Main.dust[dust].scale = 3.5f;
}
float distance = 168f;
for (int k = 0; k < Main.maxNPCs; k++)
{
NPC npc = Main.npc[k];
Vector2 vec = npc.Center - Projectile.Center;
float distanceTo = (float)Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y);
if (distanceTo < distance && npc.CanBeChasedBy(Projectile, false) && k != Projectile.localAI[0])
{
float alldamage = Projectile.damage * 0.5f;
double damage = npc.StrikeNPC(npc.CalculateHitInfo((int)alldamage, Projectile.velocity.X > 0f ? 1 : -1, true, Projectile.knockBack));
player.addDPS((int)damage);
}
}
return false;
}
public override bool PreDraw(ref Color lightColor)
{
SpriteEffects spriteEffects = SpriteEffects.None;
if (Projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
Rectangle sourceRectangle = new Rectangle(0, 0, texture.Width, texture.Height);
Vector2 origin = sourceRectangle.Size() / 2f;
for (int i = 0; i < Projectile.oldPos.Length; i++)
{
float rot = MathHelper.ToRadians(22.5f) * Math.Sign(Projectile.velocity.X);
Vector2 drawPos = Projectile.oldPos[i] - Main.screenPosition + origin + new Vector2(0f, Projectile.gfxOffY);
Color color = Projectile.GetAlpha(lightColor) * ((Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length);
Main.EntitySpriteDraw(texture, drawPos, new Rectangle?(), color, Projectile.rotation - i * rot, origin, Projectile.scale, spriteEffects, 0);
}
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

+162 -87
View File
@@ -1,7 +1,9 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Projectiles.Melee;
using Microsoft.Xna.Framework;
using System;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -13,6 +15,11 @@ namespace CalamityMod.Projectiles.Melee
{
public new string LocalizationCategory => "Projectiles.Melee";
public override string Texture => "CalamityMod/Items/Weapons/Melee/FallenPaladinsHammer";
public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PwnagehammerSound") { Volume = 0.35f, PitchVariance = 0.3f };
public static readonly SoundStyle HomingSound = new("CalamityMod/Sounds/Item/PwnagehammerHoming") { Volume = 0.3f, PitchVariance = 0.3f };
public static readonly SoundStyle RedHamSound = new("CalamityMod/Sounds/Item/FallenPaladinsHammerClone") { Volume = 1f};
public ref int EmpoweredHammer => ref Main.player[Projectile.owner].Calamity().PHAThammer;
public int returnhammer = 0;
public override void SetStaticDefaults()
{
@@ -28,103 +35,171 @@ namespace CalamityMod.Projectiles.Melee
Projectile.DamageType = DamageClass.MeleeNoSpeed;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.extraUpdates = 2;
Projectile.extraUpdates = 1;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 120;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, 0.35f, 0.35f, 0f);
if (Projectile.soundDelay == 0)
{
Projectile.soundDelay = 8;
SoundEngine.PlaySound(SoundID.Item7, Projectile.position);
}
if (Projectile.ai[0] == 0f)
{
Projectile.ai[1] += 1f;
if (Projectile.ai[1] >= 30f)
{
Projectile.ai[0] = 1f;
Projectile.ai[1] = 0f;
Projectile.netUpdate = true;
}
}
else
{
Projectile.tileCollide = false;
float num42 = 16f;
float num43 = 3.2f;
Vector2 vector2 = new Vector2(Projectile.position.X + Projectile.width * 0.5f, Projectile.position.Y + Projectile.height * 0.5f);
float num44 = Main.player[Projectile.owner].position.X + Main.player[Projectile.owner].width / 2 - vector2.X;
float num45 = Main.player[Projectile.owner].position.Y + Main.player[Projectile.owner].height / 2 - vector2.Y;
float num46 = (float)Math.Sqrt(num44 * num44 + num45 * num45);
if (num46 > 3000f)
Projectile.Kill();
num46 = num42 / num46;
num44 *= num46;
num45 *= num46;
if (Projectile.velocity.X < num44)
{
Projectile.velocity.X = Projectile.velocity.X + num43;
if (Projectile.velocity.X < 0f && num44 > 0f)
Projectile.velocity.X = Projectile.velocity.X + num43;
}
else if (Projectile.velocity.X > num44)
{
Projectile.velocity.X = Projectile.velocity.X - num43;
if (Projectile.velocity.X > 0f && num44 < 0f)
Projectile.velocity.X = Projectile.velocity.X - num43;
}
if (Projectile.velocity.Y < num45)
{
Projectile.velocity.Y = Projectile.velocity.Y + num43;
if (Projectile.velocity.Y < 0f && num45 > 0f)
Projectile.velocity.Y = Projectile.velocity.Y + num43;
}
else if (Projectile.velocity.Y > num45)
{
Projectile.velocity.Y = Projectile.velocity.Y - num43;
if (Projectile.velocity.Y > 0f && num45 < 0f)
Projectile.velocity.Y = Projectile.velocity.Y - num43;
}
if (Main.myPlayer == Projectile.owner)
{
Rectangle rectangle = new Rectangle((int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height);
Rectangle value2 = new Rectangle((int)Main.player[Projectile.owner].position.X, (int)Main.player[Projectile.owner].position.Y, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height);
if (rectangle.Intersects(value2))
Projectile.Kill();
}
}
Projectile.rotation += 0.5f;
}
//returnhammer determines if the hammer is slowing down after hitting an enemy, or homing in o0n the player.
Player player = Main.player[Projectile.owner];
Projectile.direction = Projectile.spriteDirection = Projectile.velocity.X > 0f ? 1 : -1;
Projectile.rotation += MathHelper.ToRadians(22.5f) * Projectile.direction;
public override Color? GetAlpha(Color lightColor)
{
return new Color(250, 250, 250, 50);
}
if (returnhammer == 0)
{
Projectile.velocity.X *= 0.9711f;
Projectile.velocity.Y += 0.426f;
}
if (returnhammer == 1)
{
Projectile.velocity.Y *= 0.896f;
Projectile.velocity.X *= 0.811f;
if (Projectile.velocity.X > -1.05f && Projectile.velocity.X < 1.05f & Projectile.velocity.Y > -1.05f && Projectile.velocity.Y < 1.05f)
returnhammer = 2;
}
if (returnhammer == 2)
{
float returnSpeed = FallenPaladinsHammer.Speed;
float acceleration = 1.1f;
Player owner = Main.player[Projectile.owner];
Vector2 playerCenter = owner.Center;
float xDist = playerCenter.X - Projectile.Center.X;
float yDist = playerCenter.Y - Projectile.Center.Y;
float dist = (float)Math.Sqrt(xDist * xDist + yDist * yDist);
dist = returnSpeed / dist;
xDist *= dist;
yDist *= dist;
if (Projectile.velocity.X < xDist)
{
Projectile.velocity.X = Projectile.velocity.X + acceleration;
if (Projectile.velocity.X < 0f && xDist > 0f)
Projectile.velocity.X += acceleration;
}
else if (Projectile.velocity.X > xDist)
{
Projectile.velocity.X = Projectile.velocity.X - acceleration;
if (Projectile.velocity.X > 0f && xDist < 0f)
Projectile.velocity.X -= acceleration;
}
if (Projectile.velocity.Y < yDist)
{
Projectile.velocity.Y = Projectile.velocity.Y + acceleration;
if (Projectile.velocity.Y < 0f && yDist > 0f)
Projectile.velocity.Y += acceleration;
}
else if (Projectile.velocity.Y > yDist)
{
Projectile.velocity.Y = Projectile.velocity.Y - acceleration;
if (Projectile.velocity.Y > 0f && yDist < 0f)
Projectile.velocity.Y -= acceleration;
}
// Delete the projectile if it touches its owner, increase counter to the big hammer, and spawn a dustsplosion on the player that scales with how close they are to getting a big hammer.
if (Main.myPlayer == Projectile.owner)
{
if (Projectile.Hitbox.Intersects(player.Hitbox))
{
EmpoweredHammer++;
if (EmpoweredHammer == 3)
{
SoundEngine.PlaySound(RedHamSound, Projectile.Center);
for (int i = 0; i < 30; i++)
{
Dust fire = Dust.NewDustPerfect(Projectile.Center, 218);
fire.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.8f) * new Vector2(4f, 1.25f) * Main.rand.NextFloat(0.9f, 1f);
fire.velocity = fire.velocity.RotatedBy(Projectile.rotation - MathHelper.PiOver2);
fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f);
fire.noGravity = true;
fire.scale = Main.rand.NextFloat(0.5f, 1.5f) * EmpoweredHammer;
fire = Dust.CloneDust(fire);
fire.velocity = Main.rand.NextVector2Circular(3f, 3f);
fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f);
}
int hammer = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType<FallenPaladinsHammerEcho>(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner, 0f, Projectile.ai[1]);
Main.projectile[hammer].localAI[0] = Math.Sign(Projectile.velocity.X);
Main.projectile[hammer].netUpdate = true;
EmpoweredHammer = 0;
}
else
{
SoundEngine.PlaySound(SoundID.DD2_BetsysWrathShot with { Volume = 0.4f }, Projectile.Center);
for (int i = 0; i < 30; i++)
{
Dust fire = Dust.NewDustPerfect(Projectile.Center, 218);
fire.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.8f) * new Vector2(4f, 1.25f) * Main.rand.NextFloat(0.9f, 1f);
fire.velocity = fire.velocity.RotatedBy(Projectile.rotation - MathHelper.PiOver2);
fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f);
fire.noGravity = true;
fire.scale = Main.rand.NextFloat(0.5f, 1.5f) * EmpoweredHammer;
fire = Dust.CloneDust(fire);
fire.velocity = Main.rand.NextVector2Circular(3f, 3f);
fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f);
}
}
Projectile.Kill();
}
}
}
//Spawn dust as the hammer travels.
if (Main.rand.NextBool(2))
{
Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.RedTorch, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(205, 38, 38), 2f);
dust.noGravity = true;
}
if (Main.rand.NextBool(6))
{
Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.RedTorch, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(205, 38, 38), 2f);
dust.noGravity = true;
}
}
// On hit play GONG and spawn dust.
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 240);
OnHitEffect();
}
Player player = Main.player[Projectile.owner];
if (returnhammer == 0)
{
SoundEngine.PlaySound(UseSound, Projectile.Center);
returnhammer = 1;
}
float numberOfDusts = 35f;
float rotFactor = 360f / numberOfDusts;
for (int i = 0; i < numberOfDusts; i++)
{
float rot = MathHelper.ToRadians(i * rotFactor);
Vector2 offset = new Vector2(3.6f, 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 4.1f));
Vector2 velOffset = new Vector2(3f, 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 4.1f));
Dust dust = Dust.NewDustPerfect(Projectile.position + offset, 90, new Vector2(velOffset.X, velOffset.Y));
dust.noGravity = true;
dust.velocity = velOffset;
dust.scale = Main.rand.NextFloat(1.5f, 3.2f);
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
SoundEngine.PlaySound(SoundID.Item14 with { Volume = 0.22f }, Projectile.Center);
Projectile.ai[1] = target.whoAmI;
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 240);
OnHitEffect();
Projectile.damage = (int)(Projectile.damage * 0.9f);
if (Projectile.damage < 1)
Projectile.damage = 1;
}
private void OnHitEffect()
{
if (Projectile.owner == Main.myPlayer)
{
int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<FuckYou>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f);
if (proj.WithinBounds(Main.maxProjectiles))
Main.projectile[proj].DamageType = DamageClass.MeleeNoSpeed;
}
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
+2 -2
View File
@@ -13,8 +13,8 @@ namespace CalamityMod.Projectiles.Melee
public new string LocalizationCategory => "Projectiles.Melee";
public override string Texture => "CalamityMod/Items/Weapons/Melee/Pwnagehammer";
public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PwnagehammerSound") { Volume = 0.16f, PitchVariance = 0.16f };
public static readonly SoundStyle HomingSound = new("CalamityMod/Sounds/Item/PwnagehammerHoming") { Volume = 0.3f };
public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PwnagehammerSound") { Volume = 0.3f, PitchVariance = 0.3f };
public static readonly SoundStyle HomingSound = new("CalamityMod/Sounds/Item/PwnagehammerHoming") { Volume = 0.4f };
public override void SetStaticDefaults()
{
Binary file not shown.
Binary file not shown.