// Pokemon stored in the pokeball
public class Pokemon
{
public String Name;
public int Health;
public int MaxHealth;
public int Experience;
public int[] BuffTypes;
public int[] BuffTimes;
public ArrayHandler<bool> Immunities;
}
// instance of the pokemon class
Pokemon Captured = null;
// last health amount of the NPC before the pokeball damages it
int LastHealth = 0;
// pokeball this pokemon is normally stored in
Item Ball = null;
// when the projectile dies
/*public void Kill()
{
//Captured.Name = "Bulbasaur";
// ball has a pokemon inside of it
if (Captured != null)
{
// create the pokemon that's in this ball
int Summoned = NPC.NewNPC((int)projectile.position.X,(int)projectile.position.Y,"Bulbasaur",0);
Main.npc[Summoned].friendly = true;
if (Ball != null)
{
Ball.RunMethod("SetActive", Main.npc[Summoned]);
}
}
projectile.active = false;
}*/
public void Kill()
{
if (Captured != null)
{
NPC.NewNPC((int)projectile.position.X,(int)projectile.position.Y,"Bulbasaur",0);
}
projectile.active = false;
}
public void DamageNPC(NPC npc, ref int damage, ref float knockback)
{
LastHealth = npc.life;
}
public void DealtNPC(NPC npc, double damage, Player player)
{
if (Captured == null)
{
if (npc.life <= 0)
{
int item = Item.NewItem((int)projectile.position.X, (int)projectile.position.Y,
projectile.width, projectile.height, projectile.name + " ");
int[] ARGS = new int[2];
ARGS[0] = npc.whoAmI;
ARGS[1] = LastHealth;
Main.item[item].RunMethod("SetCaptured", ARGS);
Main.item[item].toolTip = npc.name;
Main.NewText("You caught a " + npc.name + "!", 255, 255, 255);
if (!(bool)RunPlayerFunc("DiscoverPokemon", npc.name))
{
Main.NewText("Unfortunately that entry is not in", 255, 255, 255);
Main.NewText("the PokeDex, and cannot be recorded", 255, 255, 255);
}
}
projectile.active = false;
}
}
// run a function that's in Player.cs
public static object RunPlayerFunc(String FunctionName, object Parameter)
{
Codable.RunGlobalMethod("ModPlayer", FunctionName, Parameter);
return Codable.customMethodReturn;
}
public void CreateCaptured()
{
Captured = new Pokemon();
}
public void SetBall(Item a_Ball)
{
Ball = a_Ball;
}
public void SetCapturedName(String a_Name)
{
Captured.Name = a_Name;
}
public void SetCapturedHealth(int a_Health)
{
Captured.Health = a_Health;
}
public void SetCapturedMaxHealth(int a_MaxHealth)
{
Captured.MaxHealth = a_MaxHealth;
}
public void SetCapturedExperience(int a_Experience)
{
Captured.Experience = a_Experience;
}
public void SetCapturedBuffTypes(int[] a_BuffTypes)
{
Captured.BuffTypes = a_BuffTypes;
}
public void SetCapturedBuffTimes(int[] a_BuffTimes)
{
Captured.BuffTimes = a_BuffTimes;
}
public void SetCapturedImmunities(ArrayHandler<bool> a_Immunities)
{
Captured.Immunities = a_Immunities;
}