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
/Properties
*.csproj
/.idea

View File

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

View File

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