Fixed Bloodshot Eye disappearing.

The Bloody Lunar Tablet can now be used the day.
This commit is contained in:
FyloZ 2020-06-04 17:17:01 -04:00
parent 05149c4341
commit 9c23e3284f
5 changed files with 678 additions and 666 deletions

2
.gitignore vendored
View File

@ -41,3 +41,5 @@
/bin /bin
/Properties /Properties
*.csproj *.csproj
/.idea

View File

@ -1,9 +1,4 @@
using System; using Terraria.ModLoader;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria.ModLoader;
using Terraria; using Terraria;
namespace Decimation.Content.Buffs namespace Decimation.Content.Buffs

View File

@ -24,12 +24,14 @@ namespace Decimation.Content.Items.Misc
public override bool CanUseItem(Player player) public override bool CanUseItem(Player player)
{ {
return !Main.dayTime && !Main.bloodMoon; return !Main.bloodMoon;
} }
public override bool UseItem(Player player) public override bool UseItem(Player player)
{ {
Main.bloodMoon = true; Main.bloodMoon = true;
Main.dayTime = false;
return true; return true;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,12 @@
using Microsoft.Xna.Framework; using System;
using System; using Microsoft.Xna.Framework;
using Terraria; using Terraria;
using Terraria.ID; using Terraria.ID;
using Terraria.ModLoader; using Terraria.ModLoader;
namespace Decimation.Content.NPCs.Bloodshot namespace Decimation.Content.NPCs.Bloodshot
{ {
class MangledServant : ModNPC internal class MangledServant : ModNPC
{ {
public override void SetDefaults() public override void SetDefaults()
{ {
@ -29,17 +29,15 @@ namespace Decimation.Content.NPCs.Bloodshot
public override void AI() public override void AI()
{ {
int bloodshotEye = (int)npc.ai[1]; int bloodshotEye = (int) npc.ai[1];
if (Main.GameUpdateCount % 60 == 0 && Main.expertMode) if (Main.GameUpdateCount % 60 == 0 && Main.expertMode)
{
if (Main.rand.NextBool(21)) if (Main.rand.NextBool(21))
{ {
npc.ai[3] = npc.ai[0]; npc.ai[3] = npc.ai[0];
npc.ai[2] = 0; npc.ai[2] = 0;
npc.ai[0] = 2f; npc.ai[0] = 2f;
} }
}
if (bloodshotEye < 0) if (bloodshotEye < 0)
{ {
@ -51,7 +49,7 @@ namespace Decimation.Content.NPCs.Bloodshot
Vector2 npcCenter = npc.Center; Vector2 npcCenter = npc.Center;
float diffX = Main.npc[bloodshotEye].Center.X - npcCenter.X; float diffX = Main.npc[bloodshotEye].Center.X - npcCenter.X;
float diffY = Main.npc[bloodshotEye].Center.Y - npcCenter.Y; float diffY = Main.npc[bloodshotEye].Center.Y - npcCenter.Y;
float magnitude = (float)Math.Sqrt((double)(diffX * diffX + diffY * diffY)); float magnitude = (float) Math.Sqrt(diffX * diffX + diffY * diffY);
if (magnitude > 90f) if (magnitude > 90f)
{ {
magnitude = 8f / magnitude; magnitude = 8f / magnitude;
@ -67,17 +65,15 @@ namespace Decimation.Content.NPCs.Bloodshot
npc.velocity.Y = npc.velocity.Y * 1.05f; npc.velocity.Y = npc.velocity.Y * 1.05f;
npc.velocity.X = npc.velocity.X * 1.05f; npc.velocity.X = npc.velocity.X * 1.05f;
} }
if (Main.netMode != 1) if (Main.netMode != 1)
{ {
if ((!Main.expertMode || Main.rand.Next(100) != 0) && Main.rand.Next(200) != 0) if ((!Main.expertMode || Main.rand.Next(100) != 0) && Main.rand.Next(200) != 0) return;
{ npc.TargetClosest();
return;
}
npc.TargetClosest(true);
npcCenter = new Vector2(npc.Center.X, npc.Center.Y); npcCenter = new Vector2(npc.Center.X, npc.Center.Y);
diffX = Main.player[npc.target].Center.X - npcCenter.X; diffX = Main.player[npc.target].Center.X - npcCenter.X;
diffY = Main.player[npc.target].Center.Y - npcCenter.Y; diffY = Main.player[npc.target].Center.Y - npcCenter.Y;
magnitude = (float)Math.Sqrt((double)(diffX * diffX + diffY * diffY)); magnitude = (float) Math.Sqrt(diffX * diffX + diffY * diffY);
magnitude = 8f / magnitude; magnitude = 8f / magnitude;
npc.velocity.X = diffX * magnitude; npc.velocity.X = diffX * magnitude;
npc.velocity.Y = diffY * magnitude; npc.velocity.Y = diffY * magnitude;
@ -95,14 +91,12 @@ namespace Decimation.Content.NPCs.Bloodshot
diff *= 9f; diff *= 9f;
npc.velocity = (npc.velocity * 99f + diff) / 100f; npc.velocity = (npc.velocity * 99f + diff) / 100f;
} }
Vector2 npcCenter = npc.Center; Vector2 npcCenter = npc.Center;
float diffX = Main.npc[bloodshotEye].Center.X - npcCenter.X; float diffX = Main.npc[bloodshotEye].Center.X - npcCenter.X;
float diffY = Main.npc[bloodshotEye].Center.Y - npcCenter.Y; float diffY = Main.npc[bloodshotEye].Center.Y - npcCenter.Y;
float magnitude = (float)Math.Sqrt((double)(diffX * diffX + diffY * diffY)); float magnitude = (float) Math.Sqrt(diffX * diffX + diffY * diffY);
if (!(magnitude > 700f) && !npc.justHit) if (!(magnitude > 700f) && !npc.justHit) return;
{
return;
}
npc.ai[0] = 0f; npc.ai[0] = 0f;
} }
else else
@ -121,8 +115,9 @@ namespace Decimation.Content.NPCs.Bloodshot
{ {
Vector2 cloudPosition = npc.position; Vector2 cloudPosition = npc.position;
cloudPosition.X += Main.rand.Next(npc.width / 2) + npc.width / 4; cloudPosition.X += Main.rand.Next(npc.width / 2) + npc.width / 4;
cloudPosition.Y += npc.height / 2; cloudPosition.Y += npc.height / 2f;
int proj = Projectile.NewProjectile(cloudPosition, new Vector2(0, 10), ProjectileID.BloodRain, Main.expertMode ? 14 : 7, 0); int proj = Projectile.NewProjectile(cloudPosition, new Vector2(0, 10), ProjectileID.BloodRain,
Main.expertMode ? 14 : 7, 0);
Main.projectile[proj].hostile = true; Main.projectile[proj].hostile = true;
Main.projectile[proj].friendly = false; Main.projectile[proj].friendly = false;
} }