Suggestions + ModBossBar round 2
- Frost armor & Necro armor set bonus - Wider Altar of the Accursed - Essence edit again
This commit is contained in:
1 parent
b6f765b0a5
commit
ba6bc032f8
52 files changed
+727
-29
No files matched your search
@@ -222,6 +222,7 @@ namespace CalamityMod.CalPlayer
|
||||
public int auralisAuroraCounter = 0;
|
||||
public int auralisAuroraCooldown = 0;
|
||||
public int auralisAurora = 0;
|
||||
public int necroReviveCounter = -1;
|
||||
public int hideOfDeusTimer = 0;
|
||||
public int spiritOriginBullseyeShootCountdown = 0;
|
||||
public int spiritOriginConvertedCrit = 0;
|
||||
@@ -611,6 +612,8 @@ namespace CalamityMod.CalPlayer
|
||||
public int tornadoCooldown = 0;
|
||||
public bool eskimoSet = false; //vanilla armor
|
||||
public bool meteorSet = false; //vanilla armor, for space gun nerf
|
||||
public bool necroSet = false; //vanilla armor
|
||||
public bool frostSet = false; //vanilla armor
|
||||
public bool victideSet = false;
|
||||
public bool victideSummoner = false;
|
||||
public bool sulfurSet = false;
|
||||
@@ -1704,6 +1707,8 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
eskimoSet = false; //vanilla armor
|
||||
meteorSet = false; //vanilla armor, for Space Gun nerf
|
||||
necroSet = false; //vanilla armor
|
||||
frostSet = false; //vanilla armor
|
||||
|
||||
victideSet = false;
|
||||
victideSummoner = false;
|
||||
@@ -2116,6 +2121,7 @@ namespace CalamityMod.CalPlayer
|
||||
auralisAuroraCounter = 0;
|
||||
auralisAuroraCooldown = 0;
|
||||
auralisAurora = 0;
|
||||
necroReviveCounter = -1;
|
||||
hideOfDeusTimer = 0;
|
||||
RustyMedallionCooldown = 0;
|
||||
SulphWaterPoisoningLevel = 0f;
|
||||
@@ -2387,6 +2393,8 @@ namespace CalamityMod.CalPlayer
|
||||
tornadoCooldown = 0;
|
||||
eskimoSet = false; //vanilla armor
|
||||
meteorSet = false; //vanilla armor, for Space Gun nerf
|
||||
necroSet = false; //vanilla armor
|
||||
frostSet = false; //vanilla armor
|
||||
victideSet = false;
|
||||
aeroSet = false;
|
||||
sulfurSet = false;
|
||||
@@ -3827,6 +3835,18 @@ namespace CalamityMod.CalPlayer
|
||||
return false;
|
||||
}
|
||||
|
||||
if (necroSet && necroReviveCounter == -1)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.DD2_SkeletonDeath, Player.Center);
|
||||
|
||||
necroReviveCounter = 0; // Start ticking the timer of death
|
||||
Player.statLife = Player.statLifeMax2;
|
||||
|
||||
if (Player.statLife < 1)
|
||||
Player.statLife = 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (permafrostsConcoction && !Player.HasCooldown(PermafrostConcoction.ID))
|
||||
{
|
||||
Player.AddCooldown(PermafrostConcoction.ID, CalamityUtils.SecondsToFrames(180));
|
||||
@@ -4269,6 +4289,21 @@ namespace CalamityMod.CalPlayer
|
||||
int defenseAdd = (int)(target.defense * 0.5);
|
||||
damage += defenseAdd;
|
||||
}
|
||||
if (frostSet)
|
||||
{
|
||||
float DistanceInterpolant = Utils.GetLerpValue(FrostArmorSetChange.MinDistance, FrostArmorSetChange.MaxDistance, target.Distance(Main.player[Main.myPlayer].Center), true);
|
||||
if (item.CountsAsClass<MeleeDamageClass>())
|
||||
{
|
||||
float MeleeDamageFactor = MathHelper.Lerp(1f, FrostArmorSetChange.ProximityBoost, 1 - DistanceInterpolant);
|
||||
damage = (int)Math.Ceiling(damage * MeleeDamageFactor);
|
||||
}
|
||||
// Works with bayonets too... for the few that exists
|
||||
else if (item.CountsAsClass<RangedDamageClass>())
|
||||
{
|
||||
float RangedDamageFactor = MathHelper.Lerp(1f, FrostArmorSetChange.ProximityBoost, DistanceInterpolant);
|
||||
damage = (int)Math.Ceiling(damage * RangedDamageFactor);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -4353,6 +4388,20 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
}
|
||||
}
|
||||
if (frostSet)
|
||||
{
|
||||
float DistanceInterpolant = Utils.GetLerpValue(FrostArmorSetChange.MinDistance, FrostArmorSetChange.MaxDistance, target.Distance(Main.player[proj.owner].Center), true);
|
||||
if (proj.CountsAsClass<MeleeDamageClass>())
|
||||
{
|
||||
float MeleeDamageFactor = MathHelper.Lerp(1f, FrostArmorSetChange.ProximityBoost, 1 - DistanceInterpolant);
|
||||
damage = (int)Math.Ceiling(damage * MeleeDamageFactor);
|
||||
}
|
||||
else if (proj.CountsAsClass<RangedDamageClass>())
|
||||
{
|
||||
float RangedDamageFactor = MathHelper.Lerp(1f, FrostArmorSetChange.ProximityBoost, DistanceInterpolant);
|
||||
damage = (int)Math.Ceiling(damage * RangedDamageFactor);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region MultiplicativeReductions
|
||||
|
||||
@@ -1287,6 +1287,22 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
}
|
||||
|
||||
// Necro armor post-mortem effects. Activates regardless of having the armor equipped because it is a "delayed death"
|
||||
if (necroReviveCounter >= 0)
|
||||
{
|
||||
necroReviveCounter++;
|
||||
float ratioUntilDead = necroReviveCounter / (NecroArmorSetChange.PostMortemDuration * 60f);
|
||||
int upperHealthLimit = (int)MathHelper.Lerp(Player.statLifeMax2, 1, ratioUntilDead);
|
||||
|
||||
if (Player.statLife > upperHealthLimit)
|
||||
Player.statLife = upperHealthLimit;
|
||||
|
||||
if (necroReviveCounter >= NecroArmorSetChange.PostMortemDuration * 60)
|
||||
Player.KillMe(PlayerDeathReason.ByCustomReason($"{Player.name} fell to the inevitable."), 1000, -1);
|
||||
else if (necroReviveCounter % 60 == 59)
|
||||
SoundEngine.PlaySound(SoundID.Item17, Player.Center);
|
||||
}
|
||||
|
||||
// Silva invincibility effects
|
||||
if (silvaCountdown > 0 && hasSilvaEffect && silvaSet)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.createTile = ModContent.TileType<SCalAltar>();
|
||||
Item.createTile = ModContent.TileType<SCalAltarLarge>();
|
||||
Item.useTurn = true;
|
||||
Item.useAnimation = 15;
|
||||
Item.useTime = 10;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.VanillaArmorChanges
|
||||
{
|
||||
public class FrostArmorSetChange : VanillaArmorChange
|
||||
{
|
||||
public override int? HeadPieceID => ItemID.FrostHelmet;
|
||||
|
||||
public override int? BodyPieceID => ItemID.FrostBreastplate;
|
||||
|
||||
public override int? LegPieceID => ItemID.FrostLeggings;
|
||||
|
||||
public override string ArmorSetName => "Frost";
|
||||
|
||||
public const float ProximityBoost = 1.15f;
|
||||
public const float MinDistance = 160f;
|
||||
public const float MaxDistance = 800f;
|
||||
|
||||
public override void UpdateSetBonusText(ref string setBonusText)
|
||||
{
|
||||
int PercentBoost = (int)Math.Round(ProximityBoost * 100) - 100;
|
||||
setBonusText = "Melee and ranged attacks inflict Frostbite\n" +
|
||||
$"{PercentBoost}% increased damage which scales based on how far the target is from you\n" +
|
||||
"Closer range grants melee damage, while farther range grants ranged damage";
|
||||
}
|
||||
|
||||
public override void ApplyArmorSetBonus(Player player)
|
||||
{
|
||||
player.Calamity().frostSet = true;
|
||||
|
||||
// Cancel out the old bonuses
|
||||
player.GetDamage<MeleeDamageClass>() -= 0.1f;
|
||||
player.GetDamage<RangedDamageClass>() -= 0.1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.VanillaArmorChanges
|
||||
{
|
||||
public class NecroArmorSetChange : VanillaArmorChange
|
||||
{
|
||||
public override int? HeadPieceID => ItemID.NecroHelmet;
|
||||
|
||||
public override int? BodyPieceID => ItemID.NecroBreastplate;
|
||||
|
||||
public override int? LegPieceID => ItemID.NecroGreaves;
|
||||
|
||||
public override int[] AlternativeHeadPieceIDs => new int[] { ItemID.AncientNecroHelmet };
|
||||
|
||||
public override string ArmorSetName => "Necro";
|
||||
|
||||
public const int PostMortemDuration = 7;
|
||||
|
||||
public override void UpdateSetBonusText(ref string setBonusText)
|
||||
{
|
||||
string extraLines = "\nAllows you to temporarily survive fatal damage\n" +
|
||||
$"Grants up to {PostMortemDuration} seconds of life before imminent death";
|
||||
setBonusText += extraLines;
|
||||
}
|
||||
|
||||
public override void ApplyArmorSetBonus(Player player) => player.Calamity().necroSet = true;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.UI.VanillaBossBars;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -79,6 +80,7 @@ namespace CalamityMod.NPCs.AstrumDeus
|
||||
NPC.scale *= 1.2f;
|
||||
|
||||
NPC.boss = true;
|
||||
NPC.BossBar = ModContent.GetInstance<AstrumDeusBossBar>();
|
||||
NPC.value = Item.buyPrice(1, 0, 0, 0);
|
||||
NPC.alpha = 255;
|
||||
NPC.behindTiles = true;
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace CalamityMod.NPCs.CalClone
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.Calamity().canBreakPlayerDefense = true;
|
||||
NPC.GetNPCDamage();
|
||||
NPC.npcSlots = 5f;
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace CalamityMod.NPCs.CalClone
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.Calamity().canBreakPlayerDefense = true;
|
||||
NPC.GetNPCDamage();
|
||||
NPC.npcSlots = 5f;
|
||||
|
||||
@@ -10,6 +10,7 @@ using CalamityMod.Items.Potions;
|
||||
using CalamityMod.Items.TreasureBags;
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.UI.VanillaBossBars;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
@@ -67,6 +68,7 @@ namespace CalamityMod.NPCs.CeaselessVoid
|
||||
NPC.noGravity = true;
|
||||
NPC.noTileCollide = true;
|
||||
NPC.boss = true;
|
||||
NPC.BossBar = ModContent.GetInstance<CeaselessVoidBossBar>();
|
||||
NPC.DeathSound = DeathSound;
|
||||
NPC.Calamity().VulnerableToSickness = false;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace CalamityMod.NPCs.Crags
|
||||
npcLoot.Add(ItemID.Lens, 2);
|
||||
LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode());
|
||||
LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv());
|
||||
hardmode.Add(ModContent.ItemType<EssenceofHavoc>(), 3);
|
||||
hardmode.Add(ModContent.ItemType<EssenceofHavoc>(), 2);
|
||||
postProv.Add(ModContent.ItemType<Bloodstone>(), 4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace CalamityMod.NPCs.Crags
|
||||
public override void ModifyNPCLoot(NPCLoot npcLoot)
|
||||
{
|
||||
npcLoot.Add(ModContent.ItemType<InfernalSuevite>(), 1, 10, 26);
|
||||
npcLoot.Add(ModContent.ItemType<EssenceofHavoc>(), 3);
|
||||
npcLoot.Add(ModContent.ItemType<EssenceofHavoc>(), 2);
|
||||
LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv());
|
||||
postProv.Add(ModContent.ItemType<Bloodstone>(), 4);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace CalamityMod.NPCs.Crags
|
||||
|
||||
public override void ModifyNPCLoot(NPCLoot npcLoot)
|
||||
{
|
||||
npcLoot.Add(ModContent.ItemType<EssenceofHavoc>(), 3);
|
||||
npcLoot.Add(ModContent.ItemType<EssenceofHavoc>(), 2);
|
||||
LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv());
|
||||
postProv.Add(ModContent.ItemType<Bloodstone>(), 4);
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace CalamityMod.NPCs.Crags
|
||||
npcLoot.Add(ModContent.ItemType<BrimstoneSlag>(), 5, 10, 30);
|
||||
LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode());
|
||||
LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv());
|
||||
hardmode.Add(ModContent.ItemType<EssenceofHavoc>(), 3);
|
||||
hardmode.Add(ModContent.ItemType<EssenceofHavoc>(), 2);
|
||||
postProv.Add(ModContent.ItemType<Bloodstone>(), 4);
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.Crags
|
||||
public override void ModifyNPCLoot(NPCLoot npcLoot)
|
||||
{
|
||||
LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode());
|
||||
hardmode.Add(ModContent.ItemType<EssenceofHavoc>(), 3);
|
||||
hardmode.Add(ModContent.ItemType<EssenceofHavoc>(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,7 +269,7 @@ namespace CalamityMod.NPCs.Crags
|
||||
{
|
||||
LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode());
|
||||
LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv());
|
||||
hardmode.Add(ModContent.ItemType<EssenceofHavoc>(), 3);
|
||||
hardmode.Add(ModContent.ItemType<EssenceofHavoc>(), 2);
|
||||
postProv.Add(ModContent.ItemType<Bloodstone>(), 4);
|
||||
postProv.Add(ModContent.ItemType<GuidelightofOblivion>(), 20);
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ namespace CalamityMod.NPCs.Crags
|
||||
|
||||
LeadingConditionRule hardmode = npcLoot.DefineConditionalDropSet(DropHelper.Hardmode());
|
||||
LeadingConditionRule postProv = npcLoot.DefineConditionalDropSet(DropHelper.PostProv());
|
||||
hardmode.Add(ModContent.ItemType<EssenceofHavoc>(), 3);
|
||||
hardmode.Add(ModContent.ItemType<EssenceofHavoc>(), 2);
|
||||
postProv.Add(ModContent.ItemType<Bloodstone>(), 4);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Tiles.AstralSnow;
|
||||
using CalamityMod.Tiles.Ores;
|
||||
using CalamityMod.UI.VanillaBossBars;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -93,6 +94,7 @@ namespace CalamityMod.NPCs.Cryogen
|
||||
NPC.knockBackResist = 0f;
|
||||
NPC.value = Item.buyPrice(0, 40, 0, 0);
|
||||
NPC.boss = true;
|
||||
NPC.BossBar = ModContent.GetInstance<CryogenBossBar>();
|
||||
NPC.noGravity = true;
|
||||
NPC.noTileCollide = true;
|
||||
NPC.coldDamage = true;
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace CalamityMod.NPCs.DesertScourge
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.Calamity().canBreakPlayerDefense = true;
|
||||
NPC.GetNPCDamage();
|
||||
|
||||
|
||||
@@ -166,6 +166,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
|
||||
NPC.DeathSound = SoundID.NPCDeath14;
|
||||
NPC.netAlways = true;
|
||||
NPC.boss = true;
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.Calamity().VulnerableToSickness = false;
|
||||
NPC.Calamity().VulnerableToElectricity = true;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ using CalamityMod.NPCs.ExoMechs.Thanatos;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Skies;
|
||||
using CalamityMod.UI.VanillaBossBars;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -188,6 +189,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
|
||||
NPC.DeathSound = SoundID.NPCDeath14;
|
||||
NPC.netAlways = true;
|
||||
NPC.boss = true;
|
||||
NPC.BossBar = ModContent.GetInstance<ExoMechsBossBar>();
|
||||
NPC.Calamity().VulnerableToSickness = false;
|
||||
NPC.Calamity().VulnerableToElectricity = true;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using CalamityMod.NPCs.ExoMechs.Ares;
|
||||
using CalamityMod.NPCs.ExoMechs.Thanatos;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.Skies;
|
||||
using CalamityMod.UI.VanillaBossBars;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -197,6 +198,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis
|
||||
NPC.DeathSound = SoundID.NPCDeath14;
|
||||
NPC.netAlways = true;
|
||||
NPC.boss = true;
|
||||
NPC.BossBar = ModContent.GetInstance<ExoMechsBossBar>();
|
||||
NPC.Calamity().VulnerableToSickness = false;
|
||||
NPC.Calamity().VulnerableToElectricity = true;
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
NPC.dontCountMe = true;
|
||||
NPC.chaseable = false;
|
||||
NPC.boss = true;
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.Calamity().VulnerableToSickness = false;
|
||||
NPC.Calamity().VulnerableToElectricity = true;
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
NPC.dontCountMe = true;
|
||||
NPC.chaseable = false;
|
||||
NPC.boss = true;
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.Calamity().VulnerableToSickness = false;
|
||||
NPC.Calamity().VulnerableToElectricity = true;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using CalamityMod.Items.Potions;
|
||||
using CalamityMod.NPCs.ExoMechs.Ares;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.UI.VanillaBossBars;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -165,6 +166,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
NPC.DeathSound = SoundID.NPCDeath14;
|
||||
NPC.netAlways = true;
|
||||
NPC.boss = true;
|
||||
NPC.BossBar = ModContent.GetInstance<ExoMechsBossBar>();
|
||||
NPC.chaseable = false;
|
||||
NPC.Calamity().VulnerableToSickness = false;
|
||||
NPC.Calamity().VulnerableToElectricity = true;
|
||||
|
||||
@@ -80,6 +80,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
NPC.dontCountMe = true;
|
||||
NPC.chaseable = false;
|
||||
NPC.boss = true;
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.Calamity().VulnerableToSickness = false;
|
||||
NPC.Calamity().VulnerableToElectricity = true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Items.Placeables.Furniture.Trophies;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.UI.VanillaBossBars;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -63,6 +64,7 @@ namespace CalamityMod.NPCs.Leviathan
|
||||
NPC.aiStyle = -1;
|
||||
AIType = -1;
|
||||
NPC.boss = true;
|
||||
NPC.BossBar = ModContent.GetInstance<LeviathanAnahitaBossBar>();
|
||||
NPC.value = Item.buyPrice(0, 60, 0, 0);
|
||||
NPC.noGravity = true;
|
||||
NPC.noTileCollide = true;
|
||||
|
||||
@@ -14,6 +14,7 @@ using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Items.Weapons.Rogue;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.UI.VanillaBossBars;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -76,6 +77,7 @@ namespace CalamityMod.NPCs.Leviathan
|
||||
NPC.noTileCollide = true;
|
||||
NPC.noGravity = true;
|
||||
NPC.boss = true;
|
||||
NPC.BossBar = ModContent.GetInstance<LeviathanAnahitaBossBar>();
|
||||
NPC.netAlways = true;
|
||||
NPC.Calamity().VulnerableToHeat = false;
|
||||
NPC.Calamity().VulnerableToSickness = true;
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace CalamityMod.NPCs.Perforator
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.Calamity().canBreakPlayerDefense = true;
|
||||
NPC.GetNPCDamage();
|
||||
NPC.npcSlots = 5f;
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace CalamityMod.NPCs.Perforator
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.Calamity().canBreakPlayerDefense = true;
|
||||
NPC.GetNPCDamage();
|
||||
NPC.npcSlots = 5f;
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace CalamityMod.NPCs.Perforator
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.Calamity().canBreakPlayerDefense = true;
|
||||
NPC.GetNPCDamage();
|
||||
NPC.npcSlots = 5f;
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace CalamityMod.NPCs.Polterghast
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.Calamity().canBreakPlayerDefense = true;
|
||||
NPC.GetNPCDamage();
|
||||
NPC.width = 90;
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.Calamity().canBreakPlayerDefense = true;
|
||||
NPC.npcSlots = 3f;
|
||||
NPC.aiStyle = -1;
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.Calamity().canBreakPlayerDefense = true;
|
||||
NPC.npcSlots = 3f;
|
||||
NPC.aiStyle = -1;
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.Calamity().canBreakPlayerDefense = true;
|
||||
NPC.npcSlots = 1f;
|
||||
NPC.aiStyle = -1;
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.npcSlots = 1f;
|
||||
NPC.aiStyle = -1;
|
||||
NPC.damage = 20;
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace CalamityMod.NPCs.Providence
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.Calamity().canBreakPlayerDefense = true;
|
||||
NPC.npcSlots = 1f;
|
||||
NPC.aiStyle = -1;
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
NPC.LifeMaxNERB(7500, 9000, 160000);
|
||||
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
|
||||
NPC.lifeMax += (int)(NPC.lifeMax * HPBoost);
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.knockBackResist = 0f;
|
||||
AnimationType = NPCID.KingSlime;
|
||||
NPC.value = 0f;
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
NPC.LifeMaxNERB(8000, 9600, 220000);
|
||||
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
|
||||
NPC.lifeMax += (int)(NPC.lifeMax * HPBoost);
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.aiStyle = -1;
|
||||
AIType = -1;
|
||||
NPC.knockBackResist = 0f;
|
||||
|
||||
@@ -14,6 +14,7 @@ using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Items.Weapons.Summon;
|
||||
using CalamityMod.NPCs.TownNPCs;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.UI.VanillaBossBars;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -68,6 +69,7 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
NPC.value = Item.buyPrice(0, 25, 0, 0);
|
||||
NPC.Opacity = 0.8f;
|
||||
NPC.boss = true;
|
||||
NPC.BossBar = ModContent.GetInstance<SlimeGodBossBar>();
|
||||
NPC.noGravity = true;
|
||||
NPC.noTileCollide = true;
|
||||
NPC.dontTakeDamage = true;
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
NPC.LifeMaxNERB(1875, 2250, 80000);
|
||||
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
|
||||
NPC.lifeMax += (int)(NPC.lifeMax * HPBoost);
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.GetNPCDamage();
|
||||
NPC.width = 150;
|
||||
NPC.height = 92;
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace CalamityMod.NPCs.SlimeGod
|
||||
NPC.LifeMaxNERB(2000, 2400, 110000);
|
||||
double HPBoost = CalamityConfig.Instance.BossHealthBoost * 0.01;
|
||||
NPC.lifeMax += (int)(NPC.lifeMax * HPBoost);
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.GetNPCDamage();
|
||||
NPC.width = 150;
|
||||
NPC.height = 92;
|
||||
|
||||
@@ -56,6 +56,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.damage = 0;
|
||||
NPC.npcSlots = 5f;
|
||||
NPC.width = 120;
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
NPC.BossBar = Main.BigBossProgressBar.NeverValid;
|
||||
NPC.damage = 0;
|
||||
NPC.npcSlots = 5f;
|
||||
NPC.width = 120;
|
||||
|
||||
@@ -62,7 +62,22 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations
|
||||
Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, Width * 16, Height * 16, ModContent.ItemType<AltarOfTheAccursedItem>());
|
||||
}
|
||||
|
||||
public override bool RightClick(int i, int j)
|
||||
public override bool RightClick(int i, int j) => AttemptToSummonSCal(i, j);
|
||||
public override void MouseOver(int i, int j) => HoverItemIcon();
|
||||
public override void MouseOverFar(int i, int j) => HoverItemIcon();
|
||||
|
||||
public static void HoverItemIcon()
|
||||
{
|
||||
if (Main.LocalPlayer.HasItem(ModContent.ItemType<CeremonialUrn>()))
|
||||
Main.LocalPlayer.cursorItemIconID = ModContent.ItemType<CeremonialUrn>();
|
||||
else
|
||||
Main.LocalPlayer.cursorItemIconID = ModContent.ItemType<AshesofCalamity>();
|
||||
|
||||
Main.LocalPlayer.noThrow = 2;
|
||||
Main.LocalPlayer.cursorItemIconEnabled = true;
|
||||
}
|
||||
|
||||
public static bool AttemptToSummonSCal(int i, int j)
|
||||
{
|
||||
Tile tile = Main.tile[i, j];
|
||||
|
||||
@@ -91,30 +106,57 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations
|
||||
|
||||
if (!usingSpecialItem)
|
||||
Main.LocalPlayer.ConsumeItem(ModContent.ItemType<AshesofCalamity>(), true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class SCalAltarLarge : ModTile
|
||||
{
|
||||
public const int Width = 5;
|
||||
public const int Height = 3;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.tileFrameImportant[Type] = true;
|
||||
Main.tileNoAttach[Type] = true;
|
||||
Main.tileLavaDeath[Type] = false;
|
||||
|
||||
// Various data sets to protect this tile from unintentional death
|
||||
TileID.Sets.PreventsTileRemovalIfOnTopOfIt[Type] = true;
|
||||
//TileID.Sets.PreventsTileReplaceIfOnTopOfIt[Type] = true; Since this is a furniture item this may be unnecessary?
|
||||
TileID.Sets.PreventsSandfall[Type] = true;
|
||||
|
||||
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2);
|
||||
TileObjectData.newTile.Width = 5;
|
||||
TileObjectData.newTile.Height = 3;
|
||||
TileObjectData.newTile.Origin = new Point16(1, 2);
|
||||
TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0);
|
||||
TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 };
|
||||
TileObjectData.newTile.DrawYOffset = 2;
|
||||
TileObjectData.newTile.StyleHorizontal = true;
|
||||
TileObjectData.newTile.LavaDeath = false;
|
||||
TileObjectData.addTile(Type);
|
||||
ModTranslation name = CreateMapEntryName();
|
||||
name.SetDefault("Altar");
|
||||
AddMapEntry(new Color(43, 19, 42), name);
|
||||
TileID.Sets.DisableSmartCursor[Type] = true;
|
||||
}
|
||||
|
||||
public override bool CanExplode(int i, int j) => false;
|
||||
|
||||
public override bool CreateDust(int i, int j, ref int type)
|
||||
{
|
||||
// Red torch dust.
|
||||
type = 60;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void MouseOver(int i, int j)
|
||||
public override void KillMultiTile(int i, int j, int frameX, int frameY)
|
||||
{
|
||||
if (Main.LocalPlayer.HasItem(ModContent.ItemType<CeremonialUrn>()))
|
||||
Main.LocalPlayer.cursorItemIconID = ModContent.ItemType<CeremonialUrn>();
|
||||
else
|
||||
Main.LocalPlayer.cursorItemIconID = ModContent.ItemType<AshesofCalamity>();
|
||||
|
||||
Main.LocalPlayer.noThrow = 2;
|
||||
Main.LocalPlayer.cursorItemIconEnabled = true;
|
||||
Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, Width * 16, Height * 16, ModContent.ItemType<AltarOfTheAccursedItem>());
|
||||
}
|
||||
|
||||
public override void MouseOverFar(int i, int j)
|
||||
{
|
||||
if (Main.LocalPlayer.HasItem(ModContent.ItemType<CeremonialUrn>()))
|
||||
Main.LocalPlayer.cursorItemIconID = ModContent.ItemType<CeremonialUrn>();
|
||||
else
|
||||
Main.LocalPlayer.cursorItemIconID = ModContent.ItemType<AshesofCalamity>();
|
||||
|
||||
Main.LocalPlayer.noThrow = 2;
|
||||
Main.LocalPlayer.cursorItemIconEnabled = true;
|
||||
}
|
||||
public override bool RightClick(int i, int j) => SCalAltar.AttemptToSummonSCal(i, j);
|
||||
public override void MouseOver(int i, int j) => SCalAltar.HoverItemIcon();
|
||||
public override void MouseOverFar(int i, int j) => SCalAltar.HoverItemIcon();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1,72 @@
|
||||
using CalamityMod.NPCs.AstrumDeus;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.GameContent.UI.BigProgressBar;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.UI.VanillaBossBars
|
||||
{
|
||||
public class AstrumDeusBossBar : ModBossBar
|
||||
{
|
||||
public override Asset<Texture2D> GetIconTexture(ref Rectangle? iconFrame) => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[NPCType<AstrumDeusHead>()]];
|
||||
|
||||
public override bool? ModifyInfo(ref BigProgressBarInfo info, ref float lifePercent, ref float shieldPercent)
|
||||
{
|
||||
NPC target = Main.npc[info.npcIndexToAimAt];
|
||||
if (!target.active && !FindMoreWorms(ref info))
|
||||
return false;
|
||||
|
||||
int life = 0;
|
||||
int lifeMax = 0;
|
||||
|
||||
// Determine the real health by finding more of itself
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC worm = Main.npc[i];
|
||||
if (worm.active && worm.type == target.type)
|
||||
{
|
||||
// In Death Mode, every worm must be killed
|
||||
if (CalamityWorld.death)
|
||||
{
|
||||
life += worm.life;
|
||||
lifeMax += worm.lifeMax;
|
||||
}
|
||||
// Otherwise, find the minimum
|
||||
else
|
||||
{
|
||||
if (life <= 0)
|
||||
life = worm.life;
|
||||
else
|
||||
life = Math.Min(life, worm.life);
|
||||
|
||||
lifeMax = worm.lifeMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
lifePercent = Utils.Clamp(life / (float)lifeMax, 0f, 1f);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool FindMoreWorms(ref BigProgressBarInfo info)
|
||||
{
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC target = Main.npc[i];
|
||||
if (target.active && target.type == NPCType<AstrumDeusHead>())
|
||||
{
|
||||
info.npcIndexToAimAt = i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using CalamityMod.NPCs.CeaselessVoid;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.GameContent.UI.BigProgressBar;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.UI.VanillaBossBars
|
||||
{
|
||||
public class CeaselessVoidBossBar : ModBossBar
|
||||
{
|
||||
// Used to determine the max health of a multi-segmented boss
|
||||
public NPC FalseNPCSegment;
|
||||
|
||||
public override Asset<Texture2D> GetIconTexture(ref Rectangle? iconFrame) => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[NPCType<CeaselessVoid>()]];
|
||||
|
||||
public override bool? ModifyInfo(ref BigProgressBarInfo info, ref float lifePercent, ref float shieldPercent)
|
||||
{
|
||||
NPC target = Main.npc[info.npcIndexToAimAt];
|
||||
if (!target.active)
|
||||
return false;
|
||||
|
||||
// Normal boss health
|
||||
lifePercent = Utils.Clamp(target.life / (float)target.lifeMax, 0f, 1f);
|
||||
|
||||
// Determine the shield health
|
||||
int shield = 0;
|
||||
int shieldMax = 0;
|
||||
// Amount of Dark Energies expected from each phase/difficulty
|
||||
int ExpectedBallsCounter = ((lifePercent <= 0.1f ? 3 : lifePercent <= 0.4f ? 2 : lifePercent <= 0.7f ? 1 : 0) + (CalamityWorld.death ? 6 : CalamityWorld.revenge ? 5 : Main.expertMode ? 4 : 3)) * (Main.getGoodWorld ? 6 : 3) + 2;
|
||||
// The Dark Energies will instantly all die at a certain point of their total max health
|
||||
float RatioToCombust = 0.2f;
|
||||
if (NPC.AnyNPCs(NPCType<DarkEnergy>()))
|
||||
{
|
||||
// Add max shield by feeding the data of false NPCs
|
||||
FalseNPCSegment = new NPC();
|
||||
FalseNPCSegment.SetDefaults(NPCType<DarkEnergy>(), target.GetMatchingSpawnParams());
|
||||
shieldMax = (int)(FalseNPCSegment.lifeMax * ExpectedBallsCounter * (1 - RatioToCombust));
|
||||
shield -= (int)(FalseNPCSegment.lifeMax * ExpectedBallsCounter * RatioToCombust);
|
||||
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC part = Main.npc[i];
|
||||
if (part.active && part.type == NPCType<DarkEnergy>())
|
||||
shield += part.life;
|
||||
}
|
||||
}
|
||||
shieldPercent = Utils.Clamp(shield / (float)shieldMax, 0f, 1f);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using CalamityMod.NPCs.Cryogen;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.GameContent.UI.BigProgressBar;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.UI.VanillaBossBars
|
||||
{
|
||||
public class CryogenBossBar : ModBossBar
|
||||
{
|
||||
public override Asset<Texture2D> GetIconTexture(ref Rectangle? iconFrame)
|
||||
{
|
||||
// Pyrogen moment
|
||||
if (CalamityWorld.getFixedBoi)
|
||||
return ModContent.Request<Texture2D>("CalamityMod/NPCs/Cryogen/Pyrogen_Head_Boss");
|
||||
return ModContent.Request<Texture2D>("CalamityMod/NPCs/Cryogen/Cryogen_Phase1_Head_Boss");
|
||||
}
|
||||
|
||||
public override bool? ModifyInfo(ref BigProgressBarInfo info, ref float lifePercent, ref float shieldPercent)
|
||||
{
|
||||
NPC target = Main.npc[info.npcIndexToAimAt];
|
||||
if (!target.active)
|
||||
return false;
|
||||
|
||||
// Normal boss health
|
||||
lifePercent = Utils.Clamp(target.life / (float)target.lifeMax, 0f, 1f);
|
||||
|
||||
// Determine the shield health
|
||||
int shield = 0;
|
||||
int shieldMax = 0;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC part = Main.npc[i];
|
||||
if (part.active && part.type == NPCType<CryogenShield>())
|
||||
{
|
||||
shield += part.life;
|
||||
shieldMax += part.lifeMax;
|
||||
}
|
||||
}
|
||||
shieldPercent = Utils.Clamp(shield / (float)shieldMax, 0f, 1f);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
using CalamityMod.NPCs.ExoMechs.Ares;
|
||||
using CalamityMod.NPCs.ExoMechs.Artemis;
|
||||
using CalamityMod.NPCs.ExoMechs.Thanatos;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.GameContent.UI.BigProgressBar;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.UI.VanillaBossBars
|
||||
{
|
||||
public class ExoMechsBossBar : ModBossBar
|
||||
{
|
||||
// Artemis will always be used to check twins, Apollo is there in spirit
|
||||
// For showing the correct boss icon when bosses go into solo
|
||||
public bool HideAres = false;
|
||||
public bool HideArtemis = false;
|
||||
public bool HideThanatos = false;
|
||||
|
||||
// For properly showing the first phase health
|
||||
public bool AllBossesSpawned = false;
|
||||
|
||||
// Used to determine the max health of a multi-segmented boss
|
||||
public NPC FalseNPCSegment;
|
||||
|
||||
public override Asset<Texture2D> GetIconTexture(ref Rectangle? iconFrame)
|
||||
{
|
||||
// Prioritize based on which boss(es) are hidden
|
||||
if (HideArtemis && HideThanatos && !HideAres)
|
||||
return TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[NPCType<AresBody>()]];
|
||||
if (HideAres && HideThanatos && !HideArtemis)
|
||||
return ModContent.Request<Texture2D>("CalamityMod/NPCs/ExoMechs/Artemis/ArtemisHead");
|
||||
if (HideAres && HideArtemis && !HideThanatos)
|
||||
return ModContent.Request<Texture2D>("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosNormalHead");
|
||||
// Otherwise, just run through alphabet sorting: Ares, Artemis, Thanatos
|
||||
if (!HideAres)
|
||||
return TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[NPCType<AresBody>()]];
|
||||
if (!HideArtemis)
|
||||
return ModContent.Request<Texture2D>("CalamityMod/NPCs/ExoMechs/Artemis/ArtemisHead");
|
||||
return ModContent.Request<Texture2D>("CalamityMod/NPCs/ExoMechs/Thanatos/ThanatosNormalHead");
|
||||
}
|
||||
|
||||
public override bool? ModifyInfo(ref BigProgressBarInfo info, ref float lifePercent, ref float shieldPercent)
|
||||
{
|
||||
ValidateAllMechs(ref info);
|
||||
NPC target = Main.npc[info.npcIndexToAimAt];
|
||||
|
||||
if (!target.active && !FindMechsAgain(ref info))
|
||||
return false;
|
||||
|
||||
// Immediately grab the boss's health, whichever one it is. We will check later.
|
||||
int life = target.life;
|
||||
int lifeMax = target.lifeMax;
|
||||
|
||||
// Checking for all bosses
|
||||
if (NPC.AnyNPCs(NPCType<AresBody>()) && NPC.AnyNPCs(NPCType<Artemis>()) && NPC.AnyNPCs(NPCType<ThanatosHead>()))
|
||||
AllBossesSpawned = true;
|
||||
|
||||
// Only run this after the first phase, where every boss has spawned
|
||||
if (AllBossesSpawned)
|
||||
{
|
||||
// Override max health by feeding the data of false NPCs
|
||||
FalseNPCSegment = new NPC();
|
||||
FalseNPCSegment.SetDefaults(NPCType<AresBody>(), target.GetMatchingSpawnParams());
|
||||
lifeMax = FalseNPCSegment.lifeMax;
|
||||
FalseNPCSegment.SetDefaults(NPCType<Artemis>(), target.GetMatchingSpawnParams());
|
||||
lifeMax += FalseNPCSegment.lifeMax;
|
||||
FalseNPCSegment.SetDefaults(NPCType<ThanatosHead>(), target.GetMatchingSpawnParams());
|
||||
lifeMax += FalseNPCSegment.lifeMax;
|
||||
|
||||
// Find the others
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC ecco = Main.npc[i];
|
||||
if (ecco.active && ecco.type == NPCType<AresBody>() && target.type != NPCType<AresBody>())
|
||||
life += ecco.life;
|
||||
|
||||
if (ecco.active && ecco.type == NPCType<Artemis>() && target.type != NPCType<Artemis>())
|
||||
life += ecco.life;
|
||||
|
||||
if (ecco.active && ecco.type == NPCType<ThanatosHead>() && target.type != NPCType<ThanatosHead>())
|
||||
life += ecco.life;
|
||||
}
|
||||
}
|
||||
lifePercent = Utils.Clamp(life / (float)lifeMax, 0f, 1f);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void ValidateAllMechs(ref BigProgressBarInfo info)
|
||||
{
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC target = Main.npc[i];
|
||||
// Find out first whether or not each of the mechs are in hiding
|
||||
if (target.type == NPCType<AresBody>())
|
||||
HideAres = target.Opacity < 0.5f;
|
||||
if (target.type == NPCType<Artemis>())
|
||||
HideArtemis = target.Opacity < 0.5f;
|
||||
if (target.type == NPCType<ThanatosHead>())
|
||||
HideThanatos = target.Opacity < 0.5f;
|
||||
}
|
||||
|
||||
// Manually re-hide bosses once they commit die
|
||||
if (!NPC.AnyNPCs(NPCType<AresBody>()))
|
||||
HideAres = true;
|
||||
if (!NPC.AnyNPCs(NPCType<Artemis>()))
|
||||
HideArtemis = true;
|
||||
if (!NPC.AnyNPCs(NPCType<ThanatosHead>()))
|
||||
HideThanatos = true;
|
||||
}
|
||||
|
||||
public bool FindMechsAgain(ref BigProgressBarInfo info)
|
||||
{
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC target = Main.npc[i];
|
||||
if (target.active)
|
||||
{
|
||||
// Get the index of the mech that's not hiding
|
||||
if (target.type == NPCType<AresBody>() && !HideAres)
|
||||
{
|
||||
info.npcIndexToAimAt = i;
|
||||
return true;
|
||||
}
|
||||
else if (target.type == NPCType<Artemis>() && !HideArtemis)
|
||||
{
|
||||
info.npcIndexToAimAt = i;
|
||||
return true;
|
||||
}
|
||||
else if (target.type == NPCType<ThanatosHead>() && !HideThanatos)
|
||||
{
|
||||
info.npcIndexToAimAt = i;
|
||||
return true;
|
||||
}
|
||||
// Failsafe
|
||||
else if (target.type == NPCType<AresBody>() || target.type == NPCType<Artemis>() || target.type == NPCType<ThanatosHead>())
|
||||
{
|
||||
info.npcIndexToAimAt = i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using CalamityMod.NPCs.Leviathan;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.GameContent.UI.BigProgressBar;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.UI.VanillaBossBars
|
||||
{
|
||||
public class LeviathanAnahitaBossBar : ModBossBar
|
||||
{
|
||||
public override Asset<Texture2D> GetIconTexture(ref Rectangle? iconFrame)
|
||||
{
|
||||
// Prevent icon seizures by prioritizing Leviathan first
|
||||
if (NPC.AnyNPCs(NPCType<Leviathan>()))
|
||||
return TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[NPCType<Leviathan>()]];
|
||||
return TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[NPCType<Anahita>()]];
|
||||
}
|
||||
|
||||
public override bool? ModifyInfo(ref BigProgressBarInfo info, ref float lifePercent, ref float shieldPercent)
|
||||
{
|
||||
NPC target = Main.npc[info.npcIndexToAimAt];
|
||||
|
||||
if (!target.active && !FindTheRightFish(ref info))
|
||||
return false;
|
||||
|
||||
// Immediately grab the boss's health, whichever one it is. We will check later.
|
||||
int life = target.life;
|
||||
int lifeMax = target.lifeMax;
|
||||
|
||||
// Find the partner in question
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC wife = Main.npc[i];
|
||||
int targetCouple = target.type == NPCType<Anahita>() ? NPCType<Leviathan>() : NPCType<Anahita>();
|
||||
if (wife.active && wife.type == targetCouple)
|
||||
{
|
||||
life += wife.life;
|
||||
lifeMax += wife.lifeMax;
|
||||
}
|
||||
}
|
||||
lifePercent = Utils.Clamp(life / (float)lifeMax, 0f, 1f);
|
||||
|
||||
// Determine Anahita's shield health only if she's solo (she can't just block Leviathan out of existence)
|
||||
int shield = 0;
|
||||
int shieldMax = 0;
|
||||
if (target.type == NPCType<Anahita>() && !NPC.AnyNPCs(NPCType<Leviathan>()))
|
||||
{
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC part = Main.npc[i];
|
||||
if (part.active && part.type == NPCType<AnahitasIceShield>())
|
||||
{
|
||||
shield += part.life;
|
||||
shieldMax += part.lifeMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
shieldPercent = Utils.Clamp(shield / (float)shieldMax, 0f, 1f);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool FindTheRightFish(ref BigProgressBarInfo info)
|
||||
{
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC target = Main.npc[i];
|
||||
if (target.active && target.type == NPCType<Anahita>())
|
||||
{
|
||||
info.npcIndexToAimAt = i;
|
||||
return true;
|
||||
}
|
||||
else if (target.active && target.type == NPCType<Leviathan>())
|
||||
{
|
||||
info.npcIndexToAimAt = i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,6 @@ namespace CalamityMod.UI.VanillaBossBars
|
||||
{
|
||||
public class RavagerBossBar : ModBossBar
|
||||
{
|
||||
public override Asset<Texture2D> GetIconTexture(ref Rectangle? iconFrame) => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[NPCType<RavagerBody>()]];
|
||||
|
||||
// Used to determine the max health of a multi-segmented boss
|
||||
public NPC FalseNPCSegment;
|
||||
public List<int> RavagerParts = new List<int>
|
||||
@@ -28,6 +26,8 @@ namespace CalamityMod.UI.VanillaBossBars
|
||||
NPCType<RavagerLegRight>()
|
||||
};
|
||||
|
||||
public override Asset<Texture2D> GetIconTexture(ref Rectangle? iconFrame) => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[NPCType<RavagerBody>()]];
|
||||
|
||||
public override bool? ModifyInfo(ref BigProgressBarInfo info, ref float lifePercent, ref float shieldPercent)
|
||||
{
|
||||
NPC target = Main.npc[info.npcIndexToAimAt];
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
using CalamityMod.NPCs.SlimeGod;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.GameContent.UI.BigProgressBar;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.UI.VanillaBossBars
|
||||
{
|
||||
public class SlimeGodBossBar : ModBossBar
|
||||
{
|
||||
// Used to determine the max health of a multi-segmented boss
|
||||
public NPC FalseNPCSegment;
|
||||
public List<int> SlimeGodSlimes = new List<int>
|
||||
{
|
||||
NPCType<CrimulanSlimeGod>(),
|
||||
NPCType<EbonianSlimeGod>(),
|
||||
NPCType<SplitCrimulanSlimeGod>(),
|
||||
NPCType<SplitEbonianSlimeGod>()
|
||||
};
|
||||
|
||||
public override Asset<Texture2D> GetIconTexture(ref Rectangle? iconFrame) => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[NPCType<SlimeGodCore>()]];
|
||||
|
||||
public override bool? ModifyInfo(ref BigProgressBarInfo info, ref float lifePercent, ref float shieldPercent)
|
||||
{
|
||||
NPC target = Main.npc[info.npcIndexToAimAt];
|
||||
if (!target.active)
|
||||
return false;
|
||||
|
||||
int life = 0;
|
||||
int lifeMax = 0;
|
||||
FalseNPCSegment = new NPC();
|
||||
|
||||
// Add max health by feeding the data of false NPCs
|
||||
FalseNPCSegment.SetDefaults(NPCType<CrimulanSlimeGod>(), target.GetMatchingSpawnParams());
|
||||
lifeMax += FalseNPCSegment.lifeMax;
|
||||
FalseNPCSegment.SetDefaults(NPCType<EbonianSlimeGod>(), target.GetMatchingSpawnParams());
|
||||
lifeMax += FalseNPCSegment.lifeMax;
|
||||
|
||||
// Determine the current health of each slime
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC part = Main.npc[i];
|
||||
if (part.active && SlimeGodSlimes.Contains(part.type))
|
||||
{
|
||||
life += part.life;
|
||||
}
|
||||
}
|
||||
lifePercent = Utils.Clamp(life / (float)lifeMax, 0f, 1f);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user