Start of Crowns

This commit is contained in:
sunny-raindrops committed 2025-09-30 17:43:08 -07:00
1 parent ec0ac7146a
commit 39ef5e6809
10 files changed
+347 -95

No files matched your search

+17 -2
View File
@@ -1032,7 +1032,8 @@ namespace CalamityMod.CalPlayer
public bool eclipseMirror = false;
public bool featherCrown = false;
public bool moonCrown = false;
public int rogueCrownCooldown = 0;
public int mageCrownTimer = 0;
public int mageCrownCount = 0;
public bool dragonScales = false;
public bool gloveOfPrecision = false;
public bool gloveOfRecklessness = false;
@@ -2937,7 +2938,7 @@ namespace CalamityMod.CalPlayer
andromedaCripple = 0;
theBeeCooldown = 0;
scuttlerCooldown = 0;
rogueCrownCooldown = 0;
mageCrownTimer = 0;
wingProjectileCooldown = 0;
hallowedRuneCooldown = 0;
sulphurBubbleCooldown = 0;
@@ -5733,6 +5734,20 @@ namespace CalamityMod.CalPlayer
}
}
}
//For when the player runs out of mana
if (Player.statMana <= manaConsumed || Player.statMana <= 6)
{
if (moonCrown && mageCrownCount > 0)
{
SoundStyle fire = new("CalamityMod/Sounds/Item/CursedDaggerThrow");
SoundEngine.PlaySound(fire with { Volume = 0.9f, Pitch = 0.9f, PitchVariance = 0.2f, MaxInstances = -1 }, Player.Center);
mageCrownCount -= 5;
if (mageCrownCount < 0)
{
mageCrownCount = 0;
}
}
}
}
#endregion
+41 -3
View File
@@ -74,6 +74,7 @@ using CalamityMod.World;
using Microsoft.CodeAnalysis;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Mono.Cecil;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
@@ -1962,6 +1963,46 @@ namespace CalamityMod.CalPlayer
if (Player.velocity.Length() < 6)
hookPullVisuals = 0;
}
if (featherCrown && !moonCrown)
{
int SpawnTimer = 120;
int MaxSigils = 4;
if (mageCrownTimer >= SpawnTimer)
{
if (mageCrownCount <= MaxSigils)
{
Main.NewText(mageCrownCount);
mageCrownCount += 1;
float start = 360f / mageCrownCount;
Projectile.NewProjectile(Player.GetSource_FromThis(), new Vector2((int)(Player.Center.X + (Math.Sin(0 * start) * 300)), (int)(Player.Center.Y + (Math.Cos(0 * start) * 300))), Vector2.Zero, ModContent.ProjectileType<SpectralFeather>(), 0, 0, Player.whoAmI, 0, mageCrownCount);
}
mageCrownTimer = 0;
}
else if (!Player.dead)
{
mageCrownTimer++;
}
}
if (moonCrown)
{
int SpawnTimer = 120;
int MaxSigils = 9; //Starts at 0, so cap is 10
if (mageCrownTimer >= SpawnTimer)
{
if (mageCrownCount <= MaxSigils)
{
Main.NewText(mageCrownCount);
mageCrownCount += 1;
float start = 360f / mageCrownCount;
Projectile.NewProjectile(Player.GetSource_FromThis(), new Vector2((int)(Player.Center.X + (Math.Sin(0 * start) * 300)), (int)(Player.Center.Y + (Math.Cos(0 * start) * 300))), Vector2.Zero, ModContent.ProjectileType<MoonSigil>(), 0, 0, Player.whoAmI, 0, mageCrownCount);
}
mageCrownTimer = 0;
}
else if (!Player.dead)
{
mageCrownTimer++;
}
}
if (unstableGraniteCore)
{
@@ -2157,8 +2198,6 @@ namespace CalamityMod.CalPlayer
silvaMageCooldown--;
if (scuttlerCooldown > 0)
scuttlerCooldown--;
if (rogueCrownCooldown > 0)
rogueCrownCooldown--;
if (spectralVeilImmunity > 0)
spectralVeilImmunity--;
if (jetPackDash > 0)
@@ -4501,7 +4540,6 @@ namespace CalamityMod.CalPlayer
}
#endregion
#region Energy Shields
private void EnergyShields()
{
+7 -50
View File
@@ -1062,56 +1062,6 @@ namespace CalamityMod.CalPlayer
}
}
if (modProj.stealthStrike && rogueCrownCooldown <= 0 && modProj.stealthStrikeHitCount < 3)
{
bool spawnedFeathers = false;
if (nanotech)
{
for (int i = 0; i < 3; i++)
{
Vector2 source = new Vector2(position.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50));
Vector2 velocity = (position - source) / 40f;
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(110);
Projectile.NewProjectile(spawnSource, source, velocity, ProjectileType<NanoFlare>(), damage, 3f, proj.owner);
}
}
else if (moonCrown)
{
int lunarFlareDamage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(MoonstoneCrown.BaseDamage);
float lunarFlareKB = 3f;
for (int i = 0; i < 3; i++)
{
Vector2 source = new Vector2(position.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50));
Vector2 velocity = (position - source) / 10f;
int flare = Projectile.NewProjectile(spawnSource, source, velocity, ProjectileID.LunarFlare, lunarFlareDamage, lunarFlareKB, proj.owner);
if (flare.WithinBounds(Main.maxProjectiles))
Main.projectile[flare].DamageType = DamageClass.Generic;
}
}
else if (featherCrown)
{
for (int i = 0; i < 3; i++)
{
Vector2 source = new Vector2(position.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50));
float speedX = (position.X - source.X) / 30f;
float speedY = (position.Y - source.Y) * 8;
Vector2 velocity = new Vector2(speedX, speedY);
int featherDamage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(25);
int feather = Projectile.NewProjectile(spawnSource, source, velocity, ProjectileType<StickyFeather>(), featherDamage, 3f, proj.owner);
if (feather.WithinBounds(Main.maxProjectiles))
{
Main.projectile[feather].DamageType = DamageClass.Generic;
Main.projectile[feather].extraUpdates += 3;
}
}
spawnedFeathers = true;
}
rogueCrownCooldown = spawnedFeathers ? 15 : 60;
}
if (titanHeartSet && modProj.stealthStrike && titanCooldown <= 0 && modProj.stealthStrikeHitCount < 3)
{
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(TitanHeartMask.ExplosionDamage);
@@ -1224,6 +1174,13 @@ namespace CalamityMod.CalPlayer
target.AddBuff(BuffType<AstralInfectionDebuff>(), TitanHeartMask.OnHitDebuffDuration);
}
}
if (magic)
{
if (moonCrown && mageCrownCount >= 10)
{
target.AddBuff(BuffType<Nightwither>(), 360);
}
}
if (summon)
{
if (pSoulArtifact && !profanedCrystal)
+7 -1
View File
@@ -32,8 +32,14 @@ namespace CalamityMod.Items.Accessories
public override void UpdateAccessory(Player player, bool hideVisual)
{
CalamityPlayer modPlayer = player.Calamity();
modPlayer.rogueVelocity += 0.15f;
modPlayer.featherCrown = true;
player.GetDamage<MagicDamageClass>() += (0.02f * modPlayer.mageCrownCount); //2% per feather, up to 10%
player.manaCost -= (0.01f * modPlayer.mageCrownCount); //1% per feather, up to 5%
if (modPlayer.mageCrownCount == 5)
{
player.manaCost -= 0.05f;
player.GetCritChance<MagicDamageClass>() += 5;
}
}
public override void AddRecipes()
+11 -4
View File
@@ -10,12 +10,9 @@ namespace CalamityMod.Items.Accessories
public class MoonstoneCrown : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Accessories";
// Base damage of lunar flares on stealth strikes. Increased by rogue damage stats, but not stealth damage.
internal static int BaseDamage = 75;
public override void SetStaticDefaults()
{
if (!Main.dedServ)
{
int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face);
@@ -35,8 +32,18 @@ namespace CalamityMod.Items.Accessories
public override void UpdateAccessory(Player player, bool hideVisual)
{
CalamityPlayer modPlayer = player.Calamity();
modPlayer.rogueVelocity += 0.15f;
modPlayer.moonCrown = true;
player.statManaMax2 += 70;
player.GetDamage<MagicDamageClass>() += (0.02f * modPlayer.mageCrownCount); //2% per moon sigil, up to 20%
player.manaCost -= (0.01f * modPlayer.mageCrownCount); //1% per moon sigil, up to 10%
if (modPlayer.mageCrownCount >= 4) //I know this looks weird but the count starts at 0
{
player.manaRegenBonus += 10;
}
if (modPlayer.mageCrownCount == 9)
{
player.GetCritChance<MagicDamageClass>() += 10;
}
}
public override void AddRecipes()
+10
View File
@@ -696,6 +696,16 @@ namespace CalamityMod.Items
}
}
//Mana Potion interactions
if (item.healMana > 0)
{
//If mana potion used, kill
if (modPlayer.moonCrown || modPlayer.featherCrown)
{
//modPlayer.mageCrownCount = 0;
}
}
// Staff/Axe of Regrowth growing Calamity grass
if (item.type == ItemID.StaffofRegrowth || item.type == ItemID.AcornAxe)
{
@@ -1112,7 +1112,7 @@ ManaPolarizer: {
DisplayName: Mana Polarizer
Tooltip:
'''
Increases max mana by 50
Increases maximum mana by 50
Provides life regeneration and magic damage that scales based on how much mana you have
Lower mana means more life regeneration, but less magic damage
These scale from -2 to 2 HP/sec, and 5% to 15% damage
@@ -1144,9 +1144,12 @@ MoonstoneCrown: {
DisplayName: Moonstone Crown
Tooltip:
'''
15% increased rogue projectile velocity
Stealth strikes release lunar flares on enemy hits
Rogue projectiles summon homing moon sigils as they travel
+70 max mana
Summons a Lunar Sigil every 2 seconds, up to a maximum of 10
Each Lunar Sigil increases magic damage by 2% and reduces mana cost by 1%
Having 5 sigils increases mana regeneration by +5 MP/s
Having 10 sigils increases magic critical strike chance by 10% and all magic attacks inflict Nightwither
Running out of mana removes 5 sigils
'''
}
@@ -263,6 +263,5 @@ WyvernProjectile.DisplayName: Wyvern
YharimsCrystalBeam.DisplayName: Yharim's Beam
YharimsCrystalPrism.DisplayName: Yermes Christal
FleshTotemMinion.DisplayName: Flesh Totem Minion
SylvBolt.DisplayName: Sylv Bolt
SylvRay.DisplayName: Sylv Ray
FleshTotemSoul.DisplayName: Flesh Totem Soul
SpectralFeather.DisplayName: Spectral Feather
+148
View File
@@ -0,0 +1,148 @@
using System;
using System.Collections.Generic;
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class SpectralFeather : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Magic";
public override string Texture => "CalamityMod/Projectiles/Magic/StickyFeather";
public override void SetDefaults()
{
Projectile.width = 10;
Projectile.height = 10;
Projectile.scale = 0.8f;
Projectile.friendly = true;
Projectile.penetrate = -1;
Projectile.ignoreWater = true;
Projectile.timeLeft = 18000;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.extraUpdates = 1;
}
public override void AI()
{
bool isActive = Projectile.type == ModContent.ProjectileType<SpectralFeather>();
Player player = Main.player[Projectile.owner];
CalamityPlayer modPlayer = player.Calamity();
if (!modPlayer.featherCrown)
{
Projectile.active = false;
modPlayer.mageCrownTimer = 0;
modPlayer.mageCrownCount = 0;
return;
}
if (isActive)
{
if (player.dead)
{
modPlayer.featherCrown = false;
}
if (modPlayer.featherCrown)
{
Projectile.timeLeft = 2;
}
}
Projectile.rotation += MathHelper.ToRadians(1.3f);
int cap = modPlayer.mageCrownCount;
int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Type] - cap;
if (excessCount > cap)
{
Projectile.Kill();
}
int feathers = 0;
int featherAmt = 0;
for (int i = 0; i < Main.maxProjectiles; i++)
{
if (Main.projectile[i].active && Main.projectile[i].owner == Projectile.owner && Main.projectile[i].type == Projectile.type)
{
if (Main.projectile[i] == Projectile)
{
feathers = featherAmt;
}
featherAmt++;
}
}
float f = ((float)feathers / (float)featherAmt + player.miscCounterNormalized * 2f) * ((float)Math.PI * 2f);
float num = 18f + (float)featherAmt;
Vector2 vector = player.position - player.oldPosition;
base.Projectile.Center += vector;
Vector2 vector2 = f.ToRotationVector2();
Projectile.localAI[0] = vector2.Y;
Vector2 value = (player.Center + new Vector2(0f, -25f)) + vector2 * new Vector2(1f, 0.05f) * num;
base.Projectile.Center = value;
if (!Projectile.FinalExtraUpdate())
return;
// Give off some light
float lightScalar = Main.rand.NextFloat(0.9f, 1.1f) * Main.essScale;
Lighting.AddLight(Projectile.Center, 0.3f * lightScalar, 0.26f * lightScalar, 0.15f * lightScalar);
Vector2 direction = player.Center - Projectile.Center;
direction.Normalize();
direction *= 6f;
if (direction.X >= 0.25f)
{
Projectile.direction = -1;
}
else if (direction.X < -0.25f)
{
Projectile.direction = 1;
}
Projectile.spriteDirection = Projectile.direction;
}
public override void OnKill(int timeLeft)
{
float dustSp = 0.2f;
int dustD = 0;
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 5; j++)
{
Vector2 dustspeed = new Vector2(dustSp, dustSp).RotatedBy(MathHelper.ToRadians(dustD));
int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.Smoke, dustspeed.X, dustspeed.Y, 200, new Color(213, 242, 232, 200), 1f);
Main.dust[d].noGravity = true;
Main.dust[d].position = Projectile.Center;
Main.dust[d].velocity = dustspeed;
dustSp += 0.2f;
}
dustD += 90;
dustSp = 0.2f;
}
}
public override void DrawBehind(int index, List<int> behindNPCsAndTiles, List<int> behindNPCs, List<int> behindProjectiles, List<int> overPlayers, List<int> overWiresUI)
{
if (Projectile.localAI[0] < 0)
{
overPlayers.Add(index);
}
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
Player player = Main.player[Projectile.owner];
CalamityPlayer modPlayer = player.Calamity();
if (modPlayer.mageCrownCount == 5)
{
for (int i = 0; i < 6; i++)
{
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, (Color.Teal * 0.5f) with { A = 0 }, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale * 1.01f, SpriteEffects.None, 0f);
}
}
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale * 0.9f, SpriteEffects.None, 0);
return false;
}
public override bool? CanDamage() => false;
}
}
+98 -29
View File
@@ -1,4 +1,7 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
@@ -9,46 +12,93 @@ namespace CalamityMod.Projectiles.Rogue
public class MoonSigil : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Rogue";
public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true;
public override void SetDefaults()
{
Projectile.width = 20;
Projectile.height = 20;
Projectile.scale = 0.9f;
Projectile.friendly = true;
Projectile.penetrate = 2;
Projectile.penetrate = -1;
Projectile.ignoreWater = true;
Projectile.timeLeft = 250;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.DamageType = RogueDamageClass.Instance;
Projectile.timeLeft = 18000;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.extraUpdates = 1;
}
public override void AI()
{
if (Projectile.timeLeft < 52)
bool isActive = Projectile.type == ModContent.ProjectileType<MoonSigil>();
Player player = Main.player[Projectile.owner];
CalamityPlayer modPlayer = player.Calamity();
if (!modPlayer.moonCrown)
{
Projectile.alpha += 5;
Projectile.scale -= 0.013f;
}
if (Projectile.alpha >= 255)
{
Projectile.alpha = 255;
Projectile.Kill();
Projectile.active = false;
modPlayer.mageCrownCount = 0;
return;
}
if (isActive)
{
if (player.dead)
{
modPlayer.moonCrown = false;
}
if (modPlayer.moonCrown)
{
Projectile.timeLeft = 2;
}
}
Projectile.rotation += MathHelper.ToRadians(1.3f);
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 300f, 8f, 20f);
}
// Reduce damage of projectiles if more than the cap are active
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
int cap = 5;
float capDamageFactor = 0.05f;
int cap = modPlayer.mageCrownCount;
int excessCount = Main.player[Projectile.owner].ownedProjectileCounts[Type] - cap;
modifiers.SourceDamage *= MathHelper.Clamp(1f - (capDamageFactor * excessCount), 0f, 1f);
}
if (excessCount > cap)
{
Projectile.Kill();
}
int sigils = 0;
int sigilAmt = 0;
for (int i = 0; i < Main.maxProjectiles; i++)
{
if (Main.projectile[i].active && Main.projectile[i].owner == Projectile.owner && Main.projectile[i].type == Projectile.type)
{
if (Main.projectile[i] == Projectile)
{
sigils = sigilAmt;
}
sigilAmt++;
}
}
float f = ((float)sigils / (float)sigilAmt + player.miscCounterNormalized * 2f) * ((float)Math.PI * 2f);
float num = 24f + (float)sigilAmt * 4.5f;
Vector2 vector = player.position - player.oldPosition;
base.Projectile.Center += vector;
Vector2 vector2 = f.ToRotationVector2();
Projectile.localAI[0] = vector2.Y;
Vector2 value = (player.Center + new Vector2(0f, 5f)) + vector2 * new Vector2(1f, 0.05f) * num;
base.Projectile.Center = value;
if (!Projectile.FinalExtraUpdate())
return;
// Give off some light
float lightScalar = Main.rand.NextFloat(0.9f, 1.1f) * Main.essScale;
Lighting.AddLight(Projectile.Center, 0.3f * lightScalar, 0.26f * lightScalar, 0.15f * lightScalar);
Vector2 direction = player.Center - Projectile.Center;
direction.Normalize();
direction *= 6f;
if (direction.X >= 0.25f)
{
Projectile.direction = -1;
}
else if (direction.X < -0.25f)
{
Projectile.direction = 1;
}
Projectile.spriteDirection = Projectile.direction;
}
public override void OnKill(int timeLeft)
{
float dustSp = 0.2f;
@@ -68,10 +118,27 @@ namespace CalamityMod.Projectiles.Rogue
dustSp = 0.2f;
}
}
public override void PostDraw(Color lightColor)
public override void DrawBehind(int index, List<int> behindNPCsAndTiles, List<int> behindNPCs, List<int> behindProjectiles, List<int> overPlayers, List<int> overWiresUI)
{
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Rogue/MoonSigil").Value;
if (Projectile.localAI[0] < 0)
{
overPlayers.Add(index);
}
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
Player player = Main.player[Projectile.owner];
CalamityPlayer modPlayer = player.Calamity();
if (modPlayer.mageCrownCount >= 10)
{
for (int i = 0; i < 6; i++)
{
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, (Color.Teal * 0.5f) with { A = 0 }, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale * 1.1f, SpriteEffects.None, 0f);
}
}
Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale * 0.9f, SpriteEffects.None, 0);
Main.spriteBatch.Draw
(
texture,
@@ -84,10 +151,12 @@ namespace CalamityMod.Projectiles.Rogue
Color.White,
Projectile.rotation,
new Vector2(10, 10),
Projectile.scale,
Projectile.scale * 0.9f,
SpriteEffects.None,
0f
);
return false;
}
public override bool? CanDamage() => false;
}
}