aotc work and better aligned charge bars for the ark line
This commit is contained in:
1 parent
343e35c8e7
commit
d047e71e9c
15 files changed
+272
-131
No files matched your search
@@ -76,7 +76,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
if (player.altFunctionUse == 2)
|
||||
{
|
||||
if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType<ArkoftheAncientsParryHoldout>() || n.type == ProjectileType<TrueArkoftheAncientsParryHoldout>() || n.type == ProjectileType<ArkoftheElementsParryHoldout>())))
|
||||
if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType<ArkoftheAncientsParryHoldout>() || n.type == ProjectileType<TrueArkoftheAncientsParryHoldout>() || n.type == ProjectileType<ArkoftheElementsParryHoldout>() || n.type == ProjectileType<ArkoftheCosmosParryHoldout>())))
|
||||
Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), ProjectileType<ArkoftheAncientsParryHoldout>(), damage, 0, player.whoAmI, 0, 0);
|
||||
return false;
|
||||
}
|
||||
@@ -150,15 +150,17 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
if (Charge <= 0)
|
||||
return;
|
||||
|
||||
float barScale = 1.3f;
|
||||
|
||||
var barBG = GetTexture("CalamityMod/ExtraTextures/GenericBarBack");
|
||||
var barFG = GetTexture("CalamityMod/ExtraTextures/GenericBarFront");
|
||||
|
||||
Vector2 drawPos = position + Vector2.UnitY * frame.Height * scale + Vector2.UnitX * (frame.Width - barBG.Width) * scale * 0.5f;
|
||||
Vector2 drawPos = position + Vector2.UnitY * (frame.Height - 2) * scale + Vector2.UnitX * (frame.Width - barBG.Width * barScale) * scale * 0.5f;
|
||||
Rectangle frameCrop = new Rectangle(0, 0, (int)(Charge / 10f * barFG.Width), barFG.Height);
|
||||
Color color = Main.hslToRgb((Main.GlobalTime * 0.6f) % 1, 1, 0.85f + (float)Math.Sin(Main.GlobalTime * 3f) * 0.1f);
|
||||
|
||||
spriteBatch.Draw(barBG, drawPos, null, color , 0f, origin, scale, 0f, 0f);
|
||||
spriteBatch.Draw(barFG, drawPos, frameCrop, color * 0.8f, 0f, origin, scale, 0f, 0f);
|
||||
spriteBatch.Draw(barBG, drawPos, null, color , 0f, origin, scale * barScale, 0f, 0f);
|
||||
spriteBatch.Draw(barFG, drawPos, frameCrop, color * 0.8f, 0f, origin, scale * barScale, 0f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public static float snapDamageMultiplier = 1.3f; //Extra damage from making the scissors snap
|
||||
public static float chargeDamageMultiplier = 1.6f; //Extra damage from charge
|
||||
public static float chainDamageMultiplier = 0.1f;
|
||||
public static int DashIframes = 18;
|
||||
|
||||
const string ComboTooltip = "Performs a combo of swings, alternating between narrow and wide swings and throwing the blade out every 5 swings\n" +
|
||||
"The thrown blade is held in place by constellations and will follow your cursor\n" +
|
||||
@@ -58,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.width = item.height = 136;
|
||||
item.damage = 140;
|
||||
item.damage = 1705;
|
||||
item.melee = true;
|
||||
item.noMelee = true;
|
||||
item.noUseGraphic = true;
|
||||
@@ -67,7 +68,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
item.useTurn = true;
|
||||
item.useStyle = ItemUseStyleID.HoldingOut;
|
||||
item.knockBack = 9.5f;
|
||||
item.UseSound = SoundID.Item60;
|
||||
item.UseSound = null;
|
||||
item.autoReuse = true;
|
||||
item.value = CalamityGlobalItem.Rarity15BuyPrice;
|
||||
item.rare = ItemRarityID.Purple;
|
||||
@@ -103,7 +104,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
if (Charge > 0 && player.controlUp)
|
||||
{
|
||||
float angle = new Vector2(speedX, speedY).ToRotation();
|
||||
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, new Vector2(speedX, speedY), ProjectileType<ArkoftheElementsSnapBlast>(), (int)(damage * Charge * 1.8f), 0, player.whoAmI, angle, 600);
|
||||
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, new Vector2(speedX, speedY), ProjectileType<ArkoftheCosmosBlast>(), (int)(damage * Charge * 1.8f), 0, player.whoAmI, Charge);
|
||||
|
||||
if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3)
|
||||
Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3;
|
||||
@@ -111,8 +112,8 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
Charge = 0;
|
||||
}
|
||||
|
||||
else if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType<ArkoftheAncientsParryHoldout>() || n.type == ProjectileType<TrueArkoftheAncientsParryHoldout>() || n.type == ProjectileType<ArkoftheElementsParryHoldout>())))
|
||||
Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), ProjectileType<ArkoftheElementsParryHoldout>(), damage, 0, player.whoAmI, 0, 0);
|
||||
else if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType<ArkoftheAncientsParryHoldout>() || n.type == ProjectileType<TrueArkoftheAncientsParryHoldout>() || n.type == ProjectileType<ArkoftheElementsParryHoldout>() || n.type == ProjectileType<ArkoftheCosmosParryHoldout>())))
|
||||
Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), ProjectileType<ArkoftheCosmosParryHoldout>(), damage, 0, player.whoAmI, 0, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -191,5 +192,36 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
Charge = reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
|
||||
{
|
||||
Texture2D handleTexture = GetTexture("CalamityMod/Items/Weapons/Melee/ArkoftheCosmosHandle");
|
||||
Texture2D bladeTexture = GetTexture("CalamityMod/Items/Weapons/Melee/ArkoftheCosmosGlow");
|
||||
|
||||
float bladeOpacity = (Charge > 0) ? 1f : MathHelper.Clamp((float)Math.Sin(Main.GlobalTime % MathHelper.Pi) * 2f, 0, 1) * 0.7f + 0.3f;
|
||||
|
||||
spriteBatch.Draw(handleTexture, position, null, drawColor, 0f, origin, scale, SpriteEffects.None, 0f); //Make the back scissor slightly transparent if the ark isnt charged
|
||||
spriteBatch.Draw(bladeTexture, position, null, drawColor * bladeOpacity, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
|
||||
{
|
||||
if (Charge <= 0)
|
||||
return;
|
||||
|
||||
var barBG = GetTexture("CalamityMod/ExtraTextures/GenericBarBack");
|
||||
var barFG = GetTexture("CalamityMod/ExtraTextures/GenericBarFront");
|
||||
|
||||
float barScale = 3f;
|
||||
|
||||
Vector2 drawPos = position + Vector2.UnitY * (frame.Height - 8) * scale + Vector2.UnitX * (frame.Width - barBG.Width * barScale) * scale * 0.5f;
|
||||
Rectangle frameCrop = new Rectangle(0, 0, (int)(Charge / 10f * barFG.Width), barFG.Height);
|
||||
Color color = Main.hslToRgb((Main.GlobalTime * 0.6f) % 1, 1, 0.75f + (float)Math.Sin(Main.GlobalTime * 3f) * 0.1f);
|
||||
|
||||
spriteBatch.Draw(barBG, drawPos, null, color, 0f, origin, scale * barScale, 0f, 0f);
|
||||
spriteBatch.Draw(barFG, drawPos, frameCrop, color * 0.8f, 0f, origin, scale * barScale, 0f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
@@ -101,7 +101,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
if (Charge > 0 && player.controlUp)
|
||||
{
|
||||
float angle = new Vector2(speedX, speedY).ToRotation();
|
||||
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, new Vector2(speedX, speedY), ProjectileType<ArkoftheElementsSnapBlast>(), (int)(damage * Charge * 1.8f), 0, player.whoAmI, angle, 600);
|
||||
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, new Vector2(speedX, speedY), ProjectileType<ArkoftheElementsSnapBlast>(), (int)(damage * Charge * 1.8f), 0, player.whoAmI);
|
||||
|
||||
if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3)
|
||||
Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3;
|
||||
@@ -109,7 +109,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
Charge = 0;
|
||||
}
|
||||
|
||||
else if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType<ArkoftheAncientsParryHoldout>() || n.type == ProjectileType<TrueArkoftheAncientsParryHoldout>() || n.type == ProjectileType<ArkoftheElementsParryHoldout>())))
|
||||
else if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType<ArkoftheAncientsParryHoldout>() || n.type == ProjectileType<TrueArkoftheAncientsParryHoldout>() || n.type == ProjectileType<ArkoftheElementsParryHoldout>() || n.type == ProjectileType<ArkoftheCosmosParryHoldout>())))
|
||||
Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), ProjectileType<ArkoftheElementsParryHoldout>(), damage, 0, player.whoAmI, 0, 0);
|
||||
|
||||
return false;
|
||||
@@ -226,7 +226,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
|
||||
float barScale = 3.5f;
|
||||
|
||||
Vector2 drawPos = position + Vector2.UnitY * frame.Height * scale + Vector2.UnitX * (frame.Width - barBG.Width * barScale) * scale * 0.5f;
|
||||
Vector2 drawPos = position + Vector2.UnitY * (frame.Height - 10) * scale + Vector2.UnitX * (frame.Width - barBG.Width * barScale) * scale * 0.5f;
|
||||
Rectangle frameCrop = new Rectangle(0, 0, (int)(Charge / 10f * barFG.Width), barFG.Height);
|
||||
Color color = Main.hslToRgb(((float)Math.Sin(Main.GlobalTime * 0.6f) * 0.5f + 0.5f) * 0.15f, 1, 0.85f + (float)Math.Sin(Main.GlobalTime * 3f) * 0.1f);
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
Charge = 0;
|
||||
}
|
||||
|
||||
else if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType<ArkoftheAncientsParryHoldout>() || n.type == ProjectileType<TrueArkoftheAncientsParryHoldout>() || n.type == ProjectileType<ArkoftheElementsParryHoldout>())))
|
||||
else if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType<ArkoftheAncientsParryHoldout>() || n.type == ProjectileType<TrueArkoftheAncientsParryHoldout>() || n.type == ProjectileType<ArkoftheElementsParryHoldout>() || n.type == ProjectileType<ArkoftheCosmosParryHoldout>())))
|
||||
Projectile.NewProjectile(player.Center, new Vector2(speedX, speedY), ProjectileType<TrueArkoftheAncientsParryHoldout>(), damage, 0, player.whoAmI, 0, 0);
|
||||
|
||||
return false;
|
||||
@@ -182,12 +182,14 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
var barBG = GetTexture("CalamityMod/ExtraTextures/GenericBarBack");
|
||||
var barFG = GetTexture("CalamityMod/ExtraTextures/GenericBarFront");
|
||||
|
||||
Vector2 drawPos = position + Vector2.UnitY * frame.Height * scale + Vector2.UnitX * (frame.Width - barBG.Width) * scale * 0.5f;
|
||||
float barScale = 1.5f;
|
||||
|
||||
Vector2 drawPos = position + Vector2.UnitY * ( frame.Height - 2f ) * scale + Vector2.UnitX * (frame.Width - barBG.Width * barScale) * scale * 0.5f;
|
||||
Rectangle frameCrop = new Rectangle(0, 0, (int)(Charge / 10f * barFG.Width), barFG.Height);
|
||||
Color color = Main.hslToRgb((Main.GlobalTime * 0.6f) % 1, 1, 0.85f + (float)Math.Sin(Main.GlobalTime * 3f) * 0.1f);
|
||||
|
||||
spriteBatch.Draw(barBG, drawPos, null, color, 0f, origin, scale, 0f, 0f);
|
||||
spriteBatch.Draw(barFG, drawPos, frameCrop, color * 0.8f, 0f, origin, scale, 0f, 0f);
|
||||
spriteBatch.Draw(barBG, drawPos, null, color, 0f, origin, scale * barScale, 0f, 0f);
|
||||
spriteBatch.Draw(barFG, drawPos, frameCrop, color * 0.8f, 0f, origin, scale * barScale, 0f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,8 @@ namespace CalamityMod.Particles
|
||||
//List containing the particles to delete
|
||||
private static List<Particle> particlesToKill;
|
||||
//Static list for details concerning every particle type
|
||||
private static Dictionary<Type, int> particleTypes;
|
||||
private static Dictionary<int, Texture2D> particleTextures;
|
||||
internal static Dictionary<Type, int> particleTypes;
|
||||
internal static Dictionary<int, Texture2D> particleTextures;
|
||||
private static List<Particle> particleInstances;
|
||||
//Lists used when drawing particles batched
|
||||
private static List<Particle> batchedAlphaBlendParticles;
|
||||
|
||||
@@ -24,6 +24,20 @@ namespace CalamityMod.Projectiles.Melee
|
||||
public override string Texture => "CalamityMod/Projectiles/Melee/RendingScissorsRight";
|
||||
|
||||
private bool initialized = false;
|
||||
public ref float Charge => ref projectile.ai[0];
|
||||
|
||||
public bool Dashing
|
||||
{
|
||||
get
|
||||
{
|
||||
return projectile.ai[1] == 1;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
projectile.ai[1] = value ? 1f : 0f;
|
||||
}
|
||||
}
|
||||
|
||||
const int maxStitches = 8;
|
||||
public int CurrentStitches => (int)Math.Ceiling((1 - (float)Math.Sqrt(1f - (float)Math.Pow(MathHelper.Clamp(StitchProgress * 3f, 0f, 1f), 2f))) * maxStitches);
|
||||
@@ -44,11 +58,16 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public int CurrentAnimation => (MaxTime - projectile.timeLeft) <= SnapTime ? 0 : (MaxTime - projectile.timeLeft) <= SnapTime + HoldTime ? 1 : 2;
|
||||
|
||||
public Vector2 scissorPosition => projectile.Center + ThrustDisplaceRatio() * projectile.velocity * 200f;
|
||||
|
||||
public Player Owner => Main.player[projectile.owner];
|
||||
|
||||
public Particle PolarStar;
|
||||
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Rending Scissors");
|
||||
DisplayName.SetDefault("Sundering Scissors");
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
@@ -91,7 +110,6 @@ namespace CalamityMod.Projectiles.Melee
|
||||
projectile.velocity.Normalize();
|
||||
projectile.rotation = projectile.velocity.ToRotation();
|
||||
|
||||
|
||||
initialized = true;
|
||||
projectile.netUpdate = true;
|
||||
projectile.netSpam = 0;
|
||||
@@ -101,6 +119,18 @@ namespace CalamityMod.Projectiles.Melee
|
||||
projectile.Center -= projectile.velocity; //Don't actually move xd //Yes i knowi could set the velocity to zero and then use the projectiles rotation but it saves me ToRotationVector2() clutter
|
||||
projectile.scale = 1.4f;
|
||||
|
||||
if (PolarStar == null)
|
||||
{
|
||||
PolarStar = new GenericSparkle(projectile.Center, Vector2.Zero, Color.White, Color.CornflowerBlue, projectile.scale * 2f, 2, 0.1f, 5f, true);
|
||||
GeneralParticleHandler.SpawnParticle(PolarStar);
|
||||
}
|
||||
else if (HoldProgress <= 0.4f)
|
||||
{
|
||||
PolarStar.Time = 0;
|
||||
PolarStar.Position = scissorPosition;
|
||||
PolarStar.Scale = projectile.scale * 2f;
|
||||
}
|
||||
|
||||
//Update stitches
|
||||
for (int i = 0; i < CurrentStitches; i++)
|
||||
{
|
||||
@@ -111,7 +141,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
SafeVolumeChange(ref sewSound, 0.5f);
|
||||
|
||||
float positionAlongLine = (ThrustDisplaceRatio() * 242f / (float)maxStitches * 0.5f) + MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, i / (float)maxStitches);
|
||||
Vector2 stitchCenter = projectile.Center + projectile.velocity * positionAlongLine + (projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f;
|
||||
Vector2 stitchCenter = projectile.Center + projectile.velocity * positionAlongLine;
|
||||
|
||||
|
||||
Particle spark = new CritSpark(stitchCenter, Vector2.Zero, Color.White, Color.Cyan, 3f, 8, 0.1f, 3);
|
||||
@@ -120,12 +150,21 @@ namespace CalamityMod.Projectiles.Melee
|
||||
StitchLifetimes[i]++;
|
||||
}
|
||||
|
||||
//Spawn particles when the line appears
|
||||
if (HoldTimer == 1)
|
||||
{
|
||||
//Check for the up arrow once more so if the player has good reflexes they can avoid the dash. Gives them more control
|
||||
if (Owner.controlUp && Charge >= 5)
|
||||
{
|
||||
Owner.GiveIFrames(ArkoftheCosmos.DashIframes);
|
||||
Dashing = true;
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
float positionAlongLine = MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, Main.rand.NextFloat(0f, 1f));
|
||||
Vector2 particlePosition = projectile.Center + projectile.velocity * positionAlongLine + (projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f;
|
||||
Vector2 particlePosition = projectile.Center + projectile.velocity * positionAlongLine;
|
||||
Color particleColor = Main.rand.NextBool() ? Color.OrangeRed : Main.rand.NextBool() ? Color.White : Color.Orange;
|
||||
float particleScale = Main.rand.NextFloat(0.05f, 0.4f) * (0.4f + 0.6f * (float)Math.Sin(positionAlongLine / (ThrustDisplaceRatio() * 242f) * MathHelper.Pi));
|
||||
|
||||
@@ -149,6 +188,34 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Owner.Calamity().LungingDown = false;
|
||||
|
||||
if (Dashing)
|
||||
{
|
||||
Owner.Calamity().LungingDown = true;
|
||||
Owner.fallStart = (int)(Owner.position.Y / 16f);
|
||||
Owner.velocity = Owner.DirectionTo(scissorPosition) * 60f;
|
||||
|
||||
if (Owner.Distance(scissorPosition) < 60f)
|
||||
{
|
||||
Dashing = false;
|
||||
Owner.velocity *= 0.1f; //Abrupt stop
|
||||
Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MeatySlash"), projectile.Center);
|
||||
|
||||
if (Owner.whoAmI == Main.myPlayer)
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
Projectile blast = Projectile.NewProjectileDirect(Owner.Center, Main.rand.NextVector2CircularEdge(15, 15), ProjectileType<GalaxiaBolt>(), (int)(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage * Owner.meleeDamage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.02f);
|
||||
{
|
||||
blast.timeLeft = 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
@@ -165,6 +232,16 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
if (Dashing)
|
||||
{
|
||||
Owner.velocity *= 0.1f; //Abrupt stop if the player was still dashing
|
||||
}
|
||||
|
||||
Owner.Calamity().LungingDown = false;
|
||||
}
|
||||
|
||||
//Animation keys
|
||||
public CurveSegment anticipation = new CurveSegment(EasingType.SineBump, 0f, 0.2f, -0.1f);
|
||||
public CurveSegment thrust = new CurveSegment(EasingType.PolyOut, 0.3f, 0.2f, 3f, 3);
|
||||
@@ -184,27 +261,23 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Texture2D sliceTex = GetTexture("CalamityMod/Particles/BloomLine");
|
||||
Color sliceColor = Color.Lerp(Color.OrangeRed, Color.White, SnapProgress);
|
||||
float rot = projectile.rotation + MathHelper.PiOver2;
|
||||
Vector2 nitpickShiftCorrection = (projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f; //Ngl these minor nitpick variables probably be horrible to understand when decompiled into Vector43
|
||||
Vector2 sliceScale = new Vector2(0.2f * (1 - SnapProgress) ,ThrustDisplaceRatio() * 242f);
|
||||
spriteBatch.Draw(sliceTex, projectile.Center + nitpickShiftCorrection - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0f);
|
||||
spriteBatch.Draw(sliceTex, projectile.Center - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0f);
|
||||
|
||||
|
||||
//Draw the scissors
|
||||
if (HoldProgress <= 0.4f)
|
||||
{
|
||||
Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRight");
|
||||
Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeft");
|
||||
Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeft");
|
||||
Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRight");
|
||||
|
||||
float snippingRotation = projectile.rotation + MathHelper.PiOver4;
|
||||
float snippingRotationBack = projectile.rotation + MathHelper.PiOver4 * 1.75f;
|
||||
float drawRotation = MathHelper.Lerp(snippingRotation - MathHelper.PiOver4, snippingRotation, RotationRatio());
|
||||
float drawRotationBack = MathHelper.Lerp(snippingRotation + MathHelper.PiOver4, snippingRotation, RotationRatio());
|
||||
|
||||
float nitpickAngleCorrection = MathHelper.ToRadians(6f); //ITS IMPORTANT MOM!
|
||||
float drawRotation = MathHelper.Lerp(snippingRotation + MathHelper.PiOver4, snippingRotation, RotationRatio()) + nitpickAngleCorrection;
|
||||
float drawRotationBack = MathHelper.Lerp(snippingRotationBack - MathHelper.PiOver4, snippingRotationBack, RotationRatio()) + nitpickAngleCorrection;
|
||||
|
||||
Vector2 drawOrigin = new Vector2(51, 86); //Right on the hole
|
||||
Vector2 drawOriginBack = new Vector2(22, 109); //Right on the hole
|
||||
Vector2 drawPosition = projectile.Center + ThrustDisplaceRatio() * projectile.velocity * 200f - Main.screenPosition;
|
||||
Vector2 drawOrigin = new Vector2(33, 86); //Right on the hole
|
||||
Vector2 drawOriginBack = new Vector2(44f, 86); //Right on the hole
|
||||
Vector2 drawPosition = scissorPosition - Main.screenPosition;
|
||||
|
||||
float opacity = (0.4f - HoldProgress) / 0.4f;
|
||||
Color drawColor = Color.Orange * opacity * 0.9f;
|
||||
@@ -227,7 +300,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Vector2 scale = new Vector2(ripWidth, (ThrustDisplaceRatio() * 242f) / lineTex.Height);
|
||||
float lineOpacity = StitchProgress < 0.75f ? 1f : 1 - (StitchProgress - 0.75f) * 4f;
|
||||
|
||||
spriteBatch.Draw(lineTex, projectile.Center - Main.screenPosition + Shake + nitpickShiftCorrection, null, Color.Lerp(Color.White, Color.OrangeRed * 0.7f, raise) * lineOpacity, rot, origin, scale, SpriteEffects.None, 0);
|
||||
spriteBatch.Draw(lineTex, projectile.Center - Main.screenPosition + Shake, null, Color.Lerp(Color.White, Color.OrangeRed * 0.7f, raise) * lineOpacity, rot, origin, scale, SpriteEffects.None, 0);
|
||||
|
||||
|
||||
//Draw the stitches
|
||||
@@ -236,7 +309,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
for (int i = 0; i < CurrentStitches; i++)
|
||||
{
|
||||
float positionAlongLine = (ThrustDisplaceRatio() * 242f / (float)maxStitches * 0.5f) + MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, i / (float)maxStitches);
|
||||
Vector2 stitchCenter = projectile.Center + projectile.velocity * positionAlongLine + nitpickShiftCorrection;
|
||||
Vector2 stitchCenter = projectile.Center + projectile.velocity * positionAlongLine;
|
||||
|
||||
rot = projectile.rotation + MathHelper.PiOver2 + StitchRotations[i];
|
||||
origin = new Vector2(lineTex.Width / 2f, lineTex.Height / 2f);
|
||||
|
||||
@@ -113,7 +113,6 @@ namespace CalamityMod.Projectiles.Melee
|
||||
var sound = Main.PlaySound(SoundID.Item84, projectile.Center);
|
||||
CalamityUtils.SafeVolumeChange(ref sound, 0.3f);
|
||||
|
||||
//Take the direction the sword is swung. FUCK not controlling the swing direction more than just left/right :|
|
||||
projectile.velocity = Owner.DirectionTo(Main.MouseWorld);
|
||||
projectile.velocity.Normalize();
|
||||
projectile.rotation = projectile.velocity.ToRotation();
|
||||
@@ -149,9 +148,9 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Owner.velocity += Vector2.Normalize(Owner.Center - proj.Center) * 2;
|
||||
}
|
||||
|
||||
//Reduce the projectile's damage by 100 for half a second.
|
||||
if (proj.Calamity().damageReduction < 200)
|
||||
proj.Calamity().damageReduction = 200;
|
||||
//Reduce the projectile's damage by 300 for half a second.
|
||||
if (proj.Calamity().damageReduction < 320)
|
||||
proj.Calamity().damageReduction = 320;
|
||||
if (proj.Calamity().damageReductionTimer < 60)
|
||||
proj.Calamity().damageReductionTimer = 60;
|
||||
break;
|
||||
@@ -208,19 +207,18 @@ namespace CalamityMod.Projectiles.Melee
|
||||
return false;
|
||||
}
|
||||
|
||||
Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRight");
|
||||
Texture2D frontBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRightGlow");
|
||||
Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeft");
|
||||
Texture2D backBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow");
|
||||
Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeft");
|
||||
Texture2D frontBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow");
|
||||
Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRight");
|
||||
Texture2D backBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow");
|
||||
|
||||
float snippingRotation = projectile.rotation + MathHelper.PiOver4;
|
||||
float snippingRotationBack = projectile.rotation + MathHelper.PiOver4 * 1.75f;
|
||||
|
||||
float drawRotation = MathHelper.Lerp(snippingRotation + MathHelper.PiOver4, snippingRotation, RotationRatio());
|
||||
float drawRotationBack = MathHelper.Lerp(snippingRotationBack - MathHelper.PiOver4, snippingRotationBack, RotationRatio());
|
||||
float drawRotation = MathHelper.Lerp(snippingRotation - MathHelper.PiOver4, snippingRotation, RotationRatio());
|
||||
float drawRotationBack = MathHelper.Lerp(snippingRotation + MathHelper.PiOver4, snippingRotation, RotationRatio());
|
||||
|
||||
Vector2 drawOrigin = new Vector2(51, 86); //Right on the hole
|
||||
Vector2 drawOriginBack = new Vector2(22, 109); //Right on the hole
|
||||
Vector2 drawOrigin = new Vector2(33, 86); //Right on the hole
|
||||
Vector2 drawOriginBack = new Vector2(44f, 86); //Right on the hole
|
||||
Vector2 drawPosition = Owner.Center + projectile.velocity * 15 + projectile.velocity * ThrustDisplaceRatio() * 50f - Main.screenPosition;
|
||||
|
||||
spriteBatch.Draw(backBlade, drawPosition, null, lightColor, drawRotationBack, drawOriginBack, projectile.scale, 0f, 0f);
|
||||
|
||||
@@ -64,15 +64,14 @@ namespace CalamityMod.Projectiles.Melee
|
||||
//Only used for the long range throw
|
||||
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed && Owner.HeldItem.type == ItemType<ArkoftheCosmos>();
|
||||
public bool Thrown => Combo == 2 || Combo == 3;
|
||||
const float MaxThrowTime = 140;
|
||||
const float ThrowReachMax = 500;
|
||||
const float ThrowReachMin = 200;
|
||||
public const float MaxThrowTime = 140;
|
||||
public const float ThrowReachMax = 500;
|
||||
public float ThrowReach;
|
||||
public float ThrowTimer => MaxThrowTime - projectile.timeLeft;
|
||||
public float ThrowCompletion => ThrowTimer / MaxThrowTime;
|
||||
|
||||
const float SnapWindowStart = 0.2f;
|
||||
const float SnapWindowEnd = 0.75f;
|
||||
public const float SnapWindowStart = 0.2f;
|
||||
public const float SnapWindowEnd = 0.75f;
|
||||
public float SnapEndTime => (MaxThrowTime - (MaxThrowTime * SnapWindowEnd));
|
||||
public float SnapEndCompletion => (SnapEndTime - projectile.timeLeft) / SnapEndTime;
|
||||
public ref float ChanceMissed => ref projectile.localAI[1];
|
||||
@@ -199,11 +198,8 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
//Spawn a constellation link
|
||||
|
||||
Projectile chain = Projectile.NewProjectileDirect(Owner.Center, Vector2.Zero, ProjectileType<AriesWrathConstellation>(), (int)(projectile.damage * ArkoftheCosmos.chainDamageMultiplier), 0, Owner.whoAmI);
|
||||
if (chain.modProjectile is AriesWrathConstellation constellation)
|
||||
{
|
||||
constellation.SizeVector = projectile.Center - Owner.Center;
|
||||
}
|
||||
Projectile chain = Projectile.NewProjectileDirect(Owner.Center, Vector2.Zero, ProjectileType<ArkoftheCosmosConstellation>(), (int)(projectile.damage * ArkoftheCosmos.chainDamageMultiplier), 0, Owner.whoAmI, (int)(projectile.timeLeft / 2f));
|
||||
chain.timeLeft = (int)(projectile.timeLeft / 2f);
|
||||
}
|
||||
|
||||
//Rotate the blade towards the cursor
|
||||
@@ -337,7 +333,10 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
if (smear == null)
|
||||
{
|
||||
smear = new TrientCircularSmear(projectile.Center, smearColor * opacity, projectile.rotation, projectile.scale * 1.7f);
|
||||
if (Charge <= 0)
|
||||
smear = new TrientCircularSmear(projectile.Center, smearColor * opacity, projectile.rotation, projectile.scale * 1.7f);
|
||||
else
|
||||
smear = new CircularSmearSmokeyVFX(projectile.Center, smearColor * opacity, projectile.rotation, projectile.scale * 1.7f);
|
||||
GeneralParticleHandler.SpawnParticle(smear);
|
||||
}
|
||||
//Update the variables of the smear
|
||||
@@ -475,11 +474,11 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[projectile.type] && Combo == 0f)
|
||||
{
|
||||
for (int i = 0; i < projectile.oldRot.Length; ++i)
|
||||
for (int i = 1; i < projectile.oldRot.Length; ++i)
|
||||
{
|
||||
Color color = Main.hslToRgb((i / (float)projectile.oldRot.Length) * 0.1f, 1, 0.6f + (Charge > 0 ? 0.3f : 0f));
|
||||
float afterimageRotation = projectile.oldRot[i] + angleShift + extraAngle;
|
||||
Main.spriteBatch.Draw(glowmask, drawOffset, null, color * 0.15f, afterimageRotation, drawOrigin, projectile.scale - 0.2f * ((i / (float)projectile.oldRot.Length)), flip, 0f);
|
||||
Main.spriteBatch.Draw(glowmask, drawOffset, null, color * 0.05f, afterimageRotation, drawOrigin, projectile.scale - 0.2f * ((i / (float)projectile.oldRot.Length)), flip, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,49 +505,48 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public void DrawSwungScissors(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
//Note to self: left scissor blade is the front one here
|
||||
Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRight");
|
||||
Texture2D frontBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRightGlow");
|
||||
|
||||
Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeft");
|
||||
Texture2D backBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow");
|
||||
Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeft");
|
||||
Texture2D frontBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow");
|
||||
Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRight");
|
||||
Texture2D backBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow");
|
||||
|
||||
//Front blade
|
||||
bool flipped = Owner.direction < 0;
|
||||
SpriteEffects flip = flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
float extraAngle = flipped ? MathHelper.PiOver2 : 0f;
|
||||
|
||||
float drawAngle = projectile.rotation;
|
||||
float angleShift = (Combo == 0 || !flipped) ? MathHelper.PiOver4 : MathHelper.PiOver2 * 1.5f;
|
||||
float angleShift = MathHelper.PiOver4;
|
||||
float drawRotation = projectile.rotation + angleShift + extraAngle;
|
||||
|
||||
Vector2 drawOrigin = new Vector2(flipped ? frontBlade.Width : 0f, frontBlade.Height);
|
||||
Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition;
|
||||
|
||||
//Back blade
|
||||
float functionalDrawAngle = drawAngle + (Combo == 1f && flipped ? MathHelper.PiOver2 : 0f);
|
||||
Vector2 backScissorOrigin = new Vector2(flipped ? 11 : 20f, 109); //Lined up with the hole in the scissor blade
|
||||
Vector2 backScissorDrawPosition = Owner.Center + drawAngle.ToRotationVector2() * 10f + functionalDrawAngle.ToRotationVector2() * 70f * projectile.scale - Main.screenPosition; //Lined up with the hole in the front blade
|
||||
float backScissorRotation = drawRotation + (Combo == 1 ? (!flipped ? MathHelper.PiOver4 * 0.75f : MathHelper.PiOver4 * -0.75f) : 0f);
|
||||
Vector2 backScissorOrigin = new Vector2(flipped ? 90 : 44f, 86); //Lined up with the hole in the scissor blade
|
||||
|
||||
Vector2 backScissorDrawPosition = Owner.Center + drawAngle.ToRotationVector2() * 10f + (drawAngle.ToRotationVector2() * 56f + (drawAngle - MathHelper.PiOver2).ToRotationVector2() * 11 * Owner.direction) * projectile.scale - Main.screenPosition; //Lined up with the hole in the front blade
|
||||
|
||||
if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[projectile.type])
|
||||
{
|
||||
for (int i = 0; i < projectile.oldRot.Length; ++i)
|
||||
Texture2D afterimage = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsGlow");
|
||||
|
||||
for (int i = 1; i < projectile.oldRot.Length; ++i)
|
||||
{
|
||||
Color color = Main.hslToRgb((i / (float)projectile.oldRot.Length) * 0.1f, 1, 0.6f + (Charge > 0 ? 0.3f : 0f));
|
||||
float afterimageRotation = projectile.oldRot[i] + angleShift + extraAngle;
|
||||
float afterimageBackRotation = afterimageRotation + (backScissorRotation - drawRotation);
|
||||
|
||||
spriteBatch.Draw(backBladeGlow, backScissorDrawPosition, null, color * 0.15f, afterimageBackRotation, backScissorOrigin, projectile.scale - 0.2f * ((i / (float)projectile.oldRot.Length)), flip, 0f);
|
||||
spriteBatch.Draw(frontBladeGlow, drawOffset, null, color * 0.15f, afterimageRotation, drawOrigin, projectile.scale - 0.2f * ((i / (float)projectile.oldRot.Length)), flip, 0f);
|
||||
spriteBatch.Draw(afterimage, drawOffset, null, color * 0.15f, afterimageRotation, drawOrigin, projectile.scale - 0.2f * ((i / (float)projectile.oldRot.Length)), flip, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
spriteBatch.Draw(backBlade, backScissorDrawPosition, null, lightColor, backScissorRotation, backScissorOrigin, projectile.scale, flip, 0f);
|
||||
spriteBatch.Draw(backBladeGlow, backScissorDrawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), backScissorRotation, backScissorOrigin, projectile.scale, flip, 0f);
|
||||
spriteBatch.Draw(backBlade, backScissorDrawPosition, null, lightColor, drawRotation, backScissorOrigin, projectile.scale, flip, 0f);
|
||||
spriteBatch.Draw(backBladeGlow, backScissorDrawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, backScissorOrigin, projectile.scale, flip, 0f);
|
||||
|
||||
spriteBatch.Draw(frontBlade, drawOffset, null, lightColor, drawRotation, drawOrigin, projectile.scale, flip, 0f);
|
||||
spriteBatch.Draw(frontBladeGlow, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, projectile.scale, flip, 0f);
|
||||
|
||||
if (SwingCompletion > 0.5f)
|
||||
if (SwingCompletion > 0.5f && Combo == 0f)
|
||||
{
|
||||
Texture2D smear = GetTexture("CalamityMod/Particles/TrientCircularSmear");
|
||||
|
||||
@@ -571,7 +569,6 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Texture2D sword = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeft");
|
||||
Texture2D glowmask = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow");
|
||||
|
||||
|
||||
if (Combo == 3f)
|
||||
{
|
||||
Texture2D thrownSword = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRight");
|
||||
@@ -587,7 +584,6 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
Vector2 drawPos = projectile.Center;
|
||||
float drawRotation = projectile.rotation + MathHelper.PiOver4;
|
||||
|
||||
Vector2 drawOrigin = new Vector2(32, 86); //Right on the hole. Well tbh here its not the hole theres a gem on it but you get me.
|
||||
|
||||
spriteBatch.Draw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f);
|
||||
@@ -596,42 +592,26 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public void DrawThrownScissors(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRight");
|
||||
Texture2D frontBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRightGlow");
|
||||
Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeft");
|
||||
Texture2D backBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow");
|
||||
Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeft");
|
||||
Texture2D frontBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow");
|
||||
Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRight");
|
||||
Texture2D backBladeGlow = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow");
|
||||
|
||||
Vector2 drawPos = projectile.Center;
|
||||
Vector2 drawOrigin = new Vector2(51, 86); //Right on the hole
|
||||
Vector2 drawOrigin = new Vector2(32, 86);
|
||||
float drawRotation = projectile.rotation + MathHelper.PiOver4;
|
||||
|
||||
Vector2 drawOrigin2 = new Vector2(22, 109); //Right on the hole
|
||||
float drawRotation2 = projectile.rotation + MathHelper.Lerp(0f, -MathHelper.PiOver4 * 0.33f, MathHelper.Clamp(ThrowCompletion * 2f, 0f, 1f));
|
||||
Vector2 drawOrigin2 = new Vector2(44, 86); //Right on the hole
|
||||
float drawRotation2 = projectile.rotation + MathHelper.Lerp(MathHelper.PiOver4, MathHelper.PiOver2 * 1.33f, MathHelper.Clamp(ThrowCompletion * 2f, 0f, 1f));
|
||||
|
||||
if (Combo == 3f)
|
||||
drawRotation2 = projectile.rotation + MathHelper.Lerp(-MathHelper.PiOver4 * 0.33f, MathHelper.PiOver2 * 0.85f, MathHelper.Clamp(SnapEndCompletion + 0.5f, 0f, 1f));
|
||||
drawRotation2 = projectile.rotation + MathHelper.Lerp(MathHelper.PiOver2 * 1.33f, MathHelper.PiOver4, MathHelper.Clamp(SnapEndCompletion + 0.5f, 0f, 1f));
|
||||
|
||||
spriteBatch.Draw(backBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, projectile.scale, 0f, 0f);
|
||||
spriteBatch.Draw(backBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, projectile.scale, 0f, 0f);
|
||||
|
||||
spriteBatch.Draw(frontBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, projectile.scale, 0f, 0f);
|
||||
spriteBatch.Draw(frontBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, projectile.scale, 0f, 0f);
|
||||
|
||||
|
||||
//Smear stuff
|
||||
Texture2D smear = GetTexture("CalamityMod/Particles/TrientCircularSmear");
|
||||
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
|
||||
float opacity = Combo == 3f ? (float)Math.Sin(SnapEndCompletion * MathHelper.PiOver2 + MathHelper.PiOver2) : (float)Math.Sin(ThrowCompletion * MathHelper.Pi);
|
||||
float rotation = drawRotation + MathHelper.PiOver2 * 1.5f;
|
||||
Color smearColor = Main.hslToRgb(((SwingTimer - MaxSwingTime * 0.5f) / (MaxSwingTime * 0.5f)) * 0.15f, 1, 0.6f);
|
||||
|
||||
spriteBatch.Draw(smear, projectile.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, rotation, smear.Size() / 2f, projectile.scale * 1.4f, SpriteEffects.None, 0);
|
||||
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
}
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
|
||||
@@ -113,7 +113,6 @@ namespace CalamityMod.Projectiles.Melee
|
||||
var sound = Main.PlaySound(SoundID.Item84, projectile.Center);
|
||||
CalamityUtils.SafeVolumeChange(ref sound, 0.3f);
|
||||
|
||||
//Take the direction the sword is swung. FUCK not controlling the swing direction more than just left/right :|
|
||||
projectile.velocity = Owner.DirectionTo(Main.MouseWorld);
|
||||
projectile.velocity.Normalize();
|
||||
projectile.rotation = projectile.velocity.ToRotation();
|
||||
|
||||
@@ -120,6 +120,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
StitchLifetimes[i]++;
|
||||
}
|
||||
|
||||
//Spawn particles when the line appears
|
||||
if (HoldTimer == 1)
|
||||
{
|
||||
for (int i = 0; i < 20; i++)
|
||||
|
||||
@@ -12,6 +12,7 @@ using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
using static CalamityMod.CalamityUtils;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
@@ -19,16 +20,20 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public Player Owner => Main.player[projectile.owner];
|
||||
public float Timer => 20 - projectile.timeLeft;
|
||||
public float Timer => projectile.ai[0] - projectile.timeLeft;
|
||||
const float ConstellationSwapTime = 15;
|
||||
|
||||
Entity anchorStart;
|
||||
Entity anchorEnd;
|
||||
public List<Particle> Particles = new List<Particle>();
|
||||
|
||||
public Vector2 SizeVector => anchorEnd.Center - anchorStart.Center;
|
||||
Vector2 AnchorStart => Owner.Center;
|
||||
Vector2 AnchorEnd => Owner.Calamity().mouseWorld;
|
||||
public Vector2 SizeVector => Utils.SafeNormalize(AnchorEnd - AnchorStart, Vector2.Zero) * MathHelper.Clamp((AnchorEnd - AnchorStart).Length(), 0, ArkoftheCosmosSwungBlade.ThrowReachMax);
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Constellation");
|
||||
ProjectileID.Sets.TrailCacheLength[projectile.type] = 1;
|
||||
ProjectileID.Sets.TrailingMode[projectile.type] = 2;
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
@@ -38,8 +43,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
projectile.friendly = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 30;
|
||||
projectile.timeLeft = 20;
|
||||
projectile.localNPCHitCooldown = (int)ConstellationSwapTime;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,49 +53,99 @@ namespace CalamityMod.Projectiles.Melee
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + SizeVector, 30f, ref collisionPoint);
|
||||
}
|
||||
|
||||
public void BootlegSpawnParticle(Particle particle)
|
||||
{
|
||||
Particles.Add(particle);
|
||||
particle.Type = GeneralParticleHandler.particleTypes[particle.GetType()];
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (projectile.ai[0] == 0)
|
||||
projectile.Center = Owner.Center;
|
||||
|
||||
if (!Owner.channel && projectile.timeLeft > 20)
|
||||
projectile.timeLeft = 20;
|
||||
|
||||
if (!Owner.active)
|
||||
{
|
||||
projectile.ai[0] = 1;
|
||||
Vector2 previousStar = projectile.Center;
|
||||
projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Timer % ConstellationSwapTime == 0 && projectile.timeLeft >= 20)
|
||||
{
|
||||
Particles.Clear();
|
||||
|
||||
Color constellationColor = Main.hslToRgb(Main.rand.NextFloat(), 1, 0.6f);
|
||||
Vector2 previousStar = AnchorStart;
|
||||
Vector2 offset;
|
||||
Particle Line;
|
||||
Particle Star = new GenericSparkle(previousStar, Vector2.Zero, Color.White, Color.Plum, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Star);
|
||||
|
||||
BootlegSpawnParticle(Star);
|
||||
|
||||
for (float i = 0 + Main.rand.NextFloat(0.2f, 0.5f); i < 1; i += Main.rand.NextFloat(0.2f, 0.5f))
|
||||
{
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Vector2.Normalize(SizeVector.RotatedBy(MathHelper.PiOver2));
|
||||
Star = new GenericSparkle(projectile.Center + SizeVector * i + offset, Vector2.Zero, Color.White, Color.Plum, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Star);
|
||||
Star = new GenericSparkle(AnchorStart + SizeVector * i + offset, Vector2.Zero, Color.White, constellationColor, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f);
|
||||
BootlegSpawnParticle(Star);
|
||||
|
||||
Line = new BloomLineVFX(previousStar, projectile.Center + SizeVector * i + offset - previousStar, 0.8f, Color.MediumVioletRed * 0.75f, 20, true, true);
|
||||
GeneralParticleHandler.SpawnParticle(Line);
|
||||
Line = new BloomLineVFX(previousStar, AnchorStart + SizeVector * i + offset - previousStar, 0.8f, constellationColor * 0.75f, 20, true, true);
|
||||
BootlegSpawnParticle(Line);
|
||||
|
||||
if (Main.rand.Next(3) == 0)
|
||||
{
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Vector2.Normalize(SizeVector.RotatedBy(MathHelper.PiOver2));
|
||||
Star = new GenericSparkle(projectile.Center + SizeVector * i + offset, Vector2.Zero, Color.White, Color.Plum, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Star);
|
||||
Star = new GenericSparkle(AnchorStart + SizeVector * i + offset, Vector2.Zero, Color.White, constellationColor, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f);
|
||||
BootlegSpawnParticle(Star);
|
||||
|
||||
Line = new BloomLineVFX(previousStar, projectile.Center + SizeVector * i + offset - previousStar, 0.8f, Color.MediumVioletRed * 0.75f, 20, true, true);
|
||||
GeneralParticleHandler.SpawnParticle(Line);
|
||||
Line = new BloomLineVFX(previousStar, AnchorStart + SizeVector * i + offset - previousStar, 0.8f, constellationColor, 20, true, true);
|
||||
BootlegSpawnParticle(Line);
|
||||
}
|
||||
|
||||
previousStar = projectile.Center + SizeVector * i + offset;
|
||||
previousStar = AnchorStart + SizeVector * i + offset;
|
||||
}
|
||||
|
||||
Star = new GenericSparkle(projectile.Center + SizeVector, Vector2.Zero, Color.White, Color.Plum, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Star);
|
||||
Star = new GenericSparkle(AnchorStart + SizeVector, Vector2.Zero, Color.White, constellationColor, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f);
|
||||
BootlegSpawnParticle(Star);
|
||||
|
||||
Line = new BloomLineVFX(previousStar, projectile.Center + SizeVector - previousStar, 0.8f, Color.MediumVioletRed * 0.75f, 20, true);
|
||||
GeneralParticleHandler.SpawnParticle(Line);
|
||||
Line = new BloomLineVFX(previousStar, AnchorStart + SizeVector - previousStar, 0.8f, constellationColor * 0.75f, 20, true);
|
||||
BootlegSpawnParticle(Line);
|
||||
}
|
||||
|
||||
//Run the particles manually to be sure it doesnt get fucked over by the particle cap
|
||||
Vector2 moveDirection = Vector2.Zero;
|
||||
if (Timer > projectile.oldPos.Length)
|
||||
moveDirection = projectile.position - projectile.oldPos[0];
|
||||
|
||||
foreach (Particle particle in Particles)
|
||||
{
|
||||
if (particle == null)
|
||||
continue;
|
||||
particle.Position += particle.Velocity + moveDirection;
|
||||
particle.Time++;
|
||||
particle.Update();
|
||||
|
||||
particle.Color = Main.hslToRgb(Main.rgbToHsl(particle.Color).X + 0.02f, Main.rgbToHsl(particle.Color).Y, Main.rgbToHsl(particle.Color).Z);
|
||||
}
|
||||
|
||||
Particles.RemoveAll(particle => (particle.Time >= particle.Lifetime && particle.SetLifetime));
|
||||
}
|
||||
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.Default, null, null, Main.GameViewMatrix.ZoomMatrix);
|
||||
|
||||
foreach (Particle particle in Particles)
|
||||
{
|
||||
particle.CustomDraw(spriteBatch);
|
||||
}
|
||||
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
Reference in new issue
Block a user