Merge branch '1.4' into desert-prowler

This commit is contained in:
IbanPlay committed 2022-07-13 01:46:20 +02:00
commit c754d940d4
20 files changed
+400 -314

No files matched your search

-6
View File
@@ -5689,12 +5689,6 @@ namespace CalamityMod.CalPlayer
Player.waist = (sbyte)EquipLoader.GetEquipSlot(Mod, "DaedalusBreastplate", EquipType.Waist);
}
if (Player.body == EquipLoader.GetEquipSlot(Mod, "DemonshadeBreastplate", EquipType.Body))
{
//Use an extra front layers to have the players arms draw above the shoulderpads that droop
Player.front = (sbyte)EquipLoader.GetEquipSlot(Mod, "DemonshadeBreastplate", EquipType.Front);
}
bool victideBreastplateVisible = Player.body == EquipLoader.GetEquipSlot(Mod, "VictideBreastplate", EquipType.Body);
//Give the player faulds if either the body armor or the leggings are equipped
if (victideBreastplateVisible || Player.legs == EquipLoader.GetEquipSlot(Mod, "VictideGreaves", EquipType.Legs))
+5 -9
View File
@@ -22,21 +22,17 @@ namespace CalamityMod.CalPlayer.DrawLayers
return;
Player drawPlayer = drawInfo.drawPlayer;
int bodyItem = drawPlayer.armor[1].type;
Item bodyItem = drawPlayer.armor[1];
if (drawPlayer.armor[11].type > ItemID.None)
bodyItem = drawPlayer.armor[11].type;
bodyItem = drawPlayer.armor[11];
if (ModContent.GetModItem(bodyItem) is IBulkyArmor chestplateBulkDrawer)
if (ModContent.GetModItem(bodyItem.type) is IBulkyArmor chestplateBulkDrawer)
{
int equipSlot = chestplateBulkDrawer.BodySlot(drawPlayer);
if (equipSlot == -1)
equipSlot = EquipLoader.GetEquipSlot(Mod, ModContent.GetModItem(bodyItem).Name, EquipType.Body);
string equipSlotName = chestplateBulkDrawer.EquipSlotName(drawPlayer) != "" ? chestplateBulkDrawer.EquipSlotName(drawPlayer) : bodyItem.ModItem.Name;
int equipSlot = EquipLoader.GetEquipSlot(Mod, equipSlotName, EquipType.Body);
if (drawPlayer.body != equipSlot)
return;
int dyeShader = drawPlayer.dye?[1].dye ?? 0;
Vector2 drawPosition = drawInfo.Position - Main.screenPosition;
@@ -0,0 +1,60 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.DataStructures;
using Terraria.ModLoader;
namespace CalamityMod.CalPlayer.DrawLayers
{
//Draws the front arm of the armor over the shoulderpad when walking.
public class FrontARmOverShoulderpadLayer : PlayerDrawLayer
{
public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.ArmOverItem);
public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) => drawInfo.shadow == 0f || !drawInfo.drawPlayer.dead;
protected override void Draw(ref PlayerDrawSet drawInfo)
{
Player drawPlayer = drawInfo.drawPlayer;
Item bodyItem = drawPlayer.armor[1];
if (drawPlayer.armor[11].type > ItemID.None)
bodyItem = drawPlayer.armor[11];
if (ModContent.GetModItem(bodyItem.type) is IDrawArmOverShoulderpad frontArmDrawer)
{
string equipSlotName = frontArmDrawer.EquipSlotName(drawPlayer) != "" ? frontArmDrawer.EquipSlotName(drawPlayer) : bodyItem.ModItem.Name;
int equipSlot = EquipLoader.GetEquipSlot(Mod, equipSlotName, EquipType.Body);
if (drawPlayer.body != equipSlot)
return;
int dyeShader = drawPlayer.dye?[1].dye ?? 0;
Vector2 drawPosition = drawInfo.Position - Main.screenPosition;
// Using drawPlayer to get width & height and such is perfectly fine, on the other hand. Just center everything
drawPosition += new Vector2((drawPlayer.width - drawPlayer.bodyFrame.Width) / 2f, drawPlayer.height - drawPlayer.bodyFrame.Height + 4f);
//Convert to int to remove the jitter.
drawPosition = new Vector2((int)drawPosition.X, (int)drawPosition.Y);
//Some dispalcements
drawPosition += drawPlayer.bodyPosition + drawInfo.bodyVect;
//Grab the extension texture
Texture2D extraPieceTexture = ModContent.Request<Texture2D>(frontArmDrawer.FrontArmTexture).Value;
//Get the frame of the extension based on the players body frame
Rectangle frame = extraPieceTexture.Frame(1, 20, 0, drawPlayer.bodyFrame.Y / drawPlayer.bodyFrame.Height);
DrawData pieceDrawData = new DrawData(extraPieceTexture, drawPosition, frame, drawInfo.colorArmorBody, drawPlayer.fullRotation, drawInfo.bodyVect, 1f, drawInfo.playerEffect, 0)
{
shader = dyeShader
};
drawInfo.DrawDataCache.Add(pieceDrawData);
}
}
}
}
+1 -1
View File
@@ -24,7 +24,7 @@ namespace CalamityMod.CalPlayer.DrawLayers
if (ModContent.GetModItem(headItem.type) is IExtendedHat extendedHatDrawer)
{
string equipSlotName = extendedHatDrawer.EquipSlotName(drawPlayer) != "" ? extendedHatDrawer.EquipSlotName(drawPlayer) : headItem.Name;
string equipSlotName = extendedHatDrawer.EquipSlotName(drawPlayer) != "" ? extendedHatDrawer.EquipSlotName(drawPlayer) : headItem.ModItem.Name;
int equipSlot = EquipLoader.GetEquipSlot(Mod, equipSlotName, EquipType.Head);
if (extendedHatDrawer.PreDrawExtension(drawInfo) && !drawInfo.drawPlayer.dead && equipSlot == drawPlayer.head)
+3 -4
View File
@@ -14,9 +14,8 @@ public interface IBulkyArmor
string BulkTexture { get; }
/// <summary>
/// The slot for the body equip texture.
/// Defaults to -1, which will have it search itself for the appropriate body slot using the name of the item.
/// If your item has different body slot types depending on other factors, you can specify it here.
/// The name of the equip slot for the item. If left empty, the equip slot that is looked for will use the name of the item.
/// Useful if you have multiple body textures you need to add bulk to.
/// </summary>
int BodySlot(Player drawPlayer) => -1;
string EquipSlotName(Player drawPlayer) => "";
}
@@ -0,0 +1,21 @@
using Microsoft.Xna.Framework;
using Terraria.DataStructures;
using Terraria;
/// <summary>
/// Interface that can be used by chestplates that need their front arm (when walking) to go over the shoulderpads
/// </summary>
public interface IDrawArmOverShoulderpad
{
/// <summary>
/// The texture of the part that goes above the shoulderpads
/// This should be the same size as a regular equipped sprite (20 x 560 in 1x1)
/// </summary>
string FrontArmTexture { get; }
/// <summary>
/// The name of the equip slot for the item. If left empty, the equip slot that is looked for will use the name of the item.
/// Useful if you have multiple head textures you need to extend.
/// </summary>
string EquipSlotName(Player drawPlayer) => "";
}
@@ -105,6 +105,8 @@ namespace CalamityMod.Items.Accessories.Vanity
{
Player.legs = EquipLoader.GetEquipSlot(Mod, "AbandonedWulfrumHelmet", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "AbandonedWulfrumHelmet", EquipType.Body);
Player.HideAccessories();
}
}
}
@@ -8,15 +8,10 @@ using Terraria.ID;
namespace CalamityMod.Items.Armor.Demonshade
{
[AutoloadEquip(EquipType.Body)]
public class DemonshadeBreastplate : ModItem
public class DemonshadeBreastplate : ModItem, IDrawArmOverShoulderpad
{
public override void Load()
{
if (Main.netMode != NetmodeID.Server)
{
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Demonshade/DemonshadeBreastplate_Arms", EquipType.Front, this);
}
}
public string FrontArmTexture => "CalamityMod/Items/Armor/Demonshade/DemonshadeBreastplate_Arms";
public override void SetStaticDefaults()
{
+1 -1
View File
@@ -70,7 +70,7 @@ namespace CalamityMod.Items.Armor.Wulfrum
Item.SetDefaults(0);
Item.stack = 0;
Main.mouseItem = null;
Main.mouseItem = new Item();
}
}
+1 -1
View File
@@ -242,7 +242,7 @@ namespace CalamityMod.Items.Armor.Wulfrum
setBonus3.OverrideColor = new Color(110, 192, 93);
tooltips.Insert(setBonusIndex + 3, setBonus3);
if (Main.keyState.IsKeyDown(LeftShift))
if (!Main.keyState.IsKeyDown(LeftShift))
{
TooltipLine itemDisplay = new TooltipLine(item.Mod, "CalamityMod:ArmorItemDisplay", "Hold SHIFT to see the stats of the fusion cannon");
itemDisplay.OverrideColor = new Color(190, 190, 190);
+1
View File
@@ -26,6 +26,7 @@ namespace CalamityMod.Items.Materials
Item.maxStack = 999;
Item.value = Item.sellPrice(copper: 80);
Item.rare = ItemRarityID.Blue;
Item.ammo = Item.type;
}
public override void OnSpawn(IEntitySource source)
+2 -1
View File
@@ -24,7 +24,8 @@ namespace CalamityMod.Items.Tools
{
DisplayName.SetDefault("Wulfrum Scaffold Kit");
Tooltip.SetDefault("\"For when you need something built fast and don't need it to last.\"\n" +
"Places down temporary metal scaffolding. Uses up one wulfrum metal scrap for " + TilesPerScrap.ToString() + " tiles built"
"Places down temporary metal scaffolding. Uses up one wulfrum metal scrap for " + TilesPerScrap.ToString() + " tiles built\n" +
"Scaffold needs to be adjacent to a solid tile to be placed down"
);
SacrificeTotal = 1;
}
+14
View File
@@ -58,4 +58,18 @@ namespace CalamityMod.Items.Weapons.Melee
Register();
}
}
public class SpearChargePlayer : ModPlayer
{
public bool ChargingKnockbackResist = false;
public override void PostUpdateMiscEffects()
{
if (ChargingKnockbackResist)
{
Player.noKnockback = true;
ChargingKnockbackResist = false;
}
}
}
}
@@ -87,6 +87,7 @@ namespace CalamityMod.Items.Weapons.Summon
if (buffingDrones > 0)
{
Player.lifeRegen += (int)((1 + Math.Log(buffingDrones) * 2) * 3);
Player.statDefense += buffingDrones * 3;
buffingDrones = 0;
}
+5 -1
View File
@@ -5520,7 +5520,11 @@ namespace CalamityMod.NPCs
// Draw lights
if (npc.ai[2] == 0f)
{
if ((newAI[3] >= 900f && npc.life / (float)npc.lifeMax < 0.5f) || (newAI[1] < 600f && newAI[1] > 60f))
float destroyerLifeRatio = 1f;
if (npc.realLife >= 0)
destroyerLifeRatio = Main.npc[npc.realLife].life / (float)Main.npc[npc.realLife].lifeMax;
if ((newAI[3] >= 900f && destroyerLifeRatio < 0.5f) || (newAI[1] < 600f && newAI[1] > 60f))
{
for (int i = 0; i < 3; i++)
{
+109 -92
View File
@@ -35,8 +35,6 @@ namespace CalamityMod.NPCs.Cryogen
public class Cryogen : ModNPC
{
private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax;
private int time = 0;
private int iceShard = 0;
private int currentPhase = 1;
private int teleportLocationX = 0;
@@ -92,8 +90,6 @@ namespace CalamityMod.NPCs.Cryogen
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(biomeEnrageTimer);
writer.Write(time);
writer.Write(iceShard);
writer.Write(teleportLocationX);
writer.Write(NPC.dontTakeDamage);
for (int i = 0; i < 4; i++)
@@ -103,8 +99,6 @@ namespace CalamityMod.NPCs.Cryogen
public override void ReceiveExtraAI(BinaryReader reader)
{
biomeEnrageTimer = reader.ReadInt32();
time = reader.ReadInt32();
iceShard = reader.ReadInt32();
teleportLocationX = reader.ReadInt32();
NPC.dontTakeDamage = reader.ReadBoolean();
for (int i = 0; i < 4; i++)
@@ -220,7 +214,7 @@ namespace CalamityMod.NPCs.Cryogen
{
NPC.ai[1] = 0f;
teleportLocationX = 0;
iceShard = 0;
calamityGlobalNPC.newAI[2] = 0f;
NPC.netUpdate = true;
}
return;
@@ -231,6 +225,9 @@ namespace CalamityMod.NPCs.Cryogen
float chargePhaseGateValue = bossRush ? 240f : 360f;
float chargeDuration = 60f;
float chargeTelegraphTime = NPC.ai[0] == 2f ? 100f : 120f;
float chargeTelegraphMaxRotationIncrement = 1f;
float chargeTelegraphRotationIncrement = chargeTelegraphMaxRotationIncrement / chargeTelegraphTime;
float chargeSlowDownTime = 15f;
float chargeVelocityMin = 12f;
float chargeVelocityMax = 30f;
@@ -239,16 +236,16 @@ namespace CalamityMod.NPCs.Cryogen
chargePhaseGateValue *= 0.7f;
chargeDuration *= 0.8f;
}
float chargeGateValue = chargePhaseGateValue + (NPC.ai[0] == 2f ? 20f : 30f);
float chargeGateValue = chargePhaseGateValue + chargeTelegraphTime;
float chargeSlownDownPhaseGateValue = chargeGateValue + chargeSlowDownTime;
bool chargePhase = NPC.ai[1] >= chargePhaseGateValue;
if (Main.netMode != NetmodeID.MultiplayerClient && expertMode && (NPC.ai[0] < 5f || !phase6) && !chargePhase)
{
time++;
if (time >= (bossRush ? 660 : 900))
calamityGlobalNPC.newAI[3] += 1f;
if (calamityGlobalNPC.newAI[3] >= (bossRush ? 660f : 900f))
{
time = 0;
calamityGlobalNPC.newAI[3] = 0f;
SoundEngine.PlaySound(SoundID.Item28, NPC.Center);
int totalProjectiles = 3;
float radians = MathHelper.TwoPi / totalProjectiles;
@@ -407,10 +404,40 @@ namespace CalamityMod.NPCs.Cryogen
{
NPC.ai[1] += 1f;
calamityGlobalNPC.newAI[0] += 0.025f;
if (calamityGlobalNPC.newAI[0] > 0.5f)
calamityGlobalNPC.newAI[0] = 0.5f;
float totalSpreads = 3f;
if ((NPC.ai[1] - chargePhaseGateValue) % (chargeTelegraphTime / totalSpreads) == 0f)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
{
SoundEngine.PlaySound(SoundID.Item28, NPC.Center);
int type = ModContent.ProjectileType<IceRain>();
int damage = NPC.GetProjectileDamage(type);
float maxVelocity = 9f + enrageScale;
float velocity = maxVelocity - (calamityGlobalNPC.newAI[0] * maxVelocity * 0.5f);
int totalProjectiles = 10;
int maxTotalProjectileReductionBasedOnRotationSpeed = (int)(totalProjectiles * 0.7f);
int totalProjectilesShot = totalProjectiles - (int)Math.Round(calamityGlobalNPC.newAI[0] * maxTotalProjectileReductionBasedOnRotationSpeed);
for (int i = 0; i < 2; i++)
{
float radians = MathHelper.TwoPi / totalProjectilesShot;
float newVelocity = velocity - (velocity * 0.5f * i);
double angleA = radians * 0.5;
double angleB = MathHelper.ToRadians(90f) - angleA;
float velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB));
Vector2 spinningPoint = i == 0 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity);
for (int k = 0; k < totalProjectilesShot; k++)
{
Vector2 vector255 = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity);
}
}
}
}
}
calamityGlobalNPC.newAI[0] += chargeTelegraphRotationIncrement;
NPC.rotation += calamityGlobalNPC.newAI[0];
NPC.velocity *= 0.98f;
}
@@ -435,32 +462,6 @@ namespace CalamityMod.NPCs.Cryogen
NPC.ai[1] = chargeGateValue + chargeDuration;
calamityGlobalNPC.newAI[0] = 0f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
{
SoundEngine.PlaySound(SoundID.Item28, NPC.Center);
int type = ModContent.ProjectileType<IceRain>();
int damage = NPC.GetProjectileDamage(type);
float velocity = 9f + enrageScale;
for (int i = 0; i < 2; i++)
{
int totalProjectiles = 10;
float radians = MathHelper.TwoPi / totalProjectiles;
float newVelocity = velocity - (velocity * 0.5f * i);
double angleA = radians * 0.5;
double angleB = MathHelper.ToRadians(90f) - angleA;
float velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB));
Vector2 spinningPoint = i == 0 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 vector255 = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity);
}
}
}
}
}
NPC.ai[1] -= 1f;
@@ -489,7 +490,7 @@ namespace CalamityMod.NPCs.Cryogen
NPC.ai[1] = 0f;
NPC.localAI[0] = 0f;
calamityGlobalNPC.newAI[0] = 0f;
iceShard = 0;
calamityGlobalNPC.newAI[2] = 0f;
NPC.netUpdate = true;
}
}
@@ -549,10 +550,40 @@ namespace CalamityMod.NPCs.Cryogen
{
NPC.ai[1] += 1f;
calamityGlobalNPC.newAI[0] += 0.025f;
if (calamityGlobalNPC.newAI[0] > 0.5f)
calamityGlobalNPC.newAI[0] = 0.5f;
float totalSpreads = 2f;
if ((NPC.ai[1] - chargePhaseGateValue) % (chargeTelegraphTime / totalSpreads) == 0f)
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
{
SoundEngine.PlaySound(SoundID.Item28, NPC.Center);
int type = ModContent.ProjectileType<IceRain>();
int damage = NPC.GetProjectileDamage(type);
float maxVelocity = 9f + enrageScale;
float velocity = maxVelocity - (calamityGlobalNPC.newAI[0] * maxVelocity * 0.5f);
int totalProjectiles = calamityGlobalNPC.newAI[1] == 0f ? 8 : 4;
int maxTotalProjectileReductionBasedOnRotationSpeed = (int)(totalProjectiles * 0.4f);
int totalProjectilesShot = totalProjectiles - (int)Math.Round(calamityGlobalNPC.newAI[0] * maxTotalProjectileReductionBasedOnRotationSpeed);
for (int i = 0; i < 3; i++)
{
float radians = MathHelper.TwoPi / totalProjectilesShot;
float newVelocity = velocity - (velocity * 0.33f * i);
double angleA = radians * 0.5;
double angleB = MathHelper.ToRadians(90f) - angleA;
float velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB));
Vector2 spinningPoint = i == 1 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity);
for (int k = 0; k < totalProjectilesShot; k++)
{
Vector2 vector255 = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity);
}
}
}
}
}
calamityGlobalNPC.newAI[0] += chargeTelegraphRotationIncrement;
NPC.rotation += calamityGlobalNPC.newAI[0];
NPC.velocity *= 0.98f;
}
@@ -577,32 +608,6 @@ namespace CalamityMod.NPCs.Cryogen
NPC.ai[1] = chargeGateValue + chargeDuration;
calamityGlobalNPC.newAI[0] = 0f;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
{
SoundEngine.PlaySound(SoundID.Item28, NPC.Center);
int type = ModContent.ProjectileType<IceRain>();
int damage = NPC.GetProjectileDamage(type);
float velocity = 9f + enrageScale;
for (int i = 0; i < 3; i++)
{
int totalProjectiles = calamityGlobalNPC.newAI[1] == 0f ? 8 : 4;
float radians = MathHelper.TwoPi / totalProjectiles;
float newVelocity = velocity - (velocity * 0.33f * i);
double angleA = radians * 0.5;
double angleB = MathHelper.ToRadians(90f) - angleA;
float velocityX = (float)(newVelocity * Math.Sin(angleA) / Math.Sin(angleB));
Vector2 spinningPoint = i == 1 ? new Vector2(0f, -newVelocity) : new Vector2(-velocityX, -newVelocity);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 vector255 = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(vector255) * 30f, vector255, type, damage, 0f, Main.myPlayer, 0f, velocity);
}
}
}
}
}
NPC.ai[1] -= 1f;
@@ -617,6 +622,8 @@ namespace CalamityMod.NPCs.Cryogen
NPC.localAI[0] = 0f;
calamityGlobalNPC.newAI[1] = 0f;
}
else
NPC.ai[1] = chargePhaseGateValue;
NPC.rotation = NPC.velocity.X * 0.1f;
}
@@ -726,7 +733,7 @@ namespace CalamityMod.NPCs.Cryogen
}
NPC.ai[1] = 1f;
teleportLocationX = num1250;
iceShard = num1251;
calamityGlobalNPC.newAI[2] = num1251;
NPC.netUpdate = true;
Block:
;
@@ -738,7 +745,7 @@ namespace CalamityMod.NPCs.Cryogen
// Avoid cheap bullshit
NPC.damage = 0;
Vector2 position = new Vector2(teleportLocationX * 16f - (NPC.width / 2), iceShard * 16f - (NPC.height / 2));
Vector2 position = new Vector2(teleportLocationX * 16f - (NPC.width / 2), calamityGlobalNPC.newAI[2] * 16f - (NPC.height / 2));
for (int m = 0; m < 5; m++)
{
int dust = Dust.NewDust(position, NPC.width, NPC.height, 67, 0f, 0f, 100, default, 2f);
@@ -816,7 +823,7 @@ namespace CalamityMod.NPCs.Cryogen
NPC.localAI[2] = 0f;
NPC.Opacity = 1f;
teleportLocationX = 0;
iceShard = 0;
calamityGlobalNPC.newAI[2] = 0f;
NPC.netUpdate = true;
int chance = 100;
@@ -847,7 +854,7 @@ namespace CalamityMod.NPCs.Cryogen
int type = ModContent.ProjectileType<IceBlast>();
int damage = NPC.GetProjectileDamage(type);
float velocity = 1.5f + enrageScale * 0.5f;
int totalSpreads = phase7 ? 4 : 2;
int totalSpreads = phase7 ? 3 : 2;
for (int i = 0; i < totalSpreads; i++)
{
int totalProjectiles = bossRush ? 3 : 2;
@@ -881,7 +888,7 @@ namespace CalamityMod.NPCs.Cryogen
NPC.ai[0] = 5f;
NPC.ai[1] = 0f;
NPC.ai[3] = 0f;
time = 0;
calamityGlobalNPC.newAI[3] = 0f;
}
else
NPC.ai[1] = 60f;
@@ -908,32 +915,42 @@ namespace CalamityMod.NPCs.Cryogen
float num1376 = num1372 / num1375;
num1373 *= num1376;
num1374 *= num1376;
iceShard--;
calamityGlobalNPC.newAI[2] -= 1f;
if (num1375 < 200f || iceShard > 0)
float chargeStartDistance = 300f;
float chargeCooldown = 30f;
if (num1375 < chargeStartDistance || calamityGlobalNPC.newAI[2] > 0f)
{
if (num1375 < 200f)
iceShard = 20;
if (num1375 < chargeStartDistance)
calamityGlobalNPC.newAI[2] = chargeCooldown;
if (NPC.velocity.Length() < num1372)
{
NPC.velocity.Normalize();
NPC.velocity *= num1372;
}
NPC.rotation += NPC.direction * 0.5f;
NPC.rotation += NPC.direction * 0.3f;
return;
}
float inertia = 50f;
float inertia = 30f;
if (Main.getGoodWorld)
inertia *= 0.5f;
NPC.velocity.X = (NPC.velocity.X * inertia + num1373) / (inertia + 1f);
NPC.velocity.Y = (NPC.velocity.Y * inertia + num1374) / (inertia + 1f);
if (num1375 < 350f)
if (num1375 < chargeStartDistance + 200f)
{
NPC.velocity.X = (NPC.velocity.X * 10f + num1373) / 11f;
NPC.velocity.Y = (NPC.velocity.Y * 10f + num1374) / 11f;
NPC.velocity.X = (NPC.velocity.X * 9f + num1373) / 10f;
NPC.velocity.Y = (NPC.velocity.Y * 9f + num1374) / 10f;
}
if (num1375 < 300f)
if (num1375 < chargeStartDistance + 100f)
{
NPC.velocity.X = (NPC.velocity.X * 7f + num1373) / 8f;
NPC.velocity.Y = (NPC.velocity.Y * 7f + num1374) / 8f;
NPC.velocity.X = (NPC.velocity.X * 4f + num1373) / 5f;
NPC.velocity.Y = (NPC.velocity.Y * 4f + num1374) / 5f;
}
NPC.rotation = NPC.velocity.X * 0.15f;
@@ -942,10 +959,10 @@ namespace CalamityMod.NPCs.Cryogen
{
NPC.rotation = NPC.velocity.X * 0.1f;
time++;
if (time >= (bossRush ? 50 : 75))
calamityGlobalNPC.newAI[3] += 1f;
if (calamityGlobalNPC.newAI[3] >= (bossRush ? 50f : 75f))
{
time = 0;
calamityGlobalNPC.newAI[3] = 0f;
SoundEngine.PlaySound(SoundID.Item28, NPC.Center);
int totalProjectiles = 2;
float radians = MathHelper.TwoPi / totalProjectiles;
@@ -969,8 +986,8 @@ namespace CalamityMod.NPCs.Cryogen
NPC.TargetClosest();
NPC.ai[0] = 4f;
NPC.ai[1] = 60f;
time = 0;
iceShard = 0;
calamityGlobalNPC.newAI[3] = 0f;
calamityGlobalNPC.newAI[2] = 0f;
NPC.netUpdate = true;
}
@@ -172,7 +172,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
// Float near player
if (npc.ai[1] == 0f || npc.ai[1] == 4f)
{
// Start other phases if arms are dead, start with spinning phase
// Start other phases if arms are dead, start with spin phase
if (allArmsDead)
{
// Start spin phase after 1.5 seconds
@@ -185,7 +185,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (shouldSpinAroundTarget || npc.ai[1] != 4f)
{
if (shouldSpinAroundTarget)
npc.ai[3] = Vector2.Distance(Main.player[npc.target].Center, npc.Center);
npc.ai[3] = 300f;
npc.ai[2] = 0f;
npc.ai[1] = shouldSpinAroundTarget ? 5f : 1f;
@@ -426,10 +426,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
{
npc.ai[2] += 1f;
npc.rotation = npc.velocity.X / 30f;
npc.rotation = npc.velocity.X / 50f;
// Spin for 3 seconds
float spinVelocity = 45f;
float skullSpawnDivisor = bossRush ? 9f : death ? 15f - (float)Math.Round(5f * (1f - lifeRatio)) : 15f;
float totalSkulls = 12f;
int skullSpread = bossRush ? 250 : death ? 150 : 100;
// Spin for about 3 seconds
float spinVelocity = 30f;
if (npc.ai[2] == 2f)
{
// Play angry noise
@@ -450,10 +454,12 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
}
// Maintain velocity and spit skulls
else
else if (npc.ai[2] > 2f)
{
npc.velocity = npc.velocity.RotatedBy(MathHelper.Pi / spinVelocity * -calamityGlobalNPC.newAI[0]);
float skullSpawnDivisor = bossRush ? 15f : death ? 30f - (float)Math.Round(10f * (1f - lifeRatio)) : 30f;
if (npc.ai[2] == 3f)
npc.velocity *= 0.6f;
if (npc.ai[2] % skullSpawnDivisor == 0f)
{
calamityGlobalNPC.newAI[1] += 1f;
@@ -471,7 +477,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
num160 *= num162;
num161 *= num162;
Vector2 value = new Vector2(num160 * 1f + Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + Main.rand.Next(-50, 51) * 0.01f);
Vector2 value = new Vector2(num160 + Main.rand.Next(-skullSpread, skullSpread + 1) * 0.01f, num161 + Main.rand.Next(-skullSpread, skullSpread + 1) * 0.01f);
value.Normalize();
value *= num159;
num160 = value.X;
@@ -487,7 +493,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
}
// Go to floating phase, or spinning phase if in phase 2
if (calamityGlobalNPC.newAI[1] >= 6f)
if (calamityGlobalNPC.newAI[1] >= totalSkulls)
{
npc.velocity.Normalize();
@@ -620,6 +626,53 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
bool normalLaserRotation = npc.localAI[1] % 2f == 0f;
// Movement
float velocityY = bossRush ? 0.5f : death ? 2f : 2.5f;
float velocityX = bossRush ? 1f : death ? 5f : 7f;
float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f;
if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y -= acceleration;
if (npc.velocity.Y > velocityY)
npc.velocity.Y = velocityY;
}
else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f)
{
if (npc.velocity.Y < 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y += acceleration;
if (npc.velocity.Y < -velocityY)
npc.velocity.Y = -velocityY;
}
if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0])
{
if (npc.velocity.X > 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X -= acceleration;
if (npc.velocity.X > velocityX)
npc.velocity.X = velocityX;
}
if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0])
{
if (npc.velocity.X < 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X += acceleration;
if (npc.velocity.X < -velocityX)
npc.velocity.X = -velocityX;
}
// Phase 1
if (npc.ai[2] == 0f)
{
@@ -645,51 +698,6 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
npc.netUpdate = true;
}
float velocityY = bossRush ? 0.5f : death ? 2f : 2.5f;
float velocityX = bossRush ? 1f : death ? 5f : 7f;
if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y -= bossRush ? 0.3f : death ? 0.12f : 0.1f;
if (npc.velocity.Y > velocityY)
npc.velocity.Y = velocityY;
}
else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f)
{
if (npc.velocity.Y < 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y += bossRush ? 0.3f : death ? 0.12f : 0.1f;
if (npc.velocity.Y < -velocityY)
npc.velocity.Y = -velocityY;
}
if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0])
{
if (npc.velocity.X > 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X -= bossRush ? 0.3f : death ? 0.16f : 0.14f;
if (npc.velocity.X > velocityX)
npc.velocity.X = velocityX;
}
if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - 180f * npc.ai[0])
{
if (npc.velocity.X < 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X += bossRush ? 0.3f : death ? 0.16f : 0.14f;
if (npc.velocity.X < -velocityX)
npc.velocity.X = -velocityX;
}
Vector2 vector62 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
float num506 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector62.X;
float num507 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector62.Y;
@@ -749,41 +757,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
}
Vector2 vector63 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
float num513 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - 320f - vector63.X;
float num514 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 320f - vector63.Y;
float num515 = (float)Math.Sqrt(num513 * num513 + num514 * num514);
num515 = 9f / num515;
num513 *= num515;
num514 *= num515;
if (npc.velocity.X > num513)
{
if (npc.velocity.X > 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X -= bossRush ? 0.3f : death ? 0.12f : 0.1f;
}
if (npc.velocity.X < num513)
{
if (npc.velocity.X < 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X += bossRush ? 0.3f : death ? 0.12f : 0.1f;
}
if (npc.velocity.Y > num514)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y -= bossRush ? 0.3f : death ? 0.08f : 0.06f;
}
if (npc.velocity.Y < num514)
{
if (npc.velocity.Y < 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y += bossRush ? 0.3f : death ? 0.08f : 0.06f;
}
vector63 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
num513 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector63.X;
num514 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector63.Y;
float num513 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector63.X;
float num514 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector63.Y;
npc.rotation = (float)Math.Atan2(num514, num513) - MathHelper.PiOver2;
if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack)
@@ -808,8 +783,8 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
float velocity = 3f;
double angleA = radians * 0.5;
double angleB = MathHelper.ToRadians(90f) - angleA;
float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB));
Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity);
float laserVelocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB));
Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-laserVelocityX, -velocity);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 vector255 = spinningPoint.RotatedBy(radians * k);
@@ -940,56 +915,58 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
}
}
// Movement
float velocityY = bossRush ? 0.5f : death ? 2f : 2.5f;
float velocityX = bossRush ? 1f : death ? 5f : 7f;
float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f;
if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 150f)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y -= acceleration;
if (npc.velocity.Y > velocityY)
npc.velocity.Y = velocityY;
}
else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 150f)
{
if (npc.velocity.Y < 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y += acceleration;
if (npc.velocity.Y < -velocityY)
npc.velocity.Y = -velocityY;
}
if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 200f)
{
if (npc.velocity.X > 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X -= acceleration;
if (npc.velocity.X > velocityX)
npc.velocity.X = velocityX;
}
if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 160f)
{
if (npc.velocity.X < 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X += acceleration;
if (npc.velocity.X < -velocityX)
npc.velocity.X = -velocityX;
}
if (fireSlower)
{
if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10)
npc.timeLeft = 10;
float velocityY = bossRush ? 0.5f : death ? 2f : 2.5f;
float velocityX = bossRush ? 1f : death ? 5f : 7f;
if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 150f)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y -= bossRush ? 0.275f : death ? 0.1f : 0.08f;
if (npc.velocity.Y > velocityY)
npc.velocity.Y = velocityY;
}
else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 150f)
{
if (npc.velocity.Y < 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y += bossRush ? 0.275f : death ? 0.1f : 0.08f;
if (npc.velocity.Y < -velocityY)
npc.velocity.Y = -velocityY;
}
if (npc.position.X + (npc.width / 2) > Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 200f)
{
if (npc.velocity.X > 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X -= bossRush ? 0.275f : death ? 0.22f : 0.2f;
if (npc.velocity.X > velocityX)
npc.velocity.X = velocityX;
}
if (npc.position.X + (npc.width / 2) < Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) + 160f)
{
if (npc.velocity.X < 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X += bossRush ? 0.275f : death ? 0.22f : 0.2f;
if (npc.velocity.X < -velocityX)
npc.velocity.X = -velocityX;
}
Vector2 vector60 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
float num492 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector60.X;
float num493 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector60.Y;
@@ -1025,45 +1002,11 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
}
}
}
else
{
Vector2 vector61 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
float num499 = Main.npc[(int)npc.ai[1]].position.X + (Main.npc[(int)npc.ai[1]].width / 2) - vector61.X;
float num500 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - 320f - vector61.Y;
float num501 = (float)Math.Sqrt(num499 * num499 + num500 * num500);
num501 = 9f / num501;
num499 *= num501;
num500 *= num501;
if (npc.velocity.X > num499)
{
if (npc.velocity.X > 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X -= bossRush ? 0.275f : death ? 0.1f : 0.08f;
}
if (npc.velocity.X < num499)
{
if (npc.velocity.X < 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X += bossRush ? 0.275f : death ? 0.1f : 0.08f;
}
if (npc.velocity.Y > num500)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y -= bossRush ? 0.275f : death ? 0.1f : 0.08f;
}
if (npc.velocity.Y < num500)
{
if (npc.velocity.Y < 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y += bossRush ? 0.275f : death ? 0.1f : 0.08f;
}
vector61 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f);
num499 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector61.X;
num500 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector61.Y;
float num499 = Main.player[npc.target].position.X + (Main.player[npc.target].width / 2) - vector61.X;
float num500 = Main.player[npc.target].position.Y + (Main.player[npc.target].height / 2) - vector61.Y;
npc.rotation = (float)Math.Atan2(num500, num499) - MathHelper.PiOver2;
if (Main.netMode != NetmodeID.MultiplayerClient && !dontAttack)
@@ -1182,13 +1125,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
{
float velocityY = bossRush ? 1f : death ? 5f : 7f;
float velocityX = bossRush ? 1.5f : death ? 8f : 10f;
float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f;
if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y -= bossRush ? 0.3f : death ? 0.12f : 0.1f;
npc.velocity.Y -= acceleration;
if (npc.velocity.Y > velocityY)
npc.velocity.Y = velocityY;
@@ -1198,7 +1142,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (npc.velocity.Y < 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y += bossRush ? 0.3f : death ? 0.12f : 0.1f;
npc.velocity.Y += acceleration;
if (npc.velocity.Y < -velocityY)
npc.velocity.Y = -velocityY;
@@ -1209,7 +1153,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (npc.velocity.X > 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X -= bossRush ? 1f : death ? 0.55f : 0.5f;
npc.velocity.X -= acceleration * 2f;
if (npc.velocity.X > velocityX)
npc.velocity.X = velocityX;
@@ -1219,7 +1163,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (npc.velocity.X < 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X += bossRush ? 1f : death ? 0.55f : 0.5f;
npc.velocity.X += acceleration * 2f;
if (npc.velocity.X < -velocityX)
npc.velocity.X = -velocityX;
@@ -1256,13 +1200,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
float velocityY = bossRush ? 0.5f : death ? 2f : 2.5f;
float velocityX = bossRush ? 1.5f : death ? 7f : 8f;
float velocityX2 = bossRush ? 1.25f : death ? 6f : 7f;
float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f;
if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 300f)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y -= bossRush ? 0.3f : death ? 0.12f : 0.1f;
npc.velocity.Y -= acceleration;
if (npc.velocity.Y > velocityY)
npc.velocity.Y = velocityY;
@@ -1272,7 +1217,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (npc.velocity.Y < 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y += bossRush ? 0.3f : death ? 0.12f : 0.1f;
npc.velocity.Y += acceleration;
if (npc.velocity.Y < -velocityY)
npc.velocity.Y = -velocityY;
@@ -1283,7 +1228,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (npc.velocity.X > 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X -= bossRush ? 0.8f : death ? 0.33f : 0.3f;
npc.velocity.X -= acceleration;
if (npc.velocity.X > velocityX)
npc.velocity.X = velocityX;
@@ -1293,7 +1238,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (npc.velocity.X < 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X += bossRush ? 0.8f : death ? 0.22f : 0.2f;
npc.velocity.X += acceleration;
if (npc.velocity.X < -velocityX2)
npc.velocity.X = -velocityX2;
@@ -1513,13 +1458,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
{
float velocityY = bossRush ? 1f : death ? 6f : 7f;
float velocityX = bossRush ? 1.5f : death ? 8f : 10f;
float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f;
if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y -= bossRush ? 0.3f : death ? 0.12f : 0.1f;
npc.velocity.Y -= acceleration;
if (npc.velocity.Y > velocityY)
npc.velocity.Y = velocityY;
@@ -1529,7 +1475,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (npc.velocity.Y < 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y += bossRush ? 0.3f : death ? 0.12f : 0.1f;
npc.velocity.Y += acceleration;
if (npc.velocity.Y < -velocityY)
npc.velocity.Y = -velocityY;
@@ -1540,7 +1486,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (npc.velocity.X > 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X -= bossRush ? 1.2f : death ? 0.55f : 0.5f;
npc.velocity.X -= acceleration * 2f;
if (npc.velocity.X > velocityX)
npc.velocity.X = velocityX;
@@ -1550,7 +1496,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (npc.velocity.X < 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X += bossRush ? 1.2f : death ? 0.55f : 0.5f;
npc.velocity.X += acceleration * 2f;
if (npc.velocity.X < -velocityX)
npc.velocity.X = -velocityX;
@@ -1582,13 +1528,14 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
float velocityY = bossRush ? 0.5f : death ? 2f : 2.5f;
float velocityX = bossRush ? 1.5f : death ? 8f : 10f;
float acceleration = bossRush ? 0.6f : death ? 0.3f : 0.25f;
if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 320f)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y -= bossRush ? 0.15f : death ? 0.05f : 0.04f;
npc.velocity.Y -= acceleration;
if (npc.velocity.Y > velocityY)
npc.velocity.Y = velocityY;
@@ -1598,7 +1545,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (npc.velocity.Y < 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y += bossRush ? 0.15f : death ? 0.05f : 0.04f;
npc.velocity.Y += acceleration;
if (npc.velocity.Y < -velocityY)
npc.velocity.Y = -velocityY;
@@ -1609,7 +1556,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (npc.velocity.X > 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X -= bossRush ? 0.8f : death ? 0.33f : 0.3f;
npc.velocity.X -= acceleration * 1.5f;
if (npc.velocity.X > velocityX)
npc.velocity.X = velocityX;
@@ -1619,7 +1566,7 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
if (npc.velocity.X < 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X += bossRush ? 0.8f : death ? 0.33f : 0.3f;
npc.velocity.X += acceleration * 1.5f;
if (npc.velocity.X < -velocityX)
npc.velocity.X = -velocityX;
@@ -1693,29 +1640,33 @@ namespace CalamityMod.NPCs.VanillaNPCOverrides.Bosses
num474 *= num476;
num475 *= num476;
float acceleration = bossRush ? 0.15f : death ? 0.06f : 0.05f;
float acceleration = bossRush ? 0.3f : death ? 0.1f : 0.08f;
if (npc.velocity.X > num474)
{
if (npc.velocity.X > 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X -= acceleration;
}
if (npc.velocity.X < num474)
{
if (npc.velocity.X < 0f)
npc.velocity.X *= 0.9f;
npc.velocity.X += acceleration;
}
if (npc.velocity.Y > num475)
{
if (npc.velocity.Y > 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y -= acceleration;
}
if (npc.velocity.Y < num475)
{
if (npc.velocity.Y < 0f)
npc.velocity.Y *= 0.9f;
npc.velocity.Y += acceleration;
}
+1 -1
View File
@@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Boss
if (Projectile.ai[1] == 1f)
{
float spreadOutCutoffTime = 210f;
float homeInCutoffTime = 120f;
float homeInCutoffTime = 135f;
float minAcceleration = 0.05f;
float maxAcceleration = 0.1f;
float homingVelocity = 20f;
@@ -6,6 +6,7 @@ using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Items.Weapons.Melee;
using static CalamityMod.CalamityUtils;
namespace CalamityMod.Projectiles.Melee.Spears
@@ -203,6 +204,8 @@ namespace CalamityMod.Projectiles.Melee.Spears
if (CurrentAttackState == AttackState.RunAttack)
{
Owner.GetModPlayer<SpearChargePlayer>().ChargingKnockbackResist = true;
//Keep the projectile alive during the run attack.
//The fullyRunning check is important, because the animation timer relies on the projectiles time left for the startup animation.
if (FullyRunning)
+27
View File
@@ -619,6 +619,33 @@ namespace CalamityMod
}
#endregion
#region visual layers
public static void HideAccessories(this Player player, bool hideHeadAccs = true, bool hideBodyAccs = true, bool hideLegAccs = true, bool hideShield = true)
{
if (hideHeadAccs)
player.face = -1;
if (hideBodyAccs)
{
player.handon = -1;
player.handoff = -1;
player.back = -1;
player.front = -1;
player.neck = -1;
}
if (hideLegAccs)
{
player.shoe = -1;
player.waist = -1;
}
if (hideShield)
player.shield = -1;
}
#endregion
/// <summary>
/// Makes the given player send the given packet to all appropriate receivers.<br />
/// If server is false, the packet is sent only to the multiplayer host.<br />