Merge pull request #1332 from CalamityTeam/GrandestDad

Grandest Dad
This commit is contained in:
CongratsIsTrash authored and GitHub committed 2026-03-16 19:42:29 -04:00
commit b1080c2d1a
17 files changed
+539 -282

No files matched your search

+3
View File
@@ -361,6 +361,9 @@ namespace CalamityMod.CalPlayer
public int amputatorBuff = 0;
/// <summary> Variable used to track the current fuel amount for Pristine Fury's right-click. </summary>
public int furyFuel = 1800;
/// <summary> Variable to track the healing over time gained from Grand Dad. </summary>
public int grandDadHealPool = 0;
public int grandDadHealTimer = 0;
public const int FuryFuelMax = 1800;
public float furyRefuelTimer = 0;
/// <summary> Variable used to track if Auger can do its big slash attack. </summary>
+9
View File
@@ -342,6 +342,15 @@ namespace CalamityMod.CalPlayer
Player.lifeRegen += 6;
}
if (grandDadHealTimer == 0 && grandDadHealPool >= 7)
{
Player.HealPlayer(7, HealTextType.Broadcast);
grandDadHealPool -= 7;
grandDadHealTimer = (int)(30 * Utils.GetLerpValue(260, 60, grandDadHealPool, true));
}
else if (grandDadHealTimer > 0)
grandDadHealTimer--;
// Grant life regen based on missing health for Radiant Ooze, Ambrosial Ampule, and purity
if (rOoze || aAmpoule || purity)
{
+5
View File
@@ -222,6 +222,11 @@ namespace CalamityMod.CalPlayer
int damage = (int)Player.GetTotalDamage<TrueMeleeDamageClass>().ApplyTo(Player.HeldItem.damage);
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Player.Center.DirectionTo(Player.Calamity().mouseWorld), ModContent.ProjectileType<BasherHoldout>(), damage, Player.HeldItem.knockBack, Player.whoAmI);
}
if (Player.HeldItem.type == ModContent.ItemType<GrandDad>() && (Player.ownedProjectileCounts[ModContent.ProjectileType<GrandDadHoldout>()] == 0))
{
int damage = (int)Player.GetTotalDamage<TrueMeleeDamageClass>().ApplyTo(Player.HeldItem.damage);
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Player.Center.DirectionTo(Player.Calamity().mouseWorld), ModContent.ProjectileType<GrandDadHoldout>(), damage, Player.HeldItem.knockBack, Player.whoAmI);
}
}
// De-equipping Gael's Greatsword deletes all rage.
+2 -2
View File
@@ -57,7 +57,7 @@ namespace CalamityMod.Dusts
public override bool PreDraw(Dust dust)
{
Vector2 baseSize = Vector2.One;
if (dust.customData != null)
if (dust.customData != null && dust.customData is Vector2)
baseSize = (Vector2)dust.customData;
Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1 * baseSize.X, 0.5f * baseSize.X), Utils.Remap(dust.velocity.Length(), 2, 7, 1 * baseSize.Y, 2.5f * baseSize.Y));
@@ -87,7 +87,7 @@ namespace CalamityMod.Dusts
private static void DrawPixelated(Dust dust)
{
Vector2 baseSize = Vector2.One;
if (dust.customData != null)
if (dust.customData != null && dust.customData is Vector2)
baseSize = (Vector2)dust.customData;
Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1 * baseSize.X, 0.5f * baseSize.X), Utils.Remap(dust.velocity.Length(), 2, 7, 1 * baseSize.Y, 2.5f * baseSize.Y));
+44 -11
View File
@@ -31,30 +31,51 @@ namespace CalamityMod.Dusts
public override bool Update(Dust dust)
{
dust.rotation += MathF.Sign(dust.velocity.X);
dust.velocity *= 0.98f;
float fade = (1 + dust.fadeIn);
dust.velocity *= 0.96f;
if (dust.noGravity)
dust.scale += 0.02f;
dust.scale -= 0.05f * fade;
else
dust.scale -= 0.01f;
dust.scale -= 0.065f * fade;
float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f);
if (!dust.noLightEmittence)
Lighting.AddLight(dust.position, dust.color.ToVector3() * light);
if (dust.scale <= 0)
dust.active = false;
return true;
dust.position += dust.velocity;
return false;
}
public override bool MidUpdate(Dust dust)
{
dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2;
return false;
}
public override bool PreDraw(Dust dust)
{
dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2;
Vector2 baseSize = Vector2.One;
bool useSquash = false;
float squashMaxSpeed = 0;
if (dust.customData != null && dust.customData is int)
{
useSquash = true;
squashMaxSpeed = (float)dust.customData;
}
Vector2 squash = useSquash ? new Vector2(Utils.Remap(dust.velocity.Length(), squashMaxSpeed / 4, squashMaxSpeed, 1 * baseSize.X, 0.5f * baseSize.X), Utils.Remap(dust.velocity.Length(), squashMaxSpeed / 4, squashMaxSpeed, 1 * baseSize.Y, 2.5f * baseSize.Y)) : baseSize;
if (!dust.noLight)
{
// Glow Orb
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0);
}
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
return false;
}
}
@@ -65,20 +86,32 @@ namespace CalamityMod.Dusts
public override bool PreDraw(Dust dust)
{
dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2;
PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), GeneralDrawLayer.AfterDusts);
return false;
}
private static void DrawPixelated(Dust dust)
{
Vector2 baseSize = Vector2.One;
bool useSquash = false;
float squashMaxSpeed = 0;
if (dust.customData != null && dust.customData is int)
{
useSquash = true;
squashMaxSpeed = (int)dust.customData;
}
Vector2 squash = useSquash ? new Vector2(Utils.Remap(dust.velocity.Length(), squashMaxSpeed / 4, squashMaxSpeed, 1 * baseSize.X, 0.5f * baseSize.X), Utils.Remap(dust.velocity.Length(), squashMaxSpeed / 4, squashMaxSpeed, 1 * baseSize.Y, 2.5f * baseSize.Y)) : baseSize;
if (!dust.noLight)
{
// Glow Orb
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0);
}
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0);
}
}
}
+16 -13
View File
@@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee
{
Item.width = 124;
Item.height = 124;
Item.damage = 2407; // Feel free to change these 7s as balance requires. The other 7s should stay - Update: no more 2777... :(
Item.damage = 3777; // Feel free to change these 7s as balance requires. The other 7s should stay - Update: no more 2777... :(
Item.DamageType = TrueMeleeDamageClass.Instance;
Item.useAnimation = 77;
Item.useTime = 77;
@@ -56,14 +56,6 @@ namespace CalamityMod.Items.Weapons.Melee
{
list.FindAndReplace("[GFB]", Lang.SupportGlyphs(this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")));
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<MajesticGuard>().
AddIngredient<TwistingNether>(3).
AddTile(TileID.MythrilAnvil).
Register();
}
public override void OnSpawn(IEntitySource source)
{
time = 0;
@@ -95,11 +87,21 @@ namespace CalamityMod.Items.Weapons.Melee
int particleNumber = (int)Math.Max(15 * power, 2);
for (int i = -particleNumber; i <= particleNumber; i++)
{
Particle sparks = new AltSparkParticle(place, (Vector2.UnitX * (5 + Math.Abs(i)) * Math.Sign(i)).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.5f, 1) * power, false, Main.rand.Next(17, 30 + 1), Main.rand.NextFloat(0.2f, 0.8f), Main.rand.NextBool() ? Color.Lerp(Color.Blue, Color.DodgerBlue, 0.3f) : Color.Gold);
GeneralParticleHandler.SpawnParticle(sparks);
Dust dust = Dust.NewDustPerfect(place, ModContent.DustType<VoidDust>(), (Vector2.UnitX * (5 + Math.Abs(i)) * Math.Sign(i)).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.5f, 1) * power, 0, default, Main.rand.NextFloat(0.85f, 1.2f) * power);
if (i % 2 == 0)
{
Vector2 vel = (Vector2.UnitX * (5 + Math.Abs(i)) * Math.Sign(i)).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.5f, 1) * power;
Dust dust2 = Dust.NewDustPerfect(place + vel * 13, ModContent.DustType<SquashDustPixelated>(),
vel, 0, default, Main.rand.NextFloat(1.3f, 1.2f));
dust2.noGravity = true;
dust2.color = Main.rand.NextBool() ? Color.Gold : Color.Goldenrod;
dust2.customData = new Vector2(0.2f, 1.6f);
dust2.fadeIn = 2.5f;
}
Dust dust = Dust.NewDustPerfect(place, ModContent.DustType<VoidDustPixelated>(), (Vector2.UnitX * (5 + Math.Abs(i)) * Math.Sign(i)).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.5f, 1) * power, 0, default, Main.rand.NextFloat(0.85f, 1.2f) * power);
dust.noGravity = true;
dust.color = Main.rand.NextBool() ? Color.Blue : Color.DodgerBlue;
dust.customData = 7;
}
SoundStyle sound = new("CalamityMod/Sounds/NPCHit/ExoHit3");
@@ -130,10 +132,11 @@ namespace CalamityMod.Items.Weapons.Melee
maxFallSpeed = 75;
oldVel = Item.velocity;
}
public override void OnCreated(ItemCreationContext context)
public override bool OnPickup(Player player)
{
if (Main.zenithWorld)
SoundEngine.PlaySound(GrandDadEasterEggSound, Main.LocalPlayer.MountedCenter);
return true;
}
}
}
+11 -1
View File
@@ -1,4 +1,5 @@
using CalamityMod.Projectiles.Melee;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
using Terraria;
@@ -104,5 +105,14 @@ namespace CalamityMod.Items.Weapons.Melee
Projectile.NewProjectile(player.GetSource_ItemUse(Item), target.Center + new Vector2(0, 1300f), velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.9f, 1.1f), ModContent.ProjectileType<GhastlySoulMedium>(), soulDamage, 0f, player.whoAmI, 0f, ai1);
Projectile.NewProjectile(player.GetSource_ItemUse(Item), target.Center + new Vector2(0, 1300f), velocity.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.9f, 1.1f), ModContent.ProjectileType<GhastlySoulSmall>(), soulDamage, 0f, player.whoAmI, 0f, ai1);
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<HellfireFlamberge>().
AddIngredient<Necroplasm>(15).
AddIngredient<RuinousSoul>(3).
AddTile(TileID.MythrilAnvil).
Register();
}
}
}
@@ -669,18 +669,16 @@ GrandDad: {
TooltipNormal:
'''
An unfathomably heavy blade that rips through enemies using its sheer mass
Heals you on hit
Striking weaker enemies will launch them with incredible force
Launched enemies take immense damage when colliding with walls and floors
Holding <right> while swinging will heavily reduce the damage of the blade and increase its launch damage and velocity
Provides healing over time to you and all nearby allies on hit
Striking low health enemies will launch them with incredible force
Launched enemies are killed instantly on impact with walls and floors
[c/00B8DF:'How are you swinging something that has half the mass of a star?']
'''
TooltipGFB:
'''
A high quality blade that rips through enemies
Striking weaker enemies will yeet them with incredible force, often leaving them Stuck Inside tiles
Striking low health enemies will yeet them with incredible force, nice >:]
Yeeted enemies will turn to JAM when SLAMMED into walls and floors
Holding <right> while swinging will heavily reduce the damage of the blade and increase its yeet damage and velocity, nice >:]
[c/00B8DF:'Please read the weapon description.']
'''
}
@@ -146,6 +146,7 @@ TarraEnergy.DisplayName: Tarra Energy
TarragonAura.DisplayName: Tarragon Aura
TatteredFairyDust.DisplayName: Tattered Fairy Dust
TeslaAura.DisplayName: Tesla's Electricity
TileSlamDamage.DisplayName: Grand Damage
TitanHeartBoom.DisplayName: Titan Heart Boom
TransformerAura.DisplayName: Transformer Aura
TransformerBlob.DisplayName: Transformer Shard
+1 -1
View File
@@ -462,9 +462,9 @@ namespace CalamityMod.NPCs.Abyss
// Post-Polterghast: Soul Edge, Eidolic Wail, Stardust Staff
LeadingConditionRule postPolter = new LeadingConditionRule(DropHelper.If(() => DownedBossSystem.downedPolterghast));
aewMinionCondition.Add(postPolter);
postPolter.Add(ModContent.ItemType<VoidEdge>(), 3);
postPolter.Add(ModContent.ItemType<EidolicWail>(), 3);
postPolter.Add(ModContent.ItemType<EidolonStaff>(), 3);
postPolter.Add(ModContent.ItemType<GrandDad>(), 3);
// Post-Leviathan: 6-8 Lumenyl (8-11 on Expert)
LeadingConditionRule postLevi = new LeadingConditionRule(DropHelper.If(() => DownedBossSystem.downedLeviathan));
+68 -14
View File
@@ -1,7 +1,13 @@
using System;
using System.Collections.Generic;
using CalamityMod.Dusts;
using CalamityMod.Enums;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ModLoader;
namespace CalamityMod.NPCs
@@ -30,6 +36,7 @@ namespace CalamityMod.NPCs
private bool hitVoid = false;
private Player attacker;
private int packetTimer = 0;
private bool GrandDad = false;
public int PotentialEnergyDamage
{
@@ -76,12 +83,8 @@ namespace CalamityMod.NPCs
/// <param name="potentialDamage">The maximum fall damage taken by the npc once they hit the ground</param>
/// <param name="terminalVelocityForFullDamage">The downwards velocity necessary to recieve the full fall damage. By default 10, the npc max fall speed</param>
/// <param name="checkTiles">Will check for tiles in the collision instead of velocity</param>
public void ApplyCollisionDamage(NPC npc, Player player, int potentialDamage, Vector2 forcedVel, float terminalVelocityForFullDamage = 10f, bool checkTiles = false)
public void ApplyCollisionDamage(NPC npc, Player player, int potentialDamage, Vector2 forcedVel, float terminalVelocityForFullDamage = 10f, bool checkTiles = false, bool grandDad = false)
{
//NPCs that don't collide with tiles simply don't get fall damage, lol.
if (npc.noTileCollide)
return;
PotentialEnergyDamage = potentialDamage;
OldVelocity = npc.velocity;
OlderVelocity = npc.velocity;
@@ -89,6 +92,7 @@ namespace CalamityMod.NPCs
CheckTiles = checkTiles;
ForcedVel = forcedVel;
attacker = player;
GrandDad = grandDad;
}
/// <summary>
@@ -100,10 +104,6 @@ namespace CalamityMod.NPCs
/// <param name="checkTiles">Will check for tiles in the collision instead of velocity</param>
public void ApplyForcedVelocity(NPC npc, Player player, Vector2 forcedVel, bool checkTiles = false)
{
// NPCs that don't collide with tiles simply don't get velocity, lol.
if (npc.noTileCollide)
return;
OldVelocity = npc.velocity;
OlderVelocity = npc.velocity;
CheckTiles = checkTiles;
@@ -118,17 +118,71 @@ namespace CalamityMod.NPCs
{
if (CheckTiles)
{
float oldVelocity = OldVelocity.Length();
npc.Center += ForcedVel;
ForcedVel *= 0.995f;
Vector2 safeVel = ForcedVel.SafeNormalize(Vector2.UnitX);
if (Collision.SolidCollision(npc.Center, (int)(npc.width * 0.5f), (int)(npc.height * 0.5f)) || !WorldGen.InWorld(npc.Center.ToTileCoordinates().X, npc.Center.ToTileCoordinates().Y, 40))
if (npc.velocity == Vector2.Zero || ForcedVel.Length() < 2 || Collision.SolidCollision(npc.Center, (int)(npc.width * 0.5f), (int)(npc.height * 0.5f)) || !WorldGen.InWorld(npc.Center.ToTileCoordinates().X, npc.Center.ToTileCoordinates().Y, 40))
{
if (!ForceVelocityOnly)
if (!ForceVelocityOnly && potentialEnergyDamage > 0)
{
float oldVelocity = OldVelocity.Length();
if (GrandDad)
{
float scale = (npc.boss ? 1.35f : 1) + Utils.GetLerpValue(20, 800, Math.Max(npc.width, npc.height));
attacker.SetScreenshake(7f * scale);
if (!CalamityClientConfig.Instance.Photosensitivity)
{
Vector2 pulseVel = -safeVel;
Particle pulse1 = new CustomSpark(npc.Center, pulseVel * 2, "CalamityMod/Particles/BloomCircle", false, (int)(23 * MathF.Pow(scale, 2)), 0.6f * MathF.Pow(scale, 2), Color.DodgerBlue, new Vector2(2f, 1f), shrinkSpeed: -0.1f / scale, noShrink: true, glowCenter: true, glowOpacity: 0.8f);
GeneralParticleHandler.SpawnParticle(pulse1);
pulse1.Pixelate = true;
Particle pulse2 = new CustomSpark(npc.Center, pulseVel, "CalamityMod/Particles/BloomRing", false, (int)(18 * MathF.Pow(scale, 2)), 0.5f * MathF.Pow(scale, 2), Color.Blue, new Vector2(4f, 0.7f), shrinkSpeed: -0.3f / scale, noShrink: true);
GeneralParticleHandler.SpawnParticle(pulse2);
pulse2.Pixelate = true;
}
for (int i = 0; i < 2; i++)
{
SoundStyle die = new("CalamityMod/Sounds/Item/HolyFireBulletExplosion");
SoundEngine.PlaySound(die with { Pitch = 0.5f, Volume = Math.Min(0.6f * scale, 1f), MaxInstances = 2 }, npc.Center);
if (npc.boss)
{
SoundStyle dieHard = new("CalamityMod/Sounds/Item/HellkiteSmallHit3");
SoundEngine.PlaySound(dieHard with { Pitch = -1f, Volume = Math.Min(0.5f * scale, 1f), MaxInstances = 2 }, npc.Center);
}
SoundStyle dieHarder = new("CalamityMod/Sounds/Item/HeliumFlashCoreImpact");
SoundEngine.PlaySound(dieHarder with { Pitch = -1.8f, Volume = Math.Min(0.6f * scale, 1f), MaxInstances = 2 }, npc.Center);
}
for (int i = 0; i < 30; i++)
{
float variance = Main.rand.NextFloat(-0.8f, 0.8f);
Dust dust = Dust.NewDustPerfect(npc.Center, ModContent.DustType<VoidDustPixelated>(),
-safeVel.RotatedBy(variance * 2).RotatedByRandom(MathF.Abs(variance) / 3) * scale * Main.rand.NextFloat(30.0f, 33.0f) * MathF.Pow((1 - MathF.Abs(variance)), 2), 0, default, scale * Main.rand.NextFloat(2.3f, 3.2f) - MathF.Abs(variance));
dust.noGravity = true;
dust.color = Main.rand.NextBool() ? Color.DodgerBlue : Color.Blue;
dust.customData = 2;
dust.fadeIn = 0.5f * scale;
}
for (int i = 0; i < 15; i++)
{
float variance = Main.rand.NextFloat(-0.8f, 0.8f);
Vector2 vel = -safeVel.RotatedBy(variance / 2).RotatedByRandom(MathF.Abs(variance) / 3) * Main.rand.NextFloat(20.0f, 23.0f) * MathF.Pow((1 - MathF.Abs(variance)), 2);
Dust dust2 = Dust.NewDustPerfect(npc.Center + vel * 13, ModContent.DustType<SquashDustPixelated>(),
vel, 0, default, 2 * Main.rand.NextFloat(2.3f, 3.2f) - MathF.Abs(variance));
dust2.noGravity = true;
dust2.color = Main.rand.NextBool() ? Color.Gold : Color.Goldenrod;
dust2.customData = new Vector2(0.2f, 1.6f);
dust2.fadeIn = 2.5f;
}
}
bool instakill = (GrandDad && potentialEnergyDamage != 1);
int wallImpactDamage = (int)(PotentialEnergyDamage * Math.Clamp(oldVelocity / terminalVelocityForFullFallDamage, (ForcedVel.Length() > 0 ? 1f : 0f), 1f));
Projectile wallImpact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), wallImpactDamage, 0f, attacker.whoAmI, npc.whoAmI);
Projectile wallImpact = Projectile.NewProjectileDirect(attacker.GetSource_FromThis(), npc.Center, Vector2.Zero, instakill ? ModContent.ProjectileType<TileSlamDamage>() : ModContent.ProjectileType<DirectStrike>(), wallImpactDamage, 0f, attacker.whoAmI, npc.whoAmI);
wallImpact.DamageType = DamageClass.Melee;
wallImpact.CritChance = (int)attacker.GetCritChance(DamageClass.Melee) + attacker.HeldItem.crit;
}
+1 -1
View File
@@ -1492,7 +1492,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm
public override void ModifyNPCLoot(NPCLoot npcLoot)
{
npcLoot.Add(ModContent.ItemType<EidolicWail>());
npcLoot.Add(ModContent.ItemType<VoidEdge>());
npcLoot.Add(ModContent.ItemType<GrandDad>());
npcLoot.Add(ModContent.ItemType<HalibutCannon>());
npcLoot.Add(ModContent.ItemType<AbyssShellFossil>());
npcLoot.Add(ModContent.ItemType<Voidstone>(), 1, 80, 100);
Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

+20 -5
View File
@@ -1,4 +1,5 @@
using System;
using CalamityMod.Systems.Graphic.PixelationSystem;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -22,13 +23,14 @@ namespace CalamityMod.Particles
public bool FlipHorizontal = false;
public bool NoShrink = false;
public float Spin = 0;
public float ColorFadeSpeed = 0;
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public bool AltVisual = true;
public override bool UseAdditiveBlend => AltVisual;
public override bool SetLifetime => true;
public override bool UseCustomDraw => true;
public CustomSpark(Vector2 relativePosition, Vector2 velocity, string texture, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0, float glowCenterScale = 1, float glowOpacity = 1, bool flipHorizontal = false, bool noShrink = false, float spin = 0)
public CustomSpark(Vector2 relativePosition, Vector2 velocity, string texture, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0, float glowCenterScale = 1, float glowOpacity = 1, bool flipHorizontal = false, bool noShrink = false, float spin = 0, float colorFadeSpeed = 3)
{
Position = relativePosition;
Velocity = velocity;
@@ -55,6 +57,7 @@ namespace CalamityMod.Particles
if (FadeIn)
Scale = 0f;
Spin = spin;
ColorFadeSpeed = colorFadeSpeed;
}
public override void Update()
@@ -63,7 +66,7 @@ namespace CalamityMod.Particles
{
if (!NoShrink)
Scale *= 0.95f;
Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D));
Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, ColorFadeSpeed));
}
else
{
@@ -114,9 +117,21 @@ namespace CalamityMod.Particles
col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGB(Color);
}
spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)), Rotation, texture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f);
if (GlowCenter)
spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(Color.Lerp(col, Color.White, 0.8f), Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)) * GlowOpacity, Rotation, texture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
if (Pixelate)
{
PixelationManager.AddPixelatedDrawer((_) =>
{
spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)), Rotation, texture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f);
if (GlowCenter)
spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(Color.Lerp(col, Color.White, 0.8f), Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)) * GlowOpacity, Rotation, texture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
}, Enums.GeneralDrawLayer.AfterProjectiles, UseAdditiveBlend ? BlendState.Additive : null);
}
else
{
spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)), Rotation, texture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f);
if (GlowCenter)
spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(Color.Lerp(col, Color.White, 0.8f), Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)) * GlowOpacity, Rotation, texture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
}
}
}
}
+4 -1
View File
@@ -56,6 +56,8 @@ namespace CalamityMod.Projectiles.Melee
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
Projectile.noEnchantmentVisuals = true;
Projectile.scale = 0;
}
public void OnSpawn()
{
@@ -99,7 +101,7 @@ namespace CalamityMod.Projectiles.Melee
if (!Owner.CantUseHoldout(false))
Projectile.timeLeft = 5;
Projectile.scale = Owner.GetMeleeScale() + 0.1f;
Projectile.scale = MathHelper.Lerp(Projectile.scale, Owner.GetMeleeScale() + 0.1f, 0.3f / Projectile.MaxUpdates);
toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld());
Positioning(toMouse);
@@ -125,6 +127,7 @@ namespace CalamityMod.Projectiles.Melee
}
else
Owner.itemTime = Owner.itemAnimation = 5;
#region Not Swinging
if (attackTimer < 0) // When the sword isn't swinging
{
+322 -227
View File
@@ -1,223 +1,270 @@
using CalamityMod.Dusts;
using System;
using System.Collections.Generic;
using CalamityMod.Dusts;
using CalamityMod.Enums;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.NPCs;
using CalamityMod.NPCs.PrimordialWyrm;
using CalamityMod.Particles;
using CalamityMod.Projectiles.BaseProjectiles;
using CalamityMod.Systems.Graphic.PixelationSystem;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
using static Terraria.Player;
namespace CalamityMod.Projectiles.Melee
{
[PierceResistException]
public class GrandDadHoldout : BaseCustomUseStyleProjectile, ILocalizedModType
public class GrandDadHoldout : ModProjectile, ILocalizedModType
{
public override int AssignedItemID => ModContent.ItemType<GrandDad>();
public override LocalizedText DisplayName => CalamityUtils.GetItemName<GrandDad>();
public override string Texture => "CalamityMod/Items/Weapons/Melee/GrandDad";
public override float HitboxOutset => 125;
public override Vector2 HitboxSize => new Vector2(190, 190);
public override float HitboxRotationOffset => MathHelper.ToRadians(-45);
public override Vector2 SpriteOrigin => new(0, 124);
public Vector2 mousePos;
public Vector2 aimVel;
public bool doSwing = true;
public bool postSwing = false;
public float fadeIn = 0;
public int useAnim;
public int swingCount;
public bool finalFlip = false;
public bool swingSound = true;
public ref float attackTimer => ref Projectile.ai[0];
public Player Owner => Main.player[Projectile.owner];
public int fireRate => (int)((Owner.HeldItem.useAnimation * Owner.inverseMeleeSpeed * Projectile.MaxUpdates) / 2.75f);
public int time = 0;
public Vector2 toMouse = Vector2.Zero;
public int cooldown => (int)(-Owner.HeldItem.useAnimation * Owner.inverseMeleeSpeed * Projectile.MaxUpdates);
public float bladeRot = 0; // Rotation of the blade
public int swingCount = 0; // Increases at the start of a swing
public float bladefx = 0; // Visual effects of the blade
// Checks to make sure sounds only happen once per swing
public bool makeSound = true;
public bool performSwing = false;
public float enabledHitbox = 0; // Deals damage when above 0, ticks down quickly
public float angledHold = 0; // Adds some angle based on swing direction
public float angleArmHold = 0;
public static int hitboxFramesMax = 11;
public bool canReleaseHoldout = false;
public int armoredHits = 0;
private NPC target => Main.npc[(int)Projectile.ai[0]];
public float startAngle = MathHelper.Pi * 0.9f;
public float endAngle = -MathHelper.PiOver4 * 3 * 0.9f;
public override bool? CanDamage() => enabledHitbox > 0 ? null : false;
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
float outset = 40 * Projectile.scale;
Vector2 hitboxPosition = Owner.Center + toMouse * outset;
float hitboxSize = 155 * Projectile.scale;
return CalamityUtils.CircularHitboxCollision(hitboxPosition, hitboxSize, targetHitbox);
}
public override void SetDefaults()
{
base.SetDefaults();
Projectile.width = Projectile.height = 124;
Projectile.friendly = true;
Projectile.DamageType = TrueMeleeDamageClass.Instance;
Projectile.timeLeft = 5;
Projectile.penetrate = -1;
Projectile.extraUpdates = 8;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
Projectile.DamageType = TrueMeleeDamageClass.Instance;
Projectile.noEnchantmentVisuals = true;
Projectile.scale = 0;
}
public override void WhenSpawned()
public void OnSpawn()
{
Projectile.timeLeft = Owner.HeldItem.useAnimation + 1;
Projectile.knockBack = 0;
Projectile.scale = 1;
Projectile.ai[1] = -1;
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Grand Dad has no projectiles
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
useAnim = Owner.itemAnimationMax;
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
FlipAsSword = Owner.direction == -1;
}
public override void UseStyle()
{
AnimationProgress = Animation % useAnim;
DrawUnconditionally = false;
if (CanHit || postSwing)
mousePos = Owner.Center - aimVel;
else
if (time == 0)
{
mousePos = Owner.Calamity().mouseWorld;
Projectile.knockBack = 0;
attackTimer = cooldown;
swingCount = 1;
}
}
public void ResetVariables() // After a swing, reset/adjust many stats
{
for (int i = 0; i < Main.maxNPCs; i++)
Projectile.localNPCImmunity[i] = 0;
Projectile.numHits = 0;
swingCount++;
makeSound = true;
enabledHitbox = 0;
canReleaseHoldout = false;
armoredHits = 0;
Projectile.ForceNetUpdate();
}
public void Positioning(Vector2 toMouse) // Hand and holdout positioning
{
Owner.heldProj = Projectile.whoAmI;
Owner.itemRotation = (Projectile.velocity * Owner.direction).ToRotation();
if (CanHit)
fadeIn = MathHelper.Lerp(fadeIn, 1, 0.3f);
else
fadeIn = MathHelper.Lerp(fadeIn, 0, 0.35f);
angleArmHold = MathHelper.Lerp(angleArmHold, angledHold * MathF.Pow(Utils.GetLerpValue(cooldown, cooldown * 0.35f, attackTimer, true), 5), 0.12f / Projectile.MaxUpdates * Owner.meleeSpeed);
float angleVariation = (float)Math.Sin(time * 0.04f / Projectile.MaxUpdates) * 0.05f;
float outwardDistance = 5;
Owner.ChangeDir(Math.Sign(toMouse.X));
Owner.SetCompositeArmFront(true, CompositeArmStretchAmount.Full, (toMouse.ToRotation() + (bladeRot + angleArmHold + angleVariation) * Owner.direction + MathHelper.PiOver2 * -Owner.direction) + (Owner.direction == -1 ? MathHelper.Pi : 0));
Vector2 handPos = Owner.GetFrontHandPosition(CompositeArmStretchAmount.None, Owner.compositeFrontArm.rotation) + (Owner.compositeFrontArm.rotation + MathHelper.PiOver2).ToRotationVector2() * outwardDistance;
float armRotation = (Utils.DirectionTo(Owner.Center, handPos).ToRotation() - MathHelper.PiOver2) * Owner.gravDir + (Owner.gravDir == -1 ? MathHelper.Pi : 0f);
Owner.SetCompositeArmBack(true, CompositeArmStretchAmount.Full, armRotation);
if (!doSwing)
Projectile.velocity = toMouse.RotatedBy((bladeRot + angledHold + angleVariation) * Owner.direction);
Projectile.rotation = Projectile.velocity.ToRotation();
Projectile.Center = handPos;
}
public override void AI()
{
if (!Owner.CantUseHoldout(false))
Projectile.timeLeft = 5;
Projectile.scale = MathHelper.Lerp(Projectile.scale, Owner.GetMeleeScale(), 0.3f / Projectile.MaxUpdates);
toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld());
Positioning(toMouse);
OnSpawn();
bool fadeInFX = enabledHitbox > (int)(hitboxFramesMax / 3f);
if (enabledHitbox > 0)
{
for (int i = 0; i < Main.maxNPCs; i++)
Projectile.localNPCImmunity[i] = 0;
if (Projectile.FinalExtraUpdate())
enabledHitbox--;
}
if (fadeInFX)
bladefx = MathHelper.Lerp(bladefx, 1, 0.25f / Projectile.MaxUpdates * Owner.meleeSpeed);
else
bladefx = MathHelper.Lerp(bladefx, 0, 0.15f / Projectile.MaxUpdates * Owner.meleeSpeed);
Projectile.numHits = 0;
mousePos = Owner.Calamity().mouseWorld;
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
CanHit = false;
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
FlipAsSword = Owner.direction == -1;
doSwing = true;
swingCount++;
finalFlip = false;
swingSound = true;
armoredHits = 0;
if (canReleaseHoldout || time < 25)
{
if (Owner.HeldItem.type != ItemType<GrandDad>() || Main.mapFullscreen || Owner.mouseInterface || Owner.dead)
{
Projectile.Kill();
return;
}
}
else
Owner.itemTime = Owner.itemAnimation = 5;
float lerpSpeed = 0.1f / Projectile.MaxUpdates * Owner.meleeSpeed;
float maxAngle = MathHelper.PiOver4 * 0.8f;
if (swingCount % 2 == 0)
angledHold = MathHelper.Lerp(angledHold, maxAngle, lerpSpeed);
else
angledHold = MathHelper.Lerp(angledHold, -maxAngle, lerpSpeed);
#region Not Swinging
if (attackTimer < 0) // When the sword isn't swinging
{
if (!CanHit && !postSwing)
Timers();
float lerp = Utils.GetLerpValue(cooldown, -1, attackTimer, true);
if (attackTimer == 0) // Reset a few things in prep for the next swing
ResetVariables();
else // Wind up animation in prep for the next swing
{
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
}
else
{
if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
}
int swingDir = (swingCount % 2 != 0 ? 1 : -1);
float lerp2 = Utils.GetLerpValue(cooldown, -1, attackTimer, true);
float start = -startAngle * swingDir;
float end = endAngle * swingDir;
bladeRot = MathHelper.Lerp(start, end, CalamityUtils.EaseInOutExp(lerp2, 2f, 2f));
Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f);
if (AnimationProgress < (useAnim / 1.5f))
{
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
CanHit = false;
postSwing = false;
if (AnimationProgress == 0)
if (lerp >= 0.85f)
{
doSwing = false;
Projectile.ai[1] = -Projectile.ai[1];
}
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.8f, useAnim, Animation, true)) * 0.35f)), 0.2f);
}
else
{
if (!finalFlip)
{
FlipAsSword = Owner.direction < 0;
}
float time = (AnimationProgress) - (useAnim / 3);
float timeMax = useAnim - (useAnim / 3);
if (time >= (int)(timeMax * 0.4f) && swingSound)
{
SoundStyle fire = new("CalamityMod/Sounds/Item/HeavySwing");
SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.2f, 0.32f) }, Projectile.Center);
swingSound = false;
}
if (time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f))
{
CanHit = true;
for (int i = 0; i < 3; i++)
if (Owner.controlUseItem || performSwing)
performSwing = true;
else
{
Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45));
Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 165), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)));
GeneralParticleHandler.SpawnParticle(new LineParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, false, 19, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue));
GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, Main.rand.NextBool(4) ? Color.Black : Color.DarkBlue, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f));
}
}
else
CanHit = false;
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))),
0.2f);
if (time >= timeMax)
doSwing = false;
if (time < (int)(timeMax * 0.7f))
postSwing = true;
if (CanHit)
{
for (int i = 0; i < 6; i++)
{
if (Main.rand.NextBool(3))
{
Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType<VoidDust>(), Vector2.Zero, 0, default, Main.rand.NextFloat(1.15f, 1.5f));
dust.noGravity = true;
dust.color = Color.DodgerBlue;
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, false, 23, Main.rand.NextFloat(0.5f, 1f), Color.Black, false, false, false));
}
else
{
Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType<LightDust>(), Vector2.Zero, 0, default, Main.rand.NextFloat(1.15f, 1.5f));
dust.noGravity = true;
dust.color = Color.Blue;
GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, false, 23, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue));
}
}
for (int i = 0; i < 3; i++)
{
float randRot = Main.rand.NextFloat(-30, -60);
Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot));
Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(185, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), DustID.FireworksRGB, dustVel * Main.rand.NextFloat(0.1f, 0.5f));
dust2.scale = Main.rand.NextFloat(0.55f, 1.05f);
dust2.noGravity = true;
dust2.color = Main.rand.NextBool(3) ? Color.Goldenrod : Color.Gold;
canReleaseHoldout = true;
attackTimer--;
lerp = 0.85f;
}
}
}
if (lerp > 0.85f)
{
angledHold = MathHelper.Lerp(angledHold, maxAngle * 3.5f * (swingCount % 2 == 0 ? 1 : -1), lerpSpeed * 1.5f);
}
return;
}
#endregion
ArmRotationOffset = MathHelper.ToRadians(-140f);
ArmRotationOffsetBack = MathHelper.ToRadians(-140f);
if (attackTimer >= fireRate) // Once the swing is done, put it on cooldown
{
attackTimer = cooldown;
performSwing = false;
}
else // Do the swing
{
#region Swinging
int swingDir = (swingCount % 2 != 0 ? -1 : 1);
float lerp = Utils.GetLerpValue(0, fireRate - 1, attackTimer, true);
float start = endAngle * swingDir;
float end = startAngle * swingDir;
bladeRot = MathHelper.Lerp(start, end, CalamityUtils.EaseInOutExp(lerp, 11f, 11f));
if (lerp > 0.3f && lerp < 0.8f && Main.rand.NextBool((int)(1 + 4 * Projectile.MaxUpdates * Math.Abs(Utils.GetLerpValue(0.5f, 1.2f, lerp)))))
{
Vector2 dustPosition = Projectile.Center + Projectile.velocity * 170 * Projectile.scale;
Vector2 dustPosition2 = Projectile.Center + Projectile.velocity.RotatedByRandom(0.3f) * 170 * Projectile.scale;
Vector2 swingVel = Projectile.velocity.RotatedBy(MathHelper.PiOver2 * (swingCount % 2 == 0 ? 1 : -1) * Owner.direction);
Dust dust = Dust.NewDustPerfect(dustPosition, ModContent.DustType<VoidDustPixelated>(),
swingVel.RotatedByRandom(0.1f) * Main.rand.NextFloat(9.5f, 15.5f), 0, default, Main.rand.NextFloat(1.55f, 2.2f));
dust.noGravity = true;
dust.color = Main.rand.NextBool() ? Color.DodgerBlue : Color.Blue;
dust.customData = 7;
if (Main.rand.NextBool(3, 4))
{
Vector2 vel = swingVel.RotatedByRandom(0.1f) * Main.rand.NextFloat(9.5f, 15.5f);
Dust dust2 = Dust.NewDustPerfect(dustPosition2, ModContent.DustType<SquashDustPixelated>(),
vel, 0, default, 2 * Main.rand.NextFloat(1.0f, 1.3f));
dust2.noGravity = true;
dust2.color = Main.rand.NextBool() ? Color.Gold : Color.Goldenrod;
dust2.customData = new Vector2(0.2f, 1.0f);
dust2.fadeIn = 0.2f;
}
}
if (lerp > 0.4f) // Partway through make the hitbox and sound
{
if (makeSound)
{
enabledHitbox = hitboxFramesMax;
SoundStyle swing1 = new("CalamityMod/Sounds/Item/HeavySwing");
SoundEngine.PlaySound(swing1 with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.2f, 0.32f) }, Projectile.Center);
makeSound = false;
}
}
#endregion
}
Timers();
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
public void Timers()
{
if ((target.life <= 0 && target.realLife == -1) && Projectile.numHits > 0)
Projectile.numHits -= 1;
if (damageDone <= 2)
time++;
// Only increment the attack animation when on cooldown or when allowed to swing
if ((attackTimer < fireRate && performSwing) || attackTimer < -1)
attackTimer++;
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
// Dont increment numHits on armored targets or kills
if (((target.life <= 0 && target.realLife == -1) || target.Calamity().IsArmored()))
armoredHits++;
if (Main.zenithWorld && Projectile.numHits == 0 && target.type != ModContent.NPCType<PrimordialWyrmHead>() && Main.rand.NextBool(5))
float distanceToTiles = -100;
bool canBeLaunched = false;
bool lowEnoughToExecute = target.life <= Projectile.damage * 15;
bool jared = target.type == ModContent.NPCType<PrimordialWyrmHead>();
Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
Vector2 launchVel = lowEnoughToExecute ? toMouse : Utils.DirectionTo(Owner.Center, target.Center);
if (lowEnoughToExecute || jared)
{
SoundStyle fire3 = new("CalamityMod/Sounds/Item/GFBScreams/Scream", 8);
SoundEngine.PlaySound(fire3 with { Volume = 0.8f }, Projectile.Center);
distanceToTiles = CalamityUtils.DistanceToTileCollisionHit(target.Center, launchVel, 200) ?? -100;
canBeLaunched = jared || ((distanceToTiles == -100 ? false : distanceToTiles < 200 ? true : false) && target.realLife == -1);
}
if (Projectile.numHits == 0)
{
@@ -227,60 +274,81 @@ namespace CalamityMod.Projectiles.Melee
SoundStyle fire2 = new("CalamityMod/Sounds/Item/FinalDawnSlash");
SoundEngine.PlaySound(fire2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.2f, -0.3f) }, Projectile.Center);
}
int heal = (int)(MathHelper.Clamp(20 - Projectile.numHits * 12, 1, 20));
int heal = (int)(MathHelper.Clamp(18 - Projectile.numHits * 13, 1, 20));
if (Projectile.numHits < 10)
{
Owner.DoLifestealDirect(target, heal, 0.5f);
Owner.Calamity().grandDadHealPool += heal;
// Give partial Grand Dad healing to all nearby players
for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++)
{
Player player = Main.player[playerIndex];
float targetDist = player.Center.DistanceSQ(Owner.Center);
if (targetDist < 500f && player.team == Owner.team && player != Owner)
{
player.Calamity().grandDadHealPool += (int)(heal / 2);
}
}
}
if (target.CanBeMoved(true) || Main.zenithWorld || target.type == ModContent.NPCType<PrimordialWyrmHead>() || (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs))
// Regular knockback
float launchPower = 60;
target.MoveNPC(toMouse, launchPower * (canBeLaunched ? 0.5f : 0.25f), true);
if (canBeLaunched) // launches/executes enemies
{
if (target.type == ModContent.NPCType<PrimordialWyrmHead>())
if (jared)
{
CombatText.NewText(target.Hitbox, Color.Aqua, CalamityUtils.GetTextValue("Misc.HecBoop"));
SoundStyle boop = new("CalamityMod/Sounds/Item/SnootBooped");
SoundEngine.PlaySound(boop with { Pitch = Main.rand.NextFloat(-0.15f, 0.15f) }, Projectile.Center);
}
bool rightClicked = Owner.Calamity().mouseRight;
target.Calamity().pacified = true;
// Make all hit enemies able to hit tiles, so you can dunk them
target.noTileCollide = false;
// Launch the suckers
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
float launchPower = 30 * (rightClicked ? 2 : 1);
target.MoveNPC(launchVel, launchPower * 0.5f, true);
// Remove knockback resist, just like it used to
target.knockBackResist = 1;
// Apply tile collison damage (is boosted even further if both final bosses are gone)
float damageMults = ((DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs) ? 5 : 1) * (rightClicked ? 3 : 1);
int damage = (int)(Projectile.damage * damageMults);
target.GetGlobalNPC<CalamityTileCollisionHarmNPC>().ApplyCollisionDamage(target, Owner, damage, launchVel * launchPower, 5f, true);
// Apply tile collison damage and forced velocity to launch the suckers
// This always kills (unless it's Jared)
int damage = (int)(Projectile.damage);
target.GetGlobalNPC<CalamityTileCollisionHarmNPC>().ApplyCollisionDamage(target, Owner, (jared && !lowEnoughToExecute) ? 1 : damage, launchVel * launchPower, 5f, true, true);
}
if (Projectile.numHits < 3)
{
Particle spark = new VoidSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * (-45 + Projectile.numHits * 5), false, (int)(16 - Projectile.numHits * 3), 0.6f - Projectile.numHits * 0.15f, Color.DodgerBlue, 0.45f);
GeneralParticleHandler.SpawnParticle(spark);
for (int i = 0; i < 2; i++)
{
Particle spark = new CustomSpark(target.Center, launchVel * 65, "CalamityMod/Particles/GlowSpark2", false, (int)(16 - Projectile.numHits * 3), 0.145f - Projectile.numHits * 0.015f, Color.Black, new Vector2(2f, 1f), false, shrinkSpeed: 1f, colorFadeSpeed: 10);
GeneralParticleHandler.SpawnParticle(spark);
spark.Pixelate = true;
Particle spark2 = new CustomSpark(target.Center, launchVel * 65, "CalamityMod/Particles/GlowSpark", false, (int)(16 - Projectile.numHits * 3), 0.105f - Projectile.numHits * 0.015f, Color.Lerp(Color.Blue, Color.DodgerBlue, 0.65f), new Vector2(2f, 1f), true, false, shrinkSpeed: 1f, colorFadeSpeed: 10);
GeneralParticleHandler.SpawnParticle(spark2);
spark2.Pixelate = true;
spark2.DrawLayer = GeneralDrawLayer.AfterEverything;
}
for (int i = 0; i < 25 - Projectile.numHits * 3; i++)
{
float hitMult = 1 - 0.15f * Projectile.numHits;
float variance = Main.rand.NextFloat(-0.6f, 0.6f);
Dust dust = Dust.NewDustPerfect(target.Center, ModContent.DustType<VoidDustPixelated>(),
launchVel.RotatedBy(variance / 2).RotatedByRandom(MathF.Abs(variance) / 3) * Main.rand.NextFloat(30.0f, 33.0f) * hitMult * MathF.Pow((1 - MathF.Abs(variance)), 2), 0, default, 3 * hitMult * Main.rand.NextFloat(2.3f, 3.2f) - MathF.Abs(variance));
dust.noGravity = true;
dust.color = Main.rand.NextBool() ? Color.DodgerBlue : Color.Blue;
dust.customData = 3;
dust.fadeIn = 2.1f;
if (i % 2 == 0)
{
Vector2 vel = launchVel.RotatedBy(variance / 2).RotatedByRandom(MathF.Abs(variance) / 3) * Main.rand.NextFloat(20.0f, 23.0f) * hitMult * MathF.Pow((1 - MathF.Abs(variance)), 2);
Dust dust2 = Dust.NewDustPerfect(target.Center + vel * 13, ModContent.DustType<SquashDustPixelated>(),
vel, 0, default, 2 * hitMult * Main.rand.NextFloat(2.3f, 3.2f) - MathF.Abs(variance));
dust2.noGravity = true;
dust2.color = Main.rand.NextBool() ? Color.Gold : Color.Goldenrod;
dust2.customData = new Vector2(0.2f, 1.6f);
dust2.fadeIn = 2.5f;
}
}
}
for (int i = 0; i < MathHelper.Clamp(10 - Projectile.numHits * 2, 2, 10); i++)
{
Particle spark2 = new SparkParticle(target.Center, ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), false, 55, Main.rand.NextFloat(0.4f, 1.5f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue);
GeneralParticleHandler.SpawnParticle(spark2);
Dust dust = Dust.NewDustPerfect(target.Center, ModContent.DustType<VoidDust>(), ((Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -35).RotatedByRandom(0.7) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(1.55f, 2.2f));
dust.noGravity = true;
dust.color = Main.rand.NextBool() ? Color.DodgerBlue : Color.Blue;
}
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Owner.Calamity().mouseRight)
if (canBeLaunched)
{
modifiers.SourceDamage *= 0;
modifiers.FinalDamage.Flat = 0.1f;
@@ -293,34 +361,61 @@ namespace CalamityMod.Projectiles.Melee
modifiers.SourceDamage *= damageMult;
}
}
public override bool PreDraw(ref Color lightColor)
{
// Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to.
if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive)
if (time < 3)
return false;
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
Texture2D swoosh = ModContent.Request<Texture2D>("CalamityMod/Particles/CircularSmearLarge").Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
Vector2 vel = Projectile.rotation.ToRotationVector2();
Color drawColor = Projectile.GetAlpha(lightColor);
float drawRotation = Projectile.rotation + ((Owner.direction == -1) ? MathHelper.Pi - MathHelper.PiOver4 : MathHelper.PiOver4);
Vector2 rotationPoint = (Owner.direction == -1) ? new Vector2(texture.Width, texture.Height) : new Vector2(0, texture.Height);
SpriteEffects flipSprite = (Owner.direction == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
Vector2 handLatchingAdjustments = (swingCount % 2 == 0 ? new Vector2(-6, 0) : new Vector2(-2, 0));
Vector2 placeAdjust = (drawRotation + MathHelper.PiOver2).ToRotationVector2() * 2.5f + (handLatchingAdjustments.RotatedBy(drawRotation) * Owner.direction);
float lerp = 1 - bladefx;
int swingCountFlip = (swingCount % 2 == 0 ? 1 : 3) + Owner.direction == 0 ? 2 : 0;
Vector2 vel2 = Vector2.Lerp(Projectile.velocity.RotatedBy(MathHelper.PiOver2), Owner.Center.DirectionTo(Owner.ClampedMouseWorld()).RotatedBy(-MathHelper.PiOver2), 0f);
float extraRot = MathHelper.PiOver4 * MathHelper.Lerp(3, 1.9f, lerp) * (swingCount % 2 == 0 ? (Owner.direction == -1 ? 1 : -1) : (Owner.direction == -1 ? -1 : 1));
float swooshDrawRotation = vel2.ToRotation() + extraRot;
SpriteEffects swooshFlipSprite = (swingCount % 2 == 0 ? (Owner.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None) : (Owner.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally));
if (bladefx > 0.02f)
{
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
Asset<Texture2D> glowTex = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/GrandDadGlow");
float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f;
Asset<Texture2D> swoosh = ModContent.Request<Texture2D>("CalamityMod/Particles/VerticalSmearLarge");
if (Animation > useAnim * 0.2f)
Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.DodgerBlue with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(Projectile.ai[1] == 1 ? -90 : 90) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.6f, SpriteEffects.None);
for (int i = 0; i < 25; i++)
PixelationManager.AddPixelatedDrawer((_) =>
{
Texture2D centerTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/GrandDadGhost").Value;
Color auraColor = Color.Gold with { A = 0 } * 0.15f * fadeIn;
Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 6 * fadeIn;
Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
int draws = 15;
for (int i = 0; i < draws; i++)
{
Color clr = Color.Black;
Vector2 outlineOffset = (MathHelper.TwoPi / draws * i).ToRotationVector2() * 3.5f;
Main.EntitySpriteDraw(swoosh, drawPosition + Projectile.velocity.RotatedBy(extraRot) * 12.5f + outlineOffset, null, clr * MathF.Pow(bladefx, 3) * 0.4f, swooshDrawRotation, swoosh.Size() * 0.5f, Projectile.scale * 0.6f, swooshFlipSprite);
Main.EntitySpriteDraw(texture, drawPosition + placeAdjust + outlineOffset * 2 * bladefx, null, clr * 0.2f * bladefx, drawRotation, rotationPoint, Projectile.scale, flipSprite);
}
}, Enums.GeneralDrawLayer.AfterProjectiles, BlendState.AlphaBlend);
if (!CalamityClientConfig.Instance.Photosensitivity)
{
PixelationManager.AddPixelatedDrawer((_) =>
{
Color clrCenter = Color.DodgerBlue;
Main.EntitySpriteDraw(swoosh, drawPosition + Projectile.velocity.RotatedBy(extraRot) * 12.5f, null, clrCenter * MathF.Pow(bladefx, 0.6f), swooshDrawRotation, swoosh.Size() * 0.5f, Projectile.scale * 0.6f, swooshFlipSprite);
Main.EntitySpriteDraw(texture, drawPosition + placeAdjust, null, clrCenter * bladefx, drawRotation, rotationPoint, Projectile.scale, flipSprite);
}, Enums.GeneralDrawLayer.AfterEverything, BlendState.Additive);
}
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
}
Main.EntitySpriteDraw(texture, drawPosition + placeAdjust, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); // The holdout
return false;
}
public override void DrawBehind(int index, List<int> behindNPCsAndTiles, List<int> behindNPCs, List<int> behindProjectiles, List<int> overPlayers, List<int> overWiresUI)
{
overPlayers.Add(index);
}
}
}
+28
View File
@@ -0,0 +1,28 @@
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class TileSlamDamage : DirectStrike, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public Player Owner => Main.player[Projectile.owner];
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
modifiers.SetInstantKill();
int damageLength = (int)Math.Pow(target.life.ToString().Length, target.boss ? 2.8f : 1);
string sevens = "7";
for (int i = 0; i < damageLength; i++)
{
sevens = sevens + "7";
}
Rectangle location = new Rectangle((int)target.position.X, (int)target.position.Y - 16, target.width, target.height);
int text = CombatText.NewText(location, Color.DodgerBlue, Language.GetTextValue(sevens), true);
}
}
}