Viral Sprout & Debuff Tweaks

- Sage Poison actually does damage now
- Sage Poison scales linearly instead of the odd "nearly linear" formula before
- Sage Poison is now Sickness, but only gets 25% of the effect of Weaknesses or Resistances
- Irradiated, Wet, Chilled, Slimed debuff multipliers are applied *before* weakness/resistance multipliers instead of after for consistency with other debuff multipliers
- Other misc code cleanup with no gameplay effects
This commit is contained in:
Doze-Zoze committed 2025-09-15 11:57:25 -05:00
1 parent 1064e48691
commit 9312eaa13a
3 files changed
+74 -64

No files matched your search

+29 -3
View File
@@ -1,4 +1,7 @@
using CalamityMod.DataStructures;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.DataStructures;
using CalamityMod.NPCs;
using CalamityMod.Systems.Collections;
using Terraria;
using Terraria.ModLoader;
@@ -9,14 +12,36 @@ namespace CalamityMod.Buffs.DamageOverTime
public static DebuffData debuffData = new DebuffData()
{
EnemyLostRegen = 50,
SicknessDebuffScaling = 1,
NPCLifeRegenMethod = SagePoisonPower
};
public static void SagePoisonPower(NPC npc, int buffType, ref int buffIndex, ref int damage)
{
// The dot ia multipliplied by this before being applied:
// The base DoT has this formula used when it's applied
// (float)(Math.Pow(totalSageSpirits, 0.9D) + Math.Pow(totalSageSpirits, 1.13D)) * 0.5f;
// See SageNeedle.cs for details
int baseSagePoisonDoTValue = (int)npc.Calamity().ActiveTypelessDebuffMultiplier.ApplyTo(npc.Calamity().sagePoisonDamage);
//Reduce power of weakness/resistances but leave sickness debuff boosters at full power
//We first need to apply Irradiated as that isn't included in SicknessDebuffMultiplier due to needing to dynamically update if Irradiated is applied
StatModifier multiplier = npc.Calamity().SicknessDebuffMultiplier;
if (npc.Calamity().irradiated)
multiplier += npc.Calamity().scionsCurioEffected ? 1.75f : 1f;
bool wormBoss = CalamityNPCTypeSets.DesertScourge.Contains(npc.type) || CalamityNPCTypeSets.EaterOfWorlds.Contains(npc.type) || CalamityNPCTypeSets.Perforators.Contains(npc.type) ||
CalamityNPCTypeSets.AquaticScourge.Contains(npc.type) || CalamityNPCTypeSets.AstrumDeus.Contains(npc.type) || CalamityNPCTypeSets.StormWeaver.Contains(npc.type);
float NewWeaknessEffectiveness = 1.25f; //1.25x DPS instead of 2x - 1/4th the effectiveness
float NewWeaknessEffectivenessWorm = 1.125f; //1.125x DPS instead of 1.5x - 1/4th the effectiveness
float NewResistanceEffectiveness = 0.875f; // 0.875x instead of 0.5x - 1/4th the effectiveness
if (npc.Calamity().VulnerableToSickness.HasValue)
if (npc.Calamity().VulnerableToSickness.Value)
multiplier *= (wormBoss ? NewWeaknessEffectivenessWorm : NewWeaknessEffectiveness);
else
multiplier *= NewResistanceEffectiveness;
//Apply the DOT
int baseSagePoisonDoTValue = (int)multiplier.ApplyTo(npc.Calamity().sagePoisonDamage);
Main.NewText(baseSagePoisonDoTValue);
npc.Calamity().ApplyDPSDebuff(baseSagePoisonDoTValue, baseSagePoisonDoTValue / 5, ref npc.lifeRegen, ref damage);
}
public override void SetStaticDefaults()
@@ -24,6 +49,7 @@ namespace CalamityMod.Buffs.DamageOverTime
Main.debuff[Type] = true;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = true;
BuffDatasets.DebuffDataset[Type] = debuffData;
}
public override void Update(NPC npc, ref int buffIndex)
{
+44 -48
View File
@@ -925,48 +925,13 @@ namespace CalamityMod.NPCs
bool wormBoss = CalamityNPCTypeSets.DesertScourge.Contains(npc.type) || CalamityNPCTypeSets.EaterOfWorlds.Contains(npc.type) || CalamityNPCTypeSets.Perforators.Contains(npc.type) ||
CalamityNPCTypeSets.AquaticScourge.Contains(npc.type) || CalamityNPCTypeSets.AstrumDeus.Contains(npc.type) || CalamityNPCTypeSets.StormWeaver.Contains(npc.type);
bool slimeGod = CalamityNPCTypeSets.SlimeGod.Contains(npc.type);
ActiveHeatDebuffMultiplier = HeatDebuffMultiplier;
if (VulnerableToHeat.HasValue)
{
if (VulnerableToHeat.Value)
ActiveHeatDebuffMultiplier *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult;
else
ActiveHeatDebuffMultiplier *= ResistantToDoTDamageMult;
}
ActiveColdDebuffMultiplier = ColdDebuffMultiplier;
if (VulnerableToCold.HasValue)
{
if (VulnerableToCold.Value)
ActiveColdDebuffMultiplier *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult;
else
ActiveColdDebuffMultiplier *= ResistantToDoTDamageMult;
}
ActiveSicknessDebuffMultiplier = SicknessDebuffMultiplier;
if (VulnerableToSickness.HasValue)
{
if (VulnerableToSickness.Value)
ActiveSicknessDebuffMultiplier *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult;
else
ActiveSicknessDebuffMultiplier *= ResistantToDoTDamageMult;
}
ActiveElectricDebuffMultiplier = ElectricDebuffMultiplier;
if (VulnerableToElectricity.HasValue)
{
if (VulnerableToElectricity.Value)
ActiveElectricDebuffMultiplier *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult;
else
ActiveElectricDebuffMultiplier *= ResistantToDoTDamageMult;
}
ActiveWaterDebuffMultiplier = WaterDebuffMultiplier;
if (VulnerableToWater.HasValue)
{
if (VulnerableToWater.Value)
ActiveWaterDebuffMultiplier *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult;
else
ActiveWaterDebuffMultiplier *= ResistantToDoTDamageMult;
}
if (irradiated)
{
@@ -993,11 +958,48 @@ namespace CalamityMod.NPCs
{
ActiveWaterDebuffMultiplier += 1;
}
if (VulnerableToHeat.HasValue)
{
if (VulnerableToHeat.Value)
ActiveHeatDebuffMultiplier *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult;
else
ActiveHeatDebuffMultiplier *= ResistantToDoTDamageMult;
}
if (VulnerableToCold.HasValue)
{
if (VulnerableToCold.Value)
ActiveColdDebuffMultiplier *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult;
else
ActiveColdDebuffMultiplier *= ResistantToDoTDamageMult;
}
if (VulnerableToSickness.HasValue)
{
if (VulnerableToSickness.Value)
ActiveSicknessDebuffMultiplier *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult;
else
ActiveSicknessDebuffMultiplier *= ResistantToDoTDamageMult;
}
if (VulnerableToElectricity.HasValue)
{
if (VulnerableToElectricity.Value)
ActiveElectricDebuffMultiplier *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult;
else
ActiveElectricDebuffMultiplier *= ResistantToDoTDamageMult;
}
if (VulnerableToWater.HasValue)
{
if (VulnerableToWater.Value)
ActiveWaterDebuffMultiplier *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult;
else
ActiveWaterDebuffMultiplier *= ResistantToDoTDamageMult;
}
#endregion
// Oiled
bool hasModHotOil = false;
//Apply DoT Debuffs
for (var index = 0; index < npc.buffType.Count(); index++)
{
var type = npc.buffType[index];
@@ -1008,23 +1010,17 @@ namespace CalamityMod.NPCs
if (debuffData.HeatDebuffScaling > 0)
hasModHotOil = true;
}
//Oiled comes after so that we can detect if they have a heat debuff
bool hasColdOil = npc.onFrostBurn || npc.onFrostBurn2;
bool hasHotOil = npc.onFire || npc.onFire2 || npc.onFire3 || npc.shadowFlame;
//Oiled comes after so that we can detect if they have a heat debuff in the above loop
bool hasVanillaOil = npc.onFrostBurn || npc.onFrostBurn2 || npc.onFire || npc.onFire2 || npc.onFire3 || npc.shadowFlame;
if (npc.oiled)
{
var oil = DebuffData.Oiled;
int index = npc.FindBuffIndex(BuffID.Oiled);
if (hasHotOil || hasColdOil)
if (hasVanillaOil)
npc.lifeRegen -= oil.EnemyVanillaRegenToCancelOut;
oil.NPCLifeRegenMethod(npc, BuffID.Oiled, ref index, ref damage);
}
if (npc.dryadBane)
{
}
// Debuffs that aren't affected by weaknesses or resistances.
if (somaShredStacks > 0)
Shred.TickDebuff(npc, this);
+1 -13
View File
@@ -36,19 +36,7 @@ namespace CalamityMod.Projectiles.Summon
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
int totalSageSpirits = Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType<SageSpirit>()];
// A slightly-smoothened curve that's a little less potent than a linear curve.
// Has the potential to eventually surpass a linear curve, but this is infeasible, only happening
// at around 344 allocated slots.
float averageDamageMultiplier = (float)(Math.Pow(totalSageSpirits, 0.9D) + Math.Pow(totalSageSpirits, 1.13D)) * 0.5f;
// 1 slot provides 25 DoT.
// 2 slots provide 50 DoT.
// 3 slots provide 76 DoT.
// [...]
// 9 slots provide 240 DoT.
int sagePoisonDamage = (int)(SagePoison.debuffData.EnemyLostRegen * averageDamageMultiplier);
int sagePoisonDamage = (int)(SagePoison.debuffData.EnemyLostRegen * Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType<SageSpirit>()]);
target.AddBuff(ModContent.BuffType<SagePoison>(), 300);
target.Calamity().sagePoisonDamage = sagePoisonDamage;
}