Merge branch 'master' into Calamitas-NPC

This commit is contained in:
Dominic committed 2021-04-17 22:54:00 -05:00
commit f6491a6d2d
324 files changed
+2646 -3616

No files matched your search

+8 -8
View File
@@ -3,7 +3,7 @@ using Terraria.ModLoader;
namespace CalamityMod.Buffs.Mounts
{
public class AndromedaBuff : ModBuff
public class AndromedaBuff : ModBuff
{
public override void SetDefaults()
{
@@ -15,15 +15,15 @@ namespace CalamityMod.Buffs.Mounts
public override void Update(Player player, ref int buffIndex)
{
//Disables crouching with the Crouch, Crawl, and Roll Mod
Mod crouchMod = ModLoader.GetMod("CrouchMod");
// Disables crouching with the Crouch, Crawl, and Roll Mod
Mod crouchMod = CalamityMod.Instance.crouchMod;
if (crouchMod != null)
{
//Mod Call inputs
//"CanCrouch" //string which is required
//p //int for the player's index
//canCrouch //bool whether the player can input crouch (point being to set this to false)
//forceUnCrouch //bool which, if true, forces the player to uncrouch (forcing their head into the ceiling)
// Mod Call inputs
// 1) "CanCrouch" -- name of operation
// 2) int for the player's index
// 3) bool for whether the player can use the crouch input this frame
// 4) bool for whether the player should be force-uncrouched this frame
crouchMod.Call("CanCrouch", player.whoAmI, false, true);
}
}
+1 -1
View File
@@ -9,7 +9,7 @@ namespace CalamityMod.Buffs.Pets
public override void SetDefaults()
{
DisplayName.SetDefault("Supreme Calamitas");
Description.SetDefault("Watching over you with supreme calamitous energy... How adorable");
Description.SetDefault("Watching over you with supreme calamitous energy...how adorable");
Main.buffNoTimeDisplay[Type] = true;
Main.vanityPet[Type] = true;
}
+14 -10
View File
@@ -108,6 +108,7 @@ namespace CalamityMod.CalPlayer
public bool noLifeRegen = false;
public int itemTypeLastReforged = 0;
public int reforgeTierSafety = 0;
public bool finalTierAccessoryReforge = false;
public int defenseDamage = 0;
public float rangedAmmoCost = 1f;
public bool heldGaelsLastFrame = false;
@@ -156,7 +157,6 @@ namespace CalamityMod.CalPlayer
#region Stat Meter
public int[] damageStats = new int[6];
public int[] critStats = new int[4];
public float actualMeleeDamageStat = 0f;
public int defenseStat = 0;
public int DRStat = 0;
public int meleeSpeedStat = 0;
@@ -297,10 +297,11 @@ namespace CalamityMod.CalPlayer
public AndromedaPlayerState andromedaState;
public int andromedaCripple;
public const float UnicornSpeedNerfPower = 0.8f;
#endregion
public const float MechanicalCartSpeedNerfPower = 0.7f;
#endregion
#region Pet
public bool thirdSage = false;
#region Pet
public bool thirdSage = false;
public bool thirdSageH = true; // Third sage healing
public bool perfmini = false;
public bool akato = false;
@@ -1068,6 +1069,7 @@ namespace CalamityMod.CalPlayer
boost.AddWithCondition("bossHPBar", drawBossHPBar);
boost.AddWithCondition("drawSmallText", shouldDrawSmallText);
boost.AddWithCondition("fullHPRespawn", healToFull);
boost.AddWithCondition("finalTierAccessoryReforge", finalTierAccessoryReforge);
boost.AddWithCondition("newMerchantInventory", newMerchantInventory);
boost.AddWithCondition("newPainterInventory", newPainterInventory);
@@ -1143,8 +1145,9 @@ namespace CalamityMod.CalPlayer
drawBossHPBar = boost.Contains("bossHPBar");
shouldDrawSmallText = boost.Contains("drawSmallText");
healToFull = boost.Contains("fullHPRespawn");
finalTierAccessoryReforge = boost.Contains("finalTierAccessoryReforge");
newMerchantInventory = boost.Contains("newMerchantInventory");
newMerchantInventory = boost.Contains("newMerchantInventory");
newPainterInventory = boost.Contains("newPainterInventory");
newDyeTraderInventory = boost.Contains("newDyeTraderInventory");
newPartyGirlInventory = boost.Contains("newPartyGirlInventory");
@@ -1301,7 +1304,8 @@ namespace CalamityMod.CalPlayer
BitsByte flags6 = reader.ReadByte();
newBanditInventory = flags6[0];
newCalamitasInventory = flags6[1];
finalTierAccessoryReforge = flags6[1];
newCalamitasInventory = flags6[2];
}
else
{
@@ -2542,7 +2546,7 @@ namespace CalamityMod.CalPlayer
if (Main.snowTiles > 300)
player.ZoneSnow = true;
Mod fargos = ModLoader.GetMod("Fargowiltas");
Mod fargos = CalamityMod.Instance.fargos;
if (fargos != null)
{
//Fargo's fountain effects
@@ -2973,13 +2977,13 @@ namespace CalamityMod.CalPlayer
if (prismaticSet && !prismaticCooldown && prismaticLasers <= 0)
prismaticLasers = CalamityUtils.SecondsToFrames(35f);
}
if (CalamityMod.AstralArcanumUIHotkey.JustPressed && astralArcanum)
if (CalamityMod.AstralArcanumUIHotkey.JustPressed && astralArcanum && !areThereAnyDamnBosses)
{
AstralArcanumUI.Toggle();
}
if (CalamityMod.AstralTeleportHotKey.JustPressed)
{
if (celestialJewel)
if (celestialJewel && !areThereAnyDamnBosses)
{
if (Main.netMode == NetmodeID.SinglePlayer)
{
@@ -8832,7 +8836,7 @@ namespace CalamityMod.CalPlayer
#region Nurse Modifications
public override bool ModifyNurseHeal(NPC nurse, ref int health, ref bool removeDebuffs, ref string chatText)
{
if (CalamityWorld.death && areThereAnyDamnBosses)
if ((CalamityWorld.death || CalamityWorld.malice) && areThereAnyDamnBosses)
{
chatText = "Now is not the time!";
return false;
+8 -5
View File
@@ -965,10 +965,14 @@ namespace CalamityMod.CalPlayer
{
if (player.IsUnderwater() && modPlayer.ironBoots)
player.maxFallSpeed = 9f;
if (modPlayer.aeroSet && !player.wet)
player.maxFallSpeed = 15f;
if (modPlayer.gSabatonFall > 0 && !player.wet)
player.maxFallSpeed = 20f;
if (!player.wet)
{
if (modPlayer.aeroSet)
player.maxFallSpeed = 15f;
if (modPlayer.gSabatonFall > 0 || (player.PortalPhysicsEnabled && CalamityPlayer.areThereAnyDamnBosses))
player.maxFallSpeed = 20f;
}
}
// Omega Blue Armor bonus
@@ -4000,7 +4004,6 @@ namespace CalamityMod.CalPlayer
private static void UpdateStatMeter(Player player, CalamityPlayer modPlayer)
{
float allDamageStat = player.allDamage - 1f;
modPlayer.actualMeleeDamageStat = player.meleeDamage + allDamageStat;
modPlayer.damageStats[0] = (int)((player.meleeDamage + allDamageStat - 1f) * 100f);
modPlayer.damageStats[1] = (int)((player.rangedDamage + allDamageStat - 1f) * 100f);
modPlayer.damageStats[2] = (int)((player.magicDamage + allDamageStat - 1f) * 100f);
+61 -28
View File
@@ -49,7 +49,6 @@ using System.Reflection;
using Terraria;
using Terraria.DataStructures;
using Terraria.GameContent.Dyes;
using Terraria.GameContent.Events;
using Terraria.Graphics.Effects;
using Terraria.Graphics.Shaders;
using Terraria.ID;
@@ -102,16 +101,37 @@ namespace CalamityMod
public const float velocityScaleMin = 0.5f;
public const float bitingEnemeyVelocityScale = 0.8f;
// TODO -- Calamity should check for other mods existing in exactly one place
public bool fargosMutant = false;
internal static CalamityMod Instance;
internal Mod musicMod = null; // this is Calamity's official music mod, CalamityModMusic
internal Mod ancientsAwakened = null;
internal Mod bossChecklist = null;
internal Mod census = null;
internal Mod crouchMod = null;
internal Mod fargos = null;
internal Mod redemption = null;
internal Mod soa = null;
internal Mod summonersAssociation = null;
internal Mod thorium = null;
internal Mod varia = null;
#region Load
public override void Load()
{
Instance = this;
// If any of these mods aren't loaded, it will simply keep them as null.
musicMod = ModLoader.GetMod("CalamityModMusic");
ancientsAwakened = ModLoader.GetMod("AAMod");
bossChecklist = ModLoader.GetMod("BossChecklist");
census = ModLoader.GetMod("Census");
crouchMod = ModLoader.GetMod("CrouchMod");
fargos = ModLoader.GetMod("Fargowiltas");
redemption = ModLoader.GetMod("Redemption");
soa = ModLoader.GetMod("SacredTools");
summonersAssociation = ModLoader.GetMod("SummonersAssociation");
thorium = ModLoader.GetMod("ThoriumMod");
varia = ModLoader.GetMod("Varia");
// Initialize the BossStats struct as early as it is safe to do so
NPCStats.Load();
@@ -122,8 +142,10 @@ namespace CalamityMod
carpetOriginal = Main.flyingCarpetTexture;
Mount.mounts[Mount.Unicorn].dashSpeed *= CalamityPlayer.UnicornSpeedNerfPower;
Mount.mounts[Mount.Unicorn].runSpeed *= CalamityPlayer.UnicornSpeedNerfPower;
Mount.mounts[Mount.MinecartMech].dashSpeed *= CalamityPlayer.MechanicalCartSpeedNerfPower;
Mount.mounts[Mount.MinecartMech].runSpeed *= CalamityPlayer.MechanicalCartSpeedNerfPower;
NormalityRelocatorHotKey = RegisterHotKey("Normality Relocator", "Z");
NormalityRelocatorHotKey = RegisterHotKey("Normality Relocator", "Z");
RageHotKey = RegisterHotKey("Rage Mode", "V");
AdrenalineHotKey = RegisterHotKey("Adrenaline Mode", "B");
AegisHotKey = RegisterHotKey("Elysian Guard", "N");
@@ -238,6 +260,18 @@ namespace CalamityMod
#region Unload
public override void Unload()
{
musicMod = null;
ancientsAwakened = null;
bossChecklist = null;
census = null;
crouchMod = null;
fargos = null;
redemption = null;
soa = null;
summonersAssociation = null;
thorium = null;
varia = null;
NormalityRelocatorHotKey = null;
RageHotKey = null;
AdrenalineHotKey = null;
@@ -265,8 +299,6 @@ namespace CalamityMod
CalamityLists.UnloadLists();
NPCStats.Unload();
fargosMutant = false;
PopupGUIManager.UnloadGUIs();
InvasionProgressUIManager.UnloadGUIs();
BossRushEvent.Unload();
@@ -289,8 +321,10 @@ namespace CalamityMod
}
Mount.mounts[Mount.Unicorn].dashSpeed /= CalamityPlayer.UnicornSpeedNerfPower;
Mount.mounts[Mount.Unicorn].runSpeed /= CalamityPlayer.UnicornSpeedNerfPower;
Mount.mounts[Mount.MinecartMech].dashSpeed /= CalamityPlayer.MechanicalCartSpeedNerfPower;
Mount.mounts[Mount.MinecartMech].runSpeed /= CalamityPlayer.MechanicalCartSpeedNerfPower;
heartOriginal2 = null;
heartOriginal2 = null;
heartOriginal = null;
rainOriginal = null;
manaOriginal = null;
@@ -650,7 +684,6 @@ namespace CalamityMod
#region Music
public override void UpdateMusic(ref int music, ref MusicPriority priority)
{
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
if (Main.musicVolume != 0)
{
if (Main.myPlayer != -1 && !Main.gameMenu && Main.LocalPlayer.active)
@@ -660,8 +693,8 @@ namespace CalamityMod
{
if (!CalamityPlayer.areThereAnyDamnBosses)
{
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Crag");
if (musicMod != null)
music = musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/Crag");
else
music = MusicID.Eerie;
priority = MusicPriority.Environment;
@@ -671,8 +704,8 @@ namespace CalamityMod
{
if (!CalamityPlayer.areThereAnyDamnBosses)
{
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SunkenSea");
if (musicMod != null)
music = musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/SunkenSea");
else
music = MusicID.Temple;
priority = MusicPriority.Environment;
@@ -682,9 +715,9 @@ namespace CalamityMod
{
if (!CalamityPlayer.areThereAnyDamnBosses)
{
if (calamityModMusic != null)
if (musicMod != null)
{
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Astral");
music = musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/Astral");
}
else
music = MusicID.Space;
@@ -695,9 +728,9 @@ namespace CalamityMod
{
if (!CalamityPlayer.areThereAnyDamnBosses)
{
if (calamityModMusic != null)
if (musicMod != null)
{
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstralUnderground");
music = musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/AstralUnderground");
}
else
music = MusicID.Space;
@@ -708,8 +741,8 @@ namespace CalamityMod
{
if (!CalamityPlayer.areThereAnyDamnBosses)
{
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheAbyss");
if (musicMod != null)
music = musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/TheAbyss");
else
music = MusicID.Hell;
priority = MusicPriority.BiomeHigh;
@@ -719,8 +752,8 @@ namespace CalamityMod
{
if (!CalamityPlayer.areThereAnyDamnBosses)
{
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheDeepAbyss");
if (musicMod != null)
music = musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/TheDeepAbyss");
else
music = MusicID.Hell;
priority = MusicPriority.BiomeHigh;
@@ -730,8 +763,8 @@ namespace CalamityMod
{
if (!CalamityPlayer.areThereAnyDamnBosses)
{
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/TheVoid");
if (musicMod != null)
music = musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/TheVoid");
else
music = MusicID.Hell;
priority = MusicPriority.BiomeHigh;
@@ -742,11 +775,11 @@ namespace CalamityMod
if (!CalamityPlayer.areThereAnyDamnBosses)
{
bool acidRain = CalamityWorld.rainingAcid;
if (calamityModMusic != null)
if (musicMod != null)
{
string rainMusic = "Sounds/Music/AcidRain";
string musicChoice = acidRain ? rainMusic + (CalamityWorld.downedPolterghast ? "2" : "1") : "Sounds/Music/Sulphur"; //replace first acidrain1 once second theme is added.
music = calamityModMusic.GetSoundSlot(SoundType.Music, musicChoice);
music = musicMod.GetSoundSlot(SoundType.Music, musicChoice);
}
else
@@ -758,8 +791,8 @@ namespace CalamityMod
{
if (!CalamityPlayer.areThereAnyDamnBosses)
{
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse");
if (musicMod != null)
music = musicMod.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse");
else
music = MusicID.LunarBoss;
priority = MusicPriority.BossMedium;
@@ -770,7 +803,7 @@ namespace CalamityMod
}
#endregion
#region ModSupport
#region Mod Support
public override void PostSetupContent() => WeakReferenceSupport.Setup();
public override object Call(params object[] args) => ModCalls.Call(args);
+7 -7
View File
@@ -3,12 +3,12 @@
public enum CalamityRarity
{
NoEffect = 0,
Turquoise = 12,
PureGreen = 13,
DarkBlue = 14,
Violet = 15,
HotPink = 16,
Rainbow = 30,
DraedonRust = 33,
Turquoise = CalamityUtils.TurquoiseRarityValue,
PureGreen = CalamityUtils.PureGreenRarityValue,
DarkBlue = CalamityUtils.DarkBlueRarityValue,
Violet = CalamityUtils.VioletRarityValue,
HotPink = CalamityUtils.HotPinkRarityValue,
Rainbow = CalamityUtils.RainbowRarityValue,
DraedonRust = CalamityUtils.DraedonRustRarityValue,
}
}
+27 -15
View File
@@ -57,7 +57,7 @@ namespace CalamityMod.ILEditing
RemoveAerialBaneDamageBoost();
AdjustDamageVariance();
RemoveExpertHardmodeScaling();
IncreaseaChlorophyteSpreadChance();
IncreaseChlorophyteSpreadChance();
ReduceTileBoostedRunSpeeds();
ReduceWingHoverVelocities();
RemoveRNGFromBlackBelt();
@@ -67,6 +67,7 @@ namespace CalamityMod.ILEditing
LabDoorFixes();
AlterTownNPCSpawnRate();
DisableDemonAltarGeneration();
DisableTeleportersDuringBossFights();
FixSplittingWormBannerDrops();
}
@@ -139,7 +140,7 @@ namespace CalamityMod.ILEditing
};
}
private static void IncreaseaChlorophyteSpreadChance()
private static void IncreaseChlorophyteSpreadChance()
{
// Change the Chlorophyte spawn rate.
IL.Terraria.WorldGen.hardUpdateWorld += (il) =>
@@ -176,11 +177,11 @@ namespace CalamityMod.ILEditing
cursor.GotoNext(MoveType.Before, i => i.MatchLdcR4(1.25f)); // The max run speed multiplier for Frozen Slime Blocks.
cursor.Remove();
cursor.Emit(OpCodes.Ldc_R4, 1.1f); // Reduce by 0.15.
cursor.Emit(OpCodes.Ldc_R4, 1f); // Reduce boost to 0.
cursor.GotoNext(MoveType.Before, i => i.MatchLdcR4(1.25f)); // The max run speed multiplier for Ice Blocks.
cursor.Remove();
cursor.Emit(OpCodes.Ldc_R4, 1.1f); // Reduce by 0.15.
cursor.Emit(OpCodes.Ldc_R4, 1f); // Reduce boost to 0.
};
}
@@ -353,14 +354,9 @@ namespace CalamityMod.ILEditing
};
}
private static void DisableDemonAltarGeneration()
{
IL.Terraria.WorldGen.SmashAltar += (il) =>
{
var cursor = new ILCursor(il);
cursor.Emit(OpCodes.Ret);
};
}
private static void DisableDemonAltarGeneration() => On.Terraria.WorldGen.SmashAltar += PreventSmashAltarCode;
private static void DisableTeleportersDuringBossFights() => On.Terraria.Wiring.Teleport += DisableTeleporters;
private static void FixSplittingWormBannerDrops()
{
@@ -442,10 +438,26 @@ namespace CalamityMod.ILEditing
// If it's anything else, let vanilla and/or TML handle it.
return orig(i, j, forced);
}
#endregion
#region Helper Functions
private static int FindTopOfDoor(int i, int j, Tile rootTile)
private static void PreventSmashAltarCode(On.Terraria.WorldGen.orig_SmashAltar orig, int i, int j)
{
if (CalamityConfig.Instance.EarlyHardmodeProgressionRework)
return;
orig(i, j);
}
private static void DisableTeleporters(On.Terraria.Wiring.orig_Teleport orig)
{
if (CalamityPlayer.areThereAnyDamnBosses)
return;
orig();
}
#endregion
#region Helper Functions
private static int FindTopOfDoor(int i, int j, Tile rootTile)
{
Tile t = Main.tile[i, j];
int topY = j;
+1 -1
View File
@@ -38,7 +38,7 @@ namespace CalamityMod.Items.Accessories
{
if (line2.mod == "Terraria" && line2.Name == "Tooltip6")
{
line2.text = "Press " + hotkey + " to toggle teleportation UI";
line2.text = "Press " + hotkey + " to toggle teleportation UI while no bosses are alive";
}
}
}
+1 -1
View File
@@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories
{
if (line2.mod == "Terraria" && line2.Name == "Tooltip2")
{
line2.text = "Press " + hotkey + " to teleport to a random location";
line2.text = "Press " + hotkey + " to teleport to a random location while no bosses are alive";
}
}
}
+148 -1
View File
@@ -1,7 +1,9 @@
using CalamityMod.CalPlayer;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Summon;
using CalamityMod.Tiles.Furniture.CraftingStations;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using Terraria;
using Terraria.DataStructures;
@@ -123,6 +125,152 @@ namespace CalamityMod.Items.Accessories
modPlayer.profanedCrystalHide = true;
}
// Moved from CalamityGlobalItem since it's just a function called in one place.
internal static bool TransformItemUsage(Item item, Player player)
{
if (player.whoAmI != Main.myPlayer)
return false;
int weaponType = item.melee ? 1 : item.ranged ? 2 : item.magic ? 3 : item.Calamity().rogue ? 4 : -1;
if (weaponType > 0)
{
if (player.Calamity().profanedSoulWeaponType != weaponType || player.Calamity().profanedSoulWeaponUsage >= 300)
{
player.Calamity().profanedSoulWeaponType = weaponType;
player.Calamity().profanedSoulWeaponUsage = 0;
}
Vector2 correctedVelocity = Main.MouseWorld - player.Center;
correctedVelocity.Normalize();
bool shouldNerf = player.Calamity().endoCooper || player.Calamity().magicHat; //No bonkers damage memes thank you very much.
bool enrage = player.statLife <= (int)(player.statLifeMax2 * 0.5);
if (item.melee)
{
if (player.Calamity().profanedSoulWeaponUsage % (enrage ? 4 : 6) == 0)
{
if (player.Calamity().profanedSoulWeaponUsage > 0 && player.Calamity().profanedSoulWeaponUsage % (enrage ? 20 : 30) == 0) //every 5 shots is a shotgun spread
{
int numProj = 5;
correctedVelocity *= 12f;
int spread = 3;
for (int i = 0; i < numProj; i++)
{
Vector2 perturbedspeed = new Vector2(correctedVelocity.X, correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread));
Projectile.NewProjectile(player.Center.X, player.Center.Y - 10, perturbedspeed.X, perturbedspeed.Y, ModContent.ProjectileType<ProfanedCrystalMeleeSpear>(), (int)((shouldNerf ? 350 : 700) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f);
spread -= Main.rand.Next(2, 4);
Main.PlaySound(SoundID.Item20, player.Center);
}
player.Calamity().profanedSoulWeaponUsage = 0;
}
else
{
Projectile.NewProjectile(player.Center, correctedVelocity * 6.9f, ModContent.ProjectileType<ProfanedCrystalMeleeSpear>(), (int)((shouldNerf ? 250 : 500) * player.MinionDamage()), 1f, player.whoAmI, Main.rand.NextBool(player.Calamity().profanedSoulWeaponUsage == 4 ? 5 : 7) ? 1f : 0f, 1f);
Main.PlaySound(SoundID.Item20, player.Center);
}
}
player.Calamity().profanedSoulWeaponUsage++;
}
else if (item.ranged)
{
if (enrage || Main.rand.NextBool(2)) //100% chance if 50% or lower, else 1 in 2 chance
{
correctedVelocity *= 20f;
Vector2 perturbedspeed = new Vector2(correctedVelocity.X + Main.rand.Next(-3, 4), correctedVelocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(3));
bool isSmallBoomer = Main.rand.NextDouble() <= (enrage ? 0.2 : 0.3); // 20% chance if enraged, else 30% This is intentional due to literally doubling the amount of projectiles fired.
bool isThiccBoomer = isSmallBoomer && Main.rand.NextDouble() <= 0.05; // 5%
int projType = isSmallBoomer ? isThiccBoomer ? 1 : 2 : 3;
int dam = (int)((shouldNerf ? 200 : 400) * player.MinionDamage());
switch (projType)
{
case 1: //big boomer
case 2: //boomer
int proj = Projectile.NewProjectile(player.Center, perturbedspeed, ModContent.ProjectileType<ProfanedCrystalRangedHuges>(), dam, 0f, player.whoAmI, projType == 1 ? 1f : 0f);
if (proj.WithinBounds(Main.maxProjectiles))
Main.projectile[proj].Calamity().forceMinion = true;
break;
case 3: //bab boomer
int proj2 = Projectile.NewProjectile(player.Center, perturbedspeed, ModContent.ProjectileType<ProfanedCrystalRangedSmalls>(), dam, 0f, player.whoAmI, 0f);
if (proj2.WithinBounds(Main.maxProjectiles))
Main.projectile[proj2].Calamity().forceMinion = true;
break;
}
if (projType > 1)
{
Main.PlaySound(SoundID.Item20, player.Center);
}
}
}
else if (item.magic)
{
if (player.ownedProjectileCounts[ModContent.ProjectileType<ProfanedCrystalMageFireball>()] == 0 && player.ownedProjectileCounts[ModContent.ProjectileType<ProfanedCrystalMageFireballSplit>()] == 0)
{
player.Calamity().profanedSoulWeaponUsage = 0;
}
int manaCost = (int)(100 * player.manaCost);
if (player.statMana < manaCost && player.Calamity().profanedSoulWeaponUsage == 0)
{
if (player.manaFlower)
{
player.QuickMana();
}
}
if (player.statMana >= manaCost && player.Calamity().profanedSoulWeaponUsage == 0 && !player.silence)
{
player.manaRegenDelay = (int)player.maxRegenDelay;
player.statMana -= manaCost;
correctedVelocity *= 25f;
Main.PlaySound(SoundID.Item20, player.Center);
int dam = (int)((shouldNerf ? 900 : 1800) * player.MinionDamage());
if (player.HasBuff(BuffID.ManaSickness))
{
int sickPenalty = (int)(dam * (0.05f * ((player.buffTime[player.FindBuffIndex(BuffID.ManaSickness)] + 60) / 60)));
dam -= sickPenalty;
}
int proj = Projectile.NewProjectile(player.position, correctedVelocity, ModContent.ProjectileType<ProfanedCrystalMageFireball>(), dam, 1f, player.whoAmI, enrage ? 1f : 0f);
if (proj.WithinBounds(Main.maxProjectiles))
Main.projectile[proj].Calamity().forceMinion = true;
player.Calamity().profanedSoulWeaponUsage = enrage ? 20 : 25;
}
if (player.Calamity().profanedSoulWeaponUsage > 0)
player.Calamity().profanedSoulWeaponUsage--;
}
else if (item.Calamity().rogue)
{
if (player.ownedProjectileCounts[ModContent.ProjectileType<ProfanedCrystalRogueShard>()] == 0)
{
player.Calamity().profanedSoulWeaponUsage = 0;
}
if (player.Calamity().profanedSoulWeaponUsage >= (enrage ? 69 : 180))
{
float crystalCount = 36f;
for (float i = 0; i < crystalCount; i++)
{
float angle = MathHelper.TwoPi / crystalCount * i;
int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType<ProfanedCrystalRogueShard>(), (int)((shouldNerf ? 175 : 350) * player.MinionDamage()), 1f, player.whoAmI, 0f, 0f);
if (proj.WithinBounds(Main.maxProjectiles))
Main.projectile[proj].Calamity().forceMinion = true;
Main.PlaySound(SoundID.Item20, player.Center);
}
player.Calamity().profanedSoulWeaponUsage = 0;
}
else if (player.Calamity().profanedSoulWeaponUsage % (enrage ? 5 : 10) == 0)
{
float angle = MathHelper.TwoPi / (enrage ? 9 : 18) * (player.Calamity().profanedSoulWeaponUsage / (enrage ? 1 : 10));
int proj = Projectile.NewProjectile(player.Center, angle.ToRotationVector2() * 8f, ModContent.ProjectileType<ProfanedCrystalRogueShard>(), (int)((shouldNerf ? 220 : 440) * player.MinionDamage()), 1f, player.whoAmI, 1f, 0f);
if (proj.WithinBounds(Main.maxProjectiles))
Main.projectile[proj].Calamity().forceMinion = true;
Main.PlaySound(SoundID.Item20, player.Center);
}
player.Calamity().profanedSoulWeaponUsage += enrage ? 1 : 2;
if (!enrage && player.Calamity().profanedSoulWeaponUsage % 2 != 0)
player.Calamity().profanedSoulWeaponUsage--;
}
}
return false;
}
public override void AddRecipes()
{
PSCRecipe recipe = new PSCRecipe(mod);
@@ -142,7 +290,6 @@ namespace CalamityMod.Items.Accessories
public class PSCRecipe : ModRecipe
{
public PSCRecipe(Mod mod) : base(mod) { }
public override int ConsumeItem(int type, int numRequired)
+3 -3
View File
@@ -21,9 +21,9 @@ namespace CalamityMod.Items.Accessories
public const int FireProjectiles = 2;
public const float FireAngleSpread = 120;
public int counter = 0;
public const int ProjectileDamage = 1000;
public const int FungalClumpDamage = 500;
public const int AuraDamage = 150;
public const int ProjectileDamage = 300;
public const int FungalClumpDamage = 150;
public const int AuraDamage = 100;
public override void SetStaticDefaults()
{
+143 -2366
View File
File diff suppressed because it is too large. Load diff
+61 -54
View File
@@ -3,8 +3,6 @@ using CalamityMod.Items.DifficultyItems;
using CalamityMod.Items.Materials;
using CalamityMod.Items.PermanentBoosters;
using CalamityMod.Items.Potions;
using CalamityMod.Items.Weapons.Magic;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.Items.Weapons.Summon;
@@ -94,7 +92,7 @@ namespace CalamityMod.Items
case ItemID.TwinsBossBag:
case ItemID.SkeletronPrimeBossBag:
// Only drop hallowed bars after all mechs are down.
if (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3)
if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework)
DropHelper.BlockDrops(ItemID.HallowedBar);
break;
@@ -207,74 +205,83 @@ namespace CalamityMod.Items
switch (itemID)
{
case ItemID.WoodenCrate:
int[] preMechBlockedDrops_WoodenCrate = new int[]
if (CalamityConfig.Instance.EarlyHardmodeProgressionRework)
{
ItemID.MythrilOre,
ItemID.OrichalcumOre,
ItemID.AdamantiteOre,
ItemID.TitaniumOre,
ItemID.MythrilBar,
ItemID.OrichalcumBar,
ItemID.AdamantiteBar,
ItemID.TitaniumBar,
};
int[] postOneMechBlockedDrops_WoodenCrate = new int[]
{
ItemID.AdamantiteOre,
ItemID.TitaniumOre,
ItemID.AdamantiteBar,
ItemID.TitaniumBar,
};
int[] preMechBlockedDrops_WoodenCrate = new int[]
{
ItemID.MythrilOre,
ItemID.OrichalcumOre,
ItemID.AdamantiteOre,
ItemID.TitaniumOre,
ItemID.MythrilBar,
ItemID.OrichalcumBar,
ItemID.AdamantiteBar,
ItemID.TitaniumBar,
};
int[] postOneMechBlockedDrops_WoodenCrate = new int[]
{
ItemID.AdamantiteOre,
ItemID.TitaniumOre,
ItemID.AdamantiteBar,
ItemID.TitaniumBar,
};
if (!NPC.downedMechBossAny)
DropHelper.BlockDrops(preMechBlockedDrops_WoodenCrate);
else if (!twoMechsDowned)
DropHelper.BlockDrops(postOneMechBlockedDrops_WoodenCrate);
if (!NPC.downedMechBossAny)
DropHelper.BlockDrops(preMechBlockedDrops_WoodenCrate);
else if (!twoMechsDowned)
DropHelper.BlockDrops(postOneMechBlockedDrops_WoodenCrate);
}
DropHelper.DropItemChance(player, ModContent.ItemType<WulfrumShard>(), 0.25f, 3, 5);
break;
case ItemID.IronCrate:
int[] preMechBlockedDrops_IronCrate = new int[]
if (CalamityConfig.Instance.EarlyHardmodeProgressionRework)
{
ItemID.MythrilBar,
ItemID.OrichalcumBar,
ItemID.AdamantiteBar,
ItemID.TitaniumBar,
};
int[] postOneMechBlockedDrops_IronCrate = new int[]
{
ItemID.AdamantiteBar,
ItemID.TitaniumBar,
};
int[] preMechBlockedDrops_IronCrate = new int[]
{
ItemID.MythrilBar,
ItemID.OrichalcumBar,
ItemID.AdamantiteBar,
ItemID.TitaniumBar,
};
int[] postOneMechBlockedDrops_IronCrate = new int[]
{
ItemID.AdamantiteBar,
ItemID.TitaniumBar,
};
if (!NPC.downedMechBossAny)
DropHelper.BlockDrops(preMechBlockedDrops_IronCrate);
else if (!twoMechsDowned)
DropHelper.BlockDrops(postOneMechBlockedDrops_IronCrate);
if (!NPC.downedMechBossAny)
DropHelper.BlockDrops(preMechBlockedDrops_IronCrate);
else if (!twoMechsDowned)
DropHelper.BlockDrops(postOneMechBlockedDrops_IronCrate);
}
DropHelper.DropItemChance(player, ModContent.ItemType<WulfrumShard>(), 0.25f, 5, 8);
DropHelper.DropItemChance(player, ModContent.ItemType<AncientBoneDust>(), 0.25f, 5, 8);
break;
case ItemID.GoldenCrate:
int[] preMechBlockedDrops_GoldenCrate = new int[]
if (CalamityConfig.Instance.EarlyHardmodeProgressionRework)
{
ItemID.MythrilBar,
ItemID.OrichalcumBar,
ItemID.AdamantiteBar,
ItemID.TitaniumBar,
};
int[] postOneMechBlockedDrops_GoldenCrate = new int[]
{
ItemID.AdamantiteBar,
ItemID.TitaniumBar,
};
int[] preMechBlockedDrops_GoldenCrate = new int[]
{
ItemID.MythrilBar,
ItemID.OrichalcumBar,
ItemID.AdamantiteBar,
ItemID.TitaniumBar,
};
int[] postOneMechBlockedDrops_GoldenCrate = new int[]
{
ItemID.AdamantiteBar,
ItemID.TitaniumBar,
};
if (!NPC.downedMechBossAny)
DropHelper.BlockDrops(preMechBlockedDrops_GoldenCrate);
else if (!twoMechsDowned)
DropHelper.BlockDrops(postOneMechBlockedDrops_GoldenCrate);
if (!NPC.downedMechBossAny)
DropHelper.BlockDrops(preMechBlockedDrops_GoldenCrate);
else if (!twoMechsDowned)
DropHelper.BlockDrops(postOneMechBlockedDrops_GoldenCrate);
}
break;
case ItemID.CorruptFishingCrate:
+920
View File
@@ -0,0 +1,920 @@
using CalamityMod.CalPlayer;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Armor;
using CalamityMod.Items.Placeables.Furniture.Fountains;
using CalamityMod.Items.Tools;
using CalamityMod.Items.Weapons.Magic;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.Items.Weapons.Summon;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items
{
public partial class CalamityGlobalItem : GlobalItem
{
#region Main ModifyTooltips Function
public override void ModifyTooltips(Item item, List<TooltipLine> tooltips)
{
// Apply rarity coloration to the item's name.
TooltipLine nameLine = tooltips.FirstOrDefault(x => x.Name == "ItemName" && x.mod == "Terraria");
if (nameLine != null)
ApplyRarityColor(item, nameLine);
// If the item is melee, add a true melee damage number adjacent to the standard damage number.
if (item.melee && item.damage > 0 && Main.LocalPlayer.Calamity().trueMeleeDamage > 0D)
TrueMeleeDamageTooltip(item, tooltips);
// Modify all vanilla tooltips before appending mod mechanics (if any).
ModifyVanillaTooltips(item, tooltips);
// If the item has a stealth generation prefix, show that on the tooltip.
// This is placed between vanilla tooltip edits and mod mechanics because it can apply to vanilla items.
StealthGenAccessoryTooltip(item, tooltips);
// Everything below this line can only apply to modded items. If the item is vanilla, stop here for efficiency.
if (item.type < ItemID.Count)
return;
// Adds tooltips to Calamity fountains which match Fargo's fountain tooltips.
FargoFountainTooltip(item, tooltips);
// Adds a Current Charge tooltip to all items which use charge.
CalamityGlobalItem modItem = item.Calamity();
if (modItem?.UsesCharge ?? false)
{
// Convert current charge ratio into a percentage.
float displayedPercent = ChargeRatio * 100f;
TooltipLine line = new TooltipLine(mod, "CalamityCharge", $"Current Charge: {displayedPercent:N1}%");
tooltips.Add(line);
}
// Adds "Donor Item" and "Developer Item" to donor items and developer items respectively.
if (donorItem)
{
TooltipLine line = new TooltipLine(mod, "CalamityDonor", CalamityUtils.ColorMessage("- Donor Item -", CalamityUtils.DonatorItemColor));
tooltips.Add(line);
}
if (devItem)
{
TooltipLine line = new TooltipLine(mod, "CalamityDev", CalamityUtils.ColorMessage("- Developer Item -", CalamityUtils.HotPinkRarityColor));
tooltips.Add(line);
}
// Adds "Challenge Drop" or "Legendary Challenge Drop" to Malice Mode drops.
// For Legendary Challenge Drops, this tooltip matches their unique rarity color.
if (challengeDrop)
ChallengeDropTooltip(item, tooltips);
}
#endregion
#region Rarity Coloration
private void ApplyRarityColor(Item item, TooltipLine nameLine)
{
// Apply standard post-ML rarities to the item's color first.
Color? standardRarityColor = CalamityUtils.GetRarityColor(customRarity);
if (standardRarityColor.HasValue)
nameLine.overrideColor = standardRarityColor.Value;
#region Uniquely Colored Developer Items
if (item.type == ModContent.ItemType<Fabstaff>())
nameLine.overrideColor = new Color(Main.DiscoR, 100, 255);
if (item.type == ModContent.ItemType<BlushieStaff>())
nameLine.overrideColor = new Color(0, 0, 255);
if (item.type == ModContent.ItemType<Judgement>())
nameLine.overrideColor = Judgement.GetSyncedLightColor();
if (item.type == ModContent.ItemType<NanoblackReaperRogue>())
nameLine.overrideColor = new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f);
if (item.type == ModContent.ItemType<ShatteredCommunity>())
nameLine.overrideColor = ShatteredCommunity.GetRarityColor();
if (item.type == ModContent.ItemType<ProfanedSoulCrystal>())
nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25), 4f); //alternates between emerald green and amber (BanditHueh)
if (item.type == ModContent.ItemType<BensUmbrella>())
nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(210, 0, 255), new Color(255, 248, 24), 4f);
if (item.type == ModContent.ItemType<Endogenesis>())
nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(131, 239, 255), new Color(36, 55, 230), 4f);
if (item.type == ModContent.ItemType<DraconicDestruction>())
nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(255, 69, 0), new Color(139, 0, 0), 4f);
if (item.type == ModContent.ItemType<ScarletDevil>())
nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(191, 45, 71), new Color(185, 187, 253), 4f);
if (item.type == ModContent.ItemType<RedSun>())
nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(204, 86, 80), new Color(237, 69, 141), 4f);
if (item.type == ModContent.ItemType<GaelsGreatsword>())
nameLine.overrideColor = new Color(146, 0, 0);
if (item.type == ModContent.ItemType<CrystylCrusher>())
nameLine.overrideColor = new Color(129, 29, 149);
if (item.type == ModContent.ItemType<Svantechnical>())
nameLine.overrideColor = new Color(220, 20, 60);
if (item.type == ModContent.ItemType<SomaPrime>())
nameLine.overrideColor = new Color(254, 253, 235);
if (item.type == ModContent.ItemType<Contagion>())
nameLine.overrideColor = new Color(207, 17, 117);
if (item.type == ModContent.ItemType<TriactisTruePaladinianMageHammerofMightMelee>())
nameLine.overrideColor = new Color(227, 226, 180);
if (item.type == ModContent.ItemType<RoyalKnivesMelee>())
nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(154, 255, 151), new Color(228, 151, 255), 4f);
if (item.type == ModContent.ItemType<DemonshadeHelm>() || item.type == ModContent.ItemType<DemonshadeBreastplate>() || item.type == ModContent.ItemType<DemonshadeGreaves>())
nameLine.overrideColor = CalamityUtils.ColorSwap(new Color(255, 132, 22), new Color(221, 85, 7), 4f);
// TODO -- for cleanliness, ALL color math should either be a one-line color swap or inside the item's own file
// The items that currently violate this are all below:
// Eternity, Flamsteed Ring, Earth
if (item.type == ModContent.ItemType<Eternity>())
{
List<Color> colorSet = new List<Color>()
{
new Color(188, 192, 193), // white
new Color(157, 100, 183), // purple
new Color(249, 166, 77), // honey-ish orange
new Color(255, 105, 234), // pink
new Color(67, 204, 219), // sky blue
new Color(249, 245, 99), // bright yellow
new Color(236, 168, 247), // purplish pink
};
if (nameLine != null)
{
int colorIndex = (int)(Main.GlobalTime / 2 % colorSet.Count);
Color currentColor = colorSet[colorIndex];
Color nextColor = colorSet[(colorIndex + 1) % colorSet.Count];
nameLine.overrideColor = Color.Lerp(currentColor, nextColor, Main.GlobalTime % 2f > 1f ? 1f : Main.GlobalTime % 1f);
}
}
if (item.type == ModContent.ItemType<PrototypeAndromechaRing>())
{
if (Main.GlobalTime % 1f < 0.6f)
{
nameLine.overrideColor = new Color(89, 229, 255);
}
else if (Main.GlobalTime % 1f < 0.8f)
{
nameLine.overrideColor = Color.Lerp(new Color(89, 229, 255), Color.White, (Main.GlobalTime % 1f - 0.6f) / 0.2f);
}
else
{
nameLine.overrideColor = Color.Lerp(Color.White, new Color(89, 229, 255), (Main.GlobalTime % 1f - 0.8f) / 0.2f);
}
}
if (item.type == ModContent.ItemType<Earth>())
{
List<Color> earthColors = new List<Color>()
{
new Color(255, 99, 146),
new Color(255, 228, 94),
new Color(127, 200, 248)
};
if (nameLine != null)
{
int colorIndex = (int)(Main.GlobalTime / 2 % earthColors.Count);
Color currentColor = earthColors[colorIndex];
Color nextColor = earthColors[(colorIndex + 1) % earthColors.Count];
nameLine.overrideColor = Color.Lerp(currentColor, nextColor, Main.GlobalTime % 2f > 1f ? 1f : Main.GlobalTime % 1f);
}
}
#endregion
}
#endregion
#region Challenge Drop Tooltip
private void ChallengeDropTooltip(Item item, IList<TooltipLine> tooltips)
{
Color? legendaryColor = null;
if (item.type == ModContent.ItemType<AegisBlade>() || item.type == ModContent.ItemType<YharimsCrystal>())
legendaryColor = new Color(255, Main.DiscoG, 53);
if (item.type == ModContent.ItemType<BlossomFlux>() || item.type == ModContent.ItemType<Malachite>())
legendaryColor = new Color(Main.DiscoR, 203, 103);
if (item.type == ModContent.ItemType<BrinyBaron>() || item.type == ModContent.ItemType<ColdDivinity>())
legendaryColor = new Color(53, Main.DiscoG, 255);
if (item.type == ModContent.ItemType<CosmicDischarge>())
legendaryColor = new Color(150, Main.DiscoG, 255);
if (item.type == ModContent.ItemType<SeasSearing>())
legendaryColor = new Color(60, Main.DiscoG, 190);
if (item.type == ModContent.ItemType<SHPC>())
legendaryColor = new Color(255, Main.DiscoG, 155);
if (item.type == ModContent.ItemType<Vesuvius>() || item.type == ModContent.ItemType<GoldBurdenBreaker>())
legendaryColor = new Color(255, Main.DiscoG, 0);
if (item.type == ModContent.ItemType<PristineFury>())
legendaryColor = CalamityUtils.ColorSwap(new Color(255, 168, 53), new Color(255, 249, 0), 2f);
if (item.type == ModContent.ItemType<LeonidProgenitor>())
legendaryColor = CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 3f);
if (item.type == ModContent.ItemType<TheCommunity>())
legendaryColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB);
Color lineColor = legendaryColor.GetValueOrDefault(CalamityUtils.ChallengeDropColor);
string text = legendaryColor.HasValue ? "- Legendary Challenge Drop -" : "- Challenge Drop";
TooltipLine line = new TooltipLine(mod, "CalamityChallengeDrop", text)
{
overrideColor = lineColor
};
tooltips.Add(line);
}
#endregion
#region Vanilla Item Tooltip Modification
private void ModifyVanillaTooltips(Item item, IList<TooltipLine> tooltips)
{
#region Modular Tooltip Editing Code
// This is a modular tooltip editor which loops over all tooltip lines of an item,
// selects all those which match an arbitrary function you provide,
// then edits them using another arbitrary function you provide.
void ApplyTooltipEdits(IList<TooltipLine> lines, Func<Item, TooltipLine, bool> predicate, Action<TooltipLine> action)
{
foreach (TooltipLine line in lines)
if (predicate.Invoke(item, line))
action.Invoke(line);
}
// This function produces simple predicates to match a specific line of a tooltip, by number/index.
Func<Item, TooltipLine, bool> LineNum(int n) => (Item i, TooltipLine l) => l.mod == "Terraria" && l.Name == $"Tooltip{n}";
// This function produces simple predicates to match a specific line of a tooltip, by name.
Func<Item, TooltipLine, bool> LineName(string s) => (Item i, TooltipLine l) => l.mod == "Terraria" && l.Name == s;
// These functions are shorthand to invoke ApplyTooltipEdits using the above predicates.
void EditTooltipByNum(int lineNum, Action<TooltipLine> action) => ApplyTooltipEdits(tooltips, LineNum(lineNum), action);
void EditTooltipByName(string lineName, Action<TooltipLine> action) => ApplyTooltipEdits(tooltips, LineName(lineName), action);
#endregion
// Numerous random tooltip edits which don't fit into another category
#region Various Tooltip Edits
// Mirrors and Recall Potions cannot be used while a boss is alive.
if (item.type == ItemID.MagicMirror || item.type == ItemID.IceMirror || item.type == ItemID.CellPhone || item.type == ItemID.RecallPotion)
ApplyTooltipEdits(tooltips,
(i, l) => l.mod == "Terraria" && l.Name == (i.type == ItemID.CellPhone ? "Tooltip1" : "Tooltip0"),
(line) => line.text += "\nCannot be used while a boss is alive");
// Rod of Discord cannot be used multiple times to hurt yourself
if (item.type == ItemID.RodofDiscord)
EditTooltipByNum(0, (line) => line.text += "\nTeleportation is disabled while Chaos State is active");
// Water removing items cannot be used in the Abyss
string noAbyssLine = "\nCannot be used in the Abyss";
if (item.type == ItemID.SuperAbsorbantSponge)
EditTooltipByNum(0, (line) => line.text += noAbyssLine);
if (item.type == ItemID.EmptyBucket)
EditTooltipByName("Defense", (line) => line.text += noAbyssLine);
// If Early Hardmode Rework is enabled: Remind users that ores will NOT spawn when an altar is smashed.
if (CalamityConfig.Instance.EarlyHardmodeProgressionRework && (item.type == ItemID.Pwnhammer || item.type == ItemID.Hammush))
EditTooltipByNum(0, (line) => line.text += "\nDemon Altars no longer spawn ores when destroyed");
// Bottled Honey gives the Honey buff
if (item.type == ItemID.BottledHoney)
EditTooltipByName("HealLife", (line) => line.text += "\nGrants the Honey buff for 2 minutes");
// Warmth Potion provides debuff immunities and Death Mode cold protection
if (item.type == ItemID.WarmthPotion)
{
string immunityLine = "\nMakes you immune to the Chilled, Frozen, and Glacial State debuffs";
if (CalamityWorld.death)
immunityLine += "\nProvides cold protection in Death Mode";
EditTooltipByNum(0, (line) => line.text += immunityLine);
}
// Hand Warmer provides Death Mode cold protection and has a side bonus with Eskimo armor
if (item.type == ItemID.HandWarmer)
{
string extraLine = "\nProvides a regeneration boost while wearing the Eskimo armor";
if (CalamityWorld.death)
extraLine += "\nProvides cold protection in Death Mode";
EditTooltipByNum(0, (line) => line.text += extraLine);
}
// Invisibility Potion provides various rogue boosts
if (item.type == ItemID.InvisibilityPotion)
EditTooltipByNum(0, (line) => line.text += "\nBoosts various rogue stats depending on held weapon");
// Golden Fishing Rod inherently contains High Test Fishing Line
if (item.type == ItemID.GoldenFishingRod)
EditTooltipByName("NeedsBait", (line) => line.text += "\nIts fishing line will never break");
// Eternity Crystal notifies the player that they can accelerate the invasion
if (item.type == ItemID.DD2ElderCrystal)
EditTooltipByNum(0, (line) => line.text += "\nOnce placed you can right click the crystal to skip waves or increase the spawn rate of the invaders");
// Fix a vanilla mistake in Magic Quiver's tooltip
// TODO -- in 1.4 this mistake is already corrected
if (item.type == ItemID.MagicQuiver)
EditTooltipByNum(0, (line) => line.text = line.text.Replace(" damage", " arrow damage"));
#endregion
// Black Belt and Master Ninja Gear have guaranteed dodges on a 60 second cooldown.
#region Dodging Belt Tooltips
string beltDodgeLine = "Grants the ability to dodge attacks\n" +
$"The dodge has a {CalamityPlayer.BeltDodgeCooldown} second cooldown which is shared with all other dodges and reflects";
if (item.type == ItemID.BlackBelt)
EditTooltipByNum(0, (line) => line.text = beltDodgeLine);
if (item.type == ItemID.MasterNinjaGear)
EditTooltipByNum(1, (line) => line.text = beltDodgeLine);
#endregion
// Early Hardmode ore melee weapons have new on-hit effects.
#region Early Hardmode Melee Tooltips
// Cobalt
if (item.type == ItemID.CobaltSword || item.type == ItemID.CobaltNaginata)
EditTooltipByName("Knockback", (line) => line.text += "\nDecreases enemy defense by 10% on hit");
// Palladium
if (item.type == ItemID.PalladiumSword || item.type == ItemID.PalladiumPike)
EditTooltipByName("Knockback", (line) => line.text += "\nIncreases life regen on hit");
// Mythril
if (item.type == ItemID.MythrilSword || item.type == ItemID.MythrilHalberd)
EditTooltipByName("Knockback", (line) => line.text += "\nDecreases enemy contact damage by 10% on hit");
// Orichalcum
if (item.type == ItemID.OrichalcumSword || item.type == ItemID.OrichalcumHalberd)
EditTooltipByName("Knockback", (line) => line.text += "\nIncreases how frequently the Orichalcum set bonus triggers on hit");
// Adamantite
if (item.type == ItemID.AdamantiteSword || item.type == ItemID.AdamantiteGlaive)
EditTooltipByName("Knockback", (line) => line.text += "\nSlows enemies on hit");
// Titanium
if (item.type == ItemID.TitaniumSword || item.type == ItemID.TitaniumTrident)
EditTooltipByName("Knockback", (line) => line.text += "\nDeals increased damage to enemies with high knockback resistance");
// Hallowed (and True Excalibur)
if (item.type == ItemID.Excalibur || item.type == ItemID.Gungnir || item.type == ItemID.TrueExcalibur)
EditTooltipByName("Knockback", (line) => line.text += "\nInflicts Holy Flames\nDeals double damage to enemies above 75% life");
#endregion
// Other melee weapon tooltips
#region Other Melee Tooltips
if (item.type == ItemID.CandyCaneSword || item.type == ItemID.FruitcakeChakram)
EditTooltipByName("Knockback", (line) => line.text += "\nHeals you on hit");
// Stylish Scissors, all Phaseblades, and all Phasesabers
if (item.type == ItemID.StylistKilLaKillScissorsIWish || (item.type >= ItemID.BluePhaseblade && item.type <= ItemID.YellowPhaseblade) || (item.type >= ItemID.BluePhasesaber && item.type <= ItemID.YellowPhasesaber))
EditTooltipByName("Knockback", (line) => line.text += "\nIgnores 100% of enemy defense");
if (item.type == ItemID.AntlionClaw || item.type == ItemID.BoneSword || item.type == ItemID.BreakerBlade)
EditTooltipByName("Knockback", (line) => line.text += "\nIgnores 50% of enemy defense");
if (item.type == ItemID.LightsBane || item.type == ItemID.NightsEdge || item.type == ItemID.TrueNightsEdge)
EditTooltipByName("Knockback", (line) => line.text += "\nInflicts Shadowflame on hit");
if (item.type == ItemID.BloodButcherer || item.type == ItemID.TheRottedFork)
EditTooltipByName("Knockback", (line) => line.text += "\nInflicts Burning Blood on hit");
#endregion
// Light pets, accessories, and other items which boost the player's Abyss light stat
#region Abyss Light Tooltips
// +1 to Abyss light level
string abyssSmallLightLine = "\nProvides a small amount of light in the abyss";
if (item.type == ItemID.CrimsonHeart || item.type == ItemID.ShadowOrb || item.type == ItemID.MagicLantern || item.type == ItemID.JellyfishNecklace || item.type == ItemID.MiningHelmet)
EditTooltipByNum(0, (line) => line.text += abyssSmallLightLine);
if (item.type == ItemID.JellyfishDivingGear)
EditTooltipByNum(1, (line) => line.text += abyssSmallLightLine);
// +2 to Abyss light level
string abyssMediumLightLine = "\nProvides a moderate amount of light in the abyss";
if (item.type == ItemID.ShinePotion)
EditTooltipByName("BuffTime", (line) => line.text += abyssMediumLightLine);
if (item.type == ItemID.FairyBell || item.type == ItemID.DD2PetGhost)
EditTooltipByNum(0, (line) => line.text += abyssMediumLightLine);
// +3 to Abyss light level
string abyssLargeLightLine = "\nProvides a large amount of light in the abyss";
if (item.type == ItemID.WispinaBottle)
EditTooltipByNum(0, (line) => line.text += abyssLargeLightLine);
if (item.type == ItemID.SuspiciousLookingTentacle)
EditTooltipByNum(1, (line) => line.text += abyssLargeLightLine);
#endregion
// Accessories and other items which boost the player's ability to breathe in the Abyss
#region Abyss Breath Tooltips
// Moderate breath boost
string abyssModerateBreathLine = "\nModerately reduces breath loss in the abyss";
if (item.type == ItemID.DivingHelmet)
EditTooltipByNum(0, (line) => line.text += abyssModerateBreathLine);
if (item.type == ItemID.ArcticDivingGear)
EditTooltipByNum(1, (line) => line.text += abyssSmallLightLine + abyssModerateBreathLine);
// Great breath boost
string abyssGreatBreathLine = "\nGreatly reduces breath loss in the abyss";
if (item.type == ItemID.GillsPotion)
EditTooltipByName("BuffTime", (line) => line.text += abyssGreatBreathLine);
if (item.type == ItemID.NeptunesShell || item.type == ItemID.MoonShell)
EditTooltipByNum(0, (line) => line.text += abyssGreatBreathLine);
if (item.type == ItemID.CelestialShell)
EditTooltipByNum(1, (line) => line.text += abyssModerateBreathLine);
#endregion
// Flasks apply to Rogue weapons
#region Rogue Flask Tooltips
if (item.type == ItemID.FlaskofCursedFlames)
EditTooltipByNum(0, (line) => line.text += "\nRogue attacks inflict enemies with cursed flames");
if (item.type == ItemID.FlaskofFire)
EditTooltipByNum(0, (line) => line.text += "\nRogue attacks set enemies on fire");
if (item.type == ItemID.FlaskofGold)
EditTooltipByNum(0, (line) => line.text += "\nRogue attacks make enemies drop more gold");
if (item.type == ItemID.FlaskofIchor)
EditTooltipByNum(0, (line) => line.text += "\nRogue attacks decrease enemy defense");
if (item.type == ItemID.FlaskofNanites)
EditTooltipByNum(0, (line) => line.text += "\nRogue attacks confuse enemies");
// party flask is unique because it affects ALL projectiles in Calamity, not just "also rogue ones"
if (item.type == ItemID.FlaskofParty)
EditTooltipByNum(0, (line) => line.text = "All attacks cause confetti to appear");
if (item.type == ItemID.FlaskofPoison)
EditTooltipByNum(0, (line) => line.text += "\nRogue attacks poison enemies");
if (item.type == ItemID.FlaskofVenom)
EditTooltipByNum(0, (line) => line.text += "\nRogue attacks inflict Venom on enemies");
#endregion
// Rebalances to vanilla item stats
#region Vanilla Item Rebalance Tooltips
// Worm Scarf only gives 10% DR instead of 17%
if (item.type == ItemID.WormScarf)
EditTooltipByNum(0, (line) => line.text = line.text = line.text.Replace("17%", "10%"));
if (item.type == ItemID.TitanGlove)
EditTooltipByNum(0, (line) => line.text += "\n10% increased true melee damage");
if (item.type == ItemID.PowerGlove || item.type == ItemID.MechanicalGlove)
EditTooltipByNum(1, (line) => line.text += "\n10% increased true melee damage");
if (item.type == ItemID.FireGauntlet)
{
string extraLine = "\n10% increased true melee damage";
if (CalamityWorld.death)
extraLine += "\nProvides heat and cold protection in Death Mode";
EditTooltipByNum(1, (line) => line.text = line.text.Replace("12%", "14%") + extraLine);
}
// Spectre Hood's lifesteal is heavily nerfed, so it only reduces magic damage by 20% instead of 40%
if (item.type == ItemID.SpectreHood)
EditTooltipByNum(0, (line) => line.text = line.text.Replace("40%", "20%"));
#endregion
// Items which provide immunity to either heat or cold in Death Mode, or interact with Lethal Lava
#region Lava and Death Mode Environmental Immunity Tooltips
string heatProtectionLine = "\nProvides heat protection in Death Mode";
string bothProtectionLine = "\nProvides heat and cold protection in Death Mode";
if (item.type == ItemID.ObsidianSkinPotion)
{
// If Lethal Lava is enabled, Obsidian Skin Potions work very differently.
if (CalamityConfig.Instance.LethalLava)
{
string lethalLavaReplacement = "Provides immunity to direct damage from touching lava\n"
+ "Provides temporary immunity to lava burn damage\n"
+ "Greatly increases the speed at which lava immunity recharges\n"
+ "Reduces lava burn damage";
if (CalamityWorld.death)
lethalLavaReplacement += heatProtectionLine;
EditTooltipByNum(0, (line) => line.text = lethalLavaReplacement);
}
// Otherwise, changes are only made on Death Mode, where heat immunity is mentioned.
else if (CalamityWorld.death)
EditTooltipByNum(0, (line) => line.text += heatProtectionLine);
}
if (item.type == ItemID.ObsidianRose)
{
StringBuilder sb = new StringBuilder(128);
// If Lethal Lava is enabled, Obsidian Rose reduces the damage from the debuff.
if (CalamityConfig.Instance.LethalLava)
sb.Append("\nGreatly reduces lava burn damage");
if (CalamityWorld.death)
sb.Append(heatProtectionLine);
EditTooltipByNum(0, (line) => line.text += sb.ToString());
}
if (CalamityWorld.death)
{
if (item.type == ItemID.MagmaStone)
EditTooltipByNum(0, (line) => line.text += bothProtectionLine);
if (item.type == ItemID.LavaCharm)
EditTooltipByNum(0, (line) => line.text += heatProtectionLine);
if (item.type == ItemID.LavaWaders)
EditTooltipByNum(1, (line) => line.text += heatProtectionLine);
if (item.type == ItemID.FrostHelmet || item.type == ItemID.FrostBreastplate || item.type == ItemID.FrostLeggings)
EditTooltipByName("SetBonus", (line) => line.text += bothProtectionLine);
}
#endregion
// Add mentions of what Calamity ores vanilla pickaxes can mine
#region Pickaxe New Ore Tooltips
if (item.type == ItemID.Picksaw)
EditTooltipByNum(0, (line) => line.text += "\nCan mine Scoria Ore");
if (item.type == ItemID.SolarFlarePickaxe || item.type == ItemID.VortexPickaxe || item.type == ItemID.NebulaPickaxe || item.type == ItemID.StardustPickaxe)
EditTooltipByName("Material", (line) => line.text += "\nCan mine Uelibloom Ore");
#endregion
// Rebalances and information about vanilla set bonuses
#region Vanilla Set Bonus Tooltips
// Turns a number into a string of increased mining speed.
string MiningSpeedString(int percent) => $"\n{percent}% increased mining speed";
// Copper
if (item.type == ItemID.CopperHelmet || item.type == ItemID.CopperChainmail || item.type == ItemID.CopperGreaves)
EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(15));
// Tin
if (item.type == ItemID.TinHelmet || item.type == ItemID.TinChainmail || item.type == ItemID.TinGreaves)
EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(10));
// Iron
if (item.type == ItemID.AncientIronHelmet || item.type == ItemID.IronHelmet || item.type == ItemID.IronChainmail || item.type == ItemID.IronGreaves)
EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(25));
// Lead
if (item.type == ItemID.LeadHelmet || item.type == ItemID.LeadChainmail || item.type == ItemID.LeadGreaves)
EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(20));
// Silver
if (item.type == ItemID.SilverHelmet || item.type == ItemID.SilverChainmail || item.type == ItemID.SilverGreaves)
EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(35));
// Tungsten
if (item.type == ItemID.TungstenHelmet || item.type == ItemID.TungstenChainmail || item.type == ItemID.TungstenGreaves)
EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(30));
// Gold
if (item.type == ItemID.AncientGoldHelmet || item.type == ItemID.GoldHelmet || item.type == ItemID.GoldChainmail || item.type == ItemID.GoldGreaves)
EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(45));
// Platinum
if (item.type == ItemID.PlatinumHelmet || item.type == ItemID.PlatinumChainmail || item.type == ItemID.PlatinumGreaves)
EditTooltipByName("SetBonus", (line) => line.text += MiningSpeedString(40));
// Gladiator
if (item.type == ItemID.GladiatorHelmet)
EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue damage");
if (item.type == ItemID.GladiatorBreastplate)
EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue critical strike chance");
if (item.type == ItemID.GladiatorLeggings)
EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue velocity");
// Obsidian
if (item.type == ItemID.ObsidianHelm)
EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue damage");
if (item.type == ItemID.ObsidianShirt)
EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue critical strike chance");
if (item.type == ItemID.ObsidianPants)
EditTooltipByName("Defense", (line) => line.text += "\n3% increased rogue velocity");
// Meteor Armor only makes space gun cost 50% instead of zero mana
if (item.type == ItemID.MeteorHelmet || item.type == ItemID.MeteorSuit || item.type == ItemID.MeteorLeggings)
EditTooltipByName("SetBonus", (line) => line.text = line.text.Replace("0", "50%"));
// Molten
if (item.type == ItemID.MoltenHelmet || item.type == ItemID.MoltenBreastplate || item.type == ItemID.MoltenGreaves)
{
string extraLine = "\n20% extra true melee damage\nGrants immunity to fire blocks and temporary immunity to lava";
if (CalamityWorld.death)
extraLine += bothProtectionLine;
EditTooltipByName("SetBonus", (line) => line.text += extraLine);
}
// Forbidden (UNLESS you are wearing the Circlet, which is Summon/Rogue and does not get this line)
if (item.type == ItemID.AncientBattleArmorHat || item.type == ItemID.AncientBattleArmorShirt || item.type == ItemID.AncientBattleArmorPants
&& !Main.LocalPlayer.Calamity().forbiddenCirclet)
EditTooltipByName("SetBonus", (line) => line.text += "\nThe minion damage nerf is reduced while wielding magic weapons");
// Stardust
// 1) Chest and Legs only give 1 minion slot each instead of 2 each.
if (item.type == ItemID.StardustBreastplate || item.type == ItemID.StardustLeggings)
EditTooltipByNum(0, (line) => line.text = line.text.Replace('2', '1'));
// 2) Set bonus gives 2 minions instead of 0.
if (item.type == ItemID.StardustHelmet || item.type == ItemID.StardustBreastplate || item.type == ItemID.StardustLeggings)
EditTooltipByName("SetBonus", (line) => line.text += "\nIncreases your max number of minions by 2");
#endregion
// Provide the full stats of every vanilla set of wings
#region Wing Stat Tooltips
// This function produces a "stat sheet" for a pair of wings from the raw stats.
// For "vertical speed", 0 = Average, 1 = Good, 2 = Great.
string[] vertSpeedStrings = new string[] { "Average vertical speed", "Good vertical speed", "Great vertical speed" };
string WingStatsTooltip(float hSpeed, float accelMult, int vertSpeed, int flightTime, string extraTooltip = null)
{
StringBuilder sb = new StringBuilder(512);
sb.Append('\n');
sb.Append($"Horizontal speed: {hSpeed:N2}\n");
sb.Append($"Acceleration multiplier: {accelMult:N1}\n");
sb.Append(vertSpeedStrings[vertSpeed]);
sb.Append('\n');
sb.Append($"Flight time: {flightTime}");
if (extraTooltip != null)
{
sb.Append('\n');
sb.Append(extraTooltip);
}
return sb.ToString();
}
// This function is shorthand for appending a stat sheet to a pair of wings.
void AddWingStats(float h, float a, int v, int f, string s = null) => EditTooltipByNum(0, (line) => line.text += WingStatsTooltip(h, a, v, f, s));
if (item.type == ItemID.AngelWings)
AddWingStats(6.25f, 1f, 0, 100, "+20 max life, +10 defense and +2 life regen");
if (item.type == ItemID.DemonWings)
AddWingStats(6.25f, 1f, 0, 100, "5% increased damage and critical strike chance");
if (item.type == ItemID.Jetpack)
AddWingStats(6.5f, 1f, 0, 115);
if (item.type == ItemID.ButterflyWings)
AddWingStats(6.75f, 1f, 0, 130, "+20 max mana, 5% decreased mana usage,\n" +
"5% increased magic damage and magic critical strike chance");
if (item.type == ItemID.FairyWings)
AddWingStats(6.75f, 1f, 0, 130, "+60 max life");
if (item.type == ItemID.BeeWings)
AddWingStats(6.75f, 1f, 0, 130, "Permanently gives the Honey buff");
if (item.type == ItemID.HarpyWings)
AddWingStats(7f, 1f, 0, 140, "20% increased movement speed\n" +
"With Harpy Ring or Angel Treads equipped, most attacks sometimes launch feathers");
if (item.type == ItemID.BoneWings)
AddWingStats(7f, 1f, 0, 140, "10% increased movement speed, ranged damage and critical strike chance\n" +
"and +30 defense while wearing the Necro Armor");
if (item.type == ItemID.FlameWings)
AddWingStats(7.5f, 1f, 0, 160, "5% increased melee damage and critical strike chance");
if (item.type == ItemID.FrozenWings)
AddWingStats(7.5f, 1f, 0, 160, "2% increased melee and ranged damage\n" +
"and 1% increased melee and ranged critical strike chance\n" +
"while wearing the Frost Armor");
if (item.type == ItemID.GhostWings)
AddWingStats(7.5f, 1f, 0, 160, "+10 defense and 5% increased damage reduction while wearing the Spectre Hood set\n" +
"5% increased magic damage and critical strike chance while wearing the Spectre Mask set");
if (item.type == ItemID.BeetleWings)
AddWingStats(7.5f, 1f, 0, 160, "+10 defense and 5% increased damage reduction while wearing the Beetle Shell set\n" +
"5% increased melee damage and critical strike chance while wearing the Beetle Scale Mail set");
if (item.type == ItemID.FinWings)
AddWingStats(0f, 0f, 0, 100, "Gills effect and you can move freely through liquids\n" +
"You fall faster while submerged in liquid\n" +
"15% increased movement speed and 18% increased jump speed");
if (item.type == ItemID.FishronWings)
AddWingStats(8f, 2f, 1, 180);
if (item.type == ItemID.SteampunkWings)
AddWingStats(7.75f, 1f, 0, 180, "+8 defense, 10% increased movement speed,\n" + "4% increased damage, and 2% increased critical strike chance");
if (item.type == ItemID.LeafWings)
AddWingStats(6.75f, 1f, 0, 160, "+5 defense, 5% increased damage reduction,\n" + "and permanent Dryad's Blessing while wearing the Tiki Armor");
if (item.type == ItemID.BatWings)
AddWingStats(0f, 0f, 0, 140, "At night or during an eclipse, you will gain the following boosts:\n" +
"10% increased movement speed, 10% increased jump speed,\n" +
"7% increased damage and 3% increased critical strike chance");
// All developer wings have identical stats and no special effects
if (item.type == ItemID.Yoraiz0rWings || item.type == ItemID.JimsWings || item.type == ItemID.SkiphsWings ||
item.type == ItemID.LokisWings || item.type == ItemID.ArkhalisWings || item.type == ItemID.LeinforsWings ||
item.type == ItemID.BejeweledValkyrieWing || item.type == ItemID.RedsWings || item.type == ItemID.DTownsWings ||
item.type == ItemID.WillsWings || item.type == ItemID.CrownosWings || item.type == ItemID.CenxsWings)
{
AddWingStats(7f, 1f, 0, 150);
}
if (item.type == ItemID.TatteredFairyWings)
AddWingStats(7.5f, 1f, 0, 180, "5% increased damage and critical strike chance");
if (item.type == ItemID.SpookyWings)
AddWingStats(7.5f, 1f, 0, 180, "Increased minion knockback and 5% increased minion damage while wearing the Spooky Armor");
if (item.type == ItemID.Hoverboard)
AddWingStats(6.25f, 1f, 0, 170, "10% increased weapon-type damage while wearing the Shroomite Armor\n" +
"The weapon type boosted matches which Shroomite helmet is worn");
if (item.type == ItemID.FestiveWings)
AddWingStats(7.5f, 1f, 0, 170, "+40 max life\nOrnaments rain down as you fly");
if (item.type == ItemID.MothronWings)
AddWingStats(0f, 0f, 0, 160, "+5 defense, 5% increased damage,\n" +
"10% increased movement speed and 12% increased jump speed");
if (item.type == ItemID.WingsSolar)
AddWingStats(9f, 2.5f, 2, 180, "7% increased melee damage and 3% increased melee critical strike chance\n" +
"while wearing the Solar Flare Armor");
if (item.type == ItemID.WingsStardust)
AddWingStats(9f, 2.5f, 2, 180, "+1 max minion and 5% increased minion damage while wearing the Stardust Armor");
if (item.type == ItemID.WingsVortex)
AddWingStats(6.5f, 1.5f, 1, 160, "3% increased ranged damage and 7% increased ranged critical strike chance\n" +
"while wearing the Vortex Armor");
if (item.type == ItemID.WingsNebula)
AddWingStats(6.5f, 1.5f, 1, 160, "+20 max mana, 5% increased magic damage and critical strike chance,\n" +
"and 5% decreased mana usage while wearing the Nebula Armor");
if (item.type == ItemID.BetsyWings)
AddWingStats(6f, 2.5f, 1, 150);
#endregion
// Provide the full stats of every vanilla grappling hook
#region Grappling Hook Stat Tooltips
// This function produces a "stat sheet" for a grappling hook from the raw stats.
string HookStatsTooltip(float reach, float launch, float reel, float pull)
{
StringBuilder sb = new StringBuilder(128);
sb.Append('\n');
sb.Append($"Reach: {reach:N3} tiles\n");
sb.Append($"Launch Velocity: {launch:N2}\n");
sb.Append($"Reelback Velocity: {reel:N2}\n");
sb.Append($"Pull Velocity: {pull:N2}");
return sb.ToString();
}
// This function is shorthand for appending a stat sheet to a grappling hook.
void AddGrappleStats(float r, float l, float e, float p) => EditTooltipByName("Equipable", (line) => line.text += HookStatsTooltip(r, l, e, p));
if (item.type == ItemID.GrapplingHook)
AddGrappleStats(18.75f, 11.5f, 11f, 11f);
if (item.type == ItemID.AmethystHook)
AddGrappleStats(18.75f, 10f, 11f, 11f);
if (item.type == ItemID.TopazHook)
AddGrappleStats(20.625f, 10.5f, 11.75f, 11f);
if (item.type == ItemID.SapphireHook)
AddGrappleStats(22.5f, 11f, 12.5f, 11f);
if (item.type == ItemID.EmeraldHook)
AddGrappleStats(24.375f, 11.5f, 13.25f, 11f);
if (item.type == ItemID.RubyHook)
AddGrappleStats(26.25f, 12f, 14f, 11f);
if (item.type == ItemID.DiamondHook)
AddGrappleStats(28.125f, 12.5f, 14.75f, 11f);
if (item.type == ItemID.WebSlinger)
AddGrappleStats(15.625f, 10f, 11f, 11f);
if (item.type == ItemID.SkeletronHand)
AddGrappleStats(21.875f, 15f, 11f, 11f);
if (item.type == ItemID.SlimeHook)
AddGrappleStats(18.75f, 13f, 11f, 11f);
if (item.type == ItemID.FishHook)
AddGrappleStats(25f, 13f, 11f, 11f);
if (item.type == ItemID.IvyWhip)
AddGrappleStats(25f, 13f, 15f, 11f);
if (item.type == ItemID.BatHook) // TODO -- This item should be dropped by Vampires in the Eclipse. It is very overpowered.
AddGrappleStats(31.25f, 15.5f, 20f, 16f);
if (item.type == ItemID.CandyCaneHook)
AddGrappleStats(25f, 11.5f, 11f, 11f);
if (item.type == ItemID.DualHook)
AddGrappleStats(27.5f, 14f, 17f, 11f);
// these four grapple hooks are all functionally identical
if (item.type == ItemID.ThornHook || item.type == ItemID.WormHook || item.type == ItemID.TendonHook || item.type == ItemID.IlluminantHook)
AddGrappleStats(30f, 15f, 18f, 11f);
if (item.type == ItemID.AntiGravityHook)
AddGrappleStats(31.25f, 14f, 20f, 11f);
if (item.type == ItemID.SpookyHook)
AddGrappleStats(34.375f, 15.5f, 22f, 11f);
if (item.type == ItemID.ChristmasHook)
AddGrappleStats(34.375f, 15.5f, 17f, 11f);
if (item.type == ItemID.LunarHook)
AddGrappleStats(34.375f, 16f, 24f, 13f);
if (item.type == ItemID.StaticHook)
AddGrappleStats(37.5f, 16f, 24f, 0f);
#endregion
// Beyond this point all code only applies to accessories. Skip it all if the item is not an accessory.
if (!item.accessory)
return;
// Display the stat changes to vanilla prefixes
#region Accessory Prefix Rebalance Tooltips
// Turns a number into a string of increased DR.
string DRString(float percent) => $"\n+{percent:N2}% damage reduction";
switch (item.prefix)
{
case PrefixID.Brisk:
EditTooltipByName("PrefixAccMoveSpeed", (line) => line.text = line.text.Replace("1%", "2%"));
return;
case PrefixID.Fleeting:
EditTooltipByName("PrefixAccMoveSpeed", (line) => line.text = line.text.Replace("2%", "4%"));
return;
case PrefixID.Hasty2: // Hasty2 is the "Hasty" for accessories
EditTooltipByName("PrefixAccMoveSpeed", (line) => line.text = line.text.Replace("3%", "6%"));
return;
case PrefixID.Quick2: // Quick2 is the "Quick" for accessories
EditTooltipByName("PrefixAccMoveSpeed", (line) => line.text = line.text.Replace("4%", "8%"));
return;
case PrefixID.Precise:
case PrefixID.Lucky:
EditTooltipByName("PrefixAccCritChance", (line) => line.text += "\n+1 armor penetration");
return;
case PrefixID.Hard:
EditTooltipByName("PrefixAccDefense",
(line) => line.text = line.text.Replace("1", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(0.25f));
return;
case PrefixID.Guarding:
EditTooltipByName("PrefixAccDefense",
(line) => line.text = line.text.Replace("2", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(0.5f));
return;
case PrefixID.Armored:
EditTooltipByName("PrefixAccDefense",
(line) => line.text = line.text.Replace("3", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(0.75f));
return;
case PrefixID.Warding:
EditTooltipByName("PrefixAccDefense",
(line) => line.text = line.text.Replace("4", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(1f));
return;
}
#endregion
}
#endregion
#region True Melee Damage Tooltip
private void TrueMeleeDamageTooltip(Item item, IList<TooltipLine> tooltips)
{
TooltipLine line = tooltips.FirstOrDefault((l) => l.mod == "Terraria" && l.Name == "Damage");
// If there somehow isn't a damage tooltip line, do not try to perform any edits.
if (line is null)
return;
// Start with the existing line of melee damage.
StringBuilder sb = new StringBuilder(64);
sb.Append(line.text).Append(" : ");
Player p = Main.LocalPlayer;
float itemCurrentDamage = item.damage * p.MeleeDamage();
double trueMeleeBoost = 1D + p.Calamity().trueMeleeDamage;
double imprecisionRoundingCorrection = 5E-06D;
int damageToDisplay = (int)(itemCurrentDamage * trueMeleeBoost + imprecisionRoundingCorrection);
sb.Append(damageToDisplay);
// These two pieces are split apart for ease of translation
sb.Append(' ');
sb.Append("true melee damage");
line.text = sb.ToString();
}
#endregion
#region Stealth Generation Prefix Accessory Tooltip
private void StealthGenAccessoryTooltip(Item item, IList<TooltipLine> tooltips)
{
if (!item.accessory || item.social || item.prefix <= 0)
return;
float stealthGenBoost = item.Calamity().StealthGenBonus - 1f;
if (stealthGenBoost > 0)
{
TooltipLine StealthGen = new TooltipLine(mod, "PrefixStealthGenBoost", "+" + Math.Round(stealthGenBoost * 100f) + "% stealth generation")
{
isModifier = true
};
tooltips.Add(StealthGen);
}
}
#endregion
#region Fargo Biome Fountain Tooltip
private void FargoFountainTooltip(Item item, IList<TooltipLine> tooltips)
{
if (CalamityMod.Instance.fargos is null)
return;
if (item.type == ModContent.ItemType<SunkenSeaFountain>())
{
TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Sunken Sea upon activation");
tooltips.Add(line);
}
if (item.type == ModContent.ItemType<SulphurousFountainItem>())
{
TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Sulphurous Sea upon activation");
tooltips.Add(line);
}
if (item.type == ModContent.ItemType<AstralFountainItem>())
{
TooltipLine line = new TooltipLine(mod, "FargoFountain", "Forces surrounding biome state to Astral upon activation");
tooltips.Add(line);
}
}
#endregion
}
}
+2 -1
View File
@@ -16,7 +16,8 @@ namespace CalamityMod.Items.DifficultyItems
DisplayName.SetDefault("Armageddon");
Tooltip.SetDefault("Makes any hit while a boss is alive instantly kill you\n" +
"Effect can be toggled on and off\n" +
"If a boss is defeated with this effect active it will drop 6 treasure bags, 5 in normal mode");
"If a boss is defeated with this effect active it will drop 6 treasure bags, 5 in normal mode\n" +
"These extra bags will only drop if it's your first time killing the boss");
}
public override void SetDefaults()
+77
View File
@@ -0,0 +1,77 @@
using CalamityMod.CalPlayer;
using CalamityMod.Events;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.DifficultyItems
{
public class Malice : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Malice");
Tooltip.SetDefault("Enrages every boss and allows them to drop special items.\n" +
"Nurse no longer heals while a boss is alive.\n" +
"Effect can be toggled on and off.");
}
public override void SetDefaults()
{
item.rare = ItemRarityID.Purple;
item.width = 28;
item.height = 28;
item.useAnimation = 45;
item.useTime = 45;
item.useStyle = ItemUseStyleID.HoldingUp;
item.UseSound = SoundID.Item119;
item.consumable = false;
}
public override bool CanUseItem(Player player) => CalamityWorld.revenge;
public override bool UseItem(Player player)
{
// This world syncing code should only be run by one entity- the server, to prevent a race condition
// with the packets.
if (Main.netMode == NetmodeID.MultiplayerClient)
return true;
if (CalamityPlayer.areThereAnyDamnBosses || CalamityWorld.DoGSecondStageCountdown > 0 || BossRushEvent.BossRushActive)
{
string key = "Mods.CalamityMod.ChangingTheRules";
Color messageColor = Color.Crimson;
CalamityUtils.DisplayLocalizedText(key, messageColor);
return true;
}
if (!CalamityWorld.malice)
{
CalamityWorld.malice = true;
string key = "Mods.CalamityMod.MaliceText";
Color messageColor = Color.Crimson;
CalamityUtils.DisplayLocalizedText(key, messageColor);
}
else
{
CalamityWorld.malice = false;
string key = "Mods.CalamityMod.MaliceText2";
Color messageColor = Color.Crimson;
CalamityUtils.DisplayLocalizedText(key, messageColor);
}
CalamityWorld.DoGSecondStageCountdown = 0;
CalamityNetcode.SyncWorld();
return true;
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddTile(TileID.DemonAltar);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

+1 -1
View File
@@ -38,7 +38,7 @@ namespace CalamityMod.Items.Fishing
DropHelper.DropItemChance(player, ItemID.Ruby, 0.15f, gemMin, gemMax);
DropHelper.DropItemChance(player, ItemID.Diamond, 0.1f, gemMin, gemMax);
DropHelper.DropItemChance(player, ItemID.Amber, 0.25f, gemMin, gemMax);
Mod thorium = ModLoader.GetMod("ThoriumMod");
Mod thorium = CalamityMod.Instance.thorium;
if (thorium != null)
{
DropHelper.DropItemChance(player, thorium.ItemType("Pearl"), 0.25f, gemMin, gemMax);
+10 -8
View File
@@ -54,20 +54,22 @@ namespace CalamityMod.Items.Fishing
DropHelper.DropItemCondition(player, ItemID.CorruptSeeds, !WorldGen.crimson, 0.05f, seedMin, seedMax);
DropHelper.DropItemCondition(player, ItemID.CrimsonSeeds, WorldGen.crimson, 0.05f, seedMin, seedMax);
DropHelper.DropItemCondition(player, ItemID.HallowedSeeds, Main.hardMode, 0.05f, seedMin, seedMax);
Mod thorium = ModLoader.GetMod("ThoriumMod");
Mod thorium = CalamityMod.Instance.thorium;
if (thorium != null)
{
DropHelper.DropItemChance(player, thorium.ItemType("MarineKelp"), 0.25f, herbMin, herbMax);
DropHelper.DropItemChance(player, thorium.ItemType("MarineKelpSeeds"), 0.1f, seedMin, seedMax);
}
Mod shadowsOfAbaddon = ModLoader.GetMod("SacredTools");
if (shadowsOfAbaddon != null)
Mod soa = CalamityMod.Instance.soa;
if (soa != null)
{
DropHelper.DropItemChance(player, shadowsOfAbaddon.ItemType("Welkinbell"), 0.25f, herbMin, herbMax);
DropHelper.DropItemChance(player, shadowsOfAbaddon.ItemType("WelkinbellSeeds"), 0.1f, seedMin, seedMax);
DropHelper.DropItemCondition(player, shadowsOfAbaddon.ItemType("Illumifern"), Main.hardMode, 0.25f, herbMin, herbMax);
DropHelper.DropItemCondition(player, shadowsOfAbaddon.ItemType("IllumifernSeeds"), Main.hardMode, 0.1f, seedMin, seedMax);
//There's no mod call for Abaddon being dead
DropHelper.DropItemChance(player, soa.ItemType("Welkinbell"), 0.25f, herbMin, herbMax);
DropHelper.DropItemChance(player, soa.ItemType("WelkinbellSeeds"), 0.1f, seedMin, seedMax);
DropHelper.DropItemCondition(player, soa.ItemType("Illumifern"), Main.hardMode, 0.25f, herbMin, herbMax);
DropHelper.DropItemCondition(player, soa.ItemType("IllumifernSeeds"), Main.hardMode, 0.1f, seedMin, seedMax);
// TODO -- There is no way to determine if SoA's Abaddon is dead without reflection.
// Dan Yami has confirmed that downed calls will be added to SoA eventually.
//DropHelper.DropItemCondition(player, shadowsOfAbaddon.ItemType("Enduflora"), SacredTools.ModdedWorld.downedAbaddon, 0.25f, herbMin, herbMax);
//DropHelper.DropItemCondition(player, shadowsOfAbaddon.ItemType("EndufloraSeeds"), SacredTools.ModdedWorld.downedAbaddon, 0.1f, seedMin, seedMax);
}
+4 -7
View File
@@ -28,18 +28,15 @@ namespace CalamityMod.Items.Mounts
mountData.blockExtraJumps = false;
mountData.totalFrames = 15;
mountData.constantJump = false;
int baseYOffset = 24;
int[] array = new int[mountData.totalFrames];
for (int l = 0; l < array.Length; l++)
{
array[l] = 30;
array[l] = baseYOffset;
}
array[1] = 28;
array[3] = 28;
array[5] = 28;
array[7] = 28;
array[12] = 28;
array[1] = array[3] = array[5] = array[7] = array[12] = baseYOffset - 2;
mountData.playerYOffsets = array;
mountData.xOffset = 0;
mountData.xOffset = -4;
mountData.bodyFrame = 3;
mountData.yOffset = 7; //-8
mountData.playerHeadOffset = 36; //30
+4 -4
View File
@@ -140,22 +140,22 @@ namespace CalamityMod.Items.Placeables
}
else if (val < 85.03f)
{
resultType = !NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre;
resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre) : ItemID.MythrilOre;
resultStack = Main.rand.Next(1, 17);
}
else if (val < 87.03f)
{
resultType = !NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre;
resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre) : ItemID.OrichalcumOre;
resultStack = Main.rand.Next(1, 17);
}
else if (val < 88.78f)
{
resultType = !NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre;
resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre) : ItemID.AdamantiteOre;
resultStack = Main.rand.Next(1, 17);
}
else if (val < 89.53f)
{
resultType = !NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre;
resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre) : ItemID.TitaniumOre;
resultStack = Main.rand.Next(1, 17);
}
else if (CalamityWorld.downedStarGod)
+4 -4
View File
@@ -118,22 +118,22 @@ namespace CalamityMod.Items.Placeables
}
else if (val < 83.03f)
{
resultType = !NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre;
resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre) : ItemID.MythrilOre;
resultStack = Main.rand.Next(1, 17);
}
else if (val < 85.03f)
{
resultType = !NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre;
resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre) : ItemID.OrichalcumOre;
resultStack = Main.rand.Next(1, 17);
}
else if (val < 86.78f)
{
resultType = !NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre;
resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre) : ItemID.AdamantiteOre;
resultStack = Main.rand.Next(1, 17);
}
else if (val < 88.53f)
{
resultType = !NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre;
resultType = CalamityConfig.Instance.EarlyHardmodeProgressionRework ? (!NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre) : ItemID.TitaniumOre;
resultStack = Main.rand.Next(1, 17);
}
else if (CalamityWorld.downedStarGod)
@@ -0,0 +1,38 @@
using CalamityMod.Events;
using CalamityMod.Items.Materials;
using CalamityMod.World;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Items.SummonItems.Invasion
{
public class MartianDistressBeacon : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Martian Distress Beacon");
Tooltip.SetDefault("Summons the Martian Madness");
}
public override void SetDefaults()
{
item.width = 30;
item.height = 60;
item.maxStack = 99;
item.rare = ItemRarityID.Yellow;
item.useAnimation = 45;
item.useTime = 45;
item.useStyle = ItemUseStyleID.HoldingUp;
item.consumable = true;
}
public override bool CanUseItem(Player player) => Main.invasionType == InvasionID.None;
public override bool UseItem(Player player)
{
Main.StartInvasion(InvasionID.MartianMadness);
return true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 985 B

+6 -3
View File
@@ -51,8 +51,11 @@ namespace CalamityMod.Items.TreasureBags
DropHelper.DropItem(player, ItemID.Torch, 25);
DropHelper.DropItem(player, ItemID.Chest, 3);
// Difficulty items (doesn't drop in Normal)
DropHelper.DropItemCondition(player, ModContent.ItemType<Death>(), Main.expertMode);
// Malice item
DropHelper.DropItem(player, ModContent.ItemType<Malice>());
// Difficulty items (doesn't drop in Normal)
DropHelper.DropItemCondition(player, ModContent.ItemType<Death>(), Main.expertMode);
DropHelper.DropItemCondition(player, ModContent.ItemType<DefiledRune>(), Main.expertMode);
// Speedrun King Slime
@@ -62,7 +65,7 @@ namespace CalamityMod.Items.TreasureBags
DropHelper.DropItemCondition(player, ModContent.ItemType<JoyfulHeart>(), player.name == "Aleksh" || player.name == "Shark Lad");
// Music box (if music mod installed)
Mod musicMod = ModLoader.GetMod("CalamityModMusic");
Mod musicMod = CalamityMod.Instance.musicMod;
if (musicMod != null)
DropHelper.DropItem(player, musicMod.ItemType("CalamityMusicbox"));
}
+1 -1
View File
@@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
{
public class Phaseslayer : ModItem
{
public const int Damage = 1080;
public const int Damage = 980;
// When below this percentage of charge, the sword is small instead of big.
public const float SizeChargeThreshold = 0.25f;
// The small sword barely affects damage on its own because damage is already dropping significantly at low charge.
@@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
item.width = 22;
item.height = 28;
item.damage = 1640;
item.damage = 1312;
item.noMelee = true;
item.noUseGraphic = true;
item.consumable = true;
+1 -1
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal
CalamityGlobalItem modItem = item.Calamity();
item.shootSpeed = 10f;
item.damage = 356;
item.damage = 310;
item.mana = 12;
item.width = 38;
item.height = 24;
+1 -1
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic
item.width = 28;
item.height = 30;
item.damage = 148;
item.damage = 130;
item.knockBack = 3.5f;
item.noMelee = true;
item.magic = true;
+3 -4
View File
@@ -17,13 +17,12 @@ namespace CalamityMod.Items.Weapons.Magic
public override void SetDefaults()
{
item.damage = 62;
item.damage = 64;
item.magic = true;
item.mana = 4;
item.width = 34;
item.height = 36;
item.useTime = 3;
item.useAnimation = 3;
item.useTime = item.useAnimation = 4;
item.useStyle = ItemUseStyleID.HoldingOut;
item.noMelee = true;
item.knockBack = 3f;
@@ -40,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
int totalBeads = Main.rand.Next(2, 3 + 1);
int totalBeads = 2;
for (int index = 0; index < totalBeads; index++)
{
float SpeedX = speedX + (float)Main.rand.Next(-50, 51) * 0.05f;
+1 -1
View File
@@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic
public override void SetDefaults()
{
item.damage = 122;
item.damage = 170;
item.magic = true;
item.mana = 20;
item.width = 36;
+1 -1
View File
@@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Magic
item.mana = 24;
item.width = 38;
item.height = 34;
item.damage = 125;
item.damage = 128;
item.noMelee = true;
item.useAnimation = 18;
item.useStyle = ItemUseStyleID.HoldingOut;
+1 -1
View File
@@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic
public override void SetDefaults()
{
item.damage = 150;
item.damage = 142;
item.magic = true;
item.mana = 10;
item.width = 20;
+2 -2
View File
@@ -90,11 +90,11 @@ namespace CalamityMod.Items.Weapons.Melee
{
if (player.altFunctionUse == 2)
{
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType<PrismaticWave>(), (int)(damage * 1), knockBack, player.whoAmI, 0f, 0f);
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType<PrismaticWave>(), damage, knockBack, player.whoAmI);
}
else
{
Projectile.NewProjectile(position.X, position.Y, speedX * 0.5f, speedY * 0.5f, type, damage, knockBack, player.whoAmI, 0f, 0f);
Projectile.NewProjectile(position.X, position.Y, speedX * 0.5f, speedY * 0.5f, type, damage, knockBack, player.whoAmI);
}
return false;
}
+1 -1
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee
item.width = 42;
item.height = 40;
item.melee = true;
item.damage = 276;
item.damage = 255;
item.knockBack = 7.5f;
item.useTime = 20;
item.useAnimation = 20;
+1 -1
View File
@@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override void SetDefaults()
{
item.damage = 80;
item.damage = 120;
item.ranged = true;
item.width = 60;
item.height = 90;
+1 -1
View File
@@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged
item.rare = ItemRarityID.Yellow;
item.UseSound = SoundID.Item38;
item.autoReuse = true;
item.shootSpeed = 13f;
item.shootSpeed = 12f;
item.shoot = ProjectileID.PurificationPowder;
item.useAmmo = AmmoID.Bullet;
}
+1 -1
View File
@@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override void SetDefaults()
{
item.damage = 130;
item.damage = 145;
item.knockBack = 15f;
item.shootSpeed = 16f;
item.useStyle = ItemUseStyleID.HoldingOut;
+4 -3
View File
@@ -78,6 +78,7 @@ namespace CalamityMod.Items.Weapons.Ranged
return false;
Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true);
int extraBulletDamage = (int)(damage * 0.7);
for (int j = 0; j < targetArrayIndex; j++)
{
@@ -87,7 +88,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Vector2 velocity2 = Vector2.Normalize(Main.npc[targets[j]].Center - vector2) * item.shootSpeed;
int proj = Projectile.NewProjectile(vector2, velocity2, type, damage, knockBack, player.whoAmI);
int proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI);
Main.projectile[proj].extraUpdates += 2;
Main.projectile[proj].tileCollide = false;
Main.projectile[proj].timeLeft /= 2;
@@ -96,7 +97,7 @@ namespace CalamityMod.Items.Weapons.Ranged
if (targetArrayIndex == 12)
return false;
// Fire bullets at the same targets if
// Fire bullets at the same targets if 12 unique targets aren't found
for (int k = 0; k < maxTargets - targetArrayIndex; k++)
{
int randomTarget = Main.rand.Next(targetArrayIndex);
@@ -107,7 +108,7 @@ namespace CalamityMod.Items.Weapons.Ranged
Vector2 velocity2 = Vector2.Normalize(Main.npc[targets[randomTarget]].Center - vector2) * item.shootSpeed;
int proj = Projectile.NewProjectile(vector2, velocity2, type, damage, knockBack, player.whoAmI);
int proj = Projectile.NewProjectile(vector2, velocity2, type, extraBulletDamage, knockBack, player.whoAmI);
Main.projectile[proj].extraUpdates += 2;
Main.projectile[proj].tileCollide = false;
Main.projectile[proj].timeLeft /= 2;
+1 -1
View File
@@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue
public override void SafeSetDefaults()
{
item.damage = 487;
item.damage = 512;
item.knockBack = 3.5f;
item.useAnimation = item.useTime = 21;
item.autoReuse = true;
+1 -1
View File
@@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue
public override void SafeSetDefaults()
{
item.width = 64;
item.damage = 168;
item.damage = 181;
item.noMelee = true;
item.noUseGraphic = true;
item.useTime = 3;
+1 -1
View File
@@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Rogue
{
public class GodsParanoia : RogueWeapon
{
private static int damage = 66;
private static int damage = 70;
private static int knockBack = 5;
public override void SetStaticDefaults()
+1 -1
View File
@@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue
item.value = Item.buyPrice(1, 80, 0, 0);
item.rare = ItemRarityID.Red;
item.damage = 176;
item.damage = 216;
item.useAnimation = 21;
item.useTime = 3;
item.reuseDelay = 1;
+1 -1
View File
@@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue
item.value = Item.buyPrice(1, 80, 0, 0);
item.rare = ItemRarityID.Red;
item.damage = 806;
item.damage = 1008;
item.useAnimation = 40;
item.useTime = 40;
item.knockBack = 8f;
+1 -1
View File
@@ -19,7 +19,7 @@ Stealth strikes continuously leave spectral clones in their wake");
public override void SafeSetDefaults()
{
item.damage = 1060;
item.damage = 955;
item.knockBack = 8f;
item.width = 102;
@@ -88,5 +88,98 @@ namespace CalamityMod.Items.Weapons.Summon
// Otherwise create one.
return true;
}
// Moved from CalamityGlobalItem since it's just a function called in one place.
internal static bool TransformItemUsage(Item item, Player player)
{
if (player.whoAmI != Main.myPlayer)
return false;
int robotIndex = -1;
for (int i = 0; i < Main.projectile.Length; i++)
{
if (Main.projectile[i].active &&
Main.projectile[i].type == ModContent.ProjectileType<GiantIbanRobotOfDoom>() &&
Main.projectile[i].owner == player.whoAmI)
{
robotIndex = i;
break;
}
}
if (robotIndex != -1)
{
Projectile robot = Main.projectile[robotIndex];
GiantIbanRobotOfDoom robotModProjectile = ((GiantIbanRobotOfDoom)robot.modProjectile);
if (player.ownedProjectileCounts[ModContent.ProjectileType<AndromedaRegislash>()] <= 0 &&
robotModProjectile.TopIconActive &&
(robotModProjectile.RightIconCooldown <= GiantIbanRobotOfDoom.RightIconAttackTime ||
!robotModProjectile.RightIconActive)) // "Melee" attack
{
int damage = player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot ? GiantIbanRobotOfDoom.RegicideBaseDamageSmall : GiantIbanRobotOfDoom.RegicideBaseDamageLarge;
if (item.Calamity().rogue)
{
damage = (int)(damage * player.RogueDamage());
}
if (item.melee)
{
damage = (int)(damage * player.MeleeDamage());
}
if (item.ranged)
{
damage = (int)(damage * player.RangedDamage());
}
if (item.magic)
{
damage = (int)(damage * player.MagicDamage());
}
if (item.summon)
{
damage = (int)(damage * player.MinionDamage());
}
Projectile blade = Projectile.NewProjectileDirect(robot.Center + (robot.spriteDirection > 0).ToDirectionInt() * robot.width / 2 * Vector2.UnitX,
Vector2.Zero, ModContent.ProjectileType<AndromedaRegislash>(), damage, 15f, player.whoAmI, Projectile.GetByUUID(robot.owner, robot.whoAmI));
if (blade.whoAmI.WithinBounds(Main.maxProjectiles))
{
if (item.Calamity().rogue)
{
blade.Calamity().forceRogue = true;
}
if (item.melee)
{
blade.Calamity().forceMelee = true;
}
if (item.ranged)
{
blade.Calamity().forceRanged = true;
}
if (item.magic)
{
blade.Calamity().forceMagic = true;
}
if (item.summon)
{
blade.Calamity().forceMinion = true;
}
}
}
if (!robotModProjectile.TopIconActive &&
(robotModProjectile.LeftBracketActive || robotModProjectile.RightBracketActive) &&
!robotModProjectile.BottomBracketActive &&
robotModProjectile.LaserCooldown <= 0 &&
(robotModProjectile.RightIconCooldown <= GiantIbanRobotOfDoom.RightIconAttackTime ||
!robotModProjectile.RightIconActive)) // "Ranged" attack
{
robotModProjectile.LaserCooldown = AndromedaDeathRay.TrueTimeLeft * 2;
if (player.Calamity().andromedaState == AndromedaPlayerState.SmallRobot)
{
robotModProjectile.LaserCooldown = AndromedaDeathRay.TrueTimeLeft + 1;
}
}
}
return false;
}
}
}
+6 -3
View File
@@ -120,10 +120,13 @@ namespace CalamityMod.Localization
new [] { "RevengeText", "Revengeance is active." },
new [] { "RevengeText2", "Revengeance is not active." },
new [] { "DeathText", "Death is active, enjoy the fun." },
new [] { "DeathText2", "Death is not active, not fun enough for you?" },
new [] { "DeathText", "Death is active; enjoy the fun." },
new [] { "DeathText2", "Death is not active; not fun enough for you?" },
new [] { "ArmageddonText", "Bosses will now kill you instantly." },
new [] { "MaliceText", "Malice is active; witness the horror!" },
new [] { "MaliceText2", "Malice is not active." },
new [] { "ArmageddonText", "Bosses will now kill you instantly." },
new [] { "ArmageddonText2", "Bosses will no longer kill you instantly." },
new [] { "DefiledText", "Your soul is mine..." },
+5 -9
View File
@@ -225,9 +225,8 @@ namespace CalamityMod
/// </summary>
private static void BossChecklistSupport()
{
Mod bossChecklist = ModLoader.GetMod("BossChecklist");
Mod calamity = GetInstance<CalamityMod>();
CalamityMod calamity = GetInstance<CalamityMod>();
Mod bossChecklist = calamity.bossChecklist;
if (bossChecklist is null)
return;
@@ -798,13 +797,10 @@ namespace CalamityMod
private static void FargosSupport()
{
Mod fargos = ModLoader.GetMod("Fargowiltas");
Mod fargos = GetInstance<CalamityMod>().fargos;
if (fargos is null)
return;
// Mark Fargo's Mutant Mod as loaded so that Calamity doesn't add ANY boss summons to vanilla NPCs, even for its own bosses
GetInstance<CalamityMod>().fargosMutant = true;
void AddToMutantShop(string bossName, string summonItemName, Func<bool> downed, int price)
{
BossDifficulty.TryGetValue(bossName, out float order);
@@ -838,7 +834,7 @@ namespace CalamityMod
private static void CensusSupport()
{
Mod censusMod = ModLoader.GetMod("Census");
Mod censusMod = GetInstance<CalamityMod>().census;
if (censusMod != null)
{
censusMod.Call("TownNPCCondition", NPCType<SEAHOE>(), "Defeat a Giant Clam after defeating the Desert Scourge");
@@ -850,7 +846,7 @@ namespace CalamityMod
private static void SummonersAssociationSupport()
{
Mod sAssociation = ModLoader.GetMod("SummonersAssociation");
Mod sAssociation = GetInstance<CalamityMod>().summonersAssociation;
if (sAssociation is null)
return;
+6 -3
View File
@@ -33,8 +33,13 @@ namespace CalamityMod.NPCs.AcidRain
Player player = Main.player[Player.FindClosest(npc.Center, 1, 1)];
if (npc.velocity == Vector2.Zero)
npc.velocity = Vector2.UnitY * 12f;
float intertia = 24f;
npc.velocity = (npc.velocity * intertia - npc.DirectionTo(player.Center) * 12f) / (intertia + 1f);
// Attempt to flee from the nearest player.
npc.velocity = (npc.velocity * intertia - npc.SafeDirectionTo(player.Center) * 12f) / (intertia + 1f);
// But always dig downward.
npc.velocity.Y = Math.Abs(npc.velocity.Y);
npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2;
}
@@ -47,9 +52,7 @@ namespace CalamityMod.NPCs.AcidRain
npc.frameCounter = 0;
npc.frame.Y += frameHeight;
if (npc.frame.Y >= Main.npcFrameCount[npc.type] * frameHeight)
{
npc.frame.Y = 0;
}
}
}
+1 -1
View File
@@ -71,7 +71,7 @@ namespace CalamityMod.NPCs.AcidRain
if (GammaAcidShootTimer % 30f == 29f)
{
npc.velocity.Y -= MathHelper.Clamp(Math.Abs(Target.Center.Y - npc.Center.Y) / 16f, 5f, 15f);
npc.velocity.X = npc.DirectionTo(Target.Center).X * 16f;
npc.velocity.X = npc.SafeDirectionTo(Target.Center).X * 16f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
+2 -2
View File
@@ -172,7 +172,7 @@ namespace CalamityMod.NPCs.AcidRain
{
JumpTimer = 0f;
npc.velocity.Y -= MathHelper.Clamp(Math.Abs(Target.Center.Y - npc.Center.Y) / 12.5f, 8f, 18f);
npc.velocity.X = npc.DirectionTo(Target.Center).X * 18f;
npc.velocity.X = npc.SafeDirectionTo(Target.Center).X * 18f;
npc.netUpdate = true;
}
else
@@ -193,7 +193,7 @@ namespace CalamityMod.NPCs.AcidRain
// Otherwise walk towards the target if they're not super close.
else if (Math.Abs(Target.Center.X - npc.Center.X) > 125f)
{
npc.velocity.X += Math.Sign(npc.DirectionTo(Target.Center).X) * 3f;
npc.velocity.X += Math.Sign(npc.SafeDirectionTo(Target.Center).X) * 3f;
npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -28f, 28f);
}
+1 -1
View File
@@ -87,7 +87,7 @@ namespace CalamityMod.NPCs.AcidRain
// If close, simply resume current movement.
if (!npc.WithinRange(player.Center, 150f))
{
npc.velocity = (npc.velocity * 17f + npc.DirectionTo(player.Center) * maxSpeed) / 18f;
npc.velocity = (npc.velocity * 17f + npc.SafeDirectionTo(player.Center, -Vector2.UnitY) * maxSpeed) / 18f;
if (FallDelay != 12f)
{
FallDelay = 12f;
+2 -2
View File
@@ -104,7 +104,7 @@ namespace CalamityMod.NPCs.AcidRain
chargeSpeed = 14f;
if (CalamityWorld.downedPolterghast)
chargeSpeed = 18f;
npc.velocity = npc.DirectionTo(Target.Center) * chargeSpeed;
npc.velocity = npc.SafeDirectionTo(Target.Center, Vector2.UnitY) * chargeSpeed;
}
}
else
@@ -112,7 +112,7 @@ namespace CalamityMod.NPCs.AcidRain
if (Math.Abs(Target.Center.X - npc.Center.X) > 320f)
npc.velocity.X = MathHelper.Lerp(npc.velocity.X, (Target.Center.X - npc.Center.X > 0).ToDirectionInt() * 10f, 0.05f);
if (Math.Abs(Target.Center.Y - npc.Center.Y) > 50f)
npc.velocity.Y = npc.DirectionTo(Target.Center).Y * 9f;
npc.velocity.Y = npc.SafeDirectionTo(Target.Center).Y * 9f;
}
}
+1 -1
View File
@@ -142,7 +142,7 @@ namespace CalamityMod.NPCs.AcidRain
// Fly more sharply if close to the target.
if (npc.WithinRange(Target.Center, 200f))
flyInertia *= 0.667f;
npc.velocity = (npc.velocity * flyInertia + npc.DirectionTo(Target.Center) * flySpeed) / (flyInertia + 1f);
npc.velocity = (npc.velocity * flyInertia + npc.SafeDirectionTo(Target.Center, Vector2.UnitY) * flySpeed) / (flyInertia + 1f);
npc.spriteDirection = (npc.velocity.X < 0).ToDirectionInt();
// Have the bubble pop and stop flying if within the circular hitbox area of the player.
+2 -2
View File
@@ -70,7 +70,7 @@ namespace CalamityMod.NPCs.AcidRain
npc.TargetClosest();
float lungeSpeed = CalamityWorld.downedPolterghast ? 18.5f : 15f;
npc.velocity = npc.DirectionTo(Target.Center) * lungeSpeed;
npc.velocity = npc.SafeDirectionTo(Target.Center, -Vector2.UnitY) * lungeSpeed;
npc.velocity.X *= 1.6f;
npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2;
npc.netUpdate = true;
@@ -97,7 +97,7 @@ namespace CalamityMod.NPCs.AcidRain
speedX = 22f;
speedY = 11f;
}
npc.velocity = npc.DirectionTo(Target.Center) * new Vector2(speedX, speedY);
npc.velocity = npc.SafeDirectionTo(Target.Center, -Vector2.UnitY) * new Vector2(speedX, speedY);
npc.netUpdate = true;
}
npc.velocity.Y *= 0.98f;
+4 -2
View File
@@ -120,7 +120,7 @@ namespace CalamityMod.NPCs.AcidRain
swimSpeed *= 1.6f;
swimIntertia = 17f;
}
npc.velocity = (npc.velocity * (swimIntertia - 1f) + npc.DirectionTo(Target.Center) * swimSpeed) / swimIntertia;
npc.velocity = (npc.velocity * (swimIntertia - 1f) + npc.SafeDirectionTo(Target.Center, -Vector2.UnitY) * swimSpeed) / swimIntertia;
}
// Rapidly slow down if the target is not in water.
@@ -157,9 +157,11 @@ namespace CalamityMod.NPCs.AcidRain
npc.netUpdate = true;
return;
}
Vector2 destination = (Target.gravDir == 1f ? Target.Top : Target.Bottom) + Target.direction * Vector2.UnitX * 4f;
float speed = MathHelper.Lerp(7f, 23f, Utils.InverseLerp(10f, ChaseMaxDistance, npc.Distance(destination), true));
npc.velocity = npc.DirectionTo(destination) * speed;
npc.velocity = npc.SafeDirectionTo(destination) * speed;
if (npc.WithinRange(destination, 45f))
{
Target.AddBuff(BuffID.Bleeding, 180, true);
+1 -2
View File
@@ -17,7 +17,6 @@ using Microsoft.Xna.Framework.Graphics;
using System.IO;
using Terraria;
using Terraria.ID;
using Terraria.Localization;
using Terraria.ModLoader;
using CalamityMod.Items.Armor.Vanity;
@@ -87,7 +86,7 @@ namespace CalamityMod.NPCs.AquaticScourge
{
if (npc.justHit || npc.life <= npc.lifeMax * 0.99 || BossRushEvent.BossRushActive)
{
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AquaticScourge");
else
+1 -1
View File
@@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.AstrumAureus
npc.value = Item.buyPrice(0, 15, 0, 0);
npc.boss = true;
npc.DeathSound = SoundID.NPCDeath14;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Astrageldon");
else
+1 -1
View File
@@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.AstrumDeus
npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstrumDeusDeath");
npc.netAlways = true;
npc.boss = true;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus");
else
+1 -1
View File
@@ -61,7 +61,7 @@ namespace CalamityMod.NPCs.AstrumDeus
npc.HitSound = SoundID.NPCHit4;
npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstrumDeusDeath");
npc.netAlways = true;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus");
else
+1 -1
View File
@@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.AstrumDeus
npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstrumDeusDeath");
npc.netAlways = true;
npc.boss = true;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/AstrumDeus");
else
@@ -59,7 +59,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental
npc.netAlways = true;
npc.HitSound = SoundID.NPCHit23;
npc.DeathSound = SoundID.NPCDeath39;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeftAlone");
else
+2 -2
View File
@@ -53,8 +53,8 @@ namespace CalamityMod.NPCs.Bumblebirb
npc.lifeMax += (int)(npc.lifeMax * HPBoost);
npc.knockBackResist = 0f;
npc.boss = true;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
if (calamityModMusic != null)
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Murderswarm");
else
music = MusicID.Boss4;
+1 -1
View File
@@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.Calamitas
npc.noTileCollide = true;
npc.HitSound = SoundID.NPCHit4;
npc.DeathSound = SoundID.NPCDeath14;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas");
else
+1 -1
View File
@@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.Calamitas
npc.noTileCollide = true;
npc.HitSound = SoundID.NPCHit4;
npc.DeathSound = SoundID.NPCDeath14;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas");
else
+1 -1
View File
@@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.Calamitas
npc.noTileCollide = true;
npc.HitSound = SoundID.NPCHit4;
npc.DeathSound = SoundID.NPCDeath14;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Calamitas");
else
+53 -23
View File
@@ -1666,7 +1666,7 @@ namespace CalamityMod.NPCs
if (provy)
chargeVelocity *= 1.25f;
Vector2 vector = Vector2.Normalize(player.Center + player.velocity * 10f - npc.Center);
Vector2 vector = Vector2.Normalize(player.Center - npc.Center);
npc.velocity = vector * chargeVelocity;
npc.ai[1] = 3f;
@@ -1676,7 +1676,7 @@ namespace CalamityMod.NPCs
{
npc.ai[2] += 1f;
float chargeTime = BossRushEvent.BossRushActive ? 56f : (70f - (death ? 6f * (1f - lifeRatio) : 0f));
float chargeTime = BossRushEvent.BossRushActive ? 45f : (56f - (death ? 6f * (1f - lifeRatio) : 0f));
if (npc.ai[2] >= chargeTime)
{
npc.velocity *= 0.93f;
@@ -1688,7 +1688,7 @@ namespace CalamityMod.NPCs
else
npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2;
if (npc.ai[2] >= chargeTime + 15f)
if (npc.ai[2] >= chargeTime + 12f)
{
npc.ai[3] += 1f;
npc.ai[2] = 0f;
@@ -1706,7 +1706,7 @@ namespace CalamityMod.NPCs
}
else
{
int num62 = 500;
int num62 = 400;
float num63 = (calamityGlobalNPC.enraged > 0) ? 20f : 14f;
float num64 = (calamityGlobalNPC.enraged > 0) ? 0.5f : 0.35f;
@@ -1767,7 +1767,7 @@ namespace CalamityMod.NPCs
}
npc.ai[2] += 1f;
if (npc.ai[2] >= 45f)
if (npc.ai[2] >= 36f)
{
npc.TargetClosest();
npc.ai[1] = 2f;
@@ -4585,7 +4585,7 @@ namespace CalamityMod.NPCs
if (npc.ai[1] == 0f)
{
Vector2 destination2 = player.Center + new Vector2(0f, -200f);
Vector2 desiredVelocity2 = npc.DirectionTo(destination2) * 18f;
Vector2 desiredVelocity2 = npc.SafeDirectionTo(destination2, -Vector2.UnitY) * 18f;
npc.SimpleFlyMovement(desiredVelocity2, 1.5f);
if (npc.velocity.X < 0f)
@@ -4902,7 +4902,47 @@ namespace CalamityMod.NPCs
}
// Rotation
float num17 = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X);
// Phase switch
float rateOfRotation = 0.04f;
if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f || npc.ai[0] == 14f)
rateOfRotation = 0f;
if (npc.ai[0] == 3f || npc.ai[0] == 4f)
rateOfRotation = 0.01f;
if (npc.ai[0] == 8f || npc.ai[0] == 13f)
rateOfRotation = 0.05f;
Vector2 playerCenter = player.Center;
if (calamityGlobalNPC.newAI[1] != 1f && !player.dead)
{
// Rotate to show direction of predictive charge
Vector2 distanceVector = player.Center + player.velocity * 20f - vector;
if (npc.ai[0] == 0f && !phase2)
{
if (npc.ai[3] < 6f)
{
rateOfRotation = 0.1f;
playerCenter += Vector2.Normalize(distanceVector) * chargeVelocity;
}
}
else if (npc.ai[0] == 5f && !phase3)
{
if (npc.ai[3] < 4f)
{
rateOfRotation = 0.1f;
playerCenter += Vector2.Normalize(distanceVector) * chargeVelocity;
}
}
else if (npc.ai[0] == 10f)
{
if (npc.ai[3] < 8f && npc.ai[3] != 1f && npc.ai[3] != 4f)
{
rateOfRotation = 0.1f;
playerCenter += Vector2.Normalize(distanceVector) * chargeVelocity;
}
}
}
float num17 = (float)Math.Atan2(playerCenter.Y - vector.Y, playerCenter.X - vector.X);
if (npc.spriteDirection == 1)
num17 += pie;
if (num17 < 0f)
@@ -4912,42 +4952,32 @@ namespace CalamityMod.NPCs
if (npc.ai[0] == -1f || npc.ai[0] == 3f || npc.ai[0] == 4f)
num17 = 0f;
if (npc.ai[0] == 8f || npc.ai[0] == 13f)
{
num17 = pie * 0.1666666667f * npc.spriteDirection;
}
float num18 = 0.04f;
if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f || npc.ai[0] == 14f)
num18 = 0f;
if (npc.ai[0] == 3f || npc.ai[0] == 4f)
num18 = 0.01f;
if (npc.ai[0] == 8f || npc.ai[0] == 13f)
num18 = 0.05f;
if (npc.rotation < num17)
{
if (num17 - npc.rotation > pie)
npc.rotation -= num18;
npc.rotation -= rateOfRotation;
else
npc.rotation += num18;
npc.rotation += rateOfRotation;
}
if (npc.rotation > num17)
{
if (npc.rotation - num17 > pie)
npc.rotation += num18;
npc.rotation += rateOfRotation;
else
npc.rotation -= num18;
npc.rotation -= rateOfRotation;
}
if ((npc.ai[0] != 8f && npc.ai[0] != 13f) || npc.spriteDirection == 1)
{
if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18)
if (npc.rotation > num17 - rateOfRotation && npc.rotation < num17 + rateOfRotation)
npc.rotation = num17;
if (npc.rotation < 0f)
npc.rotation += MathHelper.TwoPi;
if (npc.rotation > MathHelper.TwoPi)
npc.rotation -= MathHelper.TwoPi;
if (npc.rotation > num17 - num18 && npc.rotation < num17 + num18)
if (npc.rotation > num17 - rateOfRotation && npc.rotation < num17 + rateOfRotation)
npc.rotation = num17;
}
+50 -53
View File
@@ -16066,9 +16066,10 @@ namespace CalamityMod.NPCs
// If there's nothing in the way of the player, swim towards them
if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1))
{
npc.velocity = (npc.velocity * 19f + npc.DirectionTo(Main.player[npc.target].Center) * 10f) / 20f;
npc.velocity = (npc.velocity * 19f + npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 10f) / 20f;
return false;
}
float velocityMultiplier = 10f;
if (npc.velocity.Y > 0f)
{
@@ -16503,7 +16504,7 @@ namespace CalamityMod.NPCs
for (int j = 0; j < 2; j++)
{
// Randomize and normalize. You know the drill
Vector2 dustVelocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi);
Vector2 dustVelocity = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi);
dustVelocity *= (float)Main.rand.Next(0, 100) * 0.1f;
dustVelocity.Normalize();
dustVelocity *= (float)Main.rand.Next(50, 90) * 0.1f;
@@ -16589,11 +16590,8 @@ namespace CalamityMod.NPCs
{
npc.ai[2] -= 1f;
npc.TargetClosest(true);
Vector2 vectorToPlayer = npc.DirectionTo(Main.player[npc.target].Top + new Vector2(0f, -30f));
if (vectorToPlayer.HasNaNs())
{
vectorToPlayer = Vector2.Normalize(new Vector2((float)npc.spriteDirection, -1f));
}
Vector2 vectorToPlayer = npc.SafeDirectionTo(Main.player[npc.target].Top - Vector2.UnitY * 30f, Vector2.Normalize(new Vector2(npc.spriteDirection, -1f)));
npc.velocity = vectorToPlayer * velocityMultiplier;
npc.netUpdate = true;
return false;
@@ -16972,14 +16970,13 @@ namespace CalamityMod.NPCs
}
Vector2 velocityDelta = -Vector2.One;
for (int j = 0; j < i; j++)
{
velocityDelta += npc.DirectionTo(Main.npc[players[j]].Center);
}
velocityDelta += npc.SafeDirectionTo(Main.npc[players[j]].Center);
velocityDelta.Normalize();
for (int j = 0; j < nailCount; j++)
{
float velocityMultiplier = (float)Main.rand.Next(8, 13);
Vector2 nailVelocity = Vector2.One.RotatedByRandom(Math.PI * 2.0);
float velocityMultiplier = Main.rand.Next(8, 13);
Vector2 nailVelocity = Vector2.UnitY.RotatedByRandom(Math.PI * 2.0);
if (i > 0)
{
nailVelocity += velocityDelta;
@@ -16989,9 +16986,10 @@ namespace CalamityMod.NPCs
if (i > 0)
{
i--;
nailVelocity = npc.DirectionTo(Main.npc[players[i]].Center) * velocityMultiplier;
nailVelocity = npc.SafeDirectionTo(Main.npc[players[i]].Center, -Vector2.UnitY) * velocityMultiplier;
}
Projectile.NewProjectile(npc.Center + Vector2.UnitY * (float)(npc.width / 4), nailVelocity, ProjectileID.Nail, (int)(npc.damage * 0.15), 1f, 255, 0f, 0f);
Projectile.NewProjectile(npc.Center + Vector2.UnitY * (npc.width / 4), nailVelocity, ProjectileID.Nail, (int)(npc.damage * 0.15), 1f, 255, 0f, 0f);
}
}
}
@@ -17854,21 +17852,19 @@ namespace CalamityMod.NPCs
}
if (Main.netMode != NetmodeID.MultiplayerClient)
{
npc.localAI[2] += 1f;
if (npc.localAI[2] >= (float)(240 + Main.rand.Next(240)) && npc.Distance(Main.player[npc.target].Center) < 600f && Math.Abs(npc.DirectionTo(Main.player[npc.target].Center).Y) < 0.5f && Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0))
npc.localAI[2]++;
bool closeToPlayer = npc.Distance(Main.player[npc.target].Center) < 600f && Math.Abs(npc.SafeDirectionTo(Main.player[npc.target].Center).Y) < 0.5f;
if (npc.localAI[2] >= Main.rand.Next(240, 480) && closeToPlayer && Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0))
{
npc.localAI[2] = 0f;
Vector2 spawnPos = npc.Center + new Vector2((float)(npc.direction * 30), 2f);
Vector2 velocity = npc.DirectionTo(Main.player[npc.target].Center) * 9f;
if (velocity.HasNaNs())
{
velocity = new Vector2((float)(npc.direction * 10), 0f);
}
Vector2 spawnPosition = npc.Center + new Vector2(npc.direction * 30f, 2f);
Vector2 baseLaserVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center, Vector2.UnitX * npc.direction) * 9f;
int damage = Main.expertMode ? 50 : 75;
for (int i = 0; i < 4; i++)
{
Vector2 vector17 = velocity + Utils.RandomVector2(Main.rand, -0.8f, 0.8f);
Projectile.NewProjectile(spawnPos, vector17, ProjectileID.VortexLaser, damage, 1f, Main.myPlayer, 0f, 0f);
Vector2 randomizedVelocity = baseLaserVelocity + Utils.RandomVector2(Main.rand, -0.8f, 0.8f);
Projectile.NewProjectile(spawnPosition, randomizedVelocity, ProjectileID.VortexLaser, damage, 1f, Main.myPlayer, 0f, 0f);
}
}
}
@@ -18046,7 +18042,7 @@ namespace CalamityMod.NPCs
229
});
Dust dust = Main.dust[Dust.NewDust(npc.Center + new Vector2((float)((npc.spriteDirection == 1) ? 8 : -20), -20f), 8, 8, dustType, npc.velocity.X, npc.velocity.Y, 100, default, 1f)];
dust.velocity = dust.velocity / 4f + npc.DirectionTo(Main.player[npc.target].Top);
dust.velocity = dust.velocity / 4f + npc.SafeDirectionTo(Main.player[npc.target].Top);
dust.scale = 1.2f;
dust.noLight = true;
}
@@ -18112,7 +18108,7 @@ namespace CalamityMod.NPCs
if (npc.localAI[0] > (float)Main.rand.Next(120, 240))
{
npc.localAI[0] = 0f;
Projectile.NewProjectile(npc.Center, npc.DirectionTo(Main.player[npc.target].Center) * 10f, ProjectileID.WebSpit, 18, 0f, Main.myPlayer, 0f, 0f);
Projectile.NewProjectile(npc.Center, npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 10f, ProjectileID.WebSpit, 18, 0f, Main.myPlayer, 0f, 0f);
}
}
if (npcType == NPCID.IceGolem)
@@ -18133,7 +18129,7 @@ namespace CalamityMod.NPCs
if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] >= 90f && npc.velocity.Y == 0f && !Main.player[npc.target].dead && !Main.player[npc.target].frozen && ((npc.direction > 0 && npc.Center.X < Main.player[npc.target].Center.X) || (npc.direction < 0 && npc.Center.X > Main.player[npc.target].Center.X)) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
{
npc.netUpdate = true;
Vector2 velocity = npc.DirectionTo(Main.player[npc.target].Center) * 15;
Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 15;
Projectile.NewProjectile(npc.Center - Vector2.UnitY * 28 + velocity * 2f, velocity, ProjectileID.FrostBeam, 32, 0f, Main.myPlayer, 0f, 0f);
npc.ai[2] = 0f;
}
@@ -21150,11 +21146,12 @@ namespace CalamityMod.NPCs
{
if (!Collision.SolidCollision(npc.position, npc.width, npc.height) && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
{
float speed = 12f;
int damage = 17;
int type = ProjectileID.CursedFlameHostile;
int idx = Projectile.NewProjectile(npc.Center, npc.DirectionTo(Main.player[npc.target].Center) * speed, type, damage, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[idx].timeLeft = 180;
Vector2 flameVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * 12f;
int flame = Projectile.NewProjectile(npc.Center, flameVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[flame].timeLeft = 180;
npc.localAI[0] = 0f;
}
else
@@ -21177,7 +21174,8 @@ namespace CalamityMod.NPCs
{
absoluteYDistance = 0f;
}
Vector2 velocity = npc.DirectionTo(Main.player[npc.target].Center - npc.Center - Vector2.UnitY * absoluteYDistance) * speed;
Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center - npc.Center - Vector2.UnitY * absoluteYDistance, -Vector2.UnitY) * speed;
int idx = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.FungiSpore, 0, 0f, 0f, 0f, 0f, 255);
Main.npc[idx].velocity = velocity;
@@ -21424,11 +21422,12 @@ namespace CalamityMod.NPCs
{
if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
{
float speed = 6f;
int damage = 15;
int type = ProjectileID.HarpyFeather;
int idx = Projectile.NewProjectile(npc.Center, npc.DirectionTo(Main.player[npc.target].Center) * speed, type, damage, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[idx].timeLeft = 300;
Vector2 featherVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * 6f;
int feather = Projectile.NewProjectile(npc.Center, featherVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[feather].timeLeft = 300;
}
}
else if (npc.ai[0] >= 400f + Main.rand.Next(200))
@@ -21443,11 +21442,12 @@ namespace CalamityMod.NPCs
{
if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
{
float speed = 0.2f;
int damage = 21;
int type = ProjectileID.DemonSickle;
int idx = Projectile.NewProjectile(npc.Center, npc.DirectionTo(Main.player[npc.target].Center) * speed, type, damage, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[idx].timeLeft = 300;
Vector2 sickleVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * 0.2f;
int sickle = Projectile.NewProjectile(npc.Center, sickleVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f);
Main.projectile[sickle].timeLeft = 300;
}
}
else if (npc.ai[0] >= 300f + Main.rand.Next(200))
@@ -21462,16 +21462,16 @@ namespace CalamityMod.NPCs
{
if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
{
float speed = 0.2f;
Vector2 spawnPosition = npc.Center;
Vector2 velocity = npc.DirectionTo(Main.player[npc.target].Center) * speed;
float tridentSpeed = 0.2f;
Vector2 tridentVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * tridentSpeed;
spawnPosition += npc.velocity * 5f;
int damage = 80;
int type = ProjectileID.UnholyTridentHostile;
spawnPosition += npc.velocity * 5f;
int idx = Projectile.NewProjectile(spawnPosition + velocity * 100f, velocity, type, damage, 3f, Main.myPlayer, 0f, 0f);
Main.projectile[idx].timeLeft = 300;
int trident = Projectile.NewProjectile(spawnPosition + tridentVelocity * 100f, tridentVelocity, type, damage, 3f, Main.myPlayer, 0f, 0f);
Main.projectile[trident].timeLeft = 300;
}
}
else if (npc.ai[0] >= 250f + Main.rand.Next(200))
@@ -21882,12 +21882,9 @@ namespace CalamityMod.NPCs
npc.localAI[0] = 1f;
}
npc.TargetClosest(true);
float speed = 14f;
if (npc.type == NPCID.GreenJellyfish)
{
speed = 18f;
}
npc.velocity = npc.DirectionTo(Main.player[npc.target].Center) * speed;
float lungeSpeed = npc.type == NPCID.GreenJellyfish ? 18f : 14f;
npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * lungeSpeed;
}
}
// General floating around.
@@ -22821,9 +22818,10 @@ namespace CalamityMod.NPCs
// Charge
if (npc.ai[0] == 0f)
{
float speed = 12f;
npc.velocity = npc.DirectionTo(Main.player[npc.target].Center) * speed;
float chargeSpeed = 12f;
npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center, -Vector2.UnitY) * chargeSpeed;
npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver4;
// Slow down
npc.ai[0] = 1f;
npc.ai[1] = 0f;
@@ -24721,12 +24719,11 @@ namespace CalamityMod.NPCs
float speed = 6f;
float acceleration = 0.25f;
Vector2 idealVelocity = npc.DirectionTo(Main.player[npc.target].Center - 300f * Vector2.UnitY) * speed;
Vector2 idealVelocity = npc.SafeDirectionTo(Main.player[npc.target].Center - 300f * Vector2.UnitY) * speed;
float playerDistance = npc.Distance(Main.player[npc.target].Center);
if (playerDistance < 20f)
{
idealVelocity = npc.velocity;
}
// Yes, I understand that npc.SimpleFlyMovement exists. However, the "acceleration * 2f" is not a part of that method.
// It is not identical to what is being achieved here.
if (npc.velocity.X < idealVelocity.X)
+59 -69
View File
@@ -1445,22 +1445,25 @@ namespace CalamityMod.NPCs
}
// Reduce mech boss HP and damage depending on the new ore progression changes
if (!NPC.downedMechBossAny)
if (CalamityConfig.Instance.EarlyHardmodeProgressionRework)
{
if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer)
if (!NPC.downedMechBossAny)
{
npc.lifeMax = (int)(npc.lifeMax * 0.8);
npc.damage = (int)(npc.damage * 0.8);
npc.defDamage = npc.damage;
if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer)
{
npc.lifeMax = (int)(npc.lifeMax * 0.8);
npc.damage = (int)(npc.damage * 0.8);
npc.defDamage = npc.damage;
}
}
}
else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1))
{
if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer)
else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1))
{
npc.lifeMax = (int)(npc.lifeMax * 0.9);
npc.damage = (int)(npc.damage * 0.9);
npc.defDamage = npc.damage;
if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer)
{
npc.lifeMax = (int)(npc.lifeMax * 0.9);
npc.damage = (int)(npc.damage * 0.9);
npc.defDamage = npc.damage;
}
}
}
@@ -3161,12 +3164,11 @@ namespace CalamityMod.NPCs
private void PillarEventProgressionEdit(NPC npc)
{
// Make pillars a bit more fun by forcing more difficult enemies based on progression.
int solarTowerShieldStrength = NPC.ShieldStrengthTowerSolar / 25;
int solarTowerShieldStrength = (int)Math.Ceiling(NPC.ShieldStrengthTowerSolar / 25D);
switch (solarTowerShieldStrength)
{
case 4:
case 3:
// Possible spawns: Corite, Drakanian, Drakomire, Drakomire Rider
// Possible spawns: Drakanian, Drakomire, Drakomire Rider
switch (npc.type)
{
case NPCID.SolarCrawltipedeHead:
@@ -3174,22 +3176,33 @@ namespace CalamityMod.NPCs
case NPCID.SolarCrawltipedeTail:
case NPCID.SolarSolenian:
case NPCID.SolarSroller:
case NPCID.SolarCorite:
npc.active = false;
npc.netUpdate = true;
break;
default:
break;
}
break;
case 3:
// Possible spawns: Drakomire, Drakomire Rider, Sroller
switch (npc.type)
{
case NPCID.SolarCrawltipedeHead:
case NPCID.SolarCrawltipedeBody:
case NPCID.SolarCrawltipedeTail:
case NPCID.SolarSpearman:
case NPCID.SolarSolenian:
case NPCID.SolarCorite:
if (NPC.CountNPCS(NPCID.SolarCorite) > 2)
{
npc.active = false;
npc.netUpdate = true;
}
npc.active = false;
npc.netUpdate = true;
break;
default:
break;
}
break;
case 2:
// Possible spawns: Corite, Drakomire Rider, Sroller
// Possible spawns: Drakomire Rider, Selenian, Sroller
switch (npc.type)
{
case NPCID.SolarDrakomire:
@@ -3197,17 +3210,10 @@ namespace CalamityMod.NPCs
case NPCID.SolarCrawltipedeBody:
case NPCID.SolarCrawltipedeTail:
case NPCID.SolarSpearman:
case NPCID.SolarSolenian:
case NPCID.SolarCorite:
npc.active = false;
npc.netUpdate = true;
break;
case NPCID.SolarCorite:
if (NPC.CountNPCS(NPCID.SolarCorite) > 3)
{
npc.active = false;
npc.netUpdate = true;
}
break;
default:
break;
}
@@ -3225,19 +3231,12 @@ namespace CalamityMod.NPCs
npc.active = false;
npc.netUpdate = true;
break;
case NPCID.SolarCorite:
if (NPC.CountNPCS(NPCID.SolarCorite) > 4)
{
npc.active = false;
npc.netUpdate = true;
}
break;
default:
break;
}
break;
case 0:
// Possible spawns: Corite, Selenian, Crawltipede
// Possible spawns: Corite, Crawltipede, Selenian
switch (npc.type)
{
case NPCID.SolarDrakomire:
@@ -3247,24 +3246,16 @@ namespace CalamityMod.NPCs
npc.active = false;
npc.netUpdate = true;
break;
case NPCID.SolarCorite:
if (NPC.CountNPCS(NPCID.SolarCorite) > 5)
{
npc.active = false;
npc.netUpdate = true;
}
break;
default:
break;
}
break;
}
int vortexTowerShieldStrength = NPC.ShieldStrengthTowerVortex / 25;
int vortexTowerShieldStrength = (int)Math.Ceiling(NPC.ShieldStrengthTowerVortex / 25D);
switch (vortexTowerShieldStrength)
{
case 4:
case 3:
// Possible spawns: Alien Larva, Alien Hornet, Alien Queen
switch (npc.type)
{
@@ -3277,7 +3268,7 @@ namespace CalamityMod.NPCs
break;
}
break;
case 2:
case 3:
// Possible spawns: Alien Larva, Alien Hornet, Alien Queen, Vortexian
if (npc.type == NPCID.VortexRifleman)
{
@@ -3285,7 +3276,7 @@ namespace CalamityMod.NPCs
npc.netUpdate = true;
}
break;
case 1:
case 2:
// Possible spawns: Alien Larva, Alien Hornet, Alien Queen, Storm Diver
if (npc.type == NPCID.VortexSoldier)
{
@@ -3293,16 +3284,16 @@ namespace CalamityMod.NPCs
npc.netUpdate = true;
}
break;
case 1:
case 0:
// Possible spawns: Alien Larva, Alien Hornet, Alien Queen, Vortexian, Storm Diver
break;
}
int nebulaTowerShieldStrength = NPC.ShieldStrengthTowerNebula / 25;
int nebulaTowerShieldStrength = (int)Math.Ceiling(NPC.ShieldStrengthTowerNebula / 25D);
switch (nebulaTowerShieldStrength)
{
case 4:
case 3:
// Possible spawns: Brain Suckler
switch (npc.type)
{
@@ -3316,7 +3307,7 @@ namespace CalamityMod.NPCs
break;
}
break;
case 2:
case 3:
// Possible spawns: Brain Suckler, Predictor
switch (npc.type)
{
@@ -3329,7 +3320,7 @@ namespace CalamityMod.NPCs
break;
}
break;
case 1:
case 2:
// Possible spawns: Brain Suckler, Predictor, Evolution Beast
if (npc.type == NPCID.NebulaBrain)
{
@@ -3337,6 +3328,7 @@ namespace CalamityMod.NPCs
npc.netUpdate = true;
}
break;
case 1:
case 0:
// Possible spawns: Predictor, Evolution Beast, Nebula Floater
if (npc.type == NPCID.NebulaHeadcrab)
@@ -3347,11 +3339,10 @@ namespace CalamityMod.NPCs
break;
}
int stardustTowerShieldStrength = NPC.ShieldStrengthTowerStardust / 25;
int stardustTowerShieldStrength = (int)Math.Ceiling(NPC.ShieldStrengthTowerStardust / 25D);
switch (stardustTowerShieldStrength)
{
case 4:
case 3:
// Possible spawns: Milkyway Weaver, Star Cell
switch (npc.type)
{
@@ -3365,7 +3356,7 @@ namespace CalamityMod.NPCs
break;
}
break;
case 2:
case 3:
// Possible spawns: Milkyway Weaver, Stargazer, Twinkle Popper
switch (npc.type)
{
@@ -3378,7 +3369,7 @@ namespace CalamityMod.NPCs
break;
}
break;
case 1:
case 2:
// Possible spawns: Stargazer, Twinkle Popper, Flow Invader
switch (npc.type)
{
@@ -3393,6 +3384,7 @@ namespace CalamityMod.NPCs
break;
}
break;
case 1:
case 0:
// Possible spawns: Twinkle Popper, Flow Invader
switch (npc.type)
@@ -3934,9 +3926,7 @@ namespace CalamityMod.NPCs
npc2.ai[0] = -1000 * Main.rand.Next(3);
if (Main.netMode == NetmodeID.Server && slime < Main.maxNPCs)
{
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slime, 0f, 0f, 0f, 0, 0, 0);
}
}
}
}
@@ -3951,9 +3941,7 @@ namespace CalamityMod.NPCs
case NPCID.EnchantedSword:
case NPCID.CrimsonAxe:
if (npc.life <= npc.lifeMax * 0.5)
{
npc.justHit = false;
}
break;
@@ -3964,25 +3952,19 @@ namespace CalamityMod.NPCs
case NPCID.BlackRecluse:
case NPCID.BlackRecluseWall:
if (npc.life <= npc.lifeMax * 0.25)
{
npc.justHit = false;
}
break;
case NPCID.Paladin:
if (npc.life <= npc.lifeMax * 0.15)
{
npc.justHit = false;
}
break;
case NPCID.Clown:
if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[npc.target].dead)
{
npc.ai[2] += 29f;
}
break;
}
@@ -3990,9 +3972,7 @@ namespace CalamityMod.NPCs
if (npc.type == NPCType<SandTortoise>() || npc.type == NPCType<PlaguedTortoise>())
{
if (npc.life <= npc.lifeMax * 0.25)
{
npc.justHit = false;
}
}
}
}
@@ -4066,6 +4046,16 @@ namespace CalamityMod.NPCs
maxSpawns = (int)(maxSpawns * 10f);
}
if (NPC.LunarApocalypseIsUp)
{
if ((player.ZoneTowerNebula && NPC.ShieldStrengthTowerNebula == 0) || (player.ZoneTowerStardust && NPC.ShieldStrengthTowerStardust == 0) ||
(player.ZoneTowerVortex && NPC.ShieldStrengthTowerVortex == 0) || (player.ZoneTowerSolar && NPC.ShieldStrengthTowerSolar == 0))
{
spawnRate = (int)(spawnRate * 0.85);
maxSpawns = (int)(maxSpawns * 1.25f);
}
}
if (CalamityWorld.revenge)
spawnRate = (int)(spawnRate * 0.85);
@@ -5174,7 +5164,7 @@ namespace CalamityMod.NPCs
return CalamityWorld.downedSCal;
}
return false;
return true;
}
#endregion
+69 -69
View File
@@ -51,13 +51,13 @@ namespace CalamityMod.NPCs
return false;
// Servants of Cthulhu and Probes do not provide free hearts in Rev+.
if (CalamityWorld.revenge && (npc.type == NPCID.ServantofCthulhu || npc.type == NPCID.Probe))
if (CalamityWorld.revenge && (npc.type == NPCID.ServantofCthulhu || npc.type == NPCID.Probe))
NPCLoader.blockLoot.Add(ItemID.Heart);
//
// Ozzatron 17FEB2021: A NOTE about PreNPCLoot vs NPCLoot
// PreNPCLoot runs before the boss is marked as dead. This means it is required for lore items and Resident Evil ammo.
// Because we already have clauses here for every boss, it is more convenient to drop everything here than it is
// Because we already have clauses here for every boss, it is more convenient to drop everything here than it is.
// to iterate through all the bosses twice.
//
@@ -73,19 +73,18 @@ namespace CalamityMod.NPCs
// Determine whether this NPC is the second Twin killed in a fight, regardless of which Twin it is.
bool lastTwinStanding = false;
if (npc.type == NPCID.Retinazer)
{
lastTwinStanding = !NPC.AnyNPCs(NPCID.Spazmatism);
}
else if (npc.type == NPCID.Spazmatism)
{
lastTwinStanding = !NPC.AnyNPCs(NPCID.Retinazer);
}
// Mechanical Bosses' combined lore item
bool mechLore = !NPC.downedMechBossAny && (lastTwinStanding || npc.type == NPCID.TheDestroyer || npc.type == NPCID.SkeletronPrime);
DropHelper.DropItemCondition(npc, ModContent.ItemType<KnowledgeMechs>(), true, mechLore);
if (npc.type == NPCID.KingSlime)
if (CalamityWorld.armageddon)
ArmageddonLoot(npc);
if (npc.type == NPCID.KingSlime)
{
// Drop a huge spray of Gel items
int minGel = Main.expertMode ? 90 : 60;
@@ -207,23 +206,27 @@ namespace CalamityMod.NPCs
if (!Main.hardMode)
{
// Increase altar count to allow natural mech boss spawning.
WorldGen.altarCount++;
if (CalamityConfig.Instance.EarlyHardmodeProgressionRework)
WorldGen.altarCount++;
string key2 = "Mods.CalamityMod.UglyBossText";
Color messageColor2 = Color.Aquamarine;
CalamityUtils.DisplayLocalizedText(key2, messageColor2);
string key3 = "Mods.CalamityMod.HardmodeOreTier1Text";
Color messageColor3 = new Color(50, 255, 130);
WorldGenerationMethods.SpawnOre(TileID.Cobalt, 12E-05, .4f, .6f);
WorldGenerationMethods.SpawnOre(TileID.Palladium, 12E-05, .4f, .6f);
CalamityUtils.DisplayLocalizedText(key3, messageColor3);
if (CalamityConfig.Instance.EarlyHardmodeProgressionRework)
{
string key3 = "Mods.CalamityMod.HardmodeOreTier1Text";
Color messageColor3 = new Color(50, 255, 130);
WorldGenerationMethods.SpawnOre(TileID.Cobalt, 12E-05, .4f, .6f);
WorldGenerationMethods.SpawnOre(TileID.Palladium, 12E-05, .4f, .6f);
CalamityUtils.DisplayLocalizedText(key3, messageColor3);
}
}
}
else if (lastTwinStanding)
{
// Only drop hallowed bars after all mechs are down
if (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3)
if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework)
DropHelper.BlockDrops(ItemID.HallowedBar);
DropHelper.DropItemCondition(npc, ModContent.ItemType<MysteriousCircuitry>(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16);
@@ -238,13 +241,13 @@ namespace CalamityMod.NPCs
CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType<DILF>(), ModContent.NPCType<FAP>(), ModContent.NPCType<THIEF>() }, !NPC.downedMechBoss1 || NPC.downedMechBoss2 || !NPC.downedMechBoss3);
CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss2 || !CalamityConfig.Instance.SellVanillaSummons);
if (!NPC.downedMechBoss2)
if (!NPC.downedMechBoss2 && CalamityConfig.Instance.EarlyHardmodeProgressionRework)
SpawnMechBossHardmodeOres();
}
else if (npc.type == NPCID.TheDestroyer)
{
// Only drop hallowed bars after all mechs are down
if (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3)
if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework)
DropHelper.BlockDrops(ItemID.HallowedBar);
DropHelper.DropItemCondition(npc, ModContent.ItemType<MysteriousCircuitry>(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16);
@@ -259,13 +262,13 @@ namespace CalamityMod.NPCs
CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType<DILF>(), ModContent.NPCType<FAP>(), ModContent.NPCType<THIEF>() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3);
CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss1 || !CalamityConfig.Instance.SellVanillaSummons);
if (!NPC.downedMechBoss1)
if (!NPC.downedMechBoss1 && CalamityConfig.Instance.EarlyHardmodeProgressionRework)
SpawnMechBossHardmodeOres();
}
else if (npc.type == NPCID.SkeletronPrime)
{
// Only drop hallowed bars after all mechs are down
if (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3)
if ((!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3) && CalamityConfig.Instance.EarlyHardmodeProgressionRework)
DropHelper.BlockDrops(ItemID.HallowedBar);
DropHelper.DropItemCondition(npc, ModContent.ItemType<MysteriousCircuitry>(), Main.expertMode, CalamityGlobalNPC.DraedonMayhem, 8, 16);
@@ -281,7 +284,7 @@ namespace CalamityMod.NPCs
CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType<DILF>(), ModContent.NPCType<FAP>(), ModContent.NPCType<THIEF>() }, !NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3);
CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Steampunker }, NPC.downedMechBoss3 || !CalamityConfig.Instance.SellVanillaSummons);
if (!NPC.downedMechBoss3)
if (!NPC.downedMechBoss3 && CalamityConfig.Instance.EarlyHardmodeProgressionRework)
SpawnMechBossHardmodeOres();
}
else if (npc.type == NPCID.Plantera)
@@ -669,10 +672,54 @@ namespace CalamityMod.NPCs
return true;
}
#endregion
#endregion
#region NPCLoot
public override void NPCLoot(NPC npc)
#region Armageddon Loot
private void ArmageddonLoot(NPC npc)
{
switch (npc.type)
{
case NPCID.EaterofWorldsHead:
case NPCID.EaterofWorldsBody:
case NPCID.EaterofWorldsTail:
if (npc.boss) // only drop from the 1 "boss" segment (redcode)
DropHelper.DropArmageddonBags(npc);
break;
case NPCID.Retinazer: // only drop if spaz is already dead
if (!NPC.AnyNPCs(NPCID.Spazmatism))
DropHelper.DropArmageddonBags(npc);
break;
case NPCID.Spazmatism: // only drop if ret is already dead
if (!NPC.AnyNPCs(NPCID.Retinazer))
DropHelper.DropArmageddonBags(npc);
break;
case NPCID.KingSlime:
case NPCID.EyeofCthulhu:
case NPCID.BrainofCthulhu:
case NPCID.QueenBee:
case NPCID.SkeletronHead:
case NPCID.WallofFlesh:
case NPCID.TheDestroyer:
case NPCID.SkeletronPrime:
case NPCID.Plantera:
case NPCID.Golem:
case NPCID.DD2Betsy:
case NPCID.DukeFishron:
case NPCID.MoonLordCore:
DropHelper.DropArmageddonBags(npc);
break;
default:
break;
}
}
#endregion
#region NPCLoot
public override void NPCLoot(NPC npc)
{
// LATER -- keeping bosses alive lets draedon mayhem continue even after killing mechs
// Reset Draedon Mayhem to false if no bosses are alive
@@ -685,9 +732,6 @@ namespace CalamityMod.NPCs
}
}
if (CalamityWorld.armageddon)
ArmageddonLoot(npc);
// Miscellaneous on-enemy-kill effects.
CheckBossSpawn(npc);
if (CalamityWorld.rainingAcid)
@@ -701,50 +745,6 @@ namespace CalamityMod.NPCs
}
#endregion
#region Armageddon Loot
private void ArmageddonLoot(NPC npc)
{
switch (npc.type)
{
case NPCID.EaterofWorldsHead:
case NPCID.EaterofWorldsBody:
case NPCID.EaterofWorldsTail:
if (npc.boss) // only drop from the 1 "boss" segment (redcode)
DropHelper.DropArmageddonBags(npc);
break;
case NPCID.Retinazer: // only drop if spaz is already dead
if (!NPC.AnyNPCs(NPCID.Spazmatism))
DropHelper.DropArmageddonBags(npc);
break;
case NPCID.Spazmatism: // only drop if ret is already dead
if (!NPC.AnyNPCs(NPCID.Retinazer))
DropHelper.DropArmageddonBags(npc);
break;
case NPCID.KingSlime:
case NPCID.EyeofCthulhu:
case NPCID.BrainofCthulhu:
case NPCID.QueenBee:
case NPCID.SkeletronHead:
case NPCID.WallofFlesh:
case NPCID.TheDestroyer:
case NPCID.SkeletronPrime:
case NPCID.Plantera:
case NPCID.Golem:
case NPCID.DD2Betsy:
case NPCID.DukeFishron:
case NPCID.MoonLordCore:
DropHelper.DropArmageddonBags(npc);
break;
default:
break;
}
}
#endregion
#region Check Boss Spawn
// not really drop code
private void CheckBossSpawn(NPC npc)
+2
View File
@@ -7,6 +7,7 @@ using CalamityMod.Items.Placeables.Furniture.Fountains;
using CalamityMod.Items.Placeables.Walls;
using CalamityMod.Items.Potions;
using CalamityMod.Items.SummonItems;
using CalamityMod.Items.SummonItems.Invasion;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Items.Weapons.Rogue;
@@ -1217,6 +1218,7 @@ namespace CalamityMod.NPCs
if (type == NPCID.Cyborg)
{
SetShopItem(ref shop, ref nextSlot, ItemID.RocketLauncher, NPC.downedGolemBoss, Item.buyPrice(0, 25));
SetShopItem(ref shop, ref nextSlot, ItemType<MartianDistressBeacon>(), NPC.downedGolemBoss, Item.buyPrice(0, 50));
SetShopItem(ref shop, ref nextSlot, ItemType<LionHeart>(), CalamityWorld.downedPolterghast);
}
+7 -7
View File
@@ -106,7 +106,7 @@ namespace CalamityMod.NPCs
else if (distanceFromAboveTarget > 600f)
{
flyInertia = 30f;
idealFlyVelocity = npc.DirectionTo(destinationAboveTarget) * 15f;
idealFlyVelocity = npc.SafeDirectionTo(destinationAboveTarget, -Vector2.UnitY) * 15f;
npc.velocity = (npc.velocity * (flyInertia - 1f) + idealFlyVelocity) / flyInertia;
}
@@ -168,7 +168,7 @@ namespace CalamityMod.NPCs
float flySpeed = 18f + npc.Distance(target.Center) / 100f;
flyInertia = 25f;
idealFlyVelocity = npc.DirectionTo(target.Center) * flySpeed;
idealFlyVelocity = npc.SafeDirectionTo(target.Center, -Vector2.UnitY) * flySpeed;
npc.velocity = (npc.velocity * (flyInertia - 1f) + idealFlyVelocity) / flyInertia;
break;
@@ -210,7 +210,7 @@ namespace CalamityMod.NPCs
flySpeed = 12f + flySpeedAdditive + npc.Distance(destination) / 120f;
flyInertia = 20f;
idealFlyVelocity = npc.DirectionTo(destination) * flySpeed;
idealFlyVelocity = npc.SafeDirectionTo(destination, -Vector2.UnitY) * flySpeed;
npc.velocity = (npc.velocity * (flyInertia - 1f) + idealFlyVelocity) / flyInertia;
aiTimer++;
@@ -254,7 +254,7 @@ namespace CalamityMod.NPCs
flySpeedAdditive += 0.0333333351f;
flySpeed = 24f + flySpeedAdditive;
flyInertia = 4f;
idealVelocity = npc.DirectionTo(destination) * flySpeed;
idealVelocity = npc.SafeDirectionTo(destination, -Vector2.UnitY) * flySpeed;
npc.velocity = (npc.velocity * (flyInertia - 1f) + idealVelocity) / flyInertia;
break;
case MothronAIState.ChargePreparation:
@@ -267,7 +267,7 @@ namespace CalamityMod.NPCs
destination = target.Center - Vector2.UnitY * 12f;
float chargePreperationInertia = 8f;
Vector2 chargeVelocity = npc.DirectionTo(destination) * chargeSpeed;
Vector2 chargeVelocity = npc.SafeDirectionTo(destination, -Vector2.UnitY) * chargeSpeed;
npc.velocity = (npc.velocity * (chargePreperationInertia - 1f) + chargeVelocity) / chargePreperationInertia;
npc.spriteDirection = npc.direction = (npc.velocity.X > 0).ToDirectionInt();
@@ -394,7 +394,7 @@ namespace CalamityMod.NPCs
}
flyInertia = 10f;
npc.velocity = (npc.velocity * (flyInertia - 1f) + npc.DirectionTo(spotToLayEgg) * flySpeed) / flyInertia;
npc.velocity = (npc.velocity * (flyInertia - 1f) + npc.SafeDirectionTo(spotToLayEgg, -Vector2.UnitY) * flySpeed) / flyInertia;
break;
case MothronAIState.LayEgg:
@@ -435,7 +435,7 @@ namespace CalamityMod.NPCs
if (distanceFromSpot < hoverSpeed)
hoverSpeed = distanceFromSpot;
Vector2 hoverVelocity = npc.DirectionTo(spotToLayEgg).SafeNormalize(Vector2.Zero) * hoverSpeed;
Vector2 hoverVelocity = npc.SafeDirectionTo(spotToLayEgg) * hoverSpeed;
npc.velocity = (npc.velocity * (hoverInertia - 1f) + hoverVelocity) / hoverInertia;
if (npc.velocity.HasNaNs())
npc.velocity = Vector2.Zero;
+1 -1
View File
@@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.CeaselessVoid
CalamityGlobalNPC global = npc.Calamity();
global.DR = 0.5f;
npc.lifeMax = 25000;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse");
else
+1 -1
View File
@@ -47,7 +47,7 @@ namespace CalamityMod.NPCs.Crabulon
aiType = -1;
npc.noGravity = false;
npc.noTileCollide = false;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Crabulon");
else
+1 -1
View File
@@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.Cryogen
npc.noTileCollide = true;
npc.HitSound = SoundID.NPCHit5;
npc.DeathSound = SoundID.NPCDeath15;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Cryogen");
else
+1 -1
View File
@@ -32,7 +32,7 @@ namespace CalamityMod.NPCs.DesertScourge
npc.knockBackResist = 0f;
npc.alpha = 255;
npc.boss = true;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge");
else
+1 -1
View File
@@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.DesertScourge
npc.DeathSound = SoundID.NPCDeath1;
npc.netAlways = true;
bossBag = ModContent.ItemType<DesertScourgeBag>();
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge");
else
+1 -1
View File
@@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.DesertScourge
npc.knockBackResist = 0f;
npc.alpha = 255;
npc.boss = true;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/DesertScourge");
else
+1 -1
View File
@@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.DevourerofGods
npc.DeathSound = SoundID.NPCDeath14;
npc.netAlways = true;
npc.boss = true;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse");
else
+1 -1
View File
@@ -48,7 +48,7 @@ namespace CalamityMod.NPCs.DevourerofGods
npc.DeathSound = SoundID.NPCDeath14;
npc.netAlways = true;
npc.boss = true;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse");
else
+1 -1
View File
@@ -68,7 +68,7 @@ namespace CalamityMod.NPCs.DevourerofGods
npc.noTileCollide = true;
npc.DeathSound = SoundID.NPCDeath14;
npc.netAlways = true;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse");
else
+1 -1
View File
@@ -100,7 +100,7 @@ namespace CalamityMod.NPCs.DevourerofGods
npc.noTileCollide = true;
npc.DeathSound = SoundID.NPCDeath14;
npc.netAlways = true;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse");
else
+1 -1
View File
@@ -41,7 +41,7 @@ namespace CalamityMod.NPCs.DevourerofGods
npc.netAlways = true;
npc.boss = true;
npc.takenDamageMultiplier = 1.25f;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse");
else
+1 -1
View File
@@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.DevourerofGods
npc.DeathSound = SoundID.NPCDeath14;
npc.netAlways = true;
npc.boss = true;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/UniversalCollapse");
else
+3 -2
View File
@@ -413,8 +413,9 @@ namespace CalamityMod.NPCs.GreatSandShark
(float)Main.rand.Next(-3, 4), (float)Main.rand.Next(-12, -6), ModContent.ProjectileType<GreatSandBlast>(), 40, 0f, Main.myPlayer, 0f, 0f);
}
npc.ai[2] = -30f;
Vector2 vector261 = npc.DirectionTo(vector260 + new Vector2(0f, -80f));
npc.velocity = vector261 * 18f;
Vector2 upwardChargeDirection = npc.SafeDirectionTo(vector260 + new Vector2(0f, -80f), -Vector2.UnitY);
npc.velocity = upwardChargeDirection * 18f;
}
}
else
+1 -1
View File
@@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.HiveMind
npc.value = 0f;
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath1;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind");
else
+1 -1
View File
@@ -87,7 +87,7 @@ namespace CalamityMod.NPCs.HiveMind
npc.noTileCollide = true;
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath1;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/HiveMind");
else
+1 -1
View File
@@ -61,7 +61,7 @@ namespace CalamityMod.NPCs.Leviathan
npc.noGravity = true;
npc.boss = true;
npc.netAlways = true;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren");
else
+1 -1
View File
@@ -34,7 +34,7 @@ namespace CalamityMod.NPCs.Leviathan
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = null;
npc.rarity = 2;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/SirenLure");
}
+3 -3
View File
@@ -49,8 +49,8 @@ namespace CalamityMod.NPCs.Leviathan
npc.noTileCollide = true;
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath1;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
if (calamityModMusic != null)
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Siren");
else
music = MusicID.Boss3;
@@ -145,7 +145,7 @@ namespace CalamityMod.NPCs.Leviathan
{
if (!spawnedLevi)
{
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/LeviathanAndSiren");
else
+6 -7
View File
@@ -118,8 +118,9 @@ namespace CalamityMod.NPCs.NormalNPCs
{
if (npc.direction == 0)
npc.direction = 1;
Vector2 destination = player.Center + new Vector2(300f * npc.direction, -90f);
npc.velocity = Vector2.Lerp(npc.velocity, npc.DirectionTo(destination) * 8f, 0.1f);
npc.velocity = Vector2.Lerp(npc.velocity, npc.SafeDirectionTo(destination) * 8f, 0.1f);
if (npc.Distance(destination) < 40f)
{
Time++;
@@ -134,13 +135,11 @@ namespace CalamityMod.NPCs.NormalNPCs
else
{
if (HorizontalChargeTime < 25)
{
npc.velocity = Vector2.Lerp(npc.velocity, npc.DirectionTo(player.Center) * 8f, 0.1f);
}
npc.velocity = Vector2.Lerp(npc.velocity, npc.SafeDirectionTo(player.Center) * 8f, 0.1f);
if (Supercharged && Main.netMode != NetmodeID.MultiplayerClient && HorizontalChargeTime % 30f == 29f)
{
Projectile.NewProjectile(npc.Center + Vector2.UnitX * 6f * npc.spriteDirection, npc.DirectionTo(player.Center) * 6f, ProjectileID.MartianTurretBolt, 14, 0f);
}
Projectile.NewProjectile(npc.Center + Vector2.UnitX * 6f * npc.spriteDirection, npc.SafeDirectionTo(player.Center, Vector2.UnitY) * 6f, ProjectileID.MartianTurretBolt, 14, 0f);
HorizontalChargeTime++;
if (HorizontalChargeTime > TotalHorizontalChargeTime)
{
+2 -2
View File
@@ -167,11 +167,11 @@ namespace CalamityMod.NPCs.NormalNPCs
AIState == HovercraftAIState.Hover)
{
Vector2 destination = player.Center + new Vector2(SearchXOffset * SearchDirection, -160f);
npc.velocity = npc.DirectionTo(destination) * (Supercharged ? 8.5f : 6f);
npc.velocity = npc.SafeDirectionTo(destination, Vector2.UnitY) * (Supercharged ? 8.5f : 6f);
if (AIState == HovercraftAIState.Hover)
{
destination = player.Center + new Vector2(SearchXOffset * -SearchDirection, -160f);
npc.velocity = npc.DirectionTo(destination) * (Supercharged ? 7f : 5f);
npc.velocity = npc.SafeDirectionTo(destination, Vector2.UnitY) * (Supercharged ? 7f : 5f);
}
npc.rotation = npc.velocity.X / 16f;
+2 -2
View File
@@ -55,8 +55,8 @@ namespace CalamityMod.NPCs.OldDuke
npc.boss = true;
npc.netAlways = true;
npc.timeLeft = NPC.activeTime * 30;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
if (calamityModMusic != null)
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/BoomerDuke");
else
music = MusicID.Boss1;
+2 -2
View File
@@ -57,8 +57,8 @@ namespace CalamityMod.NPCs.Perforator
npc.noTileCollide = true;
npc.HitSound = SoundID.NPCHit13;
npc.DeathSound = SoundID.NPCDeath19;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
if (calamityModMusic != null)
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/BloodCoagulant");
else
music = MusicID.Boss2;
@@ -88,7 +88,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
npc.noTileCollide = true;
npc.HitSound = SoundID.NPCHit4;
npc.DeathSound = SoundID.NPCDeath14;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/PlaguebringerGoliath");
else
@@ -1017,27 +1017,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
public override bool CheckActive() => canDespawn;
// Can only hit the target if within certain distance
public override bool CanHitPlayer(Player target, ref int cooldownSlot)
{
Rectangle targetHitbox = target.Hitbox;
float dist1 = Vector2.Distance(npc.Center, targetHitbox.TopLeft());
float dist2 = Vector2.Distance(npc.Center, targetHitbox.TopRight());
float dist3 = Vector2.Distance(npc.Center, targetHitbox.BottomLeft());
float dist4 = Vector2.Distance(npc.Center, targetHitbox.BottomRight());
float minDist = dist1;
if (dist2 < minDist)
minDist = dist2;
if (dist3 < minDist)
minDist = dist3;
if (dist4 < minDist)
minDist = dist4;
return minDist <= 100f;
}
public override void HitEffect(int hitDirection, double damage)
{
for (int k = 0; k < 2; k++)
+2 -2
View File
@@ -76,8 +76,8 @@ namespace CalamityMod.NPCs.Polterghast
npc.noGravity = true;
npc.noTileCollide = true;
npc.netAlways = true;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
if (calamityModMusic != null)
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/RUIN");
else
music = MusicID.Plantera;
@@ -51,7 +51,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians
npc.noTileCollide = true;
aiType = -1;
npc.boss = true;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians");
else
@@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians
npc.canGhostHeal = false;
aiType = -1;
npc.boss = true;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians");
else
@@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians
npc.canGhostHeal = false;
aiType = -1;
npc.boss = true;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/Guardians");
else
+2 -2
View File
@@ -104,8 +104,8 @@ namespace CalamityMod.NPCs.Providence
npc.netAlways = true;
npc.chaseable = true;
npc.canGhostHeal = false;
Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic");
if (calamityModMusic != null)
Mod calamityModMusic = CalamityMod.Instance.musicMod;
if (calamityModMusic != null)
music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ProvidenceTheme");
else
music = MusicID.LunarBoss;
Loaded 100 of 324 files, more files were not shown because too many files have changed in this diff. Show more