Effect.java 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. package me.km.effects;
  2. import java.util.ArrayList;
  3. import me.km.effects.active.*;
  4. import me.km.skills.Skill;
  5. public enum Effect
  6. {
  7. // comments indicate, that events aren't in active oder passive effect packages
  8. // passive effects
  9. ENCHANTER , // me.kt.custom.CustomEnchanting
  10. LESS_HUNGER , // me.kt.environment.EnvironmentTick
  11. LESS_THIRST , // me.kt.environment.EnvironmentAPI
  12. LESS_ENERGY_USE , // me.kt.environment.EnvironmentAPI
  13. LESS_COLD , // me.kt.environment.EnvironmentAPI
  14. FASTER_MANA , // me.kt.environment.EnvironmentAPI
  15. BREED_COW ,
  16. BREED_PIG ,
  17. BREED_SHEEP ,
  18. BREED_RABBIT ,
  19. BREED_CHICKEN ,
  20. BREED_HORSE ,
  21. BREED_MUSHROOMCOW ,
  22. GRAVEL_SAND_DIGGER ,
  23. MORE_MINERALS ,
  24. MORE_CROPS ,
  25. TREE_PICKER ,
  26. MORE_SAPLINGS ,
  27. CAKE_POWER ,
  28. SNEAKING ,
  29. SCENT ,
  30. MUGGING ,
  31. FAST_DIGGING ,
  32. XP_COLLECTOR ,
  33. MORE_DROPS ,
  34. FASTER_ARROWS ,
  35. ARROW_SAVER ,
  36. MORE_AXE_DAMAGE ,
  37. MORE_HOE_DAMAGE ,
  38. MORE_PICKAXE_DAMAGE ,
  39. MORE_SHOVEL_DAMAGE ,
  40. MORE_SWORD_DAMAGE ,
  41. MORE_DAGGER_DAMAGE ,
  42. MORE_HAMMER_DAMAGE ,
  43. MORE_STICK_DAMAGE ,
  44. FISHING ,
  45. POTION_SAVER ,
  46. BREWING ,
  47. CAULDRON_FILLING ,
  48. SMELTING ,
  49. NO_POISON ,
  50. LESS_FALL_DAMAGE ,
  51. LESS_DAMAGE ,
  52. SMITH ,
  53. FAST_ENDERPEARL_SHOOT ,
  54. PEARL_SAVER ,
  55. NO_ENDERPEARL_DAMAGE ,
  56. GOLD_WASHER ,
  57. GOLD_RUSH ,
  58. USE_WAND ,
  59. LESS_ITEM_LOSS ,
  60. NO_ARMOR_DROPPING ,
  61. // active effects
  62. ARCANE_SHOT (ArcaneShot.class),
  63. BLINDING_SHOT (BlindingShot.class),
  64. BUNNY_HOP (BunnyHop.class),
  65. CALL_BACK (CallBack.class),
  66. CLUSTER_BOMB (ClusterBomb.class),
  67. DAY (Day.class),
  68. DOOMED (Doomed.class),
  69. EARTHQUAKE (Earthquake.class),
  70. ELEVATION (Elevation.class),
  71. ELVISH_HORN (ElvishHorn.class),
  72. ENDERCHEST (Enderchest.class),
  73. EXPLOSION (Explosion.class),
  74. FALL_IMMUNITY (FallImmunity.class),
  75. FIRE (Fire.class),
  76. FIREBALL (Fireball.class),
  77. FIRE_SHOT (FireShot.class),
  78. FLYING (Flying.class),
  79. FREEZE (Freeze.class),
  80. GRAPPLING_HOOK (GrapplingHook.class),
  81. HARM (Harm.class),
  82. HARVEST (Harvest.class),
  83. HEAL (Heal.class),
  84. HEAL_RAIN (HealRain.class),
  85. HEARTS (Hearts.class),
  86. HEART_SEEKER (HeartSeeker.class),
  87. IMMORTALITY (Immortality.class),
  88. INVISIBILITY (Invisibility.class),
  89. JUMP (Jump.class),
  90. KICK (Kick.class),
  91. LEAF_COCOON (LeafCocoon.class),
  92. LOCK_PICK (LockPick.class),
  93. LUCKY (Lucky.class),
  94. MUSKET (Musket.class),
  95. NAIL_DOWN (NailDown.class),
  96. NAIL_TRAP (NailTrap.class),
  97. NET_TRAP (NetTrap.class),
  98. NIGHT (Night.class),
  99. POISON (Poison.class),
  100. POISONED_BLADE (PoisonedBlade.class),
  101. POISON_VOLLEY (PoisonVolley.class),
  102. POWER (Power.class),
  103. POWER_ATTACK (PowerAttack.class),
  104. PULL (Pull.class),
  105. PUSH (Push.class),
  106. QUICK_SHOT (QuickShot.class),
  107. RAIN (Rain.class),
  108. RAPID_FIRE (RapidFire.class),
  109. ROOTING (Rooting.class),
  110. SHADOW (Shadow.class),
  111. SHADOW_HIT (ShadowHit.class),
  112. SHADOW_STEP (ShadowStep.class),
  113. SILENCE (Silence.class),
  114. SLOWING_SHOT (SlowingShot.class),
  115. SMOKE_BOMB (SmokeBomb.class),
  116. SPRINT (Sprint.class),
  117. STONE (Stone.class),
  118. SUN (Sun.class),
  119. TELEPORT_PLAYER (TeleportPlayer.class),
  120. THOR (Thor.class),
  121. UNLUCKY (Unlucky.class),
  122. VINE_TRAP (VineTrap.class),
  123. WORKBENCH (Workbench.class);
  124. private final ArrayList<Skill> skills;
  125. private final Class<? extends ActiveEffectBase> c;
  126. private final boolean active;
  127. Effect(Class<? extends ActiveEffectBase> c)
  128. {
  129. skills = new ArrayList<>();
  130. this.active = c != null;
  131. this.c = c;
  132. }
  133. Effect()
  134. {
  135. this(null);
  136. }
  137. public void addSkill(Skill s)
  138. {
  139. skills.add(s);
  140. }
  141. public ArrayList<Skill> getSkills()
  142. {
  143. return skills;
  144. }
  145. public void clearSkills()
  146. {
  147. skills.clear();
  148. }
  149. public boolean isActive()
  150. {
  151. return active;
  152. }
  153. public int getManaCost(int power)
  154. {
  155. if(c != null)
  156. {
  157. try
  158. {
  159. return c.newInstance().getManaCost(power);
  160. }
  161. catch(InstantiationException | IllegalAccessException ex)
  162. {
  163. return 0;
  164. }
  165. }
  166. return 0;
  167. }
  168. public Class<? extends ActiveEffectBase> getEffectBase()
  169. {
  170. return c;
  171. }
  172. public String getEffectString()
  173. {
  174. if(c == null)
  175. {
  176. return null;
  177. }
  178. return c.getSimpleName();
  179. }
  180. }