using CalamityMod.Buffs;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.Placeables;
using CalamityMod.Buffs.StatBuffs;
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.CalPlayer;
using CalamityMod.Dusts;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Ammo;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Pets;
using CalamityMod.Items.Placeables.Walls;
using CalamityMod.Items.SummonItems;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.NPCs.Abyss;
using CalamityMod.NPCs.AquaticScourge;
using CalamityMod.NPCs.AstrumAureus;
using CalamityMod.NPCs.AstrumDeus;
using CalamityMod.NPCs.BrimstoneElemental;
using CalamityMod.NPCs.Bumblebirb;
using CalamityMod.NPCs.Calamitas;
using CalamityMod.NPCs.CeaselessVoid;
using CalamityMod.NPCs.Crabulon;
using CalamityMod.NPCs.Cryogen;
using CalamityMod.NPCs.DesertScourge;
using CalamityMod.NPCs.DevourerofGods;
using CalamityMod.NPCs.HiveMind;
using CalamityMod.NPCs.Leviathan;
using CalamityMod.NPCs.NormalNPCs;
using CalamityMod.NPCs.Perforator;
using CalamityMod.NPCs.PlaguebringerGoliath;
using CalamityMod.NPCs.Polterghast;
using CalamityMod.NPCs.ProfanedGuardians;
using CalamityMod.NPCs.Providence;
using CalamityMod.NPCs.Ravager;
using CalamityMod.NPCs.Signus;
using CalamityMod.NPCs.SlimeGod;
using CalamityMod.NPCs.StormWeaver;
using CalamityMod.NPCs.SupremeCalamitas;
using CalamityMod.NPCs.TownNPCs;
using CalamityMod.NPCs.Yharon;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Projectiles.Melee;
using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Summon;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
namespace CalamityMod.NPCs
{
public class CalamityGlobalNPC : GlobalNPC
{
#region Variables
public float DR { get; set; } = 0f;
///
/// If this is set to true, the NPC's DR cannot be reduced via any means. This applies regardless of whether customDR is true or false.
///
public bool unbreakableDR = false;
///
/// Overrides the normal DR math and uses custom DR reductions for each debuff, registered separately.
/// Used primarily by post-Moon Lord bosses.
///
public bool customDR = false;
public Dictionary flatDRReductions = new Dictionary();
public Dictionary multDRReductions = new Dictionary();
// Iron Heart (currently unimplemented)
// private int ironHeartDamage = 0;
// NewAI
internal const int maxAIMod = 4;
public float[] newAI = new float[maxAIMod];
// Town NPC Patreon
private bool setNewName = true;
// Draedons Remote
public static bool DraedonMayhem = false;
// Debuffs
public int vaporfied = 0;
public int timeSlow = 0;
public int gState = 0;
public int tSad = 0;
public int eFreeze = 0;
public int silvaStun = 0;
public int webbed = 0;
public int slowed = 0;
public int yellowCandle = 0;
public int pearlAura = 0;
public int wCleave = 0;
public int bBlood = 0;
public int dFlames = 0;
public int marked = 0;
public int irradiated = 0;
public int bFlames = 0;
public int hFlames = 0;
public int pFlames = 0;
public int aCrunch = 0;
public int pShred = 0;
public int cDepth = 0;
public int gsInferno = 0;
public int astralInfection = 0;
public int aFlames = 0;
public int wDeath = 0;
public int nightwither = 0;
public int enraged = 0;
public int shellfishVore = 0;
public int clamDebuff = 0;
public int sulphurPoison = 0;
// whoAmI Variables
public static int bobbitWormBottom = -1;
public static int hiveMind = -1;
public static int perfHive = -1;
public static int slimeGodPurple = -1;
public static int slimeGodRed = -1;
public static int slimeGod = -1;
public static int laserEye = -1;
public static int fireEye = -1;
public static int primeLaser = -1;
public static int primeCannon = -1;
public static int primeVice = -1;
public static int primeSaw = -1;
public static int brimstoneElemental = -1;
public static int cataclysm = -1;
public static int catastrophe = -1;
public static int calamitas = -1;
public static int leviathan = -1;
public static int siren = -1;
public static int scavenger = -1;
public static int astrumDeusHeadMain = -1;
public static int energyFlame = -1;
public static int doughnutBoss = -1;
public static int holyBossAttacker = -1;
public static int holyBossDefender = -1;
public static int holyBossHealer = -1;
public static int holyBoss = -1;
public static int voidBoss = -1;
public static int ghostBossClone = -1;
public static int ghostBoss = -1;
public static int DoGHead = -1;
public static int SCalCataclysm = -1;
public static int SCalCatastrophe = -1;
public static int SCal = -1;
public static int SCalWorm = -1;
// Collections
public static SortedDictionary BossRushHPChanges = new SortedDictionary
{
// Tier 1
{ NPCID.QueenBee, 3150000 }, // 30 seconds
{ NPCID.BrainofCthulhu, 1000000 }, // 30 seconds with creepers
{ NPCID.Creeper, 100000 },
{ NPCID.KingSlime, 3000000 }, // 30 seconds
{ NPCID.BlueSlime, 36000 },
{ NPCID.SlimeSpiked, 72000 },
{ NPCID.GreenSlime, 27000 },
{ NPCID.RedSlime, 54000 },
{ NPCID.PurpleSlime, 72000 },
{ NPCID.YellowSlime, 63000 },
{ NPCID.IceSlime, 45000 },
{ NPCID.UmbrellaSlime, 54000 },
{ NPCID.RainbowSlime, 300000 },
{ NPCID.Pinky, 150000 },
{ NPCID.EyeofCthulhu, 4500000 }, // 30 seconds
{ NPCID.ServantofCthulhu, 60000 },
{ NPCID.SkeletronPrime, 1100000 }, // 30 seconds
{ NPCID.PrimeVice, 540000 },
{ NPCID.PrimeCannon, 450000 },
{ NPCID.PrimeSaw, 450000 },
{ NPCID.PrimeLaser, 380000 },
{ NPCID.Golem, 500000 }, // 30 seconds
{ NPCID.GolemHead, 300000 },
{ NPCID.GolemHeadFree, 300000 },
{ NPCID.GolemFistLeft, 250000 },
{ NPCID.GolemFistRight, 250000 },
{ NPCID.EaterofWorldsHead, 2500000 }, // 30 seconds
{ NPCID.EaterofWorldsBody, 2500000 },
{ NPCID.EaterofWorldsTail, 2500000 },
// Tier 2
{ NPCID.TheDestroyer, 2500000 }, // 30 seconds + immunity timer at start
{ NPCID.TheDestroyerBody, 2500000 },
{ NPCID.TheDestroyerTail, 2500000 },
{ NPCID.Probe, 100000 },
{ NPCID.Spazmatism, 1500000 }, // 30 seconds
{ NPCID.Retinazer, 1250000 },
{ NPCID.WallofFlesh, 4500000 }, // 30 seconds
{ NPCID.WallofFleshEye, 4500000 },
{ NPCID.SkeletronHead, 1600000 }, // 30 seconds
{ NPCID.SkeletronHand, 600000 },
// Tier 3
{ NPCID.CultistBoss, 2200000 }, // 30 seconds
{ NPCID.CultistDragonHead, 600000 },
{ NPCID.CultistDragonBody1, 600000 },
{ NPCID.CultistDragonBody2, 600000 },
{ NPCID.CultistDragonBody3, 600000 },
{ NPCID.CultistDragonBody4, 600000 },
{ NPCID.CultistDragonTail, 600000 },
{ NPCID.AncientCultistSquidhead, 500000 },
{ NPCID.Plantera, 1600000 }, // 30 seconds
{ NPCID.PlanterasTentacle, 400000 },
// Tier 4
{ NPCID.DukeFishron, 2900000 }, // 30 seconds
{ NPCID.MoonLordCore, 1600000 }, // 1 minute
{ NPCID.MoonLordHand, 450000 },
{ NPCID.MoonLordHead, 600000 },
{ NPCID.MoonLordLeechBlob, 8000 }
// 8 minutes in total for vanilla Boss Rush bosses
};
public static SortedDictionary BossValues = new SortedDictionary
{
{ NPCID.QueenBee, Item.buyPrice(0, 5)},
{ NPCID.SkeletronHead, Item.buyPrice(0, 7) },
{ NPCID.DukeFishron, Item.buyPrice(0, 25) },
{ NPCID.CultistBoss, Item.buyPrice(0, 25) },
{ NPCID.MoonLordCore, Item.buyPrice(0, 30) }
};
///
/// Lists of enemies that resist piercing to some extent (mostly worms).
/// Could prove useful for other things as well.
///
public static List AstrumDeusIDs = new List
{
ModContent.NPCType(),
ModContent.NPCType(),
ModContent.NPCType(),
ModContent.NPCType(),
ModContent.NPCType(),
ModContent.NPCType()
};
public static List AquaticScourgeIDs = new List
{
ModContent.NPCType(),
ModContent.NPCType(),
ModContent.NPCType(),
ModContent.NPCType()
};
public static List EaterofWorldsIDs = new List
{
NPCID.EaterofWorldsHead,
NPCID.EaterofWorldsBody,
NPCID.EaterofWorldsTail
};
public static List DestroyerIDs = new List
{
NPCID.TheDestroyer,
NPCID.TheDestroyerBody,
NPCID.TheDestroyerTail
};
#endregion
#region Instance Per Entity
public override bool InstancePerEntity => true;
#endregion
#region Reset Effects
public override void ResetEffects(NPC npc)
{
void ResetSavedIndex(ref int type)
{
if (type >= 0 && !Main.npc[type].active)
{
type = -1;
}
}
ResetSavedIndex(ref bobbitWormBottom);
ResetSavedIndex(ref hiveMind);
ResetSavedIndex(ref perfHive);
ResetSavedIndex(ref slimeGodPurple);
ResetSavedIndex(ref slimeGodRed);
ResetSavedIndex(ref slimeGod);
ResetSavedIndex(ref laserEye);
ResetSavedIndex(ref fireEye);
ResetSavedIndex(ref primeLaser);
ResetSavedIndex(ref primeCannon);
ResetSavedIndex(ref primeVice);
ResetSavedIndex(ref primeSaw);
ResetSavedIndex(ref brimstoneElemental);
ResetSavedIndex(ref cataclysm);
ResetSavedIndex(ref catastrophe);
ResetSavedIndex(ref calamitas);
ResetSavedIndex(ref leviathan);
ResetSavedIndex(ref siren);
ResetSavedIndex(ref scavenger);
ResetSavedIndex(ref astrumDeusHeadMain);
ResetSavedIndex(ref energyFlame);
ResetSavedIndex(ref doughnutBoss);
ResetSavedIndex(ref holyBossAttacker);
ResetSavedIndex(ref holyBossDefender);
ResetSavedIndex(ref holyBossHealer);
ResetSavedIndex(ref holyBoss);
ResetSavedIndex(ref voidBoss);
ResetSavedIndex(ref ghostBossClone);
ResetSavedIndex(ref ghostBoss);
ResetSavedIndex(ref DoGHead);
ResetSavedIndex(ref SCalCataclysm);
ResetSavedIndex(ref SCalCatastrophe);
ResetSavedIndex(ref SCal);
ResetSavedIndex(ref SCalWorm);
}
#endregion
#region Life Regen
public override void UpdateLifeRegen(NPC npc, ref int damage)
{
int genLimit = Main.maxTilesX / 2;
int abyssChasmX = CalamityWorld.abyssSide ? genLimit - (genLimit - 135) : genLimit + (genLimit - 135);
bool abyssPosX = false;
if (CalamityWorld.abyssSide)
{
if ((double)(npc.position.X / 16f) < abyssChasmX + 80)
{
abyssPosX = true;
}
}
else
{
if ((double)(npc.position.X / 16f) > abyssChasmX - 80)
{
abyssPosX = true;
}
}
bool inAbyss = ((npc.position.Y / 16f > (Main.rockLayer - Main.maxTilesY * 0.05)) && ((double)(npc.position.Y / 16f) <= Main.maxTilesY - 250) && abyssPosX) || CalamityWorld.abyssTiles > 200;
bool hurtByAbyss = npc.wet && npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && inAbyss && !npc.buffImmune[ModContent.BuffType()];
if (hurtByAbyss)
{
npc.AddBuff(ModContent.BuffType(), 2);
npc.DeathSound = null;
npc.HitSound = null;
}
if (npc.damage > 0 && !npc.boss && !npc.friendly && !npc.dontTakeDamage && CalamityWorld.sulphurTiles > 30 &&
!npc.buffImmune[BuffID.Poisoned] && !npc.buffImmune[ModContent.BuffType()])
{
if (npc.wet)
{
npc.AddBuff(BuffID.Poisoned, 2);
}
if (Main.raining)
{
npc.AddBuff(ModContent.BuffType(), 2);
}
}
if (npc.venom)
{
if (npc.lifeRegen > 0)
{
npc.lifeRegen = 0;
}
int projectileCount = 0;
for (int j = 0; j < 1000; j++)
{
if (Main.projectile[j].active &&
(Main.projectile[j].type == ModContent.ProjectileType() || Main.projectile[j].type == ModContent.ProjectileType() || Main.projectile[j].type == ModContent.ProjectileType() || Main.projectile[j].type == ModContent.ProjectileType() || Main.projectile[j].type == ModContent.ProjectileType() || Main.projectile[j].type == ModContent.ProjectileType()) &&
Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == npc.whoAmI)
{
projectileCount++;
}
}
if (projectileCount > 0)
{
npc.lifeRegen -= projectileCount * 30;
if (damage < projectileCount * 6)
{
damage = projectileCount * 6;
}
}
}
if (shellfishVore > 0)
{
if (npc.lifeRegen > 0)
{
npc.lifeRegen = 0;
}
int projectileCount = 0;
for (int j = 0; j < 1000; j++)
{
if (Main.projectile[j].active &&
(Main.projectile[j].type == ModContent.ProjectileType()) &&
Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == npc.whoAmI &&
projectileCount < 5)
{
projectileCount++;
}
}
npc.lifeRegen -= projectileCount * 350;
if (damage < projectileCount * 70)
{
damage = projectileCount * 70;
}
}
if (clamDebuff > 0)
{
if (npc.lifeRegen > 0)
{
npc.lifeRegen = 0;
}
int projectileCount = 0;
for (int j = 0; j < 1000; j++)
{
if (Main.projectile[j].active &&
(Main.projectile[j].type == ModContent.ProjectileType()) &&
Main.projectile[j].ai[0] == 1f && Main.projectile[j].ai[1] == npc.whoAmI &&
projectileCount < 2)
{
projectileCount++;
}
}
npc.lifeRegen -= projectileCount * 35;
if (damage < projectileCount * 7)
{
damage = projectileCount * 7;
}
}
if (cDepth > 0)
{
if (npc.defense < 0)
{
npc.defense = 0;
}
int depthDamage = Main.hardMode ? 80 : 12;
if (hurtByAbyss)
{
depthDamage = 300;
}
int calcDepthDamage = depthDamage - npc.defense;
if (calcDepthDamage < 0)
{
calcDepthDamage = 0;
}
if (npc.lifeRegen > 0)
{
npc.lifeRegen = 0;
}
npc.lifeRegen -= calcDepthDamage * 5;
if (damage < calcDepthDamage)
{
damage = calcDepthDamage;
}
}
// Exo Freeze, Glacial State and Temporal Sadness don't work on bosses or other specific enemies.
if (!npc.boss && !CalamityMod.movementImpairImmuneList.Contains(npc.type))
{
if (eFreeze > 0 && !CalamityWorld.bossRushActive)
{
npc.velocity.X = 0f;
npc.velocity.Y += 0.1f;
if (npc.velocity.Y > 15f)
npc.velocity.Y = 15f;
}
else if (gState > 0)
{
npc.velocity.X = 0f;
npc.velocity.Y += 0.05f;
if (npc.velocity.Y > 15f)
npc.velocity.Y = 15f;
}
if (tSad > 0)
{
npc.velocity /= 2f;
}
}
//Oiled debuff makes flame debuffs 50% more effective (instead of vanilla 25%)
/*if (npc.oiled)
{
int num1 = (npc.onFire ? 2 : 0) + (npc.onFrostBurn ? 4 : 0) + (npc.onFire2 ? 3 : 0) + (npc.shadowFlame ? 7 : 0) + (bFlames ? 20 : 0) + (hFlames ? 25 : 0) + (gsInferno ? 125 : 0) + (aFlames ? 63 : 0) + (dFlames ? 1250 : 0);
if (num1 > 0)
{
int num2 = num1 * 4 + 12;
npc.lifeRegen = npc.lifeRegen - num2;
int num3 = num2 / 6;
if (amount < num3)
amount = num3;
}
}*/
ApplyDPSDebuff(vaporfied, 30, 6, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(irradiated, 20, 4, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(bFlames, 40, 8, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(hFlames, 50, 10, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(pFlames, 100, 20, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(gsInferno, 250, 50, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(astralInfection, 75, 15, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(aFlames, 125, 25, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(pShred, 1500, 300, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(nightwither, 200, 40, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(dFlames, 2500, 500, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(bBlood, 50, 10, ref npc.lifeRegen, ref damage);
ApplyDPSDebuff(sulphurPoison, 180, 36, ref npc.lifeRegen, ref damage);
}
public void ApplyDPSDebuff(int debuff, int lifeRegenValue, int damageValue, ref int lifeRegen, ref int damage)
{
if (debuff > 0)
{
if (lifeRegen > 0)
{
lifeRegen = 0;
}
lifeRegen -= lifeRegenValue;
if (damage < damageValue)
{
damage = damageValue;
}
}
}
#endregion
#region Set Defaults
public override void SetDefaults(NPC npc)
{
for (int m = 0; m < maxAIMod; m++)
{
newAI[m] = 0f;
}
// Apply DR to vanilla NPCs. No vanilla NPCs have DR except in Rev+.
// This also applies DR to other mods' NPCs who have set up their NPCs to have DR in Rev+.
if (CalamityWorld.revenge && CalamityMod.DRValues.ContainsKey(npc.type))
{
CalamityMod.DRValues.TryGetValue(npc.type, out float revDR);
DR = revDR;
}
if (npc.boss && CalamityWorld.revenge)
{
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType())
{
if (Main.netMode != NetmodeID.Server)
{
if (!Main.LocalPlayer.dead && Main.LocalPlayer.active)
{
Main.LocalPlayer.Calamity().adrenaline = 0;
}
}
}
}
if (CalamityWorld.bossRushActive)
{
BossRushStatChanges(npc, mod);
}
else
{
if (CalamityMod.enemyImmunityList.Contains(npc.type) || npc.boss)
{
npc.buffImmune[ModContent.BuffType()] = true;
npc.buffImmune[ModContent.BuffType()] = true;
npc.buffImmune[ModContent.BuffType()] = true;
npc.buffImmune[BuffID.Webbed] = true;
npc.buffImmune[BuffID.Slow] = true;
}
if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC)
{
for (int k = 0; k < npc.buffImmune.Length; k++)
{
npc.buffImmune[k] = true;
}
if (npc.townNPC)
{
npc.buffImmune[BuffID.Wet] = false;
npc.buffImmune[BuffID.Slimed] = false;
npc.buffImmune[BuffID.Lovestruck] = false;
npc.buffImmune[BuffID.Stinky] = false;
}
}
}
if (npc.buffImmune[BuffID.Venom] == false)
{
npc.buffImmune[ModContent.BuffType()] = false;
}
npc.buffImmune[ModContent.BuffType()] = false;
BossValueChanges(npc);
if (CalamityWorld.defiled)
{
npc.value = (int)(npc.value * 1.5);
}
if (DraedonMayhem)
{
DraedonMechaMayhemStatChanges(npc);
}
if (CalamityWorld.revenge)
{
RevengeanceStatChanges(npc, mod);
}
OtherStatChanges(npc);
if (CalamityWorld.ironHeart)
{
IronHeartChanges(npc);
}
}
#endregion
#region Boss Rush Stat Changes
private void BossRushStatChanges(NPC npc, Mod mod)
{
if (!npc.friendly)
{
npc.buffImmune[ModContent.BuffType()] = false;
npc.buffImmune[ModContent.BuffType()] = false;
}
foreach (KeyValuePair BossRushHPChange in BossRushHPChanges)
{
if (npc.type == BossRushHPChange.Key)
{
npc.lifeMax = BossRushHPChange.Value;
break;
}
}
}
#endregion
#region Boss Value Changes
private void BossValueChanges(NPC npc)
{
foreach (KeyValuePair BossValue in BossValues)
{
if (npc.type == BossValue.Key)
{
npc.value = BossValue.Value;
break;
}
}
}
#endregion
#region Draedon Mecha Mayhem Stat Changes
private void DraedonMechaMayhemStatChanges(NPC npc)
{
switch (npc.type)
{
case NPCID.TheDestroyer:
case NPCID.TheDestroyerBody:
case NPCID.TheDestroyerTail:
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.7) : (int)(npc.lifeMax * 1.8);
npc.scale = 1.5f;
npc.npcSlots = 10f;
break;
case NPCID.Probe:
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.9) : (int)(npc.lifeMax * 1.6);
npc.scale *= CalamityWorld.death ? 1.25f : 1.2f;
break;
case NPCID.SkeletronPrime:
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.5) : (int)(npc.lifeMax * 1.6);
npc.npcSlots = 12f;
break;
case NPCID.PrimeVice:
case NPCID.PrimeCannon:
case NPCID.PrimeSaw:
case NPCID.PrimeLaser:
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.15) : (int)(npc.lifeMax * 1.05);
break;
case NPCID.Retinazer:
case NPCID.Spazmatism:
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 3.0) : (int)(npc.lifeMax * 1.8);
npc.npcSlots = 10f;
break;
}
}
#endregion
#region Revengeance Stat Changes
private void RevengeanceStatChanges(NPC npc, Mod mod)
{
npc.value = (int)(npc.value * 1.5);
if (npc.type == NPCID.Mothron)
{
npc.scale = 1.25f;
}
else if (npc.type == NPCID.MoonLordCore)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.7) : (int)(npc.lifeMax * 2.2);
npc.npcSlots = 36f;
}
else if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead || npc.type == NPCID.MoonLordLeechBlob)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.4) : (int)(npc.lifeMax * 1.2);
}
else if (npc.type >= NPCID.CultistDragonHead && npc.type <= NPCID.CultistDragonTail)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 10.0) : (int)(npc.lifeMax * 5.0);
}
else if (npc.type == NPCID.DukeFishron)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 3.525) : (int)(npc.lifeMax * 1.85);
npc.npcSlots = 20f;
}
else if (npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2)
{
npc.lifeMax = (int)(npc.lifeMax * 5.0);
}
else if (npc.type == NPCID.Golem)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 7.0) : (int)(npc.lifeMax * 4.0);
npc.npcSlots = 64f;
}
else if (npc.type == NPCID.GolemHead)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.0) : (int)(npc.lifeMax * 1.5);
}
else if (npc.type == NPCID.GolemHeadFree)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.5) : (int)(npc.lifeMax * 1.25);
npc.dontTakeDamage = false;
}
else if (npc.type == NPCID.Plantera)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 3.4) : (int)(npc.lifeMax * 2.3);
npc.npcSlots = 32f;
}
else if (npc.type == NPCID.PlanterasHook)
{
npc.damage = npc.defDamage = 0;
}
else if (npc.type == NPCID.WallofFlesh || npc.type == NPCID.WallofFleshEye)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.6) : (int)(npc.lifeMax * 1.9);
if (npc.type == NPCID.WallofFlesh)
{
npc.npcSlots = 20f;
}
}
else if (npc.type == NPCID.TheHungryII || npc.type == NPCID.LeechHead || npc.type == NPCID.LeechBody || npc.type == NPCID.LeechTail)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.15) : (int)(npc.lifeMax * 1.05);
}
else if (npc.type == NPCID.SkeletronHead)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.4) : (int)(npc.lifeMax * 1.25);
npc.npcSlots = 12f;
}
else if (npc.type == NPCID.SkeletronHand)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 0.9) : (int)(npc.lifeMax * 0.75);
}
else if (npc.type == NPCID.QueenBee)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.65) : (int)(npc.lifeMax * 1.15);
npc.npcSlots = 14f;
}
else if (npc.type == NPCID.BrainofCthulhu)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.1) : (int)(npc.lifeMax * 1.6);
npc.npcSlots = 12f;
}
else if (npc.type == NPCID.Creeper)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.2) : (int)(npc.lifeMax * 1.1);
}
else if (EaterofWorldsIDs.Contains(npc.type))
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.4) : (int)(npc.lifeMax * 1.3);
if (npc.type == NPCID.EaterofWorldsHead)
{
npc.npcSlots = 10f;
}
}
else if (npc.type == NPCID.EyeofCthulhu)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.3) : (int)(npc.lifeMax * 1.25);
npc.npcSlots = 10f;
}
else if (npc.type == NPCID.KingSlime)
{
if (CalamityWorld.death)
{
npc.lifeMax = (int)(npc.lifeMax * 1.85);
}
}
else if (npc.type == NPCID.Wraith || npc.type == NPCID.Mimic || npc.type == NPCID.Reaper || npc.type == NPCID.PresentMimic || npc.type == NPCID.SandElemental)
{
npc.knockBackResist = 0f;
}
if (!DraedonMayhem)
{
if (DestroyerIDs.Contains(npc.type))
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.6) : (int)(npc.lifeMax * 1.25);
npc.scale = 1.5f;
npc.npcSlots = 10f;
}
else if (npc.type == NPCID.Probe)
{
if (CalamityWorld.death)
{
npc.lifeMax = (int)(npc.lifeMax * 1.25);
npc.scale *= 1.2f;
}
}
else if (npc.type == NPCID.SkeletronPrime)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.45) : (int)(npc.lifeMax * 1.2);
npc.npcSlots = 12f;
}
else if (npc.type == NPCID.PrimeVice || npc.type == NPCID.PrimeCannon || npc.type == NPCID.PrimeSaw || npc.type == NPCID.PrimeLaser)
{
if (!CalamityWorld.death)
{
npc.lifeMax = (int)(npc.lifeMax * 0.9);
}
}
else if (npc.type == NPCID.Retinazer)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.4) : (int)(npc.lifeMax * 1.25);
npc.npcSlots = 10f;
}
else if (npc.type == NPCID.Spazmatism)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.45) : (int)(npc.lifeMax * 1.3);
npc.npcSlots = 10f;
}
}
if (CalamityMod.revengeanceLifeStealExceptionList.Contains(npc.type))
{
npc.canGhostHeal = false;
}
}
///
/// Sets the DR of this NPC only if Revengeance Mode is enabled. Otherwise sets DR to zero.
///
/// The DR to set, assuming Rev+ difficulty.
/// Whether Revengeance Mode is currently enabled.
public bool RevPlusDR(float dr)
{
DR = CalamityWorld.revenge ? dr : 0f;
return CalamityWorld.revenge;
}
#endregion
#region Other Stat Changes
private void OtherStatChanges(NPC npc)
{
// Fix Sharkron hitboxes
if (npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2)
{
npc.width = npc.height = 36;
}
if (npc.type == NPCID.CultistBoss)
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.5) : (int)(npc.lifeMax * (CalamityWorld.revenge ? 1.7 : 1.2));
npc.npcSlots = 20f;
}
if (npc.type >= NPCID.TombCrawlerHead && npc.type <= NPCID.TombCrawlerTail && !Main.hardMode)
{
npc.lifeMax = (int)(npc.lifeMax * 0.6);
}
if (Main.bloodMoon && NPC.downedMoonlord && !npc.boss && !npc.friendly && !npc.dontTakeDamage && npc.lifeMax <= 2000 && npc.damage > 0)
{
npc.lifeMax = (int)(npc.lifeMax * 3.5);
npc.damage += 100;
npc.life = npc.lifeMax;
npc.defDamage = npc.damage;
}
if (CalamityWorld.downedDoG)
{
if (CalamityMod.pumpkinMoonBuffList.Contains(npc.type))
{
npc.lifeMax = (int)(npc.lifeMax * 7.5);
npc.damage += 200;
npc.life = npc.lifeMax;
npc.defDamage = npc.damage;
}
else if (CalamityMod.frostMoonBuffList.Contains(npc.type))
{
npc.lifeMax = (int)(npc.lifeMax * 6.0);
npc.damage += 200;
npc.life = npc.lifeMax;
npc.defDamage = npc.damage;
}
}
if (CalamityMod.eclipseBuffList.Contains(npc.type) && CalamityWorld.buffedEclipse)
{
npc.lifeMax = (int)(npc.lifeMax * 32.5);
npc.damage += 250;
npc.life = npc.lifeMax;
npc.defDamage = npc.damage;
}
if (NPC.downedMoonlord)
{
if (CalamityMod.dungeonEnemyBuffList.Contains(npc.type))
{
npc.lifeMax = (int)(npc.lifeMax * 2.5);
npc.damage += 150;
npc.life = npc.lifeMax;
npc.defDamage = npc.damage;
}
}
if (CalamityWorld.revenge)
{
if (CalamityMod.revengeanceEnemyBuffList.Contains(npc.type))
{
npc.damage = (int)(npc.damage * 1.25);
npc.defDamage = npc.damage;
}
}
if ((npc.boss && npc.type != NPCID.MartianSaucerCore && npc.type < NPCID.Count) || CalamityMod.bossHPScaleList.Contains(npc.type))
{
double HPBoost = Config.BossHealthPercentageBoost * 0.01;
npc.lifeMax += (int)(npc.lifeMax * HPBoost);
}
}
#endregion
// TODO -- Change Iron Heart damage in here for Iron Heart mode
#region Iron Heart Changes
private void IronHeartChanges(NPC npc)
{
// Iron Heart damage variable will scale with npc.damage
// ironHeartDamage = 0;
}
#endregion
#region Scale Expert Multiplayer Stats
public override void ScaleExpertStats(NPC npc, int numPlayers, float bossLifeScale)
{
if (CalamityWorld.revenge)
{
ScaleThoriumBossHealth(npc, mod);
}
if (Main.netMode == NetmodeID.SinglePlayer || numPlayers <= 1)
{
return;
}
if (((npc.boss || CalamityMod.bossScaleList.Contains(npc.type)) && npc.type < NPCID.Count) ||
(npc.modNPC != null && npc.modNPC.mod.Name.Equals("CalamityMod")))
{
double scalar;
switch (numPlayers) //Decrease HP in multiplayer before vanilla scaling
{
case 1:
scalar = 1.0;
break;
case 2:
scalar = 0.76;
break;
case 3:
scalar = 0.63;
break;
case 4:
scalar = 0.525;
break;
case 5:
scalar = 0.43;
break;
case 6:
scalar = 0.36;
break;
default:
scalar = 0.295;
break;
}
npc.lifeMax = (int)(npc.lifeMax * scalar);
}
}
#endregion
#region Scale Thorium Boss Health
private void ScaleThoriumBossHealth(NPC npc, Mod mod)
{
if (Config.RevengeanceAndDeathThoriumBossBuff)
{
Mod thorium = ModLoader.GetMod("ThoriumMod");
if (thorium != null)
{
if (npc.type == thorium.NPCType("Hatchling") || npc.type == thorium.NPCType("DistractJelly") || npc.type == thorium.NPCType("ViscountBaby") ||
npc.type == thorium.NPCType("BoreanHopper") || npc.type == thorium.NPCType("BoreanMyte1") || npc.type == thorium.NPCType("EnemyBeholder") ||
npc.type == thorium.NPCType("ThousandSoulPhalactry") || npc.type == thorium.NPCType("AbyssalSpawn"))
{
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.3) : (int)(npc.lifeMax * 1.5);
}
else if (npc.type == thorium.NPCType("TheGrandThunderBirdv2"))
{
npc.buffImmune[ModContent.BuffType()] = true;
npc.buffImmune[ModContent.BuffType()] = true;
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.3) : (int)(npc.lifeMax * 1.5);
}
else if (npc.type == thorium.NPCType("QueenJelly"))
{
npc.buffImmune[ModContent.BuffType()] = true;
npc.buffImmune[ModContent.BuffType()] = true;
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.9) : (int)(npc.lifeMax * 1.35);
}
else if (npc.type == thorium.NPCType("Viscount"))
{
npc.buffImmune[ModContent.BuffType()] = true;
npc.buffImmune[ModContent.BuffType()] = true;
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.65) : (int)(npc.lifeMax * 1.25);
}
else if (npc.type == thorium.NPCType("GraniteEnergyStorm"))
{
npc.buffImmune[ModContent.BuffType()] = true;
npc.buffImmune[ModContent.BuffType()] = true;
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.25) : (int)(npc.lifeMax * 1.1);
}
else if (npc.type == thorium.NPCType("TheBuriedWarrior") || npc.type == thorium.NPCType("TheBuriedWarrior1") || npc.type == thorium.NPCType("TheBuriedWarrior2"))
{
npc.buffImmune[ModContent.BuffType()] = true;
npc.buffImmune[ModContent.BuffType()] = true;
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.5) : (int)(npc.lifeMax * 1.2);
}
else if (npc.type == thorium.NPCType("ThePrimeScouter") || npc.type == thorium.NPCType("CryoCore") || npc.type == thorium.NPCType("BioCore") ||
npc.type == thorium.NPCType("PyroCore"))
{
npc.buffImmune[ModContent.BuffType()] = true;
npc.buffImmune[ModContent.BuffType()] = true;
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.75) : (int)(npc.lifeMax * 1.3);
}
else if (npc.type == thorium.NPCType("BoreanStrider") || npc.type == thorium.NPCType("BoreanStriderPopped"))
{
npc.buffImmune[ModContent.BuffType()] = true;
npc.buffImmune[ModContent.BuffType()] = true;
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.0) : (int)(npc.lifeMax * 1.4);
}
else if (npc.type == thorium.NPCType("FallenDeathBeholder") || npc.type == thorium.NPCType("FallenDeathBeholder2"))
{
npc.buffImmune[ModContent.BuffType()] = true;
npc.buffImmune[ModContent.BuffType()] = true;
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.5) : (int)(npc.lifeMax * 1.6);
}
else if (npc.type == thorium.NPCType("Lich") || npc.type == thorium.NPCType("LichHeadless"))
{
npc.buffImmune[ModContent.BuffType()] = true;
npc.buffImmune[ModContent.BuffType()] = true;
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.5) : (int)(npc.lifeMax * 1.6);
}
else if (npc.type == thorium.NPCType("Abyssion") || npc.type == thorium.NPCType("AbyssionCracked") || npc.type == thorium.NPCType("AbyssionReleased"))
{
npc.buffImmune[ModContent.BuffType()] = true;
npc.buffImmune[ModContent.BuffType()] = true;
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.3) : (int)(npc.lifeMax * 1.5);
}
else if (npc.type == thorium.NPCType("SlagFury") || npc.type == thorium.NPCType("Omnicide") || npc.type == thorium.NPCType("RealityBreaker") ||
npc.type == thorium.NPCType("Aquaius") || npc.type == thorium.NPCType("Aquaius2"))
{
npc.buffImmune[ModContent.BuffType()] = true;
npc.buffImmune[ModContent.BuffType()] = true;
npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.75) : (int)(npc.lifeMax * 1.3);
}
}
}
}
#endregion
#region Can Hit Player
public override bool CanHitPlayer(NPC npc, Player target, ref int cooldownSlot)
{
if (!npc.boss && !npc.friendly && !npc.dontTakeDamage)
{
if (CalamityWorld.downedDoG && (Main.pumpkinMoon || Main.snowMoon))
{
cooldownSlot = 1;
}
if (CalamityWorld.buffedEclipse && Main.eclipse)
{
cooldownSlot = 1;
}
}
return true;
}
#endregion
#region Modify Hit Player
public override void ModifyHitPlayer(NPC npc, Player target, ref int damage, ref bool crit)
{
if (tSad > 0)
{
damage /= 2;
}
if (target.Calamity().beeResist)
{
if (CalamityMod.beeEnemyList.Contains(npc.type))
{
damage = (int)(damage * 0.75);
}
}
}
#endregion
#region Strike NPC
public override bool StrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit)
{
if (DestroyerIDs.Contains(npc.type))
{
if ((newAI[1] < 480f || newAI[2] > 0f) && (CalamityWorld.revenge || CalamityWorld.bossRushActive))
{
damage *= 0.01;
}
}
// Override hand/head eye 'death' code and use custom 'death' code instead, this is here just in case the AI code fails
if (CalamityWorld.revenge || CalamityWorld.bossRushActive)
{
if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead)
{
if (npc.life - (int)damage <= 0)
{
if (newAI[0] != 1f)
{
newAI[0] = 1f;
npc.life = npc.lifeMax;
npc.netUpdate = true;
npc.dontTakeDamage = true;
}
}
}
}
// Yellow Candle provides +5% damage which ignores both DR and defense.
// However, armor penetration bonus damage has already been applied, so it's slightly higher than it should be.
double yellowCandleDamage = 0.05 * damage;
// Apply modifications to enemy's current defense based on Calamity debuffs.
// As with defense and DR, flat reductions apply first, then multiplicative reductions.
int effectiveDefense = npc.defense -
(pFlames > 0 ? Plague.DefenseReduction : 0) -
(wDeath > 0 ? WhisperingDeath.DefenseReduction : 0) -
(gsInferno > 0 ? GodSlayerInferno.DefenseReduction : 0) -
(astralInfection > 0 ? AstralInfectionDebuff.DefenseReduction : 0) -
(aFlames > 0 ? AbyssalFlames.DefenseReduction : 0) -
(wCleave > 0 ? WarCleave.DefenseReduction : 0) -
(gState > 0 ? GlacialState.DefenseReduction : 0) -
(aCrunch > 0 ? ArmorCrunch.DefenseReduction : 0);
// Defense can never be negative and has a minimum value of zero.
if (effectiveDefense < 0)
effectiveDefense = 0;
// Apply vanilla-style defense before DR, using Calamity's reduced defense.
damage = Main.CalculateDamage((int)damage, effectiveDefense);
// DR applies after vanilla defense.
damage = ApplyDR(npc, damage);
// Add Yellow Candle damage if the NPC isn't supposed to be "near invincible"
if (yellowCandle > 0 && DR < 0.99f && npc.takenDamageMultiplier > 0.05f)
damage += yellowCandleDamage;
// Cancel out vanilla defense math by reversing the calculation vanilla is about to perform.
// While roundabout, this is safer than returning false to stop vanilla damage calculations entirely.
// Other mods will probably expect the vanilla code to run and may compensate for it themselves.
damage = Main.CalculateDamage((int)damage, -defense);
return true;
}
///
/// Modifies damage incoming to an NPC based on their DR (damage reduction) stat added by Calamity.
/// This is entirely separate from vanilla's takenDamageMultiplier.
///
/// Incoming damage. Has been modified by Main.DamageVar and boosted by armor penetration, but nothing else.
///
private double ApplyDR(NPC npc, double damage)
{
if (DR <= 0f || damage <= 1.0)
return damage;
// If the NPC currently has unbreakable DR, it cannot be reduced by any means.
// If custom DR is enabled, use that instead of normal DR.
float effectiveDR = unbreakableDR ? DR : (customDR ? CustomDRMath(npc, DR) : DefaultDRMath(npc, DR));
// DR floor is 0%. Nothing can have negative DR.
if (effectiveDR <= 0f)
effectiveDR = 0f;
double newDamage = (1f - effectiveDR) * damage;
return newDamage < 1.0 ? 1.0 : newDamage;
}
private float DefaultDRMath(NPC npc, float DR)
{
float calcDR = DR;
if (marked > 0)
calcDR *= 0.5f;
if (npc.betsysCurse)
calcDR *= 0.66f;
if (wCleave > 0)
calcDR *= 0.75f;
// Ichor supersedes Cursed Inferno if both are applied.
if (npc.ichor)
calcDR *= 0.75f;
else if (npc.onFire2)
calcDR *= 0.8f;
return calcDR;
}
private float CustomDRMath(NPC npc, float DR)
{
void FlatEditDR(ref float theDR, bool npcHasDebuff, int buffID)
{
if (npcHasDebuff && flatDRReductions.TryGetValue(buffID, out float reduction))
theDR -= reduction;
}
void MultEditDR(ref float theDR, bool npcHasDebuff, int buffID)
{
if (npcHasDebuff && multDRReductions.TryGetValue(buffID, out float multiplier))
theDR *= multiplier;
}
float calcDR = DR;
// Apply flat reductions first. All vanilla debuffs check their internal booleans.
FlatEditDR(ref calcDR, npc.poisoned, BuffID.Poisoned);
FlatEditDR(ref calcDR, npc.onFire, BuffID.OnFire);
FlatEditDR(ref calcDR, npc.venom, BuffID.Venom);
FlatEditDR(ref calcDR, npc.onFrostBurn, BuffID.Frostburn);
FlatEditDR(ref calcDR, npc.shadowFlame, BuffID.ShadowFlame);
FlatEditDR(ref calcDR, npc.daybreak, BuffID.Daybreak);
FlatEditDR(ref calcDR, npc.betsysCurse, BuffID.BetsysCurse);
// Ichor supersedes Cursed Inferno if both are applied.
FlatEditDR(ref calcDR, npc.ichor, BuffID.Ichor);
FlatEditDR(ref calcDR, npc.onFire2 && !npc.ichor, BuffID.CursedInferno);
// Modded debuffs are handled modularly and use HasBuff.
foreach (KeyValuePair entry in flatDRReductions)
{
int buffID = entry.Key;
if (buffID >= BuffID.Count && npc.HasBuff(buffID))
calcDR -= entry.Value;
}
// Apply multiplicative reductions second. All vanilla debuffs check their internal booleans.
MultEditDR(ref calcDR, npc.poisoned, BuffID.Poisoned);
MultEditDR(ref calcDR, npc.onFire, BuffID.OnFire);
MultEditDR(ref calcDR, npc.venom, BuffID.Venom);
MultEditDR(ref calcDR, npc.onFrostBurn, BuffID.Frostburn);
MultEditDR(ref calcDR, npc.shadowFlame, BuffID.ShadowFlame);
MultEditDR(ref calcDR, npc.daybreak, BuffID.Daybreak);
MultEditDR(ref calcDR, npc.betsysCurse, BuffID.BetsysCurse);
// Ichor supersedes Cursed Inferno if both are applied.
MultEditDR(ref calcDR, npc.ichor, BuffID.Ichor);
MultEditDR(ref calcDR, npc.onFire2 && !npc.ichor, BuffID.CursedInferno);
// Modded debuffs are handled modularly and use HasBuff.
foreach (KeyValuePair entry in multDRReductions)
{
int buffID = entry.Key;
if (buffID >= BuffID.Count && npc.HasBuff(buffID))
calcDR *= entry.Value;
}
return calcDR;
}
#endregion
#region Boss Head Slot
public override void BossHeadSlot(NPC npc, ref int index)
{
if (CalamityWorld.revenge)
{
if (npc.type == NPCID.BrainofCthulhu)
{
if ((float)npc.life / (float)npc.lifeMax < (CalamityWorld.death ? 0.33f : 0.2f))
index = -1;
}
if (CalamityWorld.death)
{
if (npc.type == NPCID.DukeFishron)
{
if ((float)npc.life / (float)npc.lifeMax < 0.15f)
index = -1;
}
}
}
}
#endregion
#region Pre AI
public override bool PreAI(NPC npc)
{
SetPatreonTownNPCName(npc);
if (npc.type == NPCID.TargetDummy || npc.type == ModContent.NPCType())
{
npc.chaseable = !CalamityPlayer.areThereAnyDamnBosses;
npc.dontTakeDamage = CalamityPlayer.areThereAnyDamnBosses;
}
if (DestroyerIDs.Contains(npc.type) || EaterofWorldsIDs.Contains(npc.type))
{
npc.buffImmune[ModContent.BuffType()] = false;
}
if (npc.type == NPCID.Bee || npc.type == NPCID.BeeSmall || npc.type == NPCID.Hornet || npc.type == NPCID.HornetFatty || npc.type == NPCID.HornetHoney ||
npc.type == NPCID.HornetLeafy || npc.type == NPCID.HornetSpikey || npc.type == NPCID.HornetStingy || npc.type == NPCID.BigHornetStingy || npc.type == NPCID.LittleHornetStingy ||
npc.type == NPCID.BigHornetSpikey || npc.type == NPCID.LittleHornetSpikey || npc.type == NPCID.BigHornetLeafy || npc.type == NPCID.LittleHornetLeafy ||
npc.type == NPCID.BigHornetHoney || npc.type == NPCID.LittleHornetHoney || npc.type == NPCID.BigHornetFatty || npc.type == NPCID.LittleHornetFatty)
{
if (Main.player[npc.target].Calamity().queenBeeLore)
{
CalamityGlobalAI.QueenBeeLoreEffect(npc);
return false;
}
}
// Always prevent true eye of cthulhu appearance in rev+
if (CalamityWorld.revenge || CalamityWorld.bossRushActive)
{
if (npc.type == NPCID.MoonLordFreeEye)
{
npc.active = false;
npc.netUpdate = true;
}
}
if (CalamityWorld.bossRushActive && !npc.friendly && !npc.townNPC)
{
BossRushForceDespawnOtherNPCs(npc, mod);
}
if (CalamityWorld.revenge || CalamityWorld.bossRushActive)
{
switch (npc.type)
{
case NPCID.KingSlime:
return CalamityGlobalAI.BuffedKingSlimeAI(npc, mod);
case NPCID.EyeofCthulhu:
return CalamityGlobalAI.BuffedEyeofCthulhuAI(npc, enraged > 0, mod);
case NPCID.EaterofWorldsHead:
case NPCID.EaterofWorldsBody:
case NPCID.EaterofWorldsTail:
return CalamityGlobalAI.BuffedEaterofWorldsAI(npc, mod);
case NPCID.BrainofCthulhu:
return CalamityGlobalAI.BuffedBrainofCthulhuAI(npc, enraged > 0, mod);
case NPCID.Creeper:
return CalamityGlobalAI.BuffedCreeperAI(npc, enraged > 0, mod);
case NPCID.QueenBee:
return CalamityGlobalAI.BuffedQueenBeeAI(npc, mod);
case NPCID.SkeletronHand:
return CalamityGlobalAI.BuffedSkeletronHandAI(npc, enraged > 0, mod);
case NPCID.SkeletronHead:
return CalamityGlobalAI.BuffedSkeletronAI(npc, enraged > 0, mod);
case NPCID.WallofFlesh:
return CalamityGlobalAI.BuffedWallofFleshAI(npc, enraged > 0, mod);
case NPCID.WallofFleshEye:
return CalamityGlobalAI.BuffedWallofFleshEyeAI(npc, enraged > 0, mod);
case NPCID.TheDestroyer:
case NPCID.TheDestroyerBody:
case NPCID.TheDestroyerTail:
return CalamityGlobalAI.BuffedDestroyerAI(npc, enraged > 0, mod);
case NPCID.Retinazer:
return CalamityGlobalAI.BuffedRetinazerAI(npc, enraged > 0, mod);
case NPCID.Spazmatism:
return CalamityGlobalAI.BuffedSpazmatismAI(npc, enraged > 0, mod);
case NPCID.SkeletronPrime:
return CalamityGlobalAI.BuffedSkeletronPrimeAI(npc, enraged > 0, mod);
case NPCID.PrimeLaser:
return CalamityGlobalAI.BuffedPrimeLaserAI(npc, mod);
case NPCID.PrimeCannon:
return CalamityGlobalAI.BuffedPrimeCannonAI(npc, mod);
case NPCID.PrimeVice:
return CalamityGlobalAI.BuffedPrimeViceAI(npc, mod);
case NPCID.PrimeSaw:
return CalamityGlobalAI.BuffedPrimeSawAI(npc, mod);
case NPCID.Plantera:
return CalamityGlobalAI.BuffedPlanteraAI(npc, enraged > 0, mod);
case NPCID.PlanterasHook:
return CalamityGlobalAI.BuffedPlanterasHookAI(npc, mod);
case NPCID.PlanterasTentacle:
return CalamityGlobalAI.BuffedPlanterasTentacleAI(npc, mod);
case NPCID.Golem:
return CalamityGlobalAI.BuffedGolemAI(npc, enraged > 0, mod);
case NPCID.GolemHead:
return CalamityGlobalAI.BuffedGolemHeadAI(npc, enraged > 0, mod);
case NPCID.GolemHeadFree:
return CalamityGlobalAI.BuffedGolemHeadFreeAI(npc, enraged > 0, mod);
case NPCID.DukeFishron:
return CalamityGlobalAI.BuffedDukeFishronAI(npc, enraged > 0, mod);
case NPCID.Pumpking:
if (CalamityWorld.downedDoG)
{
return CalamityGlobalAI.BuffedPumpkingAI(npc);
}
break;
case NPCID.PumpkingBlade:
if (CalamityWorld.downedDoG)
{
return CalamityGlobalAI.BuffedPumpkingBladeAI(npc);
}
break;
case NPCID.IceQueen:
if (CalamityWorld.downedDoG)
{
return CalamityGlobalAI.BuffedIceQueenAI(npc);
}
break;
case NPCID.Mothron:
if (CalamityWorld.buffedEclipse)
{
return CalamityGlobalAI.BuffedMothronAI(npc);
}
break;
case NPCID.CultistBoss:
case NPCID.CultistBossClone:
return CalamityGlobalAI.BuffedCultistAI(npc, enraged > 0, mod);
case NPCID.AncientDoom:
return CalamityGlobalAI.BuffedAncientDoomAI(npc, mod);
case NPCID.MoonLordCore:
case NPCID.MoonLordHand:
case NPCID.MoonLordHead:
case NPCID.MoonLordLeechBlob:
return CalamityGlobalAI.BuffedMoonLordAI(npc, enraged > 0, mod);
default:
break;
}
}
return true;
}
#endregion
#region Set Patreon Town NPC Name
private void SetPatreonTownNPCName(NPC npc)
{
if (setNewName)
{
setNewName = false;
switch (npc.type)
{
case NPCID.Guide:
switch (Main.rand.Next(36)) // 34 guide names
{
case 0:
npc.GivenName = "Lapp";
break;
case 1:
npc.GivenName = "Ben Shapiro";
break;
default:
break;
}
break;
case NPCID.Wizard:
switch (Main.rand.Next(24)) // 23 wizard names
{
case 0:
npc.GivenName = "Mage One-Trick";
break;
default:
break;
}
break;
case NPCID.Steampunker:
switch (Main.rand.Next(22)) // 21 steampunker names
{
case 0:
npc.GivenName = "Vorbis";
break;
default:
break;
}
break;
case NPCID.Stylist:
switch (Main.rand.Next(21)) // 20 stylist names
{
case 0:
npc.GivenName = "Amber";
break;
default:
break;
}
break;
case NPCID.WitchDoctor:
switch (Main.rand.Next(11)) // 10 witch doctor names
{
case 0:
npc.GivenName = "Sok'ar";
break;
default:
break;
}
break;
case NPCID.TaxCollector:
switch (Main.rand.Next(21)) // 20 tax collector names
{
case 0:
npc.GivenName = "Emmett";
break;
default:
break;
}
break;
default:
break;
}
}
}
#endregion
#region Boss Rush Force Despawn Other NPCs
private void BossRushForceDespawnOtherNPCs(NPC npc, Mod mod)
{
switch (CalamityWorld.bossRushStage)
{
case 0:
if (npc.type != NPCID.QueenBee)
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 1:
if (npc.type != NPCID.BrainofCthulhu && npc.type != NPCID.Creeper)
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 2:
if (npc.type != NPCID.KingSlime && npc.type != NPCID.BlueSlime && npc.type != NPCID.SlimeSpiked && npc.type != ModContent.NPCType() &&
npc.type != NPCID.YellowSlime && npc.type != NPCID.PurpleSlime && npc.type != NPCID.GreenSlime && npc.type != NPCID.RedSlime &&
npc.type != NPCID.IceSlime && npc.type != NPCID.UmbrellaSlime && npc.type != NPCID.RainbowSlime && npc.type != NPCID.Pinky)
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 3:
if (npc.type != NPCID.EyeofCthulhu && npc.type != NPCID.ServantofCthulhu)
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 4:
if (npc.type != NPCID.SkeletronPrime && npc.type != NPCID.PrimeSaw && npc.type != NPCID.PrimeVice &&
npc.type != NPCID.PrimeCannon && npc.type != NPCID.PrimeLaser && npc.type != NPCID.Probe)
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 5:
if (npc.type != NPCID.Golem && npc.type != NPCID.GolemFistLeft && npc.type != NPCID.GolemFistRight &&
npc.type != NPCID.GolemHead && npc.type != NPCID.GolemHeadFree)
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 6:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 7:
if (!EaterofWorldsIDs.Contains(npc.type) && npc.type != NPCID.VileSpit)
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 8:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 9:
if (!DestroyerIDs.Contains(npc.type) && npc.type != NPCID.Probe)
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 10:
if (npc.type != NPCID.Spazmatism && npc.type != NPCID.Retinazer)
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 11:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != NPCID.Spazmatism && npc.type != NPCID.Retinazer)
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 12:
if (npc.type != NPCID.WallofFlesh && npc.type != NPCID.WallofFleshEye && npc.type != NPCID.TheHungry &&
npc.type != NPCID.TheHungryII && npc.type != NPCID.LeechHead && npc.type != NPCID.LeechBody &&
npc.type != NPCID.LeechTail)
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 13:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 14:
if (npc.type != NPCID.SkeletronHead && npc.type != NPCID.SkeletronHand)
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 15:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 16:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 17:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 18:
if (npc.type != NPCID.CultistBoss && npc.type != NPCID.CultistBossClone && npc.type != NPCID.CultistDragonHead &&
npc.type != NPCID.CultistDragonBody1 && npc.type != NPCID.CultistDragonBody2 && npc.type != NPCID.CultistDragonBody3 &&
npc.type != NPCID.CultistDragonBody4 && npc.type != NPCID.CultistDragonTail && npc.type != NPCID.AncientCultistSquidhead &&
npc.type != NPCID.AncientLight && npc.type != NPCID.AncientDoom)
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 19:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 20:
if (npc.type != NPCID.Plantera && npc.type != NPCID.PlanterasTentacle && npc.type != NPCID.PlanterasHook &&
npc.type != NPCID.Spore)
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 21:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 22:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 23:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 24:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 25:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 26:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 27:
if (npc.type != NPCID.DukeFishron && npc.type != NPCID.DetonatingBubble && npc.type != NPCID.Sharkron &&
npc.type != NPCID.Sharkron2)
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 28:
if (npc.type != NPCID.MoonLordCore && npc.type != NPCID.MoonLordHead && npc.type != NPCID.MoonLordHand &&
npc.type != NPCID.MoonLordLeechBlob)
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 29:
if (!AstrumDeusIDs.Contains(npc.type) && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 30:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 31:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 32:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 33:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 34:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 35:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 36:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 37:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
case 38:
if (npc.type != ModContent.NPCType() && npc.type != ModContent.NPCType() &&
npc.type != ModContent.NPCType())
{
npc.active = false;
npc.netUpdate = true;
}
break;
}
}
#endregion
#region AI
public override void AI(NPC npc)
{
if (!CalamityWorld.spawnedHardBoss)
{
if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCID.SkeletronPrime ||
npc.type == NPCID.Plantera || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() ||
npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() ||
npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() || npc.type == ModContent.NPCType() ||
npc.type == ModContent.NPCType() || npc.type == NPCID.DukeFishron || npc.type == NPCID.CultistBoss || npc.type == NPCID.Golem)
{
CalamityWorld.spawnedHardBoss = true;
CalamityMod.UpdateServerBoolean();
}
}
if (CalamityWorld.revenge || CalamityWorld.bossRushActive)
{
bool configBossRushBoost = Config.BossRushXerocCurse && CalamityWorld.bossRushActive;
switch (npc.type)
{
case NPCID.DungeonGuardian:
CalamityGlobalAI.RevengeanceDungeonGuardianAI(npc, configBossRushBoost, enraged > 0);
break;
case NPCID.Lihzahrd:
CalamityGlobalAI.RevengeanceLihzahrdAI(npc);
break;
case NPCID.IceGolem:
CalamityGlobalAI.RevengeanceIceGolemAI(npc);
break;
default:
break;
}
}
}
#endregion
#region Post AI
public override void PostAI(NPC npc)
{
//Debuff decrements
if (timeSlow > 0)
timeSlow--;
if (gState > 0)
gState--;
if (tSad > 0)
tSad--;
if (eFreeze > 0)
eFreeze--;
if (silvaStun > 0)
silvaStun--;
if (webbed > 0)
webbed--;
if (slowed > 0)
slowed--;
if (yellowCandle > 0)
yellowCandle--;
if (pearlAura > 0)
pearlAura--;
if (wCleave > 0)
wCleave--;
if (bBlood > 0)
bBlood--;
if (dFlames > 0)
dFlames--;
if (marked > 0)
marked--;
if (vaporfied > 0)
vaporfied--;
if (irradiated > 0)
irradiated--;
if (bFlames > 0)
bFlames--;
if (hFlames > 0)
hFlames--;
if (pFlames > 0)
pFlames--;
if (aFlames > 0)
aFlames--;
if (pShred > 0)
pShred--;
if (aCrunch > 0)
aCrunch--;
if (cDepth > 0)
cDepth--;
if (gsInferno > 0)
gsInferno--;
if (astralInfection > 0)
astralInfection--;
if (wDeath > 0)
wDeath--;
if (nightwither > 0)
nightwither--;
if (enraged > 0)
enraged--;
if (shellfishVore > 0)
shellfishVore--;
if (clamDebuff > 0)
clamDebuff--;
if (sulphurPoison > 0)
sulphurPoison--;
// Bosses and any specific other NPCs are completely immune to having their movement impaired.
if (npc.boss || CalamityMod.movementImpairImmuneList.Contains(npc.type))
return;
if (!CalamityPlayer.areThereAnyDamnBosses)
{
if (pearlAura > 0)
npc.velocity *= 0.9f;
if (vaporfied > 0)
npc.velocity *= 0.9f;
}
if (!CalamityWorld.bossRushActive)
{
if (silvaStun > 0)
npc.velocity = Vector2.Zero;
else if (timeSlow > 0 || webbed > 0)
npc.velocity *= 0.85f;
else if (slowed > 0)
npc.velocity *= 0.9f;
}
}
#endregion
#region On Hit Player
public override void OnHitPlayer(NPC npc, Player target, int damage, bool crit)
{
if (target.Calamity().snowman)
{
if (npc.type == NPCID.Demon || npc.type == NPCID.VoodooDemon || npc.type == NPCID.RedDevil)
{
target.AddBuff(ModContent.BuffType(), 36000);
}
}
switch (npc.type)
{
case NPCID.Golem:
target.AddBuff(ModContent.BuffType(), 300);
break;
case NPCID.GolemHead:
case NPCID.GolemFistRight:
case NPCID.GolemFistLeft:
target.AddBuff(ModContent.BuffType(), 180);
break;
default:
break;
}
if (CalamityWorld.revenge)
{
if (Config.RevengeanceAndDeathThoriumBossBuff)
{
Mod thorium = ModLoader.GetMod("ThoriumMod");
if (thorium != null)
{
if (npc.type == thorium.NPCType("GraniteEnergyStorm") || npc.type == thorium.NPCType("TheBuriedWarrior") || npc.type == thorium.NPCType("TheBuriedWarrior1") ||
npc.type == thorium.NPCType("TheBuriedWarrior2") || npc.type == thorium.NPCType("ThePrimeScouter") || npc.type == thorium.NPCType("CryoCore") ||
npc.type == thorium.NPCType("BioCore") || npc.type == thorium.NPCType("PyroCore") || npc.type == thorium.NPCType("SlagFury") ||
npc.type == thorium.NPCType("Omnicide") || npc.type == thorium.NPCType("RealityBreaker") || npc.type == thorium.NPCType("Aquaius") ||
npc.type == thorium.NPCType("Aquaius2"))
{
target.AddBuff(ModContent.BuffType(), 180);
}
else if (npc.type == thorium.NPCType("ViscountBaby") || npc.type == thorium.NPCType("EnemyBeholder") || npc.type == thorium.NPCType("AbyssalSpawn") ||
npc.type == thorium.NPCType("Viscount") || npc.type == thorium.NPCType("FallenDeathBeholder") || npc.type == thorium.NPCType("FallenDeathBeholder2") ||
npc.type == thorium.NPCType("Lich") || npc.type == thorium.NPCType("LichHeadless") || npc.type == thorium.NPCType("Abyssion") ||
npc.type == thorium.NPCType("AbyssionCracked") || npc.type == thorium.NPCType("AbyssionReleased"))
{
target.AddBuff(ModContent.BuffType(), 180);
target.AddBuff(ModContent.BuffType(), 180);
}
}
}
switch (npc.type)
{
case NPCID.DemonEye:
case NPCID.EaterofSouls:
case NPCID.EaterofWorldsTail:
case NPCID.ChaosBall:
case NPCID.VileSpit:
case NPCID.LeechHead:
case NPCID.Crimera:
case NPCID.FaceMonster:
case NPCID.BloodCrawler:
case NPCID.BloodCrawlerWall:
target.AddBuff(ModContent.BuffType(), 60);
break;
case NPCID.DevourerHead:
case NPCID.EaterofWorldsBody:
case NPCID.CorruptBunny:
case NPCID.CorruptGoldfish:
case NPCID.CorruptSlime:
case NPCID.Corruptor:
case NPCID.Clinger:
case NPCID.Slimer:
case NPCID.WanderingEye:
case NPCID.Frankenstein:
case NPCID.WallCreeper:
case NPCID.WallCreeperWall:
case NPCID.SwampThing:
case NPCID.CorruptPenguin:
case NPCID.Herpling:
case NPCID.FloatyGross:
case NPCID.Crimslime:
case NPCID.BloodFeeder:
case NPCID.BloodJelly:
case NPCID.IchorSticker:
case NPCID.Ghost:
case NPCID.CreatureFromTheDeep:
case NPCID.Fritz:
case NPCID.CrimsonBunny:
case NPCID.CrimsonGoldfish:
case NPCID.CrimsonPenguin:
case NPCID.Drippler:
target.AddBuff(ModContent.BuffType(), 120);
break;
case NPCID.EyeofCthulhu:
case NPCID.ServantofCthulhu:
case NPCID.SkeletronHead:
case NPCID.Demon:
case NPCID.VoodooDemon:
case NPCID.CursedHammer:
case NPCID.SeekerHead:
case NPCID.RedDevil:
case NPCID.BlackRecluse:
case NPCID.CrimsonAxe:
case NPCID.Nymph:
case NPCID.BlackRecluseWall:
case NPCID.Eyezor:
case NPCID.BrainofCthulhu:
case NPCID.HeadlessHorseman:
case NPCID.Splinterling:
case NPCID.Hellhound:
case NPCID.Poltergeist:
case NPCID.Nailhead:
case NPCID.DrManFly:
case NPCID.ThePossessed:
case NPCID.Mothron:
case NPCID.Medusa:
case NPCID.SandsharkCorrupt:
case NPCID.SandsharkCrimson:
target.AddBuff(ModContent.BuffType(), 180);
break;
case NPCID.MourningWood:
case NPCID.Pumpking:
target.AddBuff(ModContent.BuffType(), 240);
break;
case NPCID.WallofFlesh:
case NPCID.Krampus:
target.AddBuff(ModContent.BuffType(), 300);
break;
case NPCID.DungeonGuardian:
target.AddBuff(ModContent.BuffType(), 1200);
break;
case NPCID.Creeper:
target.AddBuff(ModContent.BuffType(), 60);
target.AddBuff(ModContent.BuffType(), 120);
break;
case NPCID.CursedSkull:
case NPCID.SkeletronHand:
case NPCID.TheHungry:
case NPCID.TheHungryII:
case NPCID.PumpkingBlade:
case NPCID.BloodZombie:
target.AddBuff(ModContent.BuffType(), 120);
target.AddBuff(ModContent.BuffType(), 120);
break;
case NPCID.DarkMummy:
target.AddBuff(ModContent.BuffType(), 180);
target.AddBuff(ModContent.BuffType(), 120);
break;
case NPCID.EaterofWorldsHead:
case NPCID.GiantCursedSkull:
case NPCID.Butcher:
case NPCID.Psycho:
target.AddBuff(ModContent.BuffType(), 180);
target.AddBuff(ModContent.BuffType(), 180);
break;
case NPCID.Wraith:
case NPCID.VampireBat:
case NPCID.Vampire:
case NPCID.Reaper:
target.AddBuff(ModContent.BuffType(), 240);
target.AddBuff(ModContent.BuffType(), 180);
break;
case NPCID.AncientCultistSquidhead:
target.AddBuff(ModContent.BuffType(), 240);
target.AddBuff(ModContent.BuffType(), 240);
break;
case NPCID.DungeonSpirit:
target.AddBuff(ModContent.BuffType(), 300);
target.AddBuff(ModContent.BuffType(), 180);
break;
case NPCID.AncientDoom:
target.AddBuff(ModContent.BuffType(), 300);
target.AddBuff(ModContent.BuffType(), 300);
break;
case NPCID.Snatcher:
target.AddBuff(ModContent.BuffType(), 60);
break;
case NPCID.BurningSphere:
case NPCID.ManEater:
case NPCID.Mummy:
case NPCID.EnchantedSword:
case NPCID.Werewolf:
target.AddBuff(ModContent.BuffType(), 120);
break;
case NPCID.Spazmatism:
case NPCID.PrimeSaw:
case NPCID.PrimeVice:
case NPCID.Probe:
case NPCID.QueenBee:
case NPCID.GolemFistLeft:
case NPCID.GolemFistRight:
case NPCID.Spore:
case NPCID.BoneLee:
case NPCID.Flocko:
case NPCID.DukeFishron:
case NPCID.Sharkron:
case NPCID.Sharkron2:
case NPCID.ShadowFlameApparition:
case NPCID.MartianDrone:
target.AddBuff(ModContent.BuffType(), 180);
break;
case NPCID.Mimic:
case NPCID.AngryTrapper:
target.AddBuff(ModContent.BuffType(), 240);
break;
case NPCID.DetonatingBubble:
target.AddBuff(ModContent.BuffType(), 360);
break;
default:
break;
}
}
}
#endregion
#region Modify Hit By Projectile
public override void ModifyHitByProjectile(NPC npc, Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
if (npc.townNPC && projectile.hostile)
{
damage *= Main.expertMode ? 4 : 2;
}
if (AstrumDeusIDs.Contains(npc.type))
{
if (projectile.type == ModContent.ProjectileType() || ProjectileID.Sets.StardustDragon[projectile.type])
{
damage = (int)(damage * 0.1);
}
else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() ||
projectile.type == ModContent.ProjectileType