RoRChange
This commit is contained in:
1 parent
98079baff5
commit
ca13f1e089
7 files changed
+208
-103
No files matched your search
@@ -61,7 +61,6 @@ using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using CalamityMod.Projectiles.Melee.Shortswords;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using CalamityMod.Projectiles.Rogue;
|
||||
using CalamityMod.Projectiles.Summon;
|
||||
@@ -86,7 +85,6 @@ using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ModLoader.IO;
|
||||
using Terraria.Net;
|
||||
using Terraria.WorldBuilding;
|
||||
using static Terraria.Main;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
@@ -380,6 +378,8 @@ namespace CalamityMod.CalPlayer
|
||||
/// <summary> Variable used to track if Auger can do its big slash attack. </summary>
|
||||
public bool buffedAuger = false;
|
||||
|
||||
public int rOfResilienceBaseTimeMax = 300;
|
||||
public int rOfResilienceMaxPowerTime = 1800;
|
||||
public int rOfResilienceCooldown = 0;
|
||||
public int rOfResilienceEffect = 0;
|
||||
public int rOfResilienceOrbitOffset = 0;
|
||||
|
||||
@@ -1358,7 +1358,7 @@ namespace CalamityMod.CalPlayer
|
||||
rOfResilienceCooldown = cooldownTime;
|
||||
Player.AddCooldown(Cooldowns.RelicOfResilienceCooldown.ID, cooldownTime);
|
||||
SoundStyle youGotHit = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate");
|
||||
SoundEngine.PlaySound(youGotHit with { Volume = 0.7f, Pitch = -0.1f }, Player.Center);
|
||||
SoundEngine.PlaySound(youGotHit with { Volume = 0.7f, Pitch = -0.5f }, Player.Center);
|
||||
}
|
||||
|
||||
if (alchFlask)
|
||||
|
||||
@@ -1694,9 +1694,13 @@ namespace CalamityMod.CalPlayer
|
||||
if (bootLevel > 0)
|
||||
HeatDebuffMultiplier += 0.25f * bootLevel;
|
||||
|
||||
if (rOfResilienceEffect > 0)
|
||||
rOfResilienceEffect--;
|
||||
if (Player.HeldItem.type == ModContent.ItemType<RelicOfResilience>()) // All players close to a player holding RoR get the benefits
|
||||
bool holdingRoR = Player.HeldItem.type == ModContent.ItemType<RelicOfResilience>();
|
||||
bool shieldIsSetup = (rOfResilienceEffect >= rOfResilienceBaseTimeMax);
|
||||
bool chargedButNotHolding = (rOfResilienceEffect > rOfResilienceBaseTimeMax && !holdingRoR);
|
||||
bool reduceEffect = (!shieldIsSetup || chargedButNotHolding);
|
||||
if (rOfResilienceEffect > 0 && reduceEffect)
|
||||
{ rOfResilienceEffect -= (chargedButNotHolding ? 4 : 1); if (shieldIsSetup && rOfResilienceEffect < rOfResilienceBaseTimeMax) rOfResilienceEffect = rOfResilienceBaseTimeMax; if (rOfResilienceEffect < 0) rOfResilienceEffect = 0; }
|
||||
if (holdingRoR) // All players close to a player holding RoR get the benefits
|
||||
{
|
||||
if (Player.ownedProjectileCounts[ModContent.ProjectileType<RelicGuard>()] < 1 && !Player.dead)
|
||||
{
|
||||
@@ -1705,35 +1709,43 @@ namespace CalamityMod.CalPlayer
|
||||
for (int index = 0; index < Main.player.Length; index++)
|
||||
{
|
||||
Player fella = Main.player[index];
|
||||
if (Utils.Distance(fella.Center, Player.Center) < 650 && fella.team == Player.team)
|
||||
bool validEffectBoost = Utils.Distance(fella.Center, Player.Center) < 1000 && fella.team == Player.team && fella.Calamity().rOfResilienceEffect < rOfResilienceMaxPowerTime
|
||||
&& fella.Calamity().rOfResilienceCooldown == 0 && (fella.Calamity().rOfResilienceEffect > rOfResilienceBaseTimeMax ? holdingRoR : true);
|
||||
if (validEffectBoost)
|
||||
{
|
||||
fella.Calamity().rOfResilienceEffect = (fella != Player ? 480 : 2);
|
||||
fella.Calamity().rOfResilienceEffect += (reduceEffect ? 2 : 1) + (Player.Calamity().profanedSoulRelicBuff ? 1 : 0); // gets subtracted by 1 every frame, so this goes up by more to keep up
|
||||
}
|
||||
}
|
||||
}
|
||||
// Adds a floor for defense and dr at 150 and 10% respectivley, will not ignore defense damage
|
||||
if (Player.Calamity().rOfResilienceCooldown >= 450 || Player.Calamity().rOfResilienceCooldown == 0)
|
||||
{
|
||||
float fadeInStats = Utils.GetLerpValue(0, rOfResilienceBaseTimeMax, rOfResilienceEffect, true);
|
||||
float fadeStats = (Player.Calamity().rOfResilienceCooldown == 0 ? fadeInStats : MathF.Pow(Utils.GetLerpValue(450, 900, Player.Calamity().rOfResilienceCooldown, true), 3));
|
||||
float overchargeBoost = 1 + (Utils.GetLerpValue(rOfResilienceBaseTimeMax, rOfResilienceMaxPowerTime, rOfResilienceEffect, true) * (Player.Calamity().profanedSoulRelicBuff ? 5 : 2)); // The amount of bulk this gives with artifact is way overkill but it is REALLY funny
|
||||
int def = (int)(150 * overchargeBoost);
|
||||
float dr = 0.10f * overchargeBoost;
|
||||
int maxDefFloor = (int)(def * fadeStats);
|
||||
float MaxDRFloor = dr * fadeStats;
|
||||
if (Player.statDefense < maxDefFloor)
|
||||
Player.statDefense += maxDefFloor - Player.statDefense;
|
||||
if (Player.endurance < MaxDRFloor)
|
||||
Player.endurance += MaxDRFloor - Player.endurance;
|
||||
}
|
||||
if (rOfResilienceEffect > 0)
|
||||
{
|
||||
if (Player.Calamity().mouseRight && !Player.mouseInterface && rOfResilienceCooldown == 0)
|
||||
if (Player.Calamity().mouseRight && !Player.mouseInterface && rOfResilienceCooldown == 0 && holdingRoR)
|
||||
{
|
||||
int cooldownTime = (Player.Calamity().profanedSoulRelicBuff ? 300 : 600);
|
||||
int cooldownTime = 900;
|
||||
rOfResilienceCooldown = cooldownTime;
|
||||
Player.AddCooldown(Cooldowns.RelicOfResilienceCooldown.ID, cooldownTime);
|
||||
SoundStyle y = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianRockShieldActivate");
|
||||
SoundEngine.PlaySound(y with { Volume = 0.7f, Pitch = -0.1f }, Player.Center);
|
||||
}
|
||||
|
||||
// Adds a floor for defense and dr at 150 and 10% respectivley, will not ignore defense damage
|
||||
if (Player.Calamity().rOfResilienceCooldown > 300 || Player.Calamity().rOfResilienceCooldown == 0)
|
||||
{
|
||||
float fadeStats = (Player.Calamity().rOfResilienceCooldown == 0 ? 1 : Utils.GetLerpValue(300, 600, Player.Calamity().rOfResilienceCooldown, true));
|
||||
int maxDefFloor = (int)(150 * fadeStats);
|
||||
float MaxDRFloor = 0.10f * fadeStats;
|
||||
if (Player.statDefense < maxDefFloor)
|
||||
Player.statDefense += maxDefFloor - Player.statDefense;
|
||||
if (Player.endurance < MaxDRFloor)
|
||||
Player.endurance += MaxDRFloor - Player.endurance;
|
||||
}
|
||||
|
||||
int shardBaseCap = (Player.Calamity().profanedSoulRelicBuff ? 50 : 30);
|
||||
float postMaxedShards = MathHelper.Lerp(shardBaseCap, shardBaseCap * 2f, MathF.Pow(Utils.GetLerpValue(rOfResilienceBaseTimeMax, rOfResilienceMaxPowerTime, rOfResilienceEffect, true), 2));
|
||||
int maxShards = (int)(postMaxedShards * Utils.GetLerpValue(0, rOfResilienceBaseTimeMax, rOfResilienceEffect, true));
|
||||
int numOfShards = 0;
|
||||
for (int x = 0; x < Main.maxProjectiles; x++)
|
||||
{
|
||||
@@ -1743,7 +1755,26 @@ namespace CalamityMod.CalPlayer
|
||||
numOfShards++;
|
||||
}
|
||||
}
|
||||
if (Player.miscCounter % (Player.Calamity().profanedSoulRelicBuff ? 4 : 8) == 0 && numOfShards < (Player.Calamity().profanedSoulRelicBuff ? 75 : 30) && Player.Calamity().rOfResilienceCooldown == 0)
|
||||
float lowestNum = 0;
|
||||
int whoAmI = 0;
|
||||
if (numOfShards > maxShards) // Kill the most recent shard if there's too many
|
||||
{
|
||||
for (int x = 0; x < Main.maxProjectiles; x++)
|
||||
{
|
||||
Projectile projectile = Main.projectile[x];
|
||||
if (projectile.active && projectile.type == ModContent.ProjectileType<ArtifactOfResilienceShards>() && projectile.ai[1] == 0 && projectile.owner == Player.whoAmI && projectile.ai[2] > lowestNum)
|
||||
{
|
||||
whoAmI = projectile.whoAmI;
|
||||
lowestNum = projectile.ai[2];
|
||||
}
|
||||
}
|
||||
if (whoAmI != 0)
|
||||
{
|
||||
Projectile shard = Main.projectile[whoAmI];
|
||||
shard.ai[1] = -1;
|
||||
}
|
||||
}
|
||||
if (numOfShards < maxShards && Player.Calamity().rOfResilienceCooldown == 0 && (rOfResilienceEffect >= rOfResilienceBaseTimeMax || holdingRoR))
|
||||
{
|
||||
if (numOfShards == 0)
|
||||
{
|
||||
@@ -1751,12 +1782,12 @@ namespace CalamityMod.CalPlayer
|
||||
SoundStyle sound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianDash");
|
||||
SoundEngine.PlaySound(sound with { Volume = 0.5f, Pitch = -0.3f }, Player.Center);
|
||||
}
|
||||
int shardDamage = (int)Player.GetBestClassDamage().ApplyTo(420);
|
||||
int shardDamage = (int)Player.GetBestClassDamage().ApplyTo(Player.Calamity().profanedSoulRelicBuff ? 950 : 250);
|
||||
Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, new Vector2(1, 0), ModContent.ProjectileType<ArtifactOfResilienceShards>(), shardDamage, 0f, Player.whoAmI, 0, 0, numOfShards + 1);
|
||||
}
|
||||
}
|
||||
if (rOfResilienceCooldown > 0)
|
||||
rOfResilienceCooldown--;
|
||||
{ rOfResilienceCooldown -= (holdingRoR ? 2 : 1); if (rOfResilienceCooldown < 0) rOfResilienceCooldown = 0; }
|
||||
|
||||
if (Player.Calamity().friendlyMinions > 0)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using CalamityMod.Items.Tools;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Cooldowns
|
||||
{
|
||||
@@ -12,5 +14,11 @@ namespace CalamityMod.Cooldowns
|
||||
public override Color OutlineColor => new Color(255, 191, 73);
|
||||
public override Color CooldownStartColor => new Color(122, 66, 59);
|
||||
public override Color CooldownEndColor => new Color(165, 103, 87);
|
||||
|
||||
public override void Tick()
|
||||
{
|
||||
if (instance.player.HeldItem.type == ModContent.ItemType<RelicOfResilience>())
|
||||
instance.timeLeft--;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -337,10 +337,12 @@ RelicOfResilience: {
|
||||
Tooltip:
|
||||
'''
|
||||
Holding this item creates orbiting rock shards around you and nearby allies
|
||||
After 5 seconds, the relic will retain orbiting rocks even when not holding the item
|
||||
Continuing to hold the item will steadily increase the number of rocks until reaching max power
|
||||
While they orbit you, your minimum defense is set to 150 and minimum damage reduction to 10%
|
||||
Taking a hit or pressing <right> will pull in the shards, then blast them outward, crippling hit enemies
|
||||
This effect has a 10 second cooldown after taking a hit
|
||||
Holding out the shield heavily reduces the damage of all summons while rocks are active, only for you
|
||||
Taking a hit or pressing <right> while holding this item will pull in the shards, then blast them outward, crippling hit enemies
|
||||
This effect has a 10 second cooldown after taking a hit, but recharges faster if holding the item
|
||||
Holding out the shield heavily reduces the damage of all summons
|
||||
[c/FF8C00:I saw a massacre and did nothing to stop it. My vow broken, I was shunned.]
|
||||
[c/FF8C00:My will to forge ahead vanished. My final wish was simply to not die alone.]
|
||||
[c/FF8C00:But when She put faith in my shield, I would never again let it falter.]
|
||||
|
||||
@@ -3,12 +3,14 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Tools;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
@@ -19,7 +21,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
public new string LocalizationCategory => "Projectiles.Typeless";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public ref float time => ref Projectile.ai[0];
|
||||
public bool orbiting => Projectile.ai[1] == 0;
|
||||
public bool orbiting => (Projectile.ai[1] == 0 || (Projectile.ai[1] == 1 && burstTimer > 0));
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
|
||||
public Vector2 goalPosition;
|
||||
@@ -31,53 +33,91 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
public float speedMult = 1;
|
||||
public float placementMult = 1;
|
||||
public float orbitRot = 0;
|
||||
public bool isAttacking => (burstTimer == 0 && !orbiting && Projectile.ai[1] != -1);
|
||||
public float shardNumMult = 1;
|
||||
public Vector2 lastPos;
|
||||
public Color bColor = Color.Sienna;
|
||||
public ref float debuffMult => ref Projectile.localAI[0];
|
||||
public bool isAttacking => (burstTimer <= 0 && !orbiting && Projectile.ai[1] != -1);
|
||||
public override void SetStaticDefaults() // remove this
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 8;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 3;
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 50;
|
||||
Projectile.height = 50;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.extraUpdates = 4;
|
||||
Projectile.extraUpdates = 3;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.timeLeft = 230;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 30 * Projectile.MaxUpdates;
|
||||
Projectile.localNPCHitCooldown = 20 * Projectile.MaxUpdates;
|
||||
Projectile.ContinuouslyUpdateDamageStats = true;
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
float orbitMult = Utils.Remap(Owner.ownedProjectileCounts[ModContent.ProjectileType<ArtifactOfResilienceShards>()],
|
||||
0, 30, 0.8f, 1.35f, false);
|
||||
float attackMult = MathF.Pow(1 + (Projectile.ai[1] == 1 ? (MathF.Pow(1 - Utils.GetLerpValue(0, 280, burstTimer, true), 4)) : 0) * 5, 2);
|
||||
float orbit = Projectile.ai[1] == 1 ? (1 - MathF.Pow(Utils.GetLerpValue(280, 0, burstTimer, true), 4)) : 1;
|
||||
|
||||
float sine = (float)Math.Sin(time * 0.03f * speedMult / MathHelper.Pi);
|
||||
float sine2 = (float)Math.Sin(time * (0.03f * 0.5f * speedMult) / MathHelper.Pi);
|
||||
float sineNumberThreeSurelyWeNeedAThirdSineYouWillNotRegretAThirdSine = (float)Math.Sin((Main.GlobalTimeWrappedHourly + Owner.Calamity().rOfResilienceOrbitOffset) * (4.5f) / MathHelper.Pi);
|
||||
float sineNumberThreeSurelyWeNeedAThirdSineYouWillNotRegretAThirdSine = (float)Math.Sin((Main.GlobalTimeWrappedHourly * attackMult + Owner.Calamity().rOfResilienceOrbitOffset) * (4.5f) / MathHelper.Pi);
|
||||
|
||||
|
||||
|
||||
float rate = time * 0.004f;
|
||||
List<Color> eColors = new List<Color>()
|
||||
{
|
||||
Color.Sienna,
|
||||
Color.Peru
|
||||
};
|
||||
|
||||
int colorIndex = (int)(rate / 2 % eColors.Count);
|
||||
Color currentColor = eColors[colorIndex];
|
||||
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
|
||||
bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
|
||||
|
||||
orbitSine = MathHelper.Lerp(Math.Abs(sine2), 0.1f, 1 - Math.Abs(sine2));
|
||||
float shardNumMult = Utils.GetLerpValue(-10, 30, Owner.ownedProjectileCounts[ModContent.ProjectileType<ArtifactOfResilienceShards>()], true) * (Owner.Calamity().profanedSoulRelicBuff ? 2 : 1);
|
||||
float goalMult = (Utils.GetLerpValue(-10, 30, Owner.ownedProjectileCounts[ModContent.ProjectileType<ArtifactOfResilienceShards>()], true) * orbitMult);
|
||||
shardNumMult = MathHelper.Lerp(shardNumMult, goalMult, 0.01f);
|
||||
|
||||
float displace = new Vector2(25, 0).RotatedBy(sineNumberThreeSurelyWeNeedAThirdSineYouWillNotRegretAThirdSine * 0.5f).ToRotation();
|
||||
orbitRot = Utils.AngleLerp(orbitRot, displace, 0.01f);
|
||||
goalPosition = Owner.Center + (new Vector2(250 * sine * shardNumMult * placementMult, (125 * orbitSine - 45) * shardNumMult * placementMult)).RotatedBy(orbitRot);
|
||||
goalPosition = Owner.Center + (new Vector2(250 * sine * shardNumMult * placementMult * orbit, (125 * orbitSine - 45) * shardNumMult * placementMult * orbit)).RotatedBy(orbitRot);
|
||||
|
||||
Lighting.AddLight(Projectile.Center, Color.Lerp(Color.White, Color.Sienna, 0.5f).ToVector3() * 0.8f);
|
||||
|
||||
if (Owner.Calamity().rOfResilienceCooldown > 0 && Projectile.ai[1] == 0)
|
||||
{
|
||||
burstTimer = 120;
|
||||
for (int x = 0; x < Main.maxProjectiles; x++)
|
||||
{
|
||||
Projectile projectile = Main.projectile[x];
|
||||
if (projectile.active && projectile.type == Projectile.type && projectile.ai[1] == 0 && projectile.owner == Owner.whoAmI)
|
||||
{
|
||||
projectile.localAI[0] = Utils.Remap(Owner.Calamity().rOfResilienceEffect, 0, Owner.Calamity().rOfResilienceMaxPowerTime, 1, 8, true);
|
||||
}
|
||||
}
|
||||
Owner.Calamity().rOfResilienceEffect = 0;
|
||||
burstTimer = 280;
|
||||
Projectile.ai[1] = 1;
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
if (Owner.Calamity().rOfResilienceEffect == 0 && Projectile.ai[1] == 0)
|
||||
if ((Owner.Calamity().rOfResilienceEffect == 0 || (Owner.Calamity().rOfResilienceEffect < Owner.Calamity().rOfResilienceBaseTimeMax && Owner.HeldItem.type != ModContent.ItemType<RelicOfResilience>())) && Projectile.ai[1] == 0)
|
||||
{
|
||||
Projectile.ai[1] = -1;
|
||||
Projectile.timeLeft = 95;
|
||||
Projectile.velocity = Utils.DirectionTo(Projectile.Center, goalPosition) * Main.rand.NextFloat(1f, 3f);
|
||||
}
|
||||
|
||||
if (time == 0)
|
||||
{
|
||||
lastPos = Projectile.Center;
|
||||
relicType = Main.rand.Next(1, 6 + 1);
|
||||
speedMult = (Owner.Calamity().profanedSoulRelicBuff ? Main.rand.NextFloat(0.6f, 1.5f) : Main.rand.NextFloat(0.8f, 1.2f));
|
||||
speedMult = Main.rand.NextFloat(0.8f, 1.2f);
|
||||
placementMult = Main.rand.NextFloat(0.75f, 1.15f);
|
||||
}
|
||||
|
||||
@@ -107,63 +147,55 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
Projectile.Opacity = Utils.GetLerpValue(0, 90, Projectile.timeLeft, true);
|
||||
if (Projectile.ai[1] == -1)
|
||||
{
|
||||
if (Projectile.timeLeft > 95)
|
||||
Projectile.timeLeft = 95;
|
||||
Projectile.velocity *= 0.98f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (burstTimer > 0)
|
||||
if (burstTimer == 0)
|
||||
{
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.velocity *= 0.9f;
|
||||
if (Utils.Distance(Projectile.Center, Owner.Center) < 15)
|
||||
Projectile.Opacity = 1;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
Projectile.localNPCImmunity[i] = 0;
|
||||
|
||||
int projNum = Owner.ownedProjectileCounts[ModContent.ProjectileType<ArtifactOfResilienceShards>()];
|
||||
|
||||
Projectile.velocity = (((MathHelper.TwoPi / projNum) * Projectile.ai[2]).ToRotationVector2()) * 15 * speedMult * Main.rand.NextFloat(0.6f, 1.2f);
|
||||
Owner.SetScreenshake(5f);
|
||||
|
||||
if (Projectile.ai[2] == 1)
|
||||
{
|
||||
behind = true;
|
||||
Projectile.Center = Owner.Center;
|
||||
SoundStyle boom = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate");
|
||||
SoundEngine.PlaySound(boom with { Volume = 0.7f, Pitch = 0.1f }, Owner.Center);
|
||||
SoundStyle boom2 = new("CalamityMod/Sounds/Item/MagicRockSound");
|
||||
SoundEngine.PlaySound(boom2 with { Volume = 0.7f, Pitch = 0f }, Owner.Center);
|
||||
}
|
||||
else
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Projectile.Center += Utils.DirectionTo(Projectile.Center, Owner.Center) * 40f * Utils.GetLerpValue(90, 0, burstTimer);
|
||||
if (time % 8 == 0)
|
||||
{
|
||||
Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(3, 8), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), true, Main.rand.Next(20, 32 + 1), Main.rand.NextFloat(0.65f, 1.1f), Color.White * Main.rand.NextFloat(0.4f, 0.9f), Vector2.One, false, false, Main.rand.NextFloat(-5, 5), false, false);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(6, 28), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), Main.rand.NextBool(3), Main.rand.Next(25, 55 + 1), Main.rand.NextFloat(1.2f, 1.7f), Color.White, new Vector2(0.9f, 1.1f), false, false, 0, false, false);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LightDust>(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5, 38));
|
||||
dust.noGravity = Main.rand.NextBool();
|
||||
dust.scale = Main.rand.NextFloat(1.35f, 2.8f);
|
||||
dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Sienna;
|
||||
}
|
||||
burstTimer--;
|
||||
if (burstTimer == 0)
|
||||
{
|
||||
Projectile.Opacity = 1;
|
||||
|
||||
int projNum = Owner.ownedProjectileCounts[ModContent.ProjectileType<ArtifactOfResilienceShards>()] - 4;
|
||||
|
||||
Projectile.velocity = ((MathHelper.TwoPi * Projectile.ai[2] / projNum).ToRotationVector2()) * 15 * speedMult;
|
||||
Owner.SetScreenshake(5f);
|
||||
|
||||
if (Projectile.ai[2] == 1)
|
||||
{
|
||||
SoundStyle boom = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianShieldDeactivate");
|
||||
SoundEngine.PlaySound(boom with { Volume = 0.7f, Pitch = 0.1f }, Owner.Center);
|
||||
SoundStyle boom2 = new("CalamityMod/Sounds/Item/MagicRockSound");
|
||||
SoundEngine.PlaySound(boom2 with { Volume = 0.7f, Pitch = 0f }, Owner.Center);
|
||||
}
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Particle spark = new CustomSpark(Projectile.Center, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(6, 28), "CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard" + Main.rand.Next(1, 6 + 1).ToString(), Main.rand.NextBool(3), Main.rand.Next(25, 55 + 1), Main.rand.NextFloat(1.2f, 1.7f), Color.White, new Vector2(0.9f, 1.1f), false, false, 0, false, false);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LightDust>(), Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5, 38));
|
||||
dust.noGravity = Main.rand.NextBool();
|
||||
dust.scale = Main.rand.NextFloat(1.35f, 2.8f);
|
||||
dust.color = Main.rand.NextBool() ? Color.OrangeRed : Color.Sienna;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.velocity *= 0.97f;
|
||||
}
|
||||
Projectile.velocity *= 0.97f;
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 vel = lastPos.DirectionTo(Projectile.Center);
|
||||
float trailMult = MathF.Pow(Utils.GetLerpValue(15, 60, Owner.ownedProjectileCounts[ModContent.ProjectileType<ArtifactOfResilienceShards>()], false), 0.5f);
|
||||
if (trailMult > 0 && Projectile.timeLeft > 130)
|
||||
{
|
||||
Particle spark = new CustomSpark(Projectile.Center, vel * 3, "CalamityMod/Particles/BloomCircle", false, 5, 0.365f * Projectile.scale * trailMult, bColor * Projectile.Opacity * MathF.Min(trailMult, 1), new Vector2(1f, 1f), true, true, colorFadeSpeed: 10, glowCenterScale: 0.6f, glowOpacity: 0.8f * Projectile.Opacity * trailMult, shrinkSpeed: 0.9f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
spark.DrawLayer = Enums.GeneralDrawLayer.BeforeProjectiles;
|
||||
}
|
||||
|
||||
if (isAttacking && Main.rand.NextBool(4))
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LightDust>(), -Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.6f) * Main.rand.NextFloat(4f, 8f));
|
||||
@@ -171,8 +203,11 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
dust.scale = Main.rand.NextFloat(0.55f, 1.1f) * Projectile.Opacity;
|
||||
dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod;
|
||||
}
|
||||
|
||||
time++;
|
||||
if (Projectile.FinalExtraUpdate())
|
||||
lastPos = Projectile.Center;
|
||||
if (burstTimer > 0)
|
||||
burstTimer--;
|
||||
time += 1f * orbitMult * attackMult;
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
@@ -180,9 +215,10 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
if (crit)
|
||||
modifiers.SetCrit();
|
||||
|
||||
modifiers.SourceDamage *= (isAttacking ? 1 : 0.45f);
|
||||
float damageMultBase = Utils.Remap(Owner.Calamity().rOfResilienceEffect, 0, Owner.Calamity().rOfResilienceMaxPowerTime, 0.2f, 0.5f);
|
||||
modifiers.SourceDamage *= (isAttacking ? 1 : damageMultBase);
|
||||
if (isAttacking)
|
||||
target.AddBuff(ModContent.BuffType<ProfanedWeakness>(), 520);
|
||||
target.AddBuff(ModContent.BuffType<ProfanedWeakness>(), (int)(150 * debuffMult));
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
@@ -200,7 +236,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
_ => ModContent.Request<Texture2D>("CalamityMod/Projectiles/Typeless/ArtifactOfResilienceShard6").Value
|
||||
};
|
||||
if (isAttacking)
|
||||
Projectile.DrawProjectileWithBackglow(Color.Goldenrod with { A = 0 } * Projectile.Opacity, Color.White * Projectile.Opacity, 3 * Projectile.scale, tex);
|
||||
Projectile.DrawProjectileWithBackglow(bColor with { A = 0 } * Projectile.Opacity, Color.White * Projectile.Opacity, 3 * Projectile.scale, tex);
|
||||
else
|
||||
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, lightColor * Projectile.Opacity, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None, 0);
|
||||
|
||||
@@ -213,7 +249,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
else
|
||||
overPlayers.Add(index);
|
||||
}
|
||||
public override bool? CanDamage() => (Projectile.ai[1] == -1 || burstTimer > 0) ? false : null;
|
||||
public override bool? CanDamage() => (Projectile.ai[1] == -1) ? false : null;
|
||||
|
||||
public override void SendExtraAI(BinaryWriter writer)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using CalamityMod.Items.Tools;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
@@ -23,6 +24,10 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
public float rot2 = 0;
|
||||
public Vector2 aimVel;
|
||||
public float xLerp = 0;
|
||||
public bool fullPower = false;
|
||||
public bool maxPower = false;
|
||||
public Vector2 goalPos;
|
||||
public float chargeScaling = 1;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = Projectile.height = 1;
|
||||
@@ -36,6 +41,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
public override void AI()
|
||||
{
|
||||
float sine = (float)Math.Sin(time * 0.13f / MathHelper.Pi);
|
||||
float sine2 = (float)Math.Sin(time * 0.13f / 2 / MathHelper.Pi);
|
||||
float rate = Main.GlobalTimeWrappedHourly * 2;
|
||||
List<Color> eColors = new List<Color>()
|
||||
{
|
||||
@@ -49,22 +55,41 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
bColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
|
||||
|
||||
xLerp = MathHelper.Lerp(xLerp, (30 + 10 * sine) * Math.Sign(aimVel.X), 0.05f);
|
||||
Projectile.Center = Owner.MountedCenter + new Vector2(xLerp, -25 + 12 * sine);
|
||||
Vector2 startPos = new Vector2(xLerp, -25 + 12 * sine);
|
||||
Vector2 endPos = new Vector2(40 * sine, -125 + 40 * sine2);
|
||||
goalPos = Vector2.Lerp(goalPos, fullPower ? endPos : startPos, 0.03f);
|
||||
Projectile.Center = Owner.MountedCenter + goalPos;
|
||||
Owner.direction = Math.Sign(aimVel.X);
|
||||
|
||||
if (Owner.HeldItem.type == ModContent.ItemType<RelicOfResilience>())
|
||||
if (!Owner.dead && (Owner.HeldItem.type == ModContent.ItemType<RelicOfResilience>() || (Owner.Calamity().rOfResilienceEffect >= Owner.Calamity().rOfResilienceBaseTimeMax)))
|
||||
Projectile.timeLeft++;
|
||||
else
|
||||
{
|
||||
Projectile.Kill();
|
||||
if (Owner.dead)
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((!fullPower && Owner.Calamity().rOfResilienceEffect >= Owner.Calamity().rOfResilienceBaseTimeMax) || (Owner.Calamity().rOfResilienceEffect >= Owner.Calamity().rOfResilienceMaxPowerTime && !maxPower))
|
||||
{
|
||||
if (fullPower)
|
||||
maxPower = true;
|
||||
SoundStyle sound = new("CalamityMod/Sounds/Item/HolyColliderSmallHit");
|
||||
SoundEngine.PlaySound(sound with { Volume = 0.85f, Pitch = maxPower ? 0.8f : 0.6f }, Projectile.Center);
|
||||
fullPower = true;
|
||||
}
|
||||
else if (Owner.Calamity().rOfResilienceEffect < Owner.Calamity().rOfResilienceBaseTimeMax)
|
||||
fullPower = false;
|
||||
if (Owner.Calamity().rOfResilienceEffect < Owner.Calamity().rOfResilienceMaxPowerTime)
|
||||
maxPower = false;
|
||||
|
||||
chargeScaling = MathHelper.Lerp(chargeScaling, maxPower ? 1.4f : fullPower ? 1.2f : 1, 0.02f);
|
||||
|
||||
// Emit some light
|
||||
Lighting.AddLight(Projectile.Center, Color.Goldenrod.ToVector3() * 1.5f);
|
||||
|
||||
rot2 = Math.Abs((float)Math.Sin(time * 0.15f / MathHelper.Pi) * 0.2f) + 0.8f;
|
||||
|
||||
if (time % 2 == 0 && false)
|
||||
if (time % 2 == 0 && maxPower)
|
||||
{
|
||||
Vector2 dustVel = new Vector2(15, 15).RotatedByRandom(100);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel, ModContent.DustType<LightDust>(), dustVel * Main.rand.NextFloat(0.1f, 0.4f));
|
||||
@@ -79,10 +104,12 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
float adjustedRot = aimVel.ToRotation();
|
||||
Projectile.rotation = Utils.AngleLerp(Projectile.rotation, adjustedRot + (MathHelper.ToRadians(90)), 0.05f);
|
||||
|
||||
float rot = Utils.DirectionFrom(Owner.Center, Projectile.Center).ToRotation() + (MathHelper.ToRadians(90));
|
||||
Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rot);
|
||||
Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, rot);
|
||||
|
||||
if (!fullPower || Owner.HeldItem.type == ModContent.ItemType<RelicOfResilience>())
|
||||
{
|
||||
float rot = Utils.DirectionFrom(Owner.Center, Projectile.Center).ToRotation() + (MathHelper.ToRadians(90));
|
||||
Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rot);
|
||||
Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, rot);
|
||||
}
|
||||
time++;
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
@@ -91,14 +118,15 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
Texture2D bTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
|
||||
Color drawColor = bColor;
|
||||
float CDScale = Utils.GetLerpValue(300, 0, Owner.Calamity().rOfResilienceCooldown, true);
|
||||
float overPowerScale = Utils.GetLerpValue(Owner.Calamity().rOfResilienceBaseTimeMax, Owner.Calamity().rOfResilienceMaxPowerTime, Owner.Calamity().rOfResilienceEffect, true);
|
||||
float bScale2 = 0.35f * (chargeScaling + overPowerScale * 0.5f);
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
for (int i = 0; i < (maxPower ? 6 : fullPower ? 4 : 2); i++)
|
||||
{
|
||||
float bScale2 = 0.55f;
|
||||
Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, 0, bTexture.Size() * 0.5f, (bScale2 - i * 0.15f) * rot2 * CDScale, SpriteEffects.None, 0);
|
||||
Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, i * 0.15f) with { A = 0 }, MathHelper.PiOver4 * (i % 2 == 0 ? 1 : -1), bTexture.Size() * 0.5f, new Vector2(1 - 0.4f * overPowerScale * (1 + i * 0.3f), 1 + 0.7f * overPowerScale * (1 + i * 0.3f)) * bScale2 * rot2 * CDScale, SpriteEffects.None, 0);
|
||||
}
|
||||
|
||||
Projectile.DrawProjectileWithBackglow(Color.OrangeRed with { A = 0 } * CDScale, Color.White, 3 * rot2 * CDScale, rTexture, null, Math.Sign(aimVel.X) < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
|
||||
Projectile.DrawProjectileWithBackglow(Color.OrangeRed with { A = 0 } * CDScale, Color.White, 3 * rot2 * CDScale * bScale2, rTexture, null, Math.Sign(aimVel.X) < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
|
||||
return false;
|
||||
}
|
||||
public override bool? CanDamage() => false;
|
||||
|
||||
Reference in new issue
Block a user