fireball.txt 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. event.load("item_air_click");
  2. Explosion_Power = 0;
  3. blaze_shoot_sound = sound.get("entity.blaze.shoot");
  4. sound_category_master = sound.getCategory("master");
  5. Scepter_map = map.new();
  6. map.add(Scepter_map, "km:wooden_scepter", 0.1);
  7. map.add(Scepter_map, "km:stone_scepter", 0.2);
  8. map.add(Scepter_map, "km:copper_scepter", 0.3);
  9. map.add(Scepter_map, "km:bronze_scepter", 0.4);
  10. map.add(Scepter_map, "km:iron_scepter", 0.5);
  11. map.add(Scepter_map, "km:golden_scepter", 0.75);
  12. map.add(Scepter_map, "km:diamond_scepter", 1);
  13. @wait
  14. wait();
  15. if(player.getName(player) == "SirTerence7" || player.getName(player) == "Mareeeen" || player.getName(player) == "marvinius"){
  16. if(event == "item_air_click"){
  17. player_hand = living.getEquip(player, "hand");
  18. player_hand_item_type = item.getType(player_hand);
  19. if(map.contains(Scepter_map, player_hand_item_type)){
  20. Lore_List = item.getLore(player_hand);
  21. //if(list.getSize(Lore_List) > 0){
  22. //Lore_List_1 = list.getIndex(Lore_List, 0);
  23. //if(Lore_List_1 == "Magic Item"){
  24. Shooting_Power = map.get(Scepter_map, player_hand_item_type);
  25. Look_array = entity.getLook(player);
  26. Motion_array = entity.getMotion(player);
  27. new_health = living.getHealth(player)-math.round(Shooting_Power*5);
  28. if(new_health > 0.5){
  29. living.setHealth(player, new_health);
  30. x = Look_array[0] * Shooting_Power + Motion_array[0] * 0.75;
  31. y = Look_array[1] * Shooting_Power + Motion_array[1] * 0.75 + 0.05;
  32. z = Look_array[2] * Shooting_Power + Motion_array[2] * 0.75;
  33. tag = text.concat("{ExplosionPower:", Explosion_Power, ",Motion:[",x,",",y,",",z,"],power:[",x/10,",",y/10,",",z/10,"]"/*,Invulnerable:1*/,",Owner:",player.getUuid(player),"}");
  34. entity.spawn("fireball", loc.mod(entity.getLocation(player),x,y+0.5,z), tag);
  35. sound.spawnForPlayer(player, blaze_shoot_sound, sound_category_master, 1, 1);
  36. entity.throw(player, Motion_array[0] - Look_array[0] * Shooting_Power * 0.5, Motion_array[1] - Look_array[1] * Shooting_Power * 0.125 ,Motion_array[2] - Look_array[2] * Shooting_Power * 0.5);
  37. //fireball = entity.spawn("fireball", entity.getLocation(player));
  38. //living.damage(player, math.round(Shooting_Power*5), damage.get(false,true,true,true,true,true,true,false));
  39. //entity.throw(fireball, x, y ,z);
  40. }
  41. //}
  42. //}
  43. }
  44. }
  45. }
  46. goto("wait");