using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using TAPI;
using Terraria;
namespace COFP
{
[GlobalMod] public class MProjectile : TAPI.ModProjectile
{
public override void DealtNPC(NPC npc, int hitDir, int dmgDealt, float knockback, bool crit)
{
Player owner = Main.player[projectile.owner]; //Making a variable for the player
if (projectile.friendly && owner != null && owner.active && !owner.dead) //checks to see if the projectile is friendly, the owner exists, and not dead
{
if (Main.myPlayer == owner.whoAmI && owner.HasBuff("COFP:InfusionSeekers") != -1 && projectile.type > 0 && projectile.type < 423) //Checks if the player has the certain buff and is not a custom projectile.
{
Projectile.NewProjectile(npc.position.X + 32, npc.position.Y, 0, 0, "COFP:InfusionSeekers", 10, 5, Main.myPlayer);
Projectile.NewProjectile(npc.position.X - 32, npc.position.Y, 0, 0, "COFP:InfusionSeekers", 10, 5, Main.myPlayer);
Projectile.NewProjectile(npc.position.X, npc.position.Y + 32, 0, 0, "COFP:InfusionSeekers", 10, 5, Main.myPlayer);
Projectile.NewProjectile(npc.position.X, npc.position.Y - 32, 0, 0, "COFP:InfusionSeekers", 10, 5, Main.myPlayer);
}
if (Main.myPlayer == owner.whoAmI && owner.HasBuff("COFP:InfusionInfernos") != -1 && projectile.type > 0 && projectile.type < 423)
{
Projectile.NewProjectile(npc.position.X, npc.position.Y, 0, 0, "COFP:Inferno", 20, 3, Main.myPlayer);
}
if (Main.myPlayer == owner.whoAmI && owner.HasBuff("COFP:InfusionFireball") != -1 && projectile.type > 0 && projectile.type < 423)
{
Projectile.NewProjectile(npc.position.X, npc.position.Y, 0, -6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(npc.position.X, npc.position.Y, 3, -6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(npc.position.X, npc.position.Y, -3, -6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(npc.position.X, npc.position.Y, 1, -6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(npc.position.X, npc.position.Y, -1, -6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(npc.position.X, npc.position.Y, 0, 6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(npc.position.X, npc.position.Y, 3, 6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(npc.position.X, npc.position.Y, -3, 6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(npc.position.X, npc.position.Y, 1, 6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(npc.position.X, npc.position.Y, -1, 6, "COFP:Fireball", 10, 0, Main.myPlayer);
}
}
}
public override void DealtPVP(Player playerAttacked, int hitDir, int dmgDealt, bool crit)
{
Player owner = Main.player[projectile.owner];
if (Main.myPlayer == owner.whoAmI && owner.HasBuff("COFP:InfusionSeekers") != -1 && projectile.type > 0 && projectile.type < 423)
{
Projectile.NewProjectile(playerAttacked.position.X + 32, playerAttacked.position.Y, 0, 0, "COFP:InfusionSeekers", 10, 5, Main.myPlayer);
Projectile.NewProjectile(playerAttacked.position.X - 32, playerAttacked.position.Y, 0, 0, "COFP:InfusionSeekers", 10, 5, Main.myPlayer);
Projectile.NewProjectile(playerAttacked.position.X, playerAttacked.position.Y + 32, 0, 0, "COFP:InfusionSeekers", 10, 5, Main.myPlayer);
Projectile.NewProjectile(playerAttacked.position.X, playerAttacked.position.Y - 32, 0, 0, "COFP:InfusionSeekers", 10, 5, Main.myPlayer);
}
if (Main.myPlayer == owner.whoAmI && owner.HasBuff("COFP:InfusionInfernos") != -1 && projectile.type > 0 && projectile.type < 423)
{
Projectile.NewProjectile(playerAttacked.position.X, playerAttacked.position.Y, 0, 0, "COFP:Infernos", 20, 3, Main.myPlayer);
}
if (Main.myPlayer == owner.whoAmI && owner.HasBuff("COFP:InfusionFireball") != -1 && projectile.type > 0 && projectile.type < 423)
{
Projectile.NewProjectile(playerAttacked.position.X, playerAttacked.position.Y, 0, -6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(playerAttacked.position.X, playerAttacked.position.Y, 3, -6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(playerAttacked.position.X, playerAttacked.position.Y, -3, -6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(playerAttacked.position.X, playerAttacked.position.Y, 1, -6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(playerAttacked.position.X, playerAttacked.position.Y, -1, -6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(playerAttacked.position.X, playerAttacked.position.Y, 0, 6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(playerAttacked.position.X, playerAttacked.position.Y, 3, 6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(playerAttacked.position.X, playerAttacked.position.Y, -3, 6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(playerAttacked.position.X, playerAttacked.position.Y, 1, 6, "COFP:Fireball", 10, 0, Main.myPlayer);
Projectile.NewProjectile(playerAttacked.position.X, playerAttacked.position.Y, -1, 6, "COFP:Fireball", 10, 0, Main.myPlayer);
}
}
}
}