Merge 1.4.4 into staging
No files matched your search
@@ -4798,13 +4798,13 @@ namespace CalamityMod.CalPlayer
|
||||
#region Get Weapon Damage And KB
|
||||
public override void ModifyWeaponDamage(Item item, ref StatModifier damage)
|
||||
{
|
||||
if (item.CountsAsClass<RogueDamageClass>())
|
||||
if (item.CountsAsClass<RogueDamageClass>() && item.TryGetGlobalItem<RogueGlobalItem>(out var rogueItem))
|
||||
{
|
||||
// Apply weapon modifier stealth strike damage bonus
|
||||
// 01OCT2023: Ozzatron: This is a multiplicative bonus because it is a prefix.
|
||||
// It should be equivalent to x1.15 (or whatever multiplier) on the base damage of the weapon for stealth only.
|
||||
if (item.Calamity().StealthStrikePrefixBonus != 0f && StealthStrikeAvailable())
|
||||
damage *= item.Calamity().StealthStrikePrefixBonus; // This number centers on 1f, so 1.15f = 1.15x damage.
|
||||
if (rogueItem.StealthStrikePrefixBonus != 0f && StealthStrikeAvailable())
|
||||
damage *= rogueItem.StealthStrikePrefixBonus; // This number centers on 1f, so 1.15f = 1.15x damage.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 385 B After Width: | Height: | Size: 490 B |
|
Before Width: | Height: | Size: 179 B After Width: | Height: | Size: 239 B |
|
Before Width: | Height: | Size: 163 B After Width: | Height: | Size: 184 B |
|
After Width: | Height: | Size: 409 B |
|
After Width: | Height: | Size: 238 B |
|
After Width: | Height: | Size: 199 B |
@@ -36,6 +36,12 @@ namespace CalamityMod.Cooldowns
|
||||
cooldownColorStart = new Color(107, 6, 6);
|
||||
cooldownColorEnd = new Color(228, 78, 78);
|
||||
break;
|
||||
case "shieldoftheocean":
|
||||
skinTexture = "OceanShieldParry";
|
||||
outlineColor = Color.White;
|
||||
cooldownColorStart = new Color(233, 111, 165);
|
||||
cooldownColorEnd = new Color(105, 139, 148);
|
||||
break;
|
||||
default:
|
||||
skinTexture = "ParryCooldown";
|
||||
outlineColor = Color.White;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace CalamityMod.Cooldowns
|
||||
{
|
||||
public class WardingWave : CooldownHandler
|
||||
{
|
||||
public static new string ID => "WardingWave";
|
||||
public override bool ShouldDisplay => true;
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetText("UI.Cooldowns.WardingWave");
|
||||
public override string Texture => "CalamityMod/Cooldowns/WardingWave";
|
||||
public override Color OutlineColor => new Color(158, 158, 255);
|
||||
public override Color CooldownStartColor => new Color(72, 125, 204);
|
||||
public override Color CooldownEndColor => new Color(255, 170, 204);
|
||||
public override SoundStyle? EndSound => SoundID.Item85;
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 480 B |
|
After Width: | Height: | Size: 243 B |
|
After Width: | Height: | Size: 207 B |
@@ -16,8 +16,8 @@ namespace CalamityMod.Graphics.Metaballs
|
||||
public override void Load()
|
||||
{
|
||||
// Prepare event subscribers.
|
||||
GeneralDrawLayerSystem.OnPrepareDraw += PrepareMetaballTargets;
|
||||
GeneralDrawLayerSystem.OnDrawLayer += DrawMetaballs;
|
||||
RenderTargetManager.RenderTargetUpdateLoopEvent += PrepareMetaballTargets;
|
||||
}
|
||||
|
||||
public override void OnModUnload()
|
||||
@@ -57,7 +57,7 @@ namespace CalamityMod.Graphics.Metaballs
|
||||
return;
|
||||
|
||||
// Prepare the sprite batch for drawing. Metaballs may restart the sprite batch via PrepareSpriteBatch if their implementation requires it.
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, Main.Rasterizer, null, Matrix.Identity);
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, Main.Rasterizer, null, Main.Transform);
|
||||
|
||||
var gd = Main.instance.GraphicsDevice;
|
||||
foreach (Metaball metaball in activeMetaballs)
|
||||
@@ -78,7 +78,7 @@ namespace CalamityMod.Graphics.Metaballs
|
||||
|
||||
// Flush metaball contents to its render target and reset the sprite batch for the next iteration.
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, Main.Rasterizer, null, Matrix.Identity);
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, Main.Rasterizer, null, Main.Transform);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace CalamityMod.Graphics.Metaballs
|
||||
/// <param name="layerType">The layer type to draw with.</param>
|
||||
private static void DrawMetaballs(GeneralDrawLayer layerType)
|
||||
{
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, RasterizerState.CullCounterClockwise);
|
||||
|
||||
foreach (Metaball metaball in metaballs.Where(m => m.DrawLayer == layerType && m.AnythingToDraw))
|
||||
{
|
||||
@@ -110,7 +110,7 @@ namespace CalamityMod.Graphics.Metaballs
|
||||
metaball.PrepareShaderForTarget(i);
|
||||
|
||||
// Draw the metaball's raw contents with the shader.
|
||||
Main.spriteBatch.Draw(metaball.LayerTargets[i], Main.screenLastPosition - Main.screenPosition, Color.White);
|
||||
Main.spriteBatch.Draw(metaball.LayerTargets[i], Vector2.Zero, Color.White);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
// Draw with additive blending.
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.Default, Main.Rasterizer, null, Matrix.Identity);
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.Default, Main.Rasterizer, null, Main.Transform);
|
||||
}
|
||||
|
||||
public override void DrawInstances()
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace CalamityMod.Graphics.Metaballs
|
||||
{
|
||||
// Draw with additive blending.
|
||||
Main.spriteBatch.End();
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.Default, Main.Rasterizer, null, Matrix.Identity);
|
||||
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.Default, Main.Rasterizer, null, Main.Transform);
|
||||
}
|
||||
|
||||
public override void DrawInstances()
|
||||
|
||||
@@ -886,7 +886,7 @@ namespace CalamityMod.ILEditing
|
||||
return;
|
||||
}
|
||||
cursor.Emit(OpCodes.Pop);
|
||||
cursor.Emit<CalamityGlobalNPC>(OpCodes.Call, $"get_{nameof(CalamityGlobalNPC.TotalTaxesPerNPC)}");
|
||||
cursor.Emit<CalamityGlobalTownNPC>(OpCodes.Call, $"get_{nameof(CalamityGlobalTownNPC.TotalTaxesPerNPC)}");
|
||||
|
||||
if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall<Item>(nameof(Item.buyPrice))))
|
||||
{
|
||||
@@ -894,7 +894,7 @@ namespace CalamityMod.ILEditing
|
||||
return;
|
||||
}
|
||||
cursor.Emit(OpCodes.Pop);
|
||||
cursor.Emit<CalamityGlobalNPC>(OpCodes.Call, $"get_{nameof(CalamityGlobalNPC.TaxesToCollectLimit)}");
|
||||
cursor.Emit<CalamityGlobalTownNPC>(OpCodes.Call, $"get_{nameof(CalamityGlobalTownNPC.TaxesToCollectLimit)}");
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace CalamityMod.Items.BaseItems
|
||||
|
||||
private static void DrawSpecial(Terraria.UI.On_ItemSlot.orig_Draw_SpriteBatch_ItemArray_int_int_Vector2_Color orig, SpriteBatch sb, Item[] inv, int context, int slot, Vector2 position, Color color)
|
||||
{
|
||||
if (inv[slot].ModItem is HeldOnlyItem && !(inv[slot].ModItem as HeldOnlyItem).VisibleInUI)
|
||||
if (inv[slot].ModItem is HeldOnlyItem heldOnlyItem && !heldOnlyItem.VisibleInUI)
|
||||
return;
|
||||
|
||||
else
|
||||
@@ -45,14 +45,14 @@ namespace CalamityMod.Items.BaseItems
|
||||
|
||||
private static void LockMouseToSpecialItem(Terraria.UI.On_ItemSlot.orig_LeftClick_ItemArray_int_int orig, Item[] inv, int context, int slot)
|
||||
{
|
||||
if (!(Main.mouseItem.ModItem is HeldOnlyItem))
|
||||
if (Main.mouseItem.ModItem is not HeldOnlyItem)
|
||||
orig(inv, context, slot);
|
||||
}
|
||||
|
||||
//https://media.discordapp.net/attachments/458432092301295618/993675527539916850/unknown.png
|
||||
private static void DontDropCoolStuff(Terraria.On_Player.orig_dropItemCheck orig, Terraria.Player self)
|
||||
{
|
||||
if (!(Main.mouseItem.ModItem is HeldOnlyItem))
|
||||
if (Main.mouseItem.ModItem is not HeldOnlyItem)
|
||||
orig(self);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,10 +52,6 @@ namespace CalamityMod.Items
|
||||
{
|
||||
public override bool InstancePerEntity => true;
|
||||
|
||||
// TODO -- split out a separate GlobalItem for rogue behavior?
|
||||
/// <summary> Tracks the stealth strike damage modifier for this item, derived from its prefix. </summary>
|
||||
internal float StealthStrikePrefixBonus;
|
||||
|
||||
private BitsByte flag0 = 0;
|
||||
|
||||
#region Chargeable Item Variables
|
||||
@@ -150,11 +146,6 @@ namespace CalamityMod.Items
|
||||
|
||||
public static readonly Color ExhumedTooltipColor = new Color(198, 27, 64);
|
||||
|
||||
public CalamityGlobalItem()
|
||||
{
|
||||
StealthStrikePrefixBonus = 0f;
|
||||
}
|
||||
|
||||
// Ozzatron 21MAY2022: This function is required by TML 1.4's new clone behavior.
|
||||
// This behavior is sadly mandatory because there are a few places in vanilla Terraria which use cloning.
|
||||
// Most notably: reforging and item tooltips.
|
||||
@@ -169,9 +160,6 @@ namespace CalamityMod.Items
|
||||
// BitFlags
|
||||
myClone.flag0 = flag0;
|
||||
|
||||
// Rogue
|
||||
myClone.StealthStrikePrefixBonus = StealthStrikePrefixBonus;
|
||||
|
||||
// Charge (Draedon's Arsenal)
|
||||
myClone.UsesCharge = UsesCharge;
|
||||
myClone.Charge = Charge;
|
||||
@@ -1693,13 +1681,6 @@ namespace CalamityMod.Items
|
||||
public static int RarityCalamityRedBuyPrice => Rarity17BuyPrice;
|
||||
#endregion
|
||||
|
||||
#region PreReforge
|
||||
public override void PreReforge(Item item)
|
||||
{
|
||||
StealthStrikePrefixBonus = 0f;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//
|
||||
// !! WARNING !!
|
||||
//
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items
|
||||
{
|
||||
public sealed class RogueGlobalItem : GlobalItem
|
||||
{
|
||||
public override bool InstancePerEntity => true;
|
||||
|
||||
/// <summary> Tracks the stealth strike damage modifier for this item, derived from its prefix. </summary>
|
||||
internal float StealthStrikePrefixBonus = 0.0f;
|
||||
|
||||
public override GlobalItem Clone(Item from, Item to)
|
||||
{
|
||||
RogueGlobalItem myClone = (RogueGlobalItem)base.Clone(from, to);
|
||||
|
||||
// Rogue
|
||||
myClone.StealthStrikePrefixBonus = StealthStrikePrefixBonus;
|
||||
|
||||
return myClone;
|
||||
}
|
||||
|
||||
public override bool AppliesToEntity(Item entity, bool lateInstantiation)
|
||||
{
|
||||
return entity.CountsAsClass<RogueDamageClass>();
|
||||
}
|
||||
|
||||
public override void PreReforge(Item item)
|
||||
{
|
||||
StealthStrikePrefixBonus = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -962,9 +962,9 @@ namespace CalamityMod
|
||||
#region Town NPC Alert support
|
||||
public static void RegisterTownNPCShop(int id, Predicate<Player> getShop, Action<Player, bool> setShop)
|
||||
{
|
||||
if (!CalamityGlobalNPC.npcAlertList.Contains((id, getShop, setShop)))
|
||||
if (!CalamityGlobalTownNPC.npcAlertList.Contains((id, getShop, setShop)))
|
||||
{
|
||||
CalamityGlobalNPC.npcAlertList.Add((id, getShop, setShop));
|
||||
CalamityGlobalTownNPC.npcAlertList.Add((id, getShop, setShop));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -1022,7 +1022,7 @@ namespace CalamityMod
|
||||
case "Ectoheart": player.Calamity().adrenalineBoostThree = value; break;
|
||||
|
||||
case "CelestialOnion": player.Calamity().extraAccessoryML = value; break;
|
||||
};
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -1781,6 +1781,21 @@ namespace CalamityMod
|
||||
return null;
|
||||
}
|
||||
|
||||
case "GetVanillaAIOverrideEnabled":
|
||||
{
|
||||
return CalamityVanillaAIOverrideNPC.Enabled;
|
||||
}
|
||||
|
||||
case "SetVanillaAIOverrideEnabled":
|
||||
{
|
||||
if (args.Length < 1)
|
||||
return new ArgumentNullException(nameof(args), "ERROR: Must specify a bool parameter");
|
||||
if (args[0] is not bool aiOverrideEnabled)
|
||||
return new ArgumentException("ERROR: The third argument to \"SetVanillaAIOverrideEnabled\" must be a bool.");
|
||||
CalamityVanillaAIOverrideNPC.Enabled = aiOverrideEnabled;
|
||||
return null;
|
||||
}
|
||||
|
||||
case "GetCalamityAI":
|
||||
case "GetNewAI":
|
||||
{
|
||||
@@ -2165,7 +2180,7 @@ namespace CalamityMod
|
||||
return new ArgumentException("ERROR: The first argument to \"SetNewShopVariable\" must be an integer array of npc ids that should be alerted.");
|
||||
if (args.Length != 3 || args[2] is not bool alreadySet)
|
||||
return new ArgumentException("ERROR: The second argument to \"SetNewShopVariable\" Must be a bool that determines if the shop alert should show.");
|
||||
CalamityGlobalNPC.SetNewShopVariable(npcs, alreadySet);
|
||||
CalamityGlobalTownNPC.SetNewShopVariable(npcs, alreadySet);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace CalamityMod.NPCs.CalClone
|
||||
if (lifeRatio < 0.1f && !inBulletHell && CalamityWorld.death)
|
||||
baseSize *= MathHelper.Lerp(Main.getGoodWorld ? 0.22f : 0.4f, 1f, lifeRatio * 10f); // Scale down the lower health calclone has. Much lower bound on FTW.
|
||||
|
||||
return baseSize + new Vector4(-22, 0 ,22,0);
|
||||
return baseSize + new Vector4(-22, 0, 22, 0);
|
||||
}
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -1071,7 +1071,7 @@ namespace CalamityMod.NPCs.CalClone
|
||||
|
||||
CalamityGlobalNPC.SetNewBossJustDowned(NPC);
|
||||
|
||||
CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType<Bandit>() }, DownedBossSystem.downedCalamitasClone);
|
||||
CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType<Bandit>() }, DownedBossSystem.downedCalamitasClone);
|
||||
|
||||
// Mark the Calamitas Clone as dead
|
||||
DownedBossSystem.downedCalamitasClone = true;
|
||||
|
||||
@@ -11,7 +11,6 @@ using CalamityMod.CalPlayer;
|
||||
using CalamityMod.DataStructures;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.ExtraTextures;
|
||||
using CalamityMod.Graphics.Metaballs;
|
||||
using CalamityMod.Graphics.Renderers.CalamityRenderers;
|
||||
using CalamityMod.Items;
|
||||
@@ -233,11 +232,6 @@ namespace CalamityMod.NPCs
|
||||
public const int maxPlayerImmunities = Main.maxPlayers + 1;
|
||||
public int[] dashImmunityTime = new int[maxPlayerImmunities];
|
||||
|
||||
/// <summary> Used to control the animation of the Town NPC Shop Alert icon, if the respective config is enabled. </summary>
|
||||
public int shopAlertAnimTimer = 0;
|
||||
/// <summary> <inheritdoc cref="shopAlertAnimTimer"/> </summary>
|
||||
public int shopAlertAnimFrame = 0;
|
||||
|
||||
/// <summary>
|
||||
/// If set to false, prevents this NPC from allowing Rage to be generated by nearby players, regardless of other factors.<br/>
|
||||
/// Defaults to true.
|
||||
@@ -250,9 +244,6 @@ namespace CalamityMod.NPCs
|
||||
public float[] newAI = new float[maxAIMod];
|
||||
public int killTimeTimer = 0;
|
||||
|
||||
/// <summary> Used for allowing Patreon names for Town NPCs. </summary>
|
||||
public bool setNewName = true;
|
||||
|
||||
/// <summary> If set to true, the Boss Health Bar for this NPC will count the total health of all individual segments using worm segment logic. </summary>
|
||||
public bool SplittingWorm = false;
|
||||
/// <summary> If set to true, allows this NPC to draw a Boss Health Bar, regardless of other factors. </summary>
|
||||
@@ -530,9 +521,6 @@ namespace CalamityMod.NPCs
|
||||
for (int i = 0; i < maxPlayerImmunities; ++i)
|
||||
myClone.dashImmunityTime[i] = dashImmunityTime[i];
|
||||
|
||||
myClone.shopAlertAnimTimer = shopAlertAnimTimer;
|
||||
myClone.shopAlertAnimFrame = shopAlertAnimFrame;
|
||||
|
||||
myClone.ProvidesProximityRage = ProvidesProximityRage;
|
||||
|
||||
myClone.newAI = new float[maxAIMod];
|
||||
@@ -540,8 +528,6 @@ namespace CalamityMod.NPCs
|
||||
myClone.newAI[i] = newAI[i];
|
||||
myClone.killTimeTimer = killTimeTimer;
|
||||
|
||||
myClone.setNewName = setNewName;
|
||||
|
||||
myClone.SplittingWorm = SplittingWorm;
|
||||
myClone.CanHaveBossHealthBar = CanHaveBossHealthBar;
|
||||
myClone.ShouldCloseHPBar = ShouldCloseHPBar;
|
||||
@@ -1227,7 +1213,6 @@ namespace CalamityMod.NPCs
|
||||
npc.SetDebuffImmunities();
|
||||
|
||||
VulnerabilitiesAndResistances(npc);
|
||||
BoundNPCSafety(Mod, npc);
|
||||
}
|
||||
|
||||
public override bool? CanFallThroughPlatforms(NPC npc)
|
||||
@@ -2861,8 +2846,6 @@ namespace CalamityMod.NPCs
|
||||
ManaBurnFireDrawer.Update();
|
||||
}
|
||||
|
||||
SetPatreonTownNPCName(npc, Mod);
|
||||
|
||||
// Decrement each immune timer if it's greater than 0.
|
||||
for (int i = 0; i < maxPlayerImmunities; i++)
|
||||
{
|
||||
@@ -2893,49 +2876,12 @@ namespace CalamityMod.NPCs
|
||||
if (CalamityNPCSets.DealsZeroContactDamage[npc.type] && !(npc.type == NPCID.RuneWizard && Main.zenithWorld))
|
||||
npc.damage = 0;
|
||||
|
||||
// Don't do damage for 42 frames after spawning in
|
||||
if (npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2)
|
||||
npc.damage = npc.alpha > 0 ? 0 : npc.defDamage;
|
||||
|
||||
if (BossRushEvent.BossRushActive && !npc.friendly && !npc.townNPC && !DoesNotDisappearInBossRush)
|
||||
BossRushForceDespawnOtherNPCs(npc, Mod);
|
||||
|
||||
if (NPC.LunarApocalypseIsUp)
|
||||
PillarEventProgressionEdit(npc);
|
||||
|
||||
// Servant of Cthulhu light
|
||||
if (npc.type == NPCID.ServantofCthulhu)
|
||||
Lighting.AddLight(npc.Center, 0.2f, 0.2f, 0.2f);
|
||||
|
||||
if (npc.type == NPCID.CultistBoss)
|
||||
{
|
||||
// Emit light
|
||||
float lifeRatio = npc.life / (float)npc.lifeMax;
|
||||
float colorTransitionAmt = (float)Math.Pow((double)(1f - lifeRatio), 2D);
|
||||
Color lightColor = Color.Lerp(Color.Cyan, Color.Blue, colorTransitionAmt);
|
||||
Lighting.AddLight(npc.Center, lightColor.R / 255f, lightColor.G / 255f, lightColor.B / 255f);
|
||||
|
||||
// Decrement the hit counter for the shield flicker
|
||||
if (newAI[1] > 0f)
|
||||
newAI[1] -= 1f;
|
||||
|
||||
// Cultist shield hitbox
|
||||
Vector2 hitboxSize = new Vector2(216f / 1.4142f);
|
||||
if (npc.Size != hitboxSize)
|
||||
npc.Size = hitboxSize;
|
||||
}
|
||||
if (npc.type == NPCID.CultistBossClone)
|
||||
{
|
||||
if (Main.npc[(int)npc.ai[3]].active)
|
||||
{
|
||||
// Emit light
|
||||
float lifeRatio = Main.npc[(int)npc.ai[3]].life / (float)Main.npc[(int)npc.ai[3]].lifeMax;
|
||||
float colorTransitionAmt = (float)Math.Pow((double)(1f - lifeRatio), 2D);
|
||||
Color lightColor = Color.Lerp(Color.Cyan, Color.Blue, colorTransitionAmt);
|
||||
Lighting.AddLight(npc.Center, lightColor.R / 255f, lightColor.G / 255f, lightColor.B / 255f);
|
||||
}
|
||||
}
|
||||
|
||||
#region Fairies Edit
|
||||
// Fairies don't run away and are immune to damage while wearing Fairy Boots.
|
||||
if (npc.type >= NPCID.FairyCritterPink && npc.type <= NPCID.FairyCritterBlue && (npc.ai[2] < 2f || npc.ai[2] == 7f))
|
||||
@@ -3289,114 +3235,6 @@ namespace CalamityMod.NPCs
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region AI
|
||||
public override void AI(NPC npc)
|
||||
{
|
||||
// Fair contact damage
|
||||
switch (npc.type)
|
||||
{
|
||||
case NPCID.DD2Betsy:
|
||||
npc.damage = npc.ai[0] == 2f ? npc.defDamage : 0;
|
||||
break;
|
||||
|
||||
case NPCID.DD2WyvernT1:
|
||||
case NPCID.DD2WyvernT2:
|
||||
case NPCID.DD2WyvernT3:
|
||||
npc.damage = npc.ai[0] == 2f ? npc.defDamage : 0;
|
||||
break;
|
||||
|
||||
case NPCID.Mothron:
|
||||
npc.damage = npc.ai[0] == 3.2f ? (int)Math.Round(npc.defDamage * 1.3) : npc.ai[0] == 2f ? (int)Math.Round(npc.defDamage * 0.5) : 0;
|
||||
break;
|
||||
|
||||
case NPCID.MothronSpawn:
|
||||
npc.damage = npc.ai[0] == 2.1f ? npc.defDamage : 0;
|
||||
break;
|
||||
|
||||
case NPCID.Mimic:
|
||||
case NPCID.IceMimic:
|
||||
case NPCID.PresentMimic:
|
||||
npc.damage = (npc.ai[0] == 0f || npc.velocity.Y == 0f) ? 0 : npc.defDamage;
|
||||
break;
|
||||
|
||||
case NPCID.BigMimicCorruption:
|
||||
case NPCID.BigMimicCrimson:
|
||||
case NPCID.BigMimicHallow:
|
||||
case NPCID.BigMimicJungle:
|
||||
npc.damage = npc.ai[0] == 3f ? 0 : npc.defDamage;
|
||||
|
||||
// Spend less time in closed state
|
||||
if (npc.ai[0] == 3f)
|
||||
npc.ai[1] += 0.5f;
|
||||
|
||||
break;
|
||||
|
||||
case NPCID.MartianDrone:
|
||||
case NPCID.SolarCorite:
|
||||
npc.damage = (npc.ai[0] == 2f || npc.ai[0] == 3f) ? npc.defDamage : 0;
|
||||
break;
|
||||
|
||||
case NPCID.GraniteFlyer:
|
||||
npc.damage = npc.ai[0] == -1f ? 0 : npc.defDamage;
|
||||
break;
|
||||
|
||||
case NPCID.GraniteGolem:
|
||||
npc.damage = npc.ai[2] < 0f ? 0 : npc.defDamage;
|
||||
break;
|
||||
|
||||
case NPCID.BlueSlime:
|
||||
case NPCID.MotherSlime:
|
||||
case NPCID.LavaSlime:
|
||||
case NPCID.DungeonSlime:
|
||||
case NPCID.CorruptSlime:
|
||||
case NPCID.IlluminantSlime:
|
||||
case NPCID.ToxicSludge:
|
||||
case NPCID.IceSlime:
|
||||
case NPCID.Crimslime:
|
||||
case NPCID.UmbrellaSlime:
|
||||
case NPCID.RainbowSlime:
|
||||
case NPCID.SlimeMasked:
|
||||
case NPCID.HoppinJack:
|
||||
case NPCID.SlimeRibbonWhite:
|
||||
case NPCID.SlimeRibbonYellow:
|
||||
case NPCID.SlimeRibbonGreen:
|
||||
case NPCID.SlimeRibbonRed:
|
||||
case NPCID.SandSlime:
|
||||
case NPCID.GoldenSlime:
|
||||
case NPCID.ShimmerSlime:
|
||||
case NPCID.GreenSlime:
|
||||
case NPCID.RedSlime:
|
||||
case NPCID.PurpleSlime:
|
||||
case NPCID.YellowSlime:
|
||||
case NPCID.BlackSlime:
|
||||
case NPCID.JungleSlime:
|
||||
case NPCID.BabySlime:
|
||||
case NPCID.Pinky:
|
||||
case NPCID.Slimeling:
|
||||
case NPCID.Slimer2:
|
||||
npc.damage = (npc.velocity.Y == 0f || npc.velocity.Length() < 3f) ? 0 : npc.defDamage;
|
||||
break;
|
||||
|
||||
case NPCID.GiantShelly:
|
||||
case NPCID.GiantShelly2:
|
||||
npc.damage = npc.ai[0] == 3f ? (int)Math.Round(npc.defDamage * 1.2) : 0;
|
||||
break;
|
||||
|
||||
case NPCID.GiantTortoise:
|
||||
case NPCID.IceTortoise:
|
||||
npc.damage = npc.ai[0] == 3f ? (int)Math.Round(npc.defDamage * 1.4) : 0;
|
||||
break;
|
||||
|
||||
case NPCID.SolarSroller:
|
||||
npc.damage = npc.ai[0] == 6f ? (int)Math.Round(npc.defDamage * 1.2) : 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Post AI
|
||||
public override void PostAI(NPC npc)
|
||||
{
|
||||
@@ -4935,17 +4773,6 @@ namespace CalamityMod.NPCs
|
||||
#region Drawing
|
||||
public override void FindFrame(NPC npc, int frameHeight)
|
||||
{
|
||||
if (CalamityWorld.revenge || BossRushEvent.BossRushActive)
|
||||
{
|
||||
// Used to force the head to look to the sides for the laser spread attack
|
||||
if (npc.type == NPCID.GolemHead && (npc.ai[0] == 2f || npc.ai[0] == 3f))
|
||||
{
|
||||
if (npc.localAI[1] == 1f)
|
||||
npc.frame.Y = frameHeight * 2;
|
||||
else
|
||||
npc.frame.Y = frameHeight * 4;
|
||||
}
|
||||
}
|
||||
// Increment the bestiary worm timer when hovering over the NPC or having their entry open. Pauses otherwise
|
||||
if (npc.IsABestiaryIconDummy)
|
||||
{
|
||||
@@ -5455,88 +5282,6 @@ namespace CalamityMod.NPCs
|
||||
}
|
||||
}
|
||||
|
||||
TownNPCAlertSystem(npc, Mod, spriteBatch);
|
||||
|
||||
if (CalamityWorld.revenge || BossRushEvent.BossRushActive)
|
||||
{
|
||||
if (CalamityNPCTypeSets.Destroyer.Contains(npc.type))
|
||||
shouldDrawBool = false;
|
||||
|
||||
// Allows correct frames to draw in Rev+ phases
|
||||
// GFB can rot for all I care
|
||||
if (npc.type == NPCID.SkeletronPrime && !NPC.IsMechQueenUp)
|
||||
{
|
||||
int frameHeight = TextureAssets.Npc[npc.type].Value.Height / Main.npcFrameCount[npc.type];
|
||||
if (npc.ai[1] == 0f || npc.ai[1] == 4f)
|
||||
{
|
||||
newAI[2] += 1f;
|
||||
if (newAI[2] >= 12f)
|
||||
{
|
||||
newAI[2] = 0f;
|
||||
newAI[3] += frameHeight;
|
||||
|
||||
if (newAI[3] / frameHeight >= 2f)
|
||||
newAI[3] = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
// Spinning probe spawn or fly over phase
|
||||
else if (npc.ai[1] == 5f || npc.ai[1] == 6f)
|
||||
{
|
||||
newAI[2] = 0f;
|
||||
newAI[3] = frameHeight;
|
||||
}
|
||||
|
||||
// Spinning phase
|
||||
else
|
||||
{
|
||||
newAI[2] = 0f;
|
||||
newAI[3] = frameHeight * 2;
|
||||
}
|
||||
|
||||
npc.frame.Y = (int)newAI[3];
|
||||
}
|
||||
|
||||
if (npc.type == NPCID.GolemHeadFree)
|
||||
{
|
||||
// Draw the head as usual.
|
||||
Texture2D golemHeadTexture = TextureAssets.Npc[npc.type].Value;
|
||||
Vector2 headDrawPosition = npc.Center - screenPos;
|
||||
spriteBatch.Draw(golemHeadTexture, headDrawPosition, npc.frame, npc.GetAlpha(drawColor), 0f, npc.frame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f);
|
||||
|
||||
// Draw the eyes. The way vanilla handles this is hardcoded bullshit that cannot handle different hitboxes and thus requires rewriting.
|
||||
Color eyeColor = new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, 0);
|
||||
Vector2 eyesDrawPosition = headDrawPosition - npc.scale * new Vector2(1f, 12f);
|
||||
Rectangle eyesFrame = new Rectangle(0, 0, TextureAssets.Golem[1].Value.Width, TextureAssets.Golem[1].Value.Height / 2);
|
||||
spriteBatch.Draw(TextureAssets.Golem[1].Value, eyesDrawPosition, eyesFrame, eyeColor, 0f, eyesFrame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f);
|
||||
|
||||
// Draw the glowmasks.
|
||||
int frameCounter = (int)npc.frameCounter / 4;
|
||||
Rectangle frame = TextureAssets.Extra[ExtrasID.GolemLights4].Value.Frame(1, 8);
|
||||
frame.Y += frame.Height * 2 * frameCounter + npc.frame.Y;
|
||||
Rectangle glowFrame = frame;
|
||||
spriteBatch.Draw(TextureAssets.Extra[ExtrasID.GolemLights4].Value, eyesDrawPosition, glowFrame, eyeColor, 0f, glowFrame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f);
|
||||
frame = npc.frame;
|
||||
Rectangle glowFrame2 = frame;
|
||||
spriteBatch.Draw(TextureAssets.Extra[ExtrasID.GolemLights5].Value, eyesDrawPosition, glowFrame2, eyeColor, 0f, glowFrame2.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f);
|
||||
|
||||
// Draw the sparkle telegraphs for the laser spread attack if applicable.
|
||||
if (npc.ai[0] == 3f && npc.ai[1] <= 60f)
|
||||
{
|
||||
spriteBatch.SetBlendState(BlendState.Additive);
|
||||
for (int i = -1; i <= 1; i += 2)
|
||||
{
|
||||
Texture2D sparkle = Request<Texture2D>("CalamityMod/Particles/Sparkle2").Value;
|
||||
Vector2 sparkleDraw = headDrawPosition + new Vector2(14f * i, -15f) * npc.scale;
|
||||
Color drawFade = Color.Yellow * Utils.GetLerpValue(0, 30, 60f - npc.ai[1], true);
|
||||
spriteBatch.Draw(sparkle, sparkleDraw, null, drawFade, MathHelper.Pi * 0.02f * npc.ai[1] * i, sparkle.Size() / 2f, 1.25f * npc.scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
spriteBatch.SetBlendState(BlendState.AlphaBlend);
|
||||
}
|
||||
shouldDrawBool = false;
|
||||
}
|
||||
}
|
||||
|
||||
// VHex, Mana Burn and Miracle Blight visuals do not appear if Odd Mushroom is in use for sanity reasons
|
||||
if (!Main.LocalPlayer.Calamity().trippy)
|
||||
{
|
||||
@@ -5597,389 +5342,6 @@ namespace CalamityMod.NPCs
|
||||
return shouldDrawBool;
|
||||
}
|
||||
|
||||
public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive;
|
||||
bool death = CalamityWorld.death || BossRushEvent.BossRushActive;
|
||||
|
||||
// Energy shield
|
||||
if (npc.type == NPCID.CultistBoss || npc.type == NPCID.CultistBossClone)
|
||||
{
|
||||
spriteBatch.EnterShaderRegion();
|
||||
|
||||
float intensity = newAI[1] / 35f;
|
||||
float lifeRatio = npc.type == NPCID.CultistBoss ? (npc.life / (float)npc.lifeMax) : (Main.npc[(int)npc.ai[3]].life / (float)Main.npc[(int)npc.ai[3]].lifeMax);
|
||||
|
||||
float flickerPower = 0f;
|
||||
if (lifeRatio < 0.85f)
|
||||
flickerPower += 0.1f;
|
||||
if (lifeRatio < 0.7f)
|
||||
flickerPower += 0.1f;
|
||||
if (lifeRatio < 0.55f)
|
||||
flickerPower += 0.1f;
|
||||
if (lifeRatio < 0.4f)
|
||||
flickerPower += 0.1f;
|
||||
if (lifeRatio < 0.25f)
|
||||
flickerPower += 0.1f;
|
||||
if (lifeRatio < 0.1f)
|
||||
flickerPower += 0.1f;
|
||||
|
||||
float opacity = 1f;
|
||||
opacity *= MathHelper.Lerp(MathHelper.Max(1f - flickerPower, 0.56f), 1f, (float)Math.Pow(Math.Cos(Main.GlobalTimeWrappedHourly * MathHelper.Lerp(3f, 5f, flickerPower)) * 0.5 + 0.5, 24D));
|
||||
|
||||
// Dampen the opacity and intensity slightly, to allow Cultist to be more easily visible inside of the forcefield.
|
||||
// Dampen the opacity and intensity a bit more for the Clones.
|
||||
float intensityAndOpacityMult = npc.type == NPCID.CultistBossClone ? 0.9f : 1f;
|
||||
intensity *= intensityAndOpacityMult;
|
||||
opacity *= intensityAndOpacityMult;
|
||||
|
||||
Texture2D forcefieldTexture = SupremeCalamitas.SupremeCalamitas.ForcefieldTexture.Value;
|
||||
|
||||
if (npc.type == NPCID.CultistBoss)
|
||||
GameShaders.Misc["CalamityMod:SupremeShield"].SetShaderTexture(Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/EternityStreak"));
|
||||
else
|
||||
GameShaders.Misc["CalamityMod:SupremeShield"].UseImage1("Images/Misc/noise");
|
||||
|
||||
float colorTransitionAmt = (float)Math.Pow((double)(1f - lifeRatio), 2D);
|
||||
Color forcefieldColor = Color.Lerp(Color.MediumSpringGreen, Color.Black, colorTransitionAmt);
|
||||
Color secondaryForcefieldColor = Color.Lerp(Color.Cyan, Color.Blue, colorTransitionAmt);
|
||||
|
||||
forcefieldColor *= opacity;
|
||||
secondaryForcefieldColor *= opacity;
|
||||
|
||||
GameShaders.Misc["CalamityMod:SupremeShield"].UseSecondaryColor(secondaryForcefieldColor);
|
||||
GameShaders.Misc["CalamityMod:SupremeShield"].UseColor(forcefieldColor);
|
||||
GameShaders.Misc["CalamityMod:SupremeShield"].UseSaturation(1);
|
||||
GameShaders.Misc["CalamityMod:SupremeShield"].UseOpacity(0.65f);
|
||||
GameShaders.Misc["CalamityMod:SupremeShield"].Apply();
|
||||
|
||||
// Actual Cultist has a bigger shield than the Clones.
|
||||
float shieldScale = npc.type == NPCID.CultistBossClone ? 1.65f : MathHelper.Lerp(1.65f, 3f, (float)Math.Pow((double)lifeRatio, 2D));
|
||||
spriteBatch.Draw(forcefieldTexture, npc.Center - Main.screenPosition, null, Color.White * opacity, 0f, forcefieldTexture.Size() * 0.5f, shieldScale, SpriteEffects.None, 0f);
|
||||
|
||||
spriteBatch.ExitShaderRegion();
|
||||
}
|
||||
|
||||
// Destroyer drawing and laser telegraphs
|
||||
else if (CalamityNPCTypeSets.Destroyer.Contains(npc.type) && !npc.IsABestiaryIconDummy)
|
||||
{
|
||||
Texture2D npcTexture = TextureAssets.Npc[npc.type].Value;
|
||||
Vector2 halfSize = npc.frame.Size() / 2;
|
||||
SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
Color segmentDrawColor = npc.GetAlpha(drawColor);
|
||||
|
||||
// Check if Destroyer is behind tiles and, if so, how much of the segment is behind tiles and adjust color accordingly
|
||||
int x = (int)((npc.position.X - 8f) / 16f);
|
||||
int x2 = (int)((npc.position.X + npc.width + 8f) / 16f);
|
||||
int y = (int)((npc.position.Y - 8f) / 16f);
|
||||
int y2 = (int)((npc.position.Y + npc.height + 8f) / 16f);
|
||||
for (int l = x; l <= x2; l++)
|
||||
{
|
||||
for (int m = y; m <= y2; m++)
|
||||
{
|
||||
if (Lighting.Brightness(l, m) == 0f)
|
||||
segmentDrawColor = Color.Black;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw segments
|
||||
spriteBatch.Draw(npcTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, segmentDrawColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f);
|
||||
|
||||
// Draw lights
|
||||
if (npc.ai[2] == 0f && segmentDrawColor != Color.Black)
|
||||
{
|
||||
// This life ratio is fine now because all Destroyer segments update to have the same amount of life every frame
|
||||
float destroyerLifeRatio = npc.life / (float)npc.lifeMax;
|
||||
|
||||
// Phases
|
||||
bool phase4 = destroyerLifeRatio < (death ? 0.4f : 0.25f);
|
||||
bool phase5 = destroyerLifeRatio < (death ? 0.2f : 0.1f);
|
||||
|
||||
// Spawn DR check
|
||||
bool hasSpawnDR = newAI[1] < DestroyerAI.DRIncreaseTime && newAI[1] > 60f;
|
||||
|
||||
// Gradual color transition from ground to flight and vice versa
|
||||
// 0f = Red, 1f = Purple
|
||||
float phaseTransitionColorAmount = (hasSpawnDR || phase5) ? 1f : 0f;
|
||||
if (!hasSpawnDR && !phase5)
|
||||
{
|
||||
if (newAI[3] >= DestroyerAI.GroundTelegraphStartGateValue)
|
||||
phaseTransitionColorAmount = MathHelper.Clamp(1f - (newAI[3] - DestroyerAI.GroundTelegraphStartGateValue) / DestroyerAI.PhaseTransitionTelegraphTime, 0f, 1f);
|
||||
else if (newAI[3] >= DestroyerAI.FlightTelegraphStartGateValue)
|
||||
phaseTransitionColorAmount = MathHelper.Clamp((newAI[3] - DestroyerAI.FlightTelegraphStartGateValue) / DestroyerAI.PhaseTransitionTelegraphTime, 0f, 1f);
|
||||
}
|
||||
|
||||
// Light colors
|
||||
int alpha = 192;
|
||||
Color groundColor = new Color(150, 0, 0, alpha);
|
||||
Color flightColor = revenge ? new Color(0, 0, 150, alpha) : groundColor;
|
||||
Color segmentColor = Color.Lerp(groundColor, flightColor, phaseTransitionColorAmount);
|
||||
Color telegraphColor_Red = new Color(255, 125, 125, alpha);
|
||||
Color telegraphColor_Green = new Color(125, 255, 125, alpha);
|
||||
Color telegraphColor_Cyan = new Color(0, 255, 255, alpha);
|
||||
Color telegraphColor = telegraphColor_Red;
|
||||
|
||||
// Telegraph for body lasers
|
||||
float telegraphProgress = 0f;
|
||||
if (npc.TryGetAIOverride<DestroyerAI>(out var destroyerAI) && destroyerAI.LaserColor != -1)
|
||||
{
|
||||
float shootProjectileTime = death ? (phase5 ? 180f : phase4 ? 270f : 360f) : 450f;
|
||||
float telegraphGateValue = shootProjectileTime - DestroyerAI.LaserTelegraphTime;
|
||||
if (newAI[0] > telegraphGateValue)
|
||||
{
|
||||
switch (destroyerAI.LaserColor)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
telegraphColor = telegraphColor_Green;
|
||||
break;
|
||||
case 2:
|
||||
telegraphColor = telegraphColor_Cyan;
|
||||
break;
|
||||
}
|
||||
telegraphProgress = MathHelper.Clamp((newAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
Texture2D glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.DestroyerHeadGlowmask.Value : TextureAssets.Dest[0].Value;
|
||||
switch (npc.type)
|
||||
{
|
||||
default:
|
||||
case NPCID.TheDestroyer:
|
||||
break;
|
||||
case NPCID.TheDestroyerBody:
|
||||
glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.DestroyerBodyGlowmask.Value : TextureAssets.Dest[1].Value;
|
||||
break;
|
||||
case NPCID.TheDestroyerTail:
|
||||
glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.DestroyerTailGlowmask.Value : TextureAssets.Dest[2].Value;
|
||||
break;
|
||||
}
|
||||
|
||||
float alphaMultiplier = 1f - npc.alpha / 255f;
|
||||
spriteBatch.Draw(glowTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, Color.Lerp(segmentColor, telegraphColor, telegraphProgress) * alphaMultiplier, npc.rotation, halfSize, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
// Laser telegraph
|
||||
else if (npc.type == NPCID.Probe)
|
||||
{
|
||||
float eyeTelegraphGateValue = (NPC.IsMechQueenUp ? DestroyerAI.ProbeLaserGateValue_Mechdusa : revenge ? DestroyerAI.ProbeLaserGateValue_Rev : DestroyerAI.ProbeLaserGateValue) - DestroyerAI.ProbeLaserTelegraphTime;
|
||||
Texture2D glowTexture = Request<Texture2D>("CalamityMod/Particles/Sparkle").Value;
|
||||
Vector2 halfSize = npc.frame.Size() / 2;
|
||||
|
||||
Vector2 drawPosition = npc.Center - screenPos + Vector2.UnitX.RotatedBy(npc.rotation) * (npc.width * 0.45f * npc.spriteDirection) + Vector2.UnitY * npc.gfxOffY;
|
||||
float colorScale = MathHelper.Clamp((npc.localAI[0] - eyeTelegraphGateValue) / DestroyerAI.ProbeLaserTelegraphTime, 0f, 1f);
|
||||
Color drawColor2 = new Color(255, 100, 150, 192) * colorScale;
|
||||
spriteBatch.SetBlendState(BlendState.Additive);
|
||||
spriteBatch.Draw(glowTexture, drawPosition, npc.frame, drawColor2, npc.rotation, halfSize, npc.scale * 1.1f, SpriteEffects.None, 0f);
|
||||
spriteBatch.SetBlendState(BlendState.AlphaBlend);
|
||||
}
|
||||
|
||||
if (revenge)
|
||||
{
|
||||
// Telegraph for charge and blood shots
|
||||
if (npc.type == NPCID.Creeper)
|
||||
{
|
||||
if (NPC.crimsonBoss < 0)
|
||||
return;
|
||||
|
||||
Vector2 halfSize = npc.frame.Size() / 2;
|
||||
SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
bool brainIsInPhase2 = Main.npc[NPC.crimsonBoss].ai[0] < 0f;
|
||||
if (brainIsInPhase2)
|
||||
{
|
||||
Color currentColor = npc.GetAlpha(drawColor);
|
||||
float opacity = (1f - Main.npc[NPC.crimsonBoss].life / (float)Main.npc[NPC.crimsonBoss].lifeMax) * 2f;
|
||||
opacity *= opacity;
|
||||
if (Main.getGoodWorld)
|
||||
opacity = 1f;
|
||||
|
||||
opacity = MathHelper.Clamp(opacity, 0f, 1f);
|
||||
currentColor.R = (byte)(currentColor.R * opacity);
|
||||
currentColor.G = (byte)(currentColor.G * opacity);
|
||||
currentColor.B = (byte)(currentColor.B * opacity);
|
||||
currentColor.A = (byte)(currentColor.A * opacity);
|
||||
int totalAfterimages = 4;
|
||||
for (int i = 0; i < totalAfterimages; i++)
|
||||
{
|
||||
Vector2 position = npc.position;
|
||||
float distanceFromTargetX = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X);
|
||||
float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y);
|
||||
if (i == 0 || i == 2)
|
||||
position.X = Main.LocalPlayer.Center.X + distanceFromTargetX;
|
||||
else
|
||||
position.X = Main.LocalPlayer.Center.X - distanceFromTargetX;
|
||||
|
||||
position.X -= npc.width / 2;
|
||||
if (i == 0 || i == 1)
|
||||
position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY;
|
||||
else
|
||||
position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY;
|
||||
|
||||
position.Y -= npc.height / 2;
|
||||
|
||||
int width = TextureAssets.Npc[npc.type] is null ? 0 : TextureAssets.Npc[npc.type].Width();
|
||||
int height = TextureAssets.Npc[npc.type] is null ? 0 : TextureAssets.Npc[npc.type].Height();
|
||||
spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position.X - screenPos.X + npc.width / 2 - width * npc.scale / 2f + halfSize.X * npc.scale, position.Y - screenPos.Y + (float)npc.height - (float)height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + halfSize.Y * npc.scale + npc.gfxOffY), npc.frame, currentColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
float beginTelegraphGateValue = BrainOfCthulhuAI.TimeBeforeCreeperAttack - BrainOfCthulhuAI.CreeperTelegraphTime;
|
||||
if (npc.ai[1] > beginTelegraphGateValue || npc.ai[0] == 1f)
|
||||
{
|
||||
float colorScale = npc.ai[0] == 1f ? 1f : MathHelper.Clamp((npc.ai[1] - beginTelegraphGateValue) / BrainOfCthulhuAI.CreeperTelegraphTime, 0f, 1f);
|
||||
Color drawColor2 = new Color(150, 30, 30, 0) * colorScale;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame,
|
||||
drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Telegraph for charges
|
||||
else if (npc.type == NPCID.SkeletronHead)
|
||||
{
|
||||
float beginTelegraphGateValue = SkeletronAI.ChargeGateValue - SkeletronAI.ChargeTelegraphTime;
|
||||
if (npc.localAI[1] > beginTelegraphGateValue)
|
||||
{
|
||||
float colorScale = MathHelper.Clamp((npc.localAI[1] - beginTelegraphGateValue) / SkeletronAI.ChargeTelegraphTime, 0f, 1f);
|
||||
Color drawColor2 = new Color(150, 150, 150, 0) * colorScale;
|
||||
Vector2 halfSize = npc.frame.Size() / 2;
|
||||
SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame,
|
||||
drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Telegraph for slaps
|
||||
else if (npc.type == NPCID.SkeletronHand)
|
||||
{
|
||||
float beginTelegraphGateValue = SkeletronAI.HandSlapGateValue - SkeletronAI.HandSlapTelegraphTime;
|
||||
if (newAI[2] > beginTelegraphGateValue)
|
||||
{
|
||||
float colorScale = MathHelper.Clamp((newAI[2] - beginTelegraphGateValue) / SkeletronAI.HandSlapTelegraphTime, 0f, 1f);
|
||||
Color drawColor2 = new Color(150, 150, 150, 0) * colorScale;
|
||||
Vector2 halfSize = npc.frame.Size() / 2;
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (npc.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Vector2 glowOffset = Vector2.UnitY * 8f;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY) - glowOffset, npc.frame,
|
||||
drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Laser telegraph
|
||||
else if (npc.type == NPCID.WallofFleshEye && Main.wofNPCIndex >= 0)
|
||||
{
|
||||
bool enraged = npc.localAI[3] > 0f;
|
||||
float eyeTelegraphGateValue = WallOfFleshAI.LaserShootGateValue - WallOfFleshAI.LaserShootTelegraphTime;
|
||||
if (npc.localAI[1] > eyeTelegraphGateValue || npc.localAI[2] > 0f || enraged)
|
||||
{
|
||||
Texture2D glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.WallOfFleshEyeGlowmask.Value : TextureAssets.Npc[npc.type].Value;
|
||||
Vector2 halfSize = npc.frame.Size() / 2;
|
||||
SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
float colorScale = enraged ? MathHelper.Clamp(npc.localAI[3] / WallOfFleshAI.EnragedLaserFiringDuration, 0f, 1f) :
|
||||
npc.localAI[2] > 0f ? 1f - ((npc.localAI[2] - 1f) / WallOfFleshAI.TotalLasersPerBarrage) :
|
||||
MathHelper.Clamp((npc.localAI[1] - eyeTelegraphGateValue) / WallOfFleshAI.LaserShootTelegraphTime, 0f, 1f);
|
||||
|
||||
Color drawColor2 = new Color(100, 0, 200, 192) * colorScale;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
spriteBatch.Draw(glowTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame,
|
||||
drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (npc.type == NPCID.Plantera)
|
||||
{
|
||||
// Percent life remaining
|
||||
float lifeRatio = npc.life / (float)npc.lifeMax;
|
||||
Texture2D npcTexture = TextureAssets.Npc[npc.type].Value;
|
||||
SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
Color originalColor = npc.GetAlpha(drawColor);
|
||||
Color newColor = new Color(100, 255, 100, 255);
|
||||
Vector2 glowOffset = Vector2.UnitY * -4f;
|
||||
Vector2 drawPosition = npc.Center - screenPos + new Vector2(0, npc.gfxOffY) + glowOffset;
|
||||
Vector2 origin = npc.frame.Size() / 2;
|
||||
|
||||
bool phase2 = lifeRatio <= 0.5f;
|
||||
if (!phase2)
|
||||
{
|
||||
float telegraphTimer = Math.Abs(npc.ai[1]);
|
||||
bool startSeedGatlingSporeGasTelegraph = npc.ai[1] > PlanteraAI.SeedGatlingColorChangeGateValue;
|
||||
bool endSeedGatlingSporeGasTelegraph = npc.ai[1] < -PlanteraAI.SeedGatlingDuration + PlanteraAI.SeedGatlingColorChangeDuration;
|
||||
if (startSeedGatlingSporeGasTelegraph)
|
||||
{
|
||||
float telegraphScalar = MathHelper.Clamp((telegraphTimer - PlanteraAI.SeedGatlingColorChangeGateValue) / PlanteraAI.SeedGatlingColorChangeDuration, 0f, 1f);
|
||||
Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar);
|
||||
spriteBatch.Draw(npcTexture, drawPosition, npc.frame, telegraphColor, npc.rotation, origin, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
// -300 to -120
|
||||
else if (endSeedGatlingSporeGasTelegraph)
|
||||
{
|
||||
float telegraphScalar = MathHelper.Clamp((telegraphTimer - (PlanteraAI.SeedGatlingDuration - PlanteraAI.SeedGatlingColorChangeDuration)) / PlanteraAI.SeedGatlingColorChangeDuration, 0f, 1f);
|
||||
Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar);
|
||||
spriteBatch.Draw(npcTexture, drawPosition, npc.frame, telegraphColor, npc.rotation, origin, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float telegraphTimer = Math.Abs(npc.ai[3]);
|
||||
bool startChargeTelegraph = npc.ai[3] > PlanteraAI.ChargeTelegraphColorChangeGateValue;
|
||||
bool endChargeTelegraph = npc.ai[3] <= -2f;
|
||||
if (startChargeTelegraph)
|
||||
{
|
||||
float telegraphScalar = MathHelper.Clamp((telegraphTimer - PlanteraAI.ChargeTelegraphColorChangeGateValue) / PlanteraAI.SeedGatlingColorChangeDuration, 0f, 1f);
|
||||
Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar);
|
||||
spriteBatch.Draw(npcTexture, drawPosition, npc.frame, telegraphColor, npc.rotation, origin, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
// -195 to -2
|
||||
else if (endChargeTelegraph)
|
||||
{
|
||||
float telegraphScalar = MathHelper.Clamp((Math.Abs(PlanteraAI.StopChargeGateValue) - telegraphTimer) / Math.Abs(PlanteraAI.StopChargeGateValue), 0f, 1f);
|
||||
Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar);
|
||||
|
||||
if (CalamityClientConfig.Instance.Afterimages)
|
||||
{
|
||||
int afterimageAmount = 10;
|
||||
int afterImageIncrement = 2;
|
||||
for (int j = 0; j < afterimageAmount; j += afterImageIncrement)
|
||||
{
|
||||
Color afterimageColor = telegraphColor;
|
||||
afterimageColor = Color.Lerp(afterimageColor, originalColor, 0.5f);
|
||||
afterimageColor = npc.GetAlpha(afterimageColor);
|
||||
afterimageColor *= (afterimageAmount - j) / 15f;
|
||||
Vector2 afterimagePos = npc.oldPos[j] + new Vector2(npc.width, npc.height) / 2f - screenPos;
|
||||
afterimagePos -= new Vector2(npcTexture.Width, npcTexture.Height / Main.npcFrameCount[npc.type]) * npc.scale / 2f;
|
||||
afterimagePos += origin * npc.scale + new Vector2(0f, npc.gfxOffY) + glowOffset;
|
||||
spriteBatch.Draw(npcTexture, afterimagePos, npc.frame, afterimageColor, npc.rotation, origin, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
spriteBatch.Draw(npcTexture, drawPosition, npc.frame, telegraphColor, npc.rotation, origin, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Color buffColor(Color newColor, float R, float G, float B, float A)
|
||||
{
|
||||
newColor.R = (byte)((float)newColor.R * R);
|
||||
|
||||
@@ -31,6 +31,7 @@ using Terraria.Audio;
|
||||
using Terraria.GameContent.ItemDropRules;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static CalamityMod.NPCs.CalamityGlobalTownNPC;
|
||||
|
||||
namespace CalamityMod.NPCs
|
||||
{
|
||||
@@ -699,7 +700,7 @@ namespace CalamityMod.NPCs
|
||||
case NPCID.Drippler:
|
||||
postEoC.Add(ModContent.ItemType<BloodOrb>(), 4);
|
||||
break;
|
||||
|
||||
|
||||
//Hardmode enemies drop orbs even if EoC is not dead
|
||||
//99% of players will not encounter this and challenge runners will appreciate it
|
||||
case NPCID.Clown:
|
||||
@@ -1701,12 +1702,12 @@ namespace CalamityMod.NPCs
|
||||
}
|
||||
}
|
||||
catch (ArgumentNullException) { }
|
||||
DukeEditFailed:
|
||||
DukeEditFailed:
|
||||
|
||||
// 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic
|
||||
// npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.ShrimpyTruffle));
|
||||
// 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic
|
||||
// npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.ShrimpyTruffle));
|
||||
|
||||
// Would be in the bag otherwise
|
||||
// Would be in the bag otherwise
|
||||
npcLoot.AddNormalOnly(ModContent.ItemType<BrinyBaron>(), 10);
|
||||
npcLoot.AddNormalOnly(ModContent.ItemType<ThankYouPainting>(), ThankYouPainting.DropInt);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.NPCs
|
||||
{
|
||||
public partial class CalamityGlobalNPC : GlobalNPC
|
||||
public class CalamityGlobalTownNPC : GlobalNPC
|
||||
{
|
||||
public static float TaxYieldFactor
|
||||
{
|
||||
@@ -62,16 +62,42 @@ namespace CalamityMod.NPCs
|
||||
// Vanilla: 25 gold
|
||||
public static int TaxesToCollectLimit => (int)(Item.buyPrice(gold: 50) * TaxYieldFactor);
|
||||
|
||||
|
||||
/// <summary> Used for allowing Patreon names for Town NPCs. </summary>
|
||||
public bool setNewName = true;
|
||||
/// <summary> Used to control the animation of the Town NPC Shop Alert icon, if the respective config is enabled. </summary>
|
||||
public int shopAlertAnimTimer = 0;
|
||||
/// <summary> <inheritdoc cref="shopAlertAnimTimer"/> </summary>
|
||||
public int shopAlertAnimFrame = 0;
|
||||
|
||||
public override bool InstancePerEntity => true;
|
||||
|
||||
public override bool AppliesToEntity(NPC entity, bool lateInstantiation)
|
||||
{
|
||||
return entity.isLikeATownNPC;
|
||||
}
|
||||
|
||||
public override GlobalNPC Clone(NPC npc, NPC npcClone)
|
||||
{
|
||||
CalamityGlobalTownNPC myClone = (CalamityGlobalTownNPC)base.Clone(npc, npcClone);
|
||||
|
||||
myClone.setNewName = setNewName;
|
||||
myClone.shopAlertAnimTimer = shopAlertAnimTimer;
|
||||
myClone.shopAlertAnimFrame = shopAlertAnimFrame;
|
||||
|
||||
return myClone;
|
||||
}
|
||||
|
||||
#region Town NPC Patreon Name Sets
|
||||
private static readonly string[] AnglerNames =
|
||||
{
|
||||
[
|
||||
"Dazren",
|
||||
"Johnny Test", // <@!589966747977777197> (konorango)
|
||||
"Bling Bling Boy", // <@!522970788203069442> (phallguy)
|
||||
"RICE", // <@!400107830889152524> (rice_xd.)
|
||||
};
|
||||
];
|
||||
private static readonly string[] ArmsDealerNames =
|
||||
{
|
||||
[
|
||||
"Finchi",
|
||||
"Heniek", // <@!363404700445442050> (kazurgundu)
|
||||
"Fire", // <@!354362326947856384> (ultimatefirewaster)
|
||||
@@ -81,37 +107,37 @@ namespace CalamityMod.NPCs
|
||||
"The Cooler Arthur", // <@!568263512523014154> (gokuartillery)
|
||||
"Shark", // <@!874464051697172492> (congratsistrash)
|
||||
"Sagi", // <@!508233115781693441> (sagittariod)
|
||||
};
|
||||
];
|
||||
private static readonly string[] ClothierNames =
|
||||
{
|
||||
[
|
||||
"Joeseph Jostar",
|
||||
"Storm Havik", // <@!1013452363178197072> (fishnotduck)
|
||||
"Magorfis Splunt the Greater Finklejim", // <@!147490809334333440> (eidolbyssus)
|
||||
"Perrin", // <@!253764551139393537> (easyperrin)
|
||||
};
|
||||
];
|
||||
private static readonly string[] CyborgNames =
|
||||
{
|
||||
[
|
||||
"Sylux", // <@!331812782183809025> (gonkachino)
|
||||
"Nemesis", // <@!1104036024063107082> (yashimayamanata)
|
||||
};
|
||||
];
|
||||
private static readonly string[] DemolitionistNames =
|
||||
{
|
||||
[
|
||||
"Tavish DeGroot", // <@!442447226992721930> (magicoal)
|
||||
"Fimmy", // <@!407348617079160832> (darkmega5)
|
||||
"John Helldiver", // <@!614126424751603714> (exellent.)
|
||||
};
|
||||
];
|
||||
private static readonly string[] DryadNames =
|
||||
{
|
||||
[
|
||||
"Rythmi",
|
||||
"Izuna",
|
||||
"Jasmine", // <@!430532867479699456> (phantasmagoria.)
|
||||
"Cybil", // <@!486507232666845185> (Captain Doofus#????)
|
||||
"Ruth", // <@!1001307586068492388> (briny_coffee)
|
||||
"Kanna", // <@!730203712898859018> (cosmoredeathwish)
|
||||
};
|
||||
];
|
||||
private static readonly string[] DyeTraderNames = null;
|
||||
private static readonly string[] GoblinTinkererNames =
|
||||
{
|
||||
[
|
||||
"Verth",
|
||||
"Gormer", // <@!287651204924833795> (picassosbean2819 -- RIP)
|
||||
"TingFlarg", // <@!185605031716847616> (smugggo)
|
||||
@@ -125,10 +151,10 @@ namespace CalamityMod.NPCs
|
||||
"Bars Boldia", // <@!332989575708540939> (careless_imp)
|
||||
"Basel Raiden John Clive Fantasy 16", // <@!529392083136413696> (raiden_ii)
|
||||
"Gobby, Destroyer of Wallets", // <@!429024941296582658> (bwlstorm)
|
||||
};
|
||||
];
|
||||
private static readonly string[] GolferNames = null;
|
||||
private static readonly string[] GuideNames =
|
||||
{
|
||||
[
|
||||
"Lapp",
|
||||
"Ben Shapiro",
|
||||
"Streakist", // used to be "StreakistYT". couldn't find the youtube channel, and decided to remove the ad.
|
||||
@@ -147,39 +173,39 @@ namespace CalamityMod.NPCs
|
||||
"Dinkleberg", // <@!581993958037520404> (hyperionzx)
|
||||
"Wamy", // Fab added this name with no Discord ID. May be a donor who has no Discord account.
|
||||
"Baggute", // <@!535140564174110720> (thebaggutegamer)
|
||||
};
|
||||
];
|
||||
private static readonly string[] MechanicNames =
|
||||
{
|
||||
[
|
||||
"Lilly",
|
||||
"Daawn", // <@!206162323541458944> (daawnily)
|
||||
"Robin", // <@!654737510030639112> (altzeus)
|
||||
"Curly", // <@!673092101780668416> (curly4830)
|
||||
"Cobalt", // <@!132962828922388481> (cobalt_44)
|
||||
};
|
||||
];
|
||||
private static readonly string[] MerchantNames =
|
||||
{
|
||||
[
|
||||
"Morshu", // <@!194931581826236416> (uberransy)
|
||||
"Spamton G. Spamton", // <@!497146350438318101> (j.u.n.e.s)
|
||||
};
|
||||
];
|
||||
private static readonly string[] NurseNames =
|
||||
{
|
||||
[
|
||||
"Farsni",
|
||||
"Fanny", // <@!799749125720637460> (zombiewolf511)
|
||||
"Mausi", // <@!194156349347594241> (sadouken)
|
||||
"Fiona", // <@!475216964168450048> (thatgayguy69)
|
||||
};
|
||||
];
|
||||
private static readonly string[] PainterNames =
|
||||
{
|
||||
[
|
||||
"Picasso", // <@!353316526306361347> (sconicboom -- for the late picassosbean2819)
|
||||
"Bew", // <@!232291351167893505> (dmshi)
|
||||
};
|
||||
];
|
||||
private static readonly string[] PartyGirlNames =
|
||||
{
|
||||
[
|
||||
"Arin", // <@!268169458302976012> (kiyotu)
|
||||
"Typhäne", // <@!222064016107896832> (typhane.)
|
||||
};
|
||||
];
|
||||
private static readonly string[] PirateNames =
|
||||
{
|
||||
[
|
||||
"Tyler Van Hook",
|
||||
"Cap'n Deek", // "Alex N" on Patreon (No discord account)
|
||||
"Captain Billy Bones", // <@!699589229507772416> (djackv)
|
||||
@@ -188,9 +214,9 @@ namespace CalamityMod.NPCs
|
||||
"Yarrim", // <@!290061123137306624> (borb9834)
|
||||
"Hector Barbossa", // <@!615704209303797790> (thatrockisfullamagic)
|
||||
"Blunderbeard", // <@!1039460813490102293> (parmiigianoreggiano)
|
||||
};
|
||||
];
|
||||
private static readonly string[] PrincessNames =
|
||||
{
|
||||
[
|
||||
"Nyapano", // <@!120976656826368003> (nyapano)
|
||||
"Jade", // <@!187395834625785869> (verymasterninja)
|
||||
"Nyavi Aceso", // <@!270260920888852480> (navigator.)
|
||||
@@ -199,21 +225,21 @@ namespace CalamityMod.NPCs
|
||||
"Hael", // <@!641747280944431156> (kalebtull)
|
||||
"Yumesaki Mirrin", // <@!100235144744415232> (milinen)
|
||||
"Vela", // <@!208719047146209281> (nyxxynightstar)
|
||||
};
|
||||
];
|
||||
private static readonly string[] SantaClausNames =
|
||||
{
|
||||
[
|
||||
"Jank", // <@!339950757472239616> (jankle_)
|
||||
"Aoi Kurashiki", // <@!358411687885537291> (nothinpurrsonal)
|
||||
};
|
||||
];
|
||||
private static readonly string[] SkeletonMerchantNames =
|
||||
{
|
||||
[
|
||||
"Sans Undertale", // <@!534770496038895616> (done_22_)
|
||||
"Papyrus Undertale", // <@!262663471189983242> (nycro)
|
||||
"Mr. Bones", // <@!359215912856977408> (jaybones.)
|
||||
"Freakbob", // <@!377863128140087296> (jevilamv)
|
||||
};
|
||||
];
|
||||
private static readonly string[] SteampunkerNames =
|
||||
{
|
||||
[
|
||||
"Vorbis",
|
||||
"Angel",
|
||||
"Mòrag Ladair", // <@!161893929485074432> (jalapeno9)
|
||||
@@ -222,51 +248,51 @@ namespace CalamityMod.NPCs
|
||||
"Kreutz", // <@!553445849149997056> (red_r_kreutz)
|
||||
"Cathlyn", // <@!156672312425316352> (xaqult)
|
||||
"Eunice", // <@!358376627400605699> (srmg267)
|
||||
};
|
||||
];
|
||||
private static readonly string[] StylistNames =
|
||||
{
|
||||
[
|
||||
"Amber", // <@!114677116473180169> (mishirousui)
|
||||
"Faith", // <@!509050283871961123> (toasty1007)
|
||||
"Xsiana", // <@!625780237489143839> (lokistic)
|
||||
"Lain", // <@!655201622863118337> (literallyadeerfr)
|
||||
"Hamis", // <@!608455754093035521> (haefer)
|
||||
"Brio Scarlet", // <@!358576903701004289> (brio_scarlet)
|
||||
};
|
||||
];
|
||||
private static readonly string[] TavernkeepNames =
|
||||
{
|
||||
[
|
||||
"Tim Lockwood", // <@!605839945483026434> (pomvoid)
|
||||
"Sir Samuel Winchester Jenkins Kester II", // <@!107659695749070848> (ryaegos)
|
||||
"Brutus", // <@!591889650692521984> (.brutus._)
|
||||
"Sloth", // <@!486265327387279391> (bossypunch)
|
||||
};
|
||||
];
|
||||
private static readonly string[] TaxCollectorNames =
|
||||
{
|
||||
[
|
||||
"Emmett",
|
||||
"Casino King Gray", // <@!555512087711973390> (eternalgrayson)
|
||||
};
|
||||
];
|
||||
private static readonly string[] TravelingMerchantNames =
|
||||
{
|
||||
[
|
||||
"Stan Pines",
|
||||
"Intergaze", // <@!923504188615450654> (intergaze)
|
||||
"Borgus", // <@!539127427482255376> (therealmeepman)
|
||||
"Postman Hiss", // <@!454638106122125312> (karinthefairy)
|
||||
};
|
||||
];
|
||||
private static readonly string[] TruffleNames =
|
||||
{
|
||||
[
|
||||
"Aldrimil", // <@!413719640238194689> (Thorioum#2475)
|
||||
"Wonton", // <@!1198092982923043040> (imonthatgudkush)
|
||||
"Mad Lad", // <@!215269032360804352> (crimsoncb)
|
||||
"Nokko", // <@!706732954079985745> (violet.prime)
|
||||
};
|
||||
];
|
||||
private static readonly string[] WitchDoctorNames =
|
||||
{
|
||||
[
|
||||
"Sok'ar",
|
||||
"Aeroni", // <@!348174404984766465> (aeroni) (previously: toxin)
|
||||
"Mixcoatl", // <@!284775927294984203> (.sharzz)
|
||||
"Amnesia Wapers", // <@!326821498323075073> (retardedadvicefromaretard)
|
||||
};
|
||||
];
|
||||
private static readonly string[] WizardNames =
|
||||
{
|
||||
[
|
||||
"Inorim, son of Ivukey",
|
||||
"Jensen",
|
||||
"Merasmus", // <@!288066987819663360> (spiderprovidence)
|
||||
@@ -277,16 +303,16 @@ namespace CalamityMod.NPCs
|
||||
"Nextdoor Psycho", // <@!173261518572486656> (nextdoorpsycho)
|
||||
"Mike Cyclops", // <@!702327497475227741> (seichoseicho)
|
||||
"Derin", // <@!466703979695308820> (god_15)
|
||||
};
|
||||
];
|
||||
private static readonly string[] ZoologistNames =
|
||||
{
|
||||
[
|
||||
"Kiriku", // <@!395312478160027668> (rulosss)
|
||||
"Lacuna", // <@!790746689211203604> (_lacuna_)
|
||||
"Mae Borowski", //<@!219158690433990656> (justakkolite)
|
||||
"Fera", // <@!195850711567826945> (juneark_)
|
||||
"Gwenhwyvar", // <@!291342874497515531> (diamondnife)
|
||||
"Daxie", // <@!465438861103988737> (daxie626)
|
||||
};
|
||||
];
|
||||
// Town Slimes
|
||||
private static readonly string[] ClumsySlimeNames = null;
|
||||
private static readonly string[] CoolSlimeNames = null;
|
||||
@@ -294,10 +320,10 @@ namespace CalamityMod.NPCs
|
||||
private static readonly string[] ElderSlimeNames = null;
|
||||
private static readonly string[] MysticSlimeNames = null;
|
||||
private static readonly string[] NerdySlimeNames =
|
||||
{
|
||||
[
|
||||
"Big Blungus", // <@!272759434282008577> (schmoov)
|
||||
"Rimuru Tempest", // <@!806463201398358036> (c0d3_404)
|
||||
};
|
||||
];
|
||||
private static readonly string[] SquireSlimeNames = null;
|
||||
private static readonly string[] SurlySlimeNames = null;
|
||||
|
||||
@@ -312,29 +338,29 @@ namespace CalamityMod.NPCs
|
||||
private const int TownDogDalmatianVanillaNames = 13;
|
||||
private const int TownDogHuskyVanillaNames = 16;
|
||||
private static readonly string[] TownDogNames =
|
||||
{
|
||||
[
|
||||
"Ozymandias", // <@!146333264871686145> (ozzatron)
|
||||
"Miss Throws a Lot", // <@!799345607847182400> (oakhamsam)
|
||||
"Brikwilla", // <@!543803736909414438> (lavendercobra)
|
||||
};
|
||||
];
|
||||
private static readonly string[] TownDogLabradorNames =
|
||||
{
|
||||
[
|
||||
"Riley", // <@!260875558592708619> (potionpal)
|
||||
};
|
||||
];
|
||||
private static readonly string[] TownDogPitBullNames =
|
||||
{
|
||||
[
|
||||
"Splinter", // <@!320320801213775873> (kaimonick)
|
||||
};
|
||||
];
|
||||
private static readonly string[] TownDogBeagleNames =
|
||||
{
|
||||
[
|
||||
"Kendra", // <@!237247188005158912> (lordmetarex)
|
||||
};
|
||||
];
|
||||
private static readonly string[] TownDogCorgiNames = null;
|
||||
private static readonly string[] TownDogDalmatianNames = null;
|
||||
private static readonly string[] TownDogHuskyNames =
|
||||
{
|
||||
[
|
||||
"Yoshi", // <@!541127291426832384> (gregthespinarak)
|
||||
};
|
||||
];
|
||||
|
||||
private const int TownCatSiameseVanillaNames = 12;
|
||||
private const int TownCatBlackVanillaNames = 23;
|
||||
@@ -343,34 +369,34 @@ namespace CalamityMod.NPCs
|
||||
private const int TownCatSilverVanillaNames = 17;
|
||||
private const int TownCatWhiteVanillaNames = 15;
|
||||
private static readonly string[] TownCatNames =
|
||||
{
|
||||
[
|
||||
"Smoogle", // <@!709968379334623274> (smooglin)
|
||||
"The Meowurer of Gods", // <@!385949114271268864> (thatgp)
|
||||
"Katsafaros", // <@!190595401328492544> (gr_mm)
|
||||
"Lucerne", // <@!271954788676141066> (lord_lucerne)
|
||||
"Milo", // <@!401849201597874179> (maskedmilo)
|
||||
"Octo", // <@!796112889353994281> (octolinggrimm)
|
||||
};
|
||||
];
|
||||
private static readonly string[] TownCatSiameseNames = null;
|
||||
private static readonly string[] TownCatBlackNames =
|
||||
{
|
||||
[
|
||||
"Bear", // <@!183424826407518208> (lilac_vrt_olligoci)
|
||||
"Storm", // <@!620383533516718085> (airwaveslr)
|
||||
"Hognar the Wicked", // <@!766511001356468237> (xzier_tengal)
|
||||
};
|
||||
];
|
||||
private static readonly string[] TownCatOrangeTabbyNames =
|
||||
{
|
||||
[
|
||||
"Felix", // <@!183424826407518208> (lilac_vrt_olligoci)
|
||||
"Tardo", // <@!739343546867384391> (midnight295)
|
||||
"Dali", // <@!460238880436781061> (darthlego)
|
||||
"Kiba", // <@!852348657072340992> (jollydragonslayer)
|
||||
};
|
||||
];
|
||||
private static readonly string[] TownCatRussianBlueNames = null;
|
||||
private static readonly string[] TownCatSilverNames =
|
||||
{
|
||||
[
|
||||
"Archie", // <@!303022375191183360> (jackshiz)
|
||||
"Hognar the Wicked", // <@!766511001356468237> (xzier_tengal)
|
||||
};
|
||||
];
|
||||
private static readonly string[] TownCatWhiteNames = null;
|
||||
|
||||
private const int TownBunnyWhiteVanillaNames = 14;
|
||||
@@ -380,10 +406,10 @@ namespace CalamityMod.NPCs
|
||||
private const int TownBunnyLopVanillaNames = 13;
|
||||
private const int TownBunnySilverVanillaNames = 13;
|
||||
private static readonly string[] TownBunnyNames =
|
||||
{
|
||||
[
|
||||
"Poco", // <@!1192261996146593872> (tostitomuncher33)
|
||||
"Puffer", // <@!181103507711983616> (piky)
|
||||
};
|
||||
];
|
||||
private static readonly string[] TownBunnyWhiteNames = null;
|
||||
private static readonly string[] TownBunnyAngoraNames = null;
|
||||
private static readonly string[] TownBunnyDutchNames = null;
|
||||
@@ -733,6 +759,29 @@ namespace CalamityMod.NPCs
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region SetDefaults
|
||||
public override void SetDefaults(NPC npc)
|
||||
{
|
||||
BoundNPCSafety(Mod, npc);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PreAI
|
||||
public override bool PreAI(NPC npc)
|
||||
{
|
||||
SetPatreonTownNPCName(npc, Mod);
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PreDraw
|
||||
public override bool PreDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
TownNPCAlertSystem(npc, Mod, spriteBatch);
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region NPC New Shop Alert
|
||||
|
||||
public static List<(int, Predicate<Player>, Action<Player, bool>)> npcAlertList = new List<(int, Predicate<Player>, Action<Player, bool>)>()
|
||||
@@ -895,7 +944,7 @@ namespace CalamityMod.NPCs
|
||||
chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.DarksunEclipse");
|
||||
else if (Main.rand.NextBool(5) && Main.LocalPlayer.ZoneGlowshroom)
|
||||
{
|
||||
chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.Mushroom");
|
||||
chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.Mushroom");
|
||||
}
|
||||
else if (Main.rand.NextBool(5) && Main.LocalPlayer.Calamity().ZoneSulphur)
|
||||
chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.SulphurSea");
|
||||
|
||||
@@ -0,0 +1,359 @@
|
||||
using System;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.ExtraTextures;
|
||||
using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses;
|
||||
using CalamityMod.Systems.Collections;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs;
|
||||
|
||||
public sealed partial class CalamityVanillaAIOverrideNPC : GlobalNPC
|
||||
{
|
||||
private static bool GlobalPreAI(NPC npc)
|
||||
{
|
||||
var calNPC = npc.GetGlobalNPC<CalamityGlobalNPC>();
|
||||
|
||||
// Don't do damage for 42 frames after spawning in
|
||||
if (npc.type == NPCID.Sharkron || npc.type == NPCID.Sharkron2)
|
||||
npc.damage = npc.alpha > 0 ? 0 : npc.defDamage;
|
||||
|
||||
// Servant of Cthulhu light
|
||||
if (npc.type == NPCID.ServantofCthulhu)
|
||||
Lighting.AddLight(npc.Center, 0.2f, 0.2f, 0.2f);
|
||||
|
||||
if (npc.type == NPCID.CultistBoss)
|
||||
{
|
||||
// Emit light
|
||||
float lifeRatio = npc.life / (float)npc.lifeMax;
|
||||
float colorTransitionAmt = (float)Math.Pow((double)(1f - lifeRatio), 2D);
|
||||
Color lightColor = Color.Lerp(Color.Cyan, Color.Blue, colorTransitionAmt);
|
||||
Lighting.AddLight(npc.Center, lightColor.R / 255f, lightColor.G / 255f, lightColor.B / 255f);
|
||||
|
||||
// Decrement the hit counter for the shield flicker
|
||||
if (calNPC.newAI[1] > 0f)
|
||||
calNPC.newAI[1] -= 1f;
|
||||
|
||||
// Cultist shield hitbox
|
||||
Vector2 hitboxSize = new Vector2(216f / 1.4142f);
|
||||
if (npc.Size != hitboxSize)
|
||||
npc.Size = hitboxSize;
|
||||
}
|
||||
if (npc.type == NPCID.CultistBossClone)
|
||||
{
|
||||
if (Main.npc[(int)npc.ai[3]].active)
|
||||
{
|
||||
// Emit light
|
||||
float lifeRatio = Main.npc[(int)npc.ai[3]].life / (float)Main.npc[(int)npc.ai[3]].lifeMax;
|
||||
float colorTransitionAmt = (float)Math.Pow((double)(1f - lifeRatio), 2D);
|
||||
Color lightColor = Color.Lerp(Color.Cyan, Color.Blue, colorTransitionAmt);
|
||||
Lighting.AddLight(npc.Center, lightColor.R / 255f, lightColor.G / 255f, lightColor.B / 255f);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void GlobalAI(NPC npc)
|
||||
{
|
||||
// Fair contact damage
|
||||
switch (npc.type)
|
||||
{
|
||||
case NPCID.DD2Betsy:
|
||||
npc.damage = npc.ai[0] == 2f ? npc.defDamage : 0;
|
||||
break;
|
||||
|
||||
case NPCID.DD2WyvernT1:
|
||||
case NPCID.DD2WyvernT2:
|
||||
case NPCID.DD2WyvernT3:
|
||||
npc.damage = npc.ai[0] == 2f ? npc.defDamage : 0;
|
||||
break;
|
||||
|
||||
case NPCID.Mothron:
|
||||
npc.damage = npc.ai[0] == 3.2f ? (int)Math.Round(npc.defDamage * 1.3) : npc.ai[0] == 2f ? (int)Math.Round(npc.defDamage * 0.5) : 0;
|
||||
break;
|
||||
|
||||
case NPCID.MothronSpawn:
|
||||
npc.damage = npc.ai[0] == 2.1f ? npc.defDamage : 0;
|
||||
break;
|
||||
|
||||
case NPCID.Mimic:
|
||||
case NPCID.IceMimic:
|
||||
case NPCID.PresentMimic:
|
||||
npc.damage = (npc.ai[0] == 0f || npc.velocity.Y == 0f) ? 0 : npc.defDamage;
|
||||
break;
|
||||
|
||||
case NPCID.BigMimicCorruption:
|
||||
case NPCID.BigMimicCrimson:
|
||||
case NPCID.BigMimicHallow:
|
||||
case NPCID.BigMimicJungle:
|
||||
npc.damage = npc.ai[0] == 3f ? 0 : npc.defDamage;
|
||||
|
||||
// Spend less time in closed state
|
||||
if (npc.ai[0] == 3f)
|
||||
npc.ai[1] += 0.5f;
|
||||
|
||||
break;
|
||||
|
||||
case NPCID.MartianDrone:
|
||||
case NPCID.SolarCorite:
|
||||
npc.damage = (npc.ai[0] == 2f || npc.ai[0] == 3f) ? npc.defDamage : 0;
|
||||
break;
|
||||
|
||||
case NPCID.GraniteFlyer:
|
||||
npc.damage = npc.ai[0] == -1f ? 0 : npc.defDamage;
|
||||
break;
|
||||
|
||||
case NPCID.GraniteGolem:
|
||||
npc.damage = npc.ai[2] < 0f ? 0 : npc.defDamage;
|
||||
break;
|
||||
|
||||
case NPCID.BlueSlime:
|
||||
case NPCID.MotherSlime:
|
||||
case NPCID.LavaSlime:
|
||||
case NPCID.DungeonSlime:
|
||||
case NPCID.CorruptSlime:
|
||||
case NPCID.IlluminantSlime:
|
||||
case NPCID.ToxicSludge:
|
||||
case NPCID.IceSlime:
|
||||
case NPCID.Crimslime:
|
||||
case NPCID.UmbrellaSlime:
|
||||
case NPCID.RainbowSlime:
|
||||
case NPCID.SlimeMasked:
|
||||
case NPCID.HoppinJack:
|
||||
case NPCID.SlimeRibbonWhite:
|
||||
case NPCID.SlimeRibbonYellow:
|
||||
case NPCID.SlimeRibbonGreen:
|
||||
case NPCID.SlimeRibbonRed:
|
||||
case NPCID.SandSlime:
|
||||
case NPCID.GoldenSlime:
|
||||
case NPCID.ShimmerSlime:
|
||||
case NPCID.GreenSlime:
|
||||
case NPCID.RedSlime:
|
||||
case NPCID.PurpleSlime:
|
||||
case NPCID.YellowSlime:
|
||||
case NPCID.BlackSlime:
|
||||
case NPCID.JungleSlime:
|
||||
case NPCID.BabySlime:
|
||||
case NPCID.Pinky:
|
||||
case NPCID.Slimeling:
|
||||
case NPCID.Slimer2:
|
||||
npc.damage = (npc.velocity.Y == 0f || npc.velocity.Length() < 3f) ? 0 : npc.defDamage;
|
||||
break;
|
||||
|
||||
case NPCID.GiantShelly:
|
||||
case NPCID.GiantShelly2:
|
||||
npc.damage = npc.ai[0] == 3f ? (int)Math.Round(npc.defDamage * 1.2) : 0;
|
||||
break;
|
||||
|
||||
case NPCID.GiantTortoise:
|
||||
case NPCID.IceTortoise:
|
||||
npc.damage = npc.ai[0] == 3f ? (int)Math.Round(npc.defDamage * 1.4) : 0;
|
||||
break;
|
||||
|
||||
case NPCID.SolarSroller:
|
||||
npc.damage = npc.ai[0] == 6f ? (int)Math.Round(npc.defDamage * 1.2) : 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool GlobalPreDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
var calNPC = npc.GetGlobalNPC<CalamityGlobalNPC>();
|
||||
bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive;
|
||||
bool death = CalamityWorld.death || BossRushEvent.BossRushActive;
|
||||
|
||||
// Destroyer drawing and laser telegraphs
|
||||
if (CalamityNPCTypeSets.Destroyer.Contains(npc.type) && !npc.IsABestiaryIconDummy)
|
||||
{
|
||||
Texture2D npcTexture = TextureAssets.Npc[npc.type].Value;
|
||||
Vector2 halfSize = npc.frame.Size() / 2;
|
||||
SpriteEffects spriteEffects = npc.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
Color segmentDrawColor = npc.GetAlpha(drawColor);
|
||||
|
||||
// Check if Destroyer is behind tiles and, if so, how much of the segment is behind tiles and adjust color accordingly
|
||||
int x = (int)((npc.position.X - 8f) / 16f);
|
||||
int x2 = (int)((npc.position.X + npc.width + 8f) / 16f);
|
||||
int y = (int)((npc.position.Y - 8f) / 16f);
|
||||
int y2 = (int)((npc.position.Y + npc.height + 8f) / 16f);
|
||||
for (int l = x; l <= x2; l++)
|
||||
{
|
||||
for (int m = y; m <= y2; m++)
|
||||
{
|
||||
if (Lighting.Brightness(l, m) == 0f)
|
||||
segmentDrawColor = Color.Black;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw segments
|
||||
spriteBatch.Draw(npcTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, segmentDrawColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f);
|
||||
|
||||
// Draw lights
|
||||
if (npc.ai[2] == 0f && segmentDrawColor != Color.Black)
|
||||
{
|
||||
// This life ratio is fine now because all Destroyer segments update to have the same amount of life every frame
|
||||
float destroyerLifeRatio = npc.life / (float)npc.lifeMax;
|
||||
|
||||
// Phases
|
||||
bool phase4 = destroyerLifeRatio < (death ? 0.4f : 0.25f);
|
||||
bool phase5 = destroyerLifeRatio < (death ? 0.2f : 0.1f);
|
||||
|
||||
// Spawn DR check
|
||||
bool hasSpawnDR = calNPC.newAI[1] < DestroyerAI.DRIncreaseTime && calNPC.newAI[1] > 60f;
|
||||
|
||||
// Gradual color transition from ground to flight and vice versa
|
||||
// 0f = Red, 1f = Purple
|
||||
float phaseTransitionColorAmount = (hasSpawnDR || phase5) ? 1f : 0f;
|
||||
if (!hasSpawnDR && !phase5)
|
||||
{
|
||||
if (calNPC.newAI[3] >= DestroyerAI.GroundTelegraphStartGateValue)
|
||||
phaseTransitionColorAmount = MathHelper.Clamp(1f - (calNPC.newAI[3] - DestroyerAI.GroundTelegraphStartGateValue) / DestroyerAI.PhaseTransitionTelegraphTime, 0f, 1f);
|
||||
else if (calNPC.newAI[3] >= DestroyerAI.FlightTelegraphStartGateValue)
|
||||
phaseTransitionColorAmount = MathHelper.Clamp((calNPC.newAI[3] - DestroyerAI.FlightTelegraphStartGateValue) / DestroyerAI.PhaseTransitionTelegraphTime, 0f, 1f);
|
||||
}
|
||||
|
||||
// Light colors
|
||||
int alpha = 192;
|
||||
Color groundColor = new Color(150, 0, 0, alpha);
|
||||
Color flightColor = revenge ? new Color(0, 0, 150, alpha) : groundColor;
|
||||
Color segmentColor = Color.Lerp(groundColor, flightColor, phaseTransitionColorAmount);
|
||||
Color telegraphColor_Red = new Color(255, 125, 125, alpha);
|
||||
Color telegraphColor_Green = new Color(125, 255, 125, alpha);
|
||||
Color telegraphColor_Cyan = new Color(0, 255, 255, alpha);
|
||||
Color telegraphColor = telegraphColor_Red;
|
||||
|
||||
// Telegraph for body lasers
|
||||
float telegraphProgress = 0f;
|
||||
if (npc.TryGetAIOverride<DestroyerAI>(out var destroyerAI) && destroyerAI.LaserColor != -1)
|
||||
{
|
||||
float shootProjectileTime = death ? (phase5 ? 180f : phase4 ? 270f : 360f) : 450f;
|
||||
float telegraphGateValue = shootProjectileTime - DestroyerAI.LaserTelegraphTime;
|
||||
if (calNPC.newAI[0] > telegraphGateValue)
|
||||
{
|
||||
switch (destroyerAI.LaserColor)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
telegraphColor = telegraphColor_Green;
|
||||
break;
|
||||
case 2:
|
||||
telegraphColor = telegraphColor_Cyan;
|
||||
break;
|
||||
}
|
||||
telegraphProgress = MathHelper.Clamp((calNPC.newAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
Texture2D glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.DestroyerHeadGlowmask.Value : TextureAssets.Dest[0].Value;
|
||||
switch (npc.type)
|
||||
{
|
||||
default:
|
||||
case NPCID.TheDestroyer:
|
||||
break;
|
||||
case NPCID.TheDestroyerBody:
|
||||
glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.DestroyerBodyGlowmask.Value : TextureAssets.Dest[1].Value;
|
||||
break;
|
||||
case NPCID.TheDestroyerTail:
|
||||
glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.DestroyerTailGlowmask.Value : TextureAssets.Dest[2].Value;
|
||||
break;
|
||||
}
|
||||
|
||||
float alphaMultiplier = 1f - npc.alpha / 255f;
|
||||
spriteBatch.Draw(glowTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, Color.Lerp(segmentColor, telegraphColor, telegraphProgress) * alphaMultiplier, npc.rotation, halfSize, npc.scale, spriteEffects, 0f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void GlobalPostDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
var calNPC = npc.GetGlobalNPC<CalamityGlobalNPC>();
|
||||
bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive;
|
||||
bool death = CalamityWorld.death || BossRushEvent.BossRushActive;
|
||||
|
||||
// Energy shield
|
||||
if (npc.type == NPCID.CultistBoss || npc.type == NPCID.CultistBossClone)
|
||||
{
|
||||
spriteBatch.EnterShaderRegion();
|
||||
|
||||
float intensity = calNPC.newAI[1] / 35f;
|
||||
float lifeRatio = npc.type == NPCID.CultistBoss ? (npc.life / (float)npc.lifeMax) : (Main.npc[(int)npc.ai[3]].life / (float)Main.npc[(int)npc.ai[3]].lifeMax);
|
||||
|
||||
float flickerPower = 0f;
|
||||
if (lifeRatio < 0.85f)
|
||||
flickerPower += 0.1f;
|
||||
if (lifeRatio < 0.7f)
|
||||
flickerPower += 0.1f;
|
||||
if (lifeRatio < 0.55f)
|
||||
flickerPower += 0.1f;
|
||||
if (lifeRatio < 0.4f)
|
||||
flickerPower += 0.1f;
|
||||
if (lifeRatio < 0.25f)
|
||||
flickerPower += 0.1f;
|
||||
if (lifeRatio < 0.1f)
|
||||
flickerPower += 0.1f;
|
||||
|
||||
float opacity = 1f;
|
||||
opacity *= MathHelper.Lerp(MathHelper.Max(1f - flickerPower, 0.56f), 1f, (float)Math.Pow(Math.Cos(Main.GlobalTimeWrappedHourly * MathHelper.Lerp(3f, 5f, flickerPower)) * 0.5 + 0.5, 24D));
|
||||
|
||||
// Dampen the opacity and intensity slightly, to allow Cultist to be more easily visible inside of the forcefield.
|
||||
// Dampen the opacity and intensity a bit more for the Clones.
|
||||
float intensityAndOpacityMult = npc.type == NPCID.CultistBossClone ? 0.9f : 1f;
|
||||
intensity *= intensityAndOpacityMult;
|
||||
opacity *= intensityAndOpacityMult;
|
||||
|
||||
Texture2D forcefieldTexture = SupremeCalamitas.SupremeCalamitas.ForcefieldTexture.Value;
|
||||
|
||||
if (npc.type == NPCID.CultistBoss)
|
||||
GameShaders.Misc["CalamityMod:SupremeShield"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/GreyscaleGradients/EternityStreak"));
|
||||
else
|
||||
GameShaders.Misc["CalamityMod:SupremeShield"].UseImage1("Images/Misc/noise");
|
||||
|
||||
float colorTransitionAmt = (float)Math.Pow((double)(1f - lifeRatio), 2D);
|
||||
Color forcefieldColor = Color.Lerp(Color.MediumSpringGreen, Color.Black, colorTransitionAmt);
|
||||
Color secondaryForcefieldColor = Color.Lerp(Color.Cyan, Color.Blue, colorTransitionAmt);
|
||||
|
||||
forcefieldColor *= opacity;
|
||||
secondaryForcefieldColor *= opacity;
|
||||
|
||||
GameShaders.Misc["CalamityMod:SupremeShield"].UseSecondaryColor(secondaryForcefieldColor);
|
||||
GameShaders.Misc["CalamityMod:SupremeShield"].UseColor(forcefieldColor);
|
||||
GameShaders.Misc["CalamityMod:SupremeShield"].UseSaturation(1);
|
||||
GameShaders.Misc["CalamityMod:SupremeShield"].UseOpacity(0.65f);
|
||||
GameShaders.Misc["CalamityMod:SupremeShield"].Apply();
|
||||
|
||||
// Actual Cultist has a bigger shield than the Clones.
|
||||
float shieldScale = npc.type == NPCID.CultistBossClone ? 1.65f : MathHelper.Lerp(1.65f, 3f, (float)Math.Pow((double)lifeRatio, 2D));
|
||||
spriteBatch.Draw(forcefieldTexture, npc.Center - Main.screenPosition, null, Color.White * opacity, 0f, forcefieldTexture.Size() * 0.5f, shieldScale, SpriteEffects.None, 0f);
|
||||
|
||||
spriteBatch.ExitShaderRegion();
|
||||
}
|
||||
|
||||
// Laser telegraph
|
||||
else if (npc.type == NPCID.Probe)
|
||||
{
|
||||
float eyeTelegraphGateValue = (NPC.IsMechQueenUp ? DestroyerAI.ProbeLaserGateValue_Mechdusa : revenge ? DestroyerAI.ProbeLaserGateValue_Rev : DestroyerAI.ProbeLaserGateValue) - DestroyerAI.ProbeLaserTelegraphTime;
|
||||
Texture2D glowTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/Sparkle").Value;
|
||||
Vector2 halfSize = npc.frame.Size() / 2;
|
||||
|
||||
Vector2 drawPosition = npc.Center - screenPos + Vector2.UnitX.RotatedBy(npc.rotation) * (npc.width * 0.45f * npc.spriteDirection) + Vector2.UnitY * npc.gfxOffY;
|
||||
float colorScale = MathHelper.Clamp((npc.localAI[0] - eyeTelegraphGateValue) / DestroyerAI.ProbeLaserTelegraphTime, 0f, 1f);
|
||||
Color drawColor2 = new Color(255, 100, 150, 192) * colorScale;
|
||||
spriteBatch.SetBlendState(BlendState.Additive);
|
||||
spriteBatch.Draw(glowTexture, drawPosition, npc.frame, drawColor2, npc.rotation, halfSize, npc.scale * 1.1f, SpriteEffects.None, 0f);
|
||||
spriteBatch.SetBlendState(BlendState.AlphaBlend);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,8 +44,13 @@ public static class VanillaAIOverrideExtension
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CalamityVanillaAIOverrideNPC : GlobalNPC
|
||||
public sealed partial class CalamityVanillaAIOverrideNPC : GlobalNPC
|
||||
{
|
||||
/// <summary>
|
||||
/// Toggle Entire System. External mods can toggle this out if they want.
|
||||
/// </summary>
|
||||
public static bool Enabled { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Specify the AI Override to work with. This handles AI, SendExtraAI and ReceiveExtraAI in instaned manner.
|
||||
/// </summary>
|
||||
@@ -881,16 +886,18 @@ public sealed class CalamityVanillaAIOverrideNPC : GlobalNPC
|
||||
|
||||
public override void SetDefaults(NPC npc)
|
||||
{
|
||||
// Clients will get their instance in ReceiveExtraAI
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
AIOverride = GetVanillaAIOverrideToApply(npc);
|
||||
if (!Enabled)
|
||||
return;
|
||||
|
||||
if (AIOverride != null)
|
||||
{
|
||||
AIOverride.NPC = npc;
|
||||
AIOverride.SetDefaults(Mod);
|
||||
}
|
||||
// Clients will get their instance in ReceiveExtraAI
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient)
|
||||
return;
|
||||
|
||||
AIOverride = GetVanillaAIOverrideToApply(npc);
|
||||
if (AIOverride != null)
|
||||
{
|
||||
AIOverride.NPC = npc;
|
||||
AIOverride.SetDefaults(Mod);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -898,11 +905,19 @@ public sealed class CalamityVanillaAIOverrideNPC : GlobalNPC
|
||||
|
||||
public override void OnSpawn(NPC npc, IEntitySource source)
|
||||
{
|
||||
if (!Enabled)
|
||||
return;
|
||||
|
||||
AIOverride?.OnSpawn(Mod);
|
||||
}
|
||||
|
||||
public override bool PreAI(NPC npc)
|
||||
{
|
||||
if (!Enabled)
|
||||
return base.PreAI(npc);
|
||||
|
||||
bool result = true;
|
||||
result &= GlobalPreAI(npc);
|
||||
if (AIOverride != null)
|
||||
{
|
||||
if (AIOverride.DisableMultiplayerSmoothing)
|
||||
@@ -910,36 +925,60 @@ public sealed class CalamityVanillaAIOverrideNPC : GlobalNPC
|
||||
npc.netOffset = Vector2.Zero;
|
||||
}
|
||||
|
||||
return AIOverride.AI(Mod);
|
||||
result &= AIOverride.AI(Mod);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return base.PreAI(npc);
|
||||
public override void AI(NPC npc)
|
||||
{
|
||||
if (!Enabled)
|
||||
return;
|
||||
|
||||
GlobalAI(npc);
|
||||
}
|
||||
|
||||
public override void PostAI(NPC npc)
|
||||
{
|
||||
if (!Enabled)
|
||||
return;
|
||||
|
||||
AIOverride?.PostAI(Mod);
|
||||
}
|
||||
|
||||
public override void HitEffect(NPC npc, NPC.HitInfo hit)
|
||||
{
|
||||
if (!Enabled)
|
||||
return;
|
||||
|
||||
AIOverride?.HitEffect(Mod, hit);
|
||||
}
|
||||
|
||||
public override void FindFrame(NPC npc, int frameHeight)
|
||||
{
|
||||
if (!Enabled)
|
||||
return;
|
||||
|
||||
AIOverride?.FindFrame(Mod, frameHeight);
|
||||
}
|
||||
|
||||
public override bool PreDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
if (AIOverride != null)
|
||||
return AIOverride.PreDraw(Mod, spriteBatch, screenPos, drawColor);
|
||||
return base.PreDraw(npc, spriteBatch, screenPos, drawColor);
|
||||
if (!Enabled)
|
||||
base.PreDraw(npc, spriteBatch, screenPos, drawColor);
|
||||
|
||||
bool result = true;
|
||||
result &= GlobalPreDraw(npc, spriteBatch, screenPos, drawColor);
|
||||
result &= AIOverride?.PreDraw(Mod, spriteBatch, screenPos, drawColor) ?? true;
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
if (!Enabled)
|
||||
return;
|
||||
|
||||
GlobalPostDraw(npc, spriteBatch, screenPos, drawColor);
|
||||
AIOverride?.PostDraw(Mod, spriteBatch, screenPos, drawColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
[LongDistanceNetSync]
|
||||
public class DevourerofGodsHead : ModNPC
|
||||
{
|
||||
public static Color SpecialMoveColor => Color.Lerp(Color.Fuchsia, Color.Cyan, MathHelper.SmoothStep(0,1,(MathF.Sin(Main.GlobalTimeWrappedHourly*2)+1) * 0.5f));
|
||||
public static Color SpecialMoveColor => Color.Lerp(Color.Fuchsia, Color.Cyan, MathHelper.SmoothStep(0, 1, (MathF.Sin(Main.GlobalTimeWrappedHourly * 2) + 1) * 0.5f));
|
||||
|
||||
public static int phase1IconIndex;
|
||||
public static int phase2IconIndex;
|
||||
@@ -67,7 +67,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
string phase1IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_Head_Boss";
|
||||
string phase2IconPath = "CalamityMod/NPCs/DevourerofGods/DevourerofGodsHead_P2_Head_Boss";
|
||||
|
||||
|
||||
phase1IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1);
|
||||
phase2IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1);
|
||||
}
|
||||
@@ -152,7 +152,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
|
||||
public bool isInPassiveState
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
if (Phase2Started && NPC.ai[3] == 1)
|
||||
return true;
|
||||
@@ -625,7 +625,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
string key = "Mods.CalamityMod.Status.Boss.DoGPhase2";
|
||||
Color messageColor = Color.Cyan;
|
||||
var ctid = CombatText.NewText(NPC.Hitbox,messageColor, Language.GetTextValue(key),true);
|
||||
var ctid = CombatText.NewText(NPC.Hitbox, messageColor, Language.GetTextValue(key), true);
|
||||
if (ctid < Main.maxCombatText)
|
||||
player.Calamity().subtitletext = Main.combatText[ctid];
|
||||
player.Calamity().subtitleColors = new Color[] { Color.Cyan, Color.Fuchsia };
|
||||
@@ -685,7 +685,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
AttemptingToEnterPortal = true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
// Phase 2
|
||||
else
|
||||
{
|
||||
@@ -929,7 +929,8 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
VelocityRotation -= maxSpeed;
|
||||
else
|
||||
VelocityRotation += dif;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dif > maxSpeed)
|
||||
VelocityRotation += maxSpeed;
|
||||
@@ -975,11 +976,11 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
float targetY = destination.Y;
|
||||
int destinationTileX = (int)(destination.X / 16f);
|
||||
int destinationTileY = (int)(destination.Y / 16f);
|
||||
|
||||
|
||||
|
||||
|
||||
speedCopy = homingSpeed;
|
||||
turnSpeedCopy = homingTurnSpeed;
|
||||
|
||||
|
||||
|
||||
speedCopy += Vector2.Distance(destination, NPC.Center) * 0.005f;
|
||||
turnSpeedCopy += Vector2.Distance(destination, NPC.Center) * 0.00025f;
|
||||
@@ -1013,7 +1014,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
targetX *= timeToReachTarget;
|
||||
targetY *= timeToReachTarget;
|
||||
|
||||
turnSpeedCopy *= NPC.Distance(destination) / ( death ? 800 : 1000f);
|
||||
turnSpeedCopy *= NPC.Distance(destination) / (death ? 800 : 1000f);
|
||||
if ((NPC.velocity.X > 0f && targetX > 0f) || (NPC.velocity.X < 0f && targetX < 0f) || (NPC.velocity.Y > 0f && targetY > 0f) || (NPC.velocity.Y < 0f && targetY < 0f))
|
||||
{
|
||||
if (NPC.velocity.X < targetX)
|
||||
@@ -1374,14 +1375,14 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
if (calamityGlobalNPC.newAI[2] > phaseLimit)
|
||||
{
|
||||
|
||||
|
||||
|
||||
calamityGlobalNPC.velocityPriorToPhaseSwap = NPC.velocity.Length();
|
||||
NPC.ai[3] = 0f;
|
||||
calamityGlobalNPC.newAI[2] = 0f;
|
||||
|
||||
if ((phase4))
|
||||
{
|
||||
calamityGlobalNPC.newAI[3] = AlphaGateValue-120;
|
||||
calamityGlobalNPC.newAI[3] = AlphaGateValue - 120;
|
||||
NPC.ai[3] = 2f;
|
||||
|
||||
}
|
||||
@@ -1405,11 +1406,12 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
var currentVelLength = NPC.velocity.Length();
|
||||
var goalVel = NPC.DirectionTo(goalpos) * currentVelLength;
|
||||
|
||||
TurnTowards(goalpos,maxSpeed: 6f * calamityGlobalNPC.newAI[2] / 120f);
|
||||
TurnTowards(goalpos, maxSpeed: 6f * calamityGlobalNPC.newAI[2] / 120f);
|
||||
NPC.velocity = VelocityRotation.ToRotationVector2() * (currentVelLength < 40 ? currentVelLength + 0.2f : currentVelLength > 42 ? currentVelLength - 0.2f : currentVelLength);
|
||||
|
||||
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
NPC.dontTakeDamage = true;
|
||||
}
|
||||
@@ -1441,7 +1443,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
if (isInPassiveState)
|
||||
{
|
||||
ShootFireballs(player, distanceFromTarget, revenge);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
calamityGlobalNPC.newAI[0] = 0f;
|
||||
@@ -1523,11 +1525,11 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
calamityGlobalNPC.newAI[1] += 1f;
|
||||
if (calamityGlobalNPC.newAI[1] >= laserBarragePhaseGateValue)
|
||||
{
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles)
|
||||
Main.LocalPlayer.Calamity().infiniteFlight = true;
|
||||
}
|
||||
if (!Main.dedServ)
|
||||
{
|
||||
if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles)
|
||||
Main.LocalPlayer.Calamity().infiniteFlight = true;
|
||||
}
|
||||
if (calamityGlobalNPC.newAI[1] >= laserBarrageGateValue)
|
||||
{
|
||||
calamityGlobalNPC.newAI[1] = 0f;
|
||||
@@ -1621,7 +1623,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
Vector2 npcCenter = NPC.Center;
|
||||
float targetX = player.position.X + (player.width / 2);
|
||||
float targetY = player.position.Y + (player.height / 2);
|
||||
|
||||
|
||||
speedCopy = homingSpeed;
|
||||
turnSpeedCopy = homingTurnSpeed;
|
||||
|
||||
@@ -1746,7 +1748,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
calamityGlobalNPC.velocityPriorToPhaseSwap = NPC.velocity.Length();
|
||||
NPC.ai[3] = 0f;
|
||||
calamityGlobalNPC.newAI[2] = 0f;
|
||||
calamityGlobalNPC.newAI[2] = 0f;
|
||||
if (phase2)
|
||||
{
|
||||
NPC.ai[3] = 2;
|
||||
@@ -2185,8 +2187,8 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
|
||||
if (!phase2Transition)
|
||||
teleportTimer = baseTeleportTime;
|
||||
|
||||
SoundEngine.PlaySound(RiftOpenSound with {Volume = 1.5f}, player.Center);
|
||||
|
||||
SoundEngine.PlaySound(RiftOpenSound with { Volume = 1.5f }, player.Center);
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
{
|
||||
@@ -2227,31 +2229,31 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
return;
|
||||
bool phase6 = NPC.life / (float)NPC.lifeMax < 0.25f;
|
||||
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && !(death && phase6 && NPC.ai[3] < 7)) // 4 dashes on Death phase 3 without fireballs
|
||||
if (Main.netMode != NetmodeID.MultiplayerClient && !(death && phase6 && NPC.ai[3] < 7)) // 4 dashes on Death phase 3 without fireballs
|
||||
{
|
||||
float finalVelocity = death ? 12f : 10f;
|
||||
int totalSpreads = revenge ? 6 : 3;
|
||||
float mult = revenge ? 1.5f : 3f;
|
||||
for (int i = 0; i < totalSpreads; i++)
|
||||
{
|
||||
float finalVelocity = death ? 12f : 10f;
|
||||
int totalSpreads = revenge ? 6 : 3;
|
||||
float mult = revenge ? 1.5f : 3f;
|
||||
for (int i = 0; i < totalSpreads; i++)
|
||||
if (!death && i % 3 == 2)
|
||||
continue;
|
||||
int totalProjectiles = 12;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
float newVelocity = finalVelocity - i * mult;
|
||||
float velocityMult = 1f + ((finalVelocity - newVelocity) / (newVelocity * 2f) / 100f);
|
||||
double angleA = radians * 0.5;
|
||||
double angleB = MathHelper.ToRadians(90f) - angleA;
|
||||
float velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB));
|
||||
Vector2 spinningPoint = i < 3 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity);
|
||||
float finalVelocityReduction = (float)Math.Pow(1.25, i) - 1f;
|
||||
for (int k = 0; k < totalProjectiles; k++)
|
||||
{
|
||||
if (!death && i % 3 == 2)
|
||||
continue;
|
||||
int totalProjectiles = 12;
|
||||
float radians = MathHelper.TwoPi / totalProjectiles;
|
||||
float newVelocity = finalVelocity - i * mult;
|
||||
float velocityMult = 1f + ((finalVelocity - newVelocity) / (newVelocity * 2f) / 100f);
|
||||
double angleA = radians * 0.5;
|
||||
double angleB = MathHelper.ToRadians(90f) - angleA;
|
||||
float velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB));
|
||||
Vector2 spinningPoint = i < 3 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity);
|
||||
float finalVelocityReduction = (float)Math.Pow(1.25, i) - 1f;
|
||||
for (int k = 0; k < totalProjectiles; k++)
|
||||
{
|
||||
Vector2 vector255 = spinningPoint.RotatedBy(radians * k);
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), newPosition, vector255, ModContent.ProjectileType<DoGFire>(), FireballDamage, 0f, Main.myPlayer, velocityMult, finalVelocity - finalVelocityReduction);
|
||||
}
|
||||
Vector2 vector255 = spinningPoint.RotatedBy(radians * k);
|
||||
Projectile.NewProjectile(NPC.GetSource_FromAI(), newPosition, vector255, ModContent.ProjectileType<DoGFire>(), FireballDamage, 0f, Main.myPlayer, velocityMult, finalVelocity - finalVelocityReduction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NPC.TargetClosest();
|
||||
NPC.position = newPosition;
|
||||
@@ -2259,17 +2261,17 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
chargeVelocity *= (death) ? (!(phase6 && NPC.ai[3] < 7)) ? 2.5f : 3 : 2.25f;
|
||||
float maxChargeDistance = 1800f;
|
||||
postTeleportTimer = (int)Math.Round(maxChargeDistance / chargeVelocity);
|
||||
int phase6dashcount = death ? 5 : 3;
|
||||
if (phase6 && NPC.ai[3] < 2 + phase6dashcount)
|
||||
{
|
||||
if (NPC.ai[3] < 3)
|
||||
NPC.ai[3] = 3;
|
||||
NPC.ai[3]++;
|
||||
int phase6dashcount = death ? 5 : 3;
|
||||
if (phase6 && NPC.ai[3] < 2 + phase6dashcount)
|
||||
{
|
||||
if (NPC.ai[3] < 3)
|
||||
NPC.ai[3] = 3;
|
||||
NPC.ai[3]++;
|
||||
// On FTW the final 10% is infinite portal dashing
|
||||
if (Main.getGoodWorld && NPC.life / (float)NPC.lifeMax < 0.1f)
|
||||
{
|
||||
NPC.ai[3] = 4;
|
||||
NPC.SimpleStrikeNPC(10000,1);
|
||||
NPC.SimpleStrikeNPC(10000, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2503,7 +2505,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
|
||||
CalamityGlobalNPC.SetNewBossJustDowned(NPC);
|
||||
|
||||
CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType<Bandit>() }, DownedBossSystem.downedDoG);
|
||||
CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType<Bandit>() }, DownedBossSystem.downedDoG);
|
||||
|
||||
// If DoG has not been killed yet, notify players that the holiday moons are buffed
|
||||
if (!DownedBossSystem.downedDoG)
|
||||
@@ -2737,7 +2739,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
{
|
||||
if (hurtInfo.Damage <= 0)
|
||||
return;
|
||||
|
||||
|
||||
if (target.Calamity().dogTextCooldown <= 0 && !BossRushEvent.BossRushActive)
|
||||
{
|
||||
string[] headHitKeys = new string[]
|
||||
@@ -2755,13 +2757,13 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
"Mods.CalamityMod.Status.Boss.DoGHead11",
|
||||
"Mods.CalamityMod.Status.Boss.DoGHead12",
|
||||
"Mods.CalamityMod.Status.Boss.DoGHead13",
|
||||
|
||||
|
||||
|
||||
};
|
||||
Color messageColor = Color.Cyan;
|
||||
Rectangle location = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height);
|
||||
var counter = target.Calamity().DoGHeadHitCounter;
|
||||
string text = headHitKeys[Main.rand.Next(10, 13)];
|
||||
string text = headHitKeys[Main.rand.Next(10, 13)];
|
||||
if (target.statLife - hurtInfo.Damage <= 0)
|
||||
{
|
||||
if (counter == 0)
|
||||
@@ -2777,7 +2779,8 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
text = "Mods.CalamityMod.Status.Boss.DoGHeadDeath1"; //Tasteless slop.
|
||||
else
|
||||
text = "Mods.CalamityMod.Status.Boss.DoGHeadDeath2"; //A feast worthy of a god!
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (counter == 0 && Phase2Started)
|
||||
{
|
||||
@@ -2785,7 +2788,8 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
text = "Mods.CalamityMod.Status.Boss.DoGHeadRunning2"; //WHAT'S THE PROBLEM?! CAN'T RUN ANYMORE?!
|
||||
else
|
||||
text = "Mods.CalamityMod.Status.Boss.DoGHeadRunning"; //You can't run forever!
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (counter > 9)
|
||||
text = headHitKeys[Main.rand.Next(10, 13)]; //DogHead11-13
|
||||
@@ -2793,7 +2797,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
text = headHitKeys[9]; //DogHead10
|
||||
else if (counter > 4)
|
||||
text = headHitKeys[Main.rand.Next(4, 9)]; //DogHead5-9
|
||||
else
|
||||
else
|
||||
text = headHitKeys[Main.rand.Next(0, 4)]; //DogHead1-4
|
||||
}
|
||||
}
|
||||
@@ -2804,7 +2808,7 @@ namespace CalamityMod.NPCs.DevourerofGods
|
||||
target.Calamity().subtitleColors = new Color[] { Color.Cyan, Color.Fuchsia };
|
||||
target.Calamity().dogTextCooldown = 60;
|
||||
}
|
||||
target.Calamity().DoGHeadHitCounter++;
|
||||
target.Calamity().DoGHeadHitCounter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1981,7 +1981,7 @@ namespace CalamityMod.NPCs.OldDuke
|
||||
drawLocation += new Vector2(Main.rand.NextFloat(-shake, shake), Main.rand.NextFloat(-shake, shake));
|
||||
|
||||
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(finalDrawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
|
||||
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(overlayDrawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
|
||||
|
||||
float auraOutset = 6f + (float)(Math.Sin(VisualTimerSystem.GlobalVisualTimer / 10f) * 10f);
|
||||
@@ -2066,7 +2066,7 @@ namespace CalamityMod.NPCs.OldDuke
|
||||
|
||||
CalamityGlobalNPC.SetNewBossJustDowned(NPC);
|
||||
|
||||
CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType<SeaKing>() }, DownedBossSystem.downedBoomerDuke);
|
||||
CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType<SeaKing>() }, DownedBossSystem.downedBoomerDuke);
|
||||
|
||||
// Mark Old Duke as dead
|
||||
DownedBossSystem.downedBoomerDuke = true;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.Polterghast
|
||||
{
|
||||
public static int phase1IconIndex;
|
||||
public static int phase3IconIndex;
|
||||
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
string phase1IconPath = "CalamityMod/NPCs/Polterghast/Polterghast_Head_Boss";
|
||||
@@ -943,7 +943,7 @@ namespace CalamityMod.NPCs.Polterghast
|
||||
|
||||
CalamityGlobalNPC.SetNewBossJustDowned(NPC);
|
||||
|
||||
CalamityGlobalNPC.SetNewShopVariable(new int[] { NPCID.Cyborg }, DownedBossSystem.downedPolterghast);
|
||||
CalamityGlobalTownNPC.SetNewShopVariable(new int[] { NPCID.Cyborg }, DownedBossSystem.downedPolterghast);
|
||||
|
||||
// If Polterghast has not been killed, notify players about the Abyss minibosses now dropping items
|
||||
if (!DownedBossSystem.downedPolterghast)
|
||||
|
||||
@@ -60,7 +60,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas
|
||||
Count = 7
|
||||
}
|
||||
|
||||
public static Color CurrentColor => CalamityGlobalNPC.SCal >= 0 && Main.npc[CalamityGlobalNPC.SCal].active && Main.npc[CalamityGlobalNPC.SCal].ModNPC<SupremeCalamitas>().ArenaBox is not null ? Main.npc[CalamityGlobalNPC.SCal].ModNPC<SupremeCalamitas>().ArenaBox.borderColor : SupremeCalamitas.AcceptanceColor;
|
||||
public static Color CurrentColor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (CalamityGlobalNPC.SCal < 0)
|
||||
return AcceptanceColor;
|
||||
|
||||
var npc = Main.npc[CalamityGlobalNPC.SCal];
|
||||
if (npc == null || !npc.active)
|
||||
return AcceptanceColor;
|
||||
|
||||
if (npc.ModNPC is not SupremeCalamitas calamitas || calamitas.ArenaBox is null)
|
||||
return AcceptanceColor;
|
||||
|
||||
return calamitas.ArenaBox.borderColor;
|
||||
}
|
||||
}
|
||||
public static Color GriefColor => Color.Crimson;
|
||||
public static Color LamentColor => Color.RoyalBlue;
|
||||
public static Color EpiphanyColor => new Color(219, 75, 2);
|
||||
@@ -682,20 +698,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas
|
||||
|
||||
void UpdateArena(ArenaWallSystem.Box box)
|
||||
{
|
||||
var x = 1f/TextureAssets.MagicPixel.Height();
|
||||
var p = ScalArenaMetaball.SpawnParticle((box.TopLeft + box.BottomLeft) * 0.5f - new Vector2(box.borderThickness*0.5f + 2,0), Vector2.Zero, 1);
|
||||
var x = 1f / TextureAssets.MagicPixel.Height();
|
||||
var p = ScalArenaMetaball.SpawnParticle((box.TopLeft + box.BottomLeft) * 0.5f - new Vector2(box.borderThickness * 0.5f + 2, 0), Vector2.Zero, 1);
|
||||
p.SizeScaling = 0;
|
||||
p.TextureToUse = TextureAssets.MagicPixel.Value;
|
||||
p.Scale = new Vector2(box.borderThickness-6, box.borderThickness*2 + box.Size.Y-4);
|
||||
p.Scale = new Vector2(box.borderThickness - 6, box.borderThickness * 2 + box.Size.Y - 4);
|
||||
p.Scale.Y *= x;
|
||||
|
||||
|
||||
p = ScalArenaMetaball.SpawnParticle((box.TopRight + box.BottomRight) * 0.5f + new Vector2(box.borderThickness * 0.5f + 2, 0), Vector2.Zero, 1);
|
||||
p.SizeScaling = 0;
|
||||
p.TextureToUse = TextureAssets.MagicPixel.Value;
|
||||
p.Scale = new Vector2(box.borderThickness - 6, box.borderThickness * 2 + box.Size.Y - 4);
|
||||
p.Scale.Y *= x;
|
||||
|
||||
p = ScalArenaMetaball.SpawnParticle((box.TopRight + box.TopLeft) * 0.5f - new Vector2(0,box.borderThickness * 0.5f + 2), Vector2.Zero, 1);
|
||||
p = ScalArenaMetaball.SpawnParticle((box.TopRight + box.TopLeft) * 0.5f - new Vector2(0, box.borderThickness * 0.5f + 2), Vector2.Zero, 1);
|
||||
p.SizeScaling = 0;
|
||||
p.TextureToUse = TextureAssets.MagicPixel.Value;
|
||||
p.Scale = new Vector2(box.borderThickness * 2 + box.Size.X - 4, box.borderThickness - 6);
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -941,6 +943,67 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void PostDraw(Mod mod, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
// Telegraph for charge and blood shots
|
||||
if (NPC.crimsonBoss < 0)
|
||||
return;
|
||||
|
||||
var halfSize = NPC.frame.Size() / 2;
|
||||
SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
bool brainIsInPhase2 = Main.npc[NPC.crimsonBoss].ai[0] < 0f;
|
||||
if (brainIsInPhase2)
|
||||
{
|
||||
var currentColor = NPC.GetAlpha(drawColor);
|
||||
float opacity = (1f - Main.npc[NPC.crimsonBoss].life / (float)Main.npc[NPC.crimsonBoss].lifeMax) * 2f;
|
||||
opacity *= opacity;
|
||||
if (Main.getGoodWorld)
|
||||
opacity = 1f;
|
||||
|
||||
opacity = MathHelper.Clamp(opacity, 0f, 1f);
|
||||
currentColor.R = (byte)(currentColor.R * opacity);
|
||||
currentColor.G = (byte)(currentColor.G * opacity);
|
||||
currentColor.B = (byte)(currentColor.B * opacity);
|
||||
currentColor.A = (byte)(currentColor.A * opacity);
|
||||
int totalAfterimages = 4;
|
||||
for (int i = 0; i < totalAfterimages; i++)
|
||||
{
|
||||
Vector2 position = NPC.position;
|
||||
float distanceFromTargetX = Math.Abs(NPC.Center.X - Main.LocalPlayer.Center.X);
|
||||
float distanceFromTargetY = Math.Abs(NPC.Center.Y - Main.LocalPlayer.Center.Y);
|
||||
if (i == 0 || i == 2)
|
||||
position.X = Main.LocalPlayer.Center.X + distanceFromTargetX;
|
||||
else
|
||||
position.X = Main.LocalPlayer.Center.X - distanceFromTargetX;
|
||||
|
||||
position.X -= NPC.width / 2;
|
||||
if (i == 0 || i == 1)
|
||||
position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY;
|
||||
else
|
||||
position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY;
|
||||
|
||||
position.Y -= NPC.height / 2;
|
||||
|
||||
int width = TextureAssets.Npc[NPC.type] is null ? 0 : TextureAssets.Npc[NPC.type].Width();
|
||||
int height = TextureAssets.Npc[NPC.type] is null ? 0 : TextureAssets.Npc[NPC.type].Height();
|
||||
spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, new Vector2(position.X - screenPos.X + NPC.width / 2 - width * NPC.scale / 2f + halfSize.X * NPC.scale, position.Y - screenPos.Y + (float)NPC.height - (float)height * NPC.scale / (float)Main.npcFrameCount[NPC.type] + 4f + halfSize.Y * NPC.scale + NPC.gfxOffY), NPC.frame, currentColor, NPC.rotation, halfSize, NPC.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
float beginTelegraphGateValue = TimeBeforeCreeperAttack - CreeperTelegraphTime;
|
||||
if (NPC.ai[1] > beginTelegraphGateValue || NPC.ai[0] == 1f)
|
||||
{
|
||||
float colorScale = NPC.ai[0] == 1f ? 1f : MathHelper.Clamp((NPC.ai[1] - beginTelegraphGateValue) / CreeperTelegraphTime, 0f, 1f);
|
||||
Color drawColor2 = new Color(150, 30, 30, 0) * colorScale;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame,
|
||||
drawColor2, NPC.rotation, halfSize, NPC.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetBrainOfCthuluCreepersCountRevDeath()
|
||||
|
||||
@@ -4,8 +4,10 @@ using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -506,6 +508,57 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void FindFrame(Mod mod, int frameHeight)
|
||||
{
|
||||
// Used to force the head to look to the sides for the laser spread attack
|
||||
if (NPC.ai[0] == 2f || NPC.ai[0] == 3f)
|
||||
{
|
||||
if (NPC.localAI[1] == 1f)
|
||||
NPC.frame.Y = frameHeight * 2;
|
||||
else
|
||||
NPC.frame.Y = frameHeight * 4;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(Mod mod, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
// Draw the head as usual.
|
||||
Texture2D golemHeadTexture = TextureAssets.Npc[NPC.type].Value;
|
||||
Vector2 headDrawPosition = NPC.Center - screenPos;
|
||||
spriteBatch.Draw(golemHeadTexture, headDrawPosition, NPC.frame, NPC.GetAlpha(drawColor), 0f, NPC.frame.Size() * 0.5f, NPC.scale, SpriteEffects.None, 0f);
|
||||
|
||||
// Draw the eyes. The way vanilla handles this is hardcoded bullshit that cannot handle different hitboxes and thus requires rewriting.
|
||||
Color eyeColor = new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, 0);
|
||||
Vector2 eyesDrawPosition = headDrawPosition - NPC.scale * new Vector2(1f, 12f);
|
||||
Rectangle eyesFrame = new Rectangle(0, 0, TextureAssets.Golem[1].Value.Width, TextureAssets.Golem[1].Value.Height / 2);
|
||||
spriteBatch.Draw(TextureAssets.Golem[1].Value, eyesDrawPosition, eyesFrame, eyeColor, 0f, eyesFrame.Size() * 0.5f, NPC.scale, SpriteEffects.None, 0f);
|
||||
|
||||
// Draw the glowmasks.
|
||||
int frameCounter = (int)NPC.frameCounter / 4;
|
||||
Rectangle frame = TextureAssets.Extra[ExtrasID.GolemLights4].Value.Frame(1, 8);
|
||||
frame.Y += frame.Height * 2 * frameCounter + NPC.frame.Y;
|
||||
Rectangle glowFrame = frame;
|
||||
spriteBatch.Draw(TextureAssets.Extra[ExtrasID.GolemLights4].Value, eyesDrawPosition, glowFrame, eyeColor, 0f, glowFrame.Size() * 0.5f, NPC.scale, SpriteEffects.None, 0f);
|
||||
frame = NPC.frame;
|
||||
Rectangle glowFrame2 = frame;
|
||||
spriteBatch.Draw(TextureAssets.Extra[ExtrasID.GolemLights5].Value, eyesDrawPosition, glowFrame2, eyeColor, 0f, glowFrame2.Size() * 0.5f, NPC.scale, SpriteEffects.None, 0f);
|
||||
|
||||
// Draw the sparkle telegraphs for the laser spread attack if applicable.
|
||||
if (NPC.ai[0] == 3f && NPC.ai[1] <= 60f)
|
||||
{
|
||||
spriteBatch.SetBlendState(BlendState.Additive);
|
||||
for (int i = -1; i <= 1; i += 2)
|
||||
{
|
||||
Texture2D sparkle = ModContent.Request<Texture2D>("CalamityMod/Particles/Sparkle2").Value;
|
||||
Vector2 sparkleDraw = headDrawPosition + new Vector2(14f * i, -15f) * NPC.scale;
|
||||
var drawFade = Color.Yellow * Utils.GetLerpValue(0, 30, 60f - NPC.ai[1], true);
|
||||
spriteBatch.Draw(sparkle, sparkleDraw, null, drawFade, MathHelper.Pi * 0.02f * NPC.ai[1] * i, sparkle.Size() / 2f, 1.25f * NPC.scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
spriteBatch.SetBlendState(BlendState.AlphaBlend);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public class FistAI : VanillaAIOverride
|
||||
{
|
||||
public override bool AI(Mod mod)
|
||||
|
||||
@@ -4,8 +4,10 @@ using CalamityMod.NPCs.NormalNPCs;
|
||||
using CalamityMod.Projectiles.Boss;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -942,6 +944,79 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void PostDraw(Mod mod, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
// Percent life remaining
|
||||
float lifeRatio = NPC.life / (float)NPC.lifeMax;
|
||||
Texture2D npcTexture = TextureAssets.Npc[NPC.type].Value;
|
||||
SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
var originalColor = NPC.GetAlpha(drawColor);
|
||||
Color newColor = new Color(100, 255, 100, 255);
|
||||
Vector2 glowOffset = Vector2.UnitY * -4f;
|
||||
Vector2 drawPosition = NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) + glowOffset;
|
||||
var origin = NPC.frame.Size() / 2;
|
||||
|
||||
bool phase2 = lifeRatio <= 0.5f;
|
||||
if (!phase2)
|
||||
{
|
||||
float telegraphTimer = Math.Abs(NPC.ai[1]);
|
||||
bool startSeedGatlingSporeGasTelegraph = NPC.ai[1] > SeedGatlingColorChangeGateValue;
|
||||
bool endSeedGatlingSporeGasTelegraph = NPC.ai[1] < -SeedGatlingDuration + SeedGatlingColorChangeDuration;
|
||||
if (startSeedGatlingSporeGasTelegraph)
|
||||
{
|
||||
float telegraphScalar = MathHelper.Clamp((telegraphTimer - SeedGatlingColorChangeGateValue) / SeedGatlingColorChangeDuration, 0f, 1f);
|
||||
Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar);
|
||||
spriteBatch.Draw(npcTexture, drawPosition, NPC.frame, telegraphColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
// -300 to -120
|
||||
else if (endSeedGatlingSporeGasTelegraph)
|
||||
{
|
||||
float telegraphScalar = MathHelper.Clamp((telegraphTimer - (SeedGatlingDuration - SeedGatlingColorChangeDuration)) / SeedGatlingColorChangeDuration, 0f, 1f);
|
||||
Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar);
|
||||
spriteBatch.Draw(npcTexture, drawPosition, NPC.frame, telegraphColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float telegraphTimer = Math.Abs(NPC.ai[3]);
|
||||
bool startChargeTelegraph = NPC.ai[3] > ChargeTelegraphColorChangeGateValue;
|
||||
bool endChargeTelegraph = NPC.ai[3] <= -2f;
|
||||
if (startChargeTelegraph)
|
||||
{
|
||||
float telegraphScalar = MathHelper.Clamp((telegraphTimer - ChargeTelegraphColorChangeGateValue) / SeedGatlingColorChangeDuration, 0f, 1f);
|
||||
Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar);
|
||||
spriteBatch.Draw(npcTexture, drawPosition, NPC.frame, telegraphColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
|
||||
}
|
||||
|
||||
// -195 to -2
|
||||
else if (endChargeTelegraph)
|
||||
{
|
||||
float telegraphScalar = MathHelper.Clamp((Math.Abs(StopChargeGateValue) - telegraphTimer) / Math.Abs(StopChargeGateValue), 0f, 1f);
|
||||
Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar);
|
||||
|
||||
if (CalamityClientConfig.Instance.Afterimages)
|
||||
{
|
||||
int afterimageAmount = 10;
|
||||
int afterImageIncrement = 2;
|
||||
for (int j = 0; j < afterimageAmount; j += afterImageIncrement)
|
||||
{
|
||||
Color afterimageColor = telegraphColor;
|
||||
afterimageColor = Color.Lerp(afterimageColor, originalColor, 0.5f);
|
||||
afterimageColor = NPC.GetAlpha(afterimageColor);
|
||||
afterimageColor *= (afterimageAmount - j) / 15f;
|
||||
Vector2 afterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
|
||||
afterimagePos -= new Vector2(npcTexture.Width, npcTexture.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
|
||||
afterimagePos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY) + glowOffset;
|
||||
spriteBatch.Draw(npcTexture, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
spriteBatch.Draw(npcTexture, drawPosition, NPC.frame, telegraphColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class HookAI : VanillaAIOverride
|
||||
{
|
||||
public override bool AI(Mod mod)
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -743,6 +745,25 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void PostDraw(Mod mod, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
// Telegraph for charges
|
||||
float beginTelegraphGateValue = ChargeGateValue - ChargeTelegraphTime;
|
||||
if (NPC.localAI[1] > beginTelegraphGateValue)
|
||||
{
|
||||
float colorScale = MathHelper.Clamp((NPC.localAI[1] - beginTelegraphGateValue) / ChargeTelegraphTime, 0f, 1f);
|
||||
Color drawColor2 = new Color(150, 150, 150, 0) * colorScale;
|
||||
var halfSize = NPC.frame.Size() / 2;
|
||||
SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame,
|
||||
drawColor2, NPC.rotation, halfSize, NPC.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class SkeletronHandAI : VanillaAIOverride
|
||||
{
|
||||
public override bool AI(Mod mod)
|
||||
@@ -1064,6 +1085,28 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void PostDraw(Mod mod, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
var calNPC = NPC.GetGlobalNPC<CalamityGlobalNPC>();
|
||||
float beginTelegraphGateValue = HandSlapGateValue - HandSlapTelegraphTime;
|
||||
if (calNPC.newAI[2] > beginTelegraphGateValue)
|
||||
{
|
||||
float colorScale = MathHelper.Clamp((calNPC.newAI[2] - beginTelegraphGateValue) / HandSlapTelegraphTime, 0f, 1f);
|
||||
Color drawColor2 = new Color(150, 150, 150, 0) * colorScale;
|
||||
var halfSize = NPC.frame.Size() / 2;
|
||||
SpriteEffects spriteEffects = SpriteEffects.None;
|
||||
if (NPC.spriteDirection == 1)
|
||||
spriteEffects = SpriteEffects.FlipHorizontally;
|
||||
|
||||
Vector2 glowOffset = Vector2.UnitY * 8f;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
spriteBatch.Draw(TextureAssets.Npc[NPC.type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - glowOffset, NPC.frame,
|
||||
drawColor2, NPC.rotation, halfSize, NPC.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class DungeonGuardianAI : VanillaAIOverride
|
||||
|
||||
@@ -4,8 +4,10 @@ using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -613,6 +615,46 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool PreDraw(Mod mod, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
if (NPC.IsMechQueenUp)
|
||||
return true;
|
||||
|
||||
// Allows correct frames to draw in Rev+ phases
|
||||
// GFB can rot for all I care
|
||||
var calNPC = NPC.GetGlobalNPC<CalamityGlobalNPC>();
|
||||
int frameHeight = TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type];
|
||||
if (NPC.ai[1] == 0f || NPC.ai[1] == 4f)
|
||||
{
|
||||
calNPC.newAI[2] += 1f;
|
||||
if (calNPC.newAI[2] >= 12f)
|
||||
{
|
||||
calNPC.newAI[2] = 0f;
|
||||
calNPC.newAI[3] += frameHeight;
|
||||
|
||||
if (calNPC.newAI[3] / frameHeight >= 2f)
|
||||
calNPC.newAI[3] = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
// Spinning probe spawn or fly over phase
|
||||
else if (NPC.ai[1] == 5f || NPC.ai[1] == 6f)
|
||||
{
|
||||
calNPC.newAI[2] = 0f;
|
||||
calNPC.newAI[3] = frameHeight;
|
||||
}
|
||||
|
||||
// Spinning phase
|
||||
else
|
||||
{
|
||||
calNPC.newAI[2] = 0f;
|
||||
calNPC.newAI[3] = frameHeight * 2;
|
||||
}
|
||||
|
||||
NPC.frame.Y = (int)calNPC.newAI[3];
|
||||
return true;
|
||||
}
|
||||
|
||||
public class PrimeLaserAI : VanillaAIOverride
|
||||
{
|
||||
public override bool AI(Mod mod)
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
using System;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.ExtraTextures;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -508,6 +511,30 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void PostDraw(Mod mod, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor)
|
||||
{
|
||||
// Laser telegraph
|
||||
bool enraged = NPC.localAI[3] > 0f;
|
||||
float eyeTelegraphGateValue = LaserShootGateValue - LaserShootTelegraphTime;
|
||||
if (NPC.localAI[1] > eyeTelegraphGateValue || NPC.localAI[2] > 0f || enraged)
|
||||
{
|
||||
Texture2D glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.WallOfFleshEyeGlowmask.Value : TextureAssets.Npc[NPC.type].Value;
|
||||
var halfSize = NPC.frame.Size() / 2;
|
||||
SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
float colorScale = enraged ? MathHelper.Clamp(NPC.localAI[3] / EnragedLaserFiringDuration, 0f, 1f) :
|
||||
NPC.localAI[2] > 0f ? 1f - ((NPC.localAI[2] - 1f) / TotalLasersPerBarrage) :
|
||||
MathHelper.Clamp((NPC.localAI[1] - eyeTelegraphGateValue) / LaserShootTelegraphTime, 0f, 1f);
|
||||
|
||||
Color drawColor2 = new Color(100, 0, 200, 192) * colorScale;
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
spriteBatch.Draw(glowTexture, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY), NPC.frame,
|
||||
drawColor2, NPC.rotation, halfSize, NPC.scale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class HungryAI : VanillaAIOverride
|
||||
{
|
||||
public override bool AI(Mod mod)
|
||||
|
||||
@@ -3018,7 +3018,7 @@ namespace CalamityMod.NPCs.Yharon
|
||||
if (BossRushEvent.BossRushActive)
|
||||
return;
|
||||
|
||||
CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType<Bandit>() }, DownedBossSystem.downedYharon);
|
||||
CalamityGlobalTownNPC.SetNewShopVariable(new int[] { ModContent.NPCType<Bandit>() }, DownedBossSystem.downedYharon);
|
||||
CalamityGlobalNPC.SetNewBossJustDowned(NPC);
|
||||
|
||||
// If Yharon has not been killed yet, notify players of Auric Ore
|
||||
|
||||
@@ -19,9 +19,14 @@ namespace CalamityMod.Prefixes
|
||||
// Ozzatron 31AUG2022: total rework to the reforge rework for mod compatibility
|
||||
// you can now disable the rework with config in case it isn't enough to solve your conflicts
|
||||
// removed data saved on items; reforging is now a coalescing flowchart that has no RNG
|
||||
private static int storedPrefix = -1;
|
||||
public override void PreReforge(Item item)
|
||||
{
|
||||
storedPrefix = item.prefix;
|
||||
}
|
||||
|
||||
public override int ChoosePrefix(Item item, UnifiedRandom rand)
|
||||
{
|
||||
int storedPrefix = item.prefix;
|
||||
if (storedPrefix == -1 && item.CountsAsClass<RogueDamageClass>() && (item.maxStack == 1 || item.AllowReforgeForStackableItem))
|
||||
{
|
||||
// Crafting (or first reforge of) a rogue weapon has a 75% chance for a random modifier, this check is done by vanilla
|
||||
@@ -48,6 +53,8 @@ namespace CalamityMod.Prefixes
|
||||
|
||||
public override void PostReforge(Item item)
|
||||
{
|
||||
storedPrefix = -1;
|
||||
|
||||
// Bandit steals 20% of the total price of the reforge if she's around.
|
||||
if (NPC.AnyNPCs(NPCType<Bandit>()))
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.Items;
|
||||
using Terraria;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
@@ -153,8 +154,8 @@ namespace CalamityMod.Prefixes
|
||||
// Applying stealth strike damage
|
||||
public override void Apply(Item item)
|
||||
{
|
||||
if (item.CountsAsClass<RogueDamageClass>())
|
||||
item.Calamity().StealthStrikePrefixBonus = stealthDmgMult;
|
||||
if (item.CountsAsClass<RogueDamageClass>() && item.TryGetGlobalItem<RogueGlobalItem>(out var rogueItem))
|
||||
rogueItem.StealthStrikePrefixBonus = stealthDmgMult;
|
||||
}
|
||||
|
||||
// Changing value based on prefix tier (rarity is set automatically around value multiplier)
|
||||
|
||||
@@ -46,6 +46,20 @@ namespace CalamityMod.Projectiles.Summon
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool _hadSpiderMinion = false;
|
||||
public override bool PreAI()
|
||||
{
|
||||
var owner = Main.player[Projectile.owner];
|
||||
_hadSpiderMinion = owner.spiderMinion;
|
||||
owner.spiderMinion = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void PostAI()
|
||||
{
|
||||
Main.player[Projectile.owner].spiderMinion = _hadSpiderMinion;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (bloodCooldown > 0)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using CalamityMod.Buffs.Summon.Whips;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.NPCs.ProfanedGuardians;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
@@ -109,7 +110,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
var dye = Owner?.cMinion ?? 0;
|
||||
bool psc = Owner.Calamity().profanedCrystalBuffs;
|
||||
int rockType = (int)MathHelper.Clamp(Projectile.ai[2], 1f, 6f); ;
|
||||
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/NPCs/ProfanedGuardians/ProfanedRocks" + rockType.ToString()).Value;
|
||||
Texture2D texture = ProfanedRocks.Textures[rockType - 1].Value;
|
||||
|
||||
Vector2 drawOrigin = new Vector2(texture.Width / 2, texture.Height / 2);
|
||||
Vector2 drawPos = Projectile.Center - Main.screenPosition;
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace CalamityMod.Systems
|
||||
|
||||
#region Post NPC Updating
|
||||
// TODO -- Apply caching to this process. For now most of the looping issues should be eradicated but it can be reduced further.
|
||||
public override void PostUpdateNPCs() => CalamityGlobalNPC.ResetTownNPCNameBools();
|
||||
public override void PostUpdateNPCs() => CalamityGlobalTownNPC.ResetTownNPCNameBools();
|
||||
#endregion
|
||||
|
||||
#region Tile Entity Time Handler
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace CalamityMod.Systems.Mechanic
|
||||
/// <summary>
|
||||
/// The despawn logic to kill this box. Only runs when RemovalCondition is true. Return true to delete the box from ActiveBoxes.
|
||||
/// </summary>
|
||||
public Func<Box,bool> DespawnAction = (box) => true;
|
||||
public Func<Box, bool> DespawnAction = (box) => true;
|
||||
|
||||
public bool PullPlayerWhenSizeChanged => false;
|
||||
public void DrawBoxWithOffset(float Offset, float Thickness, Color color)
|
||||
@@ -112,7 +112,7 @@ namespace CalamityMod.Systems.Mechanic
|
||||
DepthStencilState.None,
|
||||
RasterizerState.CullNone,
|
||||
null,
|
||||
Main.GameViewMatrix.ZoomMatrix
|
||||
Main.Transform
|
||||
);
|
||||
foreach (var box in ActiveBoxes)
|
||||
{
|
||||
@@ -144,7 +144,7 @@ namespace CalamityMod.Systems.Mechanic
|
||||
ActiveBoxes.Remove(box);
|
||||
i--;
|
||||
}
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace CalamityMod.Systems
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace CalamityMod.UI.DraedonsArsenal
|
||||
}
|
||||
|
||||
// When the mouse is released, save the config and destroy the drag offset.
|
||||
if (ms.LeftButton == ButtonState.Released)
|
||||
if (dragOffset.HasValue && ms.LeftButton == ButtonState.Released)
|
||||
{
|
||||
dragOffset = null;
|
||||
CalamityClientConfig.Instance.SaveChanges();
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace CalamityMod.UI
|
||||
}
|
||||
|
||||
// When the mouse is released, save the config and destroy the drag offset.
|
||||
if (ms.LeftButton == ButtonState.Released)
|
||||
if (dragOffset.HasValue && ms.LeftButton == ButtonState.Released)
|
||||
{
|
||||
dragOffset = null;
|
||||
CalamityClientConfig.Instance.SaveChanges();
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace CalamityMod.UI.Rippers
|
||||
}
|
||||
|
||||
// When the mouse is released, save the config and destroy the drag offset.
|
||||
if (ms.LeftButton == ButtonState.Released)
|
||||
if (rageDragOffset.HasValue && ms.LeftButton == ButtonState.Released)
|
||||
{
|
||||
rageDragOffset = null;
|
||||
CalamityClientConfig.Instance.SaveChanges();
|
||||
@@ -264,7 +264,7 @@ namespace CalamityMod.UI.Rippers
|
||||
}
|
||||
|
||||
// When the mouse is released, save the config and destroy the drag offset.
|
||||
if (ms.LeftButton == ButtonState.Released)
|
||||
if (adrenDragOffset.HasValue && ms.LeftButton == ButtonState.Released)
|
||||
{
|
||||
adrenDragOffset = null;
|
||||
CalamityClientConfig.Instance.SaveChanges();
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace CalamityMod.UI
|
||||
}
|
||||
|
||||
// When the mouse is released, save the config and destroy the drag offset.
|
||||
if (ms.LeftButton == ButtonState.Released)
|
||||
if (dragOffset.HasValue && ms.LeftButton == ButtonState.Released)
|
||||
{
|
||||
dragOffset = null;
|
||||
CalamityClientConfig.Instance.SaveChanges();
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace CalamityMod.UI.SulphurousWaterMeter
|
||||
}
|
||||
|
||||
// When the mouse is released, save the config and destroy the drag offset.
|
||||
if (ms.LeftButton == ButtonState.Released)
|
||||
if (dragOffset.HasValue && ms.LeftButton == ButtonState.Released)
|
||||
{
|
||||
dragOffset = null;
|
||||
CalamityClientConfig.Instance.SaveChanges();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -6,7 +7,6 @@ using Microsoft.Xna.Framework.Input;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.CalPlayer;
|
||||
|
||||
namespace CalamityMod.UI.DraedonsArsenal
|
||||
{
|
||||
@@ -130,7 +130,7 @@ namespace CalamityMod.UI.DraedonsArsenal
|
||||
}
|
||||
|
||||
// When the mouse is released, save the config and destroy the drag offset.
|
||||
if (ms.LeftButton == ButtonState.Released)
|
||||
if (dragOffset.HasValue && ms.LeftButton == ButtonState.Released)
|
||||
{
|
||||
dragOffset = null;
|
||||
CalamityClientConfig.Instance.SaveChanges();
|
||||
|
||||
@@ -8,12 +8,14 @@ namespace CalamityMod
|
||||
{
|
||||
private static readonly List<IDeferredLoadTexture> Textures = [];
|
||||
private static readonly List<IDeferredLoadTexture> TexturesToRemove = [];
|
||||
private static bool HasItem = false;
|
||||
|
||||
public static void Enqueue(IDeferredLoadTexture texture)
|
||||
{
|
||||
Main.QueueMainThreadAction(() =>
|
||||
{
|
||||
Textures.Add(texture);
|
||||
HasItem = true;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -29,6 +31,9 @@ namespace CalamityMod
|
||||
|
||||
private static void DoUpdate()
|
||||
{
|
||||
if (!HasItem)
|
||||
return;
|
||||
|
||||
int limitPerTick = 2;
|
||||
foreach (var texture in Textures)
|
||||
{
|
||||
@@ -39,7 +44,7 @@ namespace CalamityMod
|
||||
limitPerTick--;
|
||||
}
|
||||
|
||||
if (limitPerTick < 0)
|
||||
if (limitPerTick <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -51,6 +56,7 @@ namespace CalamityMod
|
||||
}
|
||||
|
||||
TexturesToRemove.Clear();
|
||||
HasItem = Textures.Count != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||