couple visual stuff
& ported urchin mace into BaseMace
This commit is contained in:
1 parent
afd4ab72db
commit
ce8aebc76e
14 files changed
+182
-145
No files matched your search
@@ -16,6 +16,7 @@ using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.NPCs.OldDuke;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
@@ -43,10 +44,36 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
int uncommonRate = Math.Clamp(240 / attempt.fishingLevel, 3, 240); // Iron/Mythril (originally 300)
|
||||
attempt.uncommon = Main.rand.NextBool(uncommonRate);
|
||||
|
||||
// These roll result bools are individually stored for the rarifying visuals
|
||||
int rareRate = Math.Clamp(840 / attempt.fishingLevel, 4, 840); // Biome (originally 1050)
|
||||
attempt.uncommon = Main.rand.NextBool(rareRate);
|
||||
bool rareRoll = Main.rand.NextBool(rareRate);
|
||||
attempt.rare = rareRoll;
|
||||
|
||||
int veryRareRate = Math.Clamp(1800 / attempt.fishingLevel, 5, 1800); // Golden/Titanium (originally 2250)
|
||||
attempt.uncommon = Main.rand.NextBool(veryRareRate);
|
||||
bool veryRareRoll = Main.rand.NextBool(veryRareRate);
|
||||
attempt.veryrare = veryRareRoll;
|
||||
|
||||
Vector2 basePos = new Vector2(attempt.X * 16f, attempt.Y * 16f);
|
||||
if (rareRoll || veryRareRoll)
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Vector2 position = basePos + Vector2.UnitX * Main.rand.NextFloat(-16f, 16f);
|
||||
Vector2 velocity = (Vector2.UnitY * Main.rand.NextFloat(-12f, -9f)).RotatedByRandom(MathHelper.ToRadians(18f));
|
||||
float scale = Main.rand.NextFloat(0.5f, 1.5f);
|
||||
CritSpark spark = new(position, velocity, Color.White, Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f), scale, 36, 0.2f, scale * 2f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
Vector2 position = basePos + Vector2.UnitX * Main.rand.NextFloat(-16f, 16f);
|
||||
Vector2 velocity = (Vector2.UnitY * Main.rand.NextFloat(-3f, -0.5f)).RotatedByRandom(MathHelper.ToRadians(12f));
|
||||
PearlParticle pearl = new(position, velocity, false, 24, Main.rand.NextFloat(0.5f, 1f), Main.hslToRgb(Main.rand.NextFloat(), 1f, (rareRoll || veryRareRoll) ? 0.75f : 1f));
|
||||
GeneralParticleHandler.SpawnParticle(pearl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using CalamityMod.Items.Materials;
|
||||
using CalamityMod.Projectiles.Melee.MaceFlails;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -11,6 +10,8 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public class UrchinMace : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Melee";
|
||||
|
||||
public override void SetStaticDefaults() => ItemID.Sets.ToolTipDamageMultiplier[Type] = 2f;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 42;
|
||||
@@ -28,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
Item.UseSound = SoundID.Item1;
|
||||
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
|
||||
Item.rare = ItemRarityID.Green;
|
||||
Item.shoot = ModContent.ProjectileType<UrchinMaceProjectile>();
|
||||
Item.shoot = ModContent.ProjectileType<UrchinMaceProj>();
|
||||
Item.shootSpeed = 9f;
|
||||
}
|
||||
|
||||
@@ -37,11 +38,6 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
player.Calamity().mouseWorldListener = true;
|
||||
}
|
||||
|
||||
public override bool CanUseItem(Player player)
|
||||
{
|
||||
return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ModContent.ProjectileType<UrchinMaceProjectile>());
|
||||
}
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
|
||||
@@ -723,7 +723,7 @@ EnchantedPearl: {
|
||||
'''
|
||||
Increases fishing power by 10
|
||||
Increases chance to catch crates and loot-containing fish by 15%
|
||||
Crates are 25% more likely to be higher quality
|
||||
Crate catches emit pearls and are 25% more likely to be higher quality
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -1424,14 +1424,9 @@ UltimusCleaver: {
|
||||
Tooltip: Launches damaging homing sparks and explodes on enemy hits
|
||||
}
|
||||
|
||||
UrchinFlail: {
|
||||
DisplayName: Urchin Flail
|
||||
Tooltip: Launch an urchin ball, which shoots a spike on contact with an enemy
|
||||
}
|
||||
|
||||
UrchinMace: {
|
||||
DisplayName: Urchin Mace
|
||||
Tooltip: Throws out a whirlpool when released at full charge
|
||||
Tooltip: Throws out a whirlpool when released
|
||||
}
|
||||
|
||||
VanishingPoint: {
|
||||
|
||||
@@ -299,7 +299,6 @@ TruePurityProjection.DisplayName: Purity Projection
|
||||
TumbleweedRolling.DisplayName: Rolling Tumbleweed
|
||||
TyphonsGreedBubble.DisplayName: Typhon's Greed
|
||||
UltimusCleaverDust.DisplayName: Ultimus Flame
|
||||
UrchinMaceProjectile.DisplayName: Urchin Mace
|
||||
UrchinSpikeFugu.DisplayName: Urchin Spike
|
||||
VirulentBeeWave.DisplayName: Virulent Bee Wave
|
||||
VirulentWave.DisplayName: Virulent Wave
|
||||
|
||||
@@ -328,9 +328,10 @@ namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
|
||||
/// <summary>
|
||||
/// Reserved for extra AI that is always ran regardless of state. Does nothing by default.<br/>
|
||||
/// Example cases include shooting projectiles in a similar manner to Flower Pow.
|
||||
/// Example cases include shooting projectiles in a similar manner to Flower Pow.<br/>
|
||||
/// Return false to entirely override base flail behaviour.
|
||||
/// </summary>
|
||||
public virtual void ExtraBehavior() { }
|
||||
public virtual bool ExtraBehavior() => true;
|
||||
|
||||
/// <summary>
|
||||
/// Handles simple chain drawing. Can be overridden for cases such as chains with multiple frames/variants.
|
||||
@@ -422,31 +423,32 @@ namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
break;
|
||||
}
|
||||
|
||||
ExtraBehavior();
|
||||
|
||||
Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0f).ToDirectionInt();
|
||||
|
||||
// Non-symmetric rotation (symmetric is just in this if condition here)
|
||||
if (CurrentFlailState == FlailState.Ricochet || CurrentFlailState == FlailState.Dropping)
|
||||
if (ExtraBehavior())
|
||||
{
|
||||
if (Projectile.velocity.Length() > 1f)
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi + Projectile.velocity.X * 0.1f;
|
||||
Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0f).ToDirectionInt();
|
||||
|
||||
// Non-symmetric rotation (symmetric is just in this if condition here)
|
||||
if (CurrentFlailState == FlailState.Ricochet || CurrentFlailState == FlailState.Dropping)
|
||||
{
|
||||
if (Projectile.velocity.Length() > 1f)
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi + Projectile.velocity.X * 0.1f;
|
||||
else
|
||||
Projectile.rotation += Projectile.velocity.X * 0.1f;
|
||||
}
|
||||
else
|
||||
Projectile.rotation += Projectile.velocity.X * 0.1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector2 vectorTowardsPlayer = Projectile.SafeDirectionTo(Owner.MountedCenter);
|
||||
Projectile.rotation = vectorTowardsPlayer.ToRotation() + MathHelper.ToRadians(270f);
|
||||
}
|
||||
{
|
||||
Vector2 vectorTowardsPlayer = Projectile.SafeDirectionTo(Owner.MountedCenter);
|
||||
Projectile.rotation = vectorTowardsPlayer.ToRotation() + MathHelper.ToRadians(270f);
|
||||
}
|
||||
|
||||
Projectile.timeLeft = 2;
|
||||
Owner.heldProj = Projectile.whoAmI;
|
||||
Owner.SetDummyItemTime(2);
|
||||
Owner.itemRotation = Projectile.DirectionFrom(Owner.MountedCenter).ToRotation();
|
||||
if (Projectile.Center.X < Owner.MountedCenter.X)
|
||||
Owner.itemRotation += MathHelper.Pi;
|
||||
Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation);
|
||||
Projectile.timeLeft = 2;
|
||||
Owner.heldProj = Projectile.whoAmI;
|
||||
Owner.SetDummyItemTime(2);
|
||||
Owner.itemRotation = Projectile.DirectionFrom(Owner.MountedCenter).ToRotation();
|
||||
if (Projectile.Center.X < Owner.MountedCenter.X)
|
||||
Owner.itemRotation += MathHelper.Pi;
|
||||
Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails
|
||||
base.SetDefaults();
|
||||
}
|
||||
|
||||
public override void ExtraBehavior()
|
||||
public override bool ExtraBehavior()
|
||||
{
|
||||
// Randomly play grass sounds idly if it is moving/spinning
|
||||
if ((CurrentFlailState == FlailState.Spinning || Projectile.velocity.Length() > 2f) && Projectile.soundDelay <= 0)
|
||||
@@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails
|
||||
AuraScale = MathHelper.Clamp(AuraScale + 1f / MaxAuraTime, 0f, 1f);
|
||||
|
||||
if (AuraScale < 0.15f)
|
||||
return;
|
||||
return true;
|
||||
|
||||
// The dust machine
|
||||
for (int i = 0; i < (int)(10 * AuraScale); i++)
|
||||
@@ -78,6 +78,8 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails
|
||||
}
|
||||
else
|
||||
AuraScale = MathHelper.Clamp(AuraScale - 3f / MaxAuraTime, 0f, 1f);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
|
||||
+57
-85
@@ -1,64 +1,73 @@
|
||||
using System;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
namespace CalamityMod.Projectiles.Melee.MaceFlails
|
||||
{
|
||||
public class UrchinMaceProjectile : ModProjectile, ILocalizedModType
|
||||
public class UrchinMaceProj : BaseMaceFlailProjectile
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
// The entire chain is on the mace sprite, in which the player swings
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/UrchinMace";
|
||||
public override string ChainTexturePath => string.Empty;
|
||||
|
||||
public static float MaxWindup = 110;
|
||||
public ref float Windup => ref Projectile.ai[0];
|
||||
public float WindupProgress => MathHelper.Clamp(Windup, 0, MaxWindup) / MaxWindup;
|
||||
public static float whirlpoolDamageMultiplier = 2f;
|
||||
// This flail only runs through one state (spin), thereby making most parameters unnecessary to fill out
|
||||
public override int AssociatedItemID => ModContent.ItemType<UrchinMace>();
|
||||
public override int SpinIFrames => 15;
|
||||
public override float SpinHitboxRadius => 64f;
|
||||
public override float SpinVerticalFactor => 1f; // This flail moves circular
|
||||
public override float LaunchSpeed => 22f;
|
||||
|
||||
public static float MaxWindup = 45f;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 60;
|
||||
Projectile.height = 60;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Melee;
|
||||
Projectile.width = Projectile.height = 60;
|
||||
base.SetDefaults();
|
||||
Projectile.localNPCHitCooldown = SpinIFrames * Projectile.MaxUpdates;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 10;
|
||||
Projectile.ownerHitCheck = true;
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
public override void SpinAI(float launchSpeed)
|
||||
{
|
||||
//Prevent spam click abuse
|
||||
if (Windup < Projectile.localNPCHitCooldown)
|
||||
return false;
|
||||
float WindupProgress = MathHelper.Clamp(StateTimer, 0, MaxWindup) / MaxWindup;
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
|
||||
Vector2 toMouse = Owner.MountedCenter.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX * Owner.direction);
|
||||
Owner.ChangeDir((toMouse.X > 0f).ToDirectionInt());
|
||||
if (!Owner.channel && WindupProgress >= 1f)
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter, toMouse * launchSpeed, ModContent.ProjectileType<RedtideWhirlpool>(), (int)(Projectile.damage * LaunchDamage), Projectile.knockBack, Projectile.owner);
|
||||
SoundEngine.PlaySound(SoundID.Item7, Owner.MountedCenter);
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
float collisionPoint = 0f;
|
||||
float bladeLength = 70 * Projectile.scale;
|
||||
float bladeWidth = 30 * Projectile.scale;
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.rotation.ToRotationVector2() * bladeLength), bladeWidth, ref collisionPoint);
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Owner.ChangeDir(Math.Sign(Owner.Calamity().mouseWorld.X - Owner.position.X));
|
||||
if (StateTimer == MaxWindup)
|
||||
{
|
||||
for (int i = 0; i < 25; i++)
|
||||
{
|
||||
Vector2 dustPos = Owner.position + Main.rand.NextVector2FromRectangle(Owner.Hitbox);
|
||||
Dust dust = Dust.NewDustPerfect(dustPos, 176, Vector2.UnitY * -5f * Main.rand.NextFloat(1f, 2f) + Owner.velocity, Scale: Main.rand.NextFloat(1f, 2f));
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
|
||||
Projectile.rotation += (WindupProgress * MathHelper.PiOver4 / 1.5f) * Owner.direction;
|
||||
|
||||
if (Owner.channel)
|
||||
{
|
||||
Projectile.timeLeft = 2;
|
||||
UpdateOwnerVars();
|
||||
}
|
||||
Projectile.Center = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 10f - Vector2.UnitX * 4 * Owner.direction;
|
||||
|
||||
if (WindupProgress > 0.5f)
|
||||
{
|
||||
@@ -73,31 +82,17 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
}
|
||||
|
||||
Projectile.Center = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 10f - Vector2.UnitX * 4 * Owner.direction;
|
||||
StateTimer++;
|
||||
}
|
||||
|
||||
public override bool ExtraBehavior()
|
||||
{
|
||||
if (Projectile.soundDelay <= 0)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.DD2_GhastlyGlaivePierce, Owner.MountedCenter);
|
||||
Projectile.soundDelay = 28;
|
||||
}
|
||||
|
||||
if (Windup == MaxWindup && Owner.whoAmI == Main.myPlayer)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item43, Owner.MountedCenter);
|
||||
|
||||
for (int i = 0; i < 25; i++)
|
||||
{
|
||||
Vector2 dustPos = Owner.position + Main.rand.NextVector2FromRectangle(Owner.Hitbox);
|
||||
Dust dust = Dust.NewDustPerfect(dustPos, 176, Vector2.UnitY * -5f * Main.rand.NextFloat(1f, 2f) + Owner.velocity, Scale: Main.rand.NextFloat(1f, 2f));
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
Windup++;
|
||||
}
|
||||
|
||||
public void UpdateOwnerVars()
|
||||
{
|
||||
float armPointingDirection = ((Owner.Calamity().mouseWorld - Owner.MountedCenter).ToRotation());
|
||||
|
||||
//"crop" the rotation so the player only points their arm in a smaller range. (The back arm points in the throw direction)
|
||||
@@ -111,12 +106,13 @@ namespace CalamityMod.Projectiles.Melee
|
||||
armPointingDirection = -MathHelper.Pi + MathHelper.PiOver4 * 1.5f * Utils.GetLerpValue(-MathHelper.Pi, -MathHelper.PiOver4, armPointingDirection, true);
|
||||
}
|
||||
|
||||
|
||||
Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armPointingDirection - MathHelper.PiOver2);
|
||||
Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation - MathHelper.PiOver2);
|
||||
|
||||
Projectile.timeLeft = 2;
|
||||
Owner.heldProj = Projectile.whoAmI;
|
||||
Owner.itemTime = 2;
|
||||
Owner.itemAnimation = 2;
|
||||
Owner.SetDummyItemTime(2);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
@@ -130,26 +126,15 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
}
|
||||
|
||||
//If we don't do that, the hit enemies get knocked back towards you if you hit them from the right??
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
// This would knock enemies away consistently, but i'm choosing to go with the other option
|
||||
//hitDirection = Math.Sign(target.Center.X - Owner.Center.X);
|
||||
|
||||
//Doing it this way lets the player choose if they want to knockback enemies towards them by pointing away from them
|
||||
modifiers.HitDirectionOverride = Owner.direction;
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Owner.ChangeDir(Math.Sign(Owner.Calamity().mouseWorld.X - Owner.position.X));
|
||||
|
||||
Texture2D maceTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
|
||||
Texture2D whirlpoolTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/RedtideWhirlpool").Value;
|
||||
Texture2D maceTexture = TextureAssets.Projectile[Type].Value;
|
||||
Texture2D whirlpoolTexture = TextureAssets.Projectile[ModContent.ProjectileType<RedtideWhirlpool>()].Value;
|
||||
|
||||
float WindupProgress = MathHelper.Clamp(StateTimer, 0, MaxWindup) / MaxWindup;
|
||||
float whirlpoolScale = MathHelper.Clamp(WindupProgress * 3f - 0.4f, 0f, 1f) * 2f;
|
||||
float whirlpoolOpacity = WindupProgress * 0.2f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.1f;
|
||||
float whirlpoolRotation = Windup * 0.34f * Owner.direction;
|
||||
float whirlpoolOpacity = WindupProgress * 0.2f + MathF.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.1f;
|
||||
float whirlpoolRotation = StateTimer * 0.34f * Owner.direction;
|
||||
SpriteEffects flip = Owner.direction < 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||
|
||||
Main.EntitySpriteDraw(whirlpoolTexture, Owner.MountedCenter - Main.screenPosition, null, Lighting.GetColor((int)Owner.MountedCenter.X / 16, (int)Owner.MountedCenter.Y / 16) * whirlpoolOpacity * 0.3f, whirlpoolRotation * 1.2f, whirlpoolTexture.Size() / 2f, whirlpoolScale, flip, 0);
|
||||
@@ -158,20 +143,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Vector2 handleOrigin = new Vector2(0, maceTexture.Height);
|
||||
float maceRotation = Projectile.rotation + MathHelper.PiOver4;
|
||||
Main.EntitySpriteDraw(maceTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), maceRotation, handleOrigin, Projectile.scale, SpriteEffects.None, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
//Spawn a whirlpool typhoon after sending it out
|
||||
if (WindupProgress >= 1f && Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
// 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Main.MouseWorld - Owner.position).SafeNormalize(Vector2.One) * 25f, ModContent.ProjectileType<RedtideWhirlpool>(), (int)(Projectile.damage * whirlpoolDamageMultiplier), Projectile.knockBack, Projectile.owner, 0, 0f);
|
||||
}
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item7, Projectile.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails
|
||||
base.SetDefaults();
|
||||
}
|
||||
|
||||
public override void ExtraBehavior()
|
||||
public override bool ExtraBehavior()
|
||||
{
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
@@ -37,6 +37,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails
|
||||
spore.noGravity = true;
|
||||
spore.scale = 1.5f;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Poisoned, 180);
|
||||
|
||||
@@ -42,6 +42,16 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Dust dust = Dust.NewDustPerfect(dustPos, 176, (angle - MathHelper.PiOver2 * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * 8f + Projectile.velocity, Scale: Main.rand.NextFloat(1.6f, 3f));
|
||||
dust.noGravity = true;
|
||||
}
|
||||
|
||||
Vector2 trailOffset = Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(40f, 48f);
|
||||
Dust trail = Dust.NewDustPerfect(Projectile.Center + trailOffset, 176, Main.rand.NextVector2Circular(0.2f, 0.2f));
|
||||
trail.noGravity = true;
|
||||
trail.scale = Main.rand.NextFloat(0.8f, 3f);
|
||||
trail.alpha = Main.rand.Next(120, 180 + 1);
|
||||
trail = Dust.NewDustPerfect(Projectile.Center - trailOffset, 176, Main.rand.NextVector2Circular(0.2f, 0.2f));
|
||||
trail.noGravity = true;
|
||||
trail.scale = Main.rand.NextFloat(0.8f, 3f);
|
||||
trail.alpha = Main.rand.Next(120, 180 + 1);
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
|
||||
@@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
using static CalamityMod.CalamityUtils;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
@@ -12,6 +13,9 @@ namespace CalamityMod.Projectiles.Melee
|
||||
public new string LocalizationCategory => "Projectiles.Melee";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public ref float Time => ref Projectile.ai[0];
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 80;
|
||||
@@ -19,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 5;
|
||||
Projectile.timeLeft = 20;
|
||||
Projectile.DamageType = DamageClass.MeleeNoSpeed;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
@@ -27,21 +31,42 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Projectile.ai[1] > 0f)
|
||||
return;
|
||||
|
||||
// Makeshift metal-blood explosion sound that is good enough ig
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/Ravager/RavagerStomp", 2) { Pitch = -0.75f, PitchVariance = 0.5f }, Projectile.Center);
|
||||
for (int p = 0; p < 10; p++)
|
||||
if (Time == 0f)
|
||||
{
|
||||
Vector2 velocity = (-Vector2.UnitY).RotatedByRandom(MathHelper.ToRadians(75f)) * Main.rand.NextFloat(4f, 6f);
|
||||
float scale = Main.rand.NextFloat(0.6f, 2f);
|
||||
Particle blood = new BloodParticle(Projectile.Center, velocity, 30, scale, Color.DarkRed);
|
||||
GeneralParticleHandler.SpawnParticle(blood);
|
||||
// Makeshift metal-blood explosion sound that is good enough ig
|
||||
SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/Ravager/RavagerStomp", 2) { Pitch = -0.75f, PitchVariance = 0.5f }, Projectile.Center);
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.DarkRed, Color.Red, Utils.GetLerpValue(0, 5, i, true)), "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.5f + 0.03f * i, (int)(20 - i * 1.5f));
|
||||
GeneralParticleHandler.SpawnParticle(explosion);
|
||||
}
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.DarkRed, Color.Red, Utils.GetLerpValue(0, 3, i, true)), "CalamityMod/Projectiles/FireProj", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 2f + 0.22f * i, (int)(20 - i * 2f));
|
||||
GeneralParticleHandler.SpawnParticle(explosion);
|
||||
}
|
||||
|
||||
Particle outerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.RosyBrown, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.1f, 2f, 24, true);
|
||||
GeneralParticleHandler.SpawnParticle(outerGlow);
|
||||
|
||||
for (int p = 0; p < 16; p++)
|
||||
{
|
||||
Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(8f, 12f);
|
||||
float scale = Main.rand.NextFloat(0.6f, 2f);
|
||||
Particle blood = new BloodParticle(Projectile.Center, velocity, 30, scale, Color.DarkRed);
|
||||
GeneralParticleHandler.SpawnParticle(blood);
|
||||
}
|
||||
}
|
||||
Projectile.ai[1]++;
|
||||
|
||||
Projectile.scale = MathHelper.Lerp(0f, 1f, PiecewiseAnimation(Time / 20f, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }));
|
||||
Time++;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<Laceration>(), 60);
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt();
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CircularHitboxCollision(Projectile.Center, Projectile.width * Projectile.scale, targetHitbox);
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,13 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Projectile.velocity = (Projectile.velocity * 20f + idealVelocity) / 21f;
|
||||
Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 2f);
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(8))
|
||||
{
|
||||
Dust offTrail = Dust.NewDustPerfect(Projectile.Center, 171, Main.rand.NextVector2Circular(0.2f, 0.2f));
|
||||
offTrail.noGravity = true;
|
||||
offTrail.scale = Main.rand.NextFloat(0.6f, 1.2f);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Poisoned, 120);
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace CalamityMod.Systems.Collections
|
||||
ProjectileType<TaserHook>(),
|
||||
ProjectileType<Teslabeam>(),
|
||||
ProjectileType<TyphonsGreedStaff>(),
|
||||
ProjectileType<UrchinMaceProjectile>(),
|
||||
ProjectileType<UrchinMaceProj>(),
|
||||
ProjectileType<UrchinStingerProj>(),
|
||||
ProjectileType<ViolenceThrownProjectile>(),
|
||||
ProjectileType<WaterLeechProj>(),
|
||||
|
||||
@@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Projectiles.DraedonsArsenal;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using CalamityMod.Projectiles.Melee.MaceFlails;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using CalamityMod.Projectiles.Rogue;
|
||||
using Terraria.ID;
|
||||
@@ -32,7 +33,7 @@ namespace CalamityMod.Systems.Collections
|
||||
ProjectileID.ChargedBlasterCannon,
|
||||
ProjectileID.MedusaHead,
|
||||
|
||||
ProjectileType<UrchinMaceProjectile>(),
|
||||
ProjectileType<UrchinMaceProj>(),
|
||||
ProjectileType<BrokenBiomeBladeHoldout>(),
|
||||
ProjectileType<AridGrandeur>(),
|
||||
ProjectileType<BitingEmbrace>(),
|
||||
|
||||
Reference in new issue
Block a user