Start of the Seashine Sword

This commit is contained in:
Xyk authored and Cameron Ewell committed 2025-03-11 15:41:13 -04:00
1 parent 07f09faf38
commit 81e0fd718b
13 files changed
+352 -168

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
using CalamityMod.Projectiles.Summon;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Summon
{
public class SeashineSwordBuff : BaseSummonBuff
{
protected override int MinionProjectileType => ModContent.ProjectileType<SeashineSwordProj>();
protected override ref bool MinionBool => ref BuffModdedOwner.seashineSwordBuff;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

+2
View File
@@ -1452,6 +1452,7 @@ namespace CalamityMod.CalPlayer
/// <summary> Dragonblood Disgorger. </summary>
public bool dragonFamily = false;
public bool providenceStabber = false;
public bool seashineSwordBuff = false;
public bool saros = false;
/// <summary> Fuel Cell Bundle. </summary>
public bool plaguebringerMK2 = false;
@@ -2600,6 +2601,7 @@ namespace CalamityMod.CalPlayer
powerfulRaven = false;
dragonFamily = false;
providenceStabber = false;
seashineSwordBuff = false;
plaguebringerMK2 = false;
igneousExaltation = false;
GlacialEmbrace = false;
-49
View File
@@ -1,49 +0,0 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.SunkenSea;
using CalamityMod.Projectiles.Melee;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Melee
{
public class SeashineSword : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
public override void SetDefaults()
{
Item.CloneDefaults(ItemID.EnchantedSword);
Item.width = 40;
Item.height = 40;
Item.useTime = 30;
Item.damage = 25;
Item.DamageType = DamageClass.Melee;
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
Item.knockBack = 4f;
Item.shootSpeed = 12f;
Item.rare = ItemRarityID.Green;
Item.UseSound = SoundID.Item1;
Item.shoot = ModContent.ProjectileType<SeashineSwordProj>();
}
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
}
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
{
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 120);
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PearlShard>(3).
AddIngredient<SeaPrism>(7).
AddIngredient<Navystone>(10).
AddTile(TileID.Anvils).
Register();
}
}
}
+92
View File
@@ -0,0 +1,92 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.SunkenSea;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Summon;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.Weapons.Summon
{
public class SeashineSword : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Summon";
public override void SetDefaults()
{
Item.width = 40;
Item.height = 40;
Item.useTime = 20;
Item.useAnimation = 20;
Item.damage = 55;
Item.noMelee = true;
Item.noUseGraphic = true;
Item.autoReuse = true;
Item.useStyle = ItemUseStyleID.Shoot;
Item.DamageType = DamageClass.Summon;
Item.value = CalamityGlobalItem.RarityGreenBuyPrice;
Item.knockBack = 1f;
Item.shootSpeed = 12f;
Item.mana = 10;
Item.rare = ItemRarityID.Green;
Item.UseSound = SoundID.Item1;
Item.shoot = ModContent.ProjectileType<SeashineSwordProj>();
}
public override void HoldItem(Player player)
{
player.Calamity().mouseWorldListener = true;
if (player.Calamity().mouseRight)
{
for (int x = 0; x < Main.maxProjectiles; x++)
{
Projectile projectile = Main.projectile[x];
if (projectile.active && projectile.type == Item.shoot && projectile.ai[0] < 5 && projectile.timeLeft < 90000 - 180)
{
projectile.ai[0] = 5;
}
}
}
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
int pr = Projectile.NewProjectile(source, player.Center, velocity, type, damage, knockback, player.whoAmI);
if (Main.projectile.IndexInRange(pr))
Main.projectile[pr].originalDamage = Item.damage;
float angleMax = MathHelper.ToRadians(360f);
if (CalamityUtils.CountProjectiles(type) == 1)
angleMax = 0f;
float index = 1f;
if (player.ownedProjectileCounts[Item.shoot] > 30)
{
angleMax += MathHelper.ToRadians((player.ownedProjectileCounts[Item.shoot] - 30) * 2.5f);
}
angleMax = angleMax > MathHelper.ToRadians(360f) ? MathHelper.ToRadians(360f) : angleMax; // More intuative than using a min function
foreach (Projectile p in Main.ActiveProjectiles)
{
if (p.type == type && p.owner == player.whoAmI)
{
p.ai[2] = (index / CalamityUtils.CountProjectiles(type)) * angleMax - angleMax / 2f;
p.ai[1] = index;
p.netUpdate = true;
index++;
}
}
return false;
}
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<PearlShard>(3).
AddIngredient<SeaPrism>(7).
AddIngredient<Navystone>(10).
AddTile(TileID.Anvils).
Register();
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 784 B

After

Width:  |  Height:  |  Size: 784 B

@@ -1603,3 +1603,8 @@ PopoNoselessBuff: {
DisplayName: Noseless Popo
Description: Your nose has been stolen!
}
SeashineSwordBuff: {
DisplayName: Seashine Sword Buff
Description: Mods.CalamityMod.Buffs.SeashineSwordBuff.Description
}
@@ -923,3 +923,8 @@ AmphibiansGuitar: {
"I'll show you suffering!"
'''
}
SeashineSword: {
DisplayName: Seashine Sword
Tooltip: ""
}
@@ -334,3 +334,4 @@ FlarebatMinion.DisplayName: Flarebat
FrostbatMinion.DisplayName: Frostbat
AmphibiansGuitarMinion.DisplayName: Amphibian's Guitars
AmphibiansGuitarProjectile.DisplayName: Note
SeashineSwordProj.DisplayName: Seashine Sword Proj
Binary file not shown.

After

Width:  |  Height:  |  Size: 303 KiB

-119
View File
@@ -1,119 +0,0 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class SeashineSwordProj : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
private const int TimeLeft = 600;
private const int MaxAlpha = 255;
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Type] = 10;
ProjectileID.Sets.TrailingMode[Type] = 1;
}
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.tileCollide = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.timeLeft = TimeLeft;
Projectile.alpha = MaxAlpha;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, 0f, (byte.MaxValue - Projectile.alpha) * 0.5f / byte.MaxValue, (byte.MaxValue - Projectile.alpha) * 0.5f / byte.MaxValue);
if (Projectile.localAI[1] < 7f)
{
Projectile.localAI[1] += 1f;
}
else
{
float dustScale = 1.8f * Projectile.scale;
int dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= -0.25f;
dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= -0.25f;
Main.dust[dust].position -= Projectile.velocity * 0.5f;
if (Projectile.localAI[0] == 0f)
{
Projectile.scale -= 0.02f;
Projectile.alpha += 10;
if (Projectile.alpha >= MaxAlpha - 5)
{
Projectile.alpha = MaxAlpha;
Projectile.localAI[0] = 1f;
}
}
else if (Projectile.localAI[0] == 1f)
{
Projectile.scale += 0.02f;
Projectile.alpha -= 10;
if (Projectile.alpha <= 0)
{
Projectile.alpha = 0;
Projectile.localAI[0] = 0f;
}
}
}
if (Projectile.ai[1] == 0f)
{
Projectile.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item8, Projectile.Center);
}
Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4;
}
public override bool PreDraw(ref Color lightColor)
{
if (Projectile.timeLeft > TimeLeft - 5)
return false;
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2);
return false;
}
public override Color? GetAlpha(Color lightColor) => new Color(128, byte.MaxValue, byte.MaxValue);
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 60);
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 60);
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item10, Projectile.Center);
for (int i = 4; i < 31; i++)
{
float oldXVel = Projectile.oldVelocity.X * (30f / (float)i);
float oldYVel = Projectile.oldVelocity.Y * (30f / (float)i);
float dustScale = 3.6f * Projectile.scale;
int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale);
Main.dust[dust].noGravity = true;
dustScale = 3f * Projectile.scale;
dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, DustID.Flare_Blue, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= 0.1f;
}
}
}
}
+235
View File
@@ -0,0 +1,235 @@
using System;
using System.Drawing.Drawing2D;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.Summon;
using CalamityMod.Dusts;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Summon
{
public class SeashineSwordProj : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Summon";
public Player Owner => Main.player[Projectile.owner];
public float attackTimer = 0;
public float time = 0;
public bool isSpawning => time < 180;
public float bladeFade = 0;
public Vector2 tipPosition;
public Vector2 savedTipPos = Vector2.Zero;
public bool attackMode = false;
public Vector2 startPos;
public Vector2 endPos;
public bool setPos = true;
public bool isAttacking = false;
public bool readySound = true;
public override void SetStaticDefaults()
{
ProjectileID.Sets.MinionSacrificable[Type] = true;
//ProjectileID.Sets.MinionTargettingFeature[Type] = true;
}
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.netImportant = true;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.minionSlots = 1f;
Projectile.timeLeft = 90000;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.minion = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 8 * Projectile.MaxUpdates;
Projectile.DamageType = DamageClass.Summon;
Projectile.extraUpdates = 2;
}
public override void AI()
{
if (Projectile.ai[0] == 5 && bladeFade >= 1)
isAttacking = true;
else if (attackTimer == 0)
Projectile.ai[0] = 0;
Lighting.AddLight(Projectile.Center, Color.Cyan.ToVector3() * 0.6f);
ApplyPlayerBuffs();
tipPosition = Projectile.Center + (Vector2.UnitX * MathHelper.Clamp(bladeFade * 85, 25, 2000)).RotatedBy(Projectile.rotation);
Vector2 tipVel = (savedTipPos - tipPosition);
savedTipPos = tipPosition;
attackMode = Owner.HeldItem.type == ModContent.ItemType<SeashineSword>();
if (isSpawning)
{
if (time >= 90)
{
if (time == 90)
{
for (int i = 0; i < 8; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LightDust>(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f));
dust.noGravity = false;
dust.scale = Main.rand.NextFloat(0.65f, 1f);
dust.color = Color.Cyan;
dust.noLightEmittence = true;
}
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/ExobladeBeamSlash") with { Volume = 0.45f, Pitch = 0.7f }, Projectile.Center);
}
Projectile.rotation = Utils.AngleLerp(Projectile.rotation, -Vector2.UnitY.ToRotation(), 0.05f);
Projectile.Center += Vector2.UnitY * -0.5f * Utils.GetLerpValue(180, 40, time, true);
}
else
{
Projectile.rotation += 0.3f * Projectile.direction;
Projectile.velocity *= 0.96f;
Dust dust = Dust.NewDustPerfect(tipPosition, ModContent.DustType<LightDust>(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 0.2f));
dust.noGravity = false;
dust.scale = Main.rand.NextFloat(0.55f, 0.7f);
dust.color = Color.Cyan;
dust.noLightEmittence = true;
}
}
else
{
if (isAttacking)
{
//Projectile.velocity += Utils.DirectionTo(Projectile.Center, Owner.ClampedMouseWorld());
attackTimer++;
if (attackTimer >= 70 + Projectile.ai[1] * 8)
{
attackTimer = 50;
Projectile.ai[0] = 0;
setPos = true;
isAttacking = false;
readySound = true;
bladeFade = 0.9f;
Projectile.numHits = 0;
}
if (attackTimer > Projectile.ai[1] * 8 && Projectile.ai[0] != 0)
{
Vector2 toMouse = Utils.DirectionTo(Projectile.Center, Owner.ClampedMouseWorld());
float lerp = Utils.GetLerpValue(30, 60 + Projectile.ai[1] * 8, attackTimer);
if (setPos)
{
startPos = Projectile.Center;
endPos = Owner.Calamity().mouseWorld + toMouse * 480;
Projectile.numHits = 0;
setPos = false;
}
//Particle orb = new CustomSpark(startPos, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 35, 0.75f, Color.OrangeRed * 0.75f, new Vector2(1f, 1));
//GeneralParticleHandler.SpawnParticle(orb);
//Particle or2b = new CustomSpark(endPos, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 35, 0.75f, Color.OrangeRed * 0.75f, new Vector2(1f, 1));
//GeneralParticleHandler.SpawnParticle(or2b);
Projectile.velocity = (Vector2.Lerp(startPos, endPos, lerp) - Projectile.Center) / 18;
float angles = 120 * (Projectile.ai[1] % 2 == 0 ? -1 : 1);
float rot = Utils.DirectionTo(startPos, endPos).RotatedBy(MathHelper.Lerp(MathHelper.ToRadians(-angles), MathHelper.ToRadians(angles), lerp)).ToRotation();
Projectile.rotation = Utils.AngleLerp(Projectile.rotation, rot, 0.1f);
}
}
else
{
float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 4 / MathHelper.Pi);
Vector2 bonusPos = (Vector2.UnitY * 6).RotatedBy((Main.GlobalTimeWrappedHourly + Projectile.ai[1]) * 7);
if (bladeFade < 1 || !attackMode) // Chilling on your back
{
Projectile.rotation = Utils.AngleLerp(Projectile.rotation, Utils.DirectionTo(Owner.Center + Vector2.UnitY * -60, Projectile.Center).ToRotation(), 0.05f);
Vector2 destination = Owner.Center + bonusPos - Vector2.UnitY * 40 + (Vector2.UnitX * Owner.direction).RotatedBy(Projectile.ai[2] * Owner.direction / 3) * (-15 - Projectile.ai[1] * 18);
Projectile.velocity = (destination - Projectile.Center) / 18;
if (bladeFade < 1f)
bladeFade += 0.002f;
}
else if (attackMode) // Ready to attack
{
Vector2 toMouse = Utils.DirectionTo(Projectile.Center, Owner.ClampedMouseWorld());
Projectile.rotation = Utils.AngleLerp(Projectile.rotation, toMouse.ToRotation(), 0.1f);
Vector2 displace = Projectile.rotation.ToRotationVector2().RotatedBy(Projectile.ai[2] + Main.GlobalTimeWrappedHourly * 2) * 180;
Vector2 destination = Owner.ClampedMouseWorld() + bonusPos + displace - Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld()) * 335;
Projectile.velocity = (destination - Projectile.Center) / 18;
}
}
if (readySound && bladeFade >= 1)
{
for (int i = 0; i < 8; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LightDust>(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.5f));
dust.noGravity = false;
dust.scale = Main.rand.NextFloat(0.65f, 1f);
dust.color = Color.Cyan;
dust.noLightEmittence = true;
}
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/ExobladeBeamSlash") with { Volume = 0.45f, Pitch = 0.7f }, Projectile.Center);
readySound = false;
}
if (bladeFade < 1 || (isAttacking && attackTimer > Projectile.ai[1] * 8 + 5))
{
Particle orb = new CustomSpark(tipPosition, tipVel.SafeNormalize(Vector2.UnitX), "CalamityMod/Particles/BloomCircle", false, 25, Utils.Remap(tipVel.Length(), 2, 15, 0.15f, 0.3f, true), Color.Cyan * 0.65f, new Vector2(1f, 1), true, true, shrinkSpeed: Utils.Remap(tipVel.Length(), 1, 8, 0f, 0.4f, true), glowOpacity: 0.8f);
GeneralParticleHandler.SpawnParticle(orb);
}
}
time++;
if (!isAttacking && (attackTimer > 0 || !attackMode))
{
bladeFade = MathHelper.Lerp(bladeFade, 0, 0.025f);
if (attackTimer > 0)
attackTimer--;
}
}
public void ApplyPlayerBuffs()
{
Owner.AddBuff(ModContent.BuffType<SeashineSwordBuff>(), 3600);
if (Projectile.type == ModContent.ProjectileType<SeashineSwordProj>())
{
if (Owner.dead)
Owner.Calamity().seashineSwordBuff = false;
if (Owner.Calamity().seashineSwordBuff)
Projectile.timeLeft = 2;
}
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Summon/SeashineSword").Value;
Texture2D tex2 = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowBlade").Value;
Vector2 drawPos = Projectile.Center - Main.screenPosition;
//Projectile.DrawProjectileWithBackglow(Color.Cyan with { A = 0 }, lightColor, 2.5f, tex);
for (int i = 0; i < 3; i++)
Main.EntitySpriteDraw(tex2, drawPos - (Vector2.UnitY.RotatedBy(Projectile.rotation + MathHelper.ToRadians(90)) * 43 * bladeFade), null, Color.Lerp(Color.Cyan, Color.White, i * 0.3f) with { A = 0 }, Projectile.rotation + MathHelper.ToRadians(90), tex2.Size() * 0.5f, new Vector2(0.33f - i * 0.05f, (0.75f + i * 0.03f) * bladeFade) * 0.05f, SpriteEffects.None);
Main.EntitySpriteDraw(tex, drawPos, null, lightColor, Projectile.rotation + MathHelper.ToRadians(45), tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None);
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 60);
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
float minMult = 0.15f;
int hitsToMinMult = 3;
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
modifiers.SourceDamage *= isAttacking ? damageMult : 0.1f;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) // Custom collision since it's a spear
{
// Perform an AABB line collision check to check the whole spear.
float _ = float.NaN;
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, tipPosition, 20 * Projectile.scale, ref _);
}
public override bool? CanDamage() => (bladeFade >= 1 && attackMode) ? null : false;
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 432 B

After

Width:  |  Height:  |  Size: 432 B