Merge: Forbidden Armor (Circlet) rework

This commit is contained in:
Cameron Ewell authored and GitHub committed 2025-08-08 18:59:36 -04:00
commit cfd99a40f9
11 files changed
+118 -135

No files matched your search

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.Summon.Whips
{
public class ForbiddenStealthSummonTagBuff : ModBuff
{
public override string Texture => "CalamityMod/Buffs/Summon/Whips/SentinalLash";
public override void SetStaticDefaults()
{
BuffID.Sets.IsATagBuff[Type] = true;
Main.debuff[Type] = true;
Main.buffNoSave[Type] = true;
}
}
}
+14 -7
View File
@@ -3914,7 +3914,7 @@ namespace CalamityMod.CalPlayer
SoundEngine.PlaySound(PlagueReaperMask.ActivationSound, Player.Center);
Player.AddCooldown(PlagueBlackout.ID, 1800);
}
if (forbiddenCirclet && forbiddenCooldown <= 0)
if (forbiddenCirclet && Player.ownedProjectileCounts[ModContent.ProjectileType<CircletTornado>()] < 2)
{
forbiddenCooldown = ForbiddenCirclet.StormCooldown;
int stormMana = (int)(ForbiddenCirclet.StormManaCost * Player.manaCost);
@@ -3927,7 +3927,7 @@ namespace CalamityMod.CalPlayer
}
if (Player.statMana >= stormMana && !Player.silence)
{
var source = Player.GetSource_Misc("1");
var source = Player.GetSource_ItemUse(ContentSamples.ItemsByType[ItemType<ForbiddenCirclet>()]);
Player.manaRegenDelay = (int)Player.maxRegenDelay;
Player.statMana -= stormMana;
@@ -3939,9 +3939,16 @@ namespace CalamityMod.CalPlayer
if (Player.whoAmI == Main.myPlayer)
{
int mark = Projectile.NewProjectile(source, Player.ClampedMouseWorld(), Vector2.Zero, ProjectileType<CircletMark>(), damage, kBack, Player.whoAmI);
if (mark.WithinBounds(Main.maxProjectiles))
Main.projectile[mark].DamageType = DamageClass.Generic;
if (Player.ownedProjectileCounts[ProjectileType<CircletTornado>()] > 0 )
{
foreach (var item in Main.ActiveProjectiles)
{
if (item.owner != Player.whoAmI || item.type != ProjectileType<CircletTornado>())
continue;
item.timeLeft = 60;
}
}
int mark = Projectile.NewProjectile(source, Player.ClampedMouseWorld(), Vector2.Zero, ProjectileType<CircletTornado>(), damage, kBack, Player.whoAmI);
}
}
}
@@ -5322,8 +5329,8 @@ namespace CalamityMod.CalPlayer
bool hasNonWeaponFunction = isPickaxe || isAxe || isHammer || isPlaced || isChannelable;
bool playerUsingWeapon = hasDamage && hasHitboxes && !hasNonWeaponFunction;
// The Gem Tech armor's rogue crystal ensures that stealth is not consumed by non-rogue items.
if ((it.IsAir || !it.CountsAsClass<RogueDamageClass>()) && GemTechSet && GemTechState.IsRedGemActive)
// The Gem Tech armor's rogue crystal ensures that stealth is not consumed by non-rogue items. Forbidden Circlet does this for summon weapons
if ((it.IsAir || (!it.CountsAsClass<RogueDamageClass>()) && GemTechSet && GemTechState.IsRedGemActive) || (it.CountsAsClass<SummonDamageClass>() && forbiddenCirclet))
playerUsingWeapon = false;
// Molten Amputator consumes stealth in a special way
-17
View File
@@ -4880,23 +4880,6 @@ namespace CalamityMod.CalPlayer
#region Limits
private void Limits()
{
// TODO -- what is Forbidden Circlet actually supposed to do?
if (forbiddenCirclet)
{
ref StatModifier summon = ref Player.GetDamage<SummonDamageClass>();
ref StatModifier rogue = ref Player.GetDamage<RogueDamageClass>();
float boostToSummonFromRogue = 0f;
float boostToRogueFromSummon = 0f;
if (summon.Additive < rogue.Additive)
boostToSummonFromRogue = rogue.Additive - summon.Additive;
if (rogue.Additive < summon.Additive)
boostToRogueFromSummon = summon.Additive - rogue.Additive;
summon += boostToSummonFromRogue;
rogue += boostToRogueFromSummon;
}
// 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50%
if (Player.endurance > 0f)
Player.endurance = 1f - (1f / (1f + Player.endurance));
+6 -15
View File
@@ -5,6 +5,7 @@ using CalamityMod.Balancing;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatBuffs;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Buffs.Summon.Whips;
using CalamityMod.Cooldowns;
using CalamityMod.Dusts;
using CalamityMod.Items.Accessories;
@@ -406,6 +407,11 @@ namespace CalamityMod.CalPlayer
globalProj.arcFlashCooldown = 30;
}
if (forbiddenCirclet && globalProj.stealthStrike)
{
target.AddBuff(ModContent.BuffType<ForbiddenStealthSummonTagBuff>(), 600);
}
if (!proj.npcProj && !proj.trap && proj.friendly)
{
if (plaguebringerCarapace && CalamityProjectileSets.IsFriendlyBeeProjectile[proj.type])
@@ -1104,21 +1110,6 @@ namespace CalamityMod.CalPlayer
rogueCrownCooldown = spawnedFeathers ? 15 : 60;
}
if (forbiddenCirclet && modProj.stealthStrike && forbiddenCooldown <= 0 && modProj.stealthStrikeHitCount < 3)
{
for (int index2 = 0; index2 < ForbiddenCirclet.EaterSpawnCount; index2++)
{
float xVector = Main.rand.NextFloat(-7f, 7f);
float yVector = Main.rand.NextFloat(-7f, 7f);
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(ForbiddenCirclet.EaterDamage);
int eater = Projectile.NewProjectile(spawnSource, proj.Center.X, proj.Center.Y, xVector, yVector, ProjectileType<ForbiddenCircletEater>(), damage, proj.knockBack, proj.owner);
if (eater.WithinBounds(Main.maxProjectiles))
Main.projectile[eater].DamageType = DamageClass.Generic;
forbiddenCooldown = ForbiddenCirclet.EaterSpawnCooldown;
}
}
if (titanHeartSet && modProj.stealthStrike && titanCooldown <= 0 && modProj.stealthStrikeHitCount < 3)
{
int damage = (int)Player.GetTotalDamage<RogueDamageClass>().ApplyTo(TitanHeartMask.ExplosionDamage);
+7
View File
@@ -113,6 +113,13 @@ namespace CalamityMod.DataStructures
critChance += TagCritChance;
modifiers.CritDamage += TagCritDamage;
}
/// <summary>
/// Blank tag damage functionality
/// </summary>
public static void BlankTagModifyHit(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers, ref float tagDamageMult, ref float critChance)
{
}
/// <summary>
/// Due to how Firecracker works, this allows it to work with crit accessories.
/// </summary>
+46 -2
View File
@@ -1,4 +1,8 @@
using CalamityMod.CalPlayer;
using CalamityMod.Buffs.Summon.Whips;
using CalamityMod.CalPlayer;
using CalamityMod.DataStructures;
using CalamityMod.Projectiles.Summon;
using CalamityMod.Systems.Collections;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
@@ -19,16 +23,48 @@ namespace CalamityMod.Items.Armor
public static float SetBonusRogueStealth = 0.4f;
public static int StormManaCost = 60;
public static int StormCooldown = 45;
public static int StormDamage = 80;
public static int StormDamage = 60;
public static float StormKB = 1f;
public static int EaterSpawnCount = 6;
public static int EaterSpawnCooldown = 15;
public static int EaterDamage = 40;
public static SummonTag summonTag = new SummonTag()
{
//These tag damage fields determine the damage of the spawned eater. The resulting number from each is added together
//So, 0.5 multiplicative and 10 flat would make the damage be 50% of the spawning hit's damage, plus 10 more.
//If you want entirely flt, set multiplicative to 0. If you want entirely multiplicative, set flat to 0.
MultiplicativeTagDamage = 0.25f,
FlatTagDamage = 5,
AllowsWhipStacking = true,
TagOnHit = tagOnHit,
TagModifyHitEffects = SummonTag.BlankTagModifyHit,
AutoDrawTooltip = false
};
public static void tagOnHit(NPC npc, Projectile projectile, NPC.HitInfo hit, int damageDone)
{
if (Main.rand.NextBool(5))
{
float xVector = Main.rand.Next(-35, 36) * 0.02f;
float yVector = Main.rand.Next(-35, 36) * 0.02f;
xVector *= 10f;
yVector *= 10f;
int damage = (int)Main.player[projectile.owner].GetBestClassDamage().ApplyTo(damageDone * summonTag.MultiplicativeTagDamage) + summonTag.FlatTagDamage;
Projectile.NewProjectile(projectile.GetSource_OnHit(npc), npc.Center.X, npc.Center.Y, xVector, yVector, ModContent.ProjectileType<ForbiddenCircletEater>(), damage, 3, projectile.owner);
}
}
public override void SetStaticDefaults()
{
if (!Main.dedServ)
ArmorIDs.Head.Sets.DrawFullHair[Item.headSlot] = true;
summonTag.TagItem = Type;
CalamityBuffSets.SummonTagDebuff.Add(ModContent.BuffType<ForbiddenStealthSummonTagBuff>(),summonTag);
}
public override void SetDefaults()
@@ -60,6 +96,14 @@ namespace CalamityMod.Items.Armor
modPlayer.wearingRogueArmor = true;
}
public string FormatHotkeyWithVanillaSupport(string hotkey)
{
if (hotkey == CalamityUtils.GetText("Misc.HotkeyNotBound").Value)
{
return CalamityUtils.GetText("Common.VanillaArmorSetBonus").Format(Language.GetTextValue(Main.ReversedUpDownArmorSetBonuses ? "Key.UP" : "Key.DOWN"));
}
return CalamityUtils.GetText("Common.CalamityArmorSetBonus").Format(hotkey);
}
public override void UpdateEquip(Player player)
{
player.GetDamage<SummonDamageClass>() += SummonDamageBoost;
@@ -1590,3 +1590,8 @@ PopoNoselessBuff: {
DisplayName: Noseless Popo
Description: Your nose has been stolen!
}
ForbiddenStealthSummonTagBuff: {
DisplayName: Forbidden Stealth Summon Tag Buff
Description: If you're seeing this, something went horribly wrong
}
@@ -184,8 +184,8 @@ ForbiddenCirclet: {
{$Common.RogueStealth}
{1} to call an ancient storm to the cursor location
The ancient storm costs {2} mana and benefits from both summon and rogue bonuses
Rogue stealth strikes spawn homing eaters on enemy hits
Rogue and summon attacks will scale off of the stat with a higher boost
Rogue stealth strikes will tag enemies, causing summons to spawn homing eaters on hit
Using summon weapons no longer reset your stealth
Minions no longer deal less damage while wielding rogue weapons
'''
}
+1 -1
View File
@@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Rogue
}
Projectile.velocity = Vector2.Zero;
Projectile.localAI[1] += 1f;
if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer)
if (Projectile.localAI[1] == 10f && Projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<CircletTornado>(), Projectile.damage, 2f, Projectile.owner, 0f, 0f);
}
+3 -37
View File
@@ -19,6 +19,7 @@ namespace CalamityMod.Projectiles.Rogue
Projectile.friendly = true;
Projectile.tileCollide = false;
Projectile.DamageType = RogueDamageClass.Instance;
Projectile.minion = true;
Projectile.penetrate = -1;
Projectile.timeLeft = 1200;
Projectile.usesLocalNPCImmunity = true;
@@ -29,33 +30,6 @@ namespace CalamityMod.Projectiles.Rogue
{
//only 1 tornado can exist at a time
Projectile.localAI[1] += 1f;
if (Projectile.localAI[1] >= 10f)
{
Projectile.localAI[1] = 0f;
int projCount = 0;
int oldestTornado = 0;
float tornadoAge = 0f;
int projType = Projectile.type;
for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++)
{
Projectile proj = Main.projectile[projIndex];
if (proj.active && proj.owner == Projectile.owner && proj.type == projType && proj.ai[0] < 900f)
{
projCount++;
if (proj.ai[0] > tornadoAge)
{
oldestTornado = projIndex;
tornadoAge = proj.ai[0];
}
}
}
if (projCount > 1)
{
Main.projectile[oldestTornado].netUpdate = true;
Main.projectile[oldestTornado].ai[0] = 36000f;
return;
}
}
float lifeSpan = 900f;
if (Projectile.soundDelay == 0)
@@ -64,10 +38,6 @@ namespace CalamityMod.Projectiles.Rogue
SoundEngine.PlaySound(SoundID.Item122, Projectile.Center);
}
Projectile.ai[0] += 1f;
if (Projectile.ai[0] >= lifeSpan)
{
Projectile.Kill();
}
if (Projectile.localAI[0] >= 30f)
{
Projectile.damage = 0;
@@ -113,14 +83,11 @@ namespace CalamityMod.Projectiles.Rogue
Projectile.netUpdate = true;
}
}
if (Projectile.ai[0] < lifeSpan - 120f)
{
return;
}
}
public override bool PreDraw(ref Color lightColor)
{
float OPACITY = MathHelper.Clamp(Projectile.timeLeft / 20f,0,1);
float aiTracker = Projectile.ai[0];
float trackerClamp = MathHelper.Clamp(aiTracker / 30f, 0f, 1f);
if (aiTracker > 540f)
@@ -163,12 +130,11 @@ namespace CalamityMod.Projectiles.Rogue
newSandYellow = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, sandYellow, 2f - colorChanger * 2f);
}
newSandYellow.A = (byte)((float)newSandYellow.A * 0.5f);
newSandYellow *= trackerClamp;
spinArea *= colorChangeVector * 100f;
spinArea.Y = 0f;
spinArea.X = 0f;
spinArea += new Vector2(sizeModdingVector2.X, k) - Main.screenPosition;
Main.spriteBatch.Draw(texture2D23, spinArea, new Microsoft.Xna.Framework.Rectangle?(drawRectangle), newSandYellow, aiTrackMult + incStorageMult, smallRect, 1f + lowerColorChanger, SpriteEffects.None, 0);
Main.spriteBatch.Draw(texture2D23, spinArea, new Microsoft.Xna.Framework.Rectangle?(drawRectangle), newSandYellow * OPACITY, aiTrackMult + incStorageMult, smallRect, 1f + lowerColorChanger, SpriteEffects.None, 0);
}
return false;
}
+11 -54
View File
@@ -15,6 +15,7 @@ namespace CalamityMod.Projectiles.Summon
{
Main.projFrames[Type] = 4;
ProjectileID.Sets.CultistIsResistantTo[Type] = true;
ProjectileID.Sets.MinionShot[Type] = true; //This marks it as a minion shot, which allows it to proc summon tag effects.
}
public override void SetDefaults()
@@ -70,6 +71,8 @@ namespace CalamityMod.Projectiles.Summon
float attackDistance = 100000f;
bool canAttack = false;
Projectile.ai[0] += 1f;
NPC target = null;
if (Projectile.ai[0] > 30f)
{
if (player.HasMinionAttackTargetNPC)
@@ -82,14 +85,11 @@ namespace CalamityMod.Projectiles.Summon
float npcDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcY);
if (npcDist < 640f && npcDist < attackDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height))
{
attackDistance = npcDist;
projX = npcX;
projY = npcY;
canAttack = true;
target = npc;
}
}
}
if (!canAttack)
if (target.IsNullOrInactive())
{
foreach (NPC npc in Main.ActiveNPCs)
{
@@ -100,60 +100,17 @@ namespace CalamityMod.Projectiles.Summon
float npcDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcY);
if (npcDist < 640f && npcDist < attackDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height))
{
attackDistance = npcDist;
projX = npcX;
projY = npcY;
canAttack = true;
target = npc;
}
}
}
}
}
if (!canAttack)
{
projX = Projectile.position.X + (float)(Projectile.width / 2) + Projectile.velocity.X * 100f;
projY = Projectile.position.Y + (float)(Projectile.height / 2) + Projectile.velocity.Y * 100f;
}
float projVel = 0.16f;
Vector2 playerDirection = Projectile.Center;
float playerX = projX - playerDirection.X;
float playerY = projY - playerDirection.Y;
float playerDist = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY));
playerDist = 10f / playerDist;
playerX *= playerDist;
playerY *= playerDist;
if (Projectile.velocity.X < playerX)
{
Projectile.velocity.X = Projectile.velocity.X + projVel;
if (Projectile.velocity.X < 0f && playerX > 0f)
{
Projectile.velocity.X = Projectile.velocity.X + projVel * 2f;
}
}
else if (Projectile.velocity.X > playerX)
{
Projectile.velocity.X = Projectile.velocity.X - projVel;
if (Projectile.velocity.X > 0f && playerX < 0f)
{
Projectile.velocity.X = Projectile.velocity.X - projVel * 2f;
}
}
if (Projectile.velocity.Y < playerY)
{
Projectile.velocity.Y = Projectile.velocity.Y + projVel;
if (Projectile.velocity.Y < 0f && playerY > 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y + projVel * 2f;
}
}
else if (Projectile.velocity.Y > playerY)
{
Projectile.velocity.Y = Projectile.velocity.Y - projVel;
if (Projectile.velocity.Y > 0f && playerY < 0f)
{
Projectile.velocity.Y = Projectile.velocity.Y - projVel * 2f;
}
}
if (!target.IsNullOrInactive())
Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.DirectionTo(target.Center) * 15, 0.1f);
else
Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.velocity.SafeNormalize(Vector2.Zero) * 15, 0.1f);
}
public override bool OnTileCollide(Vector2 oldVelocity)