using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
namespace TutorialMod.NPCs.Bosses
{
[AutoloadBossHead]
public class Godslayer : ModNPC
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Godslayer");
Main.npcFrameCount[npc.type] = 1;
}
public override void SetDefaults()
{
npc.width = 50;
npc.height = 111;
npc.aiStyle = -1;
npc.damage = 200;
npc.defense = 0;
npc.lifeMax = 128000;
npc.HitSound = SoundID.NPCHit1;
npc.DeathSound = SoundID.NPCDeath2; // Get New Death Sound
npc.knockBackResist = 0f;
npc.boss = true;
npc.npcSlots = 100f;
npc.lavaImmune = true;
npc.noTileCollide = true;
npc.noGravity = true;
music = MusicID.Boss2; // Get boss music here
bossBag = mod.ItemType("GodslayerTreasureBag");
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
{
npc.lifeMax = (int)(npc.lifeMax * bossLifeScale);
npc.damage = (int)(npc.damage * 1.3f);
}
public void AI()
{
npc.TargetClosest(true);
if (npc.ai[1] == 0) // First AI
{
if (Main.player[npc.target].position.X < npc.position.X)
{
if (npc.velocity.X > -8) npc.velocity.X -= 0.22f;
}
if (Main.player[npc.target].position.X > npc.position.X)
{
if (npc.velocity.X < 8) npc.velocity.X += 0.22f;
}
if (Main.player[npc.target].position.Y < npc.position.Y + 300)
{
if (npc.velocity.Y < 0)
{
if (npc.velocity.Y > -4) npc.velocity.Y -= 0.7f;
}
else npc.velocity.Y -= 0.8f;
}
if (Main.player[npc.target].position.Y > npc.position.Y + 300)
{
if (npc.velocity.Y > 0)
{
if (npc.velocity.Y < 4) npc.velocity.Y += 0.7f;
}
else npc.velocity.Y += 0.8f;
}
npc.ai[0]++;
if (npc.ai[0] >= 90)
{
float Speed = 12f;
Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2));
int damage = 30;
int type = Config.projectileID["Flame Shot"];
Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 17);
float rotation = (float)Math.Atan2(vector8.Y - (Main.player[npc.target].position.Y + (Main.player[npc.target].height * 0.5f)), vector8.X - (Main.player[npc.target].position.X + (Main.player[npc.target].width * 0.5f)));
int num54 = Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 0f, 0);
npc.ai[0] = 0;
}
}
if (npc.ai[1] == 1) // Second AI
{
// NPC AI HERE
}
npc.ai[2] += 1;
if (npc.ai[2] >= 600)
{
if (npc.ai[1] == 0) npc.ai[1] = 1;
else npc.ai[1] = 0;
}
}
}
}