Fixed the core spider didn't shoot in the right direction.
This commit is contained in:
parent
543a683b6c
commit
3a9de1cc98
@ -10,32 +10,32 @@ namespace Decimation.Content.NPCs
|
|||||||
// Check line 43861 of NPC.cs
|
// Check line 43861 of NPC.cs
|
||||||
internal class CoreSpider : ModNPC
|
internal class CoreSpider : ModNPC
|
||||||
{
|
{
|
||||||
private int _frame;
|
|
||||||
private readonly int shootFrame = 120;
|
private readonly int shootFrame = 120;
|
||||||
|
private int _frame;
|
||||||
|
|
||||||
public override void SetStaticDefaults()
|
public override void SetStaticDefaults()
|
||||||
{
|
{
|
||||||
this.DisplayName.SetDefault("Core Spider");
|
DisplayName.SetDefault("Core Spider");
|
||||||
Main.npcFrameCount[this.npc.type] = 8;
|
Main.npcFrameCount[npc.type] = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetDefaults()
|
public override void SetDefaults()
|
||||||
{
|
{
|
||||||
this.npc.CloneDefaults(NPCID.BlackRecluse);
|
npc.CloneDefaults(NPCID.BlackRecluse);
|
||||||
this.npc.width = 84;
|
npc.width = 84;
|
||||||
this.npc.height = 24;
|
npc.height = 24;
|
||||||
this.npc.lifeMax = 750;
|
npc.lifeMax = 750;
|
||||||
animationType = NPCID.BlackRecluse;
|
animationType = NPCID.BlackRecluse;
|
||||||
|
|
||||||
this.npc.lavaImmune = true;
|
npc.lavaImmune = true;
|
||||||
this.npc.buffImmune[BuffID.OnFire] = true;
|
npc.buffImmune[BuffID.OnFire] = true;
|
||||||
this.npc.buffImmune[BuffID.Burning] = true;
|
npc.buffImmune[BuffID.Burning] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AI()
|
public override void AI()
|
||||||
{
|
{
|
||||||
int x = (int) this.npc.Center.X / 16;
|
int x = (int) npc.Center.X / 16;
|
||||||
int y = (int) this.npc.Center.Y / 16;
|
int y = (int) npc.Center.Y / 16;
|
||||||
bool onWall = false;
|
bool onWall = false;
|
||||||
for (int i = x - 1; i <= x + 1; i++)
|
for (int i = x - 1; i <= x + 1; i++)
|
||||||
for (int j = y - 1; j <= y + 1; j++)
|
for (int j = y - 1; j <= y + 1; j++)
|
||||||
@ -48,15 +48,10 @@ namespace Decimation.Content.NPCs
|
|||||||
{
|
{
|
||||||
if (Main.rand.Next(4) == 0)
|
if (Main.rand.Next(4) == 0)
|
||||||
{
|
{
|
||||||
float mouthX = (float) (this.npc.height / 2f * Math.Cos(this.npc.rotation - Math.PI * 0.5f)) +
|
Vector2 mouthPos = npc.Center + new Vector2(npc.width / 2f, 0).RotatedBy(npc.rotation);
|
||||||
this.npc.Center.X;
|
Vector2 projSpeed = new Vector2(5, 0).RotatedBy(npc.rotation);
|
||||||
float mouthY = (float) (this.npc.height / 2f * Math.Sin(this.npc.rotation - Math.PI * 0.5f)) +
|
|
||||||
this.npc.Center.Y;
|
|
||||||
float speedX = (float) (3 * Math.Cos(this.npc.rotation - Math.PI)) * 2;
|
|
||||||
float speedY = (float) (3 * Math.Sin(this.npc.rotation - Math.PI)) * 2;
|
|
||||||
|
|
||||||
Projectile.NewProjectile(new Vector2(mouthX, mouthY), new Vector2(speedX, speedY),
|
Projectile.NewProjectile(mouthPos, projSpeed, ProjectileID.Fireball, 130, 30);
|
||||||
ProjectileID.Fireball, 130, 30);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_frame = 0;
|
_frame = 0;
|
||||||
@ -68,7 +63,7 @@ namespace Decimation.Content.NPCs
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (onWall)
|
if (onWall)
|
||||||
this.npc.Transform(ModContent.NPCType<CoreSpiderWall>());
|
npc.Transform(ModContent.NPCType<CoreSpiderWall>());
|
||||||
else
|
else
|
||||||
base.AI();
|
base.AI();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,17 @@
|
|||||||
using Terraria;
|
using Decimation.Content.Tiles.ShrineoftheMoltenOne;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Terraria;
|
||||||
using Terraria.ID;
|
using Terraria.ID;
|
||||||
using Terraria.ModLoader;
|
using Terraria.ModLoader;
|
||||||
using System;
|
|
||||||
using Decimation.Content.Tiles.ShrineoftheMoltenOne;
|
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
|
|
||||||
namespace Decimation.Content.NPCs
|
namespace Decimation.Content.NPCs
|
||||||
{
|
{
|
||||||
// Check line 43861 of NPC.cs
|
// Check line 43861 of NPC.cs
|
||||||
class CoreSpiderWall : ModNPC
|
internal class CoreSpiderWall : ModNPC
|
||||||
{
|
{
|
||||||
|
private int frame;
|
||||||
|
private readonly int shootFrame = 120;
|
||||||
|
|
||||||
public override void SetStaticDefaults()
|
public override void SetStaticDefaults()
|
||||||
{
|
{
|
||||||
DisplayName.SetDefault("Core Spider");
|
DisplayName.SetDefault("Core Spider");
|
||||||
@ -29,24 +31,15 @@ namespace Decimation.Content.NPCs
|
|||||||
npc.buffImmune[BuffID.Burning] = true;
|
npc.buffImmune[BuffID.Burning] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int frame = 0;
|
|
||||||
int shootFrame = 120;
|
|
||||||
|
|
||||||
public override void AI()
|
public override void AI()
|
||||||
{
|
{
|
||||||
int x = (int)npc.Center.X / 16;
|
int x = (int) npc.Center.X / 16;
|
||||||
int y = (int)npc.Center.Y / 16;
|
int y = (int) npc.Center.Y / 16;
|
||||||
bool onWall = true;
|
bool onWall = true;
|
||||||
for (int i = x - 1; i <= x + 1; i++)
|
for (int i = x - 1; i <= x + 1; i++)
|
||||||
{
|
for (int j = y - 1; j <= y + 1; j++)
|
||||||
for (int j = y - 1; j <= y + 1; j++)
|
if (Main.tile[i, j].wall <= 0)
|
||||||
{
|
onWall = false;
|
||||||
if (Main.tile[i, j].wall <= 0)
|
|
||||||
{
|
|
||||||
onWall = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Main.expertMode)
|
if (Main.expertMode)
|
||||||
{
|
{
|
||||||
@ -54,12 +47,10 @@ namespace Decimation.Content.NPCs
|
|||||||
{
|
{
|
||||||
if (Main.rand.Next(3) == 0)
|
if (Main.rand.Next(3) == 0)
|
||||||
{
|
{
|
||||||
float mouthX = (float)(((npc.height) / 2) * Math.Cos(npc.rotation - Math.PI * 0.5f)) + npc.Center.X;
|
Vector2 mouthPos = npc.Center + new Vector2(npc.width / 2f, 0).RotatedBy(npc.rotation);
|
||||||
float mouthY = (float)(((npc.height) / 2) * Math.Sin(npc.rotation - Math.PI * 0.5f)) + npc.Center.Y;
|
Vector2 projSpeed = new Vector2(5, 0).RotatedBy(npc.rotation);
|
||||||
float speedX = (float)(3 * Math.Cos(npc.rotation - Math.PI)) * 2;
|
|
||||||
float speedY = (float)(3 * Math.Sin(npc.rotation - Math.PI)) * 2;
|
|
||||||
|
|
||||||
Projectile.NewProjectile(new Vector2(mouthX, mouthY), new Vector2(speedX, speedY), ProjectileID.Fireball, 130, 30);
|
Projectile.NewProjectile(mouthPos, projSpeed, ProjectileID.Fireball, 130, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
frame = 0;
|
frame = 0;
|
||||||
@ -71,32 +62,26 @@ namespace Decimation.Content.NPCs
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!onWall)
|
if (!onWall)
|
||||||
{
|
|
||||||
npc.Transform(ModContent.NPCType<CoreSpider>());
|
npc.Transform(ModContent.NPCType<CoreSpider>());
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
base.AI();
|
base.AI();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CheckConditions(int left, int right, int top, int bottom)
|
public override bool CheckConditions(int left, int right, int top, int bottom)
|
||||||
{
|
{
|
||||||
int x = (int)Main.LocalPlayer.position.X / 16;
|
int x = (int) Main.LocalPlayer.position.X / 16;
|
||||||
int y = (int)Main.LocalPlayer.position.Y / 16;
|
int y = (int) Main.LocalPlayer.position.Y / 16;
|
||||||
|
|
||||||
int validBlockCount = 0;
|
int validBlockCount = 0;
|
||||||
for (int i = (int)(-50 + x / 16f); i <= (int)(50 + x / 16f); i++)
|
for (int i = (int) (-50 + x / 16f); i <= (int) (50 + x / 16f); i++)
|
||||||
{
|
for (int j = (int) (-50 + y / 16f); j <= (int) (50 + y / 16f); j++)
|
||||||
for (int j = (int)(-50 + y / 16f); j <= (int)(50 + y / 16f); j++)
|
if (i >= 0 && i <= Main.maxTilesX && j >= 0 && j <= Main.maxTilesY)
|
||||||
{
|
if (Main.tile[i, j].type == ModContent.TileType<ShrineBrick>() ||
|
||||||
if (i >= 0 && i <= Main.maxTilesX && j >= 0 && j <= Main.maxTilesY)
|
Main.tile[i, j].type == ModContent.TileType<LockedShrineDoor>() ||
|
||||||
{
|
Main.tile[i, j].type == ModContent.TileType<ShrineDoorClosed>() ||
|
||||||
if (Main.tile[i, j].type == ModContent.TileType<ShrineBrick>() || (Main.tile[i, j].type == ModContent.TileType<LockedShrineDoor>() || Main.tile[i, j].type == ModContent.TileType<ShrineDoorClosed>() || Main.tile[i, j].type == ModContent.TileType<ShrineDoorOpened>()) || Main.tile[i, j].type == ModContent.TileType<RedHotSpike>())
|
Main.tile[i, j].type == ModContent.TileType<ShrineDoorOpened>() ||
|
||||||
validBlockCount++;
|
Main.tile[i, j].type == ModContent.TileType<RedHotSpike>())
|
||||||
}
|
validBlockCount++;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return validBlockCount >= 15 && Main.hardMode;
|
return validBlockCount >= 15 && Main.hardMode;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user