Don't like ads? PRO users don't see any ads ;-)
Guest

Pokeball Projectile.cs

By: a guest on May 5th, 2012  |  syntax: C#  |  size: 3.00 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // Pokemon stored in the pokeball
  2. public class Pokemon
  3. {
  4.         public String Name;
  5.         public int Health;
  6.         public int MaxHealth;
  7.         public int Experience;
  8.         public int[] BuffTypes;
  9.         public int[] BuffTimes;
  10.         public ArrayHandler<bool> Immunities;
  11. }
  12.  
  13. // instance of the pokemon class
  14. Pokemon Captured = null;
  15.  
  16. // last health amount of the NPC before the pokeball damages it
  17. int LastHealth = 0;
  18.  
  19. // pokeball this pokemon is normally stored in
  20. Item Ball = null;
  21.  
  22. // when the projectile dies
  23. /*public void Kill()
  24. {
  25.     //Captured.Name = "Bulbasaur";
  26.    
  27.         // ball has a pokemon inside of it
  28.         if (Captured != null)
  29.         {
  30.        
  31.         // create the pokemon that's in this ball
  32.                 int Summoned = NPC.NewNPC((int)projectile.position.X,(int)projectile.position.Y,"Bulbasaur",0);
  33.                                    
  34.                 Main.npc[Summoned].friendly = true;
  35.                
  36.                 if (Ball != null)
  37.                 {
  38.                         Ball.RunMethod("SetActive", Main.npc[Summoned]);
  39.                 }
  40.         }
  41.        
  42.         projectile.active = false;
  43. }*/
  44.  
  45. public void Kill()
  46. {
  47.  
  48.     if (Captured != null)
  49.     {
  50.         NPC.NewNPC((int)projectile.position.X,(int)projectile.position.Y,"Bulbasaur",0);    
  51.     }
  52.    
  53.     projectile.active = false;
  54. }
  55.  
  56. public void DamageNPC(NPC npc, ref int damage, ref float knockback)
  57. {
  58.         LastHealth = npc.life;
  59. }
  60.  
  61. public void DealtNPC(NPC npc, double damage, Player player)
  62. {
  63.         if (Captured == null)
  64.         {
  65.                 if (npc.life <= 0)
  66.                 {
  67.                         int item = Item.NewItem((int)projectile.position.X, (int)projectile.position.Y,
  68.                                                                         projectile.width, projectile.height, projectile.name + " ");
  69.                        
  70.                         int[] ARGS = new int[2];
  71.                         ARGS[0] = npc.whoAmI;
  72.                         ARGS[1] = LastHealth;
  73.                         Main.item[item].RunMethod("SetCaptured", ARGS);
  74.                         Main.item[item].toolTip = npc.name;
  75.                         Main.NewText("You caught a " + npc.name + "!", 255, 255, 255);
  76.                        
  77.                         if (!(bool)RunPlayerFunc("DiscoverPokemon", npc.name))
  78.                         {
  79.                                 Main.NewText("Unfortunately that entry is not in", 255, 255, 255);
  80.                                 Main.NewText("the PokeDex, and cannot be recorded", 255, 255, 255);
  81.                         }
  82.                 }
  83.                
  84.                 projectile.active = false;
  85.         }
  86. }
  87.  
  88. // run a function that's in Player.cs
  89. public static object RunPlayerFunc(String FunctionName, object Parameter)
  90. {
  91.         Codable.RunGlobalMethod("ModPlayer", FunctionName, Parameter);
  92.         return Codable.customMethodReturn;
  93. }
  94.  
  95. public void CreateCaptured()
  96. {
  97.         Captured = new Pokemon();
  98. }
  99.  
  100. public void SetBall(Item a_Ball)
  101. {
  102.         Ball = a_Ball;
  103. }
  104.  
  105. public void SetCapturedName(String a_Name)
  106. {
  107.         Captured.Name = a_Name;
  108. }
  109.  
  110. public void SetCapturedHealth(int a_Health)
  111. {
  112.         Captured.Health = a_Health;
  113. }
  114.  
  115. public void SetCapturedMaxHealth(int a_MaxHealth)
  116. {
  117.         Captured.MaxHealth = a_MaxHealth;
  118. }
  119.  
  120. public void SetCapturedExperience(int a_Experience)
  121. {
  122.         Captured.Experience = a_Experience;
  123. }
  124.  
  125. public void SetCapturedBuffTypes(int[] a_BuffTypes)
  126. {
  127.         Captured.BuffTypes = a_BuffTypes;
  128. }
  129.  
  130. public void SetCapturedBuffTimes(int[] a_BuffTimes)
  131. {
  132.         Captured.BuffTimes = a_BuffTimes;
  133. }
  134.  
  135. public void SetCapturedImmunities(ArrayHandler<bool> a_Immunities)
  136. {
  137.         Captured.Immunities = a_Immunities;
  138. }