Merge branch 'master' of https://github.com/CalamityTeam/CalamityMod
This commit is contained in:
commit
15bfbe8a42
45 files changed
+210
-163
No files matched your search
@@ -114,7 +114,7 @@ namespace CalamityMod.CalPlayer
|
||||
Texture2D texture = ModContent.GetTexture("CalamityMod/ExtraTextures/IceShield");
|
||||
int drawX = (int)(drawInfo.position.X + drawPlayer.width / 2f - Main.screenPosition.X);
|
||||
int drawY = (int)(drawInfo.position.Y + drawPlayer.height / 2f - Main.screenPosition.Y);
|
||||
DrawData data = new DrawData(texture, new Vector2(drawX, drawY), null, Color.Cyan, 0f, texture.Size() * 0.5f, 1f, SpriteEffects.None, 0);
|
||||
DrawData data = new DrawData(texture, new Vector2(drawX, drawY), null, Color.White, 0f, texture.Size() * 0.5f, 1f, SpriteEffects.None, 0);
|
||||
Main.playerDrawData.Add(data);
|
||||
}
|
||||
if (modPlayer.amidiasBlessing)
|
||||
|
||||
@@ -541,7 +541,7 @@ namespace CalamityMod.DataStructures
|
||||
if (UseTimer % 30 == 29 && Main.rand.Next(2) == 0)
|
||||
{
|
||||
Main.PlaySound(SoundID.Item78);
|
||||
Projectile beamSword = Projectile.NewProjectileDirect(player.Center, player.DirectionTo(Main.MouseWorld) * 15f, ProjectileType<SwordsmithsPrideBeam>(), (int)(OmegaBiomeBlade.WhirlwindAttunement_PassiveBaseDamage * player.MeleeDamage()), 10f, player.whoAmI, 1f);
|
||||
Projectile beamSword = Projectile.NewProjectileDirect(player.Center, player.SafeDirectionTo(Main.MouseWorld, Vector2.One) * 15f, ProjectileType<SwordsmithsPrideBeam>(), (int)(OmegaBiomeBlade.WhirlwindAttunement_PassiveBaseDamage * player.MeleeDamage()), 10f, player.whoAmI, 1f);
|
||||
beamSword.timeLeft = 50;
|
||||
UseTimer++;
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ namespace CalamityMod.Items.VanillaArmorChanges
|
||||
|
||||
public override string ArmorSetName => "Cobalt";
|
||||
|
||||
public const int SpeedBoostSetBonusPercentage = 15;
|
||||
public const int SpeedBoostSetBonusPercentage = 10;
|
||||
public const int MaxManaBoost = 20;
|
||||
public const int MovementSpeedBoostPercentageMax = 15;
|
||||
public const int MovementSpeedBoostPercentageMax = 10;
|
||||
public const int MovementSpeedBoostMphThreshold = 60;
|
||||
|
||||
public override void ApplyHeadPieceEffect(Player player)
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.damage = 19;
|
||||
item.damage = 38;
|
||||
item.magic = true;
|
||||
item.mana = 15;
|
||||
item.width = 28;
|
||||
@@ -25,8 +25,8 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
item.useStyle = ItemUseStyleID.HoldingOut;
|
||||
item.noMelee = true;
|
||||
item.knockBack = 3f;
|
||||
item.value = CalamityGlobalItem.Rarity3BuyPrice;
|
||||
item.rare = ItemRarityID.Orange;
|
||||
item.value = CalamityGlobalItem.Rarity4BuyPrice;
|
||||
item.rare = ItemRarityID.LightRed;
|
||||
item.UseSound = SoundID.Item8;
|
||||
item.autoReuse = true;
|
||||
item.shoot = ProjectileID.ClothiersCurse;
|
||||
|
||||
@@ -23,15 +23,21 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public override bool CloneNewInstances => true;
|
||||
|
||||
public static float NeedleDamageMultiplier = 0.5f;
|
||||
public static float MaxThrowReach = 620;
|
||||
public static float snapDamageMultiplier = 1.3f; //Extra damage from making the scissors snap
|
||||
|
||||
public static float chargeDamageMultiplier = 1.6f; //Extra damage from charge
|
||||
public static float chainDamageMultiplier = 0.1f;
|
||||
|
||||
public static int DashIframes = 18;
|
||||
public static int DashIframes = 10;
|
||||
public static float SlashBoltsDamageMultiplier = 0.2f;
|
||||
public static float SnapBoltsDamageMultiplier = 0.1f;
|
||||
|
||||
public static float SwirlBoltAmount = 7f;
|
||||
public static float blastDamageMultiplier = 0.5f; //Damage multiplier applied ontop of the charge damage multiplier mutliplied by the amount of charges consumed. So if you consume 5 charges, the blast will get multiplied by 5 times the damage multiplier
|
||||
public static float blastFalloffSpeed = 0.1f; //How much the blast damage falls off as you hit more and more targets
|
||||
public static float blastFalloffStrenght = 0.75f; //Value between 0 and 1 that determines how much falloff increases affect the damage : Closer to 0 = damage falls off less intensely, closer to 1 : damage falls off way harder
|
||||
|
||||
public static float SwirlBoltAmount = 7f; //The amount of cosmic bolts produced during hte swirl attack
|
||||
public static float SwirlBoltDamageMultiplier = 0.8f; //This is the damage multiplier for ALL THE BOLTS: Aka, said damage multiplier is divided by the amount of bolts in a swirl and the full damage multiplier is gotten if you hit all the bolts
|
||||
|
||||
const string ComboTooltip = "Performs a combo of swings, alternating between narrow and wide swings and throwing the blade out every 5 swings\n" +
|
||||
@@ -73,7 +79,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public override void SetDefaults()
|
||||
{
|
||||
item.width = item.height = 136;
|
||||
item.damage = 1705;
|
||||
item.damage = 2022;
|
||||
item.melee = true;
|
||||
item.noMelee = true;
|
||||
item.noUseGraphic = true;
|
||||
@@ -118,7 +124,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
if (Charge > 0 && player.controlUp)
|
||||
{
|
||||
float angle = new Vector2(speedX, speedY).ToRotation();
|
||||
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, new Vector2(speedX, speedY), ProjectileType<ArkoftheCosmosBlast>(), (int)(damage * Charge * 1.8f), 0, player.whoAmI, Charge);
|
||||
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, new Vector2(speedX, speedY), ProjectileType<ArkoftheCosmosBlast>(), (int)(damage * Charge * chargeDamageMultiplier * blastDamageMultiplier), 0, player.whoAmI, Charge);
|
||||
|
||||
if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3)
|
||||
Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3;
|
||||
@@ -144,7 +150,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
if (scissorState != 2)
|
||||
{
|
||||
Vector2 throwVector = new Vector2(speedX, speedY);
|
||||
Projectile.NewProjectile(player.Center + Vector2.Normalize(throwVector) * 20, new Vector2(speedX, speedY) * 1.4f, ProjectileType<RendingNeedle>(), (int)(damage * NeedleDamageMultiplier), knockBack, player.whoAmI);
|
||||
Projectile.NewProjectile(player.Center + Utils.SafeNormalize(throwVector, Vector2.Zero) * 20, new Vector2(speedX, speedY) * 1.4f, ProjectileType<RendingNeedle>(), (int)(damage * NeedleDamageMultiplier), knockBack, player.whoAmI);
|
||||
}
|
||||
|
||||
Combo += 1;
|
||||
|
||||
@@ -25,6 +25,11 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public static float snapDamageMultiplier = 1.3f; //Extra damage from making the scissors snap
|
||||
public static float chargeDamageMultiplier = 1.6f; //Extra damage from charge
|
||||
|
||||
public static float blastDamageMultiplier = 0.5f; //Damage multiplier applied ontop of the charge damage multiplier mutliplied by the amount of charges consumed. So if you consume 5 charges, the blast will get multiplied by 5 times the damage multiplier
|
||||
public static float blastFalloffSpeed = 0.1f; //How much the blast damage falls off as you hit more and more targets
|
||||
public static float blastFalloffStrenght = 0.75f; //Value between 0 and 1 that determines how much falloff increases affect the damage : Closer to 0 = damage falls off less intensely, closer to 1 : damage falls off way harder
|
||||
|
||||
|
||||
const string ComboTooltip = "Performs a combo of swings, throwing the blade out every 5 swings. Releasing the mouse while the blade is out will throw the second half towards it, making the scissors snap\n" +
|
||||
"Snapping the scissors together increase their damage and empower your next two swings";
|
||||
|
||||
@@ -107,7 +112,7 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
if (Charge > 0 && player.controlUp)
|
||||
{
|
||||
float angle = new Vector2(speedX, speedY).ToRotation();
|
||||
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, new Vector2(speedX, speedY), ProjectileType<ArkoftheElementsSnapBlast>(), (int)(damage * Charge * 1.8f), 0, player.whoAmI);
|
||||
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, new Vector2(speedX, speedY), ProjectileType<ArkoftheElementsSnapBlast>(), (int)(damage * Charge * chargeDamageMultiplier * blastDamageMultiplier), 0, player.whoAmI);
|
||||
|
||||
if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3)
|
||||
Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3;
|
||||
@@ -139,10 +144,10 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
Vector2 throwVector = new Vector2(speedX, speedY);
|
||||
float empoweredNeedles = Charge > 0 ? 1f : 0f;
|
||||
Projectile.NewProjectile(player.Center + Vector2.Normalize(throwVector) * 20, new Vector2(speedX, speedY) * 2.8f, ProjectileType<SolarNeedle>(), (int)(damage * 0.5f), knockBack, player.whoAmI, empoweredNeedles);
|
||||
Projectile.NewProjectile(player.Center + Utils.SafeNormalize(throwVector, Vector2.Zero) * 20, new Vector2(speedX, speedY) * 2.8f, ProjectileType<SolarNeedle>(), (int)(damage * 0.5f), knockBack, player.whoAmI, empoweredNeedles);
|
||||
|
||||
|
||||
Vector2 Shift = Vector2.Normalize(new Vector2(speedX, speedY).RotatedBy(MathHelper.PiOver2)) * 20;
|
||||
Vector2 Shift = Utils.SafeNormalize(new Vector2(speedX, speedY).RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 20;
|
||||
|
||||
Projectile.NewProjectile(player.Center + Shift, throwVector.RotatedBy(MathHelper.PiOver4 * 0.3f), ProjectileType<ElementalGlassStar>(), (int)(damage * 0.2f), knockBack, player.whoAmI);
|
||||
Projectile.NewProjectile(player.Center + Shift * 1.2f, throwVector.RotatedBy(MathHelper.PiOver4 * 0.4f) * 0.8f, ProjectileType<ElementalGlassStar>(), (int)(damage * 0.2f), knockBack, player.whoAmI);
|
||||
@@ -201,13 +206,17 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
|
||||
public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
|
||||
{
|
||||
float extraScale = 0.3f;
|
||||
Texture2D frontTexture = GetTexture("CalamityMod/Items/Weapons/Melee/ArkoftheElements");
|
||||
Texture2D backTexture = GetTexture("CalamityMod/Items/Weapons/Melee/ArkoftheElementsBack");
|
||||
|
||||
float tweakedScale = scale * (1 + extraScale); //Make the scale bigger to avoid crunching of the item
|
||||
Vector2 offset = (frontTexture.Size() * extraScale / 2f) * scale;
|
||||
|
||||
float backLayerOpacity = (Charge > 0) ? 1f : (float)Math.Sin(Main.GlobalTime * 0.9f) * 0.2f + 0.3f;
|
||||
|
||||
spriteBatch.Draw(backTexture, position, null, drawColor * backLayerOpacity, 0f, origin, scale, SpriteEffects.None, 0f); //Make the back scissor slightly transparent if the ark isnt charged
|
||||
spriteBatch.Draw(frontTexture, position, null, drawColor, 0f, origin, scale, SpriteEffects.None, 0f);
|
||||
spriteBatch.Draw(backTexture, position - offset, null, drawColor * backLayerOpacity, 0f, origin, tweakedScale, SpriteEffects.None, 0f); //Make the back scissor slightly transparent if the ark isnt charged
|
||||
spriteBatch.Draw(frontTexture, position - offset, null, drawColor, 0f, origin, tweakedScale, SpriteEffects.None, 0f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,11 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
public static float beamDamageMultiplier = 0.8f; //Damage multiplier for the charged shots (remember it applies ontop of the charge damage multiplied
|
||||
public static float glassStarDamageMultiplier = 0.2f; //Damage multiplier for the charged shots (remember it applies ontop of the charge damage multiplied
|
||||
|
||||
public static float blastDamageMultiplier = 0.5f; //Damage multiplier applied ontop of the charge damage multiplier mutliplied by the amount of charges consumed. So if you consume 5 charges, the blast will get multiplied by 5 times the damage multiplier
|
||||
public static float blastFalloffSpeed = 0.1f; //How much the blast damage falls off as you hit more and more targets
|
||||
public static float blastFalloffStrenght = 0.75f; //Value between 0 and 1 that determines how much falloff increases affect the damage : Closer to 0 = damage falls off less intensely, closer to 1 : damage falls off way harder
|
||||
|
||||
|
||||
public override bool CloneNewInstances => true;
|
||||
|
||||
const string ParryTooltip = "Using RMB will extend the Ark out in front of you. Hitting an enemy with it will parry them, granting you a small window of invulnerability\n" +
|
||||
@@ -80,8 +85,9 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
if (Charge > 0 && player.controlUp)
|
||||
{
|
||||
float angle = new Vector2(speedX, speedY).ToRotation();
|
||||
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, Vector2.Zero, ProjectileType<TrueAncientBlast>(), (int)(damage * Charge * chargeDamageMultiplier * 0.8f), 0, player.whoAmI, angle, 600);
|
||||
float angle = player.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY).ToRotation();
|
||||
Vector2 laserVector = player.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * 600;
|
||||
Projectile.NewProjectile(player.Center + angle.ToRotationVector2() * 90f, laserVector, ProjectileType<TrueAncientBlast>(), (int)(damage * Charge * chargeDamageMultiplier * blastDamageMultiplier), 0, player.whoAmI);
|
||||
|
||||
if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3)
|
||||
Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3;
|
||||
@@ -109,9 +115,9 @@ namespace CalamityMod.Items.Weapons.Melee
|
||||
{
|
||||
//Only shoot the center star if theres no charge
|
||||
if (Charge == 0)
|
||||
Projectile.NewProjectile(player.Center + Vector2.Normalize(new Vector2(speedX, speedY)) * 20, new Vector2(speedX, speedY), ProjectileType<AncientStar>(), (int)(damage * glassStarDamageMultiplier), knockBack, player.whoAmI);
|
||||
Projectile.NewProjectile(player.Center + Utils.SafeNormalize(new Vector2(speedX, speedY), Vector2.Zero) * 20, new Vector2(speedX, speedY), ProjectileType<AncientStar>(), (int)(damage * glassStarDamageMultiplier), knockBack, player.whoAmI);
|
||||
|
||||
Vector2 Shift = Vector2.Normalize(new Vector2(speedX, speedY).RotatedBy(MathHelper.PiOver2)) * 30;
|
||||
Vector2 Shift = Utils.SafeNormalize(new Vector2(speedX, speedY).RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 30;
|
||||
|
||||
Projectile.NewProjectile(player.Center + Shift, new Vector2(speedX, speedY).RotatedBy(MathHelper.PiOver4 * 0.3f) , ProjectileType<AncientStar>(), (int)(damage * glassStarDamageMultiplier), knockBack, player.whoAmI, Charge > 0 ? 1 : 0);
|
||||
Projectile.NewProjectile(player.Center - Shift, new Vector2(speedX, speedY).RotatedBy(-MathHelper.PiOver4 * 0.3f), ProjectileType<AncientStar>(), (int)(damage * glassStarDamageMultiplier), knockBack, player.whoAmI, Charge > 0 ? 1 : 0);
|
||||
|
||||
@@ -7,10 +7,10 @@ namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public ref float Time => ref projectile.ai[0];
|
||||
public bool HasFiredSideBeams
|
||||
{
|
||||
{
|
||||
get => projectile.ai[1] == 1f;
|
||||
set => projectile.ai[1] = value.ToInt();
|
||||
}
|
||||
}
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -23,30 +23,14 @@ namespace CalamityMod.Projectiles.Magic
|
||||
projectile.height = 4;
|
||||
projectile.friendly = true;
|
||||
projectile.magic = true;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = 10;
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = 10;
|
||||
projectile.extraUpdates = 100;
|
||||
projectile.timeLeft = 150;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (!HasFiredSideBeams && projectile.owner == Main.myPlayer)
|
||||
{
|
||||
NPC potentialTarget = projectile.Center.ClosestNPCAt(5480f, false);
|
||||
if (potentialTarget != null)
|
||||
{
|
||||
Vector2 baseSpawnPositionOffset = Main.rand.NextVector2CircularEdge(40f, 40f);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Vector2 spawnPosition = potentialTarget.Center + baseSpawnPositionOffset.RotatedBy(MathHelper.TwoPi * i / 4f);
|
||||
Projectile.NewProjectile(spawnPosition, Vector2.Zero, ModContent.ProjectileType<NightOrb>(), (int)(projectile.damage * 0.8), projectile.knockBack, projectile.owner);
|
||||
}
|
||||
HasFiredSideBeams = true;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
Time++;
|
||||
if (Time >= 10f)
|
||||
{
|
||||
@@ -57,8 +41,23 @@ namespace CalamityMod.Projectiles.Magic
|
||||
corruptMagic.color = Color.Lerp(Color.Fuchsia, Color.Magenta, Main.rand.NextFloat(0.6f));
|
||||
corruptMagic.scale = Main.rand.NextFloat(0.96f, 1.04f);
|
||||
corruptMagic.noGravity = true;
|
||||
corruptMagic.velocity *= 0.1f;
|
||||
}
|
||||
corruptMagic.velocity *= 0.1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
if (!HasFiredSideBeams && projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Vector2 baseSpawnPositionOffset = Main.rand.NextVector2CircularEdge(40f, 40f);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Vector2 spawnPosition = target.Center + baseSpawnPositionOffset.RotatedBy(MathHelper.TwoPi * i / 4f);
|
||||
Projectile.NewProjectile(spawnPosition, Vector2.Zero, ModContent.ProjectileType<NightOrb>(), (int)(projectile.damage * 0.8), projectile.knockBack, projectile.owner);
|
||||
}
|
||||
HasFiredSideBeams = true;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/ArkoftheAncients";
|
||||
|
||||
private bool initialized = false;
|
||||
const float MaxTime = 160;
|
||||
const float MaxTime = 340;
|
||||
static float ParryTime = 15;
|
||||
public Vector2 DistanceFromPlayer => projectile.velocity * 10 * (1f + ((float)Math.Sin(Timer / ParryTime * MathHelper.Pi) * 0.8f));
|
||||
public float Timer => MaxTime - projectile.timeLeft;
|
||||
@@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
projectile.timeLeft = (int)MaxTime;
|
||||
Main.PlaySound(SoundID.DD2_SkyDragonsFuryShot, projectile.Center);
|
||||
|
||||
projectile.velocity = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
projectile.velocity.Normalize();
|
||||
projectile.rotation = projectile.velocity.ToRotation();
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
//Manage position and rotation
|
||||
projectile.Center = Owner.Center + DistanceFromPlayer ;
|
||||
projectile.scale = 1.4f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.6f); //SWAGGER
|
||||
projectile.scale = 1.4f + ((float)Math.Sin(Timer / 160f * MathHelper.Pi) * 0.6f); //SWAGGER
|
||||
|
||||
if (Timer > ParryTime)
|
||||
return;
|
||||
@@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
//Bounce off the player if they are in the air
|
||||
if (Owner.velocity.Y != 0)
|
||||
Owner.velocity += Vector2.Normalize(Owner.Center - proj.Center) * 2;
|
||||
Owner.velocity += Utils.SafeNormalize(Owner.Center - proj.Center, Vector2.Zero) * 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,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 * 1f, ProjectileType<AncientBeam>(), (int)(projectile.damage * ArkoftheAncients.beamDamageMultiplier), 2f, Owner.whoAmI) ;
|
||||
Projectile.NewProjectile(Owner.Center + direction * 30f, projectile.velocity * 1.25f, ProjectileType<AncientBeam>(), (int)(projectile.damage * ArkoftheAncients.beamDamageMultiplier), 2f, Owner.whoAmI) ;
|
||||
HasFired = 1f;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
public class ArkoftheCosmosBlast : ModProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/Melee/RendingScissorsRight";
|
||||
public override string Texture => "CalamityMod/Projectiles/Melee/RendingScissorsRight"; //Umm actually the rending scissors are for aote mr programmer what the hel.. it gets changed in predraw anywyas
|
||||
|
||||
private bool initialized = false;
|
||||
public ref float Charge => ref projectile.ai[0];
|
||||
@@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
projectile.ai[1] = value ? 1f : 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const int maxStitches = 8;
|
||||
public int CurrentStitches => (int)Math.Ceiling((1 - (float)Math.Sqrt(1f - (float)Math.Pow(MathHelper.Clamp(StitchProgress * 3f, 0f, 1f), 2f))) * maxStitches);
|
||||
@@ -60,6 +60,8 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public Vector2 scissorPosition => projectile.Center + ThrustDisplaceRatio() * projectile.velocity * 200f;
|
||||
|
||||
public ref float HitCounter => ref projectile.localAI[0];
|
||||
|
||||
public Player Owner => Main.player[projectile.owner];
|
||||
|
||||
public Particle PolarStar;
|
||||
@@ -119,36 +121,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
//Manage position and rotation
|
||||
projectile.scale = 1.4f;
|
||||
|
||||
if (PolarStar == null)
|
||||
{
|
||||
PolarStar = new GenericSparkle(projectile.Center, Vector2.Zero, Color.White, Color.CornflowerBlue, projectile.scale * 2f, 2, 0.1f, 5f, true);
|
||||
GeneralParticleHandler.SpawnParticle(PolarStar);
|
||||
}
|
||||
else if (HoldProgress <= 0.4f)
|
||||
{
|
||||
PolarStar.Time = 0;
|
||||
PolarStar.Position = scissorPosition;
|
||||
PolarStar.Scale = projectile.scale * 2f;
|
||||
}
|
||||
|
||||
//Update stitches
|
||||
for (int i = 0; i < CurrentStitches; i++)
|
||||
{
|
||||
if (StitchRotations[i] == 0)
|
||||
{
|
||||
StitchRotations[i] = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4) + MathHelper.PiOver2;
|
||||
var sewSound = Main.PlaySound(i % 3 == 0 ? SoundID.Item63 : i % 3 == 1 ? SoundID.Item64 : SoundID.Item65, Owner.Center);
|
||||
SafeVolumeChange(ref sewSound, 0.5f);
|
||||
|
||||
float positionAlongLine = (ThrustDisplaceRatio() * 242f / (float)maxStitches * 0.5f) + MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, i / (float)maxStitches);
|
||||
Vector2 stitchCenter = projectile.Center + projectile.velocity * positionAlongLine;
|
||||
|
||||
|
||||
Particle spark = new CritSpark(stitchCenter, Vector2.Zero, Color.White, Color.Cyan, 3f, 8, 0.1f, 3);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
StitchLifetimes[i]++;
|
||||
}
|
||||
HandleParticles();
|
||||
|
||||
//Spawn particles when the line appears
|
||||
if (HoldTimer == 1)
|
||||
@@ -196,7 +169,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
Owner.Calamity().LungingDown = true;
|
||||
Owner.fallStart = (int)(Owner.position.Y / 16f);
|
||||
Owner.velocity = Owner.DirectionTo(scissorPosition) * 60f;
|
||||
Owner.velocity = Owner.SafeDirectionTo(scissorPosition, Vector2.Zero) * 60f;
|
||||
|
||||
if (Owner.Distance(scissorPosition) < 60f)
|
||||
{
|
||||
@@ -218,6 +191,40 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleParticles()
|
||||
{
|
||||
if (PolarStar == null)
|
||||
{
|
||||
PolarStar = new GenericSparkle(projectile.Center, Vector2.Zero, Color.White, Color.CornflowerBlue, projectile.scale * 2f, 2, 0.1f, 5f, true);
|
||||
GeneralParticleHandler.SpawnParticle(PolarStar);
|
||||
}
|
||||
else if (HoldProgress <= 0.4f)
|
||||
{
|
||||
PolarStar.Time = 0;
|
||||
PolarStar.Position = scissorPosition;
|
||||
PolarStar.Scale = projectile.scale * 2f;
|
||||
}
|
||||
|
||||
//Update stitches
|
||||
for (int i = 0; i < CurrentStitches; i++)
|
||||
{
|
||||
if (StitchRotations[i] == 0)
|
||||
{
|
||||
StitchRotations[i] = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4) + MathHelper.PiOver2;
|
||||
var sewSound = Main.PlaySound(i % 3 == 0 ? SoundID.Item63 : i % 3 == 1 ? SoundID.Item64 : SoundID.Item65, Owner.Center);
|
||||
SafeVolumeChange(ref sewSound, 0.5f);
|
||||
|
||||
float positionAlongLine = (ThrustDisplaceRatio() * 242f / (float)maxStitches * 0.5f) + MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, i / (float)maxStitches);
|
||||
Vector2 stitchCenter = projectile.Center + projectile.velocity * positionAlongLine;
|
||||
|
||||
|
||||
Particle spark = new CritSpark(stitchCenter, Vector2.Zero, Color.White, Color.Cyan, 3f, 8, 0.1f, 3);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
StitchLifetimes[i]++;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
Color pulseColor = Main.rand.NextBool() ? (Main.rand.NextBool() ? Color.Orange : Color.Coral) : (Main.rand.NextBool() ? Color.OrangeRed : Color.Gold);
|
||||
@@ -232,6 +239,13 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
|
||||
{
|
||||
//Add some damage falloff
|
||||
damage = (int)(damage * Math.Pow((1 - ArkoftheCosmos.blastFalloffStrenght), HitCounter * ArkoftheCosmos.blastFalloffSpeed));
|
||||
HitCounter++;
|
||||
}
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
if (Dashing)
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
public override string Texture => "CalamityMod/Projectiles/Melee/RendingScissorsRight";
|
||||
|
||||
private bool initialized = false;
|
||||
const float MaxTime = 160;
|
||||
const float MaxTime = 340;
|
||||
static float ParryTime = 15;
|
||||
public Vector2 DistanceFromPlayer => projectile.velocity * 10 + projectile.velocity * 10 * ThrustDisplaceRatio();
|
||||
public float Timer => MaxTime - projectile.timeLeft;
|
||||
@@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
var sound = Main.PlaySound(SoundID.Item84, projectile.Center);
|
||||
CalamityUtils.SafeVolumeChange(ref sound, 0.3f);
|
||||
|
||||
projectile.velocity = Owner.DirectionTo(Main.MouseWorld);
|
||||
projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
projectile.velocity.Normalize();
|
||||
projectile.rotation = projectile.velocity.ToRotation();
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
GeneralParryEffects();
|
||||
if (Owner.velocity.Y != 0)
|
||||
Owner.velocity += Vector2.Normalize(Owner.Center - proj.Center) * 2;
|
||||
Owner.velocity += Utils.SafeNormalize(Owner.Center - proj.Center, Vector2.Zero) * 2;
|
||||
}
|
||||
|
||||
//Reduce the projectile's damage by 300 for a second.
|
||||
|
||||
@@ -65,7 +65,6 @@ namespace CalamityMod.Projectiles.Melee
|
||||
private bool OwnerCanShoot => Owner.channel && !Owner.noItems && !Owner.CCed && Owner.HeldItem.type == ItemType<ArkoftheCosmos>();
|
||||
public bool Thrown => Combo == 2 || Combo == 3;
|
||||
public const float MaxThrowTime = 140;
|
||||
public const float ThrowReachMax = 500;
|
||||
public float ThrowReach;
|
||||
public float ThrowTimer => MaxThrowTime - projectile.timeLeft;
|
||||
public float ThrowCompletion => ThrowTimer / MaxThrowTime;
|
||||
@@ -218,8 +217,8 @@ namespace CalamityMod.Projectiles.Melee
|
||||
projectile.Center = Vector2.Lerp(projectile.Center, Owner.Calamity().mouseWorld, 0.025f * ThrowRatio());
|
||||
projectile.Center = projectile.Center.MoveTowards(Owner.Calamity().mouseWorld, 20f * ThrowRatio());
|
||||
|
||||
if ((projectile.Center - Owner.Center).Length() > ThrowReachMax)
|
||||
projectile.Center = Owner.Center + Owner.DirectionTo(projectile.Center) * ThrowReachMax;
|
||||
if ((projectile.Center - Owner.Center).Length() > ArkoftheCosmos.MaxThrowReach)
|
||||
projectile.Center = Owner.Center + Owner.DirectionTo(projectile.Center) * ArkoftheCosmos.MaxThrowReach;
|
||||
|
||||
projectile.rotation -= MathHelper.PiOver4 * 0.3f;
|
||||
projectile.scale = 1f + ThrowScaleRatio() * 0.5f;
|
||||
@@ -328,7 +327,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
float maxDistance = projectile.scale * 78f;
|
||||
Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance);
|
||||
Vector2 angularVelocity = Vector2.Normalize(distance.RotatedBy(MathHelper.PiOver2 * Owner.direction)) * 2 * (1f + distance.Length() / 15f);
|
||||
Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(MathHelper.PiOver2 * Owner.direction), Vector2.Zero) * 2 * (1f + distance.Length() / 15f);
|
||||
Particle glitter = new CritSpark(Owner.Center + distance, Owner.velocity + angularVelocity, Main.rand.Next(3) == 0 ? Color.Turquoise : Color.Coral, currentColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(glitter);
|
||||
}
|
||||
@@ -387,7 +386,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
float maxDistance = projectile.scale * 78f;
|
||||
Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance);
|
||||
Vector2 angularVelocity = Vector2.Normalize(distance.RotatedBy(-MathHelper.PiOver2)) * 2 * (1f + distance.Length() / 15f);
|
||||
Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(-MathHelper.PiOver2), Vector2.Zero) * 2 * (1f + distance.Length() / 15f);
|
||||
Color glitterColor = Main.hslToRgb(Main.rand.NextFloat(), 1, 0.5f);
|
||||
Particle glitter = new CritSpark(projectile.Center + distance, Owner.velocity + angularVelocity, Color.White , glitterColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(glitter);
|
||||
@@ -456,7 +455,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
Main.PlaySound(SoundID.Item84, projectile.Center);
|
||||
|
||||
Vector2 sliceDirection = Vector2.Normalize(direction) * 40;
|
||||
Vector2 sliceDirection = Utils.SafeNormalize(direction, Vector2.One) * 40;
|
||||
Particle SliceLine = new LineVFX(projectile.Center - sliceDirection, sliceDirection * 2f, 0.2f, Color.Orange * 0.7f, expansion : 250f)
|
||||
{
|
||||
Lifetime = 10
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
public override string Texture => "CalamityMod/Projectiles/Melee/RendingScissorsRight";
|
||||
|
||||
private bool initialized = false;
|
||||
const float MaxTime = 160;
|
||||
const float MaxTime = 340;
|
||||
static float ParryTime = 15;
|
||||
public Vector2 DistanceFromPlayer => projectile.velocity * 10 + projectile.velocity * 10 * ThrustDisplaceRatio();
|
||||
public float Timer => MaxTime - projectile.timeLeft;
|
||||
@@ -113,7 +113,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
var sound = Main.PlaySound(SoundID.Item84, projectile.Center);
|
||||
CalamityUtils.SafeVolumeChange(ref sound, 0.3f);
|
||||
|
||||
projectile.velocity = Owner.DirectionTo(Main.MouseWorld);
|
||||
projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
projectile.velocity.Normalize();
|
||||
projectile.rotation = projectile.velocity.ToRotation();
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
GeneralParryEffects();
|
||||
if (Owner.velocity.Y != 0)
|
||||
Owner.velocity += Vector2.Normalize(Owner.Center - proj.Center) * 2;
|
||||
Owner.velocity += Utils.SafeNormalize(Owner.Center - proj.Center, Vector2.Zero) * 2;
|
||||
}
|
||||
|
||||
//Reduce the projectile's damage by 200 for a second.
|
||||
|
||||
@@ -44,6 +44,8 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
public int CurrentAnimation => (MaxTime - projectile.timeLeft) <= SnapTime ? 0 : (MaxTime - projectile.timeLeft) <= SnapTime + HoldTime ? 1 : 2;
|
||||
|
||||
public ref float HitCounter => ref projectile.ai[0];
|
||||
|
||||
public Player Owner => Main.player[projectile.owner];
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
@@ -165,6 +167,12 @@ namespace CalamityMod.Projectiles.Melee
|
||||
GeneralParticleHandler.SpawnParticle(energyLeak);
|
||||
}
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
|
||||
{
|
||||
//Add some damage falloff
|
||||
damage = (int)(damage * Math.Pow((1 - ArkoftheElements.blastFalloffStrenght), HitCounter * ArkoftheElements.blastFalloffSpeed));
|
||||
HitCounter++;
|
||||
}
|
||||
|
||||
//Animation keys
|
||||
public CurveSegment anticipation = new CurveSegment(EasingType.SineBump, 0f, 0.2f, -0.1f);
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
Vector2 AnchorStart => Owner.Center;
|
||||
Vector2 AnchorEnd => Owner.Calamity().mouseWorld;
|
||||
public Vector2 SizeVector => Utils.SafeNormalize(AnchorEnd - AnchorStart, Vector2.Zero) * MathHelper.Clamp((AnchorEnd - AnchorStart).Length(), 0, ArkoftheCosmosSwungBlade.ThrowReachMax);
|
||||
public Vector2 SizeVector => Utils.SafeNormalize(AnchorEnd - AnchorStart, Vector2.Zero) * MathHelper.Clamp((AnchorEnd - AnchorStart).Length(), 0, ArkoftheCosmos.MaxThrowReach);
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
constellationColorHue = (constellationColorHue + 0.16f) % 1;
|
||||
constellationColor = Main.hslToRgb(constellationColorHue, 1, 0.8f);
|
||||
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Vector2.Normalize(SizeVector.RotatedBy(MathHelper.PiOver2));
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Utils.SafeNormalize(SizeVector.RotatedBy(MathHelper.PiOver2), Vector2.Zero);
|
||||
Star = new GenericSparkle(AnchorStart + SizeVector * i + offset, Vector2.Zero, Color.White, constellationColor, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f);
|
||||
BootlegSpawnParticle(Star);
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
constellationColorHue = (constellationColorHue + 0.16f) % 1;
|
||||
constellationColor = Main.hslToRgb(constellationColorHue, 1, 0.8f);
|
||||
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Vector2.Normalize(SizeVector.RotatedBy(MathHelper.PiOver2));
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Utils.SafeNormalize(SizeVector.RotatedBy(MathHelper.PiOver2), Vector2.Zero);
|
||||
Star = new GenericSparkle(AnchorStart + SizeVector * i + offset, Vector2.Zero, Color.White, constellationColor, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f);
|
||||
BootlegSpawnParticle(Star);
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Lighting.AddLight(projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio);
|
||||
|
||||
//Manage position and rotation
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
projectile.Center = Owner.Center + (direction * 60);
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
|
||||
//Take the direction the sword is swung. FUCK not controlling the swing direction more than just left/right :|
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
CanBounce = 1f;
|
||||
projectile.timeLeft = (int)MaxTime;
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
if (CanLunge == 1f)
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
if (!initialized) //Initialization. create control points & shit)
|
||||
{
|
||||
projectile.velocity = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
Reach = MathHelper.Clamp((Owner.Center - Owner.Calamity().mouseWorld).Length(), MinReach, MaxReach);
|
||||
Main.PlaySound(SoundID.DD2_OgreSpit, projectile.Center);
|
||||
controlPoint1 = projectile.Center;
|
||||
@@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
//Shmoove the player if a tile is hit. This movement always happens if the owner isnt on the ground, but will only happen if the projectile is above the player if they are standing on the ground)
|
||||
if (Collision.SolidCollision(projectile.position, 32, 32) && (Owner.velocity.Y != 0 || projectile.position.Y < Owner.position.Y))
|
||||
{
|
||||
Owner.velocity = Owner.DirectionTo(projectile.Center) * ReelBackStrenght;
|
||||
Owner.velocity = Owner.SafeDirectionTo(projectile.Center, Vector2.Zero) * ReelBackStrenght;
|
||||
SnapCoyoteTime = 0f;
|
||||
}
|
||||
Main.PlaySound(SoundID.Item65, projectile.position);
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
if (State == 0f)
|
||||
{
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement());
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
NPC potentialTarget = TargetNext(target.Center, i);
|
||||
if (potentialTarget == null)
|
||||
break;
|
||||
Projectile proj = Projectile.NewProjectileDirect(target.Center, target.DirectionTo(potentialTarget.Center) * 25f, ProjectileType<GalaxiaBolt>(), (int)(damage * FourSeasonsGalaxia.AriesAttunement_OnHitBoltDamageReduction), 0, Owner.whoAmI, 0.9f, MathHelper.PiOver4 * 0.4f);
|
||||
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);
|
||||
proj.scale = 2f;
|
||||
}
|
||||
Array.Clear(excludedTargets, 0, 3);
|
||||
@@ -135,9 +135,9 @@ namespace CalamityMod.Projectiles.Melee
|
||||
projectile.velocity *= 10f;
|
||||
}
|
||||
if (projectile.velocity.AngleBetween(Owner.Center - projectile.Center) > MathHelper.PiOver4)
|
||||
projectile.velocity = (projectile.velocity.ToRotation().AngleTowards(projectile.DirectionTo(Owner.Center).ToRotation(), MathHelper.Pi / 20f)).ToRotationVector2() * projectile.velocity.Length() * 0.98f;
|
||||
projectile.velocity = (projectile.velocity.ToRotation().AngleTowards(projectile.SafeDirectionTo(Owner.Center, Vector2.Zero).ToRotation(), MathHelper.Pi / 20f)).ToRotationVector2() * projectile.velocity.Length() * 0.98f;
|
||||
else
|
||||
projectile.velocity = (projectile.velocity.ToRotation().AngleTowards(projectile.DirectionTo(Owner.Center).ToRotation(), MathHelper.Pi)).ToRotationVector2() * projectile.velocity.Length() * 1.05f;
|
||||
projectile.velocity = (projectile.velocity.ToRotation().AngleTowards(projectile.SafeDirectionTo(Owner.Center, Vector2.Zero).ToRotation(), MathHelper.Pi)).ToRotationVector2() * projectile.velocity.Length() * 1.05f;
|
||||
projectile.rotation = Main.GlobalTime * 25f;
|
||||
projectile.scale = MathHelper.Clamp((Owner.Center - projectile.Center).Length() / (FourSeasonsGalaxia.AriesAttunement_Reach * 0.5f), 0.3f, 2f);
|
||||
projectile.timeLeft = 4;
|
||||
@@ -163,12 +163,12 @@ namespace CalamityMod.Projectiles.Melee
|
||||
projectile.Center = projectile.Center.MoveTowards(Owner.Calamity().mouseWorld, 40f * ThrowDisplace());
|
||||
|
||||
if ((projectile.Center - Owner.Center).Length() > FourSeasonsGalaxia.AriesAttunement_Reach)
|
||||
projectile.Center = Owner.Center + Owner.DirectionTo(projectile.Center) * FourSeasonsGalaxia.AriesAttunement_Reach;
|
||||
projectile.Center = Owner.Center + Owner.SafeDirectionTo(projectile.Center, Vector2.Zero) * FourSeasonsGalaxia.AriesAttunement_Reach;
|
||||
|
||||
projectile.rotation = Main.GlobalTime * 25f;
|
||||
//Make the owner look like theyre "holding" the sword bla bla
|
||||
Owner.heldProj = projectile.whoAmI;
|
||||
projectile.velocity = Owner.DirectionTo(projectile.Center);
|
||||
projectile.velocity = Owner.SafeDirectionTo(projectile.Center, Vector2.Zero);
|
||||
Owner.direction = Math.Sign(projectile.velocity.X);
|
||||
Owner.itemRotation = projectile.velocity.ToRotation();
|
||||
if (Owner.direction != 1)
|
||||
@@ -197,14 +197,14 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
float maxDistance = projectile.scale * 82f;
|
||||
Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance);
|
||||
Vector2 angularVelocity = Vector2.Normalize(distance.RotatedBy(MathHelper.PiOver2)) * 2f * (1f + distance.Length() / 15f);
|
||||
Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 2f * (1f + distance.Length() / 15f);
|
||||
Particle glitter = new CritSpark(projectile.Center + distance, angularVelocity, Main.rand.Next(3) == 0 ? Color.HotPink : Color.Plum, Color.DarkOrchid, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(glitter);
|
||||
}
|
||||
|
||||
float smokeDistance = projectile.scale * 62f;
|
||||
Vector2 smokePos = Main.rand.NextVector2Circular(smokeDistance, smokeDistance);
|
||||
Vector2 smokeSpeed = Vector2.Normalize(smokePos.RotatedBy(MathHelper.PiOver2)) * 0.1f * (1f + smokePos.Length() / 15f);
|
||||
Vector2 smokeSpeed = Utils.SafeNormalize(smokePos.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 0.1f * (1f + smokePos.Length() / 15f);
|
||||
Particle smoke = new HeavySmokeParticle(projectile.Center + smokePos, smokeSpeed, Color.Lerp(Color.Navy, Color.Indigo, (float)Math.Sin(Main.GlobalTime * 6f)), 30, Main.rand.NextFloat(0.4f, 1f) * projectile.scale, 0.8f, 0, false, 0, true);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
for (float i = 0 + Main.rand.NextFloat(0.2f, 0.5f); i < 1; i += Main.rand.NextFloat(0.2f, 0.5f))
|
||||
{
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Vector2.Normalize(SizeVector.RotatedBy(MathHelper.PiOver2));
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Utils.SafeNormalize(SizeVector.RotatedBy(MathHelper.PiOver2), Vector2.Zero);
|
||||
Star = new GenericSparkle(projectile.Center + SizeVector * i + offset, Vector2.Zero, Color.White, Color.Plum, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Star);
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
if (Main.rand.Next(3) == 0)
|
||||
{
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Vector2.Normalize(SizeVector.RotatedBy(MathHelper.PiOver2));
|
||||
offset = Main.rand.NextFloat(-50f, 50f) * Utils.SafeNormalize(SizeVector.RotatedBy(MathHelper.PiOver2), Vector2.Zero);
|
||||
Star = new GenericSparkle(projectile.Center + SizeVector * i + offset, Vector2.Zero, Color.White, Color.Plum, Main.rand.NextFloat(1f, 1.5f), 20, 0f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Star);
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
Main.PlaySound(SoundID.Item90, projectile.Center);
|
||||
projectile.velocity = Vector2.Zero;
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
initialized = true;
|
||||
}
|
||||
@@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3;
|
||||
|
||||
Main.PlaySound(SoundID.Item80, projectile.Center);
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
//PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES
|
||||
for (int i = 0; i <= 8; i++)
|
||||
{
|
||||
@@ -207,17 +207,17 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
|
||||
float rotationAdjusted = MathHelper.WrapAngle(projectile.rotation) + MathHelper.Pi;
|
||||
float mouseAngleAdjusted = MathHelper.WrapAngle(Owner.DirectionTo(Main.MouseWorld).ToRotation()) + MathHelper.Pi;
|
||||
float mouseAngleAdjusted = MathHelper.WrapAngle(Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One).ToRotation()) + MathHelper.Pi;
|
||||
float deltaAngleShoot = Math.Abs(MathHelper.WrapAngle(rotationAdjusted - mouseAngleAdjusted));
|
||||
|
||||
if (CanDirectFire && deltaAngleShoot < 0.1f)
|
||||
{
|
||||
if (Owner.whoAmI == Main.myPlayer)
|
||||
{
|
||||
Projectile.NewProjectile(Owner.Center, Owner.DirectionTo(Main.MouseWorld) * 15f, ProjectileType<GalaxiaBolt>(), (int)(projectile.damage * FourSeasonsGalaxia.PhoenixAttunement_BoltDamageReduction), 0f, Owner.whoAmI, 0.1f, MathHelper.Pi * 0.02f);
|
||||
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);
|
||||
}
|
||||
CanDirectFire = false;
|
||||
AngleReset = Owner.DirectionTo(Main.MouseWorld).ToRotation();
|
||||
AngleReset = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One).ToRotation();
|
||||
}
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
float maxDistance = projectile.scale * 1.9f * 78f;
|
||||
Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance);
|
||||
Vector2 angularVelocity = Vector2.Normalize(distance.RotatedBy(MathHelper.PiOver2)) * 2f * (1f + distance.Length() / 15f);
|
||||
Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 2f * (1f + distance.Length() / 15f);
|
||||
Particle glitter = new CritSpark(Owner.Center + distance, Owner.velocity + angularVelocity, Main.rand.Next(3) == 0 ? Color.Turquoise : Color.Coral, currentColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(glitter);
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Shred = 0;
|
||||
|
||||
//Manage position and rotation
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
projectile.Center = Owner.Center + (direction * 60);
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
//Explode into cosmic bolts
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Projectile blast = Projectile.NewProjectileDirect(Owner.Center, Owner.DirectionTo(target.Center).RotatedByRandom(MathHelper.PiOver4) * 30f, ProjectileType<GalaxiaBolt>(), (int)(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage * Owner.meleeDamage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.01f);
|
||||
Projectile blast = Projectile.NewProjectileDirect(Owner.Center, Owner.SafeDirectionTo(target.Center, Vector2.Zero).RotatedByRandom(MathHelper.PiOver4) * 30f, ProjectileType<GalaxiaBolt>(), (int)(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage * Owner.meleeDamage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.01f);
|
||||
{
|
||||
blast.timeLeft = 100;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Main.PlaySound(SoundID.Item90, projectile.Center);
|
||||
initialized = true;
|
||||
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
|
||||
|
||||
@@ -67,13 +67,11 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
Vector2 Shake = projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - projectile.timeLeft / 5f) * 0.5f;
|
||||
|
||||
Vector2 lineDirection = Vector2.Normalize(DashEnd - DashStart);
|
||||
int dist = (int)Vector2.Distance(DashEnd, DashStart) / 16;
|
||||
Vector2[] Nodes = new Vector2[dist + 1];
|
||||
Nodes[0] = DashStart;
|
||||
Nodes[dist] = DashEnd;
|
||||
|
||||
|
||||
for (int i = 1; i < dist + 1; i++)
|
||||
{
|
||||
Vector2 positionAlongLine = Vector2.Lerp(DashStart, DashEnd, i / (float)dist); //Get the position of the segment along the line
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
if (State == 0f)
|
||||
{
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement());
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Bottom, projectile.Bottom - (Vector2.UnitY * scaleY * 110), scaleX * 40, ref collisionPoint);
|
||||
|
||||
float halfLenght = 66f * projectile.scale;
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center + Vector2.Normalize(projectile.velocity.RotatedBy(MathHelper.PiOver2)) * halfLenght, projectile.Center - Vector2.Normalize(projectile.velocity.RotatedBy(MathHelper.PiOver2)) * halfLenght, 40f, ref collisionPoint);
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center + Utils.SafeNormalize(projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLenght, projectile.Center - Utils.SafeNormalize(projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLenght, 40f, ref collisionPoint);
|
||||
}
|
||||
|
||||
public override void DrawBehind(int index, List<int> drawCacheProjsBehindNPCsAndTiles, List<int> drawCacheProjsBehindNPCs, List<int> drawCacheProjsBehindProjectiles, List<int> drawCacheProjsOverWiresUI)
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
float opacity = projectile.timeLeft > 10 ? 1 : projectile.timeLeft / 10f;
|
||||
Vector2 Shake = projectile.timeLeft < 15 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (15 - projectile.timeLeft / 5f) * 0.5f;
|
||||
|
||||
Vector2 lineDirection = Vector2.Normalize(Target.Center - NPCfrom.Center);
|
||||
Vector2 lineDirection = Utils.SafeNormalize(Target.Center - NPCfrom.Center, Vector2.Zero);
|
||||
int dist = (int)Vector2.Distance(Target.Center, NPCfrom.Center) / 16;
|
||||
Vector2[] Nodes = new Vector2[dist + 1];
|
||||
Nodes[0] = NPCfrom.Center;
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
Main.PlaySound(SoundID.Item90, projectile.Center);
|
||||
projectile.velocity = Vector2.Zero;
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
oldDirection = direction;
|
||||
initialized = true;
|
||||
@@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
CurrentState = 1f;
|
||||
Main.PlaySound(SoundID.Item80, projectile.Center);
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
//PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES
|
||||
for (int i = 0; i <= 8; i++)
|
||||
{
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Lighting.AddLight(projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio);
|
||||
|
||||
//Manage position and rotation
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
projectile.Center = Owner.Center + (direction * 60);
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
projectile.timeLeft = (int)(30f + ShredRatio * 30f);
|
||||
initialized = true;
|
||||
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
break;
|
||||
}
|
||||
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
CanBounce = 1f;
|
||||
projectile.timeLeft = (int)MaxTime;
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
if (CanLunge == 1f && !ChargedUp)
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
if (!initialized) //Initialization. create control points & shit)
|
||||
{
|
||||
projectile.velocity = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
Reach = MathHelper.Clamp((Owner.Center - Owner.Calamity().mouseWorld).Length(), MinReach, MaxReach);
|
||||
Main.PlaySound(SoundID.DD2_OgreSpit, projectile.Center);
|
||||
controlPoint1 = projectile.Center;
|
||||
@@ -201,7 +201,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
//Shmoove the player if a tile is hit. This movement always happens if the owner isnt on the ground, but will only happen if the projectile is above the player if they are standing on the ground)
|
||||
if (Collision.SolidCollision(projectile.position, 32, 32) && (Owner.velocity.Y != 0 || projectile.position.Y < Owner.position.Y))
|
||||
{
|
||||
Owner.velocity = Owner.DirectionTo(projectile.Center) * ReelBackStrenght;
|
||||
Owner.velocity = Owner.SafeDirectionTo(projectile.Center, Vector2.Zero) * ReelBackStrenght;
|
||||
SnapCoyoteTime = 0f;
|
||||
}
|
||||
Main.PlaySound(SoundID.Item65, projectile.position);
|
||||
|
||||
@@ -33,13 +33,10 @@ namespace CalamityMod.Projectiles.Melee
|
||||
const float MaxTime = 20;
|
||||
public float Timer => MaxTime - projectile.timeLeft;
|
||||
|
||||
public ref float angle => ref projectile.ai[0];
|
||||
public ref float lenght => ref projectile.ai[1];
|
||||
public ref float HitCounter => ref projectile.ai[0];
|
||||
|
||||
public Player Owner => Main.player[projectile.owner];
|
||||
|
||||
public Vector2 lineVector => angle.ToRotationVector2() * lenght;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
projectile.melee = true;
|
||||
@@ -55,9 +52,11 @@ namespace CalamityMod.Projectiles.Melee
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
float collisionPoint = 0f;
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + lineVector, 20f, ref collisionPoint);
|
||||
return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity, 20f, ref collisionPoint);
|
||||
}
|
||||
|
||||
public override bool ShouldUpdatePosition() => false;
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Timer == 0)
|
||||
@@ -65,7 +64,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Particle Star = new GenericSparkle(projectile.Center, Vector2.Zero, Color.White, Color.HotPink, Main.rand.NextFloat(2f, 2.5f), 20, 0.1f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Star);
|
||||
|
||||
Star = new GenericSparkle(projectile.Center + lineVector, Vector2.Zero, Color.White, Color.PaleGoldenrod, Main.rand.NextFloat(2f, 2.5f), 20, 0.1f, 3f);
|
||||
Star = new GenericSparkle(projectile.Center + projectile.velocity, Vector2.Zero, Color.White, Color.PaleGoldenrod, Main.rand.NextFloat(2f, 2.5f), 20, 0.1f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Star);
|
||||
|
||||
Main.PlaySound(SoundID.Item84, projectile.Center);
|
||||
@@ -80,12 +79,19 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Vector2 particleSpeed = angle.ToRotationVector2().RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(2.6f, 4f);
|
||||
Vector2 particleSpeed = Utils.SafeNormalize(projectile.velocity, Vector2.Zero).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(2.6f, 4f);
|
||||
Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Cyan, 60, 1, 1.5f, hueShift: 0.02f);
|
||||
GeneralParticleHandler.SpawnParticle(energyLeak);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
|
||||
{
|
||||
//Add some damage falloff
|
||||
damage = (int)(damage * Math.Pow((1 - TrueArkoftheAncients.blastFalloffStrenght), HitCounter * TrueArkoftheAncients.blastFalloffSpeed));
|
||||
HitCounter++;
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Texture2D sword = GetTexture("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncients");
|
||||
@@ -93,6 +99,8 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
float displace = 10 * (1f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.8f));
|
||||
|
||||
float angle = projectile.velocity.ToRotation();
|
||||
|
||||
float drawRotation = angle + MathHelper.PiOver4;
|
||||
Vector2 drawOrigin = new Vector2(0f, sword.Height);
|
||||
Vector2 drawOffset = Owner.Center + angle.ToRotationVector2() * displace - Main.screenPosition;
|
||||
@@ -111,7 +119,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Vector2 origin = new Vector2(tex.Width / 2f, tex.Height);
|
||||
float size = Timer / MaxTime > 0.5f ? (float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.2f + 0.8f : (float)Math.Sin(Timer / MaxTime * MathHelper.Pi);
|
||||
size *= 3;
|
||||
Vector2 scale = new Vector2(size, lenght / tex.Height);
|
||||
Vector2 scale = new Vector2(size, projectile.velocity.Length() / tex.Height);
|
||||
spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, Color.LightPink, rot, origin, scale, SpriteEffects.None, 0);
|
||||
|
||||
//Cap the lines
|
||||
@@ -119,7 +127,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
scale = new Vector2(size, size);
|
||||
origin = new Vector2(cap.Width / 2f, cap.Height);
|
||||
spriteBatch.Draw(cap, projectile.Center - Main.screenPosition, null, Color.LightPink, rot + MathHelper.Pi, origin, scale, SpriteEffects.None, 0);
|
||||
spriteBatch.Draw(cap, projectile.Center + lineVector - Main.screenPosition, null, Color.LightPink, rot, origin, scale, SpriteEffects.None, 0);
|
||||
spriteBatch.Draw(cap, projectile.Center + projectile.velocity - Main.screenPosition, null, Color.LightPink, rot, origin, scale, SpriteEffects.None, 0);
|
||||
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Melee/TrueArkoftheAncients";
|
||||
|
||||
private bool initialized = false;
|
||||
const float MaxTime = 160;
|
||||
const float MaxTime = 340;
|
||||
static float ParryTime = 15;
|
||||
public Vector2 DistanceFromPlayer => projectile.velocity * 10 * (1f + ((float)Math.Sin(Timer / ParryTime * MathHelper.Pi) * 0.8f));
|
||||
public float Timer => MaxTime - projectile.timeLeft;
|
||||
@@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
projectile.timeLeft = (int)MaxTime;
|
||||
Main.PlaySound(SoundID.DD2_SkyDragonsFuryShot, projectile.Center);
|
||||
|
||||
projectile.velocity = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
projectile.velocity.Normalize();
|
||||
projectile.rotation = projectile.velocity.ToRotation();
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
//Manage position and rotation
|
||||
projectile.Center = Owner.Center + DistanceFromPlayer ;
|
||||
projectile.scale = 1.4f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.6f); //SWAGGER
|
||||
projectile.scale = 1.4f + ((float)Math.Sin(Timer / 160 * MathHelper.Pi) * 0.6f); //SWAGGER
|
||||
|
||||
if (Timer > ParryTime)
|
||||
return;
|
||||
@@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
//Bounce off the player if they are in the air
|
||||
if (Owner.velocity.Y != 0)
|
||||
Owner.velocity += Vector2.Normalize(Owner.Center - proj.Center) * 2;
|
||||
Owner.velocity += Utils.SafeNormalize(Owner.Center - proj.Center, Vector2.Zero) * 2;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
if (projectile.timeLeft == MaxTwirlTime)
|
||||
{
|
||||
projectile.velocity = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
Main.PlaySound(SoundID.Item71, projectile.Center);
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
return;
|
||||
}
|
||||
|
||||
projectile.velocity = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
projectile.velocity.Normalize();
|
||||
projectile.rotation = projectile.velocity.ToRotation();
|
||||
projectile.Center = Owner.Center + (projectile.velocity * 60);
|
||||
@@ -326,7 +326,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Vector2 directionFromHead = direction.RotatedBy(MathHelper.ToRadians(MathHelper.Lerp(0, 160f * flip, (float)Math.Sin(randomNumber * MathHelper.Pi)))) * MathHelper.Lerp(130f, 200f, MathHelper.Clamp((float)Math.Sin(randomNumber * MathHelper.Pi) - 0.5f, 0f, 1f) * 2f);
|
||||
control2 = control3 + directionFromHead;
|
||||
|
||||
Vector2 directionFromSecondToLastPoint = Vector2.Normalize(directionFromHead.RotatedBy(MathHelper.Pi - MathHelper.ToRadians(MathHelper.Lerp(80f * flip, 110f * flip, (float)Math.Sin(randomNumber * MathHelper.Pi))))) * MathHelper.Lerp(120f, 280f, (float)Math.Sin(randomNumber * MathHelper.Pi));
|
||||
Vector2 directionFromSecondToLastPoint = Utils.SafeNormalize(directionFromHead.RotatedBy(MathHelper.Pi - MathHelper.ToRadians(MathHelper.Lerp(80f * flip, 110f * flip, (float)Math.Sin(randomNumber * MathHelper.Pi)))), Vector2.Zero) * MathHelper.Lerp(120f, 280f, (float)Math.Sin(randomNumber * MathHelper.Pi));
|
||||
control1 = control2 + directionFromSecondToLastPoint;
|
||||
|
||||
control3 += Vector2.UnitX.RotatedBy(MathHelper.TwoPi * seed1) * seed3 * 30f;
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
if (State == 0f)
|
||||
{
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement());
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Lighting.AddLight(projectile.Center, new Vector3(1f, 0.56f, 0.56f) * ShredRatio);
|
||||
|
||||
//Manage position and rotation
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
projectile.Center = Owner.Center + (direction * 60);
|
||||
@@ -176,7 +176,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
Owner.Calamity().LungingDown = true;
|
||||
Owner.fallStart = (int)(Owner.position.Y / 16f);
|
||||
Owner.velocity = Owner.DirectionTo(Wheel.Center) * 60f;
|
||||
Owner.velocity = Owner.SafeDirectionTo(Wheel.Center, Vector2.Zero) * 60f;
|
||||
|
||||
if (Owner.Distance(Wheel.Center) < 60f)
|
||||
Wheel.active = false;
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Main.PlaySound(SoundID.Item90, projectile.Center);
|
||||
initialized = true;
|
||||
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
projectile.rotation = direction.ToRotation();
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
Main.PlaySound(SoundID.Item90, projectile.Center);
|
||||
projectile.velocity = Vector2.Zero;
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
direction.Normalize();
|
||||
initialized = true;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
CurrentState = 1f;
|
||||
Main.PlaySound(SoundID.Item80, projectile.Center);
|
||||
direction = Owner.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero);
|
||||
//PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES
|
||||
for (int i = 0; i <= 8; i++)
|
||||
{
|
||||
@@ -179,33 +179,33 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
if (sightLine == null)
|
||||
{
|
||||
sightLine = new LineVFX(Owner.Center, Owner.DirectionTo(Owner.Calamity().mouseWorld), 0.2f, Color.HotPink, false);
|
||||
sightLine = new LineVFX(Owner.Center, Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One), 0.2f, Color.HotPink, false);
|
||||
GeneralParticleHandler.SpawnParticle(sightLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
sightLine.Position = Owner.Center + Owner.DirectionTo(Owner.Calamity().mouseWorld) * projectile.scale * 1.88f * 40;
|
||||
(sightLine as LineVFX).LineVector = Owner.DirectionTo(Owner.Calamity().mouseWorld) * projectile.scale * 1.88f * 38f;
|
||||
sightLine.Position = Owner.Center + Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * projectile.scale * 1.88f * 40;
|
||||
(sightLine as LineVFX).LineVector = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * projectile.scale * 1.88f * 38f;
|
||||
sightLine.Scale = 0.2f;
|
||||
sightLine.Time = 0;
|
||||
sightLine.Color = currentColor * 0.7f;
|
||||
}
|
||||
|
||||
float rotationAdjusted = MathHelper.WrapAngle(projectile.rotation) + MathHelper.Pi;
|
||||
float mouseAngleAdjusted = MathHelper.WrapAngle(Owner.DirectionTo(Main.MouseWorld).ToRotation()) + MathHelper.Pi;
|
||||
float mouseAngleAdjusted = MathHelper.WrapAngle(Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One).ToRotation()) + MathHelper.Pi;
|
||||
float deltaAngleShoot = Math.Abs(MathHelper.WrapAngle(rotationAdjusted - mouseAngleAdjusted));
|
||||
|
||||
if (CanDirectFire && deltaAngleShoot < 0.1f)
|
||||
{
|
||||
Particle Blink = new GenericSparkle(Owner.Center + Owner.DirectionTo(Main.MouseWorld) * projectile.scale * 1.88f * 78f, Owner.velocity, Color.White, currentColor, 1.5f, 10, 0.1f, 3f);
|
||||
Particle Blink = new GenericSparkle(Owner.Center + Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One) * projectile.scale * 1.88f * 78f, Owner.velocity, Color.White, currentColor, 1.5f, 10, 0.1f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(Blink);
|
||||
|
||||
if (Owner.whoAmI == Main.myPlayer)
|
||||
{
|
||||
Projectile.NewProjectile(Owner.Center, Owner.DirectionTo(Main.MouseWorld) * 15f, ProjectileType<SwordsmithsPrideBeam>(), (int)(projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_BeamDamageReduction), 0f, Owner.whoAmI);
|
||||
Projectile.NewProjectile(Owner.Center, Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One) * 15f, ProjectileType<SwordsmithsPrideBeam>(), (int)(projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_BeamDamageReduction), 0f, Owner.whoAmI);
|
||||
}
|
||||
CanDirectFire = false;
|
||||
AngleReset = Owner.DirectionTo(Main.MouseWorld).ToRotation();
|
||||
AngleReset = Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One).ToRotation();
|
||||
}
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
float maxDistance = projectile.scale * 1.9f * 78f;
|
||||
Vector2 distance = Main.rand.NextVector2Circular(maxDistance, maxDistance);
|
||||
Vector2 angularVelocity = Vector2.Normalize(distance.RotatedBy(MathHelper.PiOver2)) * 2f * (1f + distance.Length() / 15f);
|
||||
Vector2 angularVelocity = Utils.SafeNormalize(distance.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * 2f * (1f + distance.Length() / 15f);
|
||||
Particle glitter = new CritSpark(Owner.Center + distance, Owner.velocity + angularVelocity, Color.White, currentColor, 1f + 1 * (distance.Length() / maxDistance), 10, 0.05f, 3f);
|
||||
GeneralParticleHandler.SpawnParticle(glitter);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user