This commit is contained in:
Xyk authored and Cameron Ewell committed 2025-07-15 16:16:11 -04:00
1 parent 72e6a26b8e
commit 410533794a
22 files changed
+615 -66

No files matched your search

+3
View File
@@ -305,6 +305,9 @@ namespace CalamityMod.CalPlayer
public int furyFuelMax = 1800;
public int furyFuel = 1800;
public float furyRefuelTimer = 0;
/// <summary> Variable used to track if Auger can do a big slash </summary>
public bool buffedAuger = false;
public int rOfResilienceCooldown = 0;
public int rOfResilienceEffect = 0;
public int rOfResilienceOrbitOffset = 0;
@@ -61,7 +61,7 @@ namespace CalamityMod.Items.DraedonMisc
int insertIndex = list.FindIndex(x => x.Name == "Tooltip2" && x.Mod == "Terraria");
if (insertIndex != -1)
{
int meleeItem = ModContent.ItemType<GaussDagger>();
int meleeItem = ModContent.ItemType<Auger>();
TooltipLine meleeDisplay = new TooltipLine(this.Mod, "CalamityMod:MeleeDisplay", $"[i:{meleeItem}] {CalamityUtils.GetItemName(meleeItem)}");
meleeDisplay.OverrideColor = new Color(236, 255, 31);
list.Insert(insertIndex + 1, meleeDisplay);
+73
View File
@@ -0,0 +1,73 @@
using System.Collections.Generic;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.SunkenSea;
using CalamityMod.Projectiles.DraedonsArsenal;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.DraedonsArsenal
{
public class Auger : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal";
public override void SetDefaults()
{
CalamityGlobalItem modItem = Item.Calamity();
Item.width = 26;
Item.height = 26;
Item.damage = 90;
Item.DamageType = TrueMeleeDamageClass.Instance;
Item.useTime = Item.useAnimation = 12;
Item.knockBack = 12f;
Item.autoReuse = true;
Item.useStyle = ItemUseStyleID.Shoot;
Item.shoot = ModContent.ProjectileType<AugerHoldout>();
Item.noMelee = true;
Item.channel = true;
Item.noUseGraphic = true;
Item.value = CalamityGlobalItem.RarityOrangeBuyPrice;
Item.rare = ItemRarityID.Orange;
}
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
{
Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/DraedonsArsenal/AugerGlow").Value);
}
public override bool MeleePrefix() => true;
public override void ModifyTooltips(List<TooltipLine> tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1);
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
public override bool AltFunctionUse(Player player) => true;
public override void HoldItem(Player player)
{
if (Main.myPlayer == player.whoAmI)
player.Calamity().rightClickListener = true;
player.Calamity().mouseWorldListener = true;
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
float swordType = 0;
if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse && player.Calamity().arsenalCooldown <= 0)
swordType = 5;
Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, swordType);
holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero);
return false;
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<MysteriousCircuitry>(5).
AddIngredient<DubiousPlating>(7).
AddIngredient<AerialiteBar>(4).
AddIngredient<SeaPrism>(7).
AddTile(TileID.Anvils).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

@@ -1,65 +0,0 @@
using System.Collections.Generic;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.SunkenSea;
using CalamityMod.Projectiles.DraedonsArsenal;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.DraedonsArsenal
{
public class GaussDagger : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal";
public override void SetDefaults()
{
CalamityGlobalItem modItem = Item.Calamity();
Item.width = 26;
Item.height = 26;
Item.damage = 25;
Item.DamageType = DamageClass.Melee;
Item.useTime = 24;
Item.useAnimation = 24;
Item.useStyle = ItemUseStyleID.Swing;
Item.useTurn = true;
Item.knockBack = 7f;
Item.value = CalamityGlobalItem.RarityOrangeBuyPrice;
Item.rare = ItemRarityID.Orange;
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
modItem.UsesCharge = true;
modItem.MaxCharge = 50f;
modItem.ChargePerUse = 0.05f;
}
public override void ModifyTooltips(List<TooltipLine> tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1);
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
if (target.Calamity().GaussFluxTimer == 0)
{
target.Calamity().GaussFluxTimer = 50;
if (player.whoAmI == Main.myPlayer)
{
Projectile.NewProjectile(player.GetSource_ItemUse(Item), target.Center, Vector2.Zero, ModContent.ProjectileType<GaussFlux>(), Item.damage, 0f, player.whoAmI, 0f, target.whoAmI);
}
}
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<MysteriousCircuitry>(5).
AddIngredient<DubiousPlating>(7).
AddIngredient<AerialiteBar>(4).
AddIngredient<SeaPrism>(7).
AddTile(TileID.Anvils).
Register();
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 B

@@ -10,6 +10,17 @@ AerialTracker: {
'''
}
Auger: {
DisplayName: P-GSS: Auger
Tooltip:
'''
A high-frequency magnetic energy blade made to be worn on the wrist
<right> to create a breif magnetic pull at your cursor and amplify your next slash
[c/1FFBFF:'Originally manufactured to be used for large scale metal serration and transportaion.]
[c/1FFBFF:Its design as a lightweight tool that did not occupy the hands made it exceptionally efficent.']
'''
}
CountermeasureMitt: {
DisplayName: B-LSR: Countermeasure Mitt
Tooltip:
@@ -79,3 +79,6 @@ PlagueShotBuffer.DisplayName: Plague Shot
WaterShot.DisplayName: Water Shot
WaterShotBuffer.DisplayName: Water Shot
FrequencyManipulatorEnergy.DisplayName: Frequency Manipulator Energy
AugerHoldout.DisplayName: Auger Holdout
AugerSlash.DisplayName: Auger Slash
AugerPull.DisplayName: Auger Pull
+254
View File
@@ -0,0 +1,254 @@
using System;
using System.Collections.Generic;
using CalamityMod.Cooldowns;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ModLoader;
using static Terraria.Player;
namespace CalamityMod.Projectiles.DraedonsArsenal
{
public class AugerHoldout : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Misc";
public ref float attackTimer => ref Projectile.ai[0];
public Player Owner => Main.player[Projectile.owner];
public float scaleFx = 1;
public int fireRate => Owner.itemAnimationMax;
public int time = 0;
public bool longSwing => swingCount >= 1;
public int cooldown => -Owner.itemAnimationMax * (Owner.Calamity().buffedAuger ? 2 : longSwing ? 3 : 1);
public float bladeRot = 0;
public int swingCount = -1;
public float bladefx = 0;
public bool makeSound = true;
public bool makeHitbox = true;
public int cooldownGiven => (int)(450 / ((Owner.GetAttackSpeed<MeleeDamageClass>() - 1) * 0.5f + 1)); // Cooldown is effected by melee speed at 50% efficency
public float pullFx = 1;
public bool pressedRight = false;
public override bool? CanDamage() => false;
public override void SetDefaults()
{
Projectile.width = Projectile.height = 100;
Projectile.friendly = true;
Projectile.DamageType = TrueMeleeDamageClass.Instance;
Projectile.timeLeft = 5;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
Projectile.timeLeft = 5;
// Hand and holdout positioning
Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld());
Owner.heldProj = Projectile.whoAmI;
Owner.itemTime = Owner.itemAnimation = 2;
Owner.itemRotation = (Projectile.velocity * Owner.direction).ToRotation();
Owner.ChangeDir(Math.Sign(toMouse.X));
Owner.SetCompositeArmFront(true, CompositeArmStretchAmount.Full, (toMouse.ToRotation() + bladeRot * 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() * 9;
float armRotation = (Utils.DirectionTo(Owner.Center, handPos).ToRotation() - MathHelper.PiOver2) * Owner.gravDir + (Owner.gravDir == -1 ? MathHelper.Pi : 0f);
Owner.SetCompositeArmBack(true, CompositeArmStretchAmount.Full, armRotation);
Projectile.velocity = toMouse.RotatedBy(bladeRot * Owner.direction);
Projectile.rotation = Projectile.velocity.ToRotation();
Projectile.Center = handPos;
if (Projectile.ai[2] > 0) // Right click "gravity well" and buff
{
if (Projectile.ai[2] == 5)
{
time = 0;
attackTimer = 0;
swingCount = -1;
makeHitbox = true;
Projectile.ai[2]--;
pullFx = 5;
}
if (bladefx > 0)
bladefx = 0;
bladeRot = 0;
pullFx = MathHelper.Lerp(pullFx, 1, 0.12f);
if (attackTimer > fireRate && makeHitbox)
{
Projectile magnetZone = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.ClampedMouseWorld(), Vector2.Zero, ModContent.ProjectileType<AugerPull>(), 0, 0, Projectile.owner, 0, 0, 0);
SoundStyle pull = new("CalamityMod/Sounds/Item/AugerPull");
SoundEngine.PlaySound(pull with { Volume = 0.9f, Pitch = 0 }, Owner.ClampedMouseWorld());
Owner.Calamity().buffedAuger = true;
Owner.Calamity().arsenalCooldown = cooldownGiven;
Owner.AddCooldown(ArsenalPower.ID, cooldownGiven);
makeHitbox = false;
}
if (attackTimer >= fireRate * 2)
{
Projectile.Kill();
return;
}
time++;
attackTimer++;
return;
}
if (time == 0) // On spawn stuff
{
scaleFx = Owner.Calamity().buffedAuger ? 1.5f : 1;
attackTimer = cooldown;
if (Owner.Calamity().buffedAuger)
{
swingCount = 0;
}
}
if (scaleFx > 1 && !Owner.Calamity().buffedAuger) // Fade out the extra size from the big blade
scaleFx = MathHelper.Lerp(scaleFx, 1, 0.15f * Owner.GetAttackSpeed<MeleeDamageClass>());
if (attackTimer < 0) // When the sword isn't swinging
{
if ((pressedRight || Owner.Calamity().mouseRight) && !Owner.Calamity().buffedAuger && Owner.Calamity().arsenalCooldown <= 0)
Projectile.ai[2] = 5;
else
pressedRight = false;
if (longSwing && attackTimer == -1)
{
swingCount = -1;
}
attackTimer++;
time++;
if (longSwing && attackTimer <= cooldown * 0.35f)
{
float lerp = Utils.GetLerpValue(cooldown, -1, attackTimer, true);
bladefx = MathHelper.Lerp(bladefx, 0, lerp);
}
else
{
if (!Main.mouseLeft && longSwing && !Owner.Calamity().buffedAuger)
{
Projectile.Kill();
return;
}
float lerp = Utils.GetLerpValue((longSwing ? cooldown * 0.35f : cooldown), -1, attackTimer, true);
bladefx = MathHelper.Lerp(bladefx, 1.5f, lerp);
}
if (attackTimer >= cooldown * 0.3f)
{
if (makeSound && Owner.Calamity().buffedAuger) // Windup Sound
{
SoundStyle windup = new("CalamityMod/Sounds/Item/AugerWindup");
SoundEngine.PlaySound(windup with { Volume = 0.9f, Pitch = 0 }, Projectile.Center);
makeSound = false;
}
}
if (attackTimer == 0) // Reset a few things in prep for the next swing
{
pressedRight = false;
swingCount++;
makeSound = true;
makeHitbox = true;
}
else // Wind up animation in prep for the next swing
{
int swingDir = (swingCount % 2 == 0 ? 1 : -1);
float lerp = Utils.GetLerpValue(cooldown, -1, attackTimer, true);
bladeRot = MathHelper.Lerp(-MathHelper.Pi * swingDir, -MathHelper.PiOver4 * 3 * swingDir, CalamityUtils.EaseInOutExp(lerp, 2f, 2f));
}
return;
}
if (attackTimer >= fireRate) // Once the swing is done, put it on cooldown
{
attackTimer = cooldown * (Owner.Calamity().buffedAuger ? 3 : 1);
if (Owner.Calamity().buffedAuger)
{
Owner.Calamity().buffedAuger = false;
}
}
else // Do the swing
{
int swingDir = (swingCount % 2 == 0 ? -1 : 1);
float lerp = Utils.GetLerpValue(0, fireRate - 1, attackTimer, true);
bladeRot = MathHelper.Lerp(-MathHelper.PiOver4 * 3 * swingDir, MathHelper.Pi * swingDir, CalamityUtils.EaseInOutExp(lerp, 5f, 3f));
if (lerp > 0.5f) // Halfway through make the hitbox and sound
{
if (makeHitbox)
{
SoundStyle swing = Owner.Calamity().buffedAuger ? new("CalamityMod/Sounds/Item/AugerBigSlash") : swingCount % 2 == 0 ? new("CalamityMod/Sounds/Item/AugerSlash1") : new("CalamityMod/Sounds/Item/AugerSlash2");
SoundEngine.PlaySound(swing with { Volume = Owner.Calamity().buffedAuger ? 1f : 0.7f, Pitch = -0.1f, MaxInstances = 2 }, Projectile.Center);
int damage = Projectile.damage;
if (Owner.Calamity().buffedAuger)
{
Owner.Calamity().GeneralScreenShakePower = 4f;
damage = (int)(damage * 1.5f);
}
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + toMouse * 20 * (float)Math.Pow(scaleFx, 4), toMouse * 25, ModContent.ProjectileType<AugerSlash>(), damage, 0, Projectile.owner, 0, swingCount, Owner.Calamity().buffedAuger ? 5 : 0);
makeHitbox = false;
}
if (Owner.Calamity().mouseRight)
pressedRight = true;
}
}
time++;
attackTimer++;
}
public override bool PreDraw(ref Color lightColor)
{
if (time < 3)
return false;
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/DraedonsArsenal/AugerHoldout").Value;
Texture2D glow = ModContent.Request<Texture2D>("CalamityMod/Projectiles/DraedonsArsenal/AugerHoldoutGlow").Value;
Texture2D blade = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowBlade").Value;
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
Vector2 vel = Projectile.rotation.ToRotationVector2();
float randSize = Main.rand.NextFloat(0.8f, 1f);
Color drawColor = Projectile.GetAlpha(lightColor);
float drawRotation = Projectile.rotation + (Owner.direction == -1 ? MathHelper.Pi : 0f);
Vector2 rotationPoint = texture.Size() * 0.5f;
SpriteEffects flipSprite = Owner.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
float lerp = Utils.GetLerpValue(0, fireRate - 1, attackTimer, true);
float length = MathHelper.Lerp(0f, 0.1f, CalamityUtils.EaseInOutExp(lerp, 1f, 1f));
float bladeRotation = drawRotation + MathHelper.PiOver2 * Owner.direction;
Vector2 bladePlaceAdjust = (bladeRotation - MathHelper.PiOver2).ToRotationVector2();
for (int i = 0; i < 2; i++)
Main.EntitySpriteDraw(blade, drawPosition + bladePlaceAdjust * 20, null, (i == 0 ? Effects.ArsenalEffects.ArsenalGaussColor : Color.White) with { A = 0 }, bladeRotation, new Vector2(blade.Width / 2, blade.Height), new Vector2((i == 0 ? 0.2f : 0.1f) * randSize, 0.2f * bladefx) * Projectile.scale * 0.07f * bladefx * scaleFx, SpriteEffects.None);
for (int i = 0; i < 2; i++)
Main.EntitySpriteDraw(bloom, drawPosition + bladePlaceAdjust * 20, null, (i == 0 ? Effects.ArsenalEffects.ArsenalGaussColor : Color.White) with { A = 0 }, bladeRotation, bloom.Size() / 2, (Projectile.ai[2] > 0 ? new Vector2(randSize, randSize * (i == 0 ? 1f : 0.9f)) * 0.1f : new Vector2(0.15f * bladefx * randSize, (i == 0 ? 0.1f : 0.05f))) * Projectile.scale * 0.9f * (Projectile.ai[2] > 0 ? pullFx : bladefx) * scaleFx, SpriteEffects.None);
if (scaleFx > 1)
{
for (int b = -2; b <= 2; b++)
{
if (b == 0)
b++;
for (int i = 0; i < 2; i++)
{
Main.EntitySpriteDraw(blade, drawPosition + bladePlaceAdjust * 20, null, (i == 0 ? Effects.ArsenalEffects.ArsenalGaussColor : Color.White) with { A = 0 }, bladeRotation + (MathHelper.PiOver4 * 0.55f * b), new Vector2(blade.Width / 2, blade.Height), new Vector2(0.65f * (i == 0 ? 0.1f : 0.05f), 0.09f * (i == 0 ? 1f : 0.9f) * (2 - Math.Abs(b * 0.5f))) * randSize * Projectile.scale * 0.2f * bladefx * (scaleFx - 1), SpriteEffects.None);
}
}
}
Vector2 placeAdjust = (drawRotation + MathHelper.PiOver2).ToRotationVector2() * 2.5f;
Main.EntitySpriteDraw(texture, drawPosition + placeAdjust, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite);
Main.EntitySpriteDraw(glow, drawPosition + placeAdjust, null, Color.White, drawRotation, rotationPoint, Projectile.scale, flipSprite);
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);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 659 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

+108
View File
@@ -0,0 +1,108 @@
using System;
using CalamityMod.Dusts;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.DraedonsArsenal
{
public class AugerPull : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Misc";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public int time = 0;
public float sine = 0;
public float shrink = 1;
public int strongTimer = 0;
public bool strong => strongTimer < 10;
public override void SetDefaults()
{
Projectile.width = Projectile.height = 250;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.tileCollide = false;
Projectile.timeLeft = 90;
Projectile.penetrate = -1;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 15;
}
public override void AI()
{
if (strongTimer == 0)
{
Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalGaussColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, 0, 1.1f, 0.7f, 30);
GeneralParticleHandler.SpawnParticle(bolt2);
for (int i = 0; i < 20; i++)
{
Vector2 dustVel2 = (Vector2.UnitX).RotatedByRandom(100) * Main.rand.NextFloat(10f, 15.5f);
Dust dust2 = Dust.NewDustPerfect(Projectile.Center + dustVel2.SafeNormalize(Vector2.UnitX) * 360, ModContent.DustType<SquashDust>(), -dustVel2 * 1.5f, 0, default, Main.rand.NextFloat(1.2f, 1.8f));
dust2.noGravity = true;
dust2.fadeIn = 0.3f;
dust2.color = Effects.ArsenalEffects.ArsenalGaussColor;
}
if (Projectile.timeLeft > 2)
{
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC target = Main.npc[i];
if (target != null && target.CanBeMoved(true) && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(target.Center, Projectile.Center) < 800)
{
Vector2 moveDir = target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX);
target.velocity = moveDir * 20;
target.Center += moveDir * 3f;
}
}
}
}
Vector2 dustVel = (Vector2.UnitX).RotatedByRandom(100) * Main.rand.NextFloat(3f, 8.5f);
Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel.SafeNormalize(Vector2.UnitX) * 120, Effects.ArsenalEffects.ArsenalGaussDust, -dustVel, 0, default, Main.rand.NextFloat(0.5f, 1f));
dust.noGravity = true;
dust.fadeIn = 0.05f;
dust.color = Effects.ArsenalEffects.ArsenalGaussColor;
for (int i = 0; i < Main.maxNPCs; i++)
{
NPC target = Main.npc[i];
if (target != null && target.CanBeMoved(true) && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1))
{
if (Vector2.Distance(target.Center, Projectile.Center) > 15 && Vector2.Distance(target.Center, Projectile.Center) < 400)
{
Vector2 moveDir = target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX);
target.velocity = Vector2.Lerp(target.velocity, moveDir * 18, 0.12f);
target.Center += moveDir * 2f;
}
}
}
Projectile.rotation += 0.05f;
if (shrink > 0)
shrink -= 0.05f;
else
shrink = 1;
if (!strong)
time++;
strongTimer++;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => false;
public override bool PreDraw(ref Color lightColor)
{
float shrinkFade = Math.Min(Utils.GetLerpValue(1, 0.7f, shrink, true), Utils.GetLerpValue(0f, 0.3f, shrink, true));
float sine = Math.Abs(MathHelper.Lerp((float)Math.Sin(time * 0.1f / MathHelper.Pi), 0.4f, 0.8f));
float sine2 = Math.Abs(MathHelper.Lerp((float)Math.Sin(time * 0.3f / MathHelper.Pi), 0.4f, 0.8f));
float fade = (float)Math.Pow(Utils.GetLerpValue(0, 10, Projectile.timeLeft, true), 3);
float areaScale = (strong ? 1f : 1) * fade;
Texture2D tex2 = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowSquareParticleBig").Value;
Color drawColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * (strong ? 0.5f : 0.3f) * shrinkFade;
Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor, MathHelper.PiOver4 - MathHelper.PiOver2 * sine * 3, tex2.Size() / 2f, (areaScale + sine * 0.5f) * shrink, SpriteEffects.None, 0);
Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor, MathHelper.PiOver2 * sine2 * 3, tex2.Size() / 2f, (areaScale - sine2 * 0.5f) * (float)Math.Pow(shrink, 2), SpriteEffects.None, 0);
return false;
}
}
}
+162
View File
@@ -0,0 +1,162 @@
using System;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.DraedonsArsenal
{
public class AugerSlash : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Misc";
public ref float time => ref Projectile.ai[0];
public float fade = 1;
public int lifetime = 25;
public Player Owner => Main.player[Projectile.owner];
public float scaleFx => Projectile.ai[2] == 5 ? 2 : 1;
public override void SetDefaults()
{
Projectile.width = Projectile.height = 120;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.timeLeft = lifetime;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void AI()
{
Player Owner = Main.player[Projectile.owner];
float targetDist = Vector2.Distance(Owner.Center, Projectile.Center);
fade = (float)Math.Pow(Utils.GetLerpValue(lifetime * 0.1f, lifetime * 0.5f, Projectile.timeLeft, true), 4);
if (Projectile.velocity.Length() > 0.1f)
Projectile.velocity *= 0.45f;
int dusts = (int)(30 * scaleFx);
if (time == 1)
{
for (int i = 0; i < dusts; i++)
{
float variance = Utils.GetLerpValue(0, dusts, i, true) * Main.rand.NextFloat(0.9f, 1f);
float rot = MathHelper.Lerp(-0.7f * scaleFx, 0.7f * scaleFx, variance) * Projectile.direction;
float swingDirScale = Projectile.ai[1] != 1 ? (1 - variance) : variance;
float scale = 0.4f + swingDirScale * 2f;
float rotScaling = 1 - Math.Abs(rot);
Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(rot) * (70 / scaleFx + 80 * (float)Math.Pow(rotScaling, 1.5f) * Main.rand.NextFloat(0.85f, 1f)) * scaleFx;
Vector2 finalDustVel = (vel * (float)Math.Pow(rotScaling, 1.5f) + (vel.RotatedBy(-MathHelper.PiOver2 * rot) * 1.5f)) * 0.03f;
Dust s = Dust.NewDustPerfect(Projectile.Center + vel - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 45 * scaleFx, ModContent.DustType<SquashDust>(), finalDustVel / scaleFx);
s.scale = scale * scaleFx;
s.noGravity = true;
s.color = Color.Lerp(Effects.ArsenalEffects.ArsenalGaussColor, Color.White, Math.Max(0, swingDirScale - 0.35f));
s.fadeIn = 0.1f + swingDirScale;
}
}
Lighting.AddLight(Projectile.Center, Color.Lerp(Effects.ArsenalEffects.ArsenalGaussColor, Color.White, 0.3f).ToVector3() * 0.7f);
time++;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0)
{
Projectile.numHits -= 1;
}
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Projectile.ai[2] == 5)
{
foreach (Projectile p in Main.ActiveProjectiles)
{
if (p.type == ModContent.ProjectileType<AugerPull>() && p.owner == Projectile.owner)
{
if (p.timeLeft > 2)
p.timeLeft = 2;
}
}
}
Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX);
float launchPower = (Projectile.ai[2] == 5 ? 35 : 14);
target.MoveNPC(launchVel, launchPower, true);
if (Projectile.ai[2] == 5)
modifiers.SetCrit();
float critDamage = Math.Min(Owner.GetTotalCritChance(Projectile.DamageType) * 0.01f, 1f);
float minMult = 0.3f;
int hitsToMinMult = 7;
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
modifiers.SourceDamage *= (Projectile.ai[2] == 5 ? (1f + critDamage) : 1) * damageMult;
if (Projectile.numHits == 0)
{
SoundStyle hit = new("CalamityMod/Sounds/Item/AugerHit");
SoundEngine.PlaySound(hit with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 2 }, target.Center);
}
if (Projectile.numHits < 4)
{
for (int i = 0; i < (14 - Projectile.numHits * 2); i++)
{
float rot = Main.rand.NextFloat(-0.3f, 0.3f);
Dust s = Dust.NewDustPerfect(target.Center, ModContent.DustType<SquashDust>(), Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(rot) * (float)Math.Pow(scaleFx, 1.5f) * Main.rand.NextFloat(8, 12) * (1 - Math.Abs(rot)));
s.scale = Main.rand.NextFloat(1.6f, 1.9f) * (1 - Math.Abs(rot));
s.noGravity = true;
s.color = Color.Lerp(Effects.ArsenalEffects.ArsenalGaussColor, Color.White, Main.rand.NextFloat(0, 0.4f));
s.fadeIn = -0.5f;
if (i % 3 != 0)
{
Dust s2 = Dust.NewDustPerfect(target.Center, Effects.ArsenalEffects.ArsenalGaussDust, Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.6f) * (float)Math.Pow(scaleFx, 1.5f) * Main.rand.NextFloat(5, 10));
s2.scale = Main.rand.NextFloat(0.9f, 1.4f);
s2.noGravity = true;
s2.color = Effects.ArsenalEffects.ArsenalGaussColor;
}
}
}
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (Projectile.timeLeft <= 10)
return false;
Player Owner = Main.player[Projectile.owner];
Vector2 start = (time < 2 ? Owner.Center : Projectile.Center);
float scale = (scaleFx > 1 ? 1.5f : 1);
float length = 135 * scale;
float size = 135 * scale;
float _ = float.NaN;
bool hit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, start + Projectile.velocity.SafeNormalize(Vector2.UnitX) * length, size, ref _);
return (hit);
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D proj = ModContent.Request<Texture2D>("CalamityMod/Projectiles/DraedonsArsenal/AugerSlash").Value;
Vector2 vel = Projectile.rotation.ToRotationVector2();
Color drawColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 };
float drawRotation = Projectile.velocity.ToRotation();
float lerp = 1 - (float)Math.Pow((Utils.GetLerpValue(lifetime, 0, time, true)), 2f);
float sizeLerp = (float)Math.Pow((Utils.GetLerpValue(lifetime, lifetime * 0.2f, time, true)), 5f);
Vector2 squash = new Vector2(1 + lerp * 0.5f, 1.25f - lerp * 1.1f) * 0.08f * sizeLerp;
Vector2 rotationPoint = new Vector2(proj.Width * 0.85f, proj.Height / 2);
Vector2 drawPosition = Projectile.Center - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 105;
SpriteEffects spfx = (Projectile.ai[1] == 0 ? SpriteEffects.None : SpriteEffects.FlipVertically);
if (Projectile.direction == -1)
spfx = (Projectile.ai[1] != 0 ? SpriteEffects.None : SpriteEffects.FlipVertically);
Main.EntitySpriteDraw(proj, drawPosition, null, Color.White with { A = 0 } * sizeLerp, drawRotation, rotationPoint, squash * Projectile.scale * scaleFx, spfx);
/*for (int i = 0; i < 15; i++)
{
Color auraColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * 0.05f;
Vector2 drawOffset = (MathHelper.TwoPi * i / 15f).ToRotationVector2() * 0.7f;
Main.EntitySpriteDraw(proj, drawPosition + drawOffset, null, drawColor * (float)Math.Pow(sizeLerp, 1.8f), drawRotation, rotationPoint, squash * Projectile.scale, spfx);
}*/
//Main.EntitySpriteDraw(proj, drawPosition, null, Color.White with { A = 0 }, drawRotation, rotationPoint, squash * Projectile.scale * 0.06f, SpriteEffects.None);
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 435 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.