Fixed pretty much all melee proj errors

This commit is contained in:
DominicKarma committed 2022-04-04 16:16:18 -05:00
1 parent 319b79ed3b
commit 8b1d39a217
215 files changed
+924 -956

No files matched your search

+4 -4
View File
@@ -1,4 +1,4 @@
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Items.Weapons.Magic;
using Microsoft.Xna.Framework;
using Terraria;
@@ -33,9 +33,9 @@ namespace CalamityMod.Projectiles.Magic
public override void AI()
{
// Draw offsets
drawOffsetX = -10;
drawOriginOffsetY = -10;
drawOriginOffsetX = 0;
DrawOffsetX = -10;
DrawOriginOffsetY = -10;
DrawOriginOffsetX = 0;
// Play sound and set rotation on frame 1
if (Projectile.localAI[0] == 0f)
+1 -1
View File
@@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Melee
for (int i = 0; i < flameAmt; i++)
{
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType<AegisFlame>(), (int)(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, 0f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<AegisFlame>(), (int)(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, 0f);
}
}
}
+1 -1
View File
@@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee
{
if (Projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType<AegisBlast2>(), (int)((double)damage * 0.75), knockback, Main.myPlayer);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType<AegisBlast2>(), (int)((double)damage * 0.75), knockback, Main.myPlayer);
}
}
+1 -1
View File
@@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.extraUpdates = 1;
Projectile.DamageType = DamageClass.Melee;
Projectile.ignoreWater = true;
aiType = ProjectileID.BoulderStaffOfEarth;
AIType = ProjectileID.BoulderStaffOfEarth;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
}
-2
View File
@@ -71,8 +71,6 @@ namespace CalamityMod.Projectiles.Melee
Dust.NewDust(Projectile.Center, 14, 14, dustType, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 150, default, 1.3f);
}
if (Projectile.velocity.Length() < 1.0f)
Projectile.Kill();
}
+5 -5
View File
@@ -1,4 +1,4 @@
using CalamityMod.Particles;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
@@ -97,10 +97,10 @@ namespace CalamityMod.Projectiles.Melee
if (Shine == 1f)
{
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Texture2D starTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/Sparkle");
Texture2D bloomTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
Texture2D starTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/Sparkle").Value;
Texture2D bloomTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
//Ajust the bloom's texture to be the same size as the star's
float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height;
@@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Melee
Main.EntitySpriteDraw(starTexture, sparkCenter, null, Color.White, rotation, starTexture.Size() / 2f, 1, SpriteEffects.None, 0);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
}
return false;
+2 -2
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
@@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee
Dust dust;
// You need to set position depending on what you are doing. You may need to subtract width/2 and height/2 as well to center the spawn rectangle.
Vector2 position = Projectile.Center;
dust = Terraria.Dust.NewDustPerfect(position, 33, new Vector2(0f, 0f), 0, new Color(0, 142, 255), 2.368421f);
dust = Dust.NewDustPerfect(position, 33, new Vector2(0f, 0f), 0, new Color(0, 142, 255), 2.368421f);
dust.noGravity = true;
}
}
@@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.penetrate = -1;
}
public override bool CanDamage() => Timer <= ParryTime && AlreadyParried == 0f;
public override bool? CanDamage() => Timer <= ParryTime && AlreadyParried == 0f;
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
@@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Melee
public void GeneralParryEffects()
{
ArkoftheAncients sword = (Owner.HeldItem.modItem as ArkoftheAncients);
ArkoftheAncients sword = (Owner.HeldItem.ModItem as ArkoftheAncients);
if (sword != null)
sword.Charge = 10f;
@@ -159,8 +159,8 @@ namespace CalamityMod.Projectiles.Melee
{
if (Main.myPlayer == Owner.whoAmI)
{
var barBG = GetTexture("CalamityMod/ExtraTextures/GenericBarBack");
var barFG = GetTexture("CalamityMod/ExtraTextures/GenericBarFront");
var barBG = Request<Texture2D>("CalamityMod/ExtraTextures/GenericBarBack").Value;
var barFG = Request<Texture2D>("CalamityMod/ExtraTextures/GenericBarFront").Value;
Vector2 drawPos = Owner.Center - Main.screenPosition + new Vector2(0, -36) - barBG.Size() / 2;
Rectangle frame = new Rectangle(0, 0, (int)((Timer - ParryTime) / (MaxTime - ParryTime) * barFG.Width), barFG.Height);
@@ -168,30 +168,27 @@ namespace CalamityMod.Projectiles.Melee
float opacity = Timer <= ParryTime + 25f ? (Timer - ParryTime) / 25f : (MaxTime - Timer <= 8) ? Projectile.timeLeft / 8f : 1f;
Color color = Main.hslToRgb((Main.GlobalTimeWrappedHourly * 0.6f) % 1, 1, 0.85f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.1f);
Main.EntitySpriteDraw(barBG, drawPos, color * opacity);
Main.EntitySpriteDraw(barFG, drawPos, frame, color * opacity * 0.8f);
Main.spriteBatch.Draw(barBG, drawPos, color * opacity);
Main.spriteBatch.Draw(barFG, drawPos, frame, color * opacity * 0.8f);
}
return false;
}
Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/ArkoftheAncients");
Texture2D glowmask = GetTexture("CalamityMod/Items/Weapons/Melee/ArkoftheAncientsGlow");
Texture2D sword = Request<Texture2D>("CalamityMod/Items/Weapons/Melee/ArkoftheAncients").Value;
Texture2D glowmask = Request<Texture2D>("CalamityMod/Items/Weapons/Melee/ArkoftheAncientsGlow").Value;
float drawRotation = Projectile.rotation + MathHelper.PiOver4;
Vector2 drawOrigin = new Vector2(0f, sword.Height);
Vector2 drawOffset = Owner.Center + Projectile.velocity * DistanceFromPlayer.Length() - Main.screenPosition;
Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0);
if (AlreadyParried > 0)
{
drawOrigin = new Vector2(0f, 36f);
Rectangle frame = new Rectangle(24, 0, 36, 36);
drawOffset = Owner.Center + Projectile.velocity * (DistanceFromPlayer.Length() + 33) - Main.screenPosition;
Main.EntitySpriteDraw(glowmask, drawOffset, frame, Main.hslToRgb(Main.GlobalTimeWrappedHourly % 1, 1, 0.8f) * (1 - AlreadyParried / ParryTime), drawRotation, drawOrigin, Projectile.scale + AlreadyParried / ParryTime, 0f, 0f);
Main.EntitySpriteDraw(glowmask, drawOffset, frame, Main.hslToRgb(Main.GlobalTimeWrappedHourly % 1, 1, 0.8f) * (1 - AlreadyParried / ParryTime), drawRotation, drawOrigin, Projectile.scale + AlreadyParried / ParryTime, 0f, 0);
}
return false;
@@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Melee
if (Owner.whoAmI == Main.myPlayer && SwingRatio() > 0.5f && HasFired == 0f && Charge > 0)
{
Projectile.NewProjectile(Owner.Center + direction * 30f, Projectile.velocity * 1.25f, ProjectileType<AncientBeam>(), (int)(Projectile.damage * ArkoftheAncients.beamDamageMultiplier), 2f, Owner.whoAmI) ;
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center + direction * 30f, Projectile.velocity * 1.25f, ProjectileType<AncientBeam>(), (int)(Projectile.damage * ArkoftheAncients.beamDamageMultiplier), 2f, Owner.whoAmI) ;
HasFired = 1f;
}
@@ -120,9 +120,8 @@ namespace CalamityMod.Projectiles.Melee
public override bool PreDraw(ref Color lightColor)
{
Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/ArkoftheAncients");
Texture2D glowmask = GetTexture("CalamityMod/Items/Weapons/Melee/ArkoftheAncientsGlow");
Texture2D sword = Request<Texture2D>("CalamityMod/Items/Weapons/Melee/ArkoftheAncients").Value;
Texture2D glowmask = Request<Texture2D>("CalamityMod/Items/Weapons/Melee/ArkoftheAncientsGlow").Value;
SpriteEffects flip = Owner.direction < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
float extraAngle = Owner.direction < 0 ? MathHelper.PiOver2 : 0f;
@@ -143,8 +142,8 @@ namespace CalamityMod.Projectiles.Melee
}
}
Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f);
Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f);
Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0);
Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0);
return false;
}
+14 -15
View File
@@ -1,4 +1,4 @@
using CalamityMod.Particles;
using CalamityMod.Particles;
using CalamityMod.Items.Weapons.Melee;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -77,7 +77,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.localNPCHitCooldown = (int)MaxTime + 2;
}
public override bool CanDamage()
public override bool? CanDamage()
{
return HoldProgress > 0;
}
@@ -168,13 +168,14 @@ namespace CalamityMod.Projectiles.Melee
{
Dashing = false;
Owner.velocity *= 0.1f; //Abrupt stop
SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MeatySlash"), Projectile.Center);
SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "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(28, 28), ProjectileType<EonBolt>(), (int)(ArkoftheCosmos.SlashBoltsDamageMultiplier * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.07f);
var source = Projectile.GetProjectileSource_FromThis();
Projectile blast = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), source, Owner.Center, Main.rand.NextVector2CircularEdge(28, 28), ProjectileType<EonBolt>(), (int)(ArkoftheCosmos.SlashBoltsDamageMultiplier * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.07f);
{
blast.timeLeft = 100;
}
@@ -262,20 +263,19 @@ namespace CalamityMod.Projectiles.Melee
public override bool PreDraw(ref Color lightColor)
{
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Texture2D sliceTex = GetTexture("CalamityMod/Particles/BloomLine");
Texture2D sliceTex = Request<Texture2D>("CalamityMod/Particles/BloomLine").Value;
Color sliceColor = Color.Lerp(Color.OrangeRed, Color.White, SnapProgress);
float rot = Projectile.rotation + MathHelper.PiOver2;
Vector2 sliceScale = new Vector2(0.2f * (1 - SnapProgress) ,ThrustDisplaceRatio() * 242f);
Main.EntitySpriteDraw(sliceTex, Projectile.Center - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0f);
Main.EntitySpriteDraw(sliceTex, Projectile.Center - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0);
//Draw the scissors
if (HoldProgress <= 0.4f)
{
Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeft");
Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRight");
Texture2D frontBlade = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsLeft").Value;
Texture2D backBlade = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsRight").Value;
float snippingRotation = Projectile.rotation + MathHelper.PiOver4;
float drawRotation = MathHelper.Lerp(snippingRotation - MathHelper.PiOver4, snippingRotation, RotationRatio());
@@ -289,14 +289,14 @@ namespace CalamityMod.Projectiles.Melee
Color drawColor = Color.Tomato * opacity * 0.9f;
Color drawColorBack = Color.DeepSkyBlue * opacity * 0.9f;
Main.EntitySpriteDraw(backBlade, drawPosition, null, drawColorBack, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(frontBlade, drawPosition, null, drawColor * opacity, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(backBlade, drawPosition, null, drawColorBack, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(frontBlade, drawPosition, null, drawColor * opacity, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
}
//Draw the rip
if (HoldProgress > 0)
{
Texture2D lineTex = GetTexture("CalamityMod/Particles/ThinEndedLine");
Texture2D lineTex = Request<Texture2D>("CalamityMod/Particles/ThinEndedLine").Value;
Vector2 Shake = HoldProgress > 0.2f ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (1 - HoldProgress * 5f) * 0.5f;
float raise = (float)Math.Sin(HoldProgress * MathHelper.PiOver2);
@@ -308,7 +308,6 @@ namespace CalamityMod.Projectiles.Melee
Main.EntitySpriteDraw(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
if (StitchProgress > 0)
{
@@ -336,7 +335,7 @@ namespace CalamityMod.Projectiles.Melee
}
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
return false;
}
@@ -7,10 +7,9 @@ using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
using static Terraria.ModLoader.ModContent;
using static CalamityMod.CalamityUtils;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Melee
{
@@ -42,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.penetrate = -1;
}
public override bool CanDamage() => Timer <= ParryTime && AlreadyParried == 0f;
public override bool? CanDamage() => Timer <= ParryTime && AlreadyParried == 0f;
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
@@ -54,14 +53,14 @@ namespace CalamityMod.Projectiles.Melee
public void GeneralParryEffects()
{
ArkoftheCosmos sword = (Owner.HeldItem.modItem as ArkoftheCosmos);
ArkoftheCosmos sword = (Owner.HeldItem.ModItem as ArkoftheCosmos);
if (sword != null)
{
sword.Charge = 10f;
sword.Combo = 0f;
}
SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact);
var chunder = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center);
var chunder = SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center);
SafeVolumeChange(ref chunder, 1.3f);
CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), "Parry!", true);
@@ -187,8 +186,8 @@ namespace CalamityMod.Projectiles.Melee
{
if (Main.myPlayer == Owner.whoAmI)
{
var barBG = GetTexture("CalamityMod/ExtraTextures/GenericBarBack");
var barFG = GetTexture("CalamityMod/ExtraTextures/GenericBarFront");
var barBG = Request<Texture2D>("CalamityMod/ExtraTextures/GenericBarBack").Value;
var barFG = Request<Texture2D>("CalamityMod/ExtraTextures/GenericBarFront").Value;
Vector2 drawPos = Owner.Center - Main.screenPosition + new Vector2(0, -36) - barBG.Size() / 2;
Rectangle frame = new Rectangle(0, 0, (int)((Timer - ParryTime) / (MaxTime - ParryTime) * barFG.Width), barFG.Height);
@@ -196,16 +195,16 @@ namespace CalamityMod.Projectiles.Melee
float opacity = Timer <= ParryTime + 25f ? (Timer - ParryTime) / 25f : (MaxTime - Timer <= 8) ? Projectile.timeLeft / 8f : 1f;
Color color = Main.hslToRgb((float)Math.Sin(Main.GlobalTimeWrappedHourly * 1.2f) * 0.05f + 0.08f, 1, 0.65f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 7f) * 0.1f);
Main.EntitySpriteDraw(barBG, drawPos, color * opacity);
Main.EntitySpriteDraw(barFG, drawPos, frame, color * opacity * 0.8f);
Main.spriteBatch.Draw(barBG, drawPos, color * opacity);
Main.spriteBatch.Draw(barFG, drawPos, frame, color * opacity * 0.8f);
}
return false;
}
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");
Texture2D frontBlade = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsLeft").Value;
Texture2D frontBladeGlow = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow").Value;
Texture2D backBlade = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsRight").Value;
Texture2D backBladeGlow = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow").Value;
float snippingRotation = Projectile.rotation + MathHelper.PiOver4;
@@ -216,11 +215,11 @@ namespace CalamityMod.Projectiles.Melee
Vector2 drawOriginBack = new Vector2(44f, 86); //Right on the hole
Vector2 drawPosition = Owner.Center + Projectile.velocity * 15 + Projectile.velocity * ThrustDisplaceRatio() * 50f - Main.screenPosition;
Main.EntitySpriteDraw(backBlade, drawPosition, null, lightColor, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(backBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(backBlade, drawPosition, null, lightColor, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(backBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(frontBlade, drawPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(frontBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(frontBlade, drawPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(frontBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0);
return false;
}
@@ -230,7 +229,7 @@ namespace CalamityMod.Projectiles.Melee
if (Main.myPlayer == Owner.whoAmI)
{
var ding = SoundEngine.PlaySound(SoundID.Item35);
CalamityUtils.SafeVolumeChange(ref ding, 2f);
SafeVolumeChange(ref ding, 2f);
}
}
+45 -42
View File
@@ -1,4 +1,4 @@
using CalamityMod.Particles;
using CalamityMod.Particles;
using CalamityMod.Items.Weapons.Melee;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -183,7 +183,8 @@ namespace CalamityMod.Projectiles.Melee
//Slightly shift the blasts up so the final close shots don't go BELOW the cursor and instead go right on it.
float adjustedBlastRotation = Projectile.rotation - MathHelper.PiOver4 * 1.15f * Owner.direction;
Projectile blast = Projectile.NewProjectileDirect(Owner.Center + adjustedBlastRotation.ToRotationVector2() * 10f, adjustedBlastRotation.ToRotationVector2() * 20f, ProjectileType<EonBolt>(), (int)(ArkoftheCosmos.SwirlBoltDamageMultiplier / ArkoftheCosmos.SwirlBoltAmount * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f);
var source = Projectile.GetProjectileSource_FromThis();
Projectile blast = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), source, Owner.Center + adjustedBlastRotation.ToRotationVector2() * 10f, adjustedBlastRotation.ToRotationVector2() * 20f, ProjectileType<EonBolt>(), (int)(ArkoftheCosmos.SwirlBoltDamageMultiplier / ArkoftheCosmos.SwirlBoltAmount * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f);
{
blast.timeLeft = 100;
}
@@ -204,7 +205,8 @@ namespace CalamityMod.Projectiles.Melee
//Spawn a constellation link
Projectile chain = Projectile.NewProjectileDirect(Owner.Center, Vector2.Zero, ProjectileType<ArkoftheCosmosConstellation>(), (int)(Projectile.damage * ArkoftheCosmos.chainDamageMultiplier), 0, Owner.whoAmI, (int)(Projectile.timeLeft / 2f));
var source = Projectile.GetProjectileSource_FromThis();
Projectile chain = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), source, Owner.Center, Vector2.Zero, ProjectileType<ArkoftheCosmosConstellation>(), (int)(Projectile.damage * ArkoftheCosmos.chainDamageMultiplier), 0, Owner.whoAmI, (int)(Projectile.timeLeft / 2f));
chain.timeLeft = (int)(Projectile.timeLeft / 2f);
}
@@ -241,7 +243,8 @@ namespace CalamityMod.Projectiles.Melee
for (int i = 0; i < 3; i++)
{
Projectile blast = Projectile.NewProjectileDirect(Projectile.Center + (MathHelper.TwoPi * (i / 3f) + rotationOffset).ToRotationVector2() * 30f, (MathHelper.TwoPi * (i / 3f) + rotationOffset).ToRotationVector2() * 20f, ProjectileType<EonBolt>(), (int)(ArkoftheCosmos.SnapBoltsDamageMultiplier * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f);
var source = Projectile.GetProjectileSource_FromThis();
Projectile blast = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), source, Projectile.Center + (MathHelper.TwoPi * (i / 3f) + rotationOffset).ToRotationVector2() * 30f, (MathHelper.TwoPi * (i / 3f) + rotationOffset).ToRotationVector2() * 20f, ProjectileType<EonBolt>(), (int)(ArkoftheCosmos.SnapBoltsDamageMultiplier * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.05f);
{
blast.timeLeft = 100;
}
@@ -429,12 +432,12 @@ namespace CalamityMod.Projectiles.Melee
if (Combo == 3f)
{
var snapSound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center);
var snapSound = SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center);
SafeVolumeChange(ref snapSound, 1.3f);
if (Charge <= 1)
{
ArkoftheCosmos sword = (Owner.HeldItem.modItem as ArkoftheCosmos);
ArkoftheCosmos sword = (Owner.HeldItem.ModItem as ArkoftheCosmos);
if (sword != null)
sword.Charge = 2f;
}
@@ -481,8 +484,8 @@ namespace CalamityMod.Projectiles.Melee
public void DrawSingleSwungScissorBlade(Color lightColor)
{
Texture2D sword = GetTexture(Combo == 0 ? "CalamityMod/Projectiles/Melee/SunderingScissorsRight" : "CalamityMod/Projectiles/Melee/SunderingScissorsLeft");
Texture2D glowmask = GetTexture(Combo == 0 ? "CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow" : "CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow");
Texture2D sword = Request<Texture2D>(Combo == 0 ? "CalamityMod/Projectiles/Melee/SunderingScissorsRight" : "CalamityMod/Projectiles/Melee/SunderingScissorsLeft").Value;
Texture2D glowmask = Request<Texture2D>(Combo == 0 ? "CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow" : "CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow").Value;
bool flipped = Owner.direction < 0;
SpriteEffects flip = flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
@@ -505,15 +508,15 @@ namespace CalamityMod.Projectiles.Melee
}
}
Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f);
Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f);
Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0);
Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0);
if (SwingCompletion > 0.5f && Combo == 0f)
{
Texture2D smear = GetTexture("CalamityMod/Particles/TrientCircularSmear");
Texture2D smear = Request<Texture2D>("CalamityMod/Particles/TrientCircularSmear").Value;
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
float opacity = (float)Math.Sin(SwingCompletion * MathHelper.Pi);
float rotation = (-MathHelper.PiOver4 * 0.5f + MathHelper.PiOver4 * 0.5f * SwingCompletion + (Combo == 1f ? MathHelper.PiOver4 : 0)) * SwingDirection;
@@ -522,16 +525,16 @@ namespace CalamityMod.Projectiles.Melee
Main.EntitySpriteDraw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 2.3f, SpriteEffects.None, 0);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
}
}
public void DrawSwungScissors(Color lightColor)
{
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");
Texture2D frontBlade = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsLeft").Value;
Texture2D frontBladeGlow = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow").Value;
Texture2D backBlade = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsRight").Value;
Texture2D backBladeGlow = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow").Value;
//Front blade
bool flipped = Owner.direction < 0;
@@ -552,29 +555,29 @@ namespace CalamityMod.Projectiles.Melee
if (CalamityConfig.Instance.Afterimages && SwingTimer > ProjectileID.Sets.TrailCacheLength[Projectile.type])
{
Texture2D afterimage = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsGlow");
Texture2D afterimage = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsGlow").Value;
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.EntitySpriteDraw(afterimage, drawOffset, null, color * 0.15f, afterimageRotation, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), flip, 0f);
Main.EntitySpriteDraw(afterimage, drawOffset, null, color * 0.15f, afterimageRotation, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), flip, 0);
}
}
Main.EntitySpriteDraw(backBlade, backScissorDrawPosition, null, lightColor, drawRotation, backScissorOrigin, Projectile.scale, flip, 0f);
Main.EntitySpriteDraw(backBladeGlow, backScissorDrawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, backScissorOrigin, Projectile.scale, flip, 0f);
Main.EntitySpriteDraw(backBlade, backScissorDrawPosition, null, lightColor, drawRotation, backScissorOrigin, Projectile.scale, flip, 0);
Main.EntitySpriteDraw(backBladeGlow, backScissorDrawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, backScissorOrigin, Projectile.scale, flip, 0);
Main.EntitySpriteDraw(frontBlade, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f);
Main.EntitySpriteDraw(frontBladeGlow, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f);
Main.EntitySpriteDraw(frontBlade, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0);
Main.EntitySpriteDraw(frontBladeGlow, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0);
if (SwingCompletion > 0.5f && Combo == 0f)
{
Texture2D smear = GetTexture("CalamityMod/Particles/TrientCircularSmear");
Texture2D smear = Request<Texture2D>("CalamityMod/Particles/TrientCircularSmear").Value;
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
float opacity = (float)Math.Sin(SwingCompletion * MathHelper.Pi);
float rotation = (-MathHelper.PiOver4 * 0.5f + MathHelper.PiOver4 * 0.5f * SwingCompletion + (Combo == 1f ? MathHelper.PiOver4 : 0)) * SwingDirection;
@@ -583,42 +586,42 @@ namespace CalamityMod.Projectiles.Melee
Main.EntitySpriteDraw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 2.3f, SpriteEffects.None, 0);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
}
}
public void DrawSingleThrownScissorBlade(Color lightColor)
{
Texture2D sword = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeft");
Texture2D glowmask = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow");
Texture2D sword = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsLeft").Value;
Texture2D glowmask = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow").Value;
if (Combo == 3f)
{
Texture2D thrownSword = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRight");
Texture2D thrownGlowmask = GetTexture("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow");
Texture2D thrownSword = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsRight").Value;
Texture2D thrownGlowmask = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow").Value;
Vector2 drawPos2 = Vector2.SmoothStep(Owner.Center, Projectile.Center, MathHelper.Clamp(SnapEndCompletion + 0.25f, 0f, 1f));
float drawRotation2 = direction.ToRotation() + MathHelper.PiOver4;
Vector2 drawOrigin2 = new Vector2(44, 86);
Main.EntitySpriteDraw(thrownSword, drawPos2 - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(thrownGlowmask, drawPos2 - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(thrownSword, drawPos2 - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(thrownGlowmask, drawPos2 - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0);
}
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.
Main.EntitySpriteDraw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(glowmask, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(glowmask, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0);
}
public void DrawThrownScissors(Color lightColor)
{
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");
Texture2D frontBlade = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsLeft").Value;
Texture2D frontBladeGlow = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsLeftGlow").Value;
Texture2D backBlade = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsRight").Value;
Texture2D backBladeGlow = Request<Texture2D>("CalamityMod/Projectiles/Melee/SunderingScissorsRightGlow").Value;
Vector2 drawPos = Projectile.Center;
Vector2 drawOrigin = new Vector2(32, 86);
@@ -630,11 +633,11 @@ namespace CalamityMod.Projectiles.Melee
if (Combo == 3f)
drawRotation2 = Projectile.rotation + MathHelper.Lerp(MathHelper.PiOver2 * 1.33f, MathHelper.PiOver4, MathHelper.Clamp(SnapEndCompletion + 0.5f, 0f, 1f));
Main.EntitySpriteDraw(backBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(backBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(backBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(backBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(frontBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(frontBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(frontBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(frontBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0);
}
public override void SendExtraAI(BinaryWriter writer)
@@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.penetrate = -1;
}
public override bool CanDamage() => Timer <= ParryTime && AlreadyParried == 0f;
public override bool? CanDamage() => Timer <= ParryTime && AlreadyParried == 0f;
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
@@ -54,14 +54,14 @@ namespace CalamityMod.Projectiles.Melee
public void GeneralParryEffects()
{
ArkoftheElements sword = (Owner.HeldItem.modItem as ArkoftheElements);
ArkoftheElements sword = (Owner.HeldItem.ModItem as ArkoftheElements);
if (sword != null)
{
sword.Charge = 10f;
sword.Combo = 0f;
}
SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact);
var chunder = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center);
var chunder = SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center);
SafeVolumeChange(ref chunder, 1.3f);
CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), "Parry!", true);
@@ -187,8 +187,8 @@ namespace CalamityMod.Projectiles.Melee
{
if (Main.myPlayer == Owner.whoAmI)
{
var barBG = GetTexture("CalamityMod/ExtraTextures/GenericBarBack");
var barFG = GetTexture("CalamityMod/ExtraTextures/GenericBarFront");
var barBG = Request<Texture2D>("CalamityMod/ExtraTextures/GenericBarBack").Value;
var barFG = Request<Texture2D>("CalamityMod/ExtraTextures/GenericBarFront").Value;
Vector2 drawPos = Owner.Center - Main.screenPosition + new Vector2(0, -36) - barBG.Size() / 2;
Rectangle frame = new Rectangle(0, 0, (int)((Timer - ParryTime) / (MaxTime - ParryTime) * barFG.Width), barFG.Height);
@@ -196,16 +196,16 @@ namespace CalamityMod.Projectiles.Melee
float opacity = Timer <= ParryTime + 25f ? (Timer - ParryTime) / 25f : (MaxTime - Timer <= 8) ? Projectile.timeLeft / 8f : 1f;
Color color = Main.hslToRgb((float)Math.Sin(Main.GlobalTimeWrappedHourly * 1.2f) * 0.05f + 0.08f, 1, 0.65f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 7f) * 0.1f);
Main.EntitySpriteDraw(barBG, drawPos, color * opacity);
Main.EntitySpriteDraw(barFG, drawPos, frame, color * opacity * 0.8f);
Main.spriteBatch.Draw(barBG, drawPos, color * opacity);
Main.spriteBatch.Draw(barFG, drawPos, frame, color * opacity * 0.8f);
}
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 = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsRight").Value;
Texture2D frontBladeGlow = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsRightGlow").Value;
Texture2D backBlade = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsLeft").Value;
Texture2D backBladeGlow = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow").Value;
float snippingRotation = Projectile.rotation + MathHelper.PiOver4;
float snippingRotationBack = Projectile.rotation + MathHelper.PiOver4 * 1.75f;
@@ -217,11 +217,11 @@ namespace CalamityMod.Projectiles.Melee
Vector2 drawOriginBack = new Vector2(22, 109); //Right on the hole
Vector2 drawPosition = Owner.Center + Projectile.velocity * 15 + Projectile.velocity * ThrustDisplaceRatio() * 50f - Main.screenPosition;
Main.EntitySpriteDraw(backBlade, drawPosition, null, lightColor, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(backBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(backBlade, drawPosition, null, lightColor, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(backBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(frontBlade, drawPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(frontBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(frontBlade, drawPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(frontBladeGlow, drawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0);
return false;
}
+10 -11
View File
@@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.localNPCHitCooldown = (int)MaxTime + 2;
}
public override bool CanDamage()
public override bool? CanDamage()
{
return HoldProgress > 0;
}
@@ -180,21 +180,20 @@ namespace CalamityMod.Projectiles.Melee
public override bool PreDraw(ref Color lightColor)
{
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Texture2D sliceTex = GetTexture("CalamityMod/Particles/BloomLine");
Texture2D sliceTex = Request<Texture2D>("CalamityMod/Particles/BloomLine").Value;
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);
Main.EntitySpriteDraw(sliceTex, Projectile.Center + nitpickShiftCorrection - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0f);
Main.EntitySpriteDraw(sliceTex, Projectile.Center + nitpickShiftCorrection - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0);
//Draw the scissors
if (HoldProgress <= 0.4f)
{
Texture2D frontBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRight");
Texture2D backBlade = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeft");
Texture2D frontBlade = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsRight").Value;
Texture2D backBlade = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsLeft").Value;
float snippingRotation = Projectile.rotation + MathHelper.PiOver4;
float snippingRotationBack = Projectile.rotation + MathHelper.PiOver4 * 1.75f;
@@ -211,14 +210,14 @@ namespace CalamityMod.Projectiles.Melee
Color drawColor = Color.Orange * opacity * 0.9f;
Color drawColorBack = Color.HotPink * opacity * 0.9f;
Main.EntitySpriteDraw(backBlade, drawPosition, null, drawColorBack, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(frontBlade, drawPosition, null, drawColor * opacity, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(backBlade, drawPosition, null, drawColorBack, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(frontBlade, drawPosition, null, drawColor * opacity, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
}
//Draw the rip
if (HoldProgress > 0)
{
Texture2D lineTex = GetTexture("CalamityMod/Particles/ThinEndedLine");
Texture2D lineTex = Request<Texture2D>("CalamityMod/Particles/ThinEndedLine").Value;
Vector2 Shake = HoldProgress > 0.2f ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (1 - HoldProgress * 5f) * 0.5f;
float raise = (float)Math.Sin(HoldProgress * MathHelper.PiOver2);
@@ -258,7 +257,7 @@ namespace CalamityMod.Projectiles.Melee
}
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
return false;
}
@@ -251,12 +251,12 @@ namespace CalamityMod.Projectiles.Melee
if (Combo == 3f)
{
var snapSound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center);
var snapSound = SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/ScissorGuillotineSnap"), Projectile.Center);
SafeVolumeChange(ref snapSound, 1.3f);
if (Charge <= 1)
{
ArkoftheElements sword = (Owner.HeldItem.modItem as ArkoftheElements);
ArkoftheElements sword = (Owner.HeldItem.ModItem as ArkoftheElements);
if (sword != null)
sword.Charge = 2f;
}
@@ -287,24 +287,24 @@ namespace CalamityMod.Projectiles.Melee
if (!Thrown)
{
if (Charge > 0)
DrawSwungScissors(spriteBatch, lightColor);
DrawSwungScissors(lightColor);
else
DrawSingleSwungScissorBlade(spriteBatch, lightColor);
DrawSingleSwungScissorBlade(lightColor);
}
else
{
if (Charge > 0)
DrawThrownScissors(spriteBatch, lightColor);
DrawThrownScissors(lightColor);
else
DrawSingleThrownScissorBlade(spriteBatch, lightColor);
DrawSingleThrownScissorBlade(lightColor);
}
return false;
}
public void DrawSingleSwungScissorBlade(Color lightColor)
{
Texture2D sword = GetTexture(Combo == 0 ? "CalamityMod/Projectiles/Melee/RendingScissorsRight" : "CalamityMod/Projectiles/Melee/RendingScissorsLeft");
Texture2D glowmask = GetTexture(Combo == 0 ? "CalamityMod/Projectiles/Melee/RendingScissorsRightGlow" : "CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow");
Texture2D sword = Request<Texture2D>(Combo == 0 ? "CalamityMod/Projectiles/Melee/RendingScissorsRight" : "CalamityMod/Projectiles/Melee/RendingScissorsLeft").Value;
Texture2D glowmask = Request<Texture2D>(Combo == 0 ? "CalamityMod/Projectiles/Melee/RendingScissorsRightGlow" : "CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow").Value;
bool flipped = Owner.direction < 0;
SpriteEffects flip = flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
@@ -327,15 +327,15 @@ namespace CalamityMod.Projectiles.Melee
}
}
Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f);
Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f);
Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0);
Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0);
if (SwingCompletion > 0.5f)
{
Texture2D smear = GetTexture("CalamityMod/Particles/TrientCircularSmear");
Texture2D smear = Request<Texture2D>("CalamityMod/Particles/TrientCircularSmear").Value;
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
float opacity = (float)Math.Sin(SwingCompletion * MathHelper.Pi);
float rotation = (-MathHelper.PiOver4 * 0.5f + MathHelper.PiOver4 * 0.5f * SwingCompletion + (Combo == 1f ? MathHelper.PiOver4 : 0)) * SwingDirection;
@@ -344,16 +344,16 @@ namespace CalamityMod.Projectiles.Melee
Main.EntitySpriteDraw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 2.3f, SpriteEffects.None, 0);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
}
}
public void DrawSwungScissors(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 = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsRight").Value;
Texture2D frontBladeGlow = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsRightGlow").Value;
Texture2D backBlade = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsLeft").Value;
Texture2D backBladeGlow = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow").Value;
//Front blade
bool flipped = Owner.direction < 0;
@@ -384,18 +384,18 @@ namespace CalamityMod.Projectiles.Melee
}
}
Main.EntitySpriteDraw(backBlade, backScissorDrawPosition, null, lightColor, backScissorRotation, backScissorOrigin, Projectile.scale, flip, 0f);
Main.EntitySpriteDraw(backBlade, backScissorDrawPosition, null, lightColor, backScissorRotation, backScissorOrigin, Projectile.scale, flip, 0);
Main.EntitySpriteDraw(backBladeGlow, backScissorDrawPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), backScissorRotation, backScissorOrigin, Projectile.scale, flip, 0f);
Main.EntitySpriteDraw(frontBlade, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0f);
Main.EntitySpriteDraw(frontBladeGlow, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0f);
Main.EntitySpriteDraw(frontBlade, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0);
Main.EntitySpriteDraw(frontBladeGlow, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, flip, 0);
if (SwingCompletion > 0.5f)
{
Texture2D smear = GetTexture("CalamityMod/Particles/TrientCircularSmear");
Texture2D smear = Request<Texture2D>("CalamityMod/Particles/TrientCircularSmear").Value;
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
float opacity = (float)Math.Sin(SwingCompletion * MathHelper.Pi);
float rotation = (-MathHelper.PiOver4 * 0.5f + MathHelper.PiOver4 * 0.5f * SwingCompletion + (Combo == 1f ? MathHelper.PiOver4 : 0)) * SwingDirection;
@@ -404,27 +404,26 @@ namespace CalamityMod.Projectiles.Melee
Main.EntitySpriteDraw(smear, Owner.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, Projectile.velocity.ToRotation() + MathHelper.Pi + rotation, smear.Size() / 2f, Projectile.scale * 2.3f, SpriteEffects.None, 0);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
}
}
public void DrawSingleThrownScissorBlade(Color lightColor)
{
Texture2D sword = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRight");
Texture2D glowmask = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsRightGlow");
Texture2D sword = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsRight").Value;
Texture2D glowmask = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsRightGlow").Value;
if (Combo == 3f)
{
Texture2D thrownSword = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeft");
Texture2D thrownGlowmask = GetTexture("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow");
Texture2D thrownSword = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsLeft").Value;
Texture2D thrownGlowmask = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow").Value;
Vector2 drawPos2 = Vector2.SmoothStep(Owner.Center, Projectile.Center, MathHelper.Clamp(SnapEndCompletion + 0.25f, 0f, 1f));
Vector2 drawOrigin2 = new Vector2(22, 109); //Right on the hole
float drawRotation2 = direction.ToRotation() + MathHelper.PiOver2;
Main.EntitySpriteDraw(thrownSword, drawPos2 - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(thrownGlowmask, drawPos2 - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(thrownSword, drawPos2 - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(thrownGlowmask, drawPos2 - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0);
}
@@ -432,13 +431,13 @@ namespace CalamityMod.Projectiles.Melee
Vector2 drawOrigin = new Vector2(51, 86); //Right on the hole
float drawRotation = Projectile.rotation + MathHelper.PiOver4;
Main.EntitySpriteDraw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(glowmask, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(glowmask, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0);
Texture2D smear = GetTexture("CalamityMod/Particles/TrientCircularSmear");
Texture2D smear = Request<Texture2D>("CalamityMod/Particles/TrientCircularSmear").Value;
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.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;
@@ -447,15 +446,15 @@ namespace CalamityMod.Projectiles.Melee
Main.EntitySpriteDraw(smear, Projectile.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, rotation, smear.Size() / 2f, Projectile.scale * 1.4f, SpriteEffects.None, 0);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
}
public void DrawThrownScissors(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 = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsRight").Value;
Texture2D frontBladeGlow = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsRightGlow").Value;
Texture2D backBlade = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsLeft").Value;
Texture2D backBladeGlow = Request<Texture2D>("CalamityMod/Projectiles/Melee/RendingScissorsLeftGlow").Value;
Vector2 drawPos = Projectile.Center;
Vector2 drawOrigin = new Vector2(51, 86); //Right on the hole
@@ -467,18 +466,18 @@ namespace CalamityMod.Projectiles.Melee
if (Combo == 3f)
drawRotation2 = Projectile.rotation + MathHelper.Lerp(-MathHelper.PiOver4 * 0.33f, MathHelper.PiOver2 * 0.85f, MathHelper.Clamp(SnapEndCompletion + 0.5f, 0f, 1f));
Main.EntitySpriteDraw(backBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(backBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(backBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation2, drawOrigin2, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(backBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation2, drawOrigin2, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(frontBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(frontBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(frontBlade, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
Main.EntitySpriteDraw(frontBladeGlow, drawPos - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, Projectile.scale, 0f, 0);
//Smear stuff
Texture2D smear = GetTexture("CalamityMod/Particles/TrientCircularSmear");
Texture2D smear = Request<Texture2D>("CalamityMod/Particles/TrientCircularSmear").Value;
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.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;
@@ -487,7 +486,7 @@ namespace CalamityMod.Projectiles.Melee
Main.EntitySpriteDraw(smear, Projectile.Center - Main.screenPosition, null, smearColor * 0.5f * opacity, rotation, smear.Size() / 2f, Projectile.scale * 1.4f, SpriteEffects.None, 0);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
}
public override void SendExtraAI(BinaryWriter writer)
@@ -146,11 +146,8 @@ namespace CalamityMod.Projectiles.Melee
if (Particles != null)
{
Main.spriteBatch.EnterShaderRegion(BlendState.Additive);
foreach (Particle particle in Particles)
{
particle.CustomDraw(spriteBatch);
}
particle.CustomDraw(Main.spriteBatch);
Main.spriteBatch.ExitShaderRegion();
}
+5 -5
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ModLoader;
@@ -127,9 +127,9 @@ namespace CalamityMod.Projectiles.Melee
public override void AI()
{
drawOffsetX = -28;
drawOriginOffsetY = -2;
drawOriginOffsetX = 12;
DrawOffsetX = -28;
DrawOriginOffsetY = -2;
DrawOriginOffsetX = 12;
Projectile.rotation = Projectile.velocity.ToRotation();
// Run homing code
@@ -159,7 +159,7 @@ namespace CalamityMod.Projectiles.Melee
}
// Cannot deal damage for the first several frames of existence.
public override bool CanDamage()
public override bool? CanDamage()
{
return Projectile.timeLeft < Lifespan - IntangibleFrames;
}
+4 -4
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -31,9 +31,9 @@ namespace CalamityMod.Projectiles.Melee
public override void AI()
{
drawOffsetX = -40;
drawOriginOffsetY = -3;
drawOriginOffsetX = 18;
DrawOffsetX = -40;
DrawOriginOffsetY = -3;
DrawOriginOffsetX = 18;
Projectile.rotation = Projectile.velocity.ToRotation();
// Light
+5 -5
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -31,9 +31,9 @@ namespace CalamityMod.Projectiles.Melee
public override void AI()
{
drawOffsetX = -28;
drawOriginOffsetY = -2;
drawOriginOffsetX = 12;
DrawOffsetX = -28;
DrawOriginOffsetY = -2;
DrawOriginOffsetX = 12;
Projectile.rotation = Projectile.velocity.ToRotation();
// Light
@@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee
{
projVec = projVec.RotatedBy(angleVariance);
if (Projectile.owner == Main.myPlayer)
Projectile.NewProjectile(Projectile.Center, projVec, splitID, damage, 1.5f, Main.myPlayer);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, projVec, splitID, damage, 1.5f, Main.myPlayer);
}
}
}
+4 -4
View File
@@ -1,4 +1,4 @@
using Terraria;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
@@ -26,9 +26,9 @@ namespace CalamityMod.Projectiles.Melee
public override void AI()
{
drawOffsetX = -5;
drawOriginOffsetY = -1;
drawOriginOffsetX = 0;
DrawOffsetX = -5;
DrawOriginOffsetY = -1;
DrawOriginOffsetX = 0;
Projectile.rotation = Projectile.velocity.ToRotation();
// Slow down exponentially and fade away
@@ -153,7 +153,7 @@ namespace CalamityMod.Projectiles.Melee
for (int k = 0; k < 2; k++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 174, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f);
Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType<TinyFlare>(),
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType<TinyFlare>(),
(int)(Projectile.damage * 0.35), Projectile.knockBack * 0.35f, Main.myPlayer, 0f, 0f);
}
}
+3 -4
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
@@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Melee
vector63.Normalize();
vector63 *= (float)Main.rand.Next(45, 65) * 0.1f;
vector63 = vector63.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default);
Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType<UrchinSpikeFugu>(), (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.2f, Projectile.owner, -10f, 0f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType<UrchinSpikeFugu>(), (int)(Projectile.damage * 0.6), Projectile.knockBack * 0.2f, Projectile.owner, -10f, 0f);
}
}
@@ -106,8 +106,7 @@ namespace CalamityMod.Projectiles.Melee
public override bool PreDraw(ref Color lightColor)
{
Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter;
Color transparent = Microsoft.Xna.Framework.Color.Transparent;
Texture2D texture2D2 = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Chains/BallOFuguChain");
Texture2D texture2D2 = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Chains/BallOFuguChain").Value;
Vector2 vector17 = Projectile.Center;
Rectangle? sourceRectangle = null;
Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f);
+4 -4
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.height = 38;
Projectile.aiStyle = 18;
aiType = ProjectileID.DeathSickle;
AIType = ProjectileID.DeathSickle;
Projectile.alpha = 100;
Projectile.friendly = true;
@@ -41,8 +41,8 @@ namespace CalamityMod.Projectiles.Melee
if (Projectile.timeLeft < 85)
{
byte b2 = (byte)(Projectile.timeLeft * 3);
byte a2 = (byte)(100f * ((float)b2 / 255f));
return new Color((int)b2, (int)b2, (int)b2, (int)a2);
byte a2 = (byte)(100f * (b2 / 255f));
return new Color(b2, b2, b2, a2);
}
return new Color(255, 255, 255, 100);
}
+12 -12
View File
@@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee
public class BiomeBladeHoldout : ModProjectile //Visuals
{
private Player Owner => Main.player[Projectile.owner];
public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.modItem as TrueBiomeBlade).CanUseItem(Owner) : false;
public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.ModItem as TrueBiomeBlade).CanUseItem(Owner) : false;
public bool OwnerMayChannel => Owner.itemAnimation == 0 && OwnerCanUseItem && Owner.Calamity().mouseRight && Owner.active && !Owner.dead && Owner.StandingStill() && !Owner.mount.Active && Owner.CheckSolidGround(1, 3);
public ref float ChanneledState => ref Projectile.ai[0];
public ref float ChannelTimer => ref Projectile.ai[1];
@@ -64,9 +64,9 @@ namespace CalamityMod.Projectiles.Melee
associatedItem = Owner.HeldItem;
//Switch up the attunements
Attunement temporaryAttunementStorage = (associatedItem.modItem as TrueBiomeBlade).mainAttunement;
(associatedItem.modItem as TrueBiomeBlade).mainAttunement = (associatedItem.modItem as TrueBiomeBlade).secondaryAttunement;
(associatedItem.modItem as TrueBiomeBlade).secondaryAttunement = temporaryAttunementStorage;
Attunement temporaryAttunementStorage = (associatedItem.ModItem as TrueBiomeBlade).mainAttunement;
(associatedItem.ModItem as TrueBiomeBlade).mainAttunement = (associatedItem.ModItem as TrueBiomeBlade).secondaryAttunement;
(associatedItem.ModItem as TrueBiomeBlade).secondaryAttunement = temporaryAttunementStorage;
Initialized = 1f;
}
@@ -89,11 +89,11 @@ namespace CalamityMod.Projectiles.Melee
if (ChannelTimer >= ChannelTime)
{
Attune((TrueBiomeBlade)associatedItem.modItem);
Attune((TrueBiomeBlade)associatedItem.ModItem);
Projectile.timeLeft = 120;
ChanneledState = 2f; //State where it stays invisible doing nothing. Acts as a cooldown
Color particleColor = (associatedItem.modItem as TrueBiomeBlade).mainAttunement.tooltipColor;
Color particleColor = (associatedItem.ModItem as TrueBiomeBlade).mainAttunement.tooltipColor;
for (int i = 0; i <= 5; i++)
{
@@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Melee
bool desert = Owner.ZoneDesert;
bool hell = Owner.ZoneUnderworldHeight;
bool ocean = Owner.ZoneBeach || Owner.Calamity().ZoneSulphur;
bool holy = Owner.ZoneHoly;
bool hallow = Owner.ZoneHallow;
bool astral = Owner.Calamity().ZoneAstral;
bool marine = Owner.Calamity().ZoneAbyss || Owner.Calamity().ZoneSunkenSea;
@@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Melee
attunement = Attunement.attunementArray[(int)AttunementID.TrueTropical];
if (evil)
attunement = Attunement.attunementArray[(int)AttunementID.TrueEvil];
if (holy)
if (hallow)
attunement = Attunement.attunementArray[(int)AttunementID.Holy];
if (astral)
attunement = Attunement.attunementArray[(int)AttunementID.Astral];
@@ -163,10 +163,10 @@ namespace CalamityMod.Projectiles.Melee
return;
}
//If we swapped out the main attunement for the second one despite the second attunement being empty at the time, unswap them.
if ((associatedItem.modItem as TrueBiomeBlade).mainAttunement == null && (associatedItem.modItem as TrueBiomeBlade).secondaryAttunement != null)
if ((associatedItem.ModItem as TrueBiomeBlade).mainAttunement == null && (associatedItem.ModItem as TrueBiomeBlade).secondaryAttunement != null)
{
(associatedItem.modItem as TrueBiomeBlade).mainAttunement = (associatedItem.modItem as TrueBiomeBlade).secondaryAttunement;
(associatedItem.modItem as TrueBiomeBlade).secondaryAttunement = null;
(associatedItem.ModItem as TrueBiomeBlade).mainAttunement = (associatedItem.ModItem as TrueBiomeBlade).secondaryAttunement;
(associatedItem.ModItem as TrueBiomeBlade).secondaryAttunement = null;
}
}
@@ -177,7 +177,7 @@ namespace CalamityMod.Projectiles.Melee
else if (ChanneledState == 1f)
{
Texture2D tex = GetTexture(Texture);
Texture2D tex = Request<Texture2D>(Texture).Value;
Vector2 squishyScale = new Vector2(Math.Abs((float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f)), 1f);
SpriteEffects flip = (float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f) > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
Main.EntitySpriteDraw(tex, Projectile.position - Main.screenPosition, null, lightColor * (Projectile.timeLeft / 60f), 0, tex.Size() / 2, squishyScale * (2f - (Projectile.timeLeft / 60f)), flip, 0);
+8 -9
View File
@@ -1,4 +1,4 @@
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Projectiles.BaseProjectiles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Melee
public override string Texture => "CalamityMod/Items/Weapons/Melee/BladecrestOathsword";
public override int AssociatedItemID => ModContent.ItemType<BladecrestOathsword>();
public override int IntendedProjectileType => ModContent.ProjectileType<BladecrestOathswordProj>();
public override bool CanDamage() => CurrentState != 0; //Could also disable the damage during the channel state,
public override bool? CanDamage() => CurrentState != 0; //Could also disable the damage during the channel state,
public override void SetStaticDefaults()
{
@@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Melee
if ((swingCompletion > 0f && swingCompletion < 1f) || PostSwingRepositionDelay > 0f)
{
swingSpeedInterpolant = MathHelper.Lerp(swingSpeedInterpolant, 1f, Utils.InverseLerp(0f, 0.2f, swingCompletion, true));
swingSpeedInterpolant = MathHelper.Lerp(swingSpeedInterpolant, 1f, Utils.GetLerpValue(0f, 0.2f, swingCompletion, true));
float horizontalAngle = MathHelper.Lerp(-1.2f, 2.6f, (float)Math.Pow(MathHelper.SmoothStep(0f, 1f, swingCompletion), 3D)) * Direction;
Matrix offsetLinearTransformation = Matrix.CreateRotationZ(horizontalAngle);
@@ -100,13 +100,12 @@ namespace CalamityMod.Projectiles.Melee
aimDirection3D = Vector3.Transform(Vector3.UnitX, offsetLinearTransformation);
}
// Fuck this shit.
// The code is kept around if we want the holdout effect but I'm honestly not going to continue Criticism Whack-a-Mole with this frankly arbitrary visual.
// Disable the holdout effect. This was decided after indeciciveness with what would be best.
else
Projectile.Opacity = 0f;
// Determine the horizontal stretch offset of the blade. This is used in matrix math below to create 2.5D visuals.
BladeHorizontalFactor = MathHelper.Lerp(1f, 1.5f, (aimDirection3D.X * 0.5f + 0.5f) * Utils.InverseLerp(1f, 0.8f, unchangedSwingCompletion, true));
BladeHorizontalFactor = MathHelper.Lerp(1f, 1.5f, (aimDirection3D.X * 0.5f + 0.5f) * Utils.GetLerpValue(1f, 0.8f, unchangedSwingCompletion, true));
float baseRotation = new Vector2(aimDirection3D.X, aimDirection3D.Y).ToRotation();
@@ -129,7 +128,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.rotation = Projectile.rotation.AngleTowards(idealRotation, swingSpeedInterpolant * 0.45f).AngleLerp(idealRotation, swingSpeedInterpolant * 0.2f);
// Offset the blade so that the handle is attached to the owner's hand.
float horizontalBladeOffset = MathHelper.Lerp(-4f, 10f, Utils.InverseLerp(1f, 0.72f, unchangedSwingCompletion, true) * Utils.InverseLerp(0f, 0.28f, unchangedSwingCompletion, true));
float horizontalBladeOffset = MathHelper.Lerp(-4f, 10f, Utils.GetLerpValue(1f, 0.72f, unchangedSwingCompletion, true) * Utils.GetLerpValue(0f, 0.28f, unchangedSwingCompletion, true));
Vector2 bladeOffset = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * Projectile.width * 0.5f;
bladeOffset += new Vector2(Direction * horizontalBladeOffset, 2f).RotatedBy(Owner.fullRotation) + Vector2.UnitY * Owner.gfxOffY;
Projectile.position += bladeOffset;
@@ -153,7 +152,7 @@ namespace CalamityMod.Projectiles.Melee
bloodScytheShootVelocity.Y *= 0.04f;
bloodScytheShootVelocity = bloodScytheShootVelocity.SafeNormalize(Vector2.UnitY) * 50f;
Vector2 bloodScytheSpawnPosition = Projectile.Center + bloodScytheShootVelocity.SafeNormalize(Vector2.UnitY) * 50f;
Projectile.NewProjectile(bloodScytheSpawnPosition, bloodScytheShootVelocity, ModContent.ProjectileType<BloodScythe>(), Projectile.damage, Projectile.knockBack * 0.4f, Projectile.owner);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), bloodScytheSpawnPosition, bloodScytheShootVelocity, ModContent.ProjectileType<BloodScythe>(), Projectile.damage, Projectile.knockBack * 0.4f, Projectile.owner);
}
}
}
@@ -209,7 +208,7 @@ namespace CalamityMod.Projectiles.Melee
{
ItemLoader.OnHitNPC(Owner.ActiveItem(), Owner, target, damage, knockback, crit);
NPCLoader.OnHitByItem(target, Owner, Owner.ActiveItem(), damage, knockback, crit);
PlayerHooks.OnHitNPC(Owner, Owner.ActiveItem(), target, damage, knockback, crit);
PlayerLoader.OnHitNPC(Owner, Owner.ActiveItem(), target, damage, knockback, crit);
}
}
}
+4 -4
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
@@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.penetrate = 5;
Projectile.timeLeft = 180;
Projectile.ignoreWater = true;
aiType = ProjectileID.DeathSickle;
AIType = ProjectileID.DeathSickle;
}
public override void AI()
@@ -42,8 +42,8 @@ namespace CalamityMod.Projectiles.Melee
if (Projectile.timeLeft < 85)
{
byte b2 = (byte)(Projectile.timeLeft * 3);
byte a2 = (byte)(100f * ((float)b2 / 255f));
return new Color((int)b2, (int)b2, (int)b2, (int)a2);
byte a2 = (byte)(100f * (b2 / 255f));
return new Color(b2, b2, b2, a2);
}
return new Color(255, 255, 255, 100);
}
+2 -2
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
@@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee
{
for (int num228 = num225; num228 < num226; num228++)
{
if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].TileType] || (Main.tileSolidTop[(int)Main.tile[num227, num228].TileType] && Main.tile[num227, num228].TileFrameY == 0)))
if (Main.tile[num227, num228] != null && Main.tile[num227, num228].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[num227, num228].TileType] || (Main.tileSolidTop[(int)Main.tile[num227, num228].TileType] && Main.tile[num227, num228].TileFrameY == 0)))
{
Vector2 vector19;
vector19.X = (float)(num227 * 16);
+2 -2
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
@@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.velocity *= 0.935f;
Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.1f;
Projectile.Opacity = Utils.InverseLerp(1f, 6f, Projectile.velocity.Length(), true);
Projectile.Opacity = Utils.GetLerpValue(1f, 6f, Projectile.velocity.Length(), true);
if (Projectile.Opacity <= 0f)
Projectile.Kill();
+1 -1
View File
@@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.width = 48;
Projectile.height = 48;
Projectile.aiStyle = 18;
aiType = ProjectileID.DeathSickle;
AIType = ProjectileID.DeathSickle;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.penetrate = 3;
+3 -3
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
@@ -31,13 +31,13 @@ namespace CalamityMod.Projectiles.Melee
//Changes the texture of the projectile
if (Projectile.ai[0] == 1f)
{
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/BonebreakerFragment2");
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/BonebreakerFragment2").Value;
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0);
return false;
}
if (Projectile.ai[0] == 2f)
{
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/BonebreakerFragment2");
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/BonebreakerFragment2").Value;
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0);
return false;
}
+2 -2
View File
@@ -1,4 +1,4 @@
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Buffs.StatDebuffs;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee
}
velocity.Normalize();
velocity *= (float)Main.rand.Next(70, 101) * 0.1f;
int shard = Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType<BonebreakerFragment1>(), (int)(Projectile.damage * 0.5f), Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.Next(0,4), 0f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<BonebreakerFragment1>(), (int)(Projectile.damage * 0.5f), Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.Next(0,4), 0f);
}
}
}
+2 -1
View File
@@ -1,4 +1,4 @@
using CalamityMod.Dusts;
using CalamityMod.Dusts;
using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
@@ -86,6 +86,7 @@ namespace CalamityMod.Projectiles.Melee
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
// TODO -- Change this to use proper i-frame variables.
target.immune[Projectile.owner] = 7;
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
}
+2 -1
View File
@@ -1,4 +1,4 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Terraria;
@@ -97,6 +97,7 @@ namespace CalamityMod.Projectiles.Melee
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
// TODO -- Change this to use proper i-frame variables.
target.immune[Projectile.owner] = 7;
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
}
+1 -1
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.width = 20;
Projectile.height = 20;
Projectile.aiStyle = 27;
aiType = ProjectileID.LightBeam;
AIType = ProjectileID.LightBeam;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.penetrate = 1;
+3 -3
View File
@@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.width = 20;
Projectile.height = 20;
Projectile.aiStyle = 27;
aiType = ProjectileID.LightBeam;
AIType = ProjectileID.LightBeam;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.penetrate = -1;
@@ -88,8 +88,8 @@ namespace CalamityMod.Projectiles.Melee
for (i = 0; i < 2; i++)
{
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<Brimlash2>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<Brimlash2>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<Brimlash2>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<Brimlash2>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
}
}
}
+2 -1
View File
@@ -1,4 +1,4 @@
using CalamityMod.Dusts;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using System;
using Terraria;
@@ -69,6 +69,7 @@ namespace CalamityMod.Projectiles.Melee
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
// TODO -- Change this to use proper i-frame variables.
target.immune[Projectile.owner] = 6;
}
}
+1 -1
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.width = 2;
Projectile.height = 2;
Projectile.aiStyle = 1;
aiType = ProjectileID.DeathLaser;
AIType = ProjectileID.DeathLaser;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.scale = 2f;
+2 -2
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
@@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Melee
float num618 = ((float)(num613 + num614) - Projectile.ai[1] + 1f) * num615 / (float)(num614 + num613);
center.Y -= (float)num617 * num618 / 2f;
center.Y += 2f;
int num335 = Projectile.NewProjectile(center.X, center.Y, Projectile.velocity.X, Projectile.velocity.Y, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 8f, Projectile.ai[1] - 1f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), center.X, center.Y, Projectile.velocity.X, Projectile.velocity.Y, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 8f, Projectile.ai[1] - 1f);
}
if (Projectile.ai[0] <= 0f)
{
+3 -3
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ModLoader;
@@ -133,13 +133,13 @@ namespace CalamityMod.Projectiles.Melee
for (int num333 = num330; num333 < num330 + num332; num333++)
{
Tile tile = Main.tile[num331, num333];
if (tile.active() && (Main.tileSolid[(int)tile.TileType] || tile.liquid != 0))
if (tile.HasTile && (Main.tileSolid[(int)tile.TileType] || tile.LiquidAmount != 0))
{
num330 = num333;
break;
}
}
int num335 = Projectile.NewProjectile((float)(num331 * 16 + 8), (float)(num330 * 16 - 24), 0f, 0f, ModContent.ProjectileType<BrinySpout>(), Projectile.damage, 6f, Main.myPlayer, 8f, 25f);
int num335 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), (float)(num331 * 16 + 8), (float)(num330 * 16 - 24), 0f, 0f, ModContent.ProjectileType<BrinySpout>(), Projectile.damage, 6f, Main.myPlayer, 8f, 25f);
Main.projectile[num335].netUpdate = true;
}
}
+10 -10
View File
@@ -17,7 +17,7 @@ namespace CalamityMod.Projectiles.Melee
{
private Player Owner => Main.player[Projectile.owner];
public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.modItem as BiomeBlade).CanUseItem(Owner) : false;
public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.ModItem as BiomeBlade).CanUseItem(Owner) : false;
public bool OwnerMayChannel => Owner.itemAnimation == 0 && OwnerCanUseItem && Owner.Calamity().mouseRight && Owner.active && !Owner.dead && Owner.StandingStill() && !Owner.mount.Active && Owner.CheckSolidGround(1, 3);
public ref float ChanneledState => ref Projectile.ai[0];
public ref float ChannelTimer => ref Projectile.ai[1];
@@ -67,9 +67,9 @@ namespace CalamityMod.Projectiles.Melee
associatedItem = Owner.HeldItem;
//Switch up the attunements
Attunement temporaryAttunementStorage = (associatedItem.modItem as BiomeBlade).mainAttunement;
(associatedItem.modItem as BiomeBlade).mainAttunement = (associatedItem.modItem as BiomeBlade).secondaryAttunement;
(associatedItem.modItem as BiomeBlade).secondaryAttunement = temporaryAttunementStorage;
Attunement temporaryAttunementStorage = (associatedItem.ModItem as BiomeBlade).mainAttunement;
(associatedItem.ModItem as BiomeBlade).mainAttunement = (associatedItem.ModItem as BiomeBlade).secondaryAttunement;
(associatedItem.ModItem as BiomeBlade).secondaryAttunement = temporaryAttunementStorage;
Initialized = 1f;
}
@@ -92,11 +92,11 @@ namespace CalamityMod.Projectiles.Melee
if (ChannelTimer >= ChannelTime)
{
Attune((BiomeBlade)associatedItem.modItem);
Attune((BiomeBlade)associatedItem.ModItem);
Projectile.timeLeft = 120;
ChanneledState = 2f; //State where it stays invisible doing nothing. Acts as a cooldown
Color particleColor = (associatedItem.modItem as BiomeBlade).mainAttunement.tooltipColor;
Color particleColor = (associatedItem.ModItem as BiomeBlade).mainAttunement.tooltipColor;
for (int i = 0; i <= 5; i++)
{
@@ -166,10 +166,10 @@ namespace CalamityMod.Projectiles.Melee
}
//If we swapped out the main attunement for the second one despite the second attunement being empty at the time, unswap them.
if ((associatedItem.modItem as BiomeBlade).mainAttunement == null && (associatedItem.modItem as BiomeBlade).secondaryAttunement != null)
if ((associatedItem.ModItem as BiomeBlade).mainAttunement == null && (associatedItem.ModItem as BiomeBlade).secondaryAttunement != null)
{
(associatedItem.modItem as BiomeBlade).mainAttunement = (associatedItem.modItem as BiomeBlade).secondaryAttunement;
(associatedItem.modItem as BiomeBlade).secondaryAttunement = null;
(associatedItem.ModItem as BiomeBlade).mainAttunement = (associatedItem.ModItem as BiomeBlade).secondaryAttunement;
(associatedItem.ModItem as BiomeBlade).secondaryAttunement = null;
}
//Cool particles
@@ -182,7 +182,7 @@ namespace CalamityMod.Projectiles.Melee
else if (ChanneledState == 1f)
{
Texture2D tex = GetTexture(Texture);
Texture2D tex = Request<Texture2D>(Texture).Value;
Vector2 squishyScale = new Vector2(Math.Abs((float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f)), 1f);
SpriteEffects flip = (float)Math.Sin(MathHelper.Pi + MathHelper.TwoPi * Projectile.timeLeft / 30f) > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
Main.EntitySpriteDraw(tex, Projectile.position - Main.screenPosition, null, lightColor * (Projectile.timeLeft / 60f), 0, tex.Size() / 2, squishyScale * (2f - (Projectile.timeLeft / 60f)), flip, 0);
@@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.timeLeft = BiomeBlade.HotAttunement_LocalIFrames;
}
public override bool CanDamage()
public override bool? CanDamage()
{
return Projectile.timeLeft <= 2; //Prevent spam click abuse
}
@@ -90,7 +90,7 @@ namespace CalamityMod.Projectiles.Melee
}
if (Owner.HeldItem.type == ItemType<BiomeBlade>())
(Owner.HeldItem.modItem as BiomeBlade).CanLunge = 1; // Reset the lunge counter on pogo. This should make for more interesting and fun synergies
(Owner.HeldItem.ModItem as BiomeBlade).CanLunge = 1; // Reset the lunge counter on pogo. This should make for more interesting and fun synergies
}
}
@@ -174,10 +174,10 @@ namespace CalamityMod.Projectiles.Melee
damage = (int)(currentDamage * damageReduction);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => ShredTarget(target);
public override void OnHitPvp(Player target, int damage, bool crit) => ShredTarget(target);
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => ShredTarget();
public override void OnHitPvp(Player target, int damage, bool crit) => ShredTarget();
private void ShredTarget(Entity target)
private void ShredTarget()
{
if (Main.myPlayer != Owner.whoAmI)
return;
@@ -200,8 +200,8 @@ namespace CalamityMod.Projectiles.Melee
public override bool PreDraw(ref Color lightColor)
{
Texture2D handle = GetTexture("CalamityMod/Items/Weapons/Melee/BiomeBlade");
Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur");
Texture2D handle = Request<Texture2D>("CalamityMod/Items/Weapons/Melee/BiomeBlade").Value;
Texture2D blade = Request<Texture2D>("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_AridGrandeur").Value;
int bladeAmount = 4;
@@ -211,21 +211,21 @@ namespace CalamityMod.Projectiles.Melee
Vector2 drawOrigin = new Vector2(0f, handle.Height);
Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition;
Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
//Turn on additive blending
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
//Update the parameters
drawOrigin = new Vector2(0f, blade.Height);
drawOffset = Owner.Center + (drawAngle.ToRotationVector2() * 32f * Projectile.scale) - Main.screenPosition;
Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
for (int i = 0; i < bladeAmount; i++) //Draw extra copies
{
blade = GetTexture("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_AridGrandeurExtra");
blade = Request<Texture2D>("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_AridGrandeurExtra").Value;
drawAngle = direction.ToRotation();
@@ -238,12 +238,12 @@ namespace CalamityMod.Projectiles.Melee
Vector2 drawOffsetStraight = Owner.Center + direction * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 7) * 10 - Main.screenPosition; //How far from the player
Vector2 drawDisplacementAngle = direction.RotatedBy(MathHelper.PiOver2) * circleCompletion.ToRotationVector2().Y * (20 + 40 * ShredRatio); //How far perpendicularly
Main.EntitySpriteDraw(blade, drawOffsetStraight + drawDisplacementAngle, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(blade, drawOffsetStraight + drawDisplacementAngle, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
}
//Back to normal
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
return false;
}
@@ -199,31 +199,31 @@ namespace CalamityMod.Projectiles.Melee
public override bool PreDraw(ref Color lightColor)
{
Texture2D handle = GetTexture("CalamityMod/Items/Weapons/Melee/BiomeBlade");
Texture2D handle = Request<Texture2D>("CalamityMod/Items/Weapons/Melee/BiomeBlade").Value;
if (SwingMode != 2)
{
Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace" + (SwingMode == 0 ? "Small" : "Big"));
Texture2D blade = Request<Texture2D>("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_BitingEmbrace" + (SwingMode == 0 ? "Small" : "Big")).Value;
float drawAngle = rotation;
float drawRotation = rotation + MathHelper.PiOver4;
Vector2 drawOrigin = new Vector2(0f, handle.Height);
Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition;
Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
//Turn on additive blending
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
//Update the parameters
drawOrigin = new Vector2(0f, blade.Height);
drawOffset = Owner.Center + (drawAngle.ToRotationVector2() * 28f * Projectile.scale) - Main.screenPosition;
Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
//Back to normal
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
}
else
{
Texture2D blade = GetTexture("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_BitingEmbraceThrust");
Texture2D blade = Request<Texture2D>("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_BitingEmbraceThrust").Value;
Vector2 thrustDisplace = direction * (ThrustDisplaceRatio() * 60);
float drawAngle = rotation;
@@ -231,10 +231,10 @@ namespace CalamityMod.Projectiles.Melee
Vector2 drawOrigin = new Vector2(0f, handle.Height);
Vector2 drawOffset = Owner.Center + drawAngle.ToRotationVector2() * 10f - Main.screenPosition;
Main.EntitySpriteDraw(handle, drawOffset + thrustDisplace, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(handle, drawOffset + thrustDisplace, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
//Turn on additive blending
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
//Update the parameters
drawOrigin = new Vector2(0f, 114f);
@@ -242,10 +242,10 @@ namespace CalamityMod.Projectiles.Melee
//Anim stuff
Rectangle frameRectangle = new Rectangle(0, 0 + (116 * Projectile.frame), 114, 114);
Main.EntitySpriteDraw(blade, drawOffset + thrustDisplace, frameRectangle, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(blade, drawOffset + thrustDisplace, frameRectangle, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
//Back to normal
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
}
return false;
@@ -118,8 +118,8 @@ namespace CalamityMod.Projectiles.Melee
public override bool PreDraw(ref Color lightColor)
{
Texture2D handle = GetTexture("CalamityMod/Items/Weapons/Melee/BiomeBlade");
Texture2D tex = GetTexture("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort");
Texture2D handle = Request<Texture2D>("CalamityMod/Items/Weapons/Melee/BiomeBlade").Value;
Texture2D tex = Request<Texture2D>("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort").Value;
float drawAngle = direction.ToRotation();
float drawRotation = drawAngle + MathHelper.PiOver4;
@@ -128,19 +128,19 @@ namespace CalamityMod.Projectiles.Melee
Vector2 drawOrigin = new Vector2(0f, handle.Height);
Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition;
Main.EntitySpriteDraw(handle, drawOffset + displace, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(handle, drawOffset + displace, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
//Turn on additive blending
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
//Update the parameters
drawOrigin = new Vector2(0f, tex.Height);
drawOffset = Owner.Center + (drawAngle.ToRotationVector2() * 24f * Projectile.scale) - Main.screenPosition;
Main.EntitySpriteDraw(tex, drawOffset + displace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(tex, drawOffset + displace, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
//Back to normal
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
return false;
}
@@ -189,7 +189,7 @@ namespace CalamityMod.Projectiles.Melee
Vector2 projBottom = Projectile.Center + new Vector2(-handle.Width / 2, handle.Height / 2).RotatedBy(Projectile.rotation + MathHelper.PiOver4) * 0.75f;
DrawChain(projBottom, out Vector2[] chainPositions);
float drawRotation = (projBottom - chainPositions[chainPositions.Length - 2]).ToRotation() + MathHelper.PiOver4; //Face away from the last point of the bezier curve
float drawRotation = (projBottom - chainPositions[^2]).ToRotation() + MathHelper.PiOver4; //Face away from the last point of the bezier curve
drawRotation += SnapCoyoteTime > 0 ? MathHelper.Pi : 0; //During coyote time the blade flips for some reason. Prevent that from happening
drawRotation += Projectile.spriteDirection < 0 ? 0f : 0f;
@@ -1,4 +1,4 @@
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Buffs.StatDebuffs;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee
{
Projectile.width = Projectile.height = 32;
Projectile.aiStyle = 27;
aiType = ProjectileID.LightBeam;
AIType = ProjectileID.LightBeam;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.timeLeft = 40;
+2 -2
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
@@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Melee
{
Projectile.alpha = num58;
}
Projectile.rotation = Projectile.velocity.ToRotation() - 1.57079637f;
Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2;
}
public override void Kill(int timeLeft)
+1 -1
View File
@@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.DamageType = DamageClass.Melee;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
aiType = ProjectileID.SporeCloud;
AIType = ProjectileID.SporeCloud;
}
public override void AI()
+1 -1
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.DamageType = DamageClass.Melee;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
aiType = ProjectileID.SporeCloud;
AIType = ProjectileID.SporeCloud;
}
public override void AI()
+4 -5
View File
@@ -1,4 +1,4 @@
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Buffs.StatDebuffs;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
@@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Melee
Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height);
Projectile.ai[0] = 1f;
Projectile.netUpdate = true;
SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)Projectile.position.X, (int)Projectile.position.Y);
SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Item/ClamImpact"), (int)Projectile.position.X, (int)Projectile.position.Y);
for (int num105 = 0; num105 < 50; num105++)
{
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
@@ -139,8 +139,7 @@ namespace CalamityMod.Projectiles.Melee
public override bool PreDraw(ref Color lightColor)
{
Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter;
Color transparent = Microsoft.Xna.Framework.Color.Transparent;
Texture2D texture2D2 = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Chains/ClamCrusherChain");
Texture2D texture2D2 = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Chains/ClamCrusherChain").Value;
Vector2 vector17 = Projectile.Center;
Rectangle? sourceRectangle = null;
Vector2 origin = new Vector2((float)texture2D2.Width * 0.5f, (float)texture2D2.Height * 0.5f);
@@ -184,7 +183,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.ai[0] = 1f;
Projectile.netUpdate = true;
SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/ClamImpact"), (int)Projectile.position.X, (int)Projectile.position.Y);
SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Item/ClamImpact"), (int)Projectile.position.X, (int)Projectile.position.Y);
}
}
}
+4 -4
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
@@ -24,16 +24,16 @@ namespace CalamityMod.Projectiles.Melee
Projectile.DamageType = DamageClass.Melee;
Projectile.tileCollide = false;
Projectile.extraUpdates = 2;
aiType = ProjectileID.Meteor1;
AIType = ProjectileID.Meteor1;
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
if (Projectile.Calamity().lineColor == 1)
tex = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/CometQuasherMeteor2");
tex = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/CometQuasherMeteor2").Value;
if (Projectile.Calamity().lineColor == 2)
tex = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/CometQuasherMeteor3");
tex = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/CometQuasherMeteor3").Value;
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1, tex);
return false;
+5 -4
View File
@@ -1,4 +1,4 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatBuffs;
using CalamityMod.Buffs.StatDebuffs;
using Microsoft.Xna.Framework;
@@ -44,8 +44,9 @@ namespace CalamityMod.Projectiles.Melee
public override int TailStartY => 114;
public override int TailHeight => 84;
//All of this wouldnt be here if depthLayer fucking worked, i wanna hit someone - Shucks
//the hell you mean, depthlayer is a useless fucking variable bro - Iban 2022
// All of this wouldnt be here if depthLayer fucking worked, i wanna hit someone - Shucks
// the hell you mean, depthlayer is a useless fucking variable bro - Iban 2022
// Not necessarily. Terraria is just made in such a way that we're forced to use sprite batch states that ignore it - Dominic 2022
public override void PostDraw(Color lightColor)
{
Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter;
@@ -108,7 +109,7 @@ namespace CalamityMod.Projectiles.Melee
target.AddBuff(ModContent.BuffType<GlacialState>(), 60);
if (Projectile.localAI[1] <= 0f && Projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType<CosmicIceBurst>(), Projectile.damage, 10f, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType<CosmicIceBurst>(), Projectile.damage, 10f, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f);
}
Projectile.localAI[1] = 4f;
player.AddBuff(ModContent.BuffType<CosmicFreeze>(), 300);
+4 -4
View File
@@ -1,4 +1,4 @@
using System;
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
@@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Melee
int directionSign = Main.rand.NextBool(2).ToDirectionInt();
Vector2 spawnPos = new Vector2(target.Center.X + directionSign * 650, Projectile.Center.Y + Main.rand.Next(-500, 501));
Vector2 velocity = Vector2.Normalize(target.Center - spawnPos) * 30f;
Projectile.NewProjectile(spawnPos.X, spawnPos.Y, velocity.X, velocity.Y, ModContent.ProjectileType<CosmicShivBlade>(), Projectile.damage, Projectile.knockBack * 0.1f, Projectile.owner);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), spawnPos.X, spawnPos.Y, velocity.X, velocity.Y, ModContent.ProjectileType<CosmicShivBlade>(), Projectile.damage, Projectile.knockBack * 0.1f, Projectile.owner);
}
int starMax = Main.rand.Next(6, 11); // 6 to 10 stars
for (int i = -starMax / 2; i < starMax / 2; i++)
@@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Melee
int ySpawnAdditive = Main.rand.Next(-40, 41);
Vector2 toSpawn = target.Center - new Vector2(0f, 800f + ySpawnAdditive).RotatedBy(MathHelper.ToRadians(i * 11f / starMax));
Vector2 toTarget = Vector2.Normalize(target.Center - toSpawn) * 35f;
Projectile.NewProjectile(toSpawn, toTarget, ModContent.ProjectileType<GalaxyStar>(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), toSpawn, toTarget, ModContent.ProjectileType<GalaxyStar>(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner);
}
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 60);
target.AddBuff(BuffID.Frostburn, 60);
@@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Melee
target.StrikeNPC(damage, 0f, 0, crit, false, false);
if (Main.netMode != NetmodeID.SinglePlayer)
NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, i, damage, 0f, 0f, crit ? 1 : 0, 0, 0);
NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, i, damage, 0f, 0f, crit ? 1 : 0, 0, 0);
}
}
}
+1 -1
View File
@@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Melee
vectorBruh -= new Vector2((float)(player.bodyFrame.Width - player.width), (float)(player.bodyFrame.Height - 42)) / 2f;
Vector2 newCenter = player.RotatedRelativePoint(Main.player[Projectile.owner].position + vectorBruh, true) + Projectile.velocity;
int moonDamage = (int)(Projectile.damage * 0.18f);
Projectile.NewProjectile(newCenter.X, newCenter.Y, 0f, 0f, ModContent.ProjectileType<CrescentMoonProj>(), moonDamage, 0f, Projectile.owner, 0f, 0f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), newCenter.X, newCenter.Y, 0f, 0f, ModContent.ProjectileType<CrescentMoonProj>(), moonDamage, 0f, Projectile.owner, 0f, 0f);
moonCounter = 6;
}
}
+1 -1
View File
@@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.localNPCHitCooldown = 10;
Projectile.extraUpdates = 1;
Projectile.aiStyle = 18;
aiType = ProjectileID.DeathSickle;
AIType = ProjectileID.DeathSickle;
}
public override void AI()
+2 -2
View File
@@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.tileCollide = false;
Projectile.DamageType = DamageClass.Melee;
Projectile.ignoreWater = true;
aiType = ProjectileID.CrystalVileShardHead;
AIType = ProjectileID.CrystalVileShardHead;
}
public override void AI()
@@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Melee
}
int num49 = Projectile.damage;
float num50 = Projectile.knockBack;
int number = Projectile.NewProjectile(Projectile.position.X + Projectile.velocity.X + (float)(Projectile.width / 2), Projectile.position.Y + Projectile.velocity.Y + (float)(Projectile.height / 2), Projectile.velocity.X, Projectile.velocity.Y, num48, num49, num50, Projectile.owner, 0f, Projectile.ai[1] + 1f);
int number = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.position.X + Projectile.velocity.X + (float)(Projectile.width / 2), Projectile.position.Y + Projectile.velocity.Y + (float)(Projectile.height / 2), Projectile.velocity.X, Projectile.velocity.Y, num48, num49, num50, Projectile.owner, 0f, Projectile.ai[1] + 1f);
NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, number, 0f, 0f, 0f, 0, 0, 0);
}
}
+1 -1
View File
@@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.tileCollide = false;
Projectile.DamageType = DamageClass.Melee;
Projectile.ignoreWater = true;
aiType = ProjectileID.CrystalVileShardShaft;
AIType = ProjectileID.CrystalVileShardShaft;
}
public override void AI()
+2 -2
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee
{
for (int num228 = num225; num228 < num226; num228++)
{
if (Main.tile[num227, num228] != null && Main.tile[num227, num228].nactive() && (Main.tileSolid[(int)Main.tile[num227, num228].TileType] || (Main.tileSolidTop[(int)Main.tile[num227, num228].TileType] && Main.tile[num227, num228].TileFrameY == 0)))
if (Main.tile[num227, num228] != null && Main.tile[num227, num228].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[num227, num228].TileType] || (Main.tileSolidTop[(int)Main.tile[num227, num228].TileType] && Main.tile[num227, num228].TileFrameY == 0)))
{
Vector2 vector19;
vector19.X = (float)(num227 * 16);
+2 -2
View File
@@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.width = 56;
Projectile.height = 56;
Projectile.aiStyle = 18;
aiType = ProjectileID.DeathSickle;
AIType = ProjectileID.DeathSickle;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.penetrate = 1;
@@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee
{
for (int k = 0; k < 3; k++)
{
Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType<TinyCrystal>(),
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType<TinyCrystal>(),
(int)(Projectile.damage * 0.5), Projectile.knockBack * 0.15f, Main.myPlayer);
}
}
+1 -1
View File
@@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.width = 28;
Projectile.height = 28;
Projectile.aiStyle = 1;
aiType = ProjectileID.Bullet;
AIType = ProjectileID.Bullet;
Projectile.timeLeft = 600;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
+2 -2
View File
@@ -1,4 +1,4 @@
using CalamityMod.Dusts;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
@@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Melee
if (tileCheck)
dust.noLight = true;
Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.ToRadians(45);
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45);
}
public override void Kill(int timeLeft)
+2 -2
View File
@@ -57,8 +57,8 @@ namespace CalamityMod.Projectiles.Melee
for (i = 0; i < 4; i++)
{
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<DracoBeam2>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<DracoBeam2>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<DracoBeam2>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<DracoBeam2>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
}
}
for (int k = 0; k < 10; k++)
+7 -7
View File
@@ -1,4 +1,4 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Items.Weapons.Melee;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -40,9 +40,9 @@ namespace CalamityMod.Projectiles.Melee
// ai[1] = tick counter used to spawn projectiles and control transparency
public override void AI()
{
drawOffsetX = 0;
drawOriginOffsetY = -11;
drawOriginOffsetX = 0;
DrawOffsetX = 0;
DrawOriginOffsetY = -11;
DrawOriginOffsetX = 0;
Player owner = Main.player[Projectile.owner];
@@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Melee
float sparkVariety = Main.rand.Next(3);
if (Projectile.owner == Main.myPlayer)
Projectile.NewProjectile(Projectile.Center, vel, type, damage, kb, Projectile.owner, sparkVariety, 0f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, vel, type, damage, kb, Projectile.owner, sparkVariety, 0f);
}
}
@@ -215,7 +215,7 @@ namespace CalamityMod.Projectiles.Melee
if (Projectile.owner == Main.myPlayer)
{
int idx = Projectile.NewProjectile(startPos, fallVec, type, waterfallDamage, waterfallKB, Projectile.owner, 0f, 0f);
int idx = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), startPos, fallVec, type, waterfallDamage, waterfallKB, Projectile.owner, 0f, 0f);
Main.projectile[idx].timeLeft = 100;
Main.projectile[idx].tileCollide = false;
}
@@ -228,7 +228,7 @@ namespace CalamityMod.Projectiles.Melee
Player owner = Main.player[Projectile.owner];
Vector2 mountedCenter = owner.MountedCenter;
Color transparent = Color.Transparent;
Texture2D chainTex = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Chains/DragonPowChain");
Texture2D chainTex = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Chains/DragonPowChain").Value;
Vector2 chainDrawPos = Projectile.Center;
Rectangle? sourceRectangle = null;
+4 -4
View File
@@ -1,4 +1,4 @@
using CalamityMod.CalPlayer;
using CalamityMod.CalPlayer;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -166,7 +166,7 @@ namespace CalamityMod.Projectiles.Melee
modPlayer.dragonRageHits = 0;
}
int proj = Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType<FuckYou>(), Projectile.damage / 4, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f);
int proj = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), position, Vector2.Zero, ModContent.ProjectileType<FuckYou>(), Projectile.damage / 4, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f);
Main.projectile[proj].Calamity().forceMelee = true;
}
}
@@ -182,7 +182,7 @@ namespace CalamityMod.Projectiles.Melee
Vector2 velocity = new Vector2(0f, speed);
velocity = velocity.RotatedBy(angleStep * i * Main.rand.NextFloat(0.9f, 1.1f));
Projectile.NewProjectile(Projectile.Center, velocity, ModContent.ProjectileType<DragonRageFireball>(), Projectile.damage / 8, Projectile.knockBack / 3f, Projectile.owner);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<DragonRageFireball>(), Projectile.damage / 8, Projectile.knockBack / 3f, Projectile.owner);
}
}
@@ -200,7 +200,7 @@ namespace CalamityMod.Projectiles.Melee
bool hostileProjs = Projectile.hostile && npc.friendly && !npc.dontTakeDamageFromHostiles;
if (npc.active && !npc.dontTakeDamage && (friendlyProjs || hostileProjs) && (Projectile.owner < 0 || npc.immune[Projectile.owner] == 0 || Projectile.maxPenetrate == 1))
{
if (npc.noTileCollide || !Projectile.ownerHitCheck || Projectile.CanHit(npc))
if (npc.noTileCollide || !Projectile.ownerHitCheck || (ProjectileLoader.CanHitNPC(Projectile, npc) ?? false))
{
bool canHit;
Rectangle rect = npc.Hitbox;
+2 -2
View File
@@ -121,8 +121,8 @@ namespace CalamityMod.Projectiles.Melee
projChoice = ModContent.ProjectileType<Earth4>();
}
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), projChoice, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), projChoice, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), projChoice, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), projChoice, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
}
SoundEngine.PlaySound(SoundID.Item10, (int)Projectile.position.X, (int)Projectile.position.Y);
for (int k = 0; k < 15; k++)
+2 -2
View File
@@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee
for (int i = 0; i < numProj + 1; i++)
{
Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1)));
Projectile.NewProjectile(Projectile.Center, perturbedSpeed * 0.5f, ModContent.ProjectileType<ElementalExcaliburBeam>(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, perturbedSpeed * 0.5f, ModContent.ProjectileType<ElementalExcaliburBeam>(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 0f, 0f);
}
}
Projectile.Kill();
@@ -223,7 +223,7 @@ namespace CalamityMod.Projectiles.Melee
{
Projectile.localAI[1] = 1f;
if (Main.myPlayer == Projectile.owner)
Projectile.NewProjectile(Projectile.Center + Projectile.velocity, Projectile.velocity, ModContent.ProjectileType<ElementalExcaliburBeam>(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, 10f, 0f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity, ModContent.ProjectileType<ElementalExcaliburBeam>(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner, 10f, 0f);
}
break;
+5 -5
View File
@@ -1,4 +1,4 @@
using CalamityMod.Particles;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
@@ -97,10 +97,10 @@ namespace CalamityMod.Projectiles.Melee
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Texture2D starTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/Sparkle");
Texture2D bloomTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
Texture2D starTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/Sparkle").Value;
Texture2D bloomTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
//Ajust the bloom's texture to be the same size as the star's
float properBloomSize = (float)starTexture.Height / (float)bloomTexture.Height;
@@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Melee
Main.EntitySpriteDraw(starTexture, sparkCenter, null, Color.White, rotation, starTexture.Size() / 2f, 2f, SpriteEffects.None, 0);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
return false;
+3 -3
View File
@@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee
internal Color ColorFunction(float completionRatio)
{
float fadeToEnd = MathHelper.Lerp(0.65f, 1f, (float)Math.Cos(-Main.GlobalTimeWrappedHourly * 3f) * 0.5f + 0.5f);
float fadeOpacity = Utils.InverseLerp(1f, 0.64f, completionRatio, true) * Projectile.Opacity;
float fadeOpacity = Utils.GetLerpValue(1f, 0.64f, completionRatio, true) * Projectile.Opacity;
Color colorHue = Main.hslToRgb(Hue, 1, 0.8f);
Color endColor = Color.Lerp(colorHue, Color.PaleTurquoise, (float)Math.Sin(completionRatio * MathHelper.Pi * 1.6f - Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f);
@@ -105,10 +105,10 @@ namespace CalamityMod.Projectiles.Melee
if (TrailDrawer is null)
TrailDrawer = new PrimitiveTrail(WidthFunction, ColorFunction, specialShader: GameShaders.Misc["CalamityMod:TrailStreak"]);
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/ScarletDevilStreak"));
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request<Texture2D>("CalamityMod/ExtraTextures/ScarletDevilStreak").Value);
TrailDrawer.Draw(Projectile.oldPos, Projectile.Size * 0.5f - Main.screenPosition, 30);
Texture2D texture = GetTexture("CalamityMod/Projectiles/Melee/GalaxiaBolt");
Texture2D texture = GetTexture("CalamityMod/Projectiles/Melee/GalaxiaBolt").Value;
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, Color.Lerp(lightColor, Color.White, 0.5f), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None, 0);
return false;
+1 -1
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.width = 26;
Projectile.height = 26;
Projectile.aiStyle = 27;
aiType = ProjectileID.LightBeam;
AIType = ProjectileID.LightBeam;
Projectile.ignoreWater = true;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
+1 -1
View File
@@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.penetrate = 10;
Projectile.timeLeft = 300;
Projectile.ignoreWater = true;
aiType = ProjectileID.DeathSickle;
AIType = ProjectileID.DeathSickle;
}
public override void AI()
+2 -2
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
@@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee
color = new Color(255, 255, 255, 100);
}
Vector2 origin = new Vector2(39f, 46f);
Main.EntitySpriteDraw(ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/ExcelsusMainGlow"), Projectile.Center - Main.screenPosition, null, color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0);
Main.EntitySpriteDraw(ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/ExcelsusMainGlow").Value, Projectile.Center - Main.screenPosition, null, color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
+2 -2
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
@@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee
color = new Color(255, 255, 255, 100);
}
Vector2 origin = new Vector2(39f, 46f);
Main.EntitySpriteDraw(ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/ExcelsusPinkGlow"), Projectile.Center - Main.screenPosition, null, color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0);
Main.EntitySpriteDraw(ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/ExcelsusPinkGlow").Value, Projectile.Center - Main.screenPosition, null, color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
@@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Melee
{
if (Projectile.owner == Main.myPlayer)
{
int proj = Projectile.NewProjectile(Projectile.Center, Vector2.Zero, ModContent.ProjectileType<FuckYou>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f);
int proj = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<FuckYou>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f);
if (proj.WithinBounds(Main.maxProjectiles))
Main.projectile[proj].Calamity().forceMelee = true;
}
@@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.penetrate = 3;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 10;
aiType = ProjectileID.DemonScythe;
AIType = ProjectileID.DemonScythe;
}
public override void AI()
+4 -4
View File
@@ -1,18 +1,18 @@
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Melee;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Melee
{
public class GaelSkull : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Ark of the Cosmos' Superior Cousin");
DisplayName.SetDefault("No Longer Ark of the Cosmos' Superior Cousin");
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
Main.projFrames[Projectile.type] = 5;
@@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Melee
if (Projectile.scale == 1.75f)
Projectile.damage /= 2;
Projectile.Damage();
SoundEngine.PlaySound((int)SoundType.NPCKilled, (int)Projectile.Center.X, (int)Projectile.Center.Y, 52, 0.4f);
SoundEngine.PlaySound(SoundID.NPCDeath52, Projectile.Center);
for (int i = 0; i < 3; i++)
{
Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 218, 0f, 0f, 100, default, 1.5f);
+2 -2
View File
@@ -1,4 +1,4 @@
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Melee;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Melee
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Ark of the Cosmos' Superior Cousin");
DisplayName.SetDefault("No Longer Ark of the Cosmos' Superior Cousin");
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
Main.projFrames[Projectile.type] = 5;
+4 -4
View File
@@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Melee
public class GalaxiaHoldout : ModProjectile //Visuals. Now much simpler than before!
{
private Player Owner => Main.player[Projectile.owner];
public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.modItem as FourSeasonsGalaxia).CanUseItem(Owner) : false;
public bool OwnerCanUseItem => Owner.HeldItem == associatedItem ? (Owner.HeldItem.ModItem as FourSeasonsGalaxia).CanUseItem(Owner) : false;
public ref float Initialized => ref Projectile.ai[0];
public ref float CycleDirection => ref Projectile.ai[1];
@@ -51,11 +51,11 @@ namespace CalamityMod.Projectiles.Melee
associatedItem = Owner.HeldItem;
//Switch up the attunements
Reattune((FourSeasonsGalaxia)associatedItem.modItem);
Reattune((FourSeasonsGalaxia)associatedItem.ModItem);
//Do particles around the player
Color particleColor = (associatedItem.modItem as FourSeasonsGalaxia).mainAttunement.tooltipColor;
Color particleColor = (associatedItem.ModItem as FourSeasonsGalaxia).mainAttunement.tooltipColor;
for (int i = 0; i <= 5; i++)
{
Vector2 displace = Vector2.UnitX * 20 * Main.rand.NextFloat(-1f, 1f);
@@ -184,7 +184,7 @@ namespace CalamityMod.Projectiles.Melee
}
//Chunger
var Sound = SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThunderStrike"), Projectile.Center);
var Sound = SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/ThunderStrike"), Projectile.Center);
CalamityUtils.SafeVolumeChange(ref Sound, 0.4f);
if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 5)
Main.LocalPlayer.Calamity().GeneralScreenShakePower = 5;
+10 -11
View File
@@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.localNPCHitCooldown = 16;
}
public override bool CanDamage()
public override bool? CanDamage()
{
return (State == 1);
}
@@ -118,7 +118,7 @@ namespace CalamityMod.Projectiles.Melee
//WOahhh do a ring of projectiles!! woahhh
for (int i = 0; i < 5; i++)
{
Projectile blast = Projectile.NewProjectileDirect(Owner.Center, (MathHelper.TwoPi * i / 5f).ToRotationVector2() * 10f, ProjectileType<GalaxiaBolt>(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_BoltsDamageReduction), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f);
Projectile blast = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center, (MathHelper.TwoPi * i / 5f).ToRotationVector2() * 10f, ProjectileType<GalaxiaBolt>(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_BoltsDamageReduction), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f);
{
blast.timeLeft = 30;
}
@@ -152,14 +152,14 @@ namespace CalamityMod.Projectiles.Melee
//Projectiles!!! wah!!!
for (int i = 0; i < 9; i++)
{
Projectile blast = Projectile.NewProjectileDirect(Owner.Center, (MathHelper.TwoPi * i / 9f).ToRotationVector2() * 10f, ProjectileType<GalaxiaBolt>(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_BoltsDamageReduction), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f);
Projectile blast = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center, (MathHelper.TwoPi * i / 9f).ToRotationVector2() * 10f, ProjectileType<GalaxiaBolt>(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_BoltsDamageReduction), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f);
{
blast.timeLeft = 50;
}
}
OverCharge = 20f;
SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/AstralBeaconUse"), Projectile.Center);
SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "Sounds/Custom/AstralBeaconUse"), Projectile.Center);
CurrentIndicator++;
}
}
@@ -219,7 +219,7 @@ namespace CalamityMod.Projectiles.Melee
if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 15)
Main.LocalPlayer.Calamity().GeneralScreenShakePower = 15;
Projectile proj = Projectile.NewProjectileDirect(Owner.Center + (direction * 120 * Projectile.scale), -direction * 16f, ProjectileType<GalaxiaBolt>(), Projectile.damage, 10f, Owner.whoAmI, 0.75f, MathHelper.Pi / 25f);
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center + (direction * 120 * Projectile.scale), -direction * 16f, ProjectileType<GalaxiaBolt>(), Projectile.damage, 10f, Owner.whoAmI, 0.75f, MathHelper.Pi / 25f);
proj.scale = 3f;
proj.timeLeft = 50;
@@ -253,8 +253,8 @@ namespace CalamityMod.Projectiles.Melee
{
Vector2 projPosition = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance;
Vector2 monolithRotation = direction.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize));
Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType<AndromedasStrideBoltSpawner>(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize);
if (proj.modProjectile is AndromedasStrideBoltSpawner spawner)
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), projPosition, -monolithRotation, ProjectileType<AndromedasStrideBoltSpawner>(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize);
if (proj.ModProjectile is AndromedasStrideBoltSpawner spawner)
{
spawner.WaitTimer = (1 - projSize) * 34f;
spawner.OriginDirection = direction;
@@ -277,7 +277,7 @@ namespace CalamityMod.Projectiles.Melee
public override bool PreDraw(ref Color lightColor)
{
Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/GalaxiaExtra");
Texture2D sword = Request<Texture2D>("CalamityMod/Items/Weapons/Melee/GalaxiaExtra").Value;
float drawAngle = direction.ToRotation();
float drawRotation = drawAngle + MathHelper.PiOver4;
@@ -285,7 +285,7 @@ namespace CalamityMod.Projectiles.Melee
Vector2 drawOrigin = new Vector2(0f, sword.Height);
Vector2 drawOffset = Projectile.Center - Main.screenPosition;
CalamityUtils.EnterShaderRegion(spriteBatch);
Main.spriteBatch.EnterShaderRegion();
if (OverCharge < 0)
OverCharge = 0f;
@@ -295,8 +295,7 @@ namespace CalamityMod.Projectiles.Melee
GameShaders.Misc["CalamityMod:BasicTint"].Apply();
Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
CalamityUtils.ExitShaderRegion(spriteBatch);
Main.spriteBatch.ExitShaderRegion();
return false;
}
@@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.hide = true;
}
public override bool CanDamage() => false;
public override bool? CanDamage() => false;
public override void AI()
{
@@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Melee
//New bolt
if (Owner.whoAmI == Main.myPlayer)
{
Projectile proj = Projectile.NewProjectileDirect(Projectile.position, Projectile.rotation.ToRotationVector2() * 18f, ProjectileType<GalaxiaBolt>(), Projectile.damage, 10f, Owner.whoAmI, 0.75f, MathHelper.Pi / 25f);
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Projectile.position, Projectile.rotation.ToRotationVector2() * 18f, ProjectileType<GalaxiaBolt>(), Projectile.damage, 10f, Owner.whoAmI, 0.75f, MathHelper.Pi / 25f);
proj.scale = Size * 3f;
proj.timeLeft = 50;
}
@@ -145,8 +145,8 @@ namespace CalamityMod.Projectiles.Melee
{
Vector2 projPosition = Projectile.Center + OriginDirection.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance;
Vector2 monolithRotation = OriginDirection.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize));
Projectile proj = Projectile.NewProjectileDirect(projPosition, -monolithRotation, ProjectileType<AndromedasStrideBoltSpawner>(), Projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize);
if (proj.modProjectile is AndromedasStrideBoltSpawner spawner)
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), projPosition, -monolithRotation, ProjectileType<AndromedasStrideBoltSpawner>(), Projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize);
if (proj.ModProjectile is AndromedasStrideBoltSpawner spawner)
{
spawner.WaitTimer = (float)Math.Sqrt(1.0 - Math.Pow(projSize - 1.0, 2)) * 3f;
spawner.OriginDirection = OriginDirection;
+5 -5
View File
@@ -1,4 +1,4 @@
using CalamityMod.Particles;
using CalamityMod.Particles;
using CalamityMod.Items.Weapons.Melee;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee
NPC potentialTarget = TargetNext(target.Center, i);
if (potentialTarget == null)
break;
Projectile proj = Projectile.NewProjectileDirect(target.Center, target.SafeDirectionTo(potentialTarget.Center, Vector2.Zero) * 25f, ProjectileType<GalaxiaBolt>(), (int)(damage * FourSeasonsGalaxia.AriesAttunement_OnHitBoltDamageReduction), 0, Owner.whoAmI, 0.9f, MathHelper.PiOver4 * 0.4f);
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), target.Center, target.SafeDirectionTo(potentialTarget.Center, Vector2.Zero) * 25f, ProjectileType<GalaxiaBolt>(), (int)(damage * FourSeasonsGalaxia.AriesAttunement_OnHitBoltDamageReduction), 0, Owner.whoAmI, 0.9f, MathHelper.PiOver4 * 0.4f);
proj.scale = 2f;
}
Array.Clear(excludedTargets, 0, 3);
@@ -214,7 +214,7 @@ namespace CalamityMod.Projectiles.Melee
if ((lastConstellation == null || !lastConstellation.active) && Owner.whoAmI == Main.myPlayer && ChainSwapTimer > 20)
{
lastConstellation = Projectile.NewProjectileDirect(Owner.Center, Vector2.Zero, ProjectileType<AriesWrathConstellation>(), (int)(Projectile.damage * FourSeasonsGalaxia.AriesAttunement_ChainDamageReduction), 0, Owner.whoAmI);
lastConstellation = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center, Vector2.Zero, ProjectileType<AriesWrathConstellation>(), (int)(Projectile.damage * FourSeasonsGalaxia.AriesAttunement_ChainDamageReduction), 0, Owner.whoAmI);
}
ChainSwapTimer++;
@@ -223,13 +223,13 @@ namespace CalamityMod.Projectiles.Melee
public override bool PreDraw(ref Color lightColor)
{
Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/GalaxiaExtra2");
Texture2D sword = Request<Texture2D>("CalamityMod/Items/Weapons/Melee/GalaxiaExtra2").Value;
Vector2 drawPos = Projectile.Center;
Vector2 drawOrigin = sword.Size() / 2f;
float drawRotation = Projectile.rotation + MathHelper.PiOver4;
Main.EntitySpriteDraw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(sword, drawPos - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
return false;
}
@@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Melee
foreach (Particle particle in Particles)
{
particle.CustomDraw(spriteBatch);
particle.CustomDraw(Main.spriteBatch);
}
Main.spriteBatch.ExitShaderRegion();
+8 -8
View File
@@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Melee
for (int i = 0; i <= 5; i++)
{
float angle = direction.ToRotation() + MathHelper.Lerp(-MathHelper.PiOver4, MathHelper.PiOver4, i / 5f);
Projectile.NewProjectile(Owner.Center, angle.ToRotationVector2() * 30f, ProjectileType<GalaxiaBolt>(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltThrowDamageMultiplier), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center, angle.ToRotationVector2() * 30f, ProjectileType<GalaxiaBolt>(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltThrowDamageMultiplier), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f);
}
}
}
@@ -178,7 +178,7 @@ namespace CalamityMod.Projectiles.Melee
if ((Empowerment + OverEmpowerment) % 30 == 29 && Owner.whoAmI == Main.myPlayer)
{
Vector2 shotDirection = Main.rand.NextVector2CircularEdge(15f, 15f);
Projectile.NewProjectile(Owner.Center, shotDirection, ProjectileType<GalaxiaBolt>(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center, shotDirection, ProjectileType<GalaxiaBolt>(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f);
}
}
@@ -209,7 +209,7 @@ namespace CalamityMod.Projectiles.Melee
{
if (Owner.whoAmI == Main.myPlayer)
{
Projectile.NewProjectile(Owner.Center, Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * 15f, ProjectileType<GalaxiaBolt>(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Owner.Center, Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * 15f, ProjectileType<GalaxiaBolt>(), (int)(Projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f);
}
CanDirectFire = false;
AngleReset = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One).ToRotation();
@@ -278,7 +278,7 @@ namespace CalamityMod.Projectiles.Melee
public override bool PreDraw(ref Color lightColor)
{
Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/GalaxiaExtra2");
Texture2D sword = Request<Texture2D>("CalamityMod/Items/Weapons/Melee/GalaxiaExtra2").Value;
float drawAngle = direction.ToRotation();
float drawRotation = drawAngle + MathHelper.PiOver4;
@@ -297,11 +297,11 @@ namespace CalamityMod.Projectiles.Melee
}
}
Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
//Turn on additive blending
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
//Update the parameters
//Don't draw the glowing blade after the retraction
@@ -321,14 +321,14 @@ namespace CalamityMod.Projectiles.Melee
//Back to normal
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
return false;
}
public void drawChain(float snapProgress, float retractProgress)
{
Texture2D chainTex = GetTexture("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMightChain");
Texture2D chainTex = Request<Texture2D>("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMightChain").Value;
float opacity = retractProgress < 0.5 ? 1 : (retractProgress - 0.5f) / 0.5f;
+8 -8
View File
@@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.localNPCHitCooldown = FourSeasonsGalaxia.PolarisAttunement_LocalIFrames;
}
public override bool CanDamage()
public override bool? CanDamage()
{
return Shred >= FourSeasonsGalaxia.PolarisAttunement_LocalIFrames; //Prevent spam click abuse
}
@@ -167,21 +167,21 @@ namespace CalamityMod.Projectiles.Melee
{
Dashing = false;
Owner.velocity *= 0.1f; //Abrupt stop
SoundEngine.PlaySound(Mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/MeatySlash"), Projectile.Center);
SoundEngine.PlaySound(SoundLoader.GetLegacySoundSlot(Mod, "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.GetDamage(DamageClass.Melee)), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.02f);
Projectile blast = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center, Main.rand.NextVector2CircularEdge(15, 15), ProjectileType<GalaxiaBolt>(), (int)(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage * Owner.GetDamage(DamageClass.Melee)), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.02f);
{
blast.timeLeft = 100;
}
}
Projectile proj = Projectile.NewProjectileDirect(Owner.Center - DashStart / 2f, Vector2.Zero, ProjectileType<PolarisGazeDash>(), (int)(Projectile.damage * FourSeasonsGalaxia.PolarisAttunement_SlashDamageBoost), 0, Owner.whoAmI);
if (proj.modProjectile is PolarisGazeDash dash)
Projectile proj = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center - DashStart / 2f, Vector2.Zero, ProjectileType<PolarisGazeDash>(), (int)(Projectile.damage * FourSeasonsGalaxia.PolarisAttunement_SlashDamageBoost), 0, Owner.whoAmI);
if (proj.ModProjectile is PolarisGazeDash dash)
{
dash.DashStart = DashStart;
dash.DashEnd = Owner.Center;
@@ -286,7 +286,7 @@ namespace CalamityMod.Projectiles.Melee
SoundEngine.PlaySound(SoundID.NPCHit43, Projectile.Center);
if (ShredRatio > 0.85 && Owner.whoAmI == Main.myPlayer)
{
Projectile.NewProjectile(Projectile.Center, direction * 36f, ProjectileType<PolarisGazeStar>(), (int)(Projectile.damage * FourSeasonsGalaxia.PolarisAttunement_ShotDamageBoost), Projectile.knockBack, Owner.whoAmI, Shred);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center, direction * 36f, ProjectileType<PolarisGazeStar>(), (int)(Projectile.damage * FourSeasonsGalaxia.PolarisAttunement_ShotDamageBoost), Projectile.knockBack, Owner.whoAmI, Shred);
}
if (Dashing)
{
@@ -298,7 +298,7 @@ namespace CalamityMod.Projectiles.Melee
public override bool PreDraw(ref Color lightColor)
{
Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/GalaxiaExtra");
Texture2D sword = Request<Texture2D>("CalamityMod/Items/Weapons/Melee/GalaxiaExtra").Value;
float drawAngle = direction.ToRotation();
float drawRotation = drawAngle + MathHelper.PiOver4;
@@ -306,7 +306,7 @@ namespace CalamityMod.Projectiles.Melee
Vector2 drawOrigin = new Vector2(0f, sword.Height);
Vector2 drawOffset = Owner.Center + direction * 10f - Main.screenPosition;
Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0f);
Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0);
return false;
}
+6 -6
View File
@@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee
//Explode into cosmic bolts
for (int i = 0; i < 3; i++)
{
Projectile blast = Projectile.NewProjectileDirect(Owner.Center, Owner.SafeDirectionTo(target.Center, Vector2.Zero).RotatedByRandom(MathHelper.PiOver4) * 30f, ProjectileType<GalaxiaBolt>(), (int)(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage * Owner.GetDamage(DamageClass.Melee)), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.01f);
Projectile blast = Projectile.NewProjectileDirect(Projectile.GetProjectileSource_FromThis(), Owner.Center, Owner.SafeDirectionTo(target.Center, Vector2.Zero).RotatedByRandom(MathHelper.PiOver4) * 30f, ProjectileType<GalaxiaBolt>(), (int)(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage * Owner.GetDamage(DamageClass.Melee)), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.01f);
{
blast.timeLeft = 100;
}
@@ -69,9 +69,9 @@ namespace CalamityMod.Projectiles.Melee
{
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Texture2D lineTex = GetTexture("CalamityMod/Particles/ThinEndedLine");
Texture2D lineTex = Request<Texture2D>("CalamityMod/Particles/ThinEndedLine").Value;
Vector2 Shake = Projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - Projectile.timeLeft / 5f) * 0.5f;
float bump = (float)Math.Sin(((20f - Projectile.timeLeft) / 20f) * MathHelper.Pi);
@@ -83,8 +83,8 @@ namespace CalamityMod.Projectiles.Melee
Main.EntitySpriteDraw(lineTex, DashStart - Main.screenPosition + Shake, null, Color.Lerp(Color.White, Color.CornflowerBlue * 0.7f, raise), rot, origin, scale, SpriteEffects.None, 0);
Texture2D sparkTexture = GetTexture("CalamityMod/Particles/ThinSparkle");
Texture2D bloomTexture = GetTexture("CalamityMod/Particles/BloomCircle");
Texture2D sparkTexture = Request<Texture2D>("CalamityMod/Particles/ThinSparkle").Value;
Texture2D bloomTexture = Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
//Ajust the bloom's texture to be the same size as the star's
float properBloomSize = (float)sparkTexture.Width / (float)bloomTexture.Height;
@@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee
//Back to normal
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
return false;
}
}
+5 -5
View File
@@ -109,18 +109,18 @@ namespace CalamityMod.Projectiles.Melee
public override bool PreDraw(ref Color lightColor)
{
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
var tex = GetTexture("CalamityMod/Particles/Sparkle");
var tex = Request<Texture2D>("CalamityMod/Particles/Sparkle").Value;
float opacityFade = Projectile.timeLeft > 15 ? 1 : Projectile.timeLeft / 15f;
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.5f * opacityFade, Main.GlobalTimeWrappedHourly * 10f + MathHelper.PiOver4, tex.Size() / 2f, Projectile.scale * 1.5f, 0f, 0f);
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.5f * opacityFade, Main.GlobalTimeWrappedHourly * 10f + MathHelper.PiOver4, tex.Size() / 2f, Projectile.scale * 1.5f, 0f, 0);
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f * opacityFade, Main.GlobalTimeWrappedHourly * 10f, tex.Size() / 2f, Projectile.scale * 2f, 0f, 0f);
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.8f * opacityFade, Main.GlobalTimeWrappedHourly * 10f, tex.Size() / 2f, Projectile.scale * 2f, 0f, 0);
//Back to normal
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.instance.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
return false;
}
+5 -5
View File
@@ -1,4 +1,4 @@
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Items.Weapons.Melee;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
@@ -44,9 +44,9 @@ namespace CalamityMod.Projectiles.Melee
public override void AI()
{
drawOffsetX = -12;
drawOriginOffsetY = -5;
drawOriginOffsetX = 0;
DrawOffsetX = -12;
DrawOriginOffsetY = -5;
DrawOriginOffsetX = 0;
// Produces violet dust constantly while in flight. This lights the hammer.
int numDust = 2;
@@ -200,7 +200,7 @@ namespace CalamityMod.Projectiles.Melee
if (Projectile.owner == Main.myPlayer)
{
int proj = Projectile.NewProjectile(startPoint, velocity, laserID, laserDamage, laserKB, Projectile.owner);
int proj = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), startPoint, velocity, laserID, laserDamage, laserKB, Projectile.owner);
if (proj.WithinBounds(Main.maxProjectiles))
{
Main.projectile[proj].Calamity().forceMelee = true;
+1 -2
View File
@@ -1,6 +1,5 @@
using System;
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
+2 -6
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@@ -62,11 +62,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.Opacity = (float)System.Math.Sqrt(Projectile.timeLeft / 45f);
}
public override void Kill(int timeLeft)
{
}
// Cannot deal damage for the first several frames of existence.
public override bool CanDamage() => Time >= IntangibleFrames;
public override bool? CanDamage() => Time >= IntangibleFrames;
}
}
+3 -2
View File
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
@@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.DamageType = DamageClass.Melee;
Projectile.penetrate = 3;
Projectile.timeLeft = 600;
aiType = ProjectileID.SporeCloud;
AIType = ProjectileID.SporeCloud;
}
public override void AI()
@@ -55,6 +55,7 @@ namespace CalamityMod.Projectiles.Melee
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
// TODO -- Make this use proper i-frame variables.
target.immune[Projectile.owner] = 8;
OnHitEffects(target.Center, crit);
target.AddBuff(BuffID.Venom, 180);
+1 -1
View File
@@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.penetrate = 5;
Projectile.timeLeft = 300;
Projectile.ignoreWater = true;
aiType = ProjectileID.DeathSickle;
AIType = ProjectileID.DeathSickle;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 4;
Projectile.extraUpdates = 1;
+3 -3
View File
@@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.timeLeft = 180;
}
public override bool CanDamage() => Projectile.ai[0] >= 120f;
public override bool? CanDamage() => Projectile.ai[0] >= 120f;
public override void AI()
{
@@ -104,13 +104,13 @@ namespace CalamityMod.Projectiles.Melee
for (i = 0; i < 2; i++)
{
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
int projectile1 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ProjectileID.FrostShard, (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f);
int projectile1 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ProjectileID.FrostShard, (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f);
if (projectile1.WithinBounds(Main.maxProjectiles))
{
Main.projectile[projectile1].Calamity().forceMelee = true;
Main.projectile[projectile1].penetrate = 2;
}
int projectile2 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ProjectileID.FrostShard, (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f);
int projectile2 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ProjectileID.FrostShard, (int)(Projectile.damage * 0.5), 0f, Projectile.owner, 0f, 0f);
if (projectile2.WithinBounds(Main.maxProjectiles))
{
Main.projectile[projectile2].Calamity().forceMelee = true;
+3 -3
View File
@@ -77,8 +77,8 @@ namespace CalamityMod.Projectiles.Melee
for (i = 0; i < 1; i++)
{
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 0.6f), (float)(Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType<WhiteOrbBlah>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 0.6f), (float)(-Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType<WhiteOrbBlah>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 0.6f), (float)(Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType<WhiteOrbBlah>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 0.6f), (float)(-Math.Cos(offsetAngle) * 0.6f), ModContent.ProjectileType<WhiteOrbBlah>(), Projectile.damage, Projectile.knockBack, Projectile.owner);
}
}
whiteLightTimer = 5;
@@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Melee
}
if (Projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType<WhiteBoltAuraBlah>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType<WhiteBoltAuraBlah>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
}
}
}
+3 -3
View File
@@ -43,8 +43,8 @@ namespace CalamityMod.Projectiles.Melee
for (i = 0; i < 1; i++)
{
offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i;
int projectile1 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<WhiteOrb>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
int projectile2 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<WhiteOrb>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
int projectile1 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<WhiteOrb>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
int projectile2 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType<WhiteOrb>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
Main.projectile[projectile1].velocity.X *= 0.1f;
Main.projectile[projectile1].velocity.Y *= 0.1f;
Main.projectile[projectile2].velocity.X *= 0.1f;
@@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Melee
SoundEngine.PlaySound(SoundID.Item122, Projectile.position);
if (Projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType<WhiteBoltAura>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y - 100, 0f, 0f, ModContent.ProjectileType<WhiteBoltAura>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
}
}
}
+1 -1
View File
@@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee
{
if (Projectile.owner == Main.myPlayer)
{
int projectile1 = Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, SpeedX, SpeedY, ModContent.ProjectileType<NebulaShot>(), (int)(350f * Main.player[Projectile.owner].MeleeDamage()), Projectile.knockBack, Projectile.owner, 0f, 0f);
int projectile1 = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, SpeedX, SpeedY, ModContent.ProjectileType<NebulaShot>(), (int)(350f * Main.player[Projectile.owner].MeleeDamage()), Projectile.knockBack, Projectile.owner, 0f, 0f);
if (projectile1.WithinBounds(Main.maxProjectiles))
{
Main.projectile[projectile1].Calamity().forceMelee = true;
+1 -1
View File
@@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.timeLeft = 240;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
aiType = ProjectileID.DeathSickle;
AIType = ProjectileID.DeathSickle;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 4;
}
+2 -2
View File
@@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.width = 56;
Projectile.height = 56;
Projectile.aiStyle = 18;
aiType = ProjectileID.DeathSickle;
AIType = ProjectileID.DeathSickle;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.penetrate = 1;
@@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee
{
for (int k = 0; k < 3; k++)
{
Projectile.NewProjectile(Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType<TinyCrystal>(),
Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Main.rand.Next(-35, 36) * 0.2f, Main.rand.Next(-35, 36) * 0.2f, ModContent.ProjectileType<TinyCrystal>(),
(int)(Projectile.damage * 0.5), Projectile.knockBack * 0.15f, Main.myPlayer, 1f, 0f);
}
}
+1 -1
View File
@@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee
int damage = (int)(GaelsGreatsword.BaseDamage * Main.player[Projectile.owner].MeleeDamage());
for (int i = 0; i < 3; i++)
{
int idx = Projectile.NewProjectile(Projectile.Center + new Vector2(Main.rand.NextFloat(-35f, 35f), -1600f), Vector2.UnitY * 12f,
int idx = Projectile.NewProjectile(Projectile.GetProjectileSource_FromThis(), Projectile.Center + new Vector2(Main.rand.NextFloat(-35f, 35f), -1600f), Vector2.UnitY * 12f,
ProjectileID.CultistBossLightningOrbArc, damage, 0f, Projectile.owner,
MathHelper.PiOver2, Main.rand.Next(100));
if (idx.WithinBounds(Main.maxProjectiles))
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
@@ -38,7 +38,6 @@ namespace CalamityMod.Projectiles.Melee
{
for (int num41 = 0; num41 < 2; num41++)
{
Vector2 value8 = Vector2.UnitX * -15f;
value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7;
int num42 = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f);
Main.dust[num42].scale = 1f;
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
@@ -38,7 +38,6 @@ namespace CalamityMod.Projectiles.Melee
{
for (int num41 = 0; num41 < 2; num41++)
{
Vector2 value8 = Vector2.UnitX * -15f;
value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7;
int num42 = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f);
Main.dust[num42].scale = 1f;
@@ -1,4 +1,4 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
@@ -38,7 +38,6 @@ namespace CalamityMod.Projectiles.Melee
{
for (int num41 = 0; num41 < 2; num41++)
{
Vector2 value8 = Vector2.UnitX * -15f;
value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7;
int num42 = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f);
Main.dust[num42].scale = 1f;
@@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Melee
{
Main.spriteBatch.EnterShaderRegion(BlendState.Additive);
var tex = GetTexture("CalamityMod/Particles/MediumMist");
var tex = Request<Texture2D>("CalamityMod/Particles/MediumMist").Value;
Rectangle frame = tex.Frame(1, 3, 0, variant);
Main.EntitySpriteDraw(tex, Projectile.position - Main.screenPosition, frame, mistColor * 0.5f * ((255f - Projectile.alpha) / 255f), Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0);
Loaded 100 of 215 files, more files were not shown because too many files have changed in this diff. Show more