This commit is contained in:
Storm2103 committed 2023-10-31 19:07:31 -06:00
commit 94d035671d
808 files changed
+21106 -21312

No files matched your search

Binary file not shown.

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 694 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 584 B

After

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 627 B

After

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 622 B

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 639 B

After

Width:  |  Height:  |  Size: 665 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 585 B

After

Width:  |  Height:  |  Size: 671 B

@@ -3,7 +3,7 @@ using Terraria.ModLoader;
namespace CalamityMod.Buffs.StatBuffs
{
public class TyrantsFury : ModBuff
public class BrutalCarnage : ModBuff
{
public override void SetStaticDefaults()
{
@@ -14,7 +14,7 @@ namespace CalamityMod.Buffs.StatBuffs
public override void Update(Player player, ref int buffIndex)
{
player.Calamity().tFury = true;
player.Calamity().brutalCarnage = true;
}
}
}
File renamed without changes.

Before

Width:  |  Height:  |  Size: 625 B

After

Width:  |  Height:  |  Size: 625 B

+3 -3
View File
@@ -868,7 +868,7 @@ namespace CalamityMod.CalPlayer
public bool xWrath = false;
public bool graxDefense = false;
public bool encased = false;
public bool tFury = false;
public bool brutalCarnage = false;
public bool omniscience = false;
public bool zerg = false;
public bool zen = false;
@@ -1890,7 +1890,7 @@ namespace CalamityMod.CalPlayer
xWrath = false;
graxDefense = false;
encased = false;
tFury = false;
brutalCarnage = false;
omniscience = false;
zerg = false;
zen = false;
@@ -2344,7 +2344,7 @@ namespace CalamityMod.CalPlayer
kamiBoost = false;
graxDefense = false;
encased = false;
tFury = false;
brutalCarnage = false;
omniscience = false;
zerg = false;
zen = false;
+2 -2
View File
@@ -2463,7 +2463,7 @@ namespace CalamityMod.CalPlayer
Player.GetDamage<MeleeDamageClass>() += 0.2f;
}
if (tFury)
if (brutalCarnage)
{
Player.GetDamage<MeleeDamageClass>() += 0.25f;
Player.GetCritChance<MeleeDamageClass>() += 10;
@@ -3132,7 +3132,7 @@ namespace CalamityMod.CalPlayer
}
if (dArtifact)
Player.GetDamage<GenericDamageClass>() += 0.25f;
Player.GetDamage<GenericDamageClass>() *= 1.2f;
if (trippy)
Player.GetDamage<GenericDamageClass>() += 0.5f;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 507 B

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 403 B

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

After

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 482 B

After

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 489 B

+1 -1
View File
@@ -15,7 +15,7 @@ namespace CalamityMod.Items.Tools
Item.knockBack = 2.5f;
Item.useTime = 9;
Item.useAnimation = 16;
Item.pick = 75;
Item.pick = 100;
Item.tileBoost += 1;
Item.DamageType = DamageClass.Melee;
+2 -2
View File
@@ -12,8 +12,8 @@ namespace CalamityMod.Items.Weapons.Melee
public override void SetDefaults()
{
Item.damage = 90;
Item.width = 66;
Item.height = 66;
Item.width = 74;
Item.height = 86;
Item.scale = 1.5f;
Item.DamageType = DamageClass.Melee;
Item.useAnimation = 22;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

+2 -2
View File
@@ -40,13 +40,13 @@ namespace CalamityMod.Items.Weapons.Melee
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
player.AddBuff(ModContent.BuffType<TyrantsFury>(), 180);
player.AddBuff(ModContent.BuffType<BrutalCarnage>(), 180);
target.AddBuff(BuffID.Venom, 150);
}
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
{
player.AddBuff(ModContent.BuffType<TyrantsFury>(), 180);
player.AddBuff(ModContent.BuffType<BrutalCarnage>(), 180);
target.AddBuff(BuffID.Venom, 150);
}
+2 -2
View File
@@ -63,13 +63,13 @@ namespace CalamityMod.Items.Weapons.Melee
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
{
player.AddBuff(ModContent.BuffType<TyrantsFury>(), 300);
player.AddBuff(ModContent.BuffType<BrutalCarnage>(), 300);
target.AddBuff(BuffID.Venom, 150);
}
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
{
player.AddBuff(ModContent.BuffType<TyrantsFury>(), 300);
player.AddBuff(ModContent.BuffType<BrutalCarnage>(), 300);
target.AddBuff(BuffID.Venom, 150);
}
+1 -1
View File
@@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee
{
Item.width = 60;
Item.height = 66;
Item.damage = 303;
Item.damage = 370;
Item.DamageType = DamageClass.Melee;
Item.useAnimation = 21;
Item.useTime = 21;
+1 -1
View File
@@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee
public override void SetDefaults()
{
Item.height = Item.width = 142;
Item.damage = 404;
Item.damage = 435;
Item.DamageType = DamageClass.MeleeNoSpeed;
Item.noMelee = true;
Item.useTurn = true;
@@ -692,6 +692,11 @@ BrimflameFrenzyBuff: {
Description: Dark magic empowers your attacks at the cost of your life
}
BrutalCarnage: {
DisplayName: Brutal Carnage
Description: 25% increased melee damage and 10% increased melee crit chance
}
ChiBuff: {
DisplayName: Chi
Description: You are more resilient
@@ -868,11 +873,6 @@ TarraLifeRegen: {
Description: Rapid healing
}
TyrantsFury: {
DisplayName: Tyrant's Fury
Description: 30% increased melee damage and 10% increased melee crit chance
}
AndromedaCripple: {
DisplayName: Andromeda Cripple
Description: You're slow
@@ -548,7 +548,7 @@ DimensionalSoulArtifact: {
Tooltip:
'''
Power
Boosts all damage by 25%, but at the cost of increasing damage taken by 15%
Multiplies all damage by 1.2x, but at the cost of increasing damage taken by 15%
'''
}
@@ -1296,8 +1296,8 @@ DefiledGreatsword: {
Tooltip:
'''
Fires blazing, hyper, and sunlight blades
Gives the player the tyrant's fury buff on enemy hits
This buff increases melee damage by 30% and melee crit chance by 10%
Gives the player the Brutal Carnage buff on enemy hits
This buff increases melee damage by 25% and melee crit chance by 10%
'''
}
@@ -1316,8 +1316,8 @@ BlightedCleaver: {
Tooltip:
'''
Fires homing blazing blades
Gives the player the tyrant's fury buff on enemy hits
This buff increases melee damage by 30% and melee crit chance by 10%
Gives the player the Brutal Carnage buff on enemy hits
This buff increases melee damage by 25% and melee crit chance by 10%
'''
}
+2 -2
View File
@@ -1013,10 +1013,10 @@ namespace CalamityMod
{
{ "Terraria KingSlime", new List<int>() { ItemType<LoreKingSlime>(), ItemType<ThankYouPainting>() } },
{ "Terraria EyeofCthulhu", new List<int>() { ItemType<LoreEyeofCthulhu>(), ItemType<ThankYouPainting>() } },
{ "Terraria EaterofWorldsHead", new List<int>() { ItemType<LoreEaterofWorlds>(), ItemType<LoreCorruption>(), ItemType<ThankYouPainting>() } },
{ "Terraria EaterofWorlds", new List<int>() { ItemType<LoreEaterofWorlds>(), ItemType<LoreCorruption>(), ItemType<ThankYouPainting>() } },
{ "Terraria BrainofCthulhu", new List<int>() { ItemType<LoreBrainofCthulhu>(), ItemType<LoreCrimson>(), ItemType<ThankYouPainting>() } },
{ "Terraria QueenBee", new List<int>() { ItemType<LoreQueenBee>(), ItemType<ThankYouPainting>() } },
{ "Terraria SkeletronHead", new List<int>() { ItemType<LoreSkeletron>(), ItemType<ThankYouPainting>() } },
{ "Terraria Skeletron", new List<int>() { ItemType<LoreSkeletron>(), ItemType<ThankYouPainting>() } },
{ "Terraria WallofFlesh", new List<int>() { ItemType<LoreWallofFlesh>(), ItemType<LoreUnderworld>(), ItemType<HermitsBoxofOneHundredMedicines>(), ItemType<ThankYouPainting>() } },
{ "Terraria QueenSlimeBoss", new List<int>() { ItemType<LoreQueenSlime>(), ItemType<ThankYouPainting>() } },
{ "Terraria TheTwins", new List<int>() { ItemType<LoreTwins>(), ItemType<LoreMechs>(), ItemType<ThankYouPainting>() } },
+5 -5
View File
@@ -100,11 +100,11 @@ namespace CalamityMod.NPCs.AquaticScourge
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2);
Vector2 scaledDraw = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2);
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f;
drawLocation += scaledDraw * NPC.scale + new Vector2(0f, NPC.gfxOffY);
Color color = NPC.GetAlpha(drawColor);
if (CalamityWorld.revenge || BossRushEvent.BossRushActive || Main.zenithWorld)
@@ -115,7 +115,7 @@ namespace CalamityMod.NPCs.AquaticScourge
color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 90f, 0f, 1f));
}
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, color, NPC.rotation, scaledDraw, NPC.scale, spriteEffects, 0f);
return false;
}
+5 -5
View File
@@ -99,11 +99,11 @@ namespace CalamityMod.NPCs.AquaticScourge
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2);
Vector2 scaledDraw = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2);
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f;
drawLocation += scaledDraw * NPC.scale + new Vector2(0f, NPC.gfxOffY);
Color color = NPC.GetAlpha(drawColor);
if (CalamityWorld.revenge || BossRushEvent.BossRushActive || Main.zenithWorld)
@@ -114,7 +114,7 @@ namespace CalamityMod.NPCs.AquaticScourge
color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 90f, 0f, 1f));
}
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, color, NPC.rotation, scaledDraw, NPC.scale, spriteEffects, 0f);
return false;
}
+16 -16
View File
@@ -138,11 +138,11 @@ namespace CalamityMod.NPCs.AquaticScourge
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2);
Vector2 scaledDraw = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2);
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f;
drawLocation += scaledDraw * NPC.scale + new Vector2(0f, NPC.gfxOffY);
Color color = NPC.GetAlpha(drawColor);
if (CalamityWorld.revenge || BossRushEvent.BossRushActive || Main.zenithWorld)
@@ -153,7 +153,7 @@ namespace CalamityMod.NPCs.AquaticScourge
color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(NPC.localAI[3] / 90f, 0f, 1f));
}
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, color, NPC.rotation, scaledDraw, NPC.scale, spriteEffects, 0f);
return false;
}
@@ -162,18 +162,18 @@ namespace CalamityMod.NPCs.AquaticScourge
{
Rectangle targetHitbox = target.Hitbox;
float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float topLeftHitbox = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float topRightHitbox = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float bottomLeftHitbox = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float bottomRightHitbox = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = dist1;
if (dist2 < minDist)
minDist = dist2;
if (dist3 < minDist)
minDist = dist3;
if (dist4 < minDist)
minDist = dist4;
float minDist = topLeftHitbox;
if (topRightHitbox < minDist)
minDist = topRightHitbox;
if (bottomLeftHitbox < minDist)
minDist = bottomLeftHitbox;
if (bottomRightHitbox < minDist)
minDist = bottomRightHitbox;
return minDist <= 50f * NPC.scale;
}
+5 -5
View File
@@ -99,11 +99,11 @@ namespace CalamityMod.NPCs.AquaticScourge
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2);
Vector2 scaledDraw = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2);
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f;
drawLocation += scaledDraw * NPC.scale + new Vector2(0f, NPC.gfxOffY);
Color color = NPC.GetAlpha(drawColor);
if (CalamityWorld.revenge || BossRushEvent.BossRushActive || Main.zenithWorld)
@@ -114,7 +114,7 @@ namespace CalamityMod.NPCs.AquaticScourge
color = Color.Lerp(color, Color.SandyBrown, MathHelper.Clamp(Main.npc[(int)NPC.ai[2]].localAI[3] / 90f, 0f, 1f));
}
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, color, NPC.rotation, scaledDraw, NPC.scale, spriteEffects, 0f);
return false;
}
+43 -43
View File
@@ -276,67 +276,67 @@ namespace CalamityMod.NPCs.AstrumAureus
}
int frameCount = Main.npcFrameCount[NPC.type];
Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / frameCount / 2);
Vector2 originalDrawSize = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / frameCount / 2);
Rectangle frame = NPC.frame;
float scale = NPC.scale;
float rotation = NPC.rotation;
float offsetY = NPC.gfxOffY;
Color color36 = Color.White;
Color slimeColor = Color.White;
if (Main.zenithWorld && slimePhaseHP)
{
color36 = slimePhase == 0 ? Color.Yellow : Color.Violet;
slimeColor = slimePhase == 0 ? Color.Yellow : Color.Violet;
}
float amount9 = 0.5f;
int num153 = 7;
float colorLerpAmt = 0.5f;
int afterimageAmt = 7;
if (NPC.ai[0] == 3f || NPC.ai[0] == 4f)
num153 = 10;
afterimageAmt = 10;
if (CalamityConfig.Instance.Afterimages)
{
for (int num155 = 1; num155 < num153; num155 += 2)
for (int i = 1; i < afterimageAmt; i += 2)
{
Color color38 = drawColor;
color38 = Color.Lerp(color38, color36, amount9);
color38 = NPC.GetAlpha(color38);
color38 *= (num153 - num155) / 15f;
Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
vector41 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f;
vector41 += vector11 * scale + new Vector2(0f, 4f + offsetY);
spriteBatch.Draw(NPCTexture, vector41, frame, color38, rotation, vector11, scale, spriteEffects, 0f);
Color afterimageColor = drawColor;
afterimageColor = Color.Lerp(afterimageColor, slimeColor, colorLerpAmt);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (afterimageAmt - i) / 15f;
Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
afterimagePos -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f;
afterimagePos += originalDrawSize * scale + new Vector2(0f, 4f + offsetY);
spriteBatch.Draw(NPCTexture, afterimagePos, frame, afterimageColor, rotation, originalDrawSize, scale, spriteEffects, 0f);
}
}
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f;
vector43 += vector11 * scale + new Vector2(0f, 4f + offsetY);
Color toUse = Main.zenithWorld && slimePhaseHP ? color36 : drawColor;
spriteBatch.Draw(NPCTexture, vector43, frame, NPC.GetAlpha(toUse), rotation, vector11, scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(NPCTexture.Width, NPCTexture.Height / frameCount) * scale / 2f;
drawLocation += originalDrawSize * scale + new Vector2(0f, 4f + offsetY);
Color toUse = Main.zenithWorld && slimePhaseHP ? slimeColor : drawColor;
spriteBatch.Draw(NPCTexture, drawLocation, frame, NPC.GetAlpha(toUse), rotation, originalDrawSize, scale, spriteEffects, 0f);
if (NPC.ai[0] != 1 || (slimePhaseHP && Main.zenithWorld)) //draw only if not recharging
{
Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Color.Gold);
Color color40 = Color.Lerp(Color.White, color, 0.5f);
Color attackingColor = Color.Lerp(Color.White, color, 0.5f);
if (Main.zenithWorld && slimePhaseHP)
{
color40 = slimePhase == 0 ? Color.Violet : Color.Yellow;
attackingColor = slimePhase == 0 ? Color.Violet : Color.Yellow;
}
if (CalamityConfig.Instance.Afterimages)
{
for (int num163 = 1; num163 < num153; num163++)
for (int j = 1; j < afterimageAmt; j++)
{
Color color41 = color40;
color41 = Color.Lerp(color41, color36, amount9);
color41 = NPC.GetAlpha(color41);
color41 *= (num153 - num163) / 15f;
Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
vector44 -= new Vector2(GlowMaskTexture.Width, GlowMaskTexture.Height / frameCount) * scale / 2f;
vector44 += vector11 * scale + new Vector2(0f, 4f + offsetY);
spriteBatch.Draw(GlowMaskTexture, vector44, frame, color41, rotation, vector11, scale, spriteEffects, 0f);
Color attackingAfterimageColor = attackingColor;
attackingAfterimageColor = Color.Lerp(attackingAfterimageColor, slimeColor, colorLerpAmt);
attackingAfterimageColor = NPC.GetAlpha(attackingAfterimageColor);
attackingAfterimageColor *= (afterimageAmt - j) / 15f;
Vector2 attackAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
attackAfterimagePos -= new Vector2(GlowMaskTexture.Width, GlowMaskTexture.Height / frameCount) * scale / 2f;
attackAfterimagePos += originalDrawSize * scale + new Vector2(0f, 4f + offsetY);
spriteBatch.Draw(GlowMaskTexture, attackAfterimagePos, frame, attackingAfterimageColor, rotation, originalDrawSize, scale, spriteEffects, 0f);
}
}
spriteBatch.Draw(GlowMaskTexture, vector43, frame, color40, rotation, vector11, scale, spriteEffects, 0f);
spriteBatch.Draw(GlowMaskTexture, drawLocation, frame, attackingColor, rotation, originalDrawSize, scale, spriteEffects, 0f);
}
return false;
@@ -440,23 +440,23 @@ namespace CalamityMod.NPCs.AstrumAureus
NPC.height = (int)(100 * NPC.scale);
NPC.position.X = NPC.position.X - (NPC.width / 2);
NPC.position.Y = NPC.position.Y - (NPC.height / 2);
for (int num621 = 0; num621 < 50; num621++)
for (int r = 0; r < 50; r++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int aureusDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[aureusDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[aureusDust].scale = 0.5f;
Main.dust[aureusDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 100; num623++)
for (int s = 0; s < 100; s++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int aureusDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 3f);
Main.dust[aureusDust2].noGravity = true;
Main.dust[aureusDust2].velocity *= 5f;
aureusDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 2f);
Main.dust[aureusDust2].velocity *= 2f;
}
}
}
+39 -40
View File
@@ -240,49 +240,48 @@ namespace CalamityMod.NPCs.AstrumAureus
NPC.DrawBackglow(Color.Lerp(Color.Cyan, Color.Orange, (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f) with { A = 0 }, 2f + 8f * ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) + 1f), spriteEffects, NPC.frame, screenPos);
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2);
Color color36 = Color.White;
float amount9 = 0.5f;
int num153 = 10;
Vector2 originalDrawSize = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2);
Color whiteColor = Color.White;
int afterimageAmt = 10;
if (CalamityConfig.Instance.Afterimages)
{
for (int num155 = 1; num155 < num153; num155 += 2)
for (int i = 1; i < afterimageAmt; i += 2)
{
Color color38 = drawColor;
color38 = Color.Lerp(color38, color36, amount9);
color38 = NPC.GetAlpha(color38);
color38 *= (num153 - num155) / 15f;
Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color afterimageColor = drawColor;
afterimageColor = Color.Lerp(afterimageColor, whiteColor, 0.5f);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (afterimageAmt - i) / 15f;
Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
afterimagePos += originalDrawSize * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f);
}
}
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
drawLocation += originalDrawSize * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumAureus/AureusSpawnGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Orange, 0.5f) * NPC.Opacity;
Color afterimageColorLerp = Color.Lerp(Color.White, Color.Orange, 0.5f) * NPC.Opacity;
if (CalamityConfig.Instance.Afterimages)
{
for (int num163 = 1; num163 < num153; num163++)
for (int j = 1; j < afterimageAmt; j++)
{
Color color41 = color37;
color41 = Color.Lerp(color41, color36, amount9);
color41 *= (num153 - num163) / 15f;
Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color secondAfterimageColor = afterimageColorLerp;
secondAfterimageColor = Color.Lerp(secondAfterimageColor, whiteColor, 0.5f);
secondAfterimageColor *= (afterimageAmt - j) / 15f;
Vector2 secondAfterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
secondAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
secondAfterimagePos += originalDrawSize * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, secondAfterimagePos, NPC.frame, secondAfterimageColor, NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f);
}
}
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, afterimageColorLerp, NPC.rotation, originalDrawSize, NPC.scale, spriteEffects, 0f);
return false;
}
@@ -351,26 +350,26 @@ namespace CalamityMod.NPCs.AstrumAureus
NPC.position.X = NPC.position.X - NPC.width / 2;
NPC.position.Y = NPC.position.Y - NPC.height / 2;
for (int num621 = 0; num621 < 30; num621++)
for (int r = 0; r < 30; r++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 1f);
Main.dust[num622].velocity *= 3f;
int astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 1f);
Main.dust[astralDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[astralDust].scale = 0.5f;
Main.dust[astralDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
Main.dust[num622].noGravity = true;
Main.dust[astralDust].noGravity = true;
}
for (int num623 = 0; num623 < 60; num623++)
for (int s = 0; s < 60; s++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 173, 0f, 0f, 100, default, 2f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 1f);
Main.dust[num624].velocity *= 2f;
Main.dust[num624].noGravity = true;
int astralDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 173, 0f, 0f, 100, default, 2f);
Main.dust[astralDust2].noGravity = true;
Main.dust[astralDust2].velocity *= 5f;
astralDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 1f);
Main.dust[astralDust2].velocity *= 2f;
Main.dust[astralDust2].noGravity = true;
}
}
}
+25 -25
View File
@@ -99,34 +99,34 @@ namespace CalamityMod.NPCs.AstrumDeus
bool deathModeEnragePhase = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f;
bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase;
Texture2D texture = altBodyTextures ? ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral").Value : TextureAssets.Npc[NPC.type].Value;
Texture2D texture2 = ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow2").Value;
Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2);
Texture2D mainWormTex = altBodyTextures ? ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltSpectral").Value : TextureAssets.Npc[NPC.type].Value;
Texture2D secondWormTex = ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow2").Value;
Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2);
Vector2 vector2 = NPC.Center - screenPos;
vector2 -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f;
vector2 += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture, vector2, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(mainWormTex.Width, mainWormTex.Height) * NPC.scale / 2f;
drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f);
texture = altBodyTextures ? ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow").Value : ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow").Value;
mainWormTex = altBodyTextures ? ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow").Value : ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow").Value;
Color phaseColor = drawCyan ? Color.Cyan : Color.Orange;
if (doubleWormPhase)
{
texture = drawCyan ? texture : (altBodyTextures ? ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow2").Value : ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow3").Value);
texture2 = drawCyan ? ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow4").Value : texture2;
mainWormTex = drawCyan ? mainWormTex : (altBodyTextures ? ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyAltGlow2").Value : ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow3").Value);
secondWormTex = drawCyan ? ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusBodyGlow4").Value : secondWormTex;
}
Color color = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity);
Color color2 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity);
Color mainWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity);
Color secondWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity);
int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 1 : 2;
for (int i = 0; i < timesToDraw; i++)
spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, mainWormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f);
if (!altBodyTextures)
{
timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1;
for (int i = 0; i < timesToDraw; i++)
spriteBatch.Draw(texture2, vector2, NPC.frame, color2, NPC.rotation, vector, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(secondWormTex, drawLocation, NPC.frame, secondWormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f);
}
return false;
@@ -152,23 +152,23 @@ namespace CalamityMod.NPCs.AstrumDeus
NPC.height = 50;
NPC.position.X = NPC.position.X - (NPC.width / 2);
NPC.position.Y = NPC.position.Y - (NPC.height / 2);
for (int num621 = 0; num621 < 5; num621++)
for (int i = 0; i < 5; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int purpleDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[purpleDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[purpleDust].scale = 0.5f;
Main.dust[purpleDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 10; num623++)
for (int j = 0; j < 10; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 3f);
Main.dust[astralDust].noGravity = true;
Main.dust[astralDust].velocity *= 5f;
astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 2f);
Main.dust[astralDust].velocity *= 2f;
}
}
}
+25 -25
View File
@@ -149,32 +149,32 @@ namespace CalamityMod.NPCs.AstrumDeus
bool deathModeEnragePhase = NPC.Calamity().newAI[0] == 3f;
bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase;
Texture2D texture = TextureAssets.Npc[NPC.type].Value;
Texture2D texture2 = ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow2").Value;
Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2);
Texture2D mainWormTex = TextureAssets.Npc[NPC.type].Value;
Texture2D secondWormTex = ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow2").Value;
Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2);
Vector2 vector2 = NPC.Center - screenPos;
vector2 -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f;
vector2 += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture, vector2, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(mainWormTex.Width, mainWormTex.Height) * NPC.scale / 2f;
drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f);
texture = ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow").Value;
mainWormTex = ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow").Value;
Color phaseColor = drawCyan ? Color.Cyan : Color.Orange;
if (doubleWormPhase)
{
texture = drawCyan ? texture : ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow3").Value;
texture2 = drawCyan ? ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow4").Value : texture2;
mainWormTex = drawCyan ? mainWormTex : ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow3").Value;
secondWormTex = drawCyan ? ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusHeadGlow4").Value : secondWormTex;
}
Color color = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity);
Color color2 = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity);
Color mainWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Cyan, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity);
Color secondWormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity);
int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 1 : 2;
for (int i = 0; i < timesToDraw; i++)
spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(mainWormTex, drawLocation, NPC.frame, mainWormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f);
timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1;
for (int i = 0; i < timesToDraw; i++)
spriteBatch.Draw(texture2, vector2, NPC.frame, color2, NPC.rotation, vector, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(secondWormTex, drawLocation, NPC.frame, secondWormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f);
return false;
}
@@ -191,23 +191,23 @@ namespace CalamityMod.NPCs.AstrumDeus
NPC.height = 50;
NPC.position.X = NPC.position.X - (NPC.width / 2);
NPC.position.Y = NPC.position.Y - (NPC.height / 2);
for (int num621 = 0; num621 < 5; num621++)
for (int i = 0; i < 5; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int purpleDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[purpleDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[purpleDust].scale = 0.5f;
Main.dust[purpleDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 10; num623++)
for (int j = 0; j < 10; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 3f);
Main.dust[astralDust].noGravity = true;
Main.dust[astralDust].velocity *= 5f;
astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 2f);
Main.dust[astralDust].velocity *= 2f;
}
}
}
+21 -21
View File
@@ -98,24 +98,24 @@ namespace CalamityMod.NPCs.AstrumDeus
bool deathModeEnragePhase = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f;
bool doubleWormPhase = NPC.Calamity().newAI[0] != 0f && !deathModeEnragePhase;
Texture2D texture = TextureAssets.Npc[NPC.type].Value;
Vector2 vector = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2);
Texture2D wormTexture = TextureAssets.Npc[NPC.type].Value;
Vector2 halfSizeTex = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / 2);
Vector2 vector2 = NPC.Center - screenPos;
vector2 -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f;
vector2 += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture, vector2, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(wormTexture.Width, wormTexture.Height) * NPC.scale / 2f;
drawLocation += halfSizeTex * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(wormTexture, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f);
texture = ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow").Value;
wormTexture = ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow").Value;
Color phaseColor = drawCyan ? Color.Cyan : Color.Orange;
if (doubleWormPhase)
texture = drawCyan ? ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow2").Value : texture;
wormTexture = drawCyan ? ModContent.Request<Texture2D>("CalamityMod/NPCs/AstrumDeus/AstrumDeusTailGlow2").Value : wormTexture;
Color color = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity);
Color wormColorLerp = Color.Lerp(Color.White, doubleWormPhase ? phaseColor : Color.Orange, 0.5f) * (deathModeEnragePhase ? 1f : NPC.Opacity);
int timesToDraw = deathModeEnragePhase ? 3 : drawCyan ? 2 : 1;
for (int i = 0; i < timesToDraw; i++)
spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(wormTexture, drawLocation, NPC.frame, wormColorLerp, NPC.rotation, halfSizeTex, NPC.scale, spriteEffects, 0f);
return false;
}
@@ -135,23 +135,23 @@ namespace CalamityMod.NPCs.AstrumDeus
NPC.height = 50;
NPC.position.X = NPC.position.X - (NPC.width / 2);
NPC.position.Y = NPC.position.Y - (NPC.height / 2);
for (int num621 = 0; num621 < 5; num621++)
for (int i = 0; i < 5; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int purpleDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[purpleDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[purpleDust].scale = 0.5f;
Main.dust[purpleDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 10; num623++)
for (int j = 0; j < 10; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 3f);
Main.dust[astralDust].noGravity = true;
Main.dust[astralDust].velocity *= 5f;
astralDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 2f);
Main.dust[astralDust].velocity *= 2f;
}
}
}
+34 -35
View File
@@ -182,14 +182,14 @@ namespace CalamityMod.NPCs.BrimstoneElemental
Vector2 distanceFromMother = Main.npc[CalamityGlobalNPC.brimstoneElemental].Center - NPC.Center;
if (distanceFromMother.Length() > 120f)
{
Vector2 value54 = distanceFromMother;
if (value54.Length() > movementVelocity)
Vector2 farFromBrimVelocityMult = distanceFromMother;
if (farFromBrimVelocityMult.Length() > movementVelocity)
{
value54.Normalize();
value54 *= movementVelocity;
farFromBrimVelocityMult.Normalize();
farFromBrimVelocityMult *= movementVelocity;
}
int inertia = 20;
NPC.velocity = (NPC.velocity * (inertia - 1) + value54) / inertia;
NPC.velocity = (NPC.velocity * (inertia - 1) + farFromBrimVelocityMult) / inertia;
}
else
NPC.velocity *= 0.96f;
@@ -221,13 +221,13 @@ namespace CalamityMod.NPCs.BrimstoneElemental
// Teleport to Brim's new location
if (NPC.ai[2] != 0f && NPC.ai[3] != 0f)
{
for (int num1449 = 0; num1449 < 20; num1449++)
for (int i = 0; i < 20; i++)
{
int num1450 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f);
Dust dust = Main.dust[num1450];
int deepRedDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f);
Dust dust = Main.dust[deepRedDust];
dust.velocity *= 3f;
Main.dust[num1450].noGravity = true;
Main.dust[num1450].scale = 2.5f;
Main.dust[deepRedDust].noGravity = true;
Main.dust[deepRedDust].scale = 2.5f;
}
NPC.Center = new Vector2(NPC.ai[2] * 16f, NPC.ai[3] * 16f);
@@ -238,13 +238,13 @@ namespace CalamityMod.NPCs.BrimstoneElemental
SoundEngine.PlaySound(SoundID.Item8, NPC.Center);
for (int num1451 = 0; num1451 < 20; num1451++)
for (int j = 0; j < 20; j++)
{
int num1452 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f);
Dust dust = Main.dust[num1452];
int deepRedDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, 235, 0f, 0f, 100, Color.Transparent, 1f);
Dust dust = Main.dust[deepRedDust2];
dust.velocity *= 3f;
Main.dust[num1452].noGravity = true;
Main.dust[num1452].scale = 2.5f;
Main.dust[deepRedDust2].noGravity = true;
Main.dust[deepRedDust2].scale = 2.5f;
}
}
@@ -261,30 +261,29 @@ namespace CalamityMod.NPCs.BrimstoneElemental
// Teleport when Brim teleports
if (Main.npc[CalamityGlobalNPC.brimstoneElemental].alpha == 255 && Main.netMode != NetmodeID.MultiplayerClient)
{
Point point12 = NPC.Center.ToTileCoordinates();
Point point13 = Main.npc[CalamityGlobalNPC.brimstoneElemental].Center.ToTileCoordinates();
int num1453 = 6;
int num1454 = 3;
int num1455 = 4;
int num1456 = 1;
int num1457 = 0;
while (num1457 < 100)
Point npcTileCoords = NPC.Center.ToTileCoordinates();
Point brimmyTileCoords = Main.npc[CalamityGlobalNPC.brimstoneElemental].Center.ToTileCoordinates();
int babTeleportRadius = 3;
int brimmyTeleportRadius = 4;
int solidTileRadius = 1;
int increment = 0;
while (increment < 100)
{
num1457++;
int num1458 = Main.rand.Next(point13.X - num1453, point13.X + num1453 + 1);
int num1459 = Main.rand.Next(point13.Y - num1453, point13.Y + num1453 + 1);
if ((num1459 < point13.Y - num1455 || num1459 > point13.Y + num1455 || num1458 < point13.X - num1455 || num1458 > point13.X + num1455) && (num1459 < point12.Y - num1454 || num1459 > point12.Y + num1454 || num1458 < point12.X - num1454 || num1458 > point12.X + num1454) && !Main.tile[num1458, num1459].HasUnactuatedTile)
increment++;
int randXOffset = Main.rand.Next(brimmyTileCoords.X - 6, brimmyTileCoords.X + 7);
int randYOffset = Main.rand.Next(brimmyTileCoords.Y - 6, brimmyTileCoords.Y + 7);
if ((randYOffset < brimmyTileCoords.Y - brimmyTeleportRadius || randYOffset > brimmyTileCoords.Y + brimmyTeleportRadius || randXOffset < brimmyTileCoords.X - brimmyTeleportRadius || randXOffset > brimmyTileCoords.X + brimmyTeleportRadius) && (randYOffset < npcTileCoords.Y - babTeleportRadius || randYOffset > npcTileCoords.Y + babTeleportRadius || randXOffset < npcTileCoords.X - babTeleportRadius || randXOffset > npcTileCoords.X + babTeleportRadius) && !Main.tile[randXOffset, randYOffset].HasUnactuatedTile)
{
bool flag107 = true;
if (flag107 && Main.tile[num1458, num1459].LiquidType == LiquidID.Lava)
flag107 = false;
if (flag107 && Collision.SolidTiles(num1458 - num1456, num1458 + num1456, num1459 - num1456, num1459 + num1456))
flag107 = false;
bool canTeleport = true;
if (canTeleport && Main.tile[randXOffset, randYOffset].LiquidType == LiquidID.Lava)
canTeleport = false;
if (canTeleport && Collision.SolidTiles(randXOffset - solidTileRadius, randXOffset + solidTileRadius, randYOffset - solidTileRadius, randYOffset + solidTileRadius))
canTeleport = false;
if (flag107)
if (canTeleport)
{
NPC.ai[2] = num1458;
NPC.ai[3] = num1459;
NPC.ai[2] = randXOffset;
NPC.ai[3] = randYOffset;
break;
}
}
+17 -17
View File
@@ -263,23 +263,23 @@ namespace CalamityMod.NPCs.BrimstoneElemental
NPC.height = 150;
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2);
for (int num621 = 0; num621 < 40; num621++)
for (int i = 0; i < 40; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[brimDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[brimDust].scale = 0.5f;
Main.dust[brimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 60; num623++)
for (int j = 0; j < 60; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f);
Main.dust[brimDust2].noGravity = true;
Main.dust[brimDust2].velocity *= 5f;
brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[brimDust2].velocity *= 2f;
}
if (Main.netMode != NetmodeID.Server)
{
@@ -300,11 +300,11 @@ namespace CalamityMod.NPCs.BrimstoneElemental
SpriteEffects spriteEffects = SpriteEffects.None;
if (NPC.spriteDirection == 1)
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture = TextureAssets.Npc[NPC.type].Value;
Vector2 origin = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[NPC.type] / 2));
Texture2D npcTexture = TextureAssets.Npc[NPC.type].Value;
Vector2 frameLocation = new Vector2((float)(npcTexture.Width / 2), (float)(npcTexture.Height / Main.npcFrameCount[NPC.type] / 2));
Vector2 npcOffset = NPC.Center - screenPos;
npcOffset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY);
npcOffset -= new Vector2((float)npcTexture.Width, (float)(npcTexture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
npcOffset += frameLocation * NPC.scale + new Vector2(0f, NPC.gfxOffY);
// Give brimmy an outline based on current elemental mode
if (Main.zenithWorld)
@@ -340,11 +340,11 @@ namespace CalamityMod.NPCs.BrimstoneElemental
for (float i = 0; i < 1; i += 0.125f)
{
spriteBatch.Draw(texture, npcOffset + (i * MathHelper.TwoPi).ToRotationVector2() * outlineThickness, NPC.frame, outlineColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(npcTexture, npcOffset + (i * MathHelper.TwoPi).ToRotationVector2() * outlineThickness, NPC.frame, outlineColor, NPC.rotation, frameLocation, NPC.scale, spriteEffects, 0f);
}
CalamityUtils.ExitShaderRegion(spriteBatch);
}
spriteBatch.Draw(texture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(npcTexture, npcOffset, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, frameLocation, NPC.scale, spriteEffects, 0f);
return false;
}
+101 -103
View File
@@ -1,4 +1,6 @@
using CalamityMod.Events;
using System;
using System.IO;
using CalamityMod.Events;
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Armor.Vanity;
using CalamityMod.Items.LoreItems;
@@ -7,6 +9,7 @@ using CalamityMod.Items.Mounts;
using CalamityMod.Items.Placeables.Furniture.BossRelics;
using CalamityMod.Items.Placeables.Furniture.DevPaintings;
using CalamityMod.Items.Placeables.Furniture.Trophies;
using CalamityMod.Items.Potions;
using CalamityMod.Items.TreasureBags;
using CalamityMod.Items.Weapons.Magic;
using CalamityMod.Items.Weapons.Melee;
@@ -16,16 +19,13 @@ using CalamityMod.Sounds;
using CalamityMod.World;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.IO;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.GameContent.Bestiary;
using Terraria.GameContent.ItemDropRules;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
using CalamityMod.Items.Potions;
namespace CalamityMod.NPCs.Bumblebirb
{
@@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.Bumblebirb
value.Position.X += 20f;
value.Position.Y += 8f;
NPCID.Sets.NPCBestiaryDrawOffset[Type] = value;
NPCID.Sets.MPAllowedEnemies[Type] = true;
NPCID.Sets.MPAllowedEnemies[Type] = true;
}
public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb";
@@ -85,7 +85,7 @@ namespace CalamityMod.NPCs.Bumblebirb
bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[]
{
BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle,
new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bumblefuck")
new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bumblefuck")
});
}
@@ -142,8 +142,8 @@ namespace CalamityMod.NPCs.Bumblebirb
if (phaseSwitchPhase || birbSpawn)
{
float frameGateValue = birbSpawn ? NPC.ai[1] : phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0];
int num116 = 180;
if (frameGateValue < (num116 - 60) || frameGateValue > (num116 - 20))
int frameTimer = 180;
if (frameGateValue < (frameTimer - 60) || frameGateValue > (frameTimer - 20))
{
NPC.frameCounter += 1D;
if (NPC.frameCounter > 5D)
@@ -159,7 +159,7 @@ namespace CalamityMod.NPCs.Bumblebirb
else
{
NPC.frame.Y = frameHeight * 4;
if (frameGateValue > (num116 - 50) && frameGateValue < (num116 - 25))
if (frameGateValue > (frameTimer - 50) && frameGateValue < (frameTimer - 25))
{
NPC.frame.Y = frameHeight * 5;
}
@@ -167,8 +167,8 @@ namespace CalamityMod.NPCs.Bumblebirb
}
else if (NPC.ai[0] == 5f)
{
int num115 = 120;
if (NPC.ai[1] < (num115 - 50) || NPC.ai[1] > (num115 - 10))
int otherFrameTimer = 120;
if (NPC.ai[1] < (otherFrameTimer - 50) || NPC.ai[1] > (otherFrameTimer - 10))
{
NPC.frameCounter += 1D;
if (NPC.frameCounter > 5D)
@@ -184,7 +184,7 @@ namespace CalamityMod.NPCs.Bumblebirb
else
{
NPC.frame.Y = frameHeight * 4;
if (NPC.ai[1] > (num115 - 40) && NPC.ai[1] < (num115 - 15))
if (NPC.ai[1] > (otherFrameTimer - 40) && NPC.ai[1] < (otherFrameTimer - 15))
{
NPC.frame.Y = frameHeight * 5;
}
@@ -228,13 +228,13 @@ namespace CalamityMod.NPCs.Bumblebirb
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2));
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2));
Color color = drawColor;
Color color36 = Color.White;
Color altColor = Color.White;
float amount9 = 0f;
int num150 = 120;
int num151 = 60;
float lerpDrawTransition = 0f;
int newAITracker = 120;
int buffColorDampener = 60;
if (phase3 && calamityGlobalNPC.newAI[3] == 1f)
{
@@ -244,157 +244,155 @@ namespace CalamityMod.NPCs.Bumblebirb
{
color = CalamityGlobalNPC.buffColor(color, 0.7f, 0.7f, 0.3f, 1f);
}
else if (phase2 && calamityGlobalNPC.newAI[0] > (float)num150)
else if (phase2 && calamityGlobalNPC.newAI[0] > (float)newAITracker)
{
float num152 = calamityGlobalNPC.newAI[0] - (float)num150;
num152 /= (float)num151;
color = CalamityGlobalNPC.buffColor(color, 1f - 0.3f * num152, 1f - 0.3f * num152, 1f - 0.7f * num152, 1f);
float phase2TranBuff = calamityGlobalNPC.newAI[0] - (float)newAITracker;
phase2TranBuff /= (float)buffColorDampener;
color = CalamityGlobalNPC.buffColor(color, 1f - 0.3f * phase2TranBuff, 1f - 0.3f * phase2TranBuff, 1f - 0.7f * phase2TranBuff, 1f);
}
int num153 = 10;
int num154 = 2;
int afterimageAmt = 10;
int afterimageIncrement = 2;
if (NPC.ai[0] == 0f || NPC.ai[0] == 3.1f || NPC.ai[0] == 4f || NPC.ai[0] == 4.2f)
{
num153 = 4;
afterimageAmt = 4;
}
if (NPC.ai[0] == 1f || NPC.ai[0] == 3f || NPC.ai[0] == 4.1f)
{
num153 = 7;
afterimageAmt = 7;
}
if (NPC.ai[0] == 2f || NPC.ai[0] == 3.2f || (phase2 && calamityGlobalNPC.newAI[2] == 1f))
{
color36 = Color.Yellow;
amount9 = 0.5f;
altColor = Color.Yellow;
lerpDrawTransition = 0.5f;
}
else
{
color = drawColor;
color = altColor;
}
if (CalamityConfig.Instance.Afterimages)
{
for (int num155 = 1; num155 < num153; num155 += num154)
for (int i = 1; i < afterimageAmt; i += afterimageIncrement)
{
Color color38 = color;
color38 = Color.Lerp(color38, color36, amount9);
color38 = NPC.GetAlpha(color38);
color38 *= (float)(num153 - num155) / 15f;
Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color afterimageColor = color;
afterimageColor = Color.Lerp(afterimageColor, altColor, lerpDrawTransition);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (float)(afterimageAmt - i) / 15f;
Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
int num156 = 0;
float num157 = 0f;
float scaleFactor9 = 0f;
int extraAfterimageAmt = 0;
float extraAfterimageDampener = 0f;
float afterimageScaler = 0f;
if (NPC.ai[0] == 0f || NPC.ai[0] == 3.1f || NPC.ai[0] == 4f || NPC.ai[0] == 4.2f)
{
num156 = 4;
extraAfterimageAmt = 4;
}
if (NPC.ai[0] == 5f)
{
int num158 = 60;
int num159 = 30;
if (NPC.ai[1] > (float)num158)
if (NPC.ai[1] > 60f)
{
num156 = 6;
num157 = 1f - (float)Math.Cos((double)((NPC.ai[1] - (float)num158) / (float)num159 * MathHelper.TwoPi));
num157 /= 3f;
scaleFactor9 = 40f;
extraAfterimageAmt = 6;
extraAfterimageDampener = 1f - (float)Math.Cos((double)((NPC.ai[1] - 60f) / 30f * MathHelper.TwoPi));
extraAfterimageDampener /= 3f;
afterimageScaler = 40f;
}
}
if (phaseSwitchPhase)
{
if (phase3 && calamityGlobalNPC.newAI[1] > (float)num150)
if (phase3 && calamityGlobalNPC.newAI[1] > (float)newAITracker)
{
num156 = 6;
num157 = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[1] - (float)num150) / (float)num151 * MathHelper.TwoPi));
num157 /= 3f;
scaleFactor9 = 60f;
extraAfterimageAmt = 6;
extraAfterimageDampener = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[1] - (float)newAITracker) / (float)buffColorDampener * MathHelper.TwoPi));
extraAfterimageDampener /= 3f;
afterimageScaler = 60f;
}
else if (phase2 && calamityGlobalNPC.newAI[0] > (float)num150)
else if (phase2 && calamityGlobalNPC.newAI[0] > (float)newAITracker)
{
num156 = 6;
num157 = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[0] - (float)num150) / (float)num151 * MathHelper.TwoPi));
num157 /= 3f;
scaleFactor9 = 60f;
extraAfterimageAmt = 6;
extraAfterimageDampener = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[0] - (float)newAITracker) / (float)buffColorDampener * MathHelper.TwoPi));
extraAfterimageDampener /= 3f;
afterimageScaler = 60f;
}
}
if (CalamityConfig.Instance.Afterimages)
{
for (int num160 = 0; num160 < num156; num160++)
for (int j = 0; j < extraAfterimageAmt; j++)
{
Color color39 = drawColor;
color39 = Color.Lerp(color39, color36, amount9);
color39 = NPC.GetAlpha(color39);
color39 *= 1f - num157;
Vector2 vector42 = NPC.Center + ((float)num160 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - screenPos;
vector42 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector42 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector42, NPC.frame, color39, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color extraAfterimageColor = altColor;
extraAfterimageColor = Color.Lerp(extraAfterimageColor, altColor, lerpDrawTransition);
extraAfterimageColor = NPC.GetAlpha(extraAfterimageColor);
extraAfterimageColor *= 1f - extraAfterimageDampener;
Vector2 extraAfterimageDrawPos = NPC.Center + ((float)j / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos;
extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
Color color2 = drawColor;
color2 = Color.Lerp(color2, color36, amount9);
color2 = NPC.GetAlpha(color2);
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, (phase3 && calamityGlobalNPC.newAI[3] == 1f ? color2 : NPC.GetAlpha(drawColor)), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color mainDrawingColor = altColor;
mainDrawingColor = Color.Lerp(mainDrawingColor, altColor, lerpDrawTransition);
mainDrawingColor = NPC.GetAlpha(mainDrawingColor);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, (phase3 && calamityGlobalNPC.newAI[3] == 1f ? mainDrawingColor : NPC.GetAlpha(altColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
if (phase2)
{
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/Bumblebirb/BirbGlow").Value;
Color color40 = Color.Lerp(Color.White, Color.Red, 0.5f);
color36 = Color.Red;
Color glowmaskColor = Color.Lerp(Color.White, Color.Red, 0.5f);
altColor = Color.Red;
amount9 = 1f;
num157 = 0.5f;
scaleFactor9 = 10f;
num154 = 1;
lerpDrawTransition = 1f;
extraAfterimageDampener = 0.5f;
afterimageScaler = 10f;
afterimageIncrement = 1;
if (phaseSwitchPhase)
{
float num161 = (phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)num150;
num161 /= (float)num151;
color36 *= num161;
color40 *= num161;
float glowmaskDampener = (phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)newAITracker;
glowmaskDampener /= (float)buffColorDampener;
altColor *= glowmaskDampener;
glowmaskColor *= glowmaskDampener;
}
if (CalamityConfig.Instance.Afterimages)
{
for (int num163 = 1; num163 < num153; num163 += num154)
for (int k = 1; k < afterimageAmt; k += afterimageIncrement)
{
Color color41 = color40;
color41 = Color.Lerp(color41, color36, amount9);
color41 *= (float)(num153 - num163) / 15f;
Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color glowmaskAfterimageColor = glowmaskColor;
glowmaskAfterimageColor = Color.Lerp(glowmaskAfterimageColor, altColor, lerpDrawTransition);
glowmaskAfterimageColor *= (float)(afterimageAmt - k) / 15f;
Vector2 glowmaskAfterimageDrawPos = NPC.oldPos[k] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
glowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
glowmaskAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, glowmaskAfterimageDrawPos, NPC.frame, glowmaskAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
for (int num164 = 1; num164 < num156; num164++)
for (int l = 1; l < extraAfterimageAmt; l++)
{
Color color42 = color40;
color42 = Color.Lerp(color42, color36, amount9);
color42 = NPC.GetAlpha(color42);
color42 *= 1f - num157;
Vector2 vector45 = NPC.Center + ((float)num164 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - screenPos;
vector45 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector45 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector45, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color extraGlowmaskAfterimageColor = glowmaskColor;
extraGlowmaskAfterimageColor = Color.Lerp(extraGlowmaskAfterimageColor, altColor, lerpDrawTransition);
extraGlowmaskAfterimageColor = NPC.GetAlpha(extraGlowmaskAfterimageColor);
extraGlowmaskAfterimageColor *= 1f - extraAfterimageDampener;
Vector2 extraGlowmaskAfterimageDrawPos = NPC.Center + ((float)l / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos;
extraGlowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
extraGlowmaskAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, extraGlowmaskAfterimageDrawPos, NPC.frame, extraGlowmaskAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color40, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
return false;
+15 -17
View File
@@ -99,30 +99,28 @@ namespace CalamityMod.NPCs.Bumblebirb
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2);
Color color36 = Color.Gold;
float amount9 = 0.5f;
int num153 = NPC.ai[0] == 2.1f ? 7 : 0;
Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2);
int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0;
if (CalamityConfig.Instance.Afterimages)
{
for (int num155 = 1; num155 < num153; num155 += 2)
for (int i = 1; i < afterimageAmt; i += 2)
{
Color color38 = drawColor;
color38 = Color.Lerp(color38, color36, amount9);
color38 = NPC.GetAlpha(color38);
color38 *= (num153 - num155) / 15f;
Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color afterimageColor = drawColor;
afterimageColor = Color.Lerp(afterimageColor, Color.Gold, 0.5f);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (afterimageAmt - i) / 15f;
Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
afterimageDrawPos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
+20 -20
View File
@@ -138,14 +138,14 @@ namespace CalamityMod.NPCs.CalClone
{
for (int i = 1; i < afterimageAmt; i += 2)
{
Color color1 = drawColor;
color1 = Color.Lerp(color1, white, colorLerpAmt);
color1 = NPC.GetAlpha(color1);
color1 *= (float)(afterimageAmt - i) / 15f;
Color afterimageColor = drawColor;
afterimageColor = Color.Lerp(afterimageColor, white, colorLerpAmt);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (float)(afterimageAmt - i) / 15f;
Vector2 offset = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
offset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture, offset, NPC.frame, color1, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture, offset, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
}
}
@@ -165,13 +165,13 @@ namespace CalamityMod.NPCs.CalClone
{
for (int i = 1; i < afterimageAmt; i++)
{
Color color2 = color;
color2 = Color.Lerp(color2, white, colorLerpAmt);
color2 *= (float)(afterimageAmt - i) / 15f;
Color extraAfterimageColor = color;
extraAfterimageColor = Color.Lerp(extraAfterimageColor, white, colorLerpAmt);
extraAfterimageColor *= (float)(afterimageAmt - i) / 15f;
Vector2 offset = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
offset -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
offset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture, offset, NPC.frame, color2, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture, offset, NPC.frame, extraAfterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f);
}
}
@@ -275,23 +275,23 @@ namespace CalamityMod.NPCs.CalClone
NPC.height = 100;
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2);
for (int num621 = 0; num621 < 40; num621++)
for (int i = 0; i < 40; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[brimDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[brimDust].scale = 0.5f;
Main.dust[brimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 70; num623++)
for (int j = 0; j < 70; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f);
Main.dust[brimDust2].noGravity = true;
Main.dust[brimDust2].velocity *= 5f;
brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[brimDust2].velocity *= 2f;
}
}
}
+36 -38
View File
@@ -106,49 +106,47 @@ namespace CalamityMod.NPCs.CalClone
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2));
Color color36 = Color.White;
float amount9 = 0.5f;
int num153 = 7;
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2));
int afterimageAmt = 7;
if (CalamityConfig.Instance.Afterimages)
{
for (int num155 = 1; num155 < num153; num155 += 2)
for (int i = 1; i < afterimageAmt; i += 2)
{
Color color38 = drawColor;
color38 = Color.Lerp(color38, color36, amount9);
color38 = NPC.GetAlpha(color38);
color38 *= (float)(num153 - num155) / 15f;
Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color afterimageColor = drawColor;
afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (float)(afterimageAmt - i) / 15f;
Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/CalClone/CataclysmGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f);
Color pinkLerp = Color.Lerp(Color.White, Color.Red, 0.5f);
if (CalamityConfig.Instance.Afterimages)
{
for (int num163 = 1; num163 < num153; num163++)
for (int j = 1; j < afterimageAmt; j++)
{
Color color41 = color37;
color41 = Color.Lerp(color41, color36, amount9);
color41 *= (float)(num153 - num163) / 15f;
Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color extraAfterimageColor = pinkLerp;
extraAfterimageColor = Color.Lerp(extraAfterimageColor, Color.White, 0.5f);
extraAfterimageColor *= (float)(afterimageAmt - j) / 15f;
Vector2 extraAfterimageDrawPos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, pinkLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
@@ -190,23 +188,23 @@ namespace CalamityMod.NPCs.CalClone
NPC.height = 100;
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2);
for (int num621 = 0; num621 < 40; num621++)
for (int i = 0; i < 40; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[brimDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[brimDust].scale = 0.5f;
Main.dust[brimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 70; num623++)
for (int j = 0; j < 70; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f);
Main.dust[brimDust2].noGravity = true;
Main.dust[brimDust2].velocity *= 5f;
brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[brimDust2].velocity *= 2f;
}
}
}
+36 -38
View File
@@ -106,49 +106,47 @@ namespace CalamityMod.NPCs.CalClone
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2));
Color color36 = Color.White;
float amount9 = 0.5f;
int num153 = 7;
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2));
int afterimageAmt = 7;
if (CalamityConfig.Instance.Afterimages)
{
for (int num155 = 1; num155 < num153; num155 += 2)
for (int i = 1; i < afterimageAmt; i += 2)
{
Color color38 = drawColor;
color38 = Color.Lerp(color38, color36, amount9);
color38 = NPC.GetAlpha(color38);
color38 *= (float)(num153 - num155) / 15f;
Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color afterimageColor = drawColor;
afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (float)(afterimageAmt - i) / 15f;
Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/CalClone/CatastropheGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f);
Color pinkLerp = Color.Lerp(Color.White, Color.Red, 0.5f);
if (CalamityConfig.Instance.Afterimages)
{
for (int num163 = 1; num163 < num153; num163++)
for (int j = 1; j < afterimageAmt; j++)
{
Color color41 = color37;
color41 = Color.Lerp(color41, color36, amount9);
color41 *= (float)(num153 - num163) / 15f;
Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color extraAfterimageColor = pinkLerp;
extraAfterimageColor = Color.Lerp(extraAfterimageColor, Color.White, 0.5f);
extraAfterimageColor *= (float)(afterimageAmt - j) / 15f;
Vector2 extraAfterimageDrawPos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, pinkLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
@@ -190,23 +188,23 @@ namespace CalamityMod.NPCs.CalClone
NPC.height = 100;
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2);
for (int num621 = 0; num621 < 40; num621++)
for (int i = 0; i < 40; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int brimDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[brimDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[brimDust].scale = 0.5f;
Main.dust[brimDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 70; num623++)
for (int j = 0; j < 70; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f);
Main.dust[brimDust2].noGravity = true;
Main.dust[brimDust2].velocity *= 5f;
brimDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f);
Main.dust[brimDust2].velocity *= 2f;
}
}
}
+710 -716
View File
File diff suppressed because it is too large. Load diff
+2 -1
View File
@@ -111,6 +111,7 @@ namespace CalamityMod.NPCs
"Katto", // <@!175972165504466944> (Katto#2858)
"Him", // <@!931019614958256139> (@himtheguy1)
"Tooshiboots", // <@!333532730593771522> (ulmod)
"Neesh", // <@!175803493464932352> (xjetty)
};
private static readonly string[] GolferNames = null;
private static readonly string[] GuideNames =
@@ -280,7 +281,7 @@ namespace CalamityMod.NPCs
"Katsafaros", // <@!190595401328492544> (NavyGuy#2650)
"Lucerne", // <@!271954788676141066> (lord_lucerne)
"Milo", // <@!401849201597874179> (maskedmilo)
"Octo", // <@!796112889353994281> (OctolingGrimm#8888)
"Octo", // <@!796112889353994281> (OctolingGrimm#8888)
};
private static readonly string[] TownCatSiameseNames = null;
private static readonly string[] TownCatBlackNames =
+49 -51
View File
@@ -122,18 +122,18 @@ namespace CalamityMod.NPCs.CeaselessVoid
{
Rectangle targetHitbox = target.Hitbox;
float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = dist1;
if (dist2 < minDist)
minDist = dist2;
if (dist3 < minDist)
minDist = dist3;
if (dist4 < minDist)
minDist = dist4;
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= 50f;
}
@@ -145,49 +145,47 @@ namespace CalamityMod.NPCs.CeaselessVoid
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2));
Color color36 = Color.White;
float amount9 = 0.5f;
int num153 = 7;
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2));
int afterimageAmt = 7;
if (CalamityConfig.Instance.Afterimages)
{
for (int num155 = 1; num155 < num153; num155 += 2)
for (int i = 1; i < afterimageAmt; i += 2)
{
Color color38 = drawColor;
color38 = Color.Lerp(color38, color36, amount9);
color38 = NPC.GetAlpha(color38);
color38 *= (float)(num153 - num155) / 15f;
Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color afterimageColor = drawColor;
afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (float)(afterimageAmt - i) / 15f;
Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/CeaselessVoid/CeaselessVoidGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f);
Color cyanLerp = Color.Lerp(Color.White, Color.Cyan, 0.5f);
if (CalamityConfig.Instance.Afterimages)
{
for (int num163 = 1; num163 < num153; num163++)
for (int j = 1; j < afterimageAmt; j++)
{
Color color41 = color37;
color41 = Color.Lerp(color41, color36, amount9);
color41 *= (float)(num153 - num163) / 15f;
Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color extraAfterimageColor = cyanLerp;
extraAfterimageColor = Color.Lerp(extraAfterimageColor, Color.White, 0.5f);
extraAfterimageColor *= (float)(afterimageAmt - j) / 15f;
Vector2 extraAfterimageDrawPos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, cyanLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
@@ -283,25 +281,25 @@ namespace CalamityMod.NPCs.CeaselessVoid
NPC.height = 100;
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2);
for (int num621 = 0; num621 < 40; num621++)
for (int i = 0; i < 40; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
Main.dust[num622].noGravity = true;
int purpleDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[purpleDust].velocity *= 3f;
Main.dust[purpleDust].noGravity = true;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[purpleDust].scale = 0.5f;
Main.dust[purpleDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 70; num623++)
for (int j = 0; j < 70; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 2f;
int purpleDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
Main.dust[purpleDust2].noGravity = true;
Main.dust[purpleDust2].velocity *= 5f;
purpleDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[purpleDust2].noGravity = true;
Main.dust[purpleDust2].velocity *= 2f;
}
if (Main.netMode != NetmodeID.Server)
+11 -11
View File
@@ -282,18 +282,18 @@ namespace CalamityMod.NPCs.CeaselessVoid
{
Rectangle targetHitbox = target.Hitbox;
float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = dist1;
if (dist2 < minDist)
minDist = dist2;
if (dist3 < minDist)
minDist = dist3;
if (dist4 < minDist)
minDist = dist4;
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= 35f * NPC.scale;
}
+59 -62
View File
@@ -190,18 +190,18 @@ namespace CalamityMod.NPCs.Crabulon
if (NPC.ai[0] < 2f)
{
Vector2 vector34 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
int num352 = 1;
Vector2 mushBombDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
int mushBombAmt = 1;
NPC.localAI[3] += 2f;
if (phase2)
{
NPC.localAI[3] += 1f;
num352 += 2;
mushBombAmt += 2;
}
if (phase3)
{
NPC.localAI[3] += 2f;
num352 += 3;
mushBombAmt += 3;
}
if (NPC.ai[3] == 0f)
{
@@ -215,30 +215,30 @@ namespace CalamityMod.NPCs.Crabulon
{
NPC.localAI[3] = 0f;
NPC.ai[3] += 1f;
if (NPC.ai[3] >= num352)
if (NPC.ai[3] >= mushBombAmt)
NPC.ai[3] = 0f;
float num353 = 10f;
float mushBombSpeed = 10f;
int type = ModContent.ProjectileType<MushBomb>();
SoundEngine.PlaySound(SoundID.Item42, NPC.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
if (phase2)
num353 += 1f;
mushBombSpeed += 1f;
if (phase3)
num353 += 1f;
mushBombSpeed += 1f;
vector34 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float num349 = player.position.X + player.width * 0.5f - vector34.X;
float num350 = player.position.Y + player.height * 0.5f - vector34.Y;
float num351 = (float)Math.Sqrt(num349 * num349 + num350 * num350);
num351 = num353 / num351;
num349 *= num351;
num350 *= num351;
vector34.X += num349;
vector34.Y += num350;
Projectile.NewProjectile(NPC.GetSource_FromAI(), vector34.X, vector34.Y, num349, num350 - 5f, type, NPC.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, player.Center.Y);
mushBombDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float playerXDist = player.position.X + player.width * 0.5f - mushBombDirection.X;
float playerYDist = player.position.Y + player.height * 0.5f - mushBombDirection.Y;
float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist);
playerDistance = mushBombSpeed / playerDistance;
playerXDist *= playerDistance;
playerYDist *= playerDistance;
mushBombDirection.X += playerXDist;
mushBombDirection.Y += playerYDist;
Projectile.NewProjectile(NPC.GetSource_FromAI(), mushBombDirection.X, mushBombDirection.Y, playerXDist, playerYDist - 5f, type, NPC.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, player.Center.Y);
}
}
}
@@ -278,11 +278,11 @@ namespace CalamityMod.NPCs.Crabulon
walkingVelocity *= 2f;
walkingVelocity += 2.5f * enrageScale;
bool flag51 = false;
bool shouldWalkSlower = false;
if (Math.Abs(NPC.Center.X - player.Center.X) < 50f)
flag51 = true;
shouldWalkSlower = true;
if (flag51)
if (shouldWalkSlower)
{
NPC.velocity.X *= 0.9f;
if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1)
@@ -308,17 +308,14 @@ namespace CalamityMod.NPCs.Crabulon
{
NPC.noGravity = true;
NPC.noTileCollide = true;
int num854 = 80;
int num855 = 20;
Vector2 position2 = new Vector2(NPC.Center.X - (num854 / 2), NPC.position.Y + NPC.height - num855);
Vector2 collisionCheckPosition = new Vector2(NPC.Center.X - 40, NPC.position.Y + NPC.height - 20);
bool fallDownOnTopOfTarget = NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width && NPC.position.Y + NPC.height < player.position.Y + player.height - 16f;
if (fallDownOnTopOfTarget)
{
NPC.velocity.Y += 0.5f;
}
else if (Collision.SolidCollision(position2, num854, num855))
else if (Collision.SolidCollision(collisionCheckPosition, 80, 20))
{
if (NPC.velocity.Y > 0f)
NPC.velocity.Y = 0f;
@@ -529,16 +526,16 @@ namespace CalamityMod.NPCs.Crabulon
NPC.netUpdate = true;
}
for (int num622 = (int)NPC.position.X - 20; num622 < (int)NPC.position.X + NPC.width + 40; num622 += 20)
for (int j = (int)NPC.position.X - 20; j < (int)NPC.position.X + NPC.width + 40; j += 20)
{
for (int num623 = 0; num623 < 4; num623++)
for (int k = 0; k < 4; k++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X - 20f, NPC.position.Y + NPC.height), NPC.width + 20, 4, 56, 0f, 0f, 100, default, 1.5f);
Main.dust[num624].velocity *= 0.2f;
int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 20f, NPC.position.Y + NPC.height), NPC.width + 20, 4, 56, 0f, 0f, 100, default, 1.5f);
Main.dust[stompDust].velocity *= 0.2f;
}
if (Main.zenithWorld)
{
int x = num622 / 16;
int x = j / 16;
int y = (int)(NPC.position.Y + NPC.height) / 16;
Tile groundTile = CalamityUtils.ParanoidTileRetrieval(x, y);
Tile walkTile = CalamityUtils.ParanoidTileRetrieval(x, y - 1);
@@ -588,27 +585,27 @@ namespace CalamityMod.NPCs.Crabulon
else if (NPC.direction > 0)
NPC.velocity.X += velocityX;
float num626 = 2.5f;
num626 += enrageScale;
float topXSpeed = 2.5f;
topXSpeed += enrageScale;
if (revenge)
{
num626 += 1f;
topXSpeed += 1f;
}
if (phase2)
{
num626 += 1f;
topXSpeed += 1f;
}
if (phase3)
{
num626 += 1f;
topXSpeed += 1f;
}
if (NPC.velocity.X < -num626)
if (NPC.velocity.X < -topXSpeed)
{
NPC.velocity.X = -num626;
NPC.velocity.X = -topXSpeed;
}
if (NPC.velocity.X > num626)
if (NPC.velocity.X > topXSpeed)
{
NPC.velocity.X = num626;
NPC.velocity.X = topXSpeed;
}
}
}
@@ -622,23 +619,23 @@ namespace CalamityMod.NPCs.Crabulon
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int num660 = (int)(NPC.lifeMax * ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.01 : Main.getGoodWorld ? 0.025 : 0.05));
if ((NPC.life + num660) < NPC.localAI[0])
int crabShroomSpawnFreq = (int)(NPC.lifeMax * ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.01 : Main.getGoodWorld ? 0.025 : 0.05));
if ((NPC.life + crabShroomSpawnFreq) < NPC.localAI[0])
{
NPC.localAI[0] = NPC.life;
int num661 = death ? 3 : expertMode ? Main.rand.Next(2, 4) : 2;
for (int num662 = 0; num662 < num661; num662++)
int crabShroomAmt = death ? 3 : expertMode ? Main.rand.Next(2, 4) : 2;
for (int mush = 0; mush < crabShroomAmt; mush++)
{
int x = (int)(NPC.position.X + Main.rand.Next(NPC.width - 32));
int y = (int)(NPC.position.Y + Main.rand.Next(NPC.height - 32));
int num663 = ModContent.NPCType<CrabShroom>();
int num664 = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, num663);
Main.npc[num664].SetDefaults(num663);
Main.npc[num664].velocity.X = Main.rand.Next(-50, 51) * (Main.getGoodWorld ? 0.2f : 0.1f);
Main.npc[num664].velocity.Y = Main.rand.Next(-50, -31) * (Main.getGoodWorld ? 0.2f : 0.1f);
if (Main.netMode == NetmodeID.Server && num664 < Main.maxNPCs)
int npcType = ModContent.NPCType<CrabShroom>();
int crabShroom = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, npcType);
Main.npc[crabShroom].SetDefaults(npcType);
Main.npc[crabShroom].velocity.X = Main.rand.Next(-50, 51) * (Main.getGoodWorld ? 0.2f : 0.1f);
Main.npc[crabShroom].velocity.Y = Main.rand.Next(-50, -31) * (Main.getGoodWorld ? 0.2f : 0.1f);
if (Main.netMode == NetmodeID.Server && crabShroom < Main.maxNPCs)
{
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0);
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, crabShroom, 0f, 0f, 0f, 0, 0, 0);
}
}
}
@@ -894,23 +891,23 @@ namespace CalamityMod.NPCs.Crabulon
NPC.height = (int)(100 * NPC.scale);
NPC.position.X = NPC.position.X - (NPC.width / 2);
NPC.position.Y = NPC.position.Y - (NPC.height / 2);
for (int num621 = 0; num621 < 40; num621++)
for (int i = 0; i < 40; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int j = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 2f);
Main.dust[j].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[j].scale = 0.5f;
Main.dust[j].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 70; num623++)
for (int k = 0; k < 70; k++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int stompDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 3f);
Main.dust[stompDust].noGravity = true;
Main.dust[stompDust].velocity *= 5f;
stompDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 56, 0f, 0f, 100, default, 2f);
Main.dust[stompDust].velocity *= 2f;
}
if (Main.netMode != NetmodeID.Server)
{
+124 -125
View File
@@ -230,16 +230,16 @@ namespace CalamityMod.NPCs.Cryogen
if (NPC.ai[2] == 0f && NPC.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient && (NPC.ai[0] < 3f || bossRush || (death && NPC.ai[0] > 3f))) //spawn shield for phase 0 1 2, not 3 4 5
{
SoundEngine.PlaySound(ShieldRegenSound, NPC.Center);
int num6 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType<CryogenShield>(), NPC.whoAmI);
NPC.ai[2] = num6 + 1;
int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType<CryogenShield>(), NPC.whoAmI);
NPC.ai[2] = shieldSpawn + 1;
NPC.localAI[1] = -1f;
NPC.netUpdate = true;
Main.npc[num6].ai[0] = NPC.whoAmI;
Main.npc[num6].netUpdate = true;
Main.npc[shieldSpawn].ai[0] = NPC.whoAmI;
Main.npc[shieldSpawn].netUpdate = true;
}
int num7 = (int)NPC.ai[2] - 1;
if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType<CryogenShield>())
int shieldTracker = (int)NPC.ai[2] - 1;
if (shieldTracker != -1 && Main.npc[shieldTracker].active && Main.npc[shieldTracker].type == ModContent.NPCType<CryogenShield>())
{
NPC.dontTakeDamage = true;
}
@@ -292,21 +292,20 @@ namespace CalamityMod.NPCs.Cryogen
int spawnType = Main.zenithWorld ? NPCID.RedDevil : NPCID.IceGolem;
if (!NPC.AnyNPCs(spawnType))
{
int num167 = 1000;
for (int num168 = 0; num168 < num167; num168++)
for (int i = 0; i < 1000; i++)
{
int num169 = (int)(NPC.Center.X / 16f) + Main.rand.Next(-50, 51);
int num170;
for (num170 = (int)(NPC.Center.Y / 16f) + Main.rand.Next(-50, 51); num170 < Main.maxTilesY - 10 && !WorldGen.SolidTile(num169, num170); num170++)
int enemySpawnX = (int)(NPC.Center.X / 16f) + Main.rand.Next(-50, 51);
int enemySpawnY;
for (enemySpawnY = (int)(NPC.Center.Y / 16f) + Main.rand.Next(-50, 51); enemySpawnY < Main.maxTilesY - 10 && !WorldGen.SolidTile(enemySpawnX, enemySpawnY); enemySpawnY++)
{
}
num170--;
if (!WorldGen.SolidTile(num169, num170))
enemySpawnY--;
if (!WorldGen.SolidTile(enemySpawnX, enemySpawnY))
{
int num171 = NPC.NewNPC(NPC.GetSource_FromAI(), num169 * 16 + 8, num170 * 16, spawnType);
if (Main.netMode == NetmodeID.Server && num171 < Main.maxNPCs)
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num171);
int legendEnemySpawn = NPC.NewNPC(NPC.GetSource_FromAI(), enemySpawnX * 16 + 8, enemySpawnY * 16, spawnType);
if (Main.netMode == NetmodeID.Server && legendEnemySpawn < Main.maxNPCs)
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, legendEnemySpawn);
break;
}
@@ -352,8 +351,8 @@ namespace CalamityMod.NPCs.Cryogen
Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity);
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);
Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer);
}
}
}
@@ -382,31 +381,31 @@ namespace CalamityMod.NPCs.Cryogen
Vector2 spinningPoint = new Vector2(0f, -velocity);
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);
Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer);
}
}
}
}
Vector2 vector142 = new Vector2(NPC.Center.X, NPC.Center.Y);
float num1243 = player.Center.X - vector142.X;
float num1244 = player.Center.Y - vector142.Y;
float num1245 = (float)Math.Sqrt(num1243 * num1243 + num1244 * num1244);
Vector2 cryogenCenter = new Vector2(NPC.Center.X, NPC.Center.Y);
float playerXDist = player.Center.X - cryogenCenter.X;
float playerYDist = player.Center.Y - cryogenCenter.Y;
float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist);
float num1246 = revenge ? 5f : 4f;
num1246 += 4f * enrageScale;
float cryogenSpeed = revenge ? 5f : 4f;
cryogenSpeed += 4f * enrageScale;
num1245 = num1246 / num1245;
num1243 *= num1245;
num1244 *= num1245;
playerDistance = cryogenSpeed / playerDistance;
playerXDist *= playerDistance;
playerYDist *= playerDistance;
float inertia = 50f;
if (Main.getGoodWorld)
inertia *= 0.5f;
NPC.velocity.X = (NPC.velocity.X * inertia + num1243) / (inertia + 1f);
NPC.velocity.Y = (NPC.velocity.Y * inertia + num1244) / (inertia + 1f);
NPC.velocity.X = (NPC.velocity.X * inertia + playerXDist) / (inertia + 1f);
NPC.velocity.Y = (NPC.velocity.Y * inertia + playerYDist) / (inertia + 1f);
if (phase2)
{
@@ -443,8 +442,8 @@ namespace CalamityMod.NPCs.Cryogen
Vector2 spinningPoint = new Vector2(0f, -velocity2);
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);
Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer);
}
}
}
@@ -527,8 +526,8 @@ namespace CalamityMod.NPCs.Cryogen
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);
Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, velocity);
}
}
}
@@ -619,31 +618,31 @@ namespace CalamityMod.NPCs.Cryogen
Vector2 spinningPoint = new Vector2(0f, -velocity);
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);
Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer);
}
}
}
}
Vector2 vector142 = new Vector2(NPC.Center.X, NPC.Center.Y);
float num1243 = player.Center.X - vector142.X;
float num1244 = player.Center.Y - vector142.Y;
float num1245 = (float)Math.Sqrt(num1243 * num1243 + num1244 * num1244);
Vector2 cryogenCenter = new Vector2(NPC.Center.X, NPC.Center.Y);
float playerXDist = player.Center.X - cryogenCenter.X;
float playerYDist = player.Center.Y - cryogenCenter.Y;
float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist);
float num1246 = revenge ? 7f : 6f;
num1246 += 4f * enrageScale;
float cryogenSpeed = revenge ? 7f : 6f;
cryogenSpeed += 4f * enrageScale;
num1245 = num1246 / num1245;
num1243 *= num1245;
num1244 *= num1245;
playerDistance = cryogenSpeed / playerDistance;
playerXDist *= playerDistance;
playerYDist *= playerDistance;
float inertia = 50f;
if (Main.getGoodWorld)
inertia *= 0.5f;
NPC.velocity.X = (NPC.velocity.X * inertia + num1243) / (inertia + 1f);
NPC.velocity.Y = (NPC.velocity.Y * inertia + num1244) / (inertia + 1f);
NPC.velocity.X = (NPC.velocity.X * inertia + playerXDist) / (inertia + 1f);
NPC.velocity.Y = (NPC.velocity.Y * inertia + playerYDist) / (inertia + 1f);
}
else if (NPC.ai[1] < chargeGateValue)
{
@@ -675,8 +674,8 @@ namespace CalamityMod.NPCs.Cryogen
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);
Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, velocity);
}
}
}
@@ -769,31 +768,31 @@ namespace CalamityMod.NPCs.Cryogen
Vector2 spinningPoint = new Vector2(0f, -velocity);
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);
Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer);
}
}
}
}
Vector2 vector142 = new Vector2(NPC.Center.X, NPC.Center.Y);
float num1243 = player.Center.X - vector142.X;
float num1244 = player.Center.Y - vector142.Y;
float num1245 = (float)Math.Sqrt(num1243 * num1243 + num1244 * num1244);
Vector2 cryogenCenter = new Vector2(NPC.Center.X, NPC.Center.Y);
float playerXDist = player.Center.X - cryogenCenter.X;
float playerYDist = player.Center.Y - cryogenCenter.Y;
float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist);
float speed = revenge ? 5.5f : 5f;
speed += 3f * enrageScale;
num1245 = speed / num1245;
num1243 *= num1245;
num1244 *= num1245;
playerDistance = speed / playerDistance;
playerXDist *= playerDistance;
playerYDist *= playerDistance;
float inertia = 50f;
if (Main.getGoodWorld)
inertia *= 0.5f;
NPC.velocity.X = (NPC.velocity.X * inertia + num1243) / (inertia + 1f);
NPC.velocity.Y = (NPC.velocity.Y * inertia + num1244) / (inertia + 1f);
NPC.velocity.X = (NPC.velocity.X * inertia + playerXDist) / (inertia + 1f);
NPC.velocity.Y = (NPC.velocity.Y * inertia + playerYDist) / (inertia + 1f);
if (NPC.ai[1] == 0f)
{
@@ -804,37 +803,37 @@ namespace CalamityMod.NPCs.Cryogen
{
NPC.TargetClosest();
NPC.localAI[2] = 0f;
int num1249 = 0;
int num1250;
int num1251;
int attackTimer = 0;
int playerTileX;
int playerTileY;
while (true)
{
num1249++;
num1250 = (int)player.Center.X / 16;
num1251 = (int)player.Center.Y / 16;
attackTimer++;
playerTileX = (int)player.Center.X / 16;
playerTileY = (int)player.Center.Y / 16;
int min = 16;
int max = 20;
if (Main.rand.NextBool())
num1250 += Main.rand.Next(min, max);
playerTileX += Main.rand.Next(min, max);
else
num1250 -= Main.rand.Next(min, max);
playerTileX -= Main.rand.Next(min, max);
if (Main.rand.NextBool())
num1251 += Main.rand.Next(min, max);
playerTileY += Main.rand.Next(min, max);
else
num1251 -= Main.rand.Next(min, max);
playerTileY -= Main.rand.Next(min, max);
if (!WorldGen.SolidTile(num1250, num1251) && Collision.CanHit(new Vector2(num1250 * 16, num1251 * 16), 1, 1, player.position, player.width, player.height))
if (!WorldGen.SolidTile(playerTileX, playerTileY) && Collision.CanHit(new Vector2(playerTileX * 16, playerTileY * 16), 1, 1, player.position, player.width, player.height))
break;
if (num1249 > 100)
if (attackTimer > 100)
goto Block;
}
NPC.ai[1] = 1f;
teleportLocationX = num1250;
calamityGlobalNPC.newAI[2] = num1251;
teleportLocationX = playerTileX;
calamityGlobalNPC.newAI[2] = playerTileY;
NPC.netUpdate = true;
Block:
;
@@ -861,8 +860,8 @@ namespace CalamityMod.NPCs.Cryogen
for (int n = 0; n < 15; n++)
{
int num39 = Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, 0f, 0f, 100, default, 3f);
Main.dust[num39].noGravity = true;
int iceDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, dustType, 0f, 0f, 100, default, 3f);
Main.dust[iceDust].noGravity = true;
}
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height))
@@ -890,8 +889,8 @@ namespace CalamityMod.NPCs.Cryogen
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);
Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, velocity);
}
}
}
@@ -976,8 +975,8 @@ namespace CalamityMod.NPCs.Cryogen
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, ai, 1f);
Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, ai, 1f);
}
}
}
@@ -1012,29 +1011,29 @@ namespace CalamityMod.NPCs.Cryogen
return;
}
float num1372 = 18f + enrageScale * 2f;
float chargeVelMult = 18f + enrageScale * 2f;
Vector2 vector167 = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f);
float num1373 = player.position.X + player.width * 0.5f - vector167.X;
float num1374 = player.Center.Y - vector167.Y;
float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374);
float num1376 = num1372 / num1375;
num1373 *= num1376;
num1374 *= num1376;
Vector2 chargeDirection = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f);
float playerchargeXDist = player.position.X + player.width * 0.5f - chargeDirection.X;
float playerchargeYDist = player.Center.Y - chargeDirection.Y;
float playerDistance = (float)Math.Sqrt(playerchargeXDist * playerchargeXDist + playerchargeYDist * playerchargeYDist);
float chargeSpeed = chargeVelMult / playerDistance;
playerchargeXDist *= chargeSpeed;
playerchargeYDist *= chargeSpeed;
calamityGlobalNPC.newAI[2] -= 1f;
float chargeStartDistance = 300f;
float chargeCooldown = 30f;
if (num1375 < chargeStartDistance || calamityGlobalNPC.newAI[2] > 0f)
if (playerDistance < chargeStartDistance || calamityGlobalNPC.newAI[2] > 0f)
{
if (num1375 < chargeStartDistance)
if (playerDistance < chargeStartDistance)
calamityGlobalNPC.newAI[2] = chargeCooldown;
if (NPC.velocity.Length() < num1372)
if (NPC.velocity.Length() < chargeVelMult)
{
NPC.velocity.Normalize();
NPC.velocity *= num1372;
NPC.velocity *= chargeVelMult;
}
NPC.rotation += NPC.direction * 0.5f;
@@ -1046,17 +1045,17 @@ namespace CalamityMod.NPCs.Cryogen
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 < chargeStartDistance + 200f)
NPC.velocity.X = (NPC.velocity.X * inertia + playerchargeXDist) / (inertia + 1f);
NPC.velocity.Y = (NPC.velocity.Y * inertia + playerchargeYDist) / (inertia + 1f);
if (playerDistance < chargeStartDistance + 200f)
{
NPC.velocity.X = (NPC.velocity.X * 9f + num1373) / 10f;
NPC.velocity.Y = (NPC.velocity.Y * 9f + num1374) / 10f;
NPC.velocity.X = (NPC.velocity.X * 9f + playerchargeXDist) / 10f;
NPC.velocity.Y = (NPC.velocity.Y * 9f + playerchargeYDist) / 10f;
}
if (num1375 < chargeStartDistance + 100f)
if (playerDistance < chargeStartDistance + 100f)
{
NPC.velocity.X = (NPC.velocity.X * 4f + num1373) / 5f;
NPC.velocity.Y = (NPC.velocity.Y * 4f + num1374) / 5f;
NPC.velocity.X = (NPC.velocity.X * 4f + playerchargeXDist) / 5f;
NPC.velocity.Y = (NPC.velocity.Y * 4f + playerchargeYDist) / 5f;
}
NPC.rotation = NPC.velocity.X * 0.15f;
@@ -1081,8 +1080,8 @@ namespace CalamityMod.NPCs.Cryogen
Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity2) : new Vector2(velocityX, -velocity2);
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);
Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer);
}
}
@@ -1250,23 +1249,23 @@ namespace CalamityMod.NPCs.Cryogen
}
if (NPC.life <= 0)
{
for (int num621 = 0; num621 < 40; num621++)
for (int i = 0; i < 40; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int icyDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f);
Main.dust[icyDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[icyDust].scale = 0.5f;
Main.dust[icyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 70; num623++)
for (int j = 0; j < 70; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int icyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 3f);
Main.dust[icyDust2].noGravity = true;
Main.dust[icyDust2].velocity *= 5f;
icyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f);
Main.dust[icyDust2].velocity *= 2f;
}
if (Main.netMode != NetmodeID.Server && !Main.zenithWorld)
{
@@ -1361,18 +1360,18 @@ namespace CalamityMod.NPCs.Cryogen
{
Rectangle targetHitbox = target.Hitbox;
float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = dist1;
if (dist2 < minDist)
minDist = dist2;
if (dist3 < minDist)
minDist = dist3;
if (dist4 < minDist)
minDist = dist4;
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= 40f * NPC.scale;
}
+30 -30
View File
@@ -71,14 +71,14 @@ namespace CalamityMod.NPCs.Cryogen
if (NPC.type == ModContent.NPCType<CryogenShield>())
{
int num989 = (int)NPC.ai[0];
if (Main.npc[num989].active && Main.npc[num989].type == ModContent.NPCType<Cryogen>())
int mainCryogen = (int)NPC.ai[0];
if (Main.npc[mainCryogen].active && Main.npc[mainCryogen].type == ModContent.NPCType<Cryogen>())
{
NPC.velocity = Vector2.Zero;
NPC.position = Main.npc[num989].Center;
NPC.ai[1] = Main.npc[num989].velocity.X;
NPC.ai[2] = Main.npc[num989].velocity.Y;
NPC.ai[3] = Main.npc[num989].target;
NPC.position = Main.npc[mainCryogen].Center;
NPC.ai[1] = Main.npc[mainCryogen].velocity.X;
NPC.ai[2] = Main.npc[mainCryogen].velocity.Y;
NPC.ai[3] = Main.npc[mainCryogen].target;
NPC.position.X = NPC.position.X - (NPC.width / 2);
NPC.position.Y = NPC.position.Y - (NPC.height / 2);
return;
@@ -95,18 +95,18 @@ namespace CalamityMod.NPCs.Cryogen
{
Rectangle targetHitbox = target.Hitbox;
float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = dist1;
if (dist2 < minDist)
minDist = dist2;
if (dist3 < minDist)
minDist = dist3;
if (dist4 < minDist)
minDist = dist4;
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= (100f * NPC.scale) && NPC.Opacity == 1f;
}
@@ -167,24 +167,24 @@ namespace CalamityMod.NPCs.Cryogen
}
if (NPC.life <= 0)
{
for (int num621 = 0; num621 < 25; num621++)
for (int i = 0; i < 25; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int icyDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f);
Main.dust[icyDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[icyDust].scale = 0.5f;
Main.dust[icyDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 50; num623++)
for (int j = 0; j < 50; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int icyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 3f);
Main.dust[icyDust2].noGravity = true;
Main.dust[icyDust2].velocity *= 5f;
icyDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f);
Main.dust[icyDust2].velocity *= 2f;
}
if (Main.netMode != NetmodeID.Server && !Main.zenithWorld)
@@ -194,11 +194,11 @@ namespace CalamityMod.NPCs.Cryogen
Vector2 spinningPoint = new Vector2(0f, -1f);
for (int k = 0; k < totalGores; k++)
{
Vector2 vector255 = spinningPoint.RotatedBy(radians * k);
Vector2 goreRotation = spinningPoint.RotatedBy(radians * k);
for (int x = 1; x <= 4; x++)
{
float randomSpread = Main.rand.Next(-200, 201) / 100f;
Gore.NewGore(NPC.GetSource_Death(), NPC.Center + Vector2.Normalize(vector255) * 80f, vector255 * new Vector2(NPC.ai[1], NPC.ai[2]) * randomSpread, Mod.Find<ModGore>("CryoShieldGore" + x).Type, NPC.scale);
Gore.NewGore(NPC.GetSource_Death(), NPC.Center + Vector2.Normalize(goreRotation) * 80f, goreRotation * new Vector2(NPC.ai[1], NPC.ai[2]) * randomSpread, Mod.Find<ModGore>("CryoShieldGore" + x).Type, NPC.scale);
}
}
}
+22 -23
View File
@@ -93,40 +93,39 @@ namespace CalamityMod.NPCs.DesertScourge
if (Main.player[NPC.target].dead)
NPC.TargetClosest(false);
Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
num191 = (float)((int)(num191 / 16f) * 16);
num192 = (float)((int)(num192 / 16f) * 16);
vector18.X = (float)((int)(vector18.X / 16f) * 16);
vector18.Y = (float)((int)(vector18.Y / 16f) * 16);
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
Vector2 segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float playerXPos = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float playerYPos = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
playerXPos = (float)((int)(playerXPos / 16f) * 16);
playerYPos = (float)((int)(playerYPos / 16f) * 16);
segmentTilePos.X = (float)((int)(segmentTilePos.X / 16f) * 16);
segmentTilePos.Y = (float)((int)(segmentTilePos.Y / 16f) * 16);
playerXPos -= segmentTilePos.X;
playerYPos -= segmentTilePos.Y;
float playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos));
if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length)
{
try
{
vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X;
num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y;
segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
playerXPos = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentTilePos.X;
playerYPos = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentTilePos.Y;
}
catch
{
}
NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f;
num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
int num194 = NPC.width;
num193 = (num193 - (float)num194) / num193;
num191 *= num193;
num192 *= num193;
NPC.rotation = (float)System.Math.Atan2((double)playerYPos, (double)playerXPos) + 1.57f;
playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos));
playerDistance = (playerDistance - (float)(NPC.width)) / playerDistance;
playerXPos *= playerDistance;
playerYPos *= playerDistance;
NPC.velocity = Vector2.Zero;
NPC.position.X = NPC.position.X + num191;
NPC.position.Y = NPC.position.Y + num192;
NPC.position.X = NPC.position.X + playerXPos;
NPC.position.Y = NPC.position.Y + playerYPos;
if (num191 < 0f)
if (playerXPos < 0f)
NPC.spriteDirection = 1;
else if (num191 > 0f)
else if (playerXPos > 0f)
NPC.spriteDirection = -1;
}
}
+117 -118
View File
@@ -100,51 +100,50 @@ namespace CalamityMod.NPCs.DesertScourge
NPC.ai[2] = (float)NPC.whoAmI;
NPC.realLife = NPC.whoAmI;
int num2 = NPC.whoAmI;
int num3 = maxLength;
for (int j = 0; j <= num3; j++)
for (int j = 0; j <= maxLength; j++)
{
int num4 = ModContent.NPCType<DesertNuisanceBody>();
if (j == num3)
int segmentType = ModContent.NPCType<DesertNuisanceBody>();
if (j == maxLength)
{
num4 = ModContent.NPCType<DesertNuisanceTail>();
segmentType = ModContent.NPCType<DesertNuisanceTail>();
}
int num5 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.position.X + (float)(NPC.width / 2)), (int)(NPC.position.Y + (float)NPC.height), num4, NPC.whoAmI, 0f, 0f, 0f, 0f, 255);
Main.npc[num5].ai[2] = (float)NPC.whoAmI;
Main.npc[num5].realLife = NPC.whoAmI;
Main.npc[num5].ai[1] = (float)num2;
Main.npc[num2].ai[0] = (float)num5;
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num5, 0f, 0f, 0f, 0, 0, 0);
num2 = num5;
int segmentSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.position.X + (float)(NPC.width / 2)), (int)(NPC.position.Y + (float)NPC.height), segmentType, NPC.whoAmI, 0f, 0f, 0f, 0f, 255);
Main.npc[segmentSpawn].ai[2] = (float)NPC.whoAmI;
Main.npc[segmentSpawn].realLife = NPC.whoAmI;
Main.npc[segmentSpawn].ai[1] = (float)num2;
Main.npc[num2].ai[0] = (float)segmentSpawn;
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segmentSpawn, 0f, 0f, 0f, 0, 0, 0);
num2 = segmentSpawn;
}
TailSpawned = true;
}
}
int num12 = (int)(NPC.position.X / 16f) - 1;
int num13 = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2;
int num14 = (int)(NPC.position.Y / 16f) - 1;
int num15 = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2;
if (num12 < 0)
int tilePositionX = (int)(NPC.position.X / 16f) - 1;
int tileWidthPosX = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2;
int tilePositionY = (int)(NPC.position.Y / 16f) - 1;
int tileWidthPosY = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2;
if (tilePositionX < 0)
{
num12 = 0;
tilePositionX = 0;
}
if (num13 > Main.maxTilesX)
if (tileWidthPosX > Main.maxTilesX)
{
num13 = Main.maxTilesX;
tileWidthPosX = Main.maxTilesX;
}
if (num14 < 0)
if (tilePositionY < 0)
{
num14 = 0;
tilePositionY = 0;
}
if (num15 > Main.maxTilesY)
if (tileWidthPosY > Main.maxTilesY)
{
num15 = Main.maxTilesY;
tileWidthPosY = Main.maxTilesY;
}
bool flag2 = false;
if (!flag2)
bool shouldFly = false;
if (!shouldFly)
{
for (int k = num12; k < num13; k++)
for (int k = tilePositionX; k < tileWidthPosX; k++)
{
for (int l = num14; l < num15; l++)
for (int l = tilePositionY; l < tileWidthPosY; l++)
{
if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[k, l].TileType] || (Main.tileSolidTop[(int)Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64))
{
@@ -153,36 +152,36 @@ namespace CalamityMod.NPCs.DesertScourge
vector2.Y = (float)(l * 16);
if (NPC.position.X + (float)NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + (float)NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f)
{
flag2 = true;
shouldFly = true;
break;
}
}
}
}
}
if (!flag2)
if (!shouldFly)
{
NPC.localAI[1] = 1f;
Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height);
int num16 = 1000;
bool flag3 = true;
int directChaseDistance = 1000;
bool shouldDirectlyChase = true;
if (NPC.position.Y > Main.player[NPC.target].position.Y)
{
for (int m = 0; m < 255; m++)
{
if (Main.player[m].active)
{
Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, num16 * 2);
Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - directChaseDistance, (int)Main.player[m].position.Y - directChaseDistance, directChaseDistance * 2, directChaseDistance * 2);
if (rectangle.Intersects(rectangle2))
{
flag3 = false;
shouldDirectlyChase = false;
break;
}
}
}
if (flag3)
if (shouldDirectlyChase)
{
flag2 = true;
shouldFly = true;
}
}
}
@@ -190,15 +189,15 @@ namespace CalamityMod.NPCs.DesertScourge
{
NPC.localAI[1] = 0f;
}
float num17 = 16f;
float maxChaseSpeed = 16f;
if (Main.player[NPC.target].dead)
{
flag2 = false;
shouldFly = false;
NPC.velocity.Y = NPC.velocity.Y + 1f;
if ((double)NPC.position.Y > Main.worldSurface * 16.0)
{
NPC.velocity.Y = NPC.velocity.Y + 1f;
num17 = 32f;
maxChaseSpeed = 32f;
}
if ((double)NPC.position.Y > Main.rockLayer * 16.0)
{
@@ -212,62 +211,62 @@ namespace CalamityMod.NPCs.DesertScourge
}
}
}
float num18 = speed;
float num19 = turnSpeed;
float speedCopy = speed;
float turnSpeedCopy = turnSpeed;
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge)
{
num18 *= 1.5f;
num19 *= 1.5f;
speedCopy *= 1.5f;
turnSpeedCopy *= 1.5f;
}
Vector2 vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float num20 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float num21 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
num20 = (float)((int)(num20 / 16f) * 16);
num21 = (float)((int)(num21 / 16f) * 16);
vector3.X = (float)((int)(vector3.X / 16f) * 16);
vector3.Y = (float)((int)(vector3.Y / 16f) * 16);
num20 -= vector3.X;
num21 -= vector3.Y;
float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21));
if (!flag2)
Vector2 npcCenter = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float playerX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float targettingPosition = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
playerX = (float)((int)(playerX / 16f) * 16);
targettingPosition = (float)((int)(targettingPosition / 16f) * 16);
npcCenter.X = (float)((int)(npcCenter.X / 16f) * 16);
npcCenter.Y = (float)((int)(npcCenter.Y / 16f) * 16);
playerX -= npcCenter.X;
targettingPosition -= npcCenter.Y;
float targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition));
if (!shouldFly)
{
NPC.TargetClosest();
NPC.velocity.Y = NPC.velocity.Y + 0.15f;
if (NPC.velocity.Y > num17)
if (NPC.velocity.Y > maxChaseSpeed)
{
NPC.velocity.Y = num17;
NPC.velocity.Y = maxChaseSpeed;
}
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.4)
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.4)
{
if (NPC.velocity.X < 0f)
{
NPC.velocity.X = NPC.velocity.X - num18 * 1.1f;
NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f;
}
else
{
NPC.velocity.X = NPC.velocity.X + num18 * 1.1f;
NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f;
}
}
else if (NPC.velocity.Y == num17)
else if (NPC.velocity.Y == maxChaseSpeed)
{
if (NPC.velocity.X < num20)
if (NPC.velocity.X < playerX)
{
NPC.velocity.X = NPC.velocity.X + num18;
NPC.velocity.X = NPC.velocity.X + speedCopy;
}
else if (NPC.velocity.X > num20)
else if (NPC.velocity.X > playerX)
{
NPC.velocity.X = NPC.velocity.X - num18;
NPC.velocity.X = NPC.velocity.X - speedCopy;
}
}
else if (NPC.velocity.Y > 4f)
{
if (NPC.velocity.X < 0f)
{
NPC.velocity.X = NPC.velocity.X + num18 * 0.9f;
NPC.velocity.X = NPC.velocity.X + speedCopy * 0.9f;
}
else
{
NPC.velocity.X = NPC.velocity.X - num18 * 0.9f;
NPC.velocity.X = NPC.velocity.X - speedCopy * 0.9f;
}
}
}
@@ -275,131 +274,131 @@ namespace CalamityMod.NPCs.DesertScourge
{
if (NPC.soundDelay == 0)
{
float num24 = num22 / 40f;
if (num24 < 10f)
float soundDelay = targetDistance / 40f;
if (soundDelay < 10f)
{
num24 = 10f;
soundDelay = 10f;
}
if (num24 > 20f)
if (soundDelay > 20f)
{
num24 = 20f;
soundDelay = 20f;
}
NPC.soundDelay = (int)num24;
NPC.soundDelay = (int)soundDelay;
SoundEngine.PlaySound(SoundID.WormDig, NPC.Center);
}
num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21));
float num25 = Math.Abs(num20);
float num26 = Math.Abs(num21);
float num27 = num17 / num22;
num20 *= num27;
num21 *= num27;
if (((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f)) && ((NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f)))
targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition));
float absolutePlayerX = Math.Abs(playerX);
float absoluteTargetPos = Math.Abs(targettingPosition);
float timeToReachTarget = maxChaseSpeed / targetDistance;
playerX *= timeToReachTarget;
targettingPosition *= timeToReachTarget;
if (((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f)) && ((NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f)))
{
if (NPC.velocity.X < num20)
if (NPC.velocity.X < playerX)
{
NPC.velocity.X = NPC.velocity.X + num19;
NPC.velocity.X = NPC.velocity.X + turnSpeedCopy;
}
else if (NPC.velocity.X > num20)
else if (NPC.velocity.X > playerX)
{
NPC.velocity.X = NPC.velocity.X - num19;
NPC.velocity.X = NPC.velocity.X - turnSpeedCopy;
}
if (NPC.velocity.Y < num21)
if (NPC.velocity.Y < targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y + num19;
NPC.velocity.Y = NPC.velocity.Y + turnSpeedCopy;
}
else if (NPC.velocity.Y > num21)
else if (NPC.velocity.Y > targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y - num19;
NPC.velocity.Y = NPC.velocity.Y - turnSpeedCopy;
}
}
if ((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f) || (NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f))
if ((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f) || (NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f))
{
if (NPC.velocity.X < num20)
if (NPC.velocity.X < playerX)
{
NPC.velocity.X = NPC.velocity.X + num18;
NPC.velocity.X = NPC.velocity.X + speedCopy;
}
else if (NPC.velocity.X > num20)
else if (NPC.velocity.X > playerX)
{
NPC.velocity.X = NPC.velocity.X - num18;
NPC.velocity.X = NPC.velocity.X - speedCopy;
}
if (NPC.velocity.Y < num21)
if (NPC.velocity.Y < targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y + num18;
NPC.velocity.Y = NPC.velocity.Y + speedCopy;
}
else if (NPC.velocity.Y > num21)
else if (NPC.velocity.Y > targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y - num18;
NPC.velocity.Y = NPC.velocity.Y - speedCopy;
}
if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((NPC.velocity.X > 0f && num20 < 0f) || (NPC.velocity.X < 0f && num20 > 0f)))
if ((double)Math.Abs(targettingPosition) < (double)maxChaseSpeed * 0.2 && ((NPC.velocity.X > 0f && playerX < 0f) || (NPC.velocity.X < 0f && playerX > 0f)))
{
if (NPC.velocity.Y > 0f)
{
NPC.velocity.Y = NPC.velocity.Y + num18 * 2f;
NPC.velocity.Y = NPC.velocity.Y + speedCopy * 2f;
}
else
{
NPC.velocity.Y = NPC.velocity.Y - num18 * 2f;
NPC.velocity.Y = NPC.velocity.Y - speedCopy * 2f;
}
}
if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((NPC.velocity.Y > 0f && num21 < 0f) || (NPC.velocity.Y < 0f && num21 > 0f)))
if ((double)Math.Abs(playerX) < (double)maxChaseSpeed * 0.2 && ((NPC.velocity.Y > 0f && targettingPosition < 0f) || (NPC.velocity.Y < 0f && targettingPosition > 0f)))
{
if (NPC.velocity.X > 0f)
{
NPC.velocity.X = NPC.velocity.X + num18 * 2f;
NPC.velocity.X = NPC.velocity.X + speedCopy * 2f;
}
else
{
NPC.velocity.X = NPC.velocity.X - num18 * 2f;
NPC.velocity.X = NPC.velocity.X - speedCopy * 2f;
}
}
}
else if (num25 > num26)
else if (absolutePlayerX > absoluteTargetPos)
{
if (NPC.velocity.X < num20)
if (NPC.velocity.X < playerX)
{
NPC.velocity.X = NPC.velocity.X + num18 * 1.1f;
NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f;
}
else if (NPC.velocity.X > num20)
else if (NPC.velocity.X > playerX)
{
NPC.velocity.X = NPC.velocity.X - num18 * 1.1f;
NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f;
}
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5)
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.5)
{
if (NPC.velocity.Y > 0f)
{
NPC.velocity.Y = NPC.velocity.Y + num18;
NPC.velocity.Y = NPC.velocity.Y + speedCopy;
}
else
{
NPC.velocity.Y = NPC.velocity.Y - num18;
NPC.velocity.Y = NPC.velocity.Y - speedCopy;
}
}
}
else
{
if (NPC.velocity.Y < num21)
if (NPC.velocity.Y < targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y + num18 * 1.1f;
NPC.velocity.Y = NPC.velocity.Y + speedCopy * 1.1f;
}
else if (NPC.velocity.Y > num21)
else if (NPC.velocity.Y > targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y - num18 * 1.1f;
NPC.velocity.Y = NPC.velocity.Y - speedCopy * 1.1f;
}
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5)
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.5)
{
if (NPC.velocity.X > 0f)
{
NPC.velocity.X = NPC.velocity.X + num18;
NPC.velocity.X = NPC.velocity.X + speedCopy;
}
else
{
NPC.velocity.X = NPC.velocity.X - num18;
NPC.velocity.X = NPC.velocity.X - speedCopy;
}
}
}
}
NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f;
if (flag2)
if (shouldFly)
{
if (NPC.localAI[0] != 1f)
{
+22 -23
View File
@@ -93,40 +93,39 @@ namespace CalamityMod.NPCs.DesertScourge
if (Main.player[NPC.target].dead)
NPC.TargetClosest(false);
Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
num191 = (float)((int)(num191 / 16f) * 16);
num192 = (float)((int)(num192 / 16f) * 16);
vector18.X = (float)((int)(vector18.X / 16f) * 16);
vector18.Y = (float)((int)(vector18.Y / 16f) * 16);
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
Vector2 segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float playerXPos = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float playerYPos = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
playerXPos = (float)((int)(playerXPos / 16f) * 16);
playerYPos = (float)((int)(playerYPos / 16f) * 16);
segmentTilePos.X = (float)((int)(segmentTilePos.X / 16f) * 16);
segmentTilePos.Y = (float)((int)(segmentTilePos.Y / 16f) * 16);
playerXPos -= segmentTilePos.X;
playerYPos -= segmentTilePos.Y;
float playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos));
if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length)
{
try
{
vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X;
num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y;
segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
playerXPos = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentTilePos.X;
playerYPos = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentTilePos.Y;
}
catch
{
}
NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f;
num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
int num194 = NPC.width;
num193 = (num193 - (float)num194) / num193;
num191 *= num193;
num192 *= num193;
NPC.rotation = (float)System.Math.Atan2((double)playerYPos, (double)playerXPos) + 1.57f;
playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos));
playerDistance = (playerDistance - (float)(NPC.width)) / playerDistance;
playerXPos *= playerDistance;
playerYPos *= playerDistance;
NPC.velocity = Vector2.Zero;
NPC.position.X = NPC.position.X + num191;
NPC.position.Y = NPC.position.Y + num192;
NPC.position.X = NPC.position.X + playerXPos;
NPC.position.Y = NPC.position.Y + playerYPos;
if (num191 < 0f)
if (playerXPos < 0f)
NPC.spriteDirection = 1;
else if (num191 > 0f)
else if (playerXPos > 0f)
NPC.spriteDirection = -1;
}
}
+22 -23
View File
@@ -109,40 +109,39 @@ namespace CalamityMod.NPCs.DesertScourge
if (Main.player[NPC.target].dead)
NPC.TargetClosest(false);
Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
num191 = (float)((int)(num191 / 16f) * 16);
num192 = (float)((int)(num192 / 16f) * 16);
vector18.X = (float)((int)(vector18.X / 16f) * 16);
vector18.Y = (float)((int)(vector18.Y / 16f) * 16);
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
Vector2 segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float playerXPos = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float playerYPos = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
playerXPos = (float)((int)(playerXPos / 16f) * 16);
playerYPos = (float)((int)(playerYPos / 16f) * 16);
segmentTilePos.X = (float)((int)(segmentTilePos.X / 16f) * 16);
segmentTilePos.Y = (float)((int)(segmentTilePos.Y / 16f) * 16);
playerXPos -= segmentTilePos.X;
playerYPos -= segmentTilePos.Y;
float playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos));
if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length)
{
try
{
vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X;
num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y;
segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
playerXPos = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentTilePos.X;
playerYPos = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentTilePos.Y;
}
catch
{
}
NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f;
num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
int num194 = NPC.width;
num193 = (num193 - (float)num194) / num193;
num191 *= num193;
num192 *= num193;
NPC.rotation = (float)System.Math.Atan2((double)playerYPos, (double)playerXPos) + 1.57f;
playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos));
playerDistance = (playerDistance - (float)(NPC.width)) / playerDistance;
playerXPos *= playerDistance;
playerYPos *= playerDistance;
NPC.velocity = Vector2.Zero;
NPC.position.X = NPC.position.X + num191;
NPC.position.Y = NPC.position.Y + num192;
NPC.position.X = NPC.position.X + playerXPos;
NPC.position.Y = NPC.position.Y + playerYPos;
if (num191 < 0f)
if (playerXPos < 0f)
NPC.spriteDirection = 1;
else if (num191 > 0f)
else if (playerXPos > 0f)
NPC.spriteDirection = -1;
}
}
+112 -112
View File
@@ -232,10 +232,10 @@ namespace CalamityMod.NPCs.DesertScourge
if (Main.getGoodWorld)
minLength *= 3;
for (int num36 = 0; num36 < minLength + 1; num36++)
for (int i = 0; i < minLength + 1; i++)
{
int lol;
if (num36 >= 0 && num36 < minLength)
if (i >= 0 && i < minLength)
{
lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType<DesertScourgeBody>(), NPC.whoAmI);
}
@@ -300,32 +300,32 @@ namespace CalamityMod.NPCs.DesertScourge
}
}
int num12 = (int)(NPC.position.X / 16f) - 1;
int num13 = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2;
int num14 = (int)(NPC.position.Y / 16f) - 1;
int num15 = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2;
if (num12 < 0)
int tilePositionX = (int)(NPC.position.X / 16f) - 1;
int tileWidthPosX = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2;
int tilePositionY = (int)(NPC.position.Y / 16f) - 1;
int tileWidthPosY = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2;
if (tilePositionX < 0)
{
num12 = 0;
tilePositionX = 0;
}
if (num13 > Main.maxTilesX)
if (tileWidthPosX > Main.maxTilesX)
{
num13 = Main.maxTilesX;
tileWidthPosX = Main.maxTilesX;
}
if (num14 < 0)
if (tilePositionY < 0)
{
num14 = 0;
tilePositionY = 0;
}
if (num15 > Main.maxTilesY)
if (tileWidthPosY > Main.maxTilesY)
{
num15 = Main.maxTilesY;
tileWidthPosY = Main.maxTilesY;
}
bool flag2 = lungeUpward;
if (!flag2)
bool shouldFly = lungeUpward;
if (!shouldFly)
{
for (int k = num12; k < num13; k++)
for (int k = tilePositionX; k < tileWidthPosX; k++)
{
for (int l = num14; l < num15; l++)
for (int l = tilePositionY; l < tileWidthPosY; l++)
{
if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[k, l].TileType] || (Main.tileSolidTop[(int)Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64))
{
@@ -334,43 +334,43 @@ namespace CalamityMod.NPCs.DesertScourge
vector2.Y = (float)(l * 16);
if (NPC.position.X + (float)NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + (float)NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f)
{
flag2 = true;
shouldFly = true;
break;
}
}
}
}
}
if (!flag2)
if (!shouldFly)
{
NPC.localAI[1] = 1f;
Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height);
int num954 = 1000;
int directChaseDistance = 1000;
if (enrageScale > 0f)
num954 = 100;
directChaseDistance = 100;
bool flag3 = true;
bool shouldDirectlyChase = true;
if (NPC.position.Y > player.position.Y)
{
int rectWidth = num954 * 2;
int rectHeight = num954 * 2;
int rectWidth = directChaseDistance * 2;
int rectHeight = directChaseDistance * 2;
for (int m = 0; m < 255; m++)
{
if (Main.player[m].active)
{
int rectX = (int)Main.player[m].position.X - num954;
int rectY = (int)Main.player[m].position.Y - num954;
Rectangle rectangle13 = new Rectangle(rectX, rectY, rectWidth, rectHeight);
if (rectangle.Intersects(rectangle13))
int rectX = (int)Main.player[m].position.X - directChaseDistance;
int rectY = (int)Main.player[m].position.Y - directChaseDistance;
Rectangle directChaseRect = new Rectangle(rectX, rectY, rectWidth, rectHeight);
if (rectangle.Intersects(directChaseRect))
{
flag3 = false;
shouldDirectlyChase = false;
break;
}
}
}
if (flag3)
if (shouldDirectlyChase)
{
flag2 = true;
shouldFly = true;
}
}
}
@@ -379,15 +379,15 @@ namespace CalamityMod.NPCs.DesertScourge
NPC.localAI[1] = 0f;
}
float num17 = 16f;
float maxChaseSpeed = 16f;
if (player.dead)
{
flag2 = false;
shouldFly = false;
NPC.velocity.Y += 1f;
if ((double)NPC.position.Y > Main.worldSurface * 16.0)
{
NPC.velocity.Y += 1f;
num17 = 32f;
maxChaseSpeed = 32f;
}
if ((double)NPC.position.Y > Main.rockLayer * 16.0)
{
@@ -402,21 +402,21 @@ namespace CalamityMod.NPCs.DesertScourge
}
}
float num18 = speed;
float num19 = turnSpeed;
float speedCopy = speed;
float turnSpeedCopy = turnSpeed;
float burrowDistance = bossRush ? 500f : 800f;
float burrowTarget = player.Center.Y + burrowDistance;
float lungeTarget = NPC.Calamity().newAI[3];
Vector2 vector3 = NPC.Center;
float num20 = player.Center.X;
float num21 = lungeUpward ? lungeTarget : burrow ? burrowTarget : player.Center.Y;
num20 = (float)((int)(num20 / 16f) * 16);
num21 = (float)((int)(num21 / 16f) * 16);
vector3.X = (float)((int)(vector3.X / 16f) * 16);
vector3.Y = (float)((int)(vector3.Y / 16f) * 16);
num20 -= vector3.X;
num21 -= vector3.Y;
float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21));
Vector2 npcCenter = NPC.Center;
float playerX = player.Center.X;
float targettingPosition = lungeUpward ? lungeTarget : burrow ? burrowTarget : player.Center.Y;
playerX = (float)((int)(playerX / 16f) * 16);
targettingPosition = (float)((int)(targettingPosition / 16f) * 16);
npcCenter.X = (float)((int)(npcCenter.X / 16f) * 16);
npcCenter.Y = (float)((int)(npcCenter.Y / 16f) * 16);
playerX -= npcCenter.X;
targettingPosition -= npcCenter.Y;
float targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition));
// Lunge up towards target
if (burrow && NPC.Center.Y >= burrowTarget - 16f)
@@ -481,45 +481,45 @@ namespace CalamityMod.NPCs.DesertScourge
NPC.Calamity().newAI[1] = 0f;
}
if (!flag2)
if (!shouldFly)
{
NPC.TargetClosest();
NPC.velocity.Y = NPC.velocity.Y + 0.15f;
if (NPC.velocity.Y > num17)
if (NPC.velocity.Y > maxChaseSpeed)
{
NPC.velocity.Y = num17;
NPC.velocity.Y = maxChaseSpeed;
}
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.4)
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.4)
{
if (NPC.velocity.X < 0f)
{
NPC.velocity.X = NPC.velocity.X - num18 * 1.1f;
NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f;
}
else
{
NPC.velocity.X = NPC.velocity.X + num18 * 1.1f;
NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f;
}
}
else if (NPC.velocity.Y == num17)
else if (NPC.velocity.Y == maxChaseSpeed)
{
if (NPC.velocity.X < num20)
if (NPC.velocity.X < playerX)
{
NPC.velocity.X = NPC.velocity.X + num18;
NPC.velocity.X = NPC.velocity.X + speedCopy;
}
else if (NPC.velocity.X > num20)
else if (NPC.velocity.X > playerX)
{
NPC.velocity.X = NPC.velocity.X - num18;
NPC.velocity.X = NPC.velocity.X - speedCopy;
}
}
else if (NPC.velocity.Y > 4f)
{
if (NPC.velocity.X < 0f)
{
NPC.velocity.X = NPC.velocity.X + num18 * 0.9f;
NPC.velocity.X = NPC.velocity.X + speedCopy * 0.9f;
}
else
{
NPC.velocity.X = NPC.velocity.X - num18 * 0.9f;
NPC.velocity.X = NPC.velocity.X - speedCopy * 0.9f;
}
}
}
@@ -527,131 +527,131 @@ namespace CalamityMod.NPCs.DesertScourge
{
if (NPC.soundDelay == 0)
{
float num24 = num22 / 40f;
if (num24 < 10f)
float soundDelay = targetDistance / 40f;
if (soundDelay < 10f)
{
num24 = 10f;
soundDelay = 10f;
}
if (num24 > 20f)
if (soundDelay > 20f)
{
num24 = 20f;
soundDelay = 20f;
}
NPC.soundDelay = (int)num24;
NPC.soundDelay = (int)soundDelay;
SoundEngine.PlaySound(SoundID.WormDig, NPC.Center);
}
num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21));
float num25 = Math.Abs(num20);
float num26 = Math.Abs(num21);
float num27 = num17 / num22;
num20 *= num27;
num21 *= num27;
if (((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f)) && ((NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f)))
targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition));
float absolutePlayerX = Math.Abs(playerX);
float absoluteTargetPos = Math.Abs(targettingPosition);
float timeToReachTarget = maxChaseSpeed / targetDistance;
playerX *= timeToReachTarget;
targettingPosition *= timeToReachTarget;
if (((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f)) && ((NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f)))
{
if (NPC.velocity.X < num20)
if (NPC.velocity.X < playerX)
{
NPC.velocity.X = NPC.velocity.X + num19;
NPC.velocity.X = NPC.velocity.X + turnSpeedCopy;
}
else if (NPC.velocity.X > num20)
else if (NPC.velocity.X > playerX)
{
NPC.velocity.X = NPC.velocity.X - num19;
NPC.velocity.X = NPC.velocity.X - turnSpeedCopy;
}
if (NPC.velocity.Y < num21)
if (NPC.velocity.Y < targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y + num19;
NPC.velocity.Y = NPC.velocity.Y + turnSpeedCopy;
}
else if (NPC.velocity.Y > num21)
else if (NPC.velocity.Y > targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y - num19;
NPC.velocity.Y = NPC.velocity.Y - turnSpeedCopy;
}
}
if ((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f) || (NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f))
if ((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f) || (NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f))
{
if (NPC.velocity.X < num20)
if (NPC.velocity.X < playerX)
{
NPC.velocity.X = NPC.velocity.X + num18;
NPC.velocity.X = NPC.velocity.X + speedCopy;
}
else if (NPC.velocity.X > num20)
else if (NPC.velocity.X > playerX)
{
NPC.velocity.X = NPC.velocity.X - num18;
NPC.velocity.X = NPC.velocity.X - speedCopy;
}
if (NPC.velocity.Y < num21)
if (NPC.velocity.Y < targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y + num18;
NPC.velocity.Y = NPC.velocity.Y + speedCopy;
}
else if (NPC.velocity.Y > num21)
else if (NPC.velocity.Y > targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y - num18;
NPC.velocity.Y = NPC.velocity.Y - speedCopy;
}
if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((NPC.velocity.X > 0f && num20 < 0f) || (NPC.velocity.X < 0f && num20 > 0f)))
if ((double)Math.Abs(targettingPosition) < (double)maxChaseSpeed * 0.2 && ((NPC.velocity.X > 0f && playerX < 0f) || (NPC.velocity.X < 0f && playerX > 0f)))
{
if (NPC.velocity.Y > 0f)
{
NPC.velocity.Y = NPC.velocity.Y + num18 * 2f;
NPC.velocity.Y = NPC.velocity.Y + speedCopy * 2f;
}
else
{
NPC.velocity.Y = NPC.velocity.Y - num18 * 2f;
NPC.velocity.Y = NPC.velocity.Y - speedCopy * 2f;
}
}
if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((NPC.velocity.Y > 0f && num21 < 0f) || (NPC.velocity.Y < 0f && num21 > 0f)))
if ((double)Math.Abs(playerX) < (double)maxChaseSpeed * 0.2 && ((NPC.velocity.Y > 0f && targettingPosition < 0f) || (NPC.velocity.Y < 0f && targettingPosition > 0f)))
{
if (NPC.velocity.X > 0f)
{
NPC.velocity.X = NPC.velocity.X + num18 * 2f;
NPC.velocity.X = NPC.velocity.X + speedCopy * 2f;
}
else
{
NPC.velocity.X = NPC.velocity.X - num18 * 2f;
NPC.velocity.X = NPC.velocity.X - speedCopy * 2f;
}
}
}
else if (num25 > num26)
else if (absolutePlayerX > absoluteTargetPos)
{
if (NPC.velocity.X < num20)
if (NPC.velocity.X < playerX)
{
NPC.velocity.X = NPC.velocity.X + num18 * 1.1f;
NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f;
}
else if (NPC.velocity.X > num20)
else if (NPC.velocity.X > playerX)
{
NPC.velocity.X = NPC.velocity.X - num18 * 1.1f;
NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f;
}
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5)
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.5)
{
if (NPC.velocity.Y > 0f)
{
NPC.velocity.Y = NPC.velocity.Y + num18;
NPC.velocity.Y = NPC.velocity.Y + speedCopy;
}
else
{
NPC.velocity.Y = NPC.velocity.Y - num18;
NPC.velocity.Y = NPC.velocity.Y - speedCopy;
}
}
}
else
{
if (NPC.velocity.Y < num21)
if (NPC.velocity.Y < targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y + num18 * 1.1f;
NPC.velocity.Y = NPC.velocity.Y + speedCopy * 1.1f;
}
else if (NPC.velocity.Y > num21)
else if (NPC.velocity.Y > targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y - num18 * 1.1f;
NPC.velocity.Y = NPC.velocity.Y - speedCopy * 1.1f;
}
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5)
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.5)
{
if (NPC.velocity.X > 0f)
{
NPC.velocity.X = NPC.velocity.X + num18;
NPC.velocity.X = NPC.velocity.X + speedCopy;
}
else
{
NPC.velocity.X = NPC.velocity.X - num18;
NPC.velocity.X = NPC.velocity.X - speedCopy;
}
}
}
}
NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f;
if (flag2)
if (shouldFly)
{
if (NPC.localAI[0] != 1f)
{
+22 -23
View File
@@ -108,40 +108,39 @@ namespace CalamityMod.NPCs.DesertScourge
if (Main.player[NPC.target].dead)
NPC.TargetClosest(false);
Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
num191 = (float)((int)(num191 / 16f) * 16);
num192 = (float)((int)(num192 / 16f) * 16);
vector18.X = (float)((int)(vector18.X / 16f) * 16);
vector18.Y = (float)((int)(vector18.Y / 16f) * 16);
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
Vector2 segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float playerXPos = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float playerYPos = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
playerXPos = (float)((int)(playerXPos / 16f) * 16);
playerYPos = (float)((int)(playerYPos / 16f) * 16);
segmentTilePos.X = (float)((int)(segmentTilePos.X / 16f) * 16);
segmentTilePos.Y = (float)((int)(segmentTilePos.Y / 16f) * 16);
playerXPos -= segmentTilePos.X;
playerYPos -= segmentTilePos.Y;
float playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos));
if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length)
{
try
{
vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X;
num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y;
segmentTilePos = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
playerXPos = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentTilePos.X;
playerYPos = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentTilePos.Y;
}
catch
{
}
NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f;
num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
int num194 = NPC.width;
num193 = (num193 - (float)num194) / num193;
num191 *= num193;
num192 *= num193;
NPC.rotation = (float)System.Math.Atan2((double)playerYPos, (double)playerXPos) + 1.57f;
playerDistance = (float)System.Math.Sqrt((double)(playerXPos * playerXPos + playerYPos * playerYPos));
playerDistance = (playerDistance - (float)(NPC.width)) / playerDistance;
playerXPos *= playerDistance;
playerYPos *= playerDistance;
NPC.velocity = Vector2.Zero;
NPC.position.X = NPC.position.X + num191;
NPC.position.Y = NPC.position.Y + num192;
NPC.position.X = NPC.position.X + playerXPos;
NPC.position.Y = NPC.position.Y + playerYPos;
if (num191 < 0f)
if (playerXPos < 0f)
NPC.spriteDirection = 1;
else if (num191 > 0f)
else if (playerXPos > 0f)
NPC.spriteDirection = -1;
}
}
+39 -39
View File
@@ -106,36 +106,36 @@ namespace CalamityMod.NPCs.DevourerofGods
NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity;
Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2);
float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2);
num191 = (int)(num191 / 16f) * 16;
num192 = (int)(num192 / 16f) * 16;
vector18.X = (int)(vector18.X / 16f) * 16;
vector18.Y = (int)(vector18.Y / 16f) * 16;
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192);
Vector2 segmentPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2);
float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2);
targetX = (int)(targetX / 16f) * 16;
targetY = (int)(targetY / 16f) * 16;
segmentPosition.X = (int)(segmentPosition.X / 16f) * 16;
segmentPosition.Y = (int)(segmentPosition.Y / 16f) * 16;
targetX -= segmentPosition.X;
targetY -= segmentPosition.Y;
float targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY);
if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length)
{
try
{
vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X;
num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y;
segmentPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X;
targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y;
}
catch
{
}
NPC.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f;
num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192);
int num194 = NPC.width;
num193 = (num193 - num194) / num193;
num191 *= num193;
num192 *= num193;
NPC.rotation = (float)System.Math.Atan2(targetY, targetX) + 1.57f;
targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY);
int segmentWidth = NPC.width;
targetDistance = (targetDistance - segmentWidth) / targetDistance;
targetX *= targetDistance;
targetY *= targetDistance;
NPC.velocity = Vector2.Zero;
NPC.position.X = NPC.position.X + num191;
NPC.position.Y = NPC.position.Y + num192;
NPC.position.X = NPC.position.X + targetX;
NPC.position.Y = NPC.position.Y + targetY;
}
}
@@ -146,17 +146,17 @@ namespace CalamityMod.NPCs.DevourerofGods
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/CosmicGuardianBodyGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f);
Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
@@ -190,23 +190,23 @@ namespace CalamityMod.NPCs.DevourerofGods
NPC.height = 50;
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2);
for (int num621 = 0; num621 < 10; num621++)
for (int i = 0; i < 10; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[cosmiliteDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[cosmiliteDust].scale = 0.5f;
Main.dust[cosmiliteDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 20; num623++)
for (int j = 0; j < 20; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
Main.dust[cosmiliteDust2].noGravity = true;
Main.dust[cosmiliteDust2].velocity *= 5f;
cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[cosmiliteDust2].velocity *= 2f;
}
}
}
+85 -85
View File
@@ -175,151 +175,151 @@ namespace CalamityMod.NPCs.DevourerofGods
return;
}
Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float num191 = Main.npc[CalamityGlobalNPC.DoGHead].position.X + (Main.npc[CalamityGlobalNPC.DoGHead].width / 2);
float num192 = Main.npc[CalamityGlobalNPC.DoGHead].position.Y + (Main.npc[CalamityGlobalNPC.DoGHead].height / 2);
float num188 = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f;
float num189 = BossRushEvent.BossRushActive ? 0.9f : CalamityWorld.revenge ? 0.75f : 0.23f;
Vector2 segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float dogHeadX = Main.npc[CalamityGlobalNPC.DoGHead].position.X + (Main.npc[CalamityGlobalNPC.DoGHead].width / 2);
float dogHeadY = Main.npc[CalamityGlobalNPC.DoGHead].position.Y + (Main.npc[CalamityGlobalNPC.DoGHead].height / 2);
float maxDistanceFromDoG = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f;
float velocityMult = BossRushEvent.BossRushActive ? 0.9f : CalamityWorld.revenge ? 0.75f : 0.23f;
if (increaseSpeedMore)
num189 *= 4f;
velocityMult *= 4f;
else if (increaseSpeed)
num189 *= 2f;
velocityMult *= 2f;
for (int num52 = 0; num52 < Main.maxNPCs; num52++)
for (int i = 0; i < Main.maxNPCs; i++)
{
if (Main.npc[num52].active && (Main.npc[num52].type == NPC.type || Main.npc[num52].type == ModContent.NPCType<DevourerofGodsHead>()) && num52 != NPC.whoAmI)
if (Main.npc[i].active && (Main.npc[i].type == NPC.type || Main.npc[i].type == ModContent.NPCType<DevourerofGodsHead>()) && i != NPC.whoAmI)
{
Vector2 vector4 = Main.npc[num52].Center - NPC.Center;
if (vector4.Length() < 400f)
Vector2 distFromHead = Main.npc[i].Center - NPC.Center;
if (distFromHead.Length() < 400f)
{
vector4.Normalize();
vector4 *= 400f;
num191 -= vector4.X;
num192 -= vector4.Y;
distFromHead.Normalize();
distFromHead *= 400f;
dogHeadX -= distFromHead.X;
dogHeadY -= distFromHead.Y;
}
}
}
float num48 = num188 * 1.3f;
float num49 = num188 * 0.7f;
float num50 = NPC.velocity.Length();
if (num50 > 0f)
float higherMaxDistance = maxDistanceFromDoG * 1.3f;
float lowerMaxDistance = maxDistanceFromDoG * 0.7f;
float npcSpeed = NPC.velocity.Length();
if (npcSpeed > 0f)
{
if (num50 > num48)
if (npcSpeed > higherMaxDistance)
{
NPC.velocity.Normalize();
NPC.velocity *= num48;
NPC.velocity *= higherMaxDistance;
}
else if (num50 < num49)
else if (npcSpeed < lowerMaxDistance)
{
NPC.velocity.Normalize();
NPC.velocity *= num49;
NPC.velocity *= lowerMaxDistance;
}
}
num191 = (int)(num191 / 16f) * 16;
num192 = (int)(num192 / 16f) * 16;
vector18.X = (int)(vector18.X / 16f) * 16;
vector18.Y = (int)(vector18.Y / 16f) * 16;
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)Math.Sqrt(num191 * num191 + num192 * num192);
float num196 = Math.Abs(num191);
float num197 = Math.Abs(num192);
float num198 = num188 / num193;
num191 *= num198;
num192 *= num198;
if ((NPC.velocity.X > 0f && num191 > 0f) || (NPC.velocity.X < 0f && num191 < 0f) || (NPC.velocity.Y > 0f && num192 > 0f) || (NPC.velocity.Y < 0f && num192 < 0f))
dogHeadX = (int)(dogHeadX / 16f) * 16;
dogHeadY = (int)(dogHeadY / 16f) * 16;
segmentDirection.X = (int)(segmentDirection.X / 16f) * 16;
segmentDirection.Y = (int)(segmentDirection.Y / 16f) * 16;
dogHeadX -= segmentDirection.X;
dogHeadY -= segmentDirection.Y;
float targetDistance = (float)Math.Sqrt(dogHeadX * dogHeadX + dogHeadY * dogHeadY);
float absoluteDoGX = Math.Abs(dogHeadX);
float absoluteDoGY = Math.Abs(dogHeadY);
float timeToReachTarget = maxDistanceFromDoG / targetDistance;
dogHeadX *= timeToReachTarget;
dogHeadY *= timeToReachTarget;
if ((NPC.velocity.X > 0f && dogHeadX > 0f) || (NPC.velocity.X < 0f && dogHeadX < 0f) || (NPC.velocity.Y > 0f && dogHeadY > 0f) || (NPC.velocity.Y < 0f && dogHeadY < 0f))
{
if (NPC.velocity.X < num191)
if (NPC.velocity.X < dogHeadX)
{
NPC.velocity.X = NPC.velocity.X + num189;
NPC.velocity.X = NPC.velocity.X + velocityMult;
}
else
{
if (NPC.velocity.X > num191)
if (NPC.velocity.X > dogHeadX)
{
NPC.velocity.X = NPC.velocity.X - num189;
NPC.velocity.X = NPC.velocity.X - velocityMult;
}
}
if (NPC.velocity.Y < num192)
if (NPC.velocity.Y < dogHeadY)
{
NPC.velocity.Y = NPC.velocity.Y + num189;
NPC.velocity.Y = NPC.velocity.Y + velocityMult;
}
else
{
if (NPC.velocity.Y > num192)
if (NPC.velocity.Y > dogHeadY)
{
NPC.velocity.Y = NPC.velocity.Y - num189;
NPC.velocity.Y = NPC.velocity.Y - velocityMult;
}
}
if (Math.Abs(num192) < num188 * 0.2 && ((NPC.velocity.X > 0f && num191 < 0f) || (NPC.velocity.X < 0f && num191 > 0f)))
if (Math.Abs(dogHeadY) < maxDistanceFromDoG * 0.2 && ((NPC.velocity.X > 0f && dogHeadX < 0f) || (NPC.velocity.X < 0f && dogHeadX > 0f)))
{
if (NPC.velocity.Y > 0f)
{
NPC.velocity.Y = NPC.velocity.Y + num189 * 2f;
NPC.velocity.Y = NPC.velocity.Y + velocityMult * 2f;
}
else
{
NPC.velocity.Y = NPC.velocity.Y - num189 * 2f;
NPC.velocity.Y = NPC.velocity.Y - velocityMult * 2f;
}
}
if (Math.Abs(num191) < num188 * 0.2 && ((NPC.velocity.Y > 0f && num192 < 0f) || (NPC.velocity.Y < 0f && num192 > 0f)))
if (Math.Abs(dogHeadX) < maxDistanceFromDoG * 0.2 && ((NPC.velocity.Y > 0f && dogHeadY < 0f) || (NPC.velocity.Y < 0f && dogHeadY > 0f)))
{
if (NPC.velocity.X > 0f)
{
NPC.velocity.X = NPC.velocity.X + num189 * 2f; //changed from 2
NPC.velocity.X = NPC.velocity.X + velocityMult * 2f; //changed from 2
}
else
{
NPC.velocity.X = NPC.velocity.X - num189 * 2f; //changed from 2
NPC.velocity.X = NPC.velocity.X - velocityMult * 2f; //changed from 2
}
}
}
else
{
if (num196 > num197)
if (absoluteDoGX > absoluteDoGY)
{
if (NPC.velocity.X < num191)
if (NPC.velocity.X < dogHeadX)
{
NPC.velocity.X = NPC.velocity.X + num189 * 1.1f; //changed from 1.1
NPC.velocity.X = NPC.velocity.X + velocityMult * 1.1f; //changed from 1.1
}
else if (NPC.velocity.X > num191)
else if (NPC.velocity.X > dogHeadX)
{
NPC.velocity.X = NPC.velocity.X - num189 * 1.1f; //changed from 1.1
NPC.velocity.X = NPC.velocity.X - velocityMult * 1.1f; //changed from 1.1
}
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5)
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxDistanceFromDoG * 0.5)
{
if (NPC.velocity.Y > 0f)
{
NPC.velocity.Y = NPC.velocity.Y + num189;
NPC.velocity.Y = NPC.velocity.Y + velocityMult;
}
else
{
NPC.velocity.Y = NPC.velocity.Y - num189;
NPC.velocity.Y = NPC.velocity.Y - velocityMult;
}
}
}
else
{
if (NPC.velocity.Y < num192)
if (NPC.velocity.Y < dogHeadY)
{
NPC.velocity.Y = NPC.velocity.Y + num189 * 1.1f;
NPC.velocity.Y = NPC.velocity.Y + velocityMult * 1.1f;
}
else if (NPC.velocity.Y > num192)
else if (NPC.velocity.Y > dogHeadY)
{
NPC.velocity.Y = NPC.velocity.Y - num189 * 1.1f;
NPC.velocity.Y = NPC.velocity.Y - velocityMult * 1.1f;
}
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < num188 * 0.5)
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < maxDistanceFromDoG * 0.5)
{
if (NPC.velocity.X > 0f)
{
NPC.velocity.X = NPC.velocity.X + num189;
NPC.velocity.X = NPC.velocity.X + velocityMult;
}
else
{
NPC.velocity.X = NPC.velocity.X - num189;
NPC.velocity.X = NPC.velocity.X - velocityMult;
}
}
}
@@ -337,22 +337,22 @@ namespace CalamityMod.NPCs.DevourerofGods
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 distFromHead3 = NPC.Center - screenPos;
distFromHead3 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
distFromHead3 += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/CosmicGuardianHeadGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f);
Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/CosmicGuardianHeadGlow2").Value;
color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f);
glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, distFromHead3, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
@@ -395,23 +395,23 @@ namespace CalamityMod.NPCs.DevourerofGods
NPC.height = 50;
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2);
for (int num621 = 0; num621 < 15; num621++)
for (int i = 0; i < 15; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[cosmiliteDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[cosmiliteDust].scale = 0.5f;
Main.dust[cosmiliteDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 30; num623++)
for (int j = 0; j < 30; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
Main.dust[cosmiliteDust2].noGravity = true;
Main.dust[cosmiliteDust2].velocity *= 5f;
cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[cosmiliteDust2].velocity *= 2f;
}
}
}
+39 -39
View File
@@ -103,36 +103,36 @@ namespace CalamityMod.NPCs.DevourerofGods
NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity;
Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float num191 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2);
float num192 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2);
num191 = (int)(num191 / 16f) * 16;
num192 = (int)(num192 / 16f) * 16;
vector18.X = (int)(vector18.X / 16f) * 16;
vector18.Y = (int)(vector18.Y / 16f) * 16;
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192);
Vector2 segmentPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2);
float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2);
targetX = (int)(targetX / 16f) * 16;
targetY = (int)(targetY / 16f) * 16;
segmentPosition.X = (int)(segmentPosition.X / 16f) * 16;
segmentPosition.Y = (int)(segmentPosition.Y / 16f) * 16;
targetX -= segmentPosition.X;
targetY -= segmentPosition.Y;
float targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY);
if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length)
{
try
{
vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X;
num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y;
segmentPosition = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X;
targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y;
}
catch
{
}
NPC.rotation = (float)System.Math.Atan2(num192, num191) + 1.57f;
num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192);
int num194 = NPC.width;
num193 = (num193 - num194) / num193;
num191 *= num193;
num192 *= num193;
NPC.rotation = (float)System.Math.Atan2(targetY, targetX) + 1.57f;
targetDistance = (float)System.Math.Sqrt(targetX * targetX + targetY * targetY);
int segmentWidth = NPC.width;
targetDistance = (targetDistance - segmentWidth) / targetDistance;
targetX *= targetDistance;
targetY *= targetDistance;
NPC.velocity = Vector2.Zero;
NPC.position.X = NPC.position.X + num191;
NPC.position.Y = NPC.position.Y + num192;
NPC.position.X = NPC.position.X + targetX;
NPC.position.Y = NPC.position.Y + targetY;
}
}
@@ -143,17 +143,17 @@ namespace CalamityMod.NPCs.DevourerofGods
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/CosmicGuardianTailGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f);
Color glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
@@ -182,23 +182,23 @@ namespace CalamityMod.NPCs.DevourerofGods
NPC.height = 50;
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2);
for (int num621 = 0; num621 < 10; num621++)
for (int i = 0; i < 10; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[cosmiliteDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[cosmiliteDust].scale = 0.5f;
Main.dust[cosmiliteDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 20; num623++)
for (int j = 0; j < 20; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
Main.dust[cosmiliteDust2].noGravity = true;
Main.dust[cosmiliteDust2].velocity *= 5f;
cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[cosmiliteDust2].velocity *= 2f;
}
}
}
+31 -31
View File
@@ -365,27 +365,27 @@ namespace CalamityMod.NPCs.DevourerofGods
bool useOtherTextures = phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60f;
Texture2D texture2D15 = useOtherTextures ? ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyS").Value : TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2);
Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2);
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
if (!NPC.dontTakeDamage)
{
if (useOtherTextures)
{
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodySGlow").Value;
Color color36 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f);
Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color36, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
texture2D15 = useOtherTextures ? ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodySGlow2").Value : ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/DevourerofGodsBodyGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f);
Color glowmaskColor2 = Color.Lerp(Color.White, Color.Cyan, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor2, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
if (disintegrationFactor > 0f)
@@ -400,18 +400,18 @@ namespace CalamityMod.NPCs.DevourerofGods
Rectangle targetHitbox = target.Hitbox;
float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = dist1;
if (dist2 < minDist)
minDist = dist2;
if (dist3 < minDist)
minDist = dist3;
if (dist4 < minDist)
minDist = dist4;
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= (phase2Started ? 55f : 40f) * NPC.scale && NPC.Opacity >= 1f && invinceTime <= 0;
}
@@ -478,23 +478,23 @@ namespace CalamityMod.NPCs.DevourerofGods
NPC.height = (int)(100 * NPC.scale);
NPC.position.X = NPC.position.X - (NPC.width / 2);
NPC.position.Y = NPC.position.Y - (NPC.height / 2);
for (int num621 = 0; num621 < 10; num621++)
for (int i = 0; i < 10; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[cosmiliteDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[cosmiliteDust].scale = 0.5f;
Main.dust[cosmiliteDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 20; num623++)
for (int j = 0; j < 20; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
Main.dust[cosmiliteDust2].noGravity = true;
Main.dust[cosmiliteDust2].velocity *= 5f;
cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[cosmiliteDust2].velocity *= 2f;
}
}
}
File diff suppressed because it is too large. Load diff
+54 -54
View File
@@ -266,39 +266,39 @@ namespace CalamityMod.NPCs.DevourerofGods
NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity;
}
Vector2 vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float num191 = player.position.X + (player.width / 2);
float num192 = player.position.Y + (player.height / 2);
num191 = (int)(num191 / 16f) * 16;
num192 = (int)(num192 / 16f) * 16;
vector18.X = (int)(vector18.X / 16f) * 16;
vector18.Y = (int)(vector18.Y / 16f) * 16;
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192);
Vector2 segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float playerXDist = player.position.X + (player.width / 2);
float playerYDist = player.position.Y + (player.height / 2);
playerXDist = (int)(playerXDist / 16f) * 16;
playerYDist = (int)(playerYDist / 16f) * 16;
segmentDirection.X = (int)(segmentDirection.X / 16f) * 16;
segmentDirection.Y = (int)(segmentDirection.Y / 16f) * 16;
playerXDist -= segmentDirection.X;
playerYDist -= segmentDirection.Y;
float playerDistance = (float)System.Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist);
if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length)
{
try
{
vector18 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
num191 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X;
num192 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y;
segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
playerXDist = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentDirection.X;
playerYDist = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentDirection.Y;
} catch
{
}
NPC.rotation = (float)System.Math.Atan2(num192, num191) + MathHelper.PiOver2;
num193 = (float)System.Math.Sqrt(num191 * num191 + num192 * num192);
int num194 = NPC.width;
num193 = (num193 - num194) / num193;
num191 *= num193;
num192 *= num193;
NPC.rotation = (float)System.Math.Atan2(playerYDist, playerXDist) + MathHelper.PiOver2;
playerDistance = (float)System.Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist);
int segmentWidth = NPC.width;
playerDistance = (playerDistance - segmentWidth) / playerDistance;
playerXDist *= playerDistance;
playerYDist *= playerDistance;
NPC.velocity = Vector2.Zero;
NPC.position.X = NPC.position.X + num191;
NPC.position.Y = NPC.position.Y + num192;
NPC.position.X = NPC.position.X + playerXDist;
NPC.position.Y = NPC.position.Y + playerYDist;
if (num191 < 0f)
if (playerXDist < 0f)
NPC.spriteDirection = -1;
else if (num191 > 0f)
else if (playerXDist > 0f)
NPC.spriteDirection = 1;
}
}
@@ -326,24 +326,24 @@ namespace CalamityMod.NPCs.DevourerofGods
bool useOtherTextures = phase2Started && Main.npc[(int)NPC.ai[2]].localAI[2] <= 60f;
Texture2D texture2D15 = useOtherTextures ? ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailS").Value : TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2);
Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / 2);
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawPosition = NPC.Center - screenPos;
drawPosition -= new Vector2(texture2D15.Width, texture2D15.Height) * NPC.scale / 2f;
drawPosition += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
if (!NPC.dontTakeDamage)
{
texture2D15 = useOtherTextures ? ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailSGlow").Value : ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Fuchsia, 0.5f);
Color glowmaskColor = Color.Lerp(Color.White, Color.Fuchsia, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = useOtherTextures ? ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailSGlow2").Value : ModContent.Request<Texture2D>("CalamityMod/NPCs/DevourerofGods/DevourerofGodsTailGlow2").Value;
color37 = Color.Lerp(Color.White, Color.Cyan, 0.5f);
glowmaskColor = Color.Lerp(Color.White, Color.Cyan, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawPosition, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
if (disintegrationFactor > 0f)
@@ -358,18 +358,18 @@ namespace CalamityMod.NPCs.DevourerofGods
Rectangle targetHitbox = target.Hitbox;
float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = dist1;
if (dist2 < minDist)
minDist = dist2;
if (dist3 < minDist)
minDist = dist3;
if (dist4 < minDist)
minDist = dist4;
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= (phase2Started ? 70f : 35f) * NPC.scale && NPC.Opacity >= 1f;
}
@@ -395,23 +395,23 @@ namespace CalamityMod.NPCs.DevourerofGods
NPC.height = (int)(100 * NPC.scale);
NPC.position.X = NPC.position.X - (NPC.width / 2);
NPC.position.Y = NPC.position.Y - (NPC.height / 2);
for (int num621 = 0; num621 < 10; num621++)
for (int i = 0; i < 10; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int cosmiliteDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[cosmiliteDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[cosmiliteDust].scale = 0.5f;
Main.dust[cosmiliteDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 20; num623++)
for (int j = 0; j < 20; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 3f);
Main.dust[cosmiliteDust2].noGravity = true;
Main.dust[cosmiliteDust2].velocity *= 5f;
cosmiliteDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f);
Main.dust[cosmiliteDust2].velocity *= 2f;
}
}
}
+18 -18
View File
@@ -1354,18 +1354,18 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
Rectangle targetHitbox = target.Hitbox;
float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = dist1;
if (dist2 < minDist)
minDist = dist2;
if (dist3 < minDist)
minDist = dist3;
if (dist4 < minDist)
minDist = dist4;
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= 100f && NPC.Opacity == 1f && AIState == (float)Phase.ChargeCombo;
}
@@ -1735,14 +1735,14 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo
{
Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
}
for (int num194 = 0; num194 < 20; num194++)
for (int i = 0; i < 20; i++)
{
int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[num195].noGravity = true;
Main.dust[num195].velocity *= 3f;
num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[num195].velocity *= 2f;
Main.dust[num195].noGravity = true;
int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[plasmaDust].noGravity = true;
Main.dust[plasmaDust].velocity *= 3f;
plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[plasmaDust].velocity *= 2f;
Main.dust[plasmaDust].noGravity = true;
}
if (Main.netMode != NetmodeID.Server)
+8 -8
View File
@@ -1607,18 +1607,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
if (NPC.life <= 0)
{
for (int num193 = 0; num193 < 2; num193++)
for (int i = 0; i < 2; i++)
{
Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
}
for (int num194 = 0; num194 < 20; num194++)
for (int j = 0; j < 20; j++)
{
int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[num195].noGravity = true;
Main.dust[num195].velocity *= 3f;
num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[num195].velocity *= 2f;
Main.dust[num195].noGravity = true;
int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[plasmaDust].noGravity = true;
Main.dust[plasmaDust].velocity *= 3f;
plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[plasmaDust].velocity *= 2f;
Main.dust[plasmaDust].noGravity = true;
}
if (Main.netMode != NetmodeID.Server)
+8 -8
View File
@@ -665,18 +665,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
if (NPC.life <= 0)
{
for (int num193 = 0; num193 < 2; num193++)
for (int i = 0; i < 2; i++)
{
Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
}
for (int num194 = 0; num194 < 20; num194++)
for (int j = 0; j < 20; j++)
{
int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[num195].noGravity = true;
Main.dust[num195].velocity *= 3f;
num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[num195].velocity *= 2f;
Main.dust[num195].noGravity = true;
int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[plasmaDust].noGravity = true;
Main.dust[plasmaDust].velocity *= 3f;
plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[plasmaDust].velocity *= 2f;
Main.dust[plasmaDust].noGravity = true;
}
if (Main.netMode != NetmodeID.Server)
+8 -8
View File
@@ -715,18 +715,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
if (NPC.life <= 0)
{
for (int num193 = 0; num193 < 2; num193++)
for (int i = 0; i < 2; i++)
{
Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
}
for (int num194 = 0; num194 < 20; num194++)
for (int j = 0; j < 20; j++)
{
int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[num195].noGravity = true;
Main.dust[num195].velocity *= 3f;
num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[num195].velocity *= 2f;
Main.dust[num195].noGravity = true;
int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[plasmaDust].noGravity = true;
Main.dust[plasmaDust].velocity *= 3f;
plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[plasmaDust].velocity *= 2f;
Main.dust[plasmaDust].noGravity = true;
}
if (Main.netMode != NetmodeID.Server)
+8 -8
View File
@@ -664,18 +664,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
if (NPC.life <= 0)
{
for (int num193 = 0; num193 < 2; num193++)
for (int i = 0; i < 2; i++)
{
Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
}
for (int num194 = 0; num194 < 20; num194++)
for (int j = 0; j < 20; j++)
{
int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[num195].noGravity = true;
Main.dust[num195].velocity *= 3f;
num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[num195].velocity *= 2f;
Main.dust[num195].noGravity = true;
int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[plasmaDust].noGravity = true;
Main.dust[plasmaDust].velocity *= 3f;
plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[plasmaDust].velocity *= 2f;
Main.dust[plasmaDust].noGravity = true;
}
if (Main.netMode != NetmodeID.Server)
+8 -8
View File
@@ -658,18 +658,18 @@ namespace CalamityMod.NPCs.ExoMechs.Ares
if (NPC.life <= 0)
{
for (int num193 = 0; num193 < 2; num193++)
for (int i = 0; i < 2; i++)
{
Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
}
for (int num194 = 0; num194 < 20; num194++)
for (int j = 0; j < 20; j++)
{
int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[num195].noGravity = true;
Main.dust[num195].velocity *= 3f;
num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[num195].velocity *= 2f;
Main.dust[num195].noGravity = true;
int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[plasmaDust].noGravity = true;
Main.dust[plasmaDust].velocity *= 3f;
plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[plasmaDust].velocity *= 2f;
Main.dust[plasmaDust].noGravity = true;
}
if (Main.netMode != NetmodeID.Server)
+19 -19
View File
@@ -1248,18 +1248,18 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis
Rectangle targetHitbox = target.Hitbox;
float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = dist1;
if (dist2 < minDist)
minDist = dist2;
if (dist3 < minDist)
minDist = dist3;
if (dist4 < minDist)
minDist = dist4;
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= 100f && NPC.Opacity == 1f && AIState == (float)Phase.Charge;
}
@@ -1562,18 +1562,18 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis
if (NPC.life <= 0)
{
for (int num193 = 0; num193 < 2; num193++)
for (int i = 0; i < 2; i++)
{
Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
}
for (int num194 = 0; num194 < 20; num194++)
for (int j = 0; j < 20; j++)
{
int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[num195].noGravity = true;
Main.dust[num195].velocity *= 3f;
num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[num195].velocity *= 2f;
Main.dust[num195].noGravity = true;
int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[plasmaDust].noGravity = true;
Main.dust[plasmaDust].velocity *= 3f;
plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[plasmaDust].velocity *= 2f;
Main.dust[plasmaDust].noGravity = true;
}
if (Main.netMode != NetmodeID.Server)
+19 -19
View File
@@ -515,18 +515,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
Rectangle targetHitbox = target.Hitbox;
float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = dist1;
if (dist2 < minDist)
minDist = dist2;
if (dist3 < minDist)
minDist = dist3;
if (dist4 < minDist)
minDist = dist4;
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= 50f && NPC.Opacity == 1f && noContactDamageTimer <= 0;
}
@@ -629,17 +629,17 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
if (NPC.life <= 0)
{
for (int num193 = 0; num193 < 2; num193++)
for (int i = 0; i < 2; i++)
Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
for (int num194 = 0; num194 < 20; num194++)
for (int j = 0; j < 20; j++)
{
int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[num195].noGravity = true;
Main.dust[num195].velocity *= 3f;
num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[num195].velocity *= 2f;
Main.dust[num195].noGravity = true;
int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[plasmaDust].noGravity = true;
Main.dust[plasmaDust].velocity *= 3f;
plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[plasmaDust].velocity *= 2f;
Main.dust[plasmaDust].noGravity = true;
}
if (Main.netMode != NetmodeID.Server)
+19 -19
View File
@@ -517,18 +517,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
Rectangle targetHitbox = target.Hitbox;
float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = dist1;
if (dist2 < minDist)
minDist = dist2;
if (dist3 < minDist)
minDist = dist3;
if (dist4 < minDist)
minDist = dist4;
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= 50f && NPC.Opacity == 1f && noContactDamageTimer <= 0;
}
@@ -632,18 +632,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
if (NPC.life <= 0)
{
for (int num193 = 0; num193 < 2; num193++)
for (int i = 0; i < 2; i++)
{
Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
}
for (int num194 = 0; num194 < 20; num194++)
for (int j = 0; j < 20; j++)
{
int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[num195].noGravity = true;
Main.dust[num195].velocity *= 3f;
num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[num195].velocity *= 2f;
Main.dust[num195].noGravity = true;
int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[plasmaDust].noGravity = true;
Main.dust[plasmaDust].velocity *= 3f;
plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[plasmaDust].velocity *= 2f;
Main.dust[plasmaDust].noGravity = true;
}
if (Main.netMode != NetmodeID.Server)
+19 -19
View File
@@ -1018,18 +1018,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
Rectangle targetHitbox = target.Hitbox;
float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = dist1;
if (dist2 < minDist)
minDist = dist2;
if (dist3 < minDist)
minDist = dist3;
if (dist4 < minDist)
minDist = dist4;
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= 50f && NPC.Opacity == 1f && noContactDamageTimer <= 0;
}
@@ -1265,18 +1265,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
if (NPC.life <= 0)
{
for (int num193 = 0; num193 < 2; num193++)
for (int i = 0; i < 2; i++)
{
Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
}
for (int num194 = 0; num194 < 20; num194++)
for (int j = 0; j < 20; j++)
{
int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[num195].noGravity = true;
Main.dust[num195].velocity *= 3f;
num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[num195].velocity *= 2f;
Main.dust[num195].noGravity = true;
int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[plasmaDust].noGravity = true;
Main.dust[plasmaDust].velocity *= 3f;
plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[plasmaDust].velocity *= 2f;
Main.dust[plasmaDust].noGravity = true;
}
if (Main.netMode != NetmodeID.Server)
+19 -19
View File
@@ -515,18 +515,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
Rectangle targetHitbox = target.Hitbox;
float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = dist1;
if (dist2 < minDist)
minDist = dist2;
if (dist3 < minDist)
minDist = dist3;
if (dist4 < minDist)
minDist = dist4;
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= 45f && NPC.Opacity == 1f && noContactDamageTimer <= 0;
}
@@ -630,18 +630,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
if (NPC.life <= 0)
{
for (int num193 = 0; num193 < 2; num193++)
for (int i = 0; i < 2; i++)
{
Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
}
for (int num194 = 0; num194 < 20; num194++)
for (int j = 0; j < 20; j++)
{
int num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[num195].noGravity = true;
Main.dust[num195].velocity *= 3f;
num195 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[num195].velocity *= 2f;
Main.dust[num195].noGravity = true;
int plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 0, new Color(0, 255, 255), 2.5f);
Main.dust[plasmaDust].noGravity = true;
Main.dust[plasmaDust].velocity *= 3f;
plasmaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 107, 0f, 0f, 100, new Color(0, 255, 255), 1.5f);
Main.dust[plasmaDust].velocity *= 2f;
Main.dust[plasmaDust].noGravity = true;
}
if (Main.netMode != NetmodeID.Server)
+17 -17
View File
@@ -65,17 +65,17 @@ namespace CalamityMod.NPCs.HiveMind
NPC.rotation = NPC.velocity.X * 0.05f;
Vector2 vector167 = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f);
float num1373 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - vector167.X;
float num1374 = Main.player[NPC.target].Center.Y - vector167.Y;
float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374);
float num1376 = speed / num1375;
num1373 *= num1376;
num1374 *= num1376;
Vector2 targetDirection = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f);
float playerXDist = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - targetDirection.X;
float playerYDist = Main.player[NPC.target].Center.Y - targetDirection.Y;
float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist);
float timeToReachTarget = speed / playerDistance;
playerXDist *= timeToReachTarget;
playerYDist *= timeToReachTarget;
NPC.ai[0] -= 1f;
if (num1375 < 200f || NPC.ai[0] > 0f)
if (playerDistance < 200f || NPC.ai[0] > 0f)
{
if (num1375 < 200f)
if (playerDistance < 200f)
{
NPC.ai[0] = 20f;
}
@@ -89,17 +89,17 @@ namespace CalamityMod.NPCs.HiveMind
}
return;
}
NPC.velocity.X = (NPC.velocity.X * 50f + num1373) / 51f;
NPC.velocity.Y = (NPC.velocity.Y * 50f + num1374) / 51f;
if (num1375 < 350f)
NPC.velocity.X = (NPC.velocity.X * 50f + playerXDist) / 51f;
NPC.velocity.Y = (NPC.velocity.Y * 50f + playerYDist) / 51f;
if (playerDistance < 350f)
{
NPC.velocity.X = (NPC.velocity.X * 10f + num1373) / 11f;
NPC.velocity.Y = (NPC.velocity.Y * 10f + num1374) / 11f;
NPC.velocity.X = (NPC.velocity.X * 10f + playerXDist) / 11f;
NPC.velocity.Y = (NPC.velocity.Y * 10f + playerYDist) / 11f;
}
if (num1375 < 300f)
if (playerDistance < 300f)
{
NPC.velocity.X = (NPC.velocity.X * 7f + num1373) / 8f;
NPC.velocity.Y = (NPC.velocity.Y * 7f + num1374) / 8f;
NPC.velocity.X = (NPC.velocity.X * 7f + playerXDist) / 8f;
NPC.velocity.Y = (NPC.velocity.Y * 7f + playerYDist) / 8f;
}
}
+33 -33
View File
@@ -63,59 +63,59 @@ namespace CalamityMod.NPCs.HiveMind
bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive;
NPC.TargetClosest();
float num1164 = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 8f : revenge ? 4.5f : 4f;
float num1165 = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 1f : revenge ? 0.8f : 0.75f;
float npcSpeed = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 8f : revenge ? 4.5f : 4f;
float velocityMult = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 1f : revenge ? 0.8f : 0.75f;
if (BossRushEvent.BossRushActive)
{
num1164 *= 2f;
num1165 *= 2f;
npcSpeed *= 2f;
velocityMult *= 2f;
}
Vector2 vector133 = new Vector2(NPC.Center.X, NPC.Center.Y);
float num1166 = Main.player[NPC.target].Center.X - vector133.X;
float num1167 = Main.player[NPC.target].Center.Y - vector133.Y - ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 500f : 400f);
float num1168 = (float)Math.Sqrt(num1166 * num1166 + num1167 * num1167);
if (num1168 < ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10f : 20f))
Vector2 npcCenter = new Vector2(NPC.Center.X, NPC.Center.Y);
float playerXDist = Main.player[NPC.target].Center.X - npcCenter.X;
float playerYDist = Main.player[NPC.target].Center.Y - npcCenter.Y - ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 500f : 400f);
float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist);
if (playerDistance < ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10f : 20f))
{
num1166 = NPC.velocity.X;
num1167 = NPC.velocity.Y;
playerXDist = NPC.velocity.X;
playerYDist = NPC.velocity.Y;
}
else
{
num1168 = num1164 / num1168;
num1166 *= num1168;
num1167 *= num1168;
playerDistance = npcSpeed / playerDistance;
playerXDist *= playerDistance;
playerYDist *= playerDistance;
}
if (NPC.velocity.X < num1166)
if (NPC.velocity.X < playerXDist)
{
NPC.velocity.X = NPC.velocity.X + num1165;
if (NPC.velocity.X < 0f && num1166 > 0f)
NPC.velocity.X = NPC.velocity.X + velocityMult;
if (NPC.velocity.X < 0f && playerXDist > 0f)
{
NPC.velocity.X = NPC.velocity.X + num1165 * 2f;
NPC.velocity.X = NPC.velocity.X + velocityMult * 2f;
}
}
else if (NPC.velocity.X > num1166)
else if (NPC.velocity.X > playerXDist)
{
NPC.velocity.X = NPC.velocity.X - num1165;
if (NPC.velocity.X > 0f && num1166 < 0f)
NPC.velocity.X = NPC.velocity.X - velocityMult;
if (NPC.velocity.X > 0f && playerXDist < 0f)
{
NPC.velocity.X = NPC.velocity.X - num1165 * 2f;
NPC.velocity.X = NPC.velocity.X - velocityMult * 2f;
}
}
if (NPC.velocity.Y < num1167)
if (NPC.velocity.Y < playerYDist)
{
NPC.velocity.Y = NPC.velocity.Y + num1165;
if (NPC.velocity.Y < 0f && num1167 > 0f)
NPC.velocity.Y = NPC.velocity.Y + velocityMult;
if (NPC.velocity.Y < 0f && playerYDist > 0f)
{
NPC.velocity.Y = NPC.velocity.Y + num1165 * 2f;
NPC.velocity.Y = NPC.velocity.Y + velocityMult * 2f;
}
}
else if (NPC.velocity.Y > num1167)
else if (NPC.velocity.Y > playerYDist)
{
NPC.velocity.Y = NPC.velocity.Y - num1165;
if (NPC.velocity.Y > 0f && num1167 < 0f)
NPC.velocity.Y = NPC.velocity.Y - velocityMult;
if (NPC.velocity.Y > 0f && playerYDist < 0f)
{
NPC.velocity.Y = NPC.velocity.Y - num1165 * 2f;
NPC.velocity.Y = NPC.velocity.Y - velocityMult * 2f;
}
}
if (NPC.position.X + NPC.width > Main.player[NPC.target].position.X && NPC.position.X < Main.player[NPC.target].position.X + Main.player[NPC.target].width && NPC.position.Y + NPC.height < Main.player[NPC.target].position.Y && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height) && Main.netMode != NetmodeID.MultiplayerClient)
@@ -124,12 +124,12 @@ namespace CalamityMod.NPCs.HiveMind
if (NPC.ai[0] >= (Main.getGoodWorld ? 12f : 24f))
{
NPC.ai[0] = 0f;
int num1169 = (int)(NPC.position.X + 10f + Main.rand.Next(NPC.width - 20));
int num1170 = (int)(NPC.position.Y + NPC.height + 4f);
int shaderainXPos = (int)(NPC.position.X + 10f + Main.rand.Next(NPC.width - 20));
int shaderainYos = (int)(NPC.position.Y + NPC.height + 4f);
int type = ModContent.ProjectileType<ShaderainHostile>();
int damage = NPC.GetProjectileDamage(type);
float randomXVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.rand.NextFloat() * 5f : 0f;
Projectile.NewProjectile(NPC.GetSource_FromAI(), num1169, num1170, randomXVelocity, 4f, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), shaderainXPos, shaderainYos, randomXVelocity, 4f, type, damage, 0f, Main.myPlayer);
}
}
}
+43 -44
View File
@@ -60,8 +60,8 @@ namespace CalamityMod.NPCs.HiveMind
bool getFuckedAI = Main.zenithWorld;
int num750 = CalamityGlobalNPC.hiveMind;
if (num750 < 0 || !Main.npc[num750].active)
int hiveMind = CalamityGlobalNPC.hiveMind;
if (hiveMind < 0 || !Main.npc[hiveMind].active)
{
NPC.life = 0;
NPC.HitEffect();
@@ -71,7 +71,7 @@ namespace CalamityMod.NPCs.HiveMind
}
if (NPC.ai[3] > 0f)
num750 = (int)NPC.ai[3] - 1;
hiveMind = (int)NPC.ai[3] - 1;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
@@ -88,45 +88,44 @@ namespace CalamityMod.NPCs.HiveMind
NPC.TargetClosest(true);
float num751 = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f;
float num752 = Main.getGoodWorld ? 256f : 128f;
Vector2 vector22 = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f);
float num189 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - (NPC.width / 2) - vector22.X;
float num190 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - (NPC.height / 2) - vector22.Y;
float num191 = (float)Math.Sqrt(num189 * num189 + num190 * num190);
float num754 = Main.npc[num750].position.X + (Main.npc[num750].width / 2);
float num755 = Main.npc[num750].position.Y + (Main.npc[num750].height / 2);
Vector2 vector93 = new Vector2(num754, num755);
float num756 = num754 + NPC.ai[0];
float num757 = num755 + NPC.ai[1];
float num758 = num756 - vector93.X;
float num759 = num757 - vector93.Y;
float num760 = (float)Math.Sqrt(num758 * num758 + num759 * num759);
num760 = num752 / num760;
num758 *= num760;
num759 *= num760;
if (NPC.position.X < num754 + num758)
float relocateSpeed = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f;
Vector2 randomLocationVector = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f);
float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - (NPC.width / 2) - randomLocationVector.X;
float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - (NPC.height / 2) - randomLocationVector.Y;
float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY);
float hiveMindX = Main.npc[hiveMind].position.X + (Main.npc[hiveMind].width / 2);
float hiveMindY = Main.npc[hiveMind].position.Y + (Main.npc[hiveMind].height / 2);
Vector2 hiveMindPos = new Vector2(hiveMindX, hiveMindY);
float randomPosX = hiveMindX + NPC.ai[0];
float randomPosY = hiveMindY + NPC.ai[1];
float finalRandPosX = randomPosX - hiveMindPos.X;
float finalRandPosY = randomPosY - hiveMindPos.Y;
float finalRandDistance = (float)Math.Sqrt(finalRandPosX * finalRandPosX + finalRandPosY * finalRandPosY);
finalRandDistance = (Main.getGoodWorld ? 256f : 128f) / finalRandDistance;
finalRandPosX *= finalRandDistance;
finalRandPosY *= finalRandDistance;
if (NPC.position.X < hiveMindX + finalRandPosX)
{
NPC.velocity.X = NPC.velocity.X + num751;
if (NPC.velocity.X < 0f && num758 > 0f)
NPC.velocity.X = NPC.velocity.X + relocateSpeed;
if (NPC.velocity.X < 0f && finalRandPosX > 0f)
NPC.velocity.X = NPC.velocity.X * 0.8f;
}
else if (NPC.position.X > num754 + num758)
else if (NPC.position.X > hiveMindX + finalRandPosX)
{
NPC.velocity.X = NPC.velocity.X - num751;
if (NPC.velocity.X > 0f && num758 < 0f)
NPC.velocity.X = NPC.velocity.X - relocateSpeed;
if (NPC.velocity.X > 0f && finalRandPosX < 0f)
NPC.velocity.X = NPC.velocity.X * 0.8f;
}
if (NPC.position.Y < num755 + num759)
if (NPC.position.Y < hiveMindY + finalRandPosY)
{
NPC.velocity.Y = NPC.velocity.Y + num751;
if (NPC.velocity.Y < 0f && num759 > 0f)
NPC.velocity.Y = NPC.velocity.Y + relocateSpeed;
if (NPC.velocity.Y < 0f && finalRandPosY > 0f)
NPC.velocity.Y = NPC.velocity.Y * 0.8f;
}
else if (NPC.position.Y > num755 + num759)
else if (NPC.position.Y > hiveMindY + finalRandPosY)
{
NPC.velocity.Y = NPC.velocity.Y - num751;
if (NPC.velocity.Y > 0f && num759 < 0f)
NPC.velocity.Y = NPC.velocity.Y - relocateSpeed;
if (NPC.velocity.Y > 0f && finalRandPosY < 0f)
NPC.velocity.Y = NPC.velocity.Y * 0.8f;
}
@@ -152,26 +151,26 @@ namespace CalamityMod.NPCs.HiveMind
NPC.TargetClosest(true);
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height))
{
float num941 = death ? 5f : revenge ? 4.5f : expertMode ? 4f : 3.5f;
float projSpeed = death ? 5f : revenge ? 4.5f : expertMode ? 4f : 3.5f;
if (Main.getGoodWorld)
num941 *= 2.4f;
projSpeed *= 2.4f;
Vector2 vector104 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + (NPC.height / 2));
float num942 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - vector104.X;
float num943 = Main.player[NPC.target].position.Y + Main.player[NPC.target].height * 0.5f - vector104.Y;
float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943);
num944 = num941 / num944;
num942 *= num944;
num943 *= num944;
Vector2 projDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + (NPC.height / 2));
float playerX = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - projDirection.X;
float playerY = Main.player[NPC.target].position.Y + Main.player[NPC.target].height * 0.5f - projDirection.Y;
float playerDist = (float)Math.Sqrt(playerX * playerX + playerY * playerY);
playerDist = projSpeed / playerDist;
playerX *= playerDist;
playerY *= playerDist;
int type = (CalamityWorld.LegendaryMode && CalamityWorld.revenge && Main.rand.NextBool(5)) ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType<VileClot>();
int damage = type == ProjectileID.CursedFlameHostile ? 30 : NPC.GetProjectileDamage(type);
Vector2 projectileVelocity = new Vector2(num942, num943);
Vector2 projectileVelocity = new Vector2(playerX, playerY);
if (type == ProjectileID.CursedFlameHostile)
{
Vector2 v = Main.player[NPC.target].Center - NPC.Center - Main.player[NPC.target].velocity * 20f;
projectileVelocity = v.SafeNormalize(Vector2.UnitY) * num941;
projectileVelocity = v.SafeNormalize(Vector2.UnitY) * projSpeed;
}
Projectile.NewProjectile(NPC.GetSource_FromAI(), vector104, projectileVelocity, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), projDirection, projectileVelocity, type, damage, 0f, Main.myPlayer);
NPC.netUpdate = true;
}
}
+43 -44
View File
@@ -62,8 +62,8 @@ namespace CalamityMod.NPCs.HiveMind
bool getFuckedAI = Main.zenithWorld;
int num750 = CalamityGlobalNPC.hiveMind;
if (num750 < 0 || !Main.npc[num750].active)
int hiveMind = CalamityGlobalNPC.hiveMind;
if (hiveMind < 0 || !Main.npc[hiveMind].active)
{
NPC.life = 0;
NPC.HitEffect();
@@ -73,7 +73,7 @@ namespace CalamityMod.NPCs.HiveMind
}
if (NPC.ai[3] > 0f)
num750 = (int)NPC.ai[3] - 1;
hiveMind = (int)NPC.ai[3] - 1;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
@@ -90,45 +90,44 @@ namespace CalamityMod.NPCs.HiveMind
NPC.TargetClosest(true);
float num751 = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f;
float num752 = Main.getGoodWorld ? 192f : 96f;
Vector2 vector22 = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f);
float num189 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - (NPC.width / 2) - vector22.X;
float num190 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - (NPC.height / 2) - vector22.Y;
float num191 = (float)Math.Sqrt(num189 * num189 + num190 * num190);
float num754 = Main.npc[num750].position.X + (Main.npc[num750].width / 2);
float num755 = Main.npc[num750].position.Y + (Main.npc[num750].height / 2);
Vector2 vector93 = new Vector2(num754, num755);
float num756 = num754 + NPC.ai[0];
float num757 = num755 + NPC.ai[1];
float num758 = num756 - vector93.X;
float num759 = num757 - vector93.Y;
float num760 = (float)Math.Sqrt(num758 * num758 + num759 * num759);
num760 = num752 / num760;
num758 *= num760;
num759 *= num760;
if (NPC.position.X < num754 + num758)
float relocateSpeed = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f;
Vector2 randomRelocateVector = new Vector2(NPC.ai[0] * 16f + 8f, NPC.ai[1] * 16f + 8f);
float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2) - (NPC.width / 2) - randomRelocateVector.X;
float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2) - (NPC.height / 2) - randomRelocateVector.Y;
float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY);
float hiveMindX = Main.npc[hiveMind].position.X + (Main.npc[hiveMind].width / 2);
float hiveMindY = Main.npc[hiveMind].position.Y + (Main.npc[hiveMind].height / 2);
Vector2 hiveMindPos = new Vector2(hiveMindX, hiveMindY);
float randomPosX = hiveMindX + NPC.ai[0];
float randomPosY = hiveMindY + NPC.ai[1];
float finalRandPosX = randomPosX - hiveMindPos.X;
float finalRandPosY = randomPosY - hiveMindPos.Y;
float finalRandDistance = (float)Math.Sqrt(finalRandPosX * finalRandPosX + finalRandPosY * finalRandPosY);
finalRandDistance = (Main.getGoodWorld ? 192f : 96f) / finalRandDistance;
finalRandPosX *= finalRandDistance;
finalRandPosY *= finalRandDistance;
if (NPC.position.X < hiveMindX + finalRandPosX)
{
NPC.velocity.X = NPC.velocity.X + num751;
if (NPC.velocity.X < 0f && num758 > 0f)
NPC.velocity.X = NPC.velocity.X + relocateSpeed;
if (NPC.velocity.X < 0f && finalRandPosX > 0f)
NPC.velocity.X = NPC.velocity.X * 0.8f;
}
else if (NPC.position.X > num754 + num758)
else if (NPC.position.X > hiveMindX + finalRandPosX)
{
NPC.velocity.X = NPC.velocity.X - num751;
if (NPC.velocity.X > 0f && num758 < 0f)
NPC.velocity.X = NPC.velocity.X - relocateSpeed;
if (NPC.velocity.X > 0f && finalRandPosX < 0f)
NPC.velocity.X = NPC.velocity.X * 0.8f;
}
if (NPC.position.Y < num755 + num759)
if (NPC.position.Y < hiveMindY + finalRandPosY)
{
NPC.velocity.Y = NPC.velocity.Y + num751;
if (NPC.velocity.Y < 0f && num759 > 0f)
NPC.velocity.Y = NPC.velocity.Y + relocateSpeed;
if (NPC.velocity.Y < 0f && finalRandPosY > 0f)
NPC.velocity.Y = NPC.velocity.Y * 0.8f;
}
else if (NPC.position.Y > num755 + num759)
else if (NPC.position.Y > hiveMindY + finalRandPosY)
{
NPC.velocity.Y = NPC.velocity.Y - num751;
if (NPC.velocity.Y > 0f && num759 < 0f)
NPC.velocity.Y = NPC.velocity.Y - relocateSpeed;
if (NPC.velocity.Y > 0f && finalRandPosY < 0f)
NPC.velocity.Y = NPC.velocity.Y * 0.8f;
}
@@ -154,26 +153,26 @@ namespace CalamityMod.NPCs.HiveMind
NPC.TargetClosest(true);
if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height))
{
float num941 = death ? 5f : revenge ? 4.5f : expertMode ? 4f : 3.5f;
float projSpeed = death ? 5f : revenge ? 4.5f : expertMode ? 4f : 3.5f;
if (Main.getGoodWorld)
num941 *= 2.4f;
projSpeed *= 2.4f;
Vector2 vector104 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + (NPC.height / 2));
float num942 = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - vector104.X;
float num943 = Main.player[NPC.target].position.Y + Main.player[NPC.target].height * 0.5f - vector104.Y;
float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943);
num944 = num941 / num944;
num942 *= num944;
num943 *= num944;
Vector2 projDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + (NPC.height / 2));
float playerX = Main.player[NPC.target].position.X + Main.player[NPC.target].width * 0.5f - projDirection.X;
float playerY = Main.player[NPC.target].position.Y + Main.player[NPC.target].height * 0.5f - projDirection.Y;
float playerDist = (float)Math.Sqrt(playerX * playerX + playerY * playerY);
playerDist = projSpeed / playerDist;
playerX *= playerDist;
playerY *= playerDist;
int type = (CalamityWorld.LegendaryMode && CalamityWorld.revenge && Main.rand.NextBool(5)) ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType<VileClot>();
int damage = type == ProjectileID.CursedFlameHostile ? 30 : NPC.GetProjectileDamage(type);
Vector2 projectileVelocity = new Vector2(num942, num943);
Vector2 projectileVelocity = new Vector2(playerX, playerY);
if (type == ProjectileID.CursedFlameHostile)
{
Vector2 v = Main.player[NPC.target].Center - NPC.Center - Main.player[NPC.target].velocity * 20f;
projectileVelocity = v.SafeNormalize(Vector2.UnitY) * num941;
projectileVelocity = v.SafeNormalize(Vector2.UnitY) * projSpeed;
}
Projectile.NewProjectile(NPC.GetSource_FromAI(), vector104, projectileVelocity, type, damage, 0f, Main.myPlayer);
Projectile.NewProjectile(NPC.GetSource_FromAI(), projDirection, projectileVelocity, type, damage, 0f, Main.myPlayer);
NPC.netUpdate = true;
}
}
+47 -47
View File
@@ -526,15 +526,15 @@ namespace CalamityMod.NPCs.HiveMind
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int num660 = (int)(NPC.lifeMax * 0.05);
if ((NPC.life + num660) < NPC.ai[3])
int fivePercentHP = (int)(NPC.lifeMax * 0.05);
if ((NPC.life + fivePercentHP) < NPC.ai[3])
{
NPC.ai[3] = NPC.life;
int maxSpawns = bossRush ? 10 : death ? 5 : revenge ? 4 : expertMode ? Main.rand.Next(3, 5) : Main.rand.Next(2, 4);
int maxDankSpawns = bossRush ? 4 : death ? Main.rand.Next(2, 4) : revenge ? 2 : expertMode ? Main.rand.Next(1, 3) : 1;
for (int num662 = 0; num662 < maxSpawns; num662++)
for (int i = 0; i < maxSpawns; i++)
{
int x = (int)(NPC.position.X + Main.rand.Next(NPC.width - 32));
int y = (int)(NPC.position.Y + Main.rand.Next(NPC.height - 32));
@@ -543,10 +543,10 @@ namespace CalamityMod.NPCs.HiveMind
if (NPC.CountNPCS(ModContent.NPCType<DankCreeper>()) < maxDankSpawns)
type = ModContent.NPCType<DankCreeper>();
int num664 = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, type);
Main.npc[num664].SetDefaults(type);
if (Main.netMode == NetmodeID.Server && num664 < Main.maxNPCs)
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num664, 0f, 0f, 0f, 0, 0, 0);
int fivePercentMinions = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, type);
Main.npc[fivePercentMinions].SetDefaults(type);
if (Main.netMode == NetmodeID.Server && fivePercentMinions < Main.maxNPCs)
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, fivePercentMinions, 0f, 0f, 0f, 0, 0, 0);
}
return;
@@ -571,21 +571,21 @@ namespace CalamityMod.NPCs.HiveMind
NPC.scale += 0.0165f;
NPC.alpha -= 4;
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale);
Main.dust[num622].velocity *= 2f;
int burrowedDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale);
Main.dust[burrowedDust].velocity *= 2f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[burrowedDust].scale = 0.5f;
Main.dust[burrowedDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
for (int i = 0; i < 2; i++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 3.5f * NPC.scale);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 3.5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale);
Main.dust[num624].velocity *= 1f;
int burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 3.5f * NPC.scale);
Main.dust[burrowedDust2].noGravity = true;
Main.dust[burrowedDust2].velocity *= 3.5f;
burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale);
Main.dust[burrowedDust2].velocity *= 1f;
}
}
else if (burrowTimer == -60)
@@ -612,21 +612,21 @@ namespace CalamityMod.NPCs.HiveMind
NPC.scale -= 0.0165f;
NPC.alpha += 4;
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale);
Main.dust[num622].velocity *= 2f;
int burrowedDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale);
Main.dust[burrowedDust].velocity *= 2f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[burrowedDust].scale = 0.5f;
Main.dust[burrowedDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
for (int i = 0; i < 2; i++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 3.5f * NPC.scale);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 3.5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale);
Main.dust[num624].velocity *= 1f;
int burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 3.5f * NPC.scale);
Main.dust[burrowedDust2].noGravity = true;
Main.dust[burrowedDust2].velocity *= 3.5f;
burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, 14, 0f, -3f, 100, default, 2.5f * NPC.scale);
Main.dust[burrowedDust2].velocity *= 1f;
}
}
else if (burrowTimer == 0)
@@ -1019,18 +1019,18 @@ namespace CalamityMod.NPCs.HiveMind
{
Rectangle targetHitbox = target.Hitbox;
float dist1 = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float dist2 = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float dist3 = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float dist4 = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float hitboxTopLeft = Vector2.Distance(NPC.Center, targetHitbox.TopLeft());
float hitboxTopRight = Vector2.Distance(NPC.Center, targetHitbox.TopRight());
float hitboxBotLeft = Vector2.Distance(NPC.Center, targetHitbox.BottomLeft());
float hitboxBotRight = Vector2.Distance(NPC.Center, targetHitbox.BottomRight());
float minDist = dist1;
if (dist2 < minDist)
minDist = dist2;
if (dist3 < minDist)
minDist = dist3;
if (dist4 < minDist)
minDist = dist4;
float minDist = hitboxTopLeft;
if (hitboxTopRight < minDist)
minDist = hitboxTopRight;
if (hitboxBotLeft < minDist)
minDist = hitboxBotLeft;
if (hitboxBotRight < minDist)
minDist = hitboxBotRight;
return minDist <= 60f && NPC.alpha == 0 && NPC.scale == 1f; // No damage while not fully visible or shrunk
}
@@ -1103,23 +1103,23 @@ namespace CalamityMod.NPCs.HiveMind
NPC.height = 150;
NPC.position.X = NPC.position.X - (NPC.width / 2);
NPC.position.Y = NPC.position.Y - (NPC.height / 2);
for (int num621 = 0; num621 < 40; num621++)
for (int i = 0; i < 40; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int killDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 2f);
Main.dust[killDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[killDust].scale = 0.5f;
Main.dust[killDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 70; num623++)
for (int j = 0; j < 70; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int killDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 3f);
Main.dust[killDust2].noGravity = true;
Main.dust[killDust2].velocity *= 5f;
killDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 14, 0f, 0f, 100, default, 2f);
Main.dust[killDust2].velocity *= 2f;
}
}
}
+68 -68
View File
@@ -248,17 +248,17 @@ namespace CalamityMod.NPCs.Leviathan
{
if (NPC.ai[3] == 0f && NPC.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient)
{
int num6 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType<AnahitasIceShield>(), NPC.whoAmI);
NPC.ai[3] = num6 + 1;
int iceShieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector.X, (int)vector.Y, ModContent.NPCType<AnahitasIceShield>(), NPC.whoAmI);
NPC.ai[3] = iceShieldSpawn + 1;
NPC.localAI[1] = -1f;
NPC.localAI[2] += 1f;
NPC.netUpdate = true;
Main.npc[num6].ai[0] = NPC.whoAmI;
Main.npc[num6].netUpdate = true;
Main.npc[iceShieldSpawn].ai[0] = NPC.whoAmI;
Main.npc[iceShieldSpawn].netUpdate = true;
}
int num7 = (int)NPC.ai[3] - 1;
if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType<AnahitasIceShield>())
int iceShieldCheck = (int)NPC.ai[3] - 1;
if (iceShieldCheck != -1 && Main.npc[iceShieldCheck].active && Main.npc[iceShieldCheck].type == ModContent.NPCType<AnahitasIceShield>())
NPC.dontTakeDamage = true;
else
{
@@ -287,8 +287,8 @@ namespace CalamityMod.NPCs.Leviathan
{
NPC.dontTakeDamage = false;
int num7 = (int)NPC.ai[3] - 1;
if (num7 != -1 && Main.npc[num7].active && Main.npc[num7].type == ModContent.NPCType<AnahitasIceShield>())
int iceShieldCheck = (int)NPC.ai[3] - 1;
if (iceShieldCheck != -1 && Main.npc[iceShieldCheck].active && Main.npc[iceShieldCheck].type == ModContent.NPCType<AnahitasIceShield>())
NPC.dontTakeDamage = true;
}
@@ -395,11 +395,11 @@ namespace CalamityMod.NPCs.Leviathan
if (NPC.ai[0] == -1f)
{
int random = ((phase2 && expertMode && !leviAlive) || phase4 || death) ? 4 : 3;
int num618;
do num618 = Main.rand.Next(random);
while (num618 == NPC.ai[1] || num618 == 1);
int nextAttack;
do nextAttack = Main.rand.Next(random);
while (nextAttack == NPC.ai[1] || nextAttack == 1);
NPC.ai[0] = num618;
NPC.ai[0] = nextAttack;
if (NPC.ai[0] != 3f)
{
@@ -422,13 +422,13 @@ namespace CalamityMod.NPCs.Leviathan
NPC.rotation = NPC.velocity.X * 0.02f;
NPC.spriteDirection = NPC.direction;
Vector2 vector118 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float num1055 = player.position.X + (player.width / 2) - vector118.X;
float num1056 = player.position.Y + (player.height / 2) - 200f * NPC.scale - vector118.Y;
float num1057 = (float)Math.Sqrt(num1055 * num1055 + num1056 * num1056);
Vector2 anahitaPos = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float playerXDist = player.position.X + (player.width / 2) - anahitaPos.X;
float playerYDist = player.position.Y + (player.height / 2) - 200f * NPC.scale - anahitaPos.Y;
float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist);
NPC.Calamity().newAI[0] += 1f;
if (num1057 < 600f * NPC.scale || NPC.Calamity().newAI[0] >= 180f)
if (playerDistance < 600f * NPC.scale || NPC.Calamity().newAI[0] >= 180f)
{
NPC.ai[0] = 1f;
NPC.ai[1] = 0f;
@@ -482,41 +482,41 @@ namespace CalamityMod.NPCs.Leviathan
else if (NPC.ai[0] == 1f)
{
NPC.rotation = NPC.velocity.X * 0.02f;
Vector2 vector119 = new Vector2(NPC.position.X + (NPC.width / 2) + (15 * NPC.direction * NPC.scale), NPC.position.Y + 30 * NPC.scale);
Vector2 vector120 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float num1058 = player.position.X + (player.width / 2) - vector120.X;
float num1059 = player.position.Y + (player.height / 2) - vector120.Y;
float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059);
Vector2 bubbleSpawnPos = new Vector2(NPC.position.X + (NPC.width / 2) + (15 * NPC.direction * NPC.scale), NPC.position.Y + 30 * NPC.scale);
Vector2 restingPos = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float restingPlayerXDist = player.position.X + (player.width / 2) - restingPos.X;
float restingPlayerYDist = player.position.Y + (player.height / 2) - restingPos.Y;
float restingPlayerDistance = (float)Math.Sqrt(restingPlayerXDist * restingPlayerXDist + restingPlayerYDist * restingPlayerYDist);
NPC.ai[1] += 1f;
int num638 = 0;
for (int num639 = 0; num639 < 255; num639++)
int activePlayerAmt = 0;
for (int i = 0; i < 255; i++)
{
if (Main.player[num639].active && !Main.player[num639].dead && (vector - Main.player[num639].Center).Length() < 1000f)
num638++;
if (Main.player[i].active && !Main.player[i].dead && (vector - Main.player[i].Center).Length() < 1000f)
activePlayerAmt++;
}
NPC.ai[1] += num638 / 2;
NPC.ai[1] += activePlayerAmt / 2;
bool flag103 = false;
float num640 = 20f;
bool spawnedBubble = false;
float bubbleDelay = 20f;
if (!leviAlive || phase4)
num640 -= death ? 15f * (1f - lifeRatio) : 12f * (1f - lifeRatio);
bubbleDelay -= death ? 15f * (1f - lifeRatio) : 12f * (1f - lifeRatio);
if (NPC.ai[1] > num640)
if (NPC.ai[1] > bubbleDelay)
{
NPC.ai[1] = 0f;
NPC.ai[2] += 1f;
flag103 = true;
spawnedBubble = true;
}
if (Collision.CanHit(vector119, 1, 1, player.position, player.width, player.height) && flag103)
if (Collision.CanHit(bubbleSpawnPos, 1, 1, player.position, player.width, player.height) && spawnedBubble)
{
SoundEngine.PlaySound(SoundID.Item85, NPC.Center);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int spawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector119.X, (int)vector119.Y, NPCID.DetonatingBubble);
int spawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)bubbleSpawnPos.X, (int)bubbleSpawnPos.Y, NPCID.DetonatingBubble);
Main.npc[spawn].target = NPC.target;
Main.npc[spawn].velocity = player.Center - vector119;
Main.npc[spawn].velocity = player.Center - bubbleSpawnPos;
Main.npc[spawn].velocity.Normalize();
Main.npc[spawn].velocity *= bubbleVelocity;
Main.npc[spawn].netUpdate = true;
@@ -524,7 +524,7 @@ namespace CalamityMod.NPCs.Leviathan
}
}
if (num1060 > 600f * NPC.scale)
if (restingPlayerDistance > 600f * NPC.scale)
{
float maxVelocityY = death ? 3f : 4f;
float maxVelocityX = death ? 7f : 8f;
@@ -594,7 +594,7 @@ namespace CalamityMod.NPCs.Leviathan
if (Main.getGoodWorld)
velocity *= 1.15f;
Vector2 vector3 = Vector2.Normalize(targetVector - vector - NPC.velocity) * velocity;
Vector2 chargeSetupLocation = Vector2.Normalize(targetVector - vector - NPC.velocity) * velocity;
float acceleration = death ? 0.28f : 0.25f;
acceleration += 0.2f * enrageScale;
@@ -602,7 +602,7 @@ namespace CalamityMod.NPCs.Leviathan
acceleration *= 1.15f;
if (Math.Abs(NPC.Center.Y - targetVector.Y) > 50f * NPC.scale || Math.Abs(NPC.Center.X - player.Center.X) > 350f * NPC.scale)
NPC.SimpleFlyMovement(vector3, acceleration);
NPC.SimpleFlyMovement(chargeSetupLocation, acceleration);
NPC.ai[1] += 1f;
@@ -742,10 +742,10 @@ namespace CalamityMod.NPCs.Leviathan
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X);
// Direction
int num22 = Math.Sign(player.Center.X - vector.X);
if (num22 != 0)
int chargeDirection = Math.Sign(player.Center.X - vector.X);
if (chargeDirection != 0)
{
NPC.direction = num22;
NPC.direction = chargeDirection;
if (NPC.spriteDirection == 1)
NPC.rotation += MathHelper.Pi;
@@ -764,12 +764,12 @@ namespace CalamityMod.NPCs.Leviathan
if (CalamityWorld.LegendaryMode && CalamityWorld.revenge && NPC.ai[1] % 5f == 0f)
{
SoundEngine.PlaySound(SoundID.Item85, NPC.Center);
Vector2 vector119 = new Vector2(NPC.position.X + (NPC.width / 2) + (15 * NPC.direction * NPC.scale), NPC.position.Y + 30 * NPC.scale);
Vector2 bubbleSpawnPos = new Vector2(NPC.position.X + (NPC.width / 2) + (15 * NPC.direction * NPC.scale), NPC.position.Y + 30 * NPC.scale);
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int spawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector119.X, (int)vector119.Y, NPCID.DetonatingBubble);
int spawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)bubbleSpawnPos.X, (int)bubbleSpawnPos.Y, NPCID.DetonatingBubble);
Main.npc[spawn].target = NPC.target;
Main.npc[spawn].velocity = player.Center - vector119;
Main.npc[spawn].velocity = player.Center - bubbleSpawnPos;
Main.npc[spawn].velocity.Normalize();
Main.npc[spawn].velocity *= bubbleVelocity;
Main.npc[spawn].netUpdate = true;
@@ -778,16 +778,16 @@ namespace CalamityMod.NPCs.Leviathan
}
// Spawn dust
int num24 = 7;
for (int j = 0; j < num24; j++)
int dustAmt = 7;
for (int j = 0; j < dustAmt; j++)
{
Vector2 arg_E1C_0 = (Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * MathHelper.Pi / num24) + vector;
Vector2 arg_E1C_0 = (Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f).RotatedBy((j - (dustAmt / 2 - 1)) * MathHelper.Pi / dustAmt) + vector;
Vector2 vector4 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8);
int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f);
Main.dust[num25].noGravity = true;
Main.dust[num25].noLight = true;
Main.dust[num25].velocity /= 4f;
Main.dust[num25].velocity -= NPC.velocity;
int waterDust = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f);
Main.dust[waterDust].noGravity = true;
Main.dust[waterDust].noLight = true;
Main.dust[waterDust].velocity /= 4f;
Main.dust[waterDust].velocity -= NPC.velocity;
}
NPC.ai[1] += 1f;
@@ -804,20 +804,20 @@ namespace CalamityMod.NPCs.Leviathan
// Rotation when charging
private void ChargeRotation(Player player, Vector2 vector)
{
float num17 = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X);
float playerDirection = (float)Math.Atan2(player.Center.Y - vector.Y, player.Center.X - vector.X);
if (NPC.spriteDirection == 1)
num17 += MathHelper.Pi;
if (num17 < 0f)
num17 += MathHelper.TwoPi;
if (num17 > MathHelper.TwoPi)
num17 -= MathHelper.TwoPi;
playerDirection += MathHelper.Pi;
if (playerDirection < 0f)
playerDirection += MathHelper.TwoPi;
if (playerDirection > MathHelper.TwoPi)
playerDirection -= MathHelper.TwoPi;
float num18 = 0.04f;
float rotationSpeed = 0.04f;
if (NPC.ai[0] == 4f)
num18 = 0f;
rotationSpeed = 0f;
if (num18 != 0f)
NPC.rotation = NPC.rotation.AngleTowards(num17, num18);
if (rotationSpeed != 0f)
NPC.rotation = NPC.rotation.AngleTowards(playerDirection, rotationSpeed);
}
// Move to charge location
@@ -829,21 +829,21 @@ namespace CalamityMod.NPCs.Leviathan
if (NPC.localAI[0] == 0f)
NPC.localAI[0] = (int)distance * Math.Sign((vector - player.Center).X);
Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(NPC.localAI[0], -distance) - vector - NPC.velocity) * 12f;
Vector2 chargeSetupLocation = Vector2.Normalize(player.Center + new Vector2(NPC.localAI[0], -distance) - vector - NPC.velocity) * 12f;
float acceleration = revenge ? 0.75f : 0.5f;
if (Main.getGoodWorld)
acceleration *= 1.15f;
NPC.SimpleFlyMovement(vector3, acceleration);
NPC.SimpleFlyMovement(chargeSetupLocation, acceleration);
// Rotation
int num22 = Math.Sign(player.Center.X - vector.X);
if (num22 != 0)
int chargeDirection = Math.Sign(player.Center.X - vector.X);
if (chargeDirection != 0)
{
if (NPC.ai[1] == 0f && num22 != NPC.direction)
if (NPC.ai[1] == 0f && chargeDirection != NPC.direction)
NPC.rotation += MathHelper.Pi;
NPC.direction = num22;
NPC.direction = chargeDirection;
if (NPC.spriteDirection != -NPC.direction)
NPC.rotation += MathHelper.Pi;
+9 -9
View File
@@ -56,28 +56,28 @@ namespace CalamityMod.NPCs.Leviathan
public override void AI()
{
int num989 = (int)NPC.ai[0];
if (Main.npc[num989].active && Main.npc[num989].type == ModContent.NPCType<Anahita>())
int anahitaID = (int)NPC.ai[0];
if (Main.npc[anahitaID].active && Main.npc[anahitaID].type == ModContent.NPCType<Anahita>())
{
if (NPC.alpha > 100 && NPC.ai[1] == 0f)
NPC.alpha -= 2;
if (Main.npc[num989].damage == 0)
if (Main.npc[anahitaID].damage == 0)
NPC.ai[1] = 1f;
else
NPC.ai[1] = 0f;
if (NPC.ai[1] == 1f)
NPC.alpha = Main.npc[num989].alpha;
NPC.alpha = Main.npc[anahitaID].alpha;
NPC.dontTakeDamage = Main.npc[num989].damage == 0;
NPC.rotation = Main.npc[num989].rotation;
NPC.spriteDirection = Main.npc[num989].direction;
NPC.dontTakeDamage = Main.npc[anahitaID].damage == 0;
NPC.rotation = Main.npc[anahitaID].rotation;
NPC.spriteDirection = Main.npc[anahitaID].direction;
NPC.velocity = Vector2.Zero;
NPC.position = Main.npc[num989].Center;
NPC.position = Main.npc[anahitaID].Center;
NPC.position.X = NPC.position.X - (NPC.width / 2) + ((NPC.spriteDirection == 1) ? -20f : 20f) * NPC.scale;
NPC.position.Y = NPC.position.Y - (NPC.height / 2) - (int)(30 * NPC.scale);
NPC.gfxOffY = Main.npc[num989].gfxOffY;
NPC.gfxOffY = Main.npc[anahitaID].gfxOffY;
Lighting.AddLight((int)NPC.Center.X / 16, (int)NPC.Center.Y / 16, 0f, 0.8f, 1.1f);
return;
}
+24 -26
View File
@@ -123,32 +123,30 @@ namespace CalamityMod.NPCs.Leviathan
if (!sirenAlive || leviathanInPhase4)
inertia *= 0.75f;
float num1006 = 0.111111117f * inertia;
if (NPC.ai[0] == 0f)
{
float scaleFactor6 = bossRush ? 14f : death ? 12f : revenge ? 11f : expertMode ? 10f : 8f;
float lungeSpeed = bossRush ? 14f : death ? 12f : revenge ? 11f : expertMode ? 10f : 8f;
if (!sirenAlive || leviathanInPhase4)
scaleFactor6 *= 1.25f;
lungeSpeed *= 1.25f;
Vector2 center4 = NPC.Center;
Vector2 center5 = Main.player[NPC.target].Center;
Vector2 vector126 = center5 - center4;
Vector2 vector127 = vector126 - Vector2.UnitY * 300f * NPC.scale;
float num1013 = vector126.Length();
vector126 = Vector2.Normalize(vector126) * scaleFactor6;
vector127 = Vector2.Normalize(vector127) * scaleFactor6;
bool flag64 = Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1);
Vector2 npcCenter = NPC.Center;
Vector2 targetCenter = Main.player[NPC.target].Center;
Vector2 targetDirection = targetCenter - npcCenter;
Vector2 beginLungeYDist = targetDirection - Vector2.UnitY * 300f * NPC.scale;
float targetDist = targetDirection.Length();
targetDirection = Vector2.Normalize(targetDirection) * lungeSpeed;
beginLungeYDist = Vector2.Normalize(beginLungeYDist) * lungeSpeed;
bool canHitPlayer = Collision.CanHit(NPC.Center, 1, 1, Main.player[NPC.target].Center, 1, 1);
if (NPC.ai[3] >= 120f)
{
flag64 = true;
canHitPlayer = true;
}
float num1014 = 8f;
flag64 = flag64 && vector126.ToRotation() > MathHelper.Pi / num1014 && vector126.ToRotation() < MathHelper.Pi - MathHelper.Pi / num1014;
if (num1013 > 800f * NPC.scale || !flag64)
canHitPlayer = canHitPlayer && targetDirection.ToRotation() > MathHelper.Pi / 8f && targetDirection.ToRotation() < MathHelper.Pi - MathHelper.Pi / 8f;
if (targetDist > 800f * NPC.scale || !canHitPlayer)
{
NPC.velocity.X = (NPC.velocity.X * (inertia - 1f) + vector127.X) / inertia;
NPC.velocity.Y = (NPC.velocity.Y * (inertia - 1f) + vector127.Y) / inertia;
if (!flag64)
NPC.velocity.X = (NPC.velocity.X * (inertia - 1f) + beginLungeYDist.X) / inertia;
NPC.velocity.Y = (NPC.velocity.Y * (inertia - 1f) + beginLungeYDist.Y) / inertia;
if (!canHitPlayer)
{
NPC.ai[3] += 1f;
if (NPC.ai[3] == 120f)
@@ -164,8 +162,8 @@ namespace CalamityMod.NPCs.Leviathan
else
{
NPC.ai[0] = 1f;
NPC.ai[2] = vector126.X;
NPC.ai[3] = vector126.Y;
NPC.ai[2] = targetDirection.X;
NPC.ai[3] = targetDirection.Y;
NPC.netUpdate = true;
}
}
@@ -187,8 +185,8 @@ namespace CalamityMod.NPCs.Leviathan
else if (NPC.ai[0] == 2f)
{
NPC.ai[1] += 1f;
bool flag65 = NPC.Center.Y + 50f > Main.player[NPC.target].Center.Y;
if ((NPC.ai[1] >= 90f && flag65) || NPC.velocity.Length() < ((!sirenAlive || leviathanInPhase4) ? 10f : 8f))
bool doLunge = NPC.Center.Y + 50f > Main.player[NPC.target].Center.Y;
if ((NPC.ai[1] >= 90f && doLunge) || NPC.velocity.Length() < ((!sirenAlive || leviathanInPhase4) ? 10f : 8f))
{
NPC.ai[0] = 3f;
NPC.ai[1] = 45f;
@@ -199,15 +197,15 @@ namespace CalamityMod.NPCs.Leviathan
}
else
{
Vector2 center6 = NPC.Center;
Vector2 center7 = Main.player[NPC.target].Center;
Vector2 vec2 = center7 - center6;
Vector2 npcCenterAgain = NPC.Center;
Vector2 targetCenterAgain = Main.player[NPC.target].Center;
Vector2 vec2 = targetCenterAgain - npcCenterAgain;
vec2.Normalize();
if (vec2.HasNaNs())
{
vec2 = new Vector2((float)NPC.direction, 0f);
}
NPC.velocity = (NPC.velocity * (inertia - 1f) + vec2 * (NPC.velocity.Length() + num1006)) / inertia;
NPC.velocity = (NPC.velocity * (inertia - 1f) + vec2 * (NPC.velocity.Length() + (0.111111117f * inertia))) / inertia;
}
}
else if (NPC.ai[0] == 3f)
+162 -162
View File
@@ -131,7 +131,7 @@ namespace CalamityMod.NPCs.Leviathan
bool death = CalamityWorld.death || bossRush;
bool revenge = CalamityWorld.revenge || bossRush;
bool expertMode = Main.expertMode || bossRush;
Vector2 vector = NPC.Center;
Vector2 npcCenter = NPC.Center;
// Is in spawning animation
float spawnAnimationTime = 180f;
@@ -187,14 +187,14 @@ namespace CalamityMod.NPCs.Leviathan
extrapitch = Main.zenithWorld ? 0.3f : 0f;
if (Main.rand.NextBool(600) && !spawnAnimation)
SoundEngine.PlaySound(((sirenAlive && !death) ? soundChoice : soundChoiceRage) with { Pitch = soundChoice.Pitch + extrapitch }, vector);
SoundEngine.PlaySound(((sirenAlive && !death) ? soundChoice : soundChoiceRage) with { Pitch = soundChoice.Pitch + extrapitch }, npcCenter);
// Get a target
if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active)
NPC.TargetClosest();
// Despawn safety, make sure to target another player if the current player target is too far away
if (Vector2.Distance(Main.player[NPC.target].Center, vector) > CalamityGlobalNPC.CatchUpDistance200Tiles)
if (Vector2.Distance(Main.player[NPC.target].Center, npcCenter) > CalamityGlobalNPC.CatchUpDistance200Tiles)
NPC.TargetClosest();
Player player = Main.player[NPC.target];
@@ -233,11 +233,11 @@ namespace CalamityMod.NPCs.Leviathan
NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs;
NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs;
if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f)
if (!player.active || player.dead || Vector2.Distance(player.Center, npcCenter) > 5600f)
{
NPC.TargetClosest(false);
player = Main.player[NPC.target];
if (!player.active || player.dead || Vector2.Distance(player.Center, vector) > 5600f)
if (!player.active || player.dead || Vector2.Distance(player.Center, npcCenter) > 5600f)
{
if (NPC.velocity.Y < -3f)
NPC.velocity.Y = -3f;
@@ -284,8 +284,8 @@ namespace CalamityMod.NPCs.Leviathan
if (calamityGlobalNPC.newAI[3] == 10f)
{
SoundEngine.PlaySound(EmergeSound, vector);
SoundEngine.PlaySound(soundChoiceRage with { Pitch = soundChoiceRage.Pitch + extrapitch }, vector);
SoundEngine.PlaySound(EmergeSound, npcCenter);
SoundEngine.PlaySound(soundChoiceRage with { Pitch = soundChoiceRage.Pitch + extrapitch }, npcCenter);
}
NPC.Opacity = MathHelper.Clamp(calamityGlobalNPC.newAI[3] / spawnAnimationTime, 0f, 1f);
@@ -297,62 +297,62 @@ namespace CalamityMod.NPCs.Leviathan
if (NPC.ai[0] == 0f)
{
float num412 = (sirenAlive && !phase4) ? 3.5f : 7f;
float num413 = (sirenAlive && !phase4) ? 0.1f : 0.2f;
num412 += 2f * enrageScale;
num413 += 0.05f * enrageScale;
float hoverSpeed = (sirenAlive && !phase4) ? 3.5f : 7f;
float hoverAcceleration = (sirenAlive && !phase4) ? 0.1f : 0.2f;
hoverSpeed += 2f * enrageScale;
hoverAcceleration += 0.05f * enrageScale;
if (expertMode && (!sirenAlive || phase4))
{
num412 += death ? 6f * (1f - lifeRatio) : 3.5f * (1f - lifeRatio);
num413 += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio);
hoverSpeed += death ? 6f * (1f - lifeRatio) : 3.5f * (1f - lifeRatio);
hoverAcceleration += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio);
}
if (Main.getGoodWorld)
{
num412 *= 1.15f;
num413 *= 1.15f;
hoverSpeed *= 1.15f;
hoverAcceleration *= 1.15f;
}
int num414 = 1;
if (vector.X < player.position.X + player.width)
num414 = -1;
int posXSign = 1;
if (npcCenter.X < player.position.X + player.width)
posXSign = -1;
Vector2 vector40 = vector;
float num415 = player.Center.X + (num414 * ((sirenAlive && !phase4) ? 1000f : 800f) * NPC.scale) - vector40.X;
float num416 = player.Center.Y - vector40.Y;
float num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416);
num417 = num412 / num417;
num415 *= num417;
num416 *= num417;
Vector2 leviCenter = npcCenter;
float xDestination = player.Center.X + (posXSign * ((sirenAlive && !phase4) ? 1000f : 800f) * NPC.scale) - leviCenter.X;
float yDestination = player.Center.Y - leviCenter.Y;
float destinationDist = (float)Math.Sqrt(xDestination * xDestination + yDestination * yDestination);
destinationDist = hoverSpeed / destinationDist;
xDestination *= destinationDist;
yDestination *= destinationDist;
if (NPC.velocity.X < num415)
if (NPC.velocity.X < xDestination)
{
NPC.velocity.X += num413;
if (NPC.velocity.X < 0f && num415 > 0f)
NPC.velocity.X += num413;
NPC.velocity.X += hoverAcceleration;
if (NPC.velocity.X < 0f && xDestination > 0f)
NPC.velocity.X += hoverAcceleration;
}
else if (NPC.velocity.X > num415)
else if (NPC.velocity.X > xDestination)
{
NPC.velocity.X -= num413;
if (NPC.velocity.X > 0f && num415 < 0f)
NPC.velocity.X -= num413;
NPC.velocity.X -= hoverAcceleration;
if (NPC.velocity.X > 0f && xDestination < 0f)
NPC.velocity.X -= hoverAcceleration;
}
if (NPC.velocity.Y < num416)
if (NPC.velocity.Y < yDestination)
{
NPC.velocity.Y += num413;
if (NPC.velocity.Y < 0f && num416 > 0f)
NPC.velocity.Y += num413;
NPC.velocity.Y += hoverAcceleration;
if (NPC.velocity.Y < 0f && yDestination > 0f)
NPC.velocity.Y += hoverAcceleration;
}
else if (NPC.velocity.Y > num416)
else if (NPC.velocity.Y > yDestination)
{
NPC.velocity.Y -= num413;
if (NPC.velocity.Y > 0f && num416 < 0f)
NPC.velocity.Y -= num413;
NPC.velocity.Y -= hoverAcceleration;
if (NPC.velocity.Y > 0f && yDestination < 0f)
NPC.velocity.Y -= hoverAcceleration;
}
float playerLocation = vector.X - player.Center.X;
float playerLocation = npcCenter.X - player.Center.X;
NPC.direction = playerLocation < 0 ? 1 : -1;
NPC.spriteDirection = NPC.direction;
@@ -381,9 +381,9 @@ namespace CalamityMod.NPCs.Leviathan
if (NPC.ai[2] >= 75f)
{
NPC.ai[2] = 0f;
vector40 = new Vector2(vector.X, vector.Y + 20f);
num415 = vector40.X + 1000f * NPC.direction - vector40.X;
num416 = player.Center.Y - vector40.Y;
leviCenter = new Vector2(npcCenter.X, npcCenter.Y + 20f);
xDestination = leviCenter.X + 1000f * NPC.direction - leviCenter.X;
yDestination = player.Center.Y - leviCenter.Y;
if (Main.netMode != NetmodeID.MultiplayerClient)
{
@@ -399,28 +399,28 @@ namespace CalamityMod.NPCs.Leviathan
if (!sirenAlive || phase4)
speed += 3f * (1f - lifeRatio);
num417 = (float)Math.Sqrt(num415 * num415 + num416 * num416);
num417 = speed / num417;
num415 *= num417;
num416 *= num417;
vector40.X += num415 * 4f;
vector40.Y += num416 * 4f;
destinationDist = (float)Math.Sqrt(xDestination * xDestination + yDestination * yDestination);
destinationDist = speed / destinationDist;
xDestination *= destinationDist;
yDestination *= destinationDist;
leviCenter.X += xDestination * 4f;
leviCenter.Y += yDestination * 4f;
if (Main.zenithWorld)
{
type = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? ProjectileID.BouncyBoulder : ProjectileID.Boulder;
vector40.Y -= 5; //Shoot a bit more up since boulders are affected by gravity
leviCenter.Y -= 5; //Shoot a bit more up since boulders are affected by gravity
damage *= 2;
}
int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), vector40.X, vector40.Y, num415, num416, type, damage, 0f, Main.myPlayer);
int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), leviCenter.X, leviCenter.Y, xDestination, yDestination, type, damage, 0f, Main.myPlayer);
if (Main.zenithWorld)
Main.projectile[proj].scale *= 5f;
if (soundDelay <= 0)
{
soundDelay = 120;
SoundEngine.PlaySound(RoarMeteorSound with { Pitch = RoarMeteorSound.Pitch + extrapitch }, vector);
SoundEngine.PlaySound(RoarMeteorSound with { Pitch = RoarMeteorSound.Pitch + extrapitch }, npcCenter);
}
}
}
@@ -428,79 +428,79 @@ namespace CalamityMod.NPCs.Leviathan
}
else if (NPC.ai[0] == 1f)
{
Vector2 vector119 = new Vector2(vector.X, NPC.position.Y + NPC.height * 0.8f);
Vector2 vector120 = vector;
float num1058 = player.Center.X - vector120.X;
float num1059 = player.Center.Y - vector120.Y;
float num1060 = (float)Math.Sqrt(num1058 * num1058 + num1059 * num1059);
Vector2 aberrationSpawn = new Vector2(npcCenter.X, NPC.position.Y + NPC.height * 0.8f);
Vector2 leviCenterAberration = npcCenter;
float playerXDist = player.Center.X - leviCenterAberration.X;
float playerYDist = player.Center.Y - leviCenterAberration.Y;
float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist);
NPC.ai[1] += 1f;
int num638 = 0;
for (int num639 = 0; num639 < Main.maxPlayers; num639++)
int activePlayerAmt = 0;
for (int i = 0; i < Main.maxPlayers; i++)
{
if (Main.player[num639].active && !Main.player[num639].dead && (vector - Main.player[num639].Center).Length() < 1000f)
num638++;
if (Main.player[i].active && !Main.player[i].dead && (npcCenter - Main.player[i].Center).Length() < 1000f)
activePlayerAmt++;
}
NPC.ai[1] += num638 / 2;
NPC.ai[1] += activePlayerAmt / 2;
bool flag103 = false;
float num640 = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 20f : (!sirenAlive || phase4) ? 60f : 40f;
if (NPC.ai[1] > num640)
bool spawnedAberration = false;
float aberrationSpawnDelay = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 20f : (!sirenAlive || phase4) ? 60f : 40f;
if (NPC.ai[1] > aberrationSpawnDelay)
{
NPC.ai[1] = 0f;
NPC.ai[2] += 1f;
flag103 = true;
spawnedAberration = true;
}
int spawnLimit = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10 : (sirenAlive && !phase4) ? 1 : (death ? 2 : 3);
if (flag103 && NPC.CountNPCS(ModContent.NPCType<AquaticAberration>()) < spawnLimit)
if (spawnedAberration && NPC.CountNPCS(ModContent.NPCType<AquaticAberration>()) < spawnLimit)
{
SoundEngine.PlaySound(soundChoice with { Pitch = soundChoice.Pitch + extrapitch }, vector);
SoundEngine.PlaySound(soundChoice with { Pitch = soundChoice.Pitch + extrapitch }, npcCenter);
if (Main.netMode != NetmodeID.MultiplayerClient)
NPC.NewNPC(NPC.GetSource_FromAI(), (int)vector119.X, (int)vector119.Y, ModContent.NPCType<AquaticAberration>());
NPC.NewNPC(NPC.GetSource_FromAI(), (int)aberrationSpawn.X, (int)aberrationSpawn.Y, ModContent.NPCType<AquaticAberration>());
}
if (num1060 > ((sirenAlive && !phase4) ? 1000f : 800f) * NPC.scale)
if (playerDistance > ((sirenAlive && !phase4) ? 1000f : 800f) * NPC.scale)
{
float num1064 = (sirenAlive && !phase4) ? 0.05f : 0.065f;
num1064 += 0.04f * enrageScale;
float aberrationAccel = (sirenAlive && !phase4) ? 0.05f : 0.065f;
aberrationAccel += 0.04f * enrageScale;
if (expertMode && (!sirenAlive || phase4))
num1064 += death ? 0.05f * (1f - lifeRatio) : 0.03f * (1f - lifeRatio);
aberrationAccel += death ? 0.05f * (1f - lifeRatio) : 0.03f * (1f - lifeRatio);
vector120 = vector119;
num1058 = player.Center.X - vector120.X;
num1059 = player.Center.Y - vector120.Y;
leviCenterAberration = aberrationSpawn;
playerXDist = player.Center.X - leviCenterAberration.X;
playerYDist = player.Center.Y - leviCenterAberration.Y;
if (NPC.velocity.X < num1058)
if (NPC.velocity.X < playerXDist)
{
NPC.velocity.X += num1064;
if (NPC.velocity.X < 0f && num1058 > 0f)
NPC.velocity.X += num1064;
NPC.velocity.X += aberrationAccel;
if (NPC.velocity.X < 0f && playerXDist > 0f)
NPC.velocity.X += aberrationAccel;
}
else if (NPC.velocity.X > num1058)
else if (NPC.velocity.X > playerXDist)
{
NPC.velocity.X -= num1064;
if (NPC.velocity.X > 0f && num1058 < 0f)
NPC.velocity.X -= num1064;
NPC.velocity.X -= aberrationAccel;
if (NPC.velocity.X > 0f && playerXDist < 0f)
NPC.velocity.X -= aberrationAccel;
}
if (NPC.velocity.Y < num1059)
if (NPC.velocity.Y < playerYDist)
{
NPC.velocity.Y += num1064;
if (NPC.velocity.Y < 0f && num1059 > 0f)
NPC.velocity.Y += num1064;
NPC.velocity.Y += aberrationAccel;
if (NPC.velocity.Y < 0f && playerYDist > 0f)
NPC.velocity.Y += aberrationAccel;
}
else if (NPC.velocity.Y > num1059)
else if (NPC.velocity.Y > playerYDist)
{
NPC.velocity.Y -= num1064;
if (NPC.velocity.Y > 0f && num1059 < 0f)
NPC.velocity.Y -= num1064;
NPC.velocity.Y -= aberrationAccel;
if (NPC.velocity.Y > 0f && playerYDist < 0f)
NPC.velocity.Y -= aberrationAccel;
}
}
else
NPC.velocity *= 0.9f;
float playerLocation = vector.X - player.Center.X;
float playerLocation = npcCenter.X - player.Center.X;
NPC.direction = playerLocation < 0 ? 1 : -1;
NPC.spriteDirection = NPC.direction;
@@ -515,7 +515,7 @@ namespace CalamityMod.NPCs.Leviathan
}
else if (NPC.ai[0] == 2f)
{
Vector2 distFromPlayer = player.Center - vector;
Vector2 distFromPlayer = player.Center - npcCenter;
float chargeAmt = death ? (phase4 ? 3f : phase3 ? 2f : 1f) : 1f;
if (NPC.ai[1] >= chargeAmt * 2f || distFromPlayer.Length() > 2400f)
{
@@ -535,16 +535,16 @@ namespace CalamityMod.NPCs.Leviathan
if (NPC.ai[1] % 2f == 0f)
{
int num24 = 7;
for (int j = 0; j < num24; j++)
int dustAmt = 7;
for (int j = 0; j < dustAmt; j++)
{
Vector2 arg_E1C_0 = (Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f).RotatedBy((j - (num24 / 2 - 1)) * MathHelper.Pi / num24) + vector;
Vector2 vector4 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8);
int num25 = Dust.NewDust(arg_E1C_0 + vector4, 0, 0, 172, vector4.X * 2f, vector4.Y * 2f, 100, default, 1.4f);
Main.dust[num25].noGravity = true;
Main.dust[num25].noLight = true;
Main.dust[num25].velocity /= 4f;
Main.dust[num25].velocity -= NPC.velocity;
Vector2 arg_E1C_0 = (Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f).RotatedBy((j - (dustAmt / 2 - 1)) * MathHelper.Pi / dustAmt) + npcCenter;
Vector2 dustRotation = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8);
int waterDust = Dust.NewDust(arg_E1C_0 + dustRotation, 0, 0, 172, dustRotation.X * 2f, dustRotation.Y * 2f, 100, default, 1.4f);
Main.dust[waterDust].noGravity = true;
Main.dust[waterDust].noLight = true;
Main.dust[waterDust].velocity /= 4f;
Main.dust[waterDust].velocity -= NPC.velocity;
}
if (Math.Abs(NPC.position.Y + (NPC.height / 2) - (player.position.Y + (player.height / 2))) < 20f)
@@ -552,72 +552,72 @@ namespace CalamityMod.NPCs.Leviathan
NPC.ai[1] += 1f;
NPC.ai[2] = 0f;
float num1044 = revenge ? 20f : 18f;
num1044 += 2f * enrageScale;
float lineupSpeed = revenge ? 20f : 18f;
lineupSpeed += 2f * enrageScale;
if (revenge && (!sirenAlive || phase4))
num1044 += death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio);
lineupSpeed += death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio);
if (Main.getGoodWorld)
num1044 *= 1.15f;
lineupSpeed *= 1.15f;
Vector2 vector117 = vector;
float num1045 = player.Center.X - vector117.X;
float num1046 = player.Center.Y - vector117.Y;
float num1047 = (float)Math.Sqrt(num1045 * num1045 + num1046 * num1046);
num1047 = num1044 / num1047;
NPC.velocity.X = num1045 * num1047;
NPC.velocity.Y = num1046 * num1047;
Vector2 leviChargeCenter = npcCenter;
float playerXDistCharge = player.Center.X - leviChargeCenter.X;
float playerYDistCharge = player.Center.Y - leviChargeCenter.Y;
float playerDistanceCharge = (float)Math.Sqrt(playerXDistCharge * playerXDistCharge + playerYDistCharge * playerYDistCharge);
playerDistanceCharge = lineupSpeed / playerDistanceCharge;
NPC.velocity.X = playerXDistCharge * playerDistanceCharge;
NPC.velocity.Y = playerYDistCharge * playerDistanceCharge;
float playerLocation = vector.X - player.Center.X;
float playerLocation = npcCenter.X - player.Center.X;
NPC.direction = playerLocation < 0 ? 1 : -1;
NPC.spriteDirection = NPC.direction;
SoundEngine.PlaySound(RoarChargeSound with { Pitch = RoarChargeSound.Pitch + extrapitch }, vector);
SoundEngine.PlaySound(RoarChargeSound with { Pitch = RoarChargeSound.Pitch + extrapitch }, npcCenter);
return;
}
float num1048 = revenge ? 7.5f : 6.5f;
float num1049 = revenge ? 0.12f : 0.11f;
num1048 += 2f * enrageScale;
num1049 += 0.04f * enrageScale;
float chargeSpeed = revenge ? 7.5f : 6.5f;
float chargeAcceleration = revenge ? 0.12f : 0.11f;
chargeSpeed += 2f * enrageScale;
chargeAcceleration += 0.04f * enrageScale;
if (revenge && (!sirenAlive || phase4))
{
num1048 += death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio);
num1049 += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio);
chargeSpeed += death ? 9f * (1f - lifeRatio) : 6f * (1f - lifeRatio);
chargeAcceleration += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio);
}
if (Main.getGoodWorld)
{
num1048 *= 1.15f;
num1049 *= 1.15f;
chargeSpeed *= 1.15f;
chargeAcceleration *= 1.15f;
}
if (vector.Y < player.Center.Y)
NPC.velocity.Y += num1049;
if (npcCenter.Y < player.Center.Y)
NPC.velocity.Y += chargeAcceleration;
else
NPC.velocity.Y -= num1049;
NPC.velocity.Y -= chargeAcceleration;
if (NPC.velocity.Y < -num1048)
NPC.velocity.Y = -num1048;
if (NPC.velocity.Y > num1048)
NPC.velocity.Y = num1048;
if (NPC.velocity.Y < -chargeSpeed)
NPC.velocity.Y = -chargeSpeed;
if (NPC.velocity.Y > chargeSpeed)
NPC.velocity.Y = chargeSpeed;
if (Math.Abs(vector.X - player.Center.X) > chargeDistance + 200f)
NPC.velocity.X += num1049 * NPC.direction;
else if (Math.Abs(vector.X - player.Center.X) < chargeDistance)
NPC.velocity.X -= num1049 * NPC.direction;
if (Math.Abs(npcCenter.X - player.Center.X) > chargeDistance + 200f)
NPC.velocity.X += chargeAcceleration * NPC.direction;
else if (Math.Abs(npcCenter.X - player.Center.X) < chargeDistance)
NPC.velocity.X -= chargeAcceleration * NPC.direction;
else
NPC.velocity.X *= 0.8f;
if (NPC.velocity.X < -num1048)
NPC.velocity.X = -num1048;
if (NPC.velocity.X > num1048)
NPC.velocity.X = num1048;
if (NPC.velocity.X < -chargeSpeed)
NPC.velocity.X = -chargeSpeed;
if (NPC.velocity.X > chargeSpeed)
NPC.velocity.X = chargeSpeed;
float playerLocation2 = vector.X - player.Center.X;
float playerLocation2 = npcCenter.X - player.Center.X;
NPC.direction = playerLocation2 < 0 ? 1 : -1;
NPC.spriteDirection = NPC.direction;
}
@@ -630,30 +630,30 @@ namespace CalamityMod.NPCs.Leviathan
NPC.spriteDirection = NPC.direction;
int num1051 = 1;
if (vector.X < player.Center.X)
num1051 = -1;
if (NPC.direction == num1051 && Math.Abs(vector.X - player.Center.X) > chargeDistance)
int chargeXDirectSign = 1;
if (npcCenter.X < player.Center.X)
chargeXDirectSign = -1;
if (NPC.direction == chargeXDirectSign && Math.Abs(npcCenter.X - player.Center.X) > chargeDistance)
NPC.ai[2] = 1f;
if (NPC.ai[2] != 1f)
return;
float playerLocation = vector.X - player.Center.X;
float playerLocation = npcCenter.X - player.Center.X;
NPC.direction = playerLocation < 0 ? 1 : -1;
NPC.spriteDirection = NPC.direction;
NPC.velocity *= 0.9f;
float num1052 = revenge ? 0.11f : 0.1f;
num1052 += 0.02f * enrageScale;
float chargeStopSpeed = revenge ? 0.11f : 0.1f;
chargeStopSpeed += 0.02f * enrageScale;
if (revenge && (!sirenAlive || phase4))
{
NPC.velocity *= death ? MathHelper.Lerp(0.75f, 1f, lifeRatio) : MathHelper.Lerp(0.81f, 1f, lifeRatio);
num1052 += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio);
chargeStopSpeed += death ? 0.15f * (1f - lifeRatio) : 0.1f * (1f - lifeRatio);
}
if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < num1052)
if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < chargeStopSpeed)
{
NPC.ai[2] = 0f;
NPC.ai[1] += 1f;
@@ -743,23 +743,23 @@ namespace CalamityMod.NPCs.Leviathan
NPC.position.Y = NPC.position.Y + (NPC.height / 2);
NPC.position.X = NPC.position.X - (NPC.width / 2);
NPC.position.Y = NPC.position.Y - (NPC.height / 2);
for (int num621 = 0; num621 < 40; num621++)
for (int i = 0; i < 40; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int bloody = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f);
Main.dust[bloody].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[bloody].scale = 0.5f;
Main.dust[bloody].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 70; num623++)
for (int j = 0; j < 70; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int bloody2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f);
Main.dust[bloody2].noGravity = true;
Main.dust[bloody2].velocity *= 5f;
bloody2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f);
Main.dust[bloody2].velocity *= 2f;
}
if (Main.netMode != NetmodeID.Server)
{
+111 -113
View File
@@ -136,13 +136,13 @@ namespace CalamityMod.NPCs.OldDuke
bool tired = NPC.Calamity().newAI[1] == 1f;
if (NPC.ai[0] == 0f || NPC.ai[0] == 5f || NPC.ai[0] == 10f || NPC.ai[0] == 12f)
{
int num114 = tired ? 14 : 7;
int frameChangeFrequency = tired ? 14 : 7;
if (NPC.ai[0] == 5f || NPC.ai[0] == 12f)
{
num114 = tired ? 12 : 6;
frameChangeFrequency = tired ? 12 : 6;
}
NPC.frameCounter += 1D;
if (NPC.frameCounter > num114)
if (NPC.frameCounter > frameChangeFrequency)
{
NPC.frameCounter = 0D;
NPC.frame.Y += frameHeight;
@@ -162,8 +162,8 @@ namespace CalamityMod.NPCs.OldDuke
}
if (NPC.ai[0] == 3f || NPC.ai[0] == 8f || NPC.ai[0] == 13f || NPC.ai[0] == -1f)
{
int num115 = 120;
if (NPC.ai[2] < (num115 - 50) || NPC.ai[2] > (num115 - 10))
int frameChangeGateValue = 120;
if (NPC.ai[2] < (frameChangeGateValue - 50) || NPC.ai[2] > (frameChangeGateValue - 10))
{
NPC.frameCounter += 1D;
if (NPC.frameCounter > 7D)
@@ -179,7 +179,7 @@ namespace CalamityMod.NPCs.OldDuke
else
{
NPC.frame.Y = frameHeight * 5;
if (NPC.ai[2] > (num115 - 40) && NPC.ai[2] < (num115 - 15))
if (NPC.ai[2] > (frameChangeGateValue - 40) && NPC.ai[2] < (frameChangeGateValue - 15))
{
NPC.frame.Y = frameHeight * 6;
}
@@ -187,8 +187,8 @@ namespace CalamityMod.NPCs.OldDuke
}
if (NPC.ai[0] == 4f || NPC.ai[0] == 9f)
{
int num116 = 180;
if (NPC.ai[2] < (num116 - 60) || NPC.ai[2] > (num116 - 20))
int secondFrameChangeGateValue = 180;
if (NPC.ai[2] < (secondFrameChangeGateValue - 60) || NPC.ai[2] > (secondFrameChangeGateValue - 20))
{
NPC.frameCounter += 1D;
if (NPC.frameCounter > 7D)
@@ -204,7 +204,7 @@ namespace CalamityMod.NPCs.OldDuke
else
{
NPC.frame.Y = frameHeight * 5;
if (NPC.ai[2] > (num116 - 50) && NPC.ai[2] < (num116 - 25))
if (NPC.ai[2] > (secondFrameChangeGateValue - 50) && NPC.ai[2] < (secondFrameChangeGateValue - 25))
{
NPC.frame.Y = frameHeight * 6;
}
@@ -220,43 +220,43 @@ namespace CalamityMod.NPCs.OldDuke
spriteEffects = SpriteEffects.FlipHorizontally;
}
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2(texture2D15.Width / 2, texture2D15.Height / Main.npcFrameCount[NPC.type] / 2);
Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2, texture2D15.Height / Main.npcFrameCount[NPC.type] / 2);
Color color = drawColor;
Color color36 = Color.White;
float amount9 = 0f;
bool flag8 = NPC.ai[0] > 4f;
bool flag9 = NPC.ai[0] > 9f && NPC.ai[0] <= 12f;
int num150 = 120;
int num151 = 60;
if (flag9)
Color drawLerpColor = Color.White;
float drawLerpValue = 0f;
bool halfTiredBuffColor = NPC.ai[0] > 4f;
bool tiredBuffColor = NPC.ai[0] > 9f && NPC.ai[0] <= 12f;
int ai2Compare = 120;
int buffColorDivisor = 60;
if (tiredBuffColor)
{
color = CalamityGlobalNPC.buffColor(color, 0.4f, 0.8f, 0.4f, 1f);
}
else if (flag8)
else if (halfTiredBuffColor)
{
color = CalamityGlobalNPC.buffColor(color, 0.5f, 0.7f, 0.5f, 1f);
}
else if (NPC.ai[0] == 4f && NPC.ai[2] > num150)
else if (NPC.ai[0] == 4f && NPC.ai[2] > ai2Compare)
{
float num152 = NPC.ai[2] - num150;
num152 /= num151;
color = CalamityGlobalNPC.buffColor(color, 1f - 0.5f * num152, 1f - 0.3f * num152, 1f - 0.5f * num152, 1f);
float buffColorDampener = NPC.ai[2] - ai2Compare;
buffColorDampener /= buffColorDivisor;
color = CalamityGlobalNPC.buffColor(color, 1f - 0.5f * buffColorDampener, 1f - 0.3f * buffColorDampener, 1f - 0.5f * buffColorDampener, 1f);
}
int num153 = 10;
int num154 = 2;
int afterimageAmt = 10;
int afterimageIncrement = 2;
if (NPC.ai[0] == -1f)
{
num153 = 0;
afterimageAmt = 0;
}
if (NPC.ai[0] == 0f || NPC.ai[0] == 5f || NPC.ai[0] == 10f || NPC.ai[0] == 12f)
{
num153 = 7;
afterimageAmt = 7;
}
if (NPC.ai[0] == 1f || NPC.ai[0] == 6f || NPC.ai[0] > 9f)
{
color36 = Color.Lime;
amount9 = 0.5f;
drawLerpColor = Color.Lime;
drawLerpValue = 0.5f;
}
else
{
@@ -265,140 +265,138 @@ namespace CalamityMod.NPCs.OldDuke
if (CalamityConfig.Instance.Afterimages)
{
for (int num155 = 1; num155 < num153; num155 += num154)
for (int i = 1; i < afterimageAmt; i += afterimageIncrement)
{
Color color38 = color;
color38 = Color.Lerp(color38, color36, amount9);
color38 = NPC.GetAlpha(color38);
color38 *= (num153 - num155) / 15f;
Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color afterimageColor = color;
afterimageColor = Color.Lerp(afterimageColor, drawLerpColor, drawLerpValue);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (afterimageAmt - i) / 15f;
Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
int num156 = 0;
float num157 = 0f;
float scaleFactor9 = 0f;
int secondAfterimageAmt = 0;
float afterimageOpacity = 0f;
float afterimageScale = 0f;
if (NPC.ai[0] == -1f)
{
num156 = 0;
secondAfterimageAmt = 0;
}
if (NPC.ai[0] == 3f || NPC.ai[0] == 8f || NPC.ai[0] == 13f)
{
int num158 = 60;
int num159 = 30;
if (NPC.ai[2] > num158)
if (NPC.ai[2] > 60)
{
num156 = 6;
num157 = 1f - (float)Math.Cos((NPC.ai[2] - num158) / num159 * MathHelper.TwoPi);
num157 /= 3f;
scaleFactor9 = 40f;
secondAfterimageAmt = 6;
afterimageOpacity = 1f - (float)Math.Cos((NPC.ai[2] - 60) / 30 * MathHelper.TwoPi);
afterimageOpacity /= 3f;
afterimageScale = 40f;
}
}
if ((NPC.ai[0] == 4f || NPC.ai[0] == 9f) && NPC.ai[2] > num150)
if ((NPC.ai[0] == 4f || NPC.ai[0] == 9f) && NPC.ai[2] > ai2Compare)
{
num156 = 6;
num157 = 1f - (float)Math.Cos((NPC.ai[2] - num150) / num151 * MathHelper.TwoPi);
num157 /= 3f;
scaleFactor9 = 60f;
secondAfterimageAmt = 6;
afterimageOpacity = 1f - (float)Math.Cos((NPC.ai[2] - ai2Compare) / buffColorDivisor * MathHelper.TwoPi);
afterimageOpacity /= 3f;
afterimageScale = 60f;
}
if (NPC.ai[0] == 12f)
{
num156 = 6;
num157 = 1f - (float)Math.Cos(NPC.ai[2] / 30f * MathHelper.TwoPi);
num157 /= 3f;
scaleFactor9 = 20f;
secondAfterimageAmt = 6;
afterimageOpacity = 1f - (float)Math.Cos(NPC.ai[2] / 30f * MathHelper.TwoPi);
afterimageOpacity /= 3f;
afterimageScale = 20f;
}
if (CalamityConfig.Instance.Afterimages)
{
for (int num160 = 0; num160 < num156; num160++)
for (int j = 0; j < secondAfterimageAmt; j++)
{
Color color39 = drawColor;
color39 = Color.Lerp(color39, color36, amount9);
color39 = NPC.GetAlpha(color39);
color39 *= 1f - num157;
Vector2 vector42 = NPC.Center + (num160 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - screenPos;
vector42 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
vector42 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector42, NPC.frame, color39, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color secondAfterimageColor = drawColor;
secondAfterimageColor = Color.Lerp(secondAfterimageColor, drawLerpColor, drawLerpValue);
secondAfterimageColor = NPC.GetAlpha(secondAfterimageColor);
secondAfterimageColor *= 1f - afterimageOpacity;
Vector2 secondAfterimagePos = NPC.Center + (j / (float)secondAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScale * afterimageOpacity - screenPos;
secondAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
secondAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, secondAfterimagePos, NPC.frame, secondAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
Color color2 = drawColor;
color2 = Color.Lerp(color2, color36, amount9);
color2 = NPC.GetAlpha(color2);
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, (NPC.ai[0] > 9f ? color2 : NPC.GetAlpha(drawColor)), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color finalDrawColor = drawColor;
finalDrawColor = Color.Lerp(finalDrawColor, drawLerpColor, drawLerpValue);
finalDrawColor = NPC.GetAlpha(finalDrawColor);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, (NPC.ai[0] > 9f ? finalDrawColor : NPC.GetAlpha(drawColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
if (NPC.ai[0] >= 4f && NPC.Calamity().newAI[1] != 1f)
{
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/OldDuke/OldDukeGlow").Value;
Color color40 = Color.Lerp(Color.White, Color.Yellow, 0.5f);
color36 = Color.Yellow;
Color yellowLerpColor = Color.Lerp(Color.White, Color.Yellow, 0.5f);
drawLerpColor = Color.Yellow;
amount9 = 1f;
num157 = 0.5f;
scaleFactor9 = 10f;
num154 = 1;
drawLerpValue = 1f;
afterimageOpacity = 0.5f;
afterimageScale = 10f;
afterimageIncrement = 1;
if (NPC.ai[0] == 4f || NPC.ai[0] == 9f)
{
float num161 = NPC.ai[2] - num150;
num161 /= num151;
color36 *= num161;
color40 *= num161;
float otherAfterimageOpacity = NPC.ai[2] - ai2Compare;
otherAfterimageOpacity /= buffColorDivisor;
drawLerpColor *= otherAfterimageOpacity;
yellowLerpColor *= otherAfterimageOpacity;
}
if (NPC.ai[0] == 12f)
{
float num162 = NPC.ai[2];
num162 /= 30f;
if (num162 > 0.5f)
float ai2Opacity = NPC.ai[2];
ai2Opacity /= 30f;
if (ai2Opacity > 0.5f)
{
num162 = 1f - num162;
ai2Opacity = 1f - ai2Opacity;
}
num162 *= 2f;
num162 = 1f - num162;
color36 *= num162;
color40 *= num162;
ai2Opacity *= 2f;
ai2Opacity = 1f - ai2Opacity;
drawLerpColor *= ai2Opacity;
yellowLerpColor *= ai2Opacity;
}
if (CalamityConfig.Instance.Afterimages)
{
for (int num163 = 1; num163 < num153; num163 += num154)
for (int k = 1; k < afterimageAmt; k += afterimageIncrement)
{
Color color41 = color40;
color41 = Color.Lerp(color41, color36, amount9);
color41 *= (num153 - num163) / 15f;
Vector2 vector44 = NPC.oldPos[num163] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
vector44 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color yellowAfterimageColor = yellowLerpColor;
yellowAfterimageColor = Color.Lerp(yellowAfterimageColor, drawLerpColor, drawLerpValue);
yellowAfterimageColor *= (afterimageAmt - k) / 15f;
Vector2 yellowAfterimagePos = NPC.oldPos[k] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
yellowAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
yellowAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, yellowAfterimagePos, NPC.frame, yellowAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
for (int num164 = 1; num164 < num156; num164++)
for (int l = 1; l < secondAfterimageAmt; l++)
{
Color color42 = color40;
color42 = Color.Lerp(color42, color36, amount9);
color42 = NPC.GetAlpha(color42);
color42 *= 1f - num157;
Vector2 vector45 = NPC.Center + (num164 / (float)num156 * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * scaleFactor9 * num157 - screenPos;
vector45 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
vector45 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector45, NPC.frame, color42, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color secondYellowAfterimageColor = yellowLerpColor;
secondYellowAfterimageColor = Color.Lerp(secondYellowAfterimageColor, drawLerpColor, drawLerpValue);
secondYellowAfterimageColor = NPC.GetAlpha(secondYellowAfterimageColor);
secondYellowAfterimageColor *= 1f - afterimageOpacity;
Vector2 secondYellowAfterimagePos = NPC.Center + (l / (float)secondAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScale * afterimageOpacity - screenPos;
secondYellowAfterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
secondYellowAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, secondYellowAfterimagePos, NPC.frame, secondYellowAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color40, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, yellowLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
return false;
@@ -486,16 +484,16 @@ namespace CalamityMod.NPCs.OldDuke
{
if (NPC.life > 0)
{
int num211 = 0;
while (num211 < hit.Damage / NPC.lifeMax * 100.0)
int onHitDust = 0;
while (onHitDust < hit.Damage / NPC.lifeMax * 100.0)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f);
num211++;
onHitDust++;
}
}
else
{
for (int num212 = 0; num212 < 150; num212++)
for (int r = 0; r < 150; r++)
{
Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 2 * hit.HitDirection, -2f, 0, default, 1f);
}
+37 -37
View File
@@ -116,18 +116,18 @@ namespace CalamityMod.NPCs.OldDuke
velocity += Vector2.Distance(player.Center, NPC.Center) * speedUpMult;
}
Vector2 vector167 = new Vector2(NPC.Center.X + NPC.direction * 20, NPC.Center.Y + 6f);
float num1373 = player.position.X + player.width * 0.5f - vector167.X;
float num1374 = player.Center.Y - vector167.Y;
float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374);
float num1376 = velocity / num1375;
num1373 *= num1376;
num1374 *= num1376;
Vector2 toothBallDirection = new Vector2(NPC.Center.X + NPC.direction * 20, NPC.Center.Y + 6f);
float targetXDist = player.position.X + player.width * 0.5f - toothBallDirection.X;
float targetYDist = player.Center.Y - toothBallDirection.Y;
float targetDistance = (float)Math.Sqrt(targetXDist * targetXDist + targetYDist * targetYDist);
float toothBallSpeed = velocity / targetDistance;
targetXDist *= toothBallSpeed;
targetYDist *= toothBallSpeed;
NPC.ai[2] -= Main.rand.Next(6);
if (num1375 < 300f || NPC.ai[2] > 0f)
if (targetDistance < 300f || NPC.ai[2] > 0f)
{
if (num1375 < 300f)
if (targetDistance < 300f)
NPC.ai[2] = 100f;
if (NPC.velocity.X < 0f)
@@ -139,27 +139,27 @@ namespace CalamityMod.NPCs.OldDuke
}
float inertia = 50f;
NPC.velocity.X = (NPC.velocity.X * inertia + num1373) / (inertia + 1f);
NPC.velocity.Y = (NPC.velocity.Y * inertia + num1374) / (inertia + 1f);
NPC.velocity.X = (NPC.velocity.X * inertia + targetXDist) / (inertia + 1f);
NPC.velocity.Y = (NPC.velocity.Y * inertia + targetYDist) / (inertia + 1f);
float num1247 = bossRush ? 0.65f : 0.5f;
for (int num1248 = 0; num1248 < Main.maxNPCs; num1248++)
float toothBallAccel = bossRush ? 0.65f : 0.5f;
for (int i = 0; i < Main.maxNPCs; i++)
{
if (Main.npc[num1248].active)
if (Main.npc[i].active)
{
if (num1248 != NPC.whoAmI && Main.npc[num1248].type == NPC.type)
if (i != NPC.whoAmI && Main.npc[i].type == NPC.type)
{
if (Vector2.Distance(NPC.Center, Main.npc[num1248].Center) < 48f)
if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 48f)
{
if (NPC.position.X < Main.npc[num1248].position.X)
NPC.velocity.X -= num1247;
if (NPC.position.X < Main.npc[i].position.X)
NPC.velocity.X -= toothBallAccel;
else
NPC.velocity.X += num1247;
NPC.velocity.X += toothBallAccel;
if (NPC.position.Y < Main.npc[num1248].position.Y)
NPC.velocity.Y -= num1247;
if (NPC.position.Y < Main.npc[i].position.Y)
NPC.velocity.Y -= toothBallAccel;
else
NPC.velocity.Y += num1247;
NPC.velocity.Y += toothBallAccel;
}
}
}
@@ -185,8 +185,8 @@ namespace CalamityMod.NPCs.OldDuke
Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity);
for (int k = 0; k < totalProjectiles; k++)
{
Vector2 vector255 = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, vector255 * 0.1f, type, damage, 0f, Main.myPlayer, vector255.X, vector255.Y);
Vector2 toothSpikeRotation = spinningPoint.RotatedBy(radians * k);
Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, toothSpikeRotation * 0.1f, type, damage, 0f, Main.myPlayer, toothSpikeRotation.X, toothSpikeRotation.Y);
}
if (Main.expertMode)
@@ -243,26 +243,26 @@ namespace CalamityMod.NPCs.OldDuke
NPC.position.X = NPC.position.X - NPC.width / 2;
NPC.position.Y = NPC.position.Y - NPC.height / 2;
for (int num621 = 0; num621 < 15; num621++)
for (int i = 0; i < 15; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int bloody = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f);
Main.dust[bloody].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[bloody].scale = 0.5f;
Main.dust[bloody].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
Main.dust[num622].noGravity = true;
Main.dust[bloody].noGravity = true;
}
for (int num623 = 0; num623 < 30; num623++)
for (int j = 0; j < 30; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
Main.dust[num624].noGravity = true;
int toxicDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 3f);
Main.dust[toxicDust].noGravity = true;
Main.dust[toxicDust].velocity *= 5f;
toxicDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f);
Main.dust[toxicDust].velocity *= 2f;
Main.dust[toxicDust].noGravity = true;
}
if (Main.netMode != NetmodeID.Server)
+31 -33
View File
@@ -141,11 +141,11 @@ namespace CalamityMod.NPCs.OldDuke
// Fly towards the target
float scaleFactor2 = NPC.velocity.Length();
Vector2 vector17 = Main.player[NPC.target].Center - NPC.Center;
vector17.Normalize();
vector17 *= scaleFactor2;
Vector2 targetDistance = Main.player[NPC.target].Center - NPC.Center;
targetDistance.Normalize();
targetDistance *= scaleFactor2;
float inertia = bossRush ? 20f : death ? 23f : revenge ? 25f : expertMode ? 27f : 30f;
NPC.velocity = (NPC.velocity * (inertia - 1f) + vector17) / inertia;
NPC.velocity = (NPC.velocity * (inertia - 1f) + targetDistance) / inertia;
NPC.velocity.Normalize();
NPC.velocity *= scaleFactor2;
}
@@ -241,30 +241,28 @@ namespace CalamityMod.NPCs.OldDuke
spriteEffects = SpriteEffects.None;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2);
Color color36 = Color.Lime;
float amount9 = 0.5f;
int num153 = 10;
Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[NPC.type].Value.Width / 2, TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2);
int afterimageAmt = 10;
if (CalamityConfig.Instance.Afterimages)
{
for (int num155 = 1; num155 < num153; num155 += 2)
for (int i = 1; i < afterimageAmt; i += 2)
{
Color color38 = drawColor;
color38 = Color.Lerp(color38, color36, amount9);
color38 = NPC.GetAlpha(color38);
color38 *= (num153 - num155) / 15f;
Vector2 vector41 = NPC.oldPos[num155] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
vector41 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color afterimageColor = drawColor;
afterimageColor = Color.Lerp(afterimageColor, Color.Lime, 0.5f);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (afterimageAmt - i) / 15f;
Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos;
afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[NPC.type]) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
@@ -299,25 +297,25 @@ namespace CalamityMod.NPCs.OldDuke
NPC.position.X = NPC.position.X - (NPC.width / 2);
NPC.position.Y = NPC.position.Y - (NPC.height / 2);
for (int num621 = 0; num621 < 15; num621++)
for (int i = 0; i < 15; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity.Y *= 6f;
Main.dust[num622].velocity.X *= 3f;
int toxicDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, (int)CalamityDusts.SulfurousSeaAcid, 0f, 0f, 100, default, 2f);
Main.dust[toxicDust].velocity.Y *= 6f;
Main.dust[toxicDust].velocity.X *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[toxicDust].scale = 0.5f;
Main.dust[toxicDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 30; num623++)
for (int j = 0; j < 30; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity.Y *= 10f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity.X *= 2f;
int bloody = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f);
Main.dust[bloody].noGravity = true;
Main.dust[bloody].velocity.Y *= 10f;
bloody = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f);
Main.dust[bloody].velocity.X *= 2f;
}
if (Main.netMode != NetmodeID.Server)
+30 -30
View File
@@ -102,40 +102,40 @@ namespace CalamityMod.NPCs.Perforator
if (Main.player[NPC.target].dead)
NPC.TargetClosest(false);
Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
num191 = (float)((int)(num191 / 16f) * 16);
num192 = (float)((int)(num192 / 16f) * 16);
vector18.X = (float)((int)(vector18.X / 16f) * 16);
vector18.Y = (float)((int)(vector18.Y / 16f) * 16);
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float targetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float targetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
targetX = (float)((int)(targetX / 16f) * 16);
targetY = (float)((int)(targetY / 16f) * 16);
segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16);
segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16);
targetX -= segmentPosition.X;
targetY -= segmentPosition.Y;
float targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY));
if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length)
{
try
{
vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X;
num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y;
segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
targetX = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X;
targetY = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y;
}
catch
{
}
NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f;
num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
int num194 = NPC.width;
num193 = (num193 - (float)num194) / num193;
num191 *= num193;
num192 *= num193;
NPC.rotation = (float)System.Math.Atan2((double)targetY, (double)targetX) + 1.57f;
targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY));
int npcWidth = NPC.width;
targetDistance = (targetDistance - (float)npcWidth) / targetDistance;
targetX *= targetDistance;
targetY *= targetDistance;
NPC.velocity = Vector2.Zero;
NPC.position.X = NPC.position.X + num191;
NPC.position.Y = NPC.position.Y + num192;
NPC.position.X = NPC.position.X + targetX;
NPC.position.Y = NPC.position.Y + targetY;
if (num191 < 0f)
if (targetX < 0f)
NPC.spriteDirection = 1;
else if (num191 > 0f)
else if (targetX > 0f)
NPC.spriteDirection = -1;
}
}
@@ -147,17 +147,17 @@ namespace CalamityMod.NPCs.Perforator
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = NPC.localAI[3] == 1f ? ModContent.Request<Texture2D>("CalamityMod/NPCs/Perforator/PerforatorBodyLargeAlt").Value : TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = NPC.localAI[3] == 1f ? ModContent.Request<Texture2D>("CalamityMod/NPCs/Perforator/PerforatorBodyLargeAltGlow").Value : ModContent.Request<Texture2D>("CalamityMod/NPCs/Perforator/PerforatorBodyLargeGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f);
Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
+37 -37
View File
@@ -105,11 +105,11 @@ namespace CalamityMod.NPCs.Perforator
{
NPC.type = ModContent.NPCType<PerforatorHeadMedium>();
int whoAmI = NPC.whoAmI;
float num25 = NPC.life / (float)NPC.lifeMax;
float num26 = NPC.ai[0];
float lifeRatio = NPC.life / (float)NPC.lifeMax;
float ai0 = NPC.ai[0];
NPC.SetDefaultsKeepPlayerInteraction(NPC.type);
NPC.life = (int)(NPC.lifeMax * num25);
NPC.ai[0] = num26;
NPC.life = (int)(NPC.lifeMax * lifeRatio);
NPC.ai[0] = ai0;
NPC.TargetClosest(true);
NPC.netUpdate = true;
NPC.whoAmI = whoAmI;
@@ -117,11 +117,11 @@ namespace CalamityMod.NPCs.Perforator
if (!Main.npc[(int)NPC.ai[0]].active || Main.npc[(int)NPC.ai[0]].aiStyle != NPC.aiStyle)
{
int whoAmI2 = NPC.whoAmI;
float num27 = NPC.life / (float)NPC.lifeMax;
float num28 = NPC.ai[1];
float otherLifeRatio = NPC.life / (float)NPC.lifeMax;
float ai1 = NPC.ai[1];
NPC.SetDefaultsKeepPlayerInteraction(NPC.type);
NPC.life = (int)(NPC.lifeMax * num27);
NPC.ai[1] = num28;
NPC.life = (int)(NPC.lifeMax * otherLifeRatio);
NPC.ai[1] = ai1;
NPC.TargetClosest(true);
NPC.netUpdate = true;
NPC.whoAmI = whoAmI2;
@@ -131,40 +131,40 @@ namespace CalamityMod.NPCs.Perforator
NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0);
}
Vector2 vector2 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float num39 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2);
float num40 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2);
Vector2 segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2);
float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2);
num39 = (int)(num39 / 16f) * 16;
num40 = (int)(num40 / 16f) * 16;
vector2.X = (int)(vector2.X / 16f) * 16;
vector2.Y = (int)(vector2.Y / 16f) * 16;
num39 -= vector2.X;
num40 -= vector2.Y;
float num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40);
targetX = (int)(targetX / 16f) * 16;
targetY = (int)(targetY / 16f) * 16;
segmentDirection.X = (int)(segmentDirection.X / 16f) * 16;
segmentDirection.Y = (int)(segmentDirection.Y / 16f) * 16;
targetX -= segmentDirection.X;
targetY -= segmentDirection.Y;
float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY);
if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length)
{
try
{
vector2 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
num39 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector2.X;
num40 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector2.Y;
segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentDirection.X;
targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentDirection.Y;
}
catch
{
}
NPC.rotation = (float)Math.Atan2(num40, num39) + MathHelper.PiOver2;
num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40);
int num53 = NPC.width;
num53 = (int)(num53 * NPC.scale);
num52 = (num52 - num53) / num52;
num39 *= num52;
num40 *= num52;
NPC.rotation = (float)Math.Atan2(targetY, targetX) + MathHelper.PiOver2;
targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY);
int npcWidth = NPC.width;
npcWidth = (int)(npcWidth * NPC.scale);
targetDistance = (targetDistance - npcWidth) / targetDistance;
targetX *= targetDistance;
targetY *= targetDistance;
NPC.velocity = Vector2.Zero;
NPC.position.X += num39;
NPC.position.Y += num40;
NPC.position.X += targetX;
NPC.position.Y += targetY;
}
}
@@ -175,17 +175,17 @@ namespace CalamityMod.NPCs.Perforator
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/Perforator/PerforatorBodyMediumGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f);
Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
+30 -30
View File
@@ -102,40 +102,40 @@ namespace CalamityMod.NPCs.Perforator
if (Main.player[NPC.target].dead)
NPC.TargetClosest(false);
Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
num191 = (float)((int)(num191 / 16f) * 16);
num192 = (float)((int)(num192 / 16f) * 16);
vector18.X = (float)((int)(vector18.X / 16f) * 16);
vector18.Y = (float)((int)(vector18.Y / 16f) * 16);
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float targetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float targetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
targetX = (float)((int)(targetX / 16f) * 16);
targetY = (float)((int)(targetY / 16f) * 16);
segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16);
segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16);
targetX -= segmentPosition.X;
targetY -= segmentPosition.Y;
float targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY));
if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length)
{
try
{
vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X;
num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y;
segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
targetX = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X;
targetY = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y;
}
catch
{
}
NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f;
num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
int num194 = NPC.width;
num193 = (num193 - (float)num194) / num193;
num191 *= num193;
num192 *= num193;
NPC.rotation = (float)System.Math.Atan2((double)targetY, (double)targetX) + 1.57f;
targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY));
int npcWidth = NPC.width;
targetDistance = (targetDistance - (float)npcWidth) / targetDistance;
targetX *= targetDistance;
targetY *= targetDistance;
NPC.velocity = Vector2.Zero;
NPC.position.X = NPC.position.X + num191;
NPC.position.Y = NPC.position.Y + num192;
NPC.position.X = NPC.position.X + targetX;
NPC.position.Y = NPC.position.Y + targetY;
if (num191 < 0f)
if (targetX < 0f)
NPC.spriteDirection = 1;
else if (num191 > 0f)
else if (targetX > 0f)
NPC.spriteDirection = -1;
}
}
@@ -147,17 +147,17 @@ namespace CalamityMod.NPCs.Perforator
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/Perforator/PerforatorBodySmallGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f);
Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
+114 -114
View File
@@ -180,10 +180,10 @@ namespace CalamityMod.NPCs.Perforator
{
int Previous = NPC.whoAmI;
int maxLength = death ? 27 : revenge ? 24 : expertMode ? 21 : 15;
for (int num36 = 0; num36 < maxLength; num36++)
for (int segments = 0; segments < maxLength; segments++)
{
int lol;
if (num36 >= 0 && num36 < maxLength - 1)
if (segments >= 0 && segments < maxLength - 1)
{
lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType<PerforatorBodyLarge>(), NPC.whoAmI);
}
@@ -191,7 +191,7 @@ namespace CalamityMod.NPCs.Perforator
{
lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType<PerforatorTailLarge>(), NPC.whoAmI);
}
if (num36 % 2 == 0)
if (segments % 2 == 0)
{
Main.npc[lol].localAI[3] = 1f;
}
@@ -206,32 +206,32 @@ namespace CalamityMod.NPCs.Perforator
}
}
int num12 = (int)(NPC.position.X / 16f) - 1;
int num13 = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2;
int num14 = (int)(NPC.position.Y / 16f) - 1;
int num15 = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2;
if (num12 < 0)
int tilePositionX = (int)(NPC.position.X / 16f) - 1;
int tileWidthPosX = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2;
int tilePositionY = (int)(NPC.position.Y / 16f) - 1;
int tileWidthPosY = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2;
if (tilePositionX < 0)
{
num12 = 0;
tilePositionX = 0;
}
if (num13 > Main.maxTilesX)
if (tileWidthPosX > Main.maxTilesX)
{
num13 = Main.maxTilesX;
tileWidthPosX = Main.maxTilesX;
}
if (num14 < 0)
if (tilePositionY < 0)
{
num14 = 0;
tilePositionY = 0;
}
if (num15 > Main.maxTilesY)
if (tileWidthPosY > Main.maxTilesY)
{
num15 = Main.maxTilesY;
tileWidthPosY = Main.maxTilesY;
}
bool flag2 = lungeUpward;
if (!flag2)
bool shouldFly = lungeUpward;
if (!shouldFly)
{
for (int k = num12; k < num13; k++)
for (int k = tilePositionX; k < tileWidthPosX; k++)
{
for (int l = num14; l < num15; l++)
for (int l = tilePositionY; l < tileWidthPosY; l++)
{
if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[k, l].TileType] || (Main.tileSolidTop[(int)Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64))
{
@@ -240,36 +240,36 @@ namespace CalamityMod.NPCs.Perforator
vector2.Y = (float)(l * 16);
if (NPC.position.X + (float)NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + (float)NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f)
{
flag2 = true;
shouldFly = true;
break;
}
}
}
}
}
if (!flag2)
if (!shouldFly)
{
NPC.localAI[1] = 1f;
Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height);
int num16 = death ? 160 : revenge ? 200 : expertMode ? 240 : 300;
bool flag3 = true;
int stopFlyingRadius = death ? 160 : revenge ? 200 : expertMode ? 240 : 300;
bool outsideFlyingRadius = true;
if (NPC.position.Y > player.position.Y)
{
for (int m = 0; m < 255; m++)
{
if (Main.player[m].active)
{
Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, num16 * 2);
Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - stopFlyingRadius, (int)Main.player[m].position.Y - stopFlyingRadius, stopFlyingRadius * 2, stopFlyingRadius * 2);
if (rectangle.Intersects(rectangle2))
{
flag3 = false;
outsideFlyingRadius = false;
break;
}
}
}
if (flag3)
if (outsideFlyingRadius)
{
flag2 = true;
shouldFly = true;
}
}
}
@@ -278,15 +278,15 @@ namespace CalamityMod.NPCs.Perforator
NPC.localAI[1] = 0f;
}
float num17 = 16f;
float fallSpeed = 16f;
if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active)
{
flag2 = false;
shouldFly = false;
NPC.velocity.Y += 1f;
if ((double)NPC.position.Y > Main.worldSurface * 16.0)
{
NPC.velocity.Y += 1f;
num17 = 32f;
fallSpeed = 32f;
}
if ((double)NPC.position.Y > Main.rockLayer * 16.0)
{
@@ -329,21 +329,21 @@ namespace CalamityMod.NPCs.Perforator
NPC.Calamity().newAI[3] = -300f;
}
float num18 = speed;
float num19 = turnSpeed;
float speedCopy = speed;
float turnSpeedCopy = turnSpeed;
float burrowDistance = bossRush ? 500f : 800f;
float burrowTarget = player.Center.Y + burrowDistance;
float lungeTarget = NPC.Calamity().newAI[2];
Vector2 vector3 = NPC.Center;
float num20 = player.Center.X;
float num21 = lungeUpward ? lungeTarget : burrow ? burrowTarget : player.Center.Y;
num20 = (float)((int)(num20 / 16f) * 16);
num21 = (float)((int)(num21 / 16f) * 16);
vector3.X = (float)((int)(vector3.X / 16f) * 16);
vector3.Y = (float)((int)(vector3.Y / 16f) * 16);
num20 -= vector3.X;
num21 -= vector3.Y;
float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21));
Vector2 npcCenter = NPC.Center;
float playerX = player.Center.X;
float targettingPosition = lungeUpward ? lungeTarget : burrow ? burrowTarget : player.Center.Y;
playerX = (float)((int)(playerX / 16f) * 16);
targettingPosition = (float)((int)(targettingPosition / 16f) * 16);
npcCenter.X = (float)((int)(npcCenter.X / 16f) * 16);
npcCenter.Y = (float)((int)(npcCenter.Y / 16f) * 16);
playerX -= npcCenter.X;
targettingPosition -= npcCenter.Y;
float targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition));
// Lunge up towards target
if (burrow && NPC.Center.Y >= burrowTarget - 16f)
@@ -375,45 +375,45 @@ namespace CalamityMod.NPCs.Perforator
NPC.Calamity().newAI[1] = 0f;
}
if (!flag2)
if (!shouldFly)
{
NPC.TargetClosest(true);
NPC.velocity.Y = NPC.velocity.Y + 0.15f;
if (NPC.velocity.Y > num17)
if (NPC.velocity.Y > fallSpeed)
{
NPC.velocity.Y = num17;
NPC.velocity.Y = fallSpeed;
}
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.4)
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)fallSpeed * 0.4)
{
if (NPC.velocity.X < 0f)
{
NPC.velocity.X = NPC.velocity.X - num18 * 1.1f;
NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f;
}
else
{
NPC.velocity.X = NPC.velocity.X + num18 * 1.1f;
NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f;
}
}
else if (NPC.velocity.Y == num17)
else if (NPC.velocity.Y == fallSpeed)
{
if (NPC.velocity.X < num20)
if (NPC.velocity.X < playerX)
{
NPC.velocity.X = NPC.velocity.X + num18;
NPC.velocity.X = NPC.velocity.X + speedCopy;
}
else if (NPC.velocity.X > num20)
else if (NPC.velocity.X > playerX)
{
NPC.velocity.X = NPC.velocity.X - num18;
NPC.velocity.X = NPC.velocity.X - speedCopy;
}
}
else if (NPC.velocity.Y > 4f)
{
if (NPC.velocity.X < 0f)
{
NPC.velocity.X = NPC.velocity.X + num18 * 0.9f;
NPC.velocity.X = NPC.velocity.X + speedCopy * 0.9f;
}
else
{
NPC.velocity.X = NPC.velocity.X - num18 * 0.9f;
NPC.velocity.X = NPC.velocity.X - speedCopy * 0.9f;
}
}
}
@@ -421,131 +421,131 @@ namespace CalamityMod.NPCs.Perforator
{
if (NPC.soundDelay == 0)
{
float num24 = num22 / 40f;
if (num24 < 10f)
float soundDelay = targetDistance / 40f;
if (soundDelay < 10f)
{
num24 = 10f;
soundDelay = 10f;
}
if (num24 > 20f)
if (soundDelay > 20f)
{
num24 = 20f;
soundDelay = 20f;
}
NPC.soundDelay = (int)num24;
NPC.soundDelay = (int)soundDelay;
SoundEngine.PlaySound(SoundID.WormDig, NPC.Center);
}
num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21));
float num25 = Math.Abs(num20);
float num26 = Math.Abs(num21);
float num27 = num17 / num22;
num20 *= num27;
num21 *= num27;
if (((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f)) && ((NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f)))
targetDistance = (float)Math.Sqrt((double)(playerX * playerX + targettingPosition * targettingPosition));
float absoluteTargetX = Math.Abs(playerX);
float absoluteTargetPos = Math.Abs(targettingPosition);
float timeToReachTarget = fallSpeed / targetDistance;
playerX *= timeToReachTarget;
targettingPosition *= timeToReachTarget;
if (((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f)) && ((NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f)))
{
if (NPC.velocity.X < num20)
if (NPC.velocity.X < playerX)
{
NPC.velocity.X = NPC.velocity.X + num19;
NPC.velocity.X = NPC.velocity.X + turnSpeedCopy;
}
else if (NPC.velocity.X > num20)
else if (NPC.velocity.X > playerX)
{
NPC.velocity.X = NPC.velocity.X - num19;
NPC.velocity.X = NPC.velocity.X - turnSpeedCopy;
}
if (NPC.velocity.Y < num21)
if (NPC.velocity.Y < targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y + num19;
NPC.velocity.Y = NPC.velocity.Y + turnSpeedCopy;
}
else if (NPC.velocity.Y > num21)
else if (NPC.velocity.Y > targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y - num19;
NPC.velocity.Y = NPC.velocity.Y - turnSpeedCopy;
}
}
if ((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f) || (NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f))
if ((NPC.velocity.X > 0f && playerX > 0f) || (NPC.velocity.X < 0f && playerX < 0f) || (NPC.velocity.Y > 0f && targettingPosition > 0f) || (NPC.velocity.Y < 0f && targettingPosition < 0f))
{
if (NPC.velocity.X < num20)
if (NPC.velocity.X < playerX)
{
NPC.velocity.X = NPC.velocity.X + num18;
NPC.velocity.X = NPC.velocity.X + speedCopy;
}
else if (NPC.velocity.X > num20)
else if (NPC.velocity.X > playerX)
{
NPC.velocity.X = NPC.velocity.X - num18;
NPC.velocity.X = NPC.velocity.X - speedCopy;
}
if (NPC.velocity.Y < num21)
if (NPC.velocity.Y < targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y + num18;
NPC.velocity.Y = NPC.velocity.Y + speedCopy;
}
else if (NPC.velocity.Y > num21)
else if (NPC.velocity.Y > targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y - num18;
NPC.velocity.Y = NPC.velocity.Y - speedCopy;
}
if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((NPC.velocity.X > 0f && num20 < 0f) || (NPC.velocity.X < 0f && num20 > 0f)))
if ((double)Math.Abs(targettingPosition) < (double)fallSpeed * 0.2 && ((NPC.velocity.X > 0f && playerX < 0f) || (NPC.velocity.X < 0f && playerX > 0f)))
{
if (NPC.velocity.Y > 0f)
{
NPC.velocity.Y = NPC.velocity.Y + num18 * 2f;
NPC.velocity.Y = NPC.velocity.Y + speedCopy * 2f;
}
else
{
NPC.velocity.Y = NPC.velocity.Y - num18 * 2f;
NPC.velocity.Y = NPC.velocity.Y - speedCopy * 2f;
}
}
if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((NPC.velocity.Y > 0f && num21 < 0f) || (NPC.velocity.Y < 0f && num21 > 0f)))
if ((double)Math.Abs(playerX) < (double)fallSpeed * 0.2 && ((NPC.velocity.Y > 0f && targettingPosition < 0f) || (NPC.velocity.Y < 0f && targettingPosition > 0f)))
{
if (NPC.velocity.X > 0f)
{
NPC.velocity.X = NPC.velocity.X + num18 * 2f;
NPC.velocity.X = NPC.velocity.X + speedCopy * 2f;
}
else
{
NPC.velocity.X = NPC.velocity.X - num18 * 2f;
NPC.velocity.X = NPC.velocity.X - speedCopy * 2f;
}
}
}
else if (num25 > num26)
else if (absoluteTargetX > absoluteTargetPos)
{
if (NPC.velocity.X < num20)
if (NPC.velocity.X < playerX)
{
NPC.velocity.X = NPC.velocity.X + num18 * 1.1f;
NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f;
}
else if (NPC.velocity.X > num20)
else if (NPC.velocity.X > playerX)
{
NPC.velocity.X = NPC.velocity.X - num18 * 1.1f;
NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f;
}
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5)
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)fallSpeed * 0.5)
{
if (NPC.velocity.Y > 0f)
{
NPC.velocity.Y = NPC.velocity.Y + num18;
NPC.velocity.Y = NPC.velocity.Y + speedCopy;
}
else
{
NPC.velocity.Y = NPC.velocity.Y - num18;
NPC.velocity.Y = NPC.velocity.Y - speedCopy;
}
}
}
else
{
if (NPC.velocity.Y < num21)
if (NPC.velocity.Y < targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y + num18 * 1.1f;
NPC.velocity.Y = NPC.velocity.Y + speedCopy * 1.1f;
}
else if (NPC.velocity.Y > num21)
else if (NPC.velocity.Y > targettingPosition)
{
NPC.velocity.Y = NPC.velocity.Y - num18 * 1.1f;
NPC.velocity.Y = NPC.velocity.Y - speedCopy * 1.1f;
}
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5)
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)fallSpeed * 0.5)
{
if (NPC.velocity.X > 0f)
{
NPC.velocity.X = NPC.velocity.X + num18;
NPC.velocity.X = NPC.velocity.X + speedCopy;
}
else
{
NPC.velocity.X = NPC.velocity.X - num18;
NPC.velocity.X = NPC.velocity.X - speedCopy;
}
}
}
}
NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f;
if (flag2)
if (shouldFly)
{
if (NPC.localAI[0] != 1f)
{
@@ -577,17 +577,17 @@ namespace CalamityMod.NPCs.Perforator
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/Perforator/PerforatorHeadLargeGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f);
Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
+111 -111
View File
@@ -163,70 +163,70 @@ namespace CalamityMod.NPCs.Perforator
}
// Movement
int num29 = (int)(NPC.position.X / 16f) - 1;
int num30 = (int)((NPC.position.X + NPC.width) / 16f) + 2;
int num31 = (int)(NPC.position.Y / 16f) - 1;
int num32 = (int)((NPC.position.Y + NPC.height) / 16f) + 2;
if (num29 < 0)
num29 = 0;
if (num30 > Main.maxTilesX)
num30 = Main.maxTilesX;
if (num31 < 0)
num31 = 0;
if (num32 > Main.maxTilesY)
num32 = Main.maxTilesY;
int tilePositionX = (int)(NPC.position.X / 16f) - 1;
int tileWidthPosX = (int)((NPC.position.X + NPC.width) / 16f) + 2;
int tilePositionY = (int)(NPC.position.Y / 16f) - 1;
int tileWidthPosY = (int)((NPC.position.Y + NPC.height) / 16f) + 2;
if (tilePositionX < 0)
tilePositionX = 0;
if (tileWidthPosX > Main.maxTilesX)
tileWidthPosX = Main.maxTilesX;
if (tilePositionY < 0)
tilePositionY = 0;
if (tileWidthPosY > Main.maxTilesY)
tileWidthPosY = Main.maxTilesY;
// Fly or not
bool flag2 = false;
if (!flag2)
bool shouldFly = false;
if (!shouldFly)
{
for (int num33 = num29; num33 < num30; num33++)
for (int i = tilePositionX; i < tileWidthPosX; i++)
{
for (int num34 = num31; num34 < num32; num34++)
for (int j = tilePositionY; j < tileWidthPosY; j++)
{
if (Main.tile[num33, num34] != null && ((Main.tile[num33, num34].HasUnactuatedTile && (Main.tileSolid[Main.tile[num33, num34].TileType] || (Main.tileSolidTop[Main.tile[num33, num34].TileType] && Main.tile[num33, num34].TileFrameY == 0))) || Main.tile[num33, num34].LiquidAmount > 64))
if (Main.tile[i, j] != null && ((Main.tile[i, j].HasUnactuatedTile && (Main.tileSolid[Main.tile[i, j].TileType] || (Main.tileSolidTop[Main.tile[i, j].TileType] && Main.tile[i, j].TileFrameY == 0))) || Main.tile[i, j].LiquidAmount > 64))
{
Vector2 vector;
vector.X = num33 * 16;
vector.Y = num34 * 16;
vector.X = i * 16;
vector.Y = j * 16;
if (NPC.position.X + NPC.width > vector.X && NPC.position.X < vector.X + 16f && NPC.position.Y + NPC.height > vector.Y && NPC.position.Y < vector.Y + 16f)
{
flag2 = true;
if (Main.rand.NextBool(100) && Main.tile[num33, num34].HasUnactuatedTile)
shouldFly = true;
if (Main.rand.NextBool(100) && Main.tile[i, j].HasUnactuatedTile)
{
WorldGen.KillTile(num33, num34, true, true, false);
WorldGen.KillTile(i, j, true, true, false);
}
}
}
}
}
}
if (!flag2)
if (!shouldFly)
{
Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height);
int num35 = death ? 160 : revenge ? 200 : expertMode ? 240 : 300;
bool flag3 = true;
for (int num36 = 0; num36 < Main.maxPlayers; num36++)
int stopFlyingRadius = death ? 160 : revenge ? 200 : expertMode ? 240 : 300;
bool outsideFlyRadius = true;
for (int k = 0; k < Main.maxPlayers; k++)
{
if (Main.player[num36].active)
if (Main.player[k].active)
{
Rectangle rectangle2 = new Rectangle((int)Main.player[num36].position.X - num35, (int)Main.player[num36].position.Y - num35, num35 * 2, num35 * 2);
Rectangle rectangle2 = new Rectangle((int)Main.player[k].position.X - stopFlyingRadius, (int)Main.player[k].position.Y - stopFlyingRadius, stopFlyingRadius * 2, stopFlyingRadius * 2);
if (rectangle.Intersects(rectangle2))
{
flag3 = false;
outsideFlyRadius = false;
break;
}
}
}
if (flag3)
flag2 = true;
if (outsideFlyRadius)
shouldFly = true;
}
float fallSpeed = 16f;
if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active)
{
NPC.TargetClosest(false);
flag2 = false;
shouldFly = false;
NPC.velocity.Y += 1f;
if (NPC.position.Y > Main.worldSurface * 16.0)
{
@@ -235,31 +235,31 @@ namespace CalamityMod.NPCs.Perforator
}
if (NPC.position.Y > Main.rockLayer * 16.0)
{
for (int num957 = 0; num957 < Main.maxNPCs; num957++)
for (int p = 0; p < Main.maxNPCs; p++)
{
if (Main.npc[num957].type == NPC.type || Main.npc[num957].type == ModContent.NPCType<PerforatorBodyMedium>() || Main.npc[num957].type == ModContent.NPCType<PerforatorTailMedium>())
if (Main.npc[p].type == NPC.type || Main.npc[p].type == ModContent.NPCType<PerforatorBodyMedium>() || Main.npc[p].type == ModContent.NPCType<PerforatorTailMedium>())
{
Main.npc[num957].active = false;
Main.npc[p].active = false;
}
}
}
}
// Velocity and acceleration
float num37 = speed;
float num38 = turnSpeed;
float speedCopy = speed;
float turnSpeedCopy = turnSpeed;
Vector2 vector2 = NPC.Center;
float num39 = player.Center.X;
float num40 = player.Center.Y;
float targetX = player.Center.X;
float targetY = player.Center.Y;
num39 = (int)(num39 / 16f) * 16;
num40 = (int)(num40 / 16f) * 16;
targetX = (int)(targetX / 16f) * 16;
targetY = (int)(targetY / 16f) * 16;
vector2.X = (int)(vector2.X / 16f) * 16;
vector2.Y = (int)(vector2.Y / 16f) * 16;
num39 -= vector2.X;
num40 -= vector2.Y;
float num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40);
targetX -= vector2.X;
targetY -= vector2.Y;
float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY);
// Prevent new heads from being slowed when they spawn
if (NPC.Calamity().newAI[1] < 3f)
@@ -267,10 +267,10 @@ namespace CalamityMod.NPCs.Perforator
NPC.Calamity().newAI[1] += 1f;
// Set velocity for when a new head spawns
NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (num37 * (death ? 0.3f : 0.2f));
NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (speedCopy * (death ? 0.3f : 0.2f));
}
if (!flag2)
if (!shouldFly)
{
NPC.velocity.Y += 0.15f;
if (NPC.velocity.Y > fallSpeed)
@@ -279,23 +279,23 @@ namespace CalamityMod.NPCs.Perforator
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 0.4)
{
if (NPC.velocity.X < 0f)
NPC.velocity.X -= num38 * 1.1f;
NPC.velocity.X -= turnSpeedCopy * 1.1f;
else
NPC.velocity.X += num38 * 1.1f;
NPC.velocity.X += turnSpeedCopy * 1.1f;
}
else if (NPC.velocity.Y == fallSpeed)
{
if (NPC.velocity.X < num39)
NPC.velocity.X += num38;
else if (NPC.velocity.X > num39)
NPC.velocity.X -= num38;
if (NPC.velocity.X < targetX)
NPC.velocity.X += turnSpeedCopy;
else if (NPC.velocity.X > targetX)
NPC.velocity.X -= turnSpeedCopy;
}
else if (NPC.velocity.Y > 4f)
{
if (NPC.velocity.X < 0f)
NPC.velocity.X += num38 * 0.9f;
NPC.velocity.X += turnSpeedCopy * 0.9f;
else
NPC.velocity.X -= num38 * 0.9f;
NPC.velocity.X -= turnSpeedCopy * 0.9f;
}
}
else
@@ -303,99 +303,99 @@ namespace CalamityMod.NPCs.Perforator
// Sound
if (NPC.soundDelay == 0)
{
float num54 = num52 / 40f;
if (num54 < 10f)
num54 = 10f;
if (num54 > 20f)
num54 = 20f;
float soundDelay = targetDistance / 40f;
if (soundDelay < 10f)
soundDelay = 10f;
if (soundDelay > 20f)
soundDelay = 20f;
NPC.soundDelay = (int)num54;
NPC.soundDelay = (int)soundDelay;
SoundEngine.PlaySound(SoundID.WormDig, NPC.Center);
}
num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40);
float num55 = Math.Abs(num39);
float num56 = Math.Abs(num40);
float num57 = fallSpeed / num52;
num39 *= num57;
num40 *= num57;
targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY);
float absoluteTargetX = Math.Abs(targetX);
float absoluteTargetY = Math.Abs(targetY);
float timeToReachTarget = fallSpeed / targetDistance;
targetX *= timeToReachTarget;
targetY *= timeToReachTarget;
if (((NPC.velocity.X > 0f && num39 > 0f) || (NPC.velocity.X < 0f && num39 < 0f)) && ((NPC.velocity.Y > 0f && num40 > 0f) || (NPC.velocity.Y < 0f && num40 < 0f)))
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 < num39)
NPC.velocity.X += num38;
else if (NPC.velocity.X > num39)
NPC.velocity.X -= num38;
if (NPC.velocity.X < targetX)
NPC.velocity.X += turnSpeedCopy;
else if (NPC.velocity.X > targetX)
NPC.velocity.X -= turnSpeedCopy;
if (NPC.velocity.Y < num40)
NPC.velocity.Y += num38;
else if (NPC.velocity.Y > num40)
NPC.velocity.Y -= num38;
if (NPC.velocity.Y < targetY)
NPC.velocity.Y += turnSpeedCopy;
else if (NPC.velocity.Y > targetY)
NPC.velocity.Y -= turnSpeedCopy;
}
if ((NPC.velocity.X > 0f && num39 > 0f) || (NPC.velocity.X < 0f && num39 < 0f) || (NPC.velocity.Y > 0f && num40 > 0f) || (NPC.velocity.Y < 0f && num40 < 0f))
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 < num39)
NPC.velocity.X += num37;
else if (NPC.velocity.X > num39)
NPC.velocity.X -= num37;
if (NPC.velocity.X < targetX)
NPC.velocity.X += speedCopy;
else if (NPC.velocity.X > targetX)
NPC.velocity.X -= speedCopy;
if (NPC.velocity.Y < num40)
NPC.velocity.Y += num37;
else if (NPC.velocity.Y > num40)
NPC.velocity.Y -= num37;
if (NPC.velocity.Y < targetY)
NPC.velocity.Y += speedCopy;
else if (NPC.velocity.Y > targetY)
NPC.velocity.Y -= speedCopy;
if (Math.Abs(num40) < fallSpeed * 0.2 && ((NPC.velocity.X > 0f && num39 < 0f) || (NPC.velocity.X < 0f && num39 > 0f)))
if (Math.Abs(targetY) < fallSpeed * 0.2 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f)))
{
if (NPC.velocity.Y > 0f)
NPC.velocity.Y += num37 * 2f;
NPC.velocity.Y += speedCopy * 2f;
else
NPC.velocity.Y -= num37 * 2f;
NPC.velocity.Y -= speedCopy * 2f;
}
if (Math.Abs(num39) < fallSpeed * 0.2 && ((NPC.velocity.Y > 0f && num40 < 0f) || (NPC.velocity.Y < 0f && num40 > 0f)))
if (Math.Abs(targetX) < fallSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f)))
{
if (NPC.velocity.X > 0f)
NPC.velocity.X += num37 * 2f;
NPC.velocity.X += speedCopy * 2f;
else
NPC.velocity.X -= num37 * 2f;
NPC.velocity.X -= speedCopy * 2f;
}
}
else if (num55 > num56)
else if (absoluteTargetX > absoluteTargetY)
{
if (NPC.velocity.X < num39)
NPC.velocity.X += num37 * 1.1f;
else if (NPC.velocity.X > num39)
NPC.velocity.X -= num37 * 1.1f;
if (NPC.velocity.X < targetX)
NPC.velocity.X += speedCopy * 1.1f;
else if (NPC.velocity.X > targetX)
NPC.velocity.X -= speedCopy * 1.1f;
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 0.5)
{
if (NPC.velocity.Y > 0f)
NPC.velocity.Y += num37;
NPC.velocity.Y += speedCopy;
else
NPC.velocity.Y -= num37;
NPC.velocity.Y -= speedCopy;
}
}
else
{
if (NPC.velocity.Y < num40)
NPC.velocity.Y += num37 * 1.1f;
else if (NPC.velocity.Y > num40)
NPC.velocity.Y -= num37 * 1.1f;
if (NPC.velocity.Y < targetY)
NPC.velocity.Y += speedCopy * 1.1f;
else if (NPC.velocity.Y > targetY)
NPC.velocity.Y -= speedCopy * 1.1f;
if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < fallSpeed * 0.5)
{
if (NPC.velocity.X > 0f)
NPC.velocity.X += num37;
NPC.velocity.X += speedCopy;
else
NPC.velocity.X -= num37;
NPC.velocity.X -= speedCopy;
}
}
}
NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2;
if (flag2)
if (shouldFly)
{
if (NPC.localAI[0] != 1f)
NPC.netUpdate = true;
@@ -423,17 +423,17 @@ namespace CalamityMod.NPCs.Perforator
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/Perforator/PerforatorHeadMediumGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f);
Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
+114 -114
View File
@@ -157,10 +157,10 @@ namespace CalamityMod.NPCs.Perforator
{
int Previous = NPC.whoAmI;
int maxLength = death ? 9 : revenge ? 8 : expertMode ? 7 : 5;
for (int num36 = 0; num36 < maxLength; num36++)
for (int segments = 0; segments < maxLength; segments++)
{
int lol;
if (num36 >= 0 && num36 < maxLength - 1)
if (segments >= 0 && segments < maxLength - 1)
{
lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.position.X + (NPC.width / 2), (int)NPC.position.Y + (NPC.height / 2), ModContent.NPCType<PerforatorBodySmall>(), NPC.whoAmI);
}
@@ -179,32 +179,32 @@ namespace CalamityMod.NPCs.Perforator
}
}
int num12 = (int)(NPC.position.X / 16f) - 1;
int num13 = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2;
int num14 = (int)(NPC.position.Y / 16f) - 1;
int num15 = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2;
if (num12 < 0)
int tilePositionX = (int)(NPC.position.X / 16f) - 1;
int tileWidthPosX = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2;
int tilePositionY = (int)(NPC.position.Y / 16f) - 1;
int tileWidthPosY = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2;
if (tilePositionX < 0)
{
num12 = 0;
tilePositionX = 0;
}
if (num13 > Main.maxTilesX)
if (tileWidthPosX > Main.maxTilesX)
{
num13 = Main.maxTilesX;
tileWidthPosX = Main.maxTilesX;
}
if (num14 < 0)
if (tilePositionY < 0)
{
num14 = 0;
tilePositionY = 0;
}
if (num15 > Main.maxTilesY)
if (tileWidthPosY > Main.maxTilesY)
{
num15 = Main.maxTilesY;
tileWidthPosY = Main.maxTilesY;
}
bool flag2 = false;
if (!flag2)
bool shouldFly = false;
if (!shouldFly)
{
for (int k = num12; k < num13; k++)
for (int k = tilePositionX; k < tileWidthPosX; k++)
{
for (int l = num14; l < num15; l++)
for (int l = tilePositionY; l < tileWidthPosY; l++)
{
if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[k, l].TileType] || (Main.tileSolidTop[(int)Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64))
{
@@ -213,36 +213,36 @@ namespace CalamityMod.NPCs.Perforator
vector2.Y = (float)(l * 16);
if (NPC.position.X + (float)NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + (float)NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f)
{
flag2 = true;
shouldFly = true;
break;
}
}
}
}
}
if (!flag2)
if (!shouldFly)
{
NPC.localAI[1] = 1f;
Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height);
int num16 = death ? 160 : revenge ? 200 : expertMode ? 240 : 300;
bool flag3 = true;
int stopFlyingRadius = death ? 160 : revenge ? 200 : expertMode ? 240 : 300;
bool outsideFlyRadius = true;
if (NPC.position.Y > player.position.Y)
{
for (int m = 0; m < 255; m++)
{
if (Main.player[m].active)
{
Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num16, (int)Main.player[m].position.Y - num16, num16 * 2, num16 * 2);
Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - stopFlyingRadius, (int)Main.player[m].position.Y - stopFlyingRadius, stopFlyingRadius * 2, stopFlyingRadius * 2);
if (rectangle.Intersects(rectangle2))
{
flag3 = false;
outsideFlyRadius = false;
break;
}
}
}
if (flag3)
if (outsideFlyRadius)
{
flag2 = true;
shouldFly = true;
}
}
}
@@ -250,15 +250,15 @@ namespace CalamityMod.NPCs.Perforator
{
NPC.localAI[1] = 0f;
}
float num17 = 16f;
float maxChargeSpeed = 16f;
if (player.dead || CalamityGlobalNPC.perfHive < 0 || !Main.npc[CalamityGlobalNPC.perfHive].active)
{
flag2 = false;
shouldFly = false;
NPC.velocity.Y += 1f;
if ((double)NPC.position.Y > Main.worldSurface * 16.0)
{
NPC.velocity.Y += 1f;
num17 = 32f;
maxChargeSpeed = 32f;
}
if ((double)NPC.position.Y > Main.rockLayer * 16.0)
{
@@ -279,7 +279,7 @@ namespace CalamityMod.NPCs.Perforator
//GFB movement
if (NPC.ai[0] >= 300f && CalamityGlobalNPC.perfHive >= 0)
{
flag2 = false;
shouldFly = false;
NPC Hive = Main.npc[CalamityGlobalNPC.perfHive];
Vector2 targetDistance = Hive.Center - NPC.Center;
@@ -304,57 +304,57 @@ namespace CalamityMod.NPCs.Perforator
//Normal movement
else
{
float num18 = speed;
float num19 = turnSpeed;
Vector2 vector3 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float num20 = player.position.X + (float)(player.width / 2);
float num21 = player.position.Y + (float)(player.height / 2);
num20 = (float)((int)(num20 / 16f) * 16);
num21 = (float)((int)(num21 / 16f) * 16);
vector3.X = (float)((int)(vector3.X / 16f) * 16);
vector3.Y = (float)((int)(vector3.Y / 16f) * 16);
num20 -= vector3.X;
num21 -= vector3.Y;
float num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21));
if (!flag2)
float speedCopy = speed;
float turnSpeedCopy = turnSpeed;
Vector2 npcCenter = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float targetX = player.position.X + (float)(player.width / 2);
float targetY = player.position.Y + (float)(player.height / 2);
targetX = (float)((int)(targetX / 16f) * 16);
targetY = (float)((int)(targetY / 16f) * 16);
npcCenter.X = (float)((int)(npcCenter.X / 16f) * 16);
npcCenter.Y = (float)((int)(npcCenter.Y / 16f) * 16);
targetX -= npcCenter.X;
targetY -= npcCenter.Y;
float targetDistance = (float)Math.Sqrt((double)(targetX * targetX + targetY * targetY));
if (!shouldFly)
{
NPC.TargetClosest(true);
NPC.velocity.Y = NPC.velocity.Y + 0.15f;
if (NPC.velocity.Y > num17)
if (NPC.velocity.Y > maxChargeSpeed)
{
NPC.velocity.Y = num17;
NPC.velocity.Y = maxChargeSpeed;
}
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.4)
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.4)
{
if (NPC.velocity.X < 0f)
{
NPC.velocity.X = NPC.velocity.X - num18 * 1.1f;
NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f;
}
else
{
NPC.velocity.X = NPC.velocity.X + num18 * 1.1f;
NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f;
}
}
else if (NPC.velocity.Y == num17)
else if (NPC.velocity.Y == maxChargeSpeed)
{
if (NPC.velocity.X < num20)
if (NPC.velocity.X < targetX)
{
NPC.velocity.X = NPC.velocity.X + num18;
NPC.velocity.X = NPC.velocity.X + speedCopy;
}
else if (NPC.velocity.X > num20)
else if (NPC.velocity.X > targetX)
{
NPC.velocity.X = NPC.velocity.X - num18;
NPC.velocity.X = NPC.velocity.X - speedCopy;
}
}
else if (NPC.velocity.Y > 4f)
{
if (NPC.velocity.X < 0f)
{
NPC.velocity.X = NPC.velocity.X + num18 * 0.9f;
NPC.velocity.X = NPC.velocity.X + speedCopy * 0.9f;
}
else
{
NPC.velocity.X = NPC.velocity.X - num18 * 0.9f;
NPC.velocity.X = NPC.velocity.X - speedCopy * 0.9f;
}
}
}
@@ -362,132 +362,132 @@ namespace CalamityMod.NPCs.Perforator
{
if (NPC.soundDelay == 0)
{
float num24 = num22 / 40f;
if (num24 < 10f)
float soundDelay = targetDistance / 40f;
if (soundDelay < 10f)
{
num24 = 10f;
soundDelay = 10f;
}
if (num24 > 20f)
if (soundDelay > 20f)
{
num24 = 20f;
soundDelay = 20f;
}
NPC.soundDelay = (int)num24;
NPC.soundDelay = (int)soundDelay;
SoundEngine.PlaySound(SoundID.WormDig, NPC.Center);
}
num22 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21));
float num25 = Math.Abs(num20);
float num26 = Math.Abs(num21);
float num27 = num17 / num22;
num20 *= num27;
num21 *= num27;
if (((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f)) && ((NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f)))
targetDistance = (float)Math.Sqrt((double)(targetX * targetX + targetY * targetY));
float absoluteTargetX = Math.Abs(targetX);
float absoluteTargetY = Math.Abs(targetY);
float timeToReachTarget = maxChargeSpeed / targetDistance;
targetX *= timeToReachTarget;
targetY *= timeToReachTarget;
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 < num20)
if (NPC.velocity.X < targetX)
{
NPC.velocity.X = NPC.velocity.X + num19;
NPC.velocity.X = NPC.velocity.X + turnSpeedCopy;
}
else if (NPC.velocity.X > num20)
else if (NPC.velocity.X > targetX)
{
NPC.velocity.X = NPC.velocity.X - num19;
NPC.velocity.X = NPC.velocity.X - turnSpeedCopy;
}
if (NPC.velocity.Y < num21)
if (NPC.velocity.Y < targetY)
{
NPC.velocity.Y = NPC.velocity.Y + num19;
NPC.velocity.Y = NPC.velocity.Y + turnSpeedCopy;
}
else if (NPC.velocity.Y > num21)
else if (NPC.velocity.Y > targetY)
{
NPC.velocity.Y = NPC.velocity.Y - num19;
NPC.velocity.Y = NPC.velocity.Y - turnSpeedCopy;
}
}
if ((NPC.velocity.X > 0f && num20 > 0f) || (NPC.velocity.X < 0f && num20 < 0f) || (NPC.velocity.Y > 0f && num21 > 0f) || (NPC.velocity.Y < 0f && num21 < 0f))
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 < num20)
if (NPC.velocity.X < targetX)
{
NPC.velocity.X = NPC.velocity.X + num18;
NPC.velocity.X = NPC.velocity.X + speedCopy;
}
else if (NPC.velocity.X > num20)
else if (NPC.velocity.X > targetX)
{
NPC.velocity.X = NPC.velocity.X - num18;
NPC.velocity.X = NPC.velocity.X - speedCopy;
}
if (NPC.velocity.Y < num21)
if (NPC.velocity.Y < targetY)
{
NPC.velocity.Y = NPC.velocity.Y + num18;
NPC.velocity.Y = NPC.velocity.Y + speedCopy;
}
else if (NPC.velocity.Y > num21)
else if (NPC.velocity.Y > targetY)
{
NPC.velocity.Y = NPC.velocity.Y - num18;
NPC.velocity.Y = NPC.velocity.Y - speedCopy;
}
if ((double)Math.Abs(num21) < (double)num17 * 0.2 && ((NPC.velocity.X > 0f && num20 < 0f) || (NPC.velocity.X < 0f && num20 > 0f)))
if ((double)Math.Abs(targetY) < (double)maxChargeSpeed * 0.2 && ((NPC.velocity.X > 0f && targetX < 0f) || (NPC.velocity.X < 0f && targetX > 0f)))
{
if (NPC.velocity.Y > 0f)
{
NPC.velocity.Y = NPC.velocity.Y + num18 * 2f;
NPC.velocity.Y = NPC.velocity.Y + speedCopy * 2f;
}
else
{
NPC.velocity.Y = NPC.velocity.Y - num18 * 2f;
NPC.velocity.Y = NPC.velocity.Y - speedCopy * 2f;
}
}
if ((double)Math.Abs(num20) < (double)num17 * 0.2 && ((NPC.velocity.Y > 0f && num21 < 0f) || (NPC.velocity.Y < 0f && num21 > 0f)))
if ((double)Math.Abs(targetX) < (double)maxChargeSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetY < 0f) || (NPC.velocity.Y < 0f && targetY > 0f)))
{
if (NPC.velocity.X > 0f)
{
NPC.velocity.X = NPC.velocity.X + num18 * 2f;
NPC.velocity.X = NPC.velocity.X + speedCopy * 2f;
}
else
{
NPC.velocity.X = NPC.velocity.X - num18 * 2f;
NPC.velocity.X = NPC.velocity.X - speedCopy * 2f;
}
}
}
else if (num25 > num26)
else if (absoluteTargetX > absoluteTargetY)
{
if (NPC.velocity.X < num20)
if (NPC.velocity.X < targetX)
{
NPC.velocity.X = NPC.velocity.X + num18 * 1.1f;
NPC.velocity.X = NPC.velocity.X + speedCopy * 1.1f;
}
else if (NPC.velocity.X > num20)
else if (NPC.velocity.X > targetX)
{
NPC.velocity.X = NPC.velocity.X - num18 * 1.1f;
NPC.velocity.X = NPC.velocity.X - speedCopy * 1.1f;
}
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5)
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.5)
{
if (NPC.velocity.Y > 0f)
{
NPC.velocity.Y = NPC.velocity.Y + num18;
NPC.velocity.Y = NPC.velocity.Y + speedCopy;
}
else
{
NPC.velocity.Y = NPC.velocity.Y - num18;
NPC.velocity.Y = NPC.velocity.Y - speedCopy;
}
}
}
else
{
if (NPC.velocity.Y < num21)
if (NPC.velocity.Y < targetY)
{
NPC.velocity.Y = NPC.velocity.Y + num18 * 1.1f;
NPC.velocity.Y = NPC.velocity.Y + speedCopy * 1.1f;
}
else if (NPC.velocity.Y > num21)
else if (NPC.velocity.Y > targetY)
{
NPC.velocity.Y = NPC.velocity.Y - num18 * 1.1f;
NPC.velocity.Y = NPC.velocity.Y - speedCopy * 1.1f;
}
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)num17 * 0.5)
if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChargeSpeed * 0.5)
{
if (NPC.velocity.X > 0f)
{
NPC.velocity.X = NPC.velocity.X + num18;
NPC.velocity.X = NPC.velocity.X + speedCopy;
}
else
{
NPC.velocity.X = NPC.velocity.X - num18;
NPC.velocity.X = NPC.velocity.X - speedCopy;
}
}
}
}
}
NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f;
if (flag2)
if (shouldFly)
{
if (NPC.localAI[0] != 1f)
{
@@ -519,17 +519,17 @@ namespace CalamityMod.NPCs.Perforator
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 glowmaskDrawLocation = NPC.Center - screenPos;
glowmaskDrawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
glowmaskDrawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, glowmaskDrawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/Perforator/PerforatorHeadSmallGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f);
Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, glowmaskDrawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
+49 -49
View File
@@ -240,8 +240,8 @@ namespace CalamityMod.NPCs.Perforator
{
if (Main.netMode != NetmodeID.MultiplayerClient)
{
int num660 = (int)(NPC.lifeMax * (Main.getGoodWorld ? 0.15 : 0.25));
if ((NPC.life + num660) < NPC.ai[3])
int wormSpawnGateValue = (int)(NPC.lifeMax * (Main.getGoodWorld ? 0.15 : 0.25));
if ((NPC.life + wormSpawnGateValue) < NPC.ai[3])
{
NPC.ai[3] = NPC.life;
int wormType = ModContent.NPCType<PerforatorHeadSmall>();
@@ -276,24 +276,24 @@ namespace CalamityMod.NPCs.Perforator
SoundEngine.PlaySound(SoundID.NPCDeath23, NPC.Center);
for (int num621 = 0; num621 < 16; num621++)
for (int i = 0; i < 16; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f);
Main.dust[num622].velocity *= 2f;
int ichorDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f);
Main.dust[ichorDust].velocity *= 2f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.25f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[ichorDust].scale = 0.25f;
Main.dust[ichorDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 32; num623++)
for (int j = 0; j < 32; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1.5f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 3f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1f);
Main.dust[num624].velocity *= 2f;
int bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1.5f);
Main.dust[bloodDust].noGravity = true;
Main.dust[bloodDust].velocity *= 3f;
bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1f);
Main.dust[bloodDust].velocity *= 2f;
}
}
}
@@ -329,16 +329,16 @@ namespace CalamityMod.NPCs.Perforator
SoundEngine.PlaySound(SoundID.NPCDeath23, NPC.Center);
for (int num621 = 0; num621 < 32; num621++)
for (int i = 0; i < 32; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f);
float dustVelocityYAdd = Math.Abs(Main.dust[num622].velocity.Y) * 0.5f;
if (Main.dust[num622].velocity.Y < 0f)
Main.dust[num622].velocity.Y = 2f + dustVelocityYAdd;
int ichorDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f);
float dustVelocityYAdd = Math.Abs(Main.dust[ichorDust].velocity.Y) * 0.5f;
if (Main.dust[ichorDust].velocity.Y < 0f)
Main.dust[ichorDust].velocity.Y = 2f + dustVelocityYAdd;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.25f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[ichorDust].scale = 0.25f;
Main.dust[ichorDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
@@ -393,24 +393,24 @@ namespace CalamityMod.NPCs.Perforator
NPC.localAI[0] = 0f;
SoundEngine.PlaySound(SoundID.NPCHit20, NPC.Center);
for (int num621 = 0; num621 < 8; num621++)
for (int i = 0; i < 8; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f);
Main.dust[num622].velocity *= 3f;
int ichorDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 170, 0f, 0f, 100, default, 1f);
Main.dust[ichorDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.25f;
Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
Main.dust[ichorDust].scale = 0.25f;
Main.dust[ichorDust].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 16; num623++)
for (int j = 0; j < 16; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1.5f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1f);
Main.dust[num624].velocity *= 2f;
int bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1.5f);
Main.dust[bloodDust].noGravity = true;
Main.dust[bloodDust].velocity *= 5f;
bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 1f);
Main.dust[bloodDust].velocity *= 2f;
}
int type = Main.rand.NextBool() ? ModContent.ProjectileType<IchorShot>() : ModContent.ProjectileType<BloodGeyser>();
@@ -487,17 +487,17 @@ namespace CalamityMod.NPCs.Perforator
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2));
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2));
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/Perforator/PerforatorHiveGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f);
Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
@@ -609,23 +609,23 @@ namespace CalamityMod.NPCs.Perforator
NPC.height = 100;
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2);
for (int num621 = 0; num621 < 40; num621++)
for (int i = 0; i < 40; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int ichorDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f);
Main.dust[ichorDust].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[ichorDust].scale = 0.5f;
Main.dust[ichorDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int num623 = 0; num623 < 70; num623++)
for (int j = 0; j < 70; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
int bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 3f);
Main.dust[bloodDust].noGravity = true;
Main.dust[bloodDust].velocity *= 5f;
bloodDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 5, 0f, 0f, 100, default, 2f);
Main.dust[bloodDust].velocity *= 2f;
}
}
}
+30 -30
View File
@@ -102,40 +102,40 @@ namespace CalamityMod.NPCs.Perforator
if (Main.player[NPC.target].dead)
NPC.TargetClosest(false);
Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
num191 = (float)((int)(num191 / 16f) * 16);
num192 = (float)((int)(num192 / 16f) * 16);
vector18.X = (float)((int)(vector18.X / 16f) * 16);
vector18.Y = (float)((int)(vector18.Y / 16f) * 16);
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float targetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float targetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
targetX = (float)((int)(targetX / 16f) * 16);
targetY = (float)((int)(targetY / 16f) * 16);
segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16);
segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16);
targetX -= segmentPosition.X;
targetY -= segmentPosition.Y;
float targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY));
if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length)
{
try
{
vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X;
num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y;
segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
targetX = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X;
targetY = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y;
}
catch
{
}
NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f;
num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
int num194 = NPC.width;
num193 = (num193 - (float)num194) / num193;
num191 *= num193;
num192 *= num193;
NPC.rotation = (float)System.Math.Atan2((double)targetY, (double)targetX) + 1.57f;
targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY));
int npcWidth = NPC.width;
targetDistance = (targetDistance - (float)npcWidth) / targetDistance;
targetX *= targetDistance;
targetY *= targetDistance;
NPC.velocity = Vector2.Zero;
NPC.position.X = NPC.position.X + num191;
NPC.position.Y = NPC.position.Y + num192;
NPC.position.X = NPC.position.X + targetX;
NPC.position.Y = NPC.position.Y + targetY;
if (num191 < 0f)
if (targetX < 0f)
NPC.spriteDirection = 1;
else if (num191 > 0f)
else if (targetX > 0f)
NPC.spriteDirection = -1;
}
}
@@ -147,17 +147,17 @@ namespace CalamityMod.NPCs.Perforator
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/Perforator/PerforatorTailLargeGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f);
Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
+29 -29
View File
@@ -102,40 +102,40 @@ namespace CalamityMod.NPCs.Perforator
NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0);
}
Vector2 vector2 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float num39 = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2);
float num40 = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2);
Vector2 segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
float targetX = Main.player[NPC.target].position.X + (Main.player[NPC.target].width / 2);
float targetY = Main.player[NPC.target].position.Y + (Main.player[NPC.target].height / 2);
num39 = (int)(num39 / 16f) * 16;
num40 = (int)(num40 / 16f) * 16;
vector2.X = (int)(vector2.X / 16f) * 16;
vector2.Y = (int)(vector2.Y / 16f) * 16;
num39 -= vector2.X;
num40 -= vector2.Y;
float num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40);
targetX = (int)(targetX / 16f) * 16;
targetY = (int)(targetY / 16f) * 16;
segmentDirection.X = (int)(segmentDirection.X / 16f) * 16;
segmentDirection.Y = (int)(segmentDirection.Y / 16f) * 16;
targetX -= segmentDirection.X;
targetY -= segmentDirection.Y;
float targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY);
if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length)
{
try
{
vector2 = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
num39 = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - vector2.X;
num40 = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - vector2.Y;
segmentDirection = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f);
targetX = Main.npc[(int)NPC.ai[1]].position.X + (Main.npc[(int)NPC.ai[1]].width / 2) - segmentDirection.X;
targetY = Main.npc[(int)NPC.ai[1]].position.Y + (Main.npc[(int)NPC.ai[1]].height / 2) - segmentDirection.Y;
}
catch
{
}
NPC.rotation = (float)Math.Atan2(num40, num39) + MathHelper.PiOver2;
num52 = (float)Math.Sqrt(num39 * num39 + num40 * num40);
int num53 = NPC.width;
num53 = (int)(num53 * NPC.scale);
num52 = (num52 - num53) / num52;
num39 *= num52;
num40 *= num52;
NPC.rotation = (float)Math.Atan2(targetY, targetX) + MathHelper.PiOver2;
targetDistance = (float)Math.Sqrt(targetX * targetX + targetY * targetY);
int npcWidth = NPC.width;
npcWidth = (int)(npcWidth * NPC.scale);
targetDistance = (targetDistance - npcWidth) / targetDistance;
targetX *= targetDistance;
targetY *= targetDistance;
NPC.velocity = Vector2.Zero;
NPC.position.X += num39;
NPC.position.Y += num40;
NPC.position.X += targetX;
NPC.position.Y += targetY;
}
}
@@ -146,17 +146,17 @@ namespace CalamityMod.NPCs.Perforator
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/Perforator/PerforatorTailMediumGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f);
Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
+30 -30
View File
@@ -102,40 +102,40 @@ namespace CalamityMod.NPCs.Perforator
if (Main.player[NPC.target].dead)
NPC.TargetClosest(false);
Vector2 vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float num191 = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float num192 = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
num191 = (float)((int)(num191 / 16f) * 16);
num192 = (float)((int)(num192 / 16f) * 16);
vector18.X = (float)((int)(vector18.X / 16f) * 16);
vector18.Y = (float)((int)(vector18.Y / 16f) * 16);
num191 -= vector18.X;
num192 -= vector18.Y;
float num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
float targetX = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2);
float targetY = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2);
targetX = (float)((int)(targetX / 16f) * 16);
targetY = (float)((int)(targetY / 16f) * 16);
segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16);
segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16);
targetX -= segmentPosition.X;
targetY -= segmentPosition.Y;
float targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY));
if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length)
{
try
{
vector18 = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
num191 = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - vector18.X;
num192 = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - vector18.Y;
segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f);
targetX = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X;
targetY = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y;
}
catch
{
}
NPC.rotation = (float)System.Math.Atan2((double)num192, (double)num191) + 1.57f;
num193 = (float)System.Math.Sqrt((double)(num191 * num191 + num192 * num192));
int num194 = NPC.width;
num193 = (num193 - (float)num194) / num193;
num191 *= num193;
num192 *= num193;
NPC.rotation = (float)System.Math.Atan2((double)targetY, (double)targetX) + 1.57f;
targetDistance = (float)System.Math.Sqrt((double)(targetX * targetX + targetY * targetY));
int npcWidth = NPC.width;
targetDistance = (targetDistance - (float)npcWidth) / targetDistance;
targetX *= targetDistance;
targetY *= targetDistance;
NPC.velocity = Vector2.Zero;
NPC.position.X = NPC.position.X + num191;
NPC.position.Y = NPC.position.Y + num192;
NPC.position.X = NPC.position.X + targetX;
NPC.position.Y = NPC.position.Y + targetY;
if (num191 < 0f)
if (targetX < 0f)
NPC.spriteDirection = 1;
else if (num191 > 0f)
else if (targetX > 0f)
NPC.spriteDirection = -1;
}
}
@@ -147,17 +147,17 @@ namespace CalamityMod.NPCs.Perforator
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / 2));
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/Perforator/PerforatorTailSmallGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Yellow, 0.5f);
Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
@@ -56,32 +56,32 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
if (Math.Abs(NPC.velocity.X) >= 3f || Math.Abs(NPC.velocity.Y) >= 3f)
{
float num247 = 0f;
float num248 = 0f;
float dustXOffset = 0f;
float dustYOffset = 0f;
if (Main.rand.NextBool())
{
num247 = NPC.velocity.X * 0.5f;
num248 = NPC.velocity.Y * 0.5f;
dustXOffset = NPC.velocity.X * 0.5f;
dustYOffset = NPC.velocity.Y * 0.5f;
}
int num249 = Dust.NewDust(new Vector2(NPC.position.X + 3f + num247, NPC.position.Y + 3f + num248) - NPC.velocity * 0.5f, NPC.width - 8, NPC.height - 8, 6, 0f, 0f, 100, default, 0.5f);
Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[num249].velocity *= 0.2f;
Main.dust[num249].noGravity = true;
num249 = Dust.NewDust(new Vector2(NPC.position.X + 3f + num247, NPC.position.Y + 3f + num248) - NPC.velocity * 0.5f, NPC.width - 8, NPC.height - 8, 31, 0f, 0f, 100, default, 0.25f);
Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[num249].velocity *= 0.05f;
int smokyFire = Dust.NewDust(new Vector2(NPC.position.X + 3f + dustXOffset, NPC.position.Y + 3f + dustYOffset) - NPC.velocity * 0.5f, NPC.width - 8, NPC.height - 8, 6, 0f, 0f, 100, default, 0.5f);
Main.dust[smokyFire].scale *= 2f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[smokyFire].velocity *= 0.2f;
Main.dust[smokyFire].noGravity = true;
smokyFire = Dust.NewDust(new Vector2(NPC.position.X + 3f + dustXOffset, NPC.position.Y + 3f + dustYOffset) - NPC.velocity * 0.5f, NPC.width - 8, NPC.height - 8, 31, 0f, 0f, 100, default, 0.25f);
Main.dust[smokyFire].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[smokyFire].velocity *= 0.05f;
}
else if (Main.rand.NextBool(4))
{
int num252 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 31, 0f, 0f, 100, default, 0.5f);
Main.dust[num252].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[num252].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[num252].noGravity = true;
Main.dust[num252].position = NPC.Center + new Vector2(0f, (float)(-(float)NPC.height / 2)).RotatedBy((double)NPC.rotation, default) * 1.1f;
num252 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 6, 0f, 0f, 100, default, 1f);
Main.dust[num252].scale = 1f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[num252].noGravity = true;
Main.dust[num252].position = NPC.Center + new Vector2(0f, (float)(-(float)NPC.height / 2 - 6)).RotatedBy((double)NPC.rotation, default) * 1.1f;
int smokyFire2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 31, 0f, 0f, 100, default, 0.5f);
Main.dust[smokyFire2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[smokyFire2].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[smokyFire2].noGravity = true;
Main.dust[smokyFire2].position = NPC.Center + new Vector2(0f, (float)(-(float)NPC.height / 2)).RotatedBy((double)NPC.rotation, default) * 1.1f;
smokyFire2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 6, 0f, 0f, 100, default, 1f);
Main.dust[smokyFire2].scale = 1f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[smokyFire2].noGravity = true;
Main.dust[smokyFire2].position = NPC.Center + new Vector2(0f, (float)(-(float)NPC.height / 2 - 6)).RotatedBy((double)NPC.rotation, default) * 1.1f;
}
NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2;
@@ -98,8 +98,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
NPC.ai[0] = 1f;
NPC.ai[1] = (float)Player.FindClosest(NPC.position, NPC.width, NPC.height);
NPC.netUpdate = true;
float num754 = NPC.velocity.Length();
NPC.velocity = Vector2.Normalize(NPC.velocity) * (num754 + 1f);
float npcSpeed = NPC.velocity.Length();
NPC.velocity = Vector2.Normalize(NPC.velocity) * (npcSpeed + 1f);
}
else if (NPC.ai[0] == 1f)
{
@@ -117,9 +117,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
{
NPC.noTileCollide = true;
Vector2 v3 = Main.player[(int)NPC.ai[1]].Center - NPC.Center;
float num760 = NPC.velocity.ToRotation();
float num761 = v3.ToRotation();
float angle = num761 - num760;
float facingDirection = NPC.velocity.ToRotation();
float playerDirection = v3.ToRotation();
float angle = playerDirection - facingDirection;
angle = MathHelper.WrapAngle(angle);
NPC.velocity = NPC.velocity.RotatedBy(angle * 0.2);
}
@@ -159,49 +159,47 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value;
Vector2 vector11 = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2));
Color color36 = Color.White;
float amount9 = 0.5f;
int num153 = 5;
Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2));
int afterimageAmt = 5;
if (CalamityConfig.Instance.Afterimages)
{
for (int num155 = 1; num155 < num153; num155 += 2)
for (int i = 1; i < afterimageAmt; i += 2)
{
Color color38 = drawColor;
color38 = Color.Lerp(color38, color36, amount9);
color38 = NPC.GetAlpha(color38);
color38 *= (float)(num153 - num155) / 15f;
Vector2 vector41 = NPC.oldPos[num155] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector41 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector41, NPC.frame, color38, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color afterimageColor = drawColor;
afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f);
afterimageColor = NPC.GetAlpha(afterimageColor);
afterimageColor *= (float)(afterimageAmt - i) / 15f;
Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
Vector2 vector43 = NPC.Center - screenPos;
vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector43 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector43, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Vector2 drawLocation = NPC.Center - screenPos;
drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
texture2D15 = ModContent.Request<Texture2D>("CalamityMod/NPCs/PlaguebringerGoliath/PlagueHomingMissileGlow").Value;
Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f);
Color redLerpColor = Color.Lerp(Color.White, Color.Red, 0.5f);
if (CalamityConfig.Instance.Afterimages)
{
for (int num163 = 1; num163 < num153; num163++)
for (int j = 1; j < afterimageAmt; j++)
{
Color color41 = color37;
color41 = Color.Lerp(color41, color36, amount9);
color41 *= (float)(num153 - num163) / 15f;
Vector2 vector44 = NPC.oldPos[num163] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
vector44 += vector11 * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, vector44, NPC.frame, color41, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
Color secondAfterimageColor = redLerpColor;
secondAfterimageColor = Color.Lerp(secondAfterimageColor, Color.White, 0.5f);
secondAfterimageColor *= (float)(afterimageAmt - j) / 15f;
Vector2 secondAfterimagePos = NPC.oldPos[j] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos;
secondAfterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f;
secondAfterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY);
spriteBatch.Draw(texture2D15, secondAfterimagePos, NPC.frame, secondAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
}
}
spriteBatch.Draw(texture2D15, vector43, NPC.frame, color37, NPC.rotation, vector11, NPC.scale, spriteEffects, 0f);
spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, redLerpColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f);
return false;
}
@@ -222,25 +220,25 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath
NPC.width = NPC.height = Main.zenithWorld ? 300 : 216;
NPC.position.X = NPC.position.X - (float)(NPC.width / 2);
NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2);
for (int num621 = 0; num621 < 15; num621++)
for (int i = 0; i < 15; i++)
{
int num622 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f);
Main.dust[num622].velocity *= 3f;
int greenPlague = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f);
Main.dust[greenPlague].velocity *= 3f;
if (Main.rand.NextBool())
{
Main.dust[num622].scale = 0.5f;
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[greenPlague].scale = 0.5f;
Main.dust[greenPlague].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
Main.dust[num622].noGravity = true;
Main.dust[greenPlague].noGravity = true;
}
for (int num623 = 0; num623 < 30; num623++)
for (int j = 0; j < 30; j++)
{
int num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 3f);
Main.dust[num624].noGravity = true;
Main.dust[num624].velocity *= 5f;
num624 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f);
Main.dust[num624].velocity *= 2f;
Main.dust[num624].noGravity = true;
int greenPlague2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 3f);
Main.dust[greenPlague2].noGravity = true;
Main.dust[greenPlague2].velocity *= 5f;
greenPlague2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y), NPC.width, NPC.height, 89, 0f, 0f, 100, default, 2f);
Main.dust[greenPlague2].velocity *= 2f;
Main.dust[greenPlague2].noGravity = true;
}
return true;
}
Loaded 100 of 808 files, more files were not shown because too many files have changed in this diff. Show more