using System;
using System.IO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CraftMaxedHacks.NPCs.Boss
{
public class KingSharkneon : ModNPC
{
public override void SetDefaults()
{
npc.name = "Sharkneon"; //boss name
npc.displayName = "King Sharkneon"; //display name
npc.aiStyle = 5; //5 is the flying AI style
npc.lifeMax = 5000000; //boss life
npc.damage = 1000; //boss damage
npc.defense = 925; //boss defense
npc.knockBackResist = 0f; //make boss invunerable to knockback
npc.width = 392;
npc.height = 390;
animationType = NPCID.DemonEye; //this boss will animate like the DemonEye
Main.npcFrameCount[npc.type] = 2; //boss frame/animation
npc.value = Item.buyPrice(0, 40, 75, 45);
npc.npcSlots = 1f;
npc.boss = true;
npc.lavaImmune = true;
npc.noGravity = true;
npc.noTileCollide = true;
npc.buffImmune[24] = true;
music = MusicID.TheTowers; //boss music
npc.netAlways = true;
if (npc.life <= 3500000)
{
npc.damage = 1500; //boss damage
npc.defense = 825; //boss defense
}
}
public override void HitEffect(int hitDirection, double damage)
{
Main.PlaySound(41, (int)npc.position.X, (int)npc.position.Y, 0);
}
public override bool Autoload(ref string name, ref string texture, ref string[] altTextures)
{
if (npc.life <= 3500000)
{
texture = "CraftMaxedHacks/NPCs/Boss/KingSharkneonPhase2";
}
return mod.Properties.Autoload;
}
public override void AutoloadHead(ref string headTexture, ref string bossHeadTexture)
{
bossHeadTexture = "CraftMaxedHacks/NPCs/Boss/KingSharkneon_Head_Boss"; //the boss head texture
if (npc.life <= 3500000)
{
bossHeadTexture = "CraftMaxedHacks/NPCs/Boss/KingSharkneonPhase2_Head_Boss";
}
}
public override void ScaleExpertStats(int numPlayers, float bossLifeScale)
{
npc.lifeMax = (int)(npc.lifeMax * 0.579f * bossLifeScale); //boss life scale in expertmode
npc.damage = (int)(npc.damage * 0.6f); //boss damage increase in expermode
}
public override void BossLoot(ref string name, ref int potionType)
{
potionType = ItemID.SuperHealingPotion; //boss drops
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName"));
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName"));
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName"));
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName"));
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName"));
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName"));
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName"));
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName"));
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName"));
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("GreatShark"));
if (Main.rand.Next(2) == 3) //item rarity
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName")); //Item spawn
}
if (Main.rand.Next(2) == 3) //item rarity
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName")); //Item spawn
}
if (Main.rand.Next(2) == 3) //item rarity
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName")); //Item spawn
}
if (Main.rand.Next(2) == 3) //item rarity
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName")); //Item spawn
}
if (Main.rand.Next(2) == 3) //item rarity
{
Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("ItemName")); //Item spawn
}
}
public override void AI()
{
npc.ai[0]++;
Player P = Main.player[npc.target];
if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active)
{
npc.TargetClosest(true);
}
npc.ai[1]++; //ai 1
if (npc.ai[1] >= 30) // 30 is projectile fire rate
{
float Speed = 1f; //projectile speed
Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2));
int damage = 950; //projectile damage
int type = mod.ProjectileType("Bubble"); //put your projectile
Main.PlaySound(23, (int)npc.position.X, (int)npc.position.Y, 17);
float rotation = (float)Math.Atan2(vector8.Y - (P.position.Y + (P.height * 0.5f)), vector8.X - (P.position.X + (P.width * 0.5f)));
Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 1f, 0);
Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 1f, 0);
Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 1f, 0);
Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 1f, 0);
Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 1f, 0);
Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 1f, 0);
}
npc.ai[2]++; //AI 2
if (npc.ai[2] % 500 == 3) //Npc spown rate
{
NPC.NewNPC((int)npc.position.X, (int)npc.position.Y, mod.NPCType("NeonGuard")); //NPC name
}
if (npc.life <= 3500000) //when the boss has less than 3500000 health phase 2 will trigger
npc.ai[3]++; //Charge Attack
npc.ai[4]++; //Phase 2 projectile
if (npc.ai[3] >= 20)
{
npc.velocity.X *= 0.98f;
npc.velocity.Y *= 0.98f;
Vector2 vector8 = new Vector2(npc.position.X + (npc.width * 0.5f), npc.position.Y + (npc.height * 0.5f));
{
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)));
npc.velocity.X = (float)(Math.Cos(rotation) * 12) * -1;
npc.velocity.Y = (float)(Math.Sin(rotation) * 12) * -1;
}
}
if (npc.ai[4] >= 5) // Projectile
{
float Speed = 1f; //projectile speed
int damage = 960; //projectile damage
int type = mod.ProjectileType("Bubble"); //put your projectile
Vector2 vector8 = new Vector2(npc.position.X + (npc.width / 2), npc.position.Y + (npc.height / 2));
float rotation = (float)Math.Atan2(vector8.Y - (P.position.Y + (P.height * 0.5f)), vector8.X - (P.position.X + (P.width * 0.5f)));
Main.PlaySound(23, (int)npc.position.X, (int)npc.position.Y, 17);
Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 1f, 0);
Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 1f, 0);
Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 1f, 0);
Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 1f, 0);
Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 1f, 0);
Projectile.NewProjectile(vector8.X, vector8.Y, (float)((Math.Cos(rotation) * Speed) * -1), (float)((Math.Sin(rotation) * Speed) * -1), type, damage, 1f, 0);
}
}
}
}