1 /* 2 * Copyright (c) 2017-2018 sel-project 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a copy 5 * of this software and associated documentation files (the "Software"), to deal 6 * in the Software without restriction, including without limitation the rights 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 * copies of the Software, and to permit persons to whom the Software is 9 * furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in all 12 * copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 * SOFTWARE. 21 * 22 */ 23 /** 24 * Copyright: 2017-2018 sel-project 25 * License: MIT 26 * Authors: Kripth 27 * Source: $(HTTP github.com/sel-project/selery/source/selery/item/throwable.d, selery/item/throwable.d) 28 */ 29 module selery.item.throwable; 30 /* 31 import selery.entity.projectile : Projectile, EntitySnowball = Snowball, EntityEgg = Egg, EntityEnderpearl = Enderpearl, EntityPotion = Potion; 32 import selery.item.consumeable : Potions; 33 import selery.item.item : Item, Items, register; 34 import selery.player : Player; 35 36 abstract class ThrowableItem(T:Projectile, E...) : Item { 37 38 private E args; 39 40 public this(ushort id, ushort damage, ubyte max, E args) { 41 super(id, damage, -1, max); 42 this.args = args; 43 } 44 45 public override bool onThrowed(Player thrower) { 46 thrower.world.spawn!T(thrower, args); 47 return true; 48 } 49 50 } 51 52 class Snowball : ThrowableItem!EntitySnowball { 53 54 public this() { 55 super(Items.SNOWBALL, 0, 64); 56 } 57 58 } 59 60 class Egg : ThrowableItem!EntityEgg { 61 62 public this() { 63 super(Items.EGG, 0, 16); 64 } 65 66 } 67 68 class Enderpearl : ThrowableItem!EntityEnderpearl { 69 70 public this() { 71 super(Items.SLIMEBALL, 0, 16); 72 } 73 74 } 75 76 //class ExperienceBottle : ThrowableItem!EntityExperienceBottl 77 78 class SplashPotion(ushort meta) : ThrowableItem!(EntityPotion, ushort) { 79 80 public this() { 81 super(Items.SPLASH_POTION, meta, 1, meta); 82 } 83 84 } 85 86 class WaterBottleSplashPotion : SplashPotion!(Potions.WATER_BOTTLE) {} 87 class MundaneSplashPotion : SplashPotion!(Potions.MUNDANE) {} 88 class MundaneExtendedSplashPotion : SplashPotion!(Potions.MUNDANE_EXTENDED) {} 89 class ThickSplashPotion : SplashPotion!(Potions.THICK) {} 90 class AwkwardSplashPotion : SplashPotion!(Potions.AWKWARD) {} 91 class NightVisionSplashPotion : SplashPotion!(Potions.NIGHT_VISION) {} 92 class NightVisionExtendedSplashPotion : SplashPotion!(Potions.NIGHT_VISION_EXTENDED) {} 93 class InvisibilitySplashPotion : SplashPotion!(Potions.INVISIBILITY) {} 94 class InvisibilityExtendedSplashPotion : SplashPotion!(Potions.INVISIBILITY_EXTENDED) {} 95 class LeapingSplashPotion : SplashPotion!(Potions.LEAPING) {} 96 class LeapingExtendedSplashPotion : SplashPotion!(Potions.LEAPING_EXTENDED) {} 97 class LeapingPlusSpashPotion : SplashPotion!(Potions.LEAPING_PLUS) {} 98 class FireResistanceSplashPotion : SplashPotion!(Potions.FIRE_RESISTANCE) {} 99 class FireResistanceExtendedSplashPotions : SplashPotion!(Potions.FIRE_RESISTANCE_EXTENDED) {} 100 class SpeedSplashPotion : SplashPotion!(Potions.SPEED) {} 101 class SpeedExtendedSplashPotion : SplashPotion!(Potions.SPEED_EXTENDED) {} 102 class SpeedPlusSplashPotion : SplashPotion!(Potions.SPEED_PLUS) {} 103 class SlownessSplashPotion : SplashPotion!(Potions.SLOWNESS) {} 104 class SlownessExtendedSplashPotion : SplashPotion!(Potions.SLOWNESS_EXTENDED) {} 105 class WaterBreathingSplashPotion : SplashPotion!(Potions.WATER_BREATHING) {} 106 class WaterBreathingExtendedSplashPotion : SplashPotion!(Potions.WATER_BREATHING_EXTENDED) {} 107 class HealingSplashPotion : SplashPotion!(Potions.HEALING) {} 108 class HealingPlusSplashPotion : SplashPotion!(Potions.HEALING_PLUS) {} 109 class HarmingSplasPotion : SplashPotion!(Potions.HARMING) {} 110 class HarmingPlusSplashPotion : SplashPotion!(Potions.HARMING_PLUS) {} 111 class PoisonSplashPotion : SplashPotion!(Potions.POISON) {} 112 class PoisonExtendedSplashPotion : SplashPotion!(Potions.POISON_EXTENDED) {} 113 class PoisonPlusSplashPotion : SplashPotion!(Potions.POISON_PLUS) {} 114 class RegenerationSplashPotion : SplashPotion!(Potions.REGENERATION) {} 115 class RegenerationExtendedSplashPotion : SplashPotion!(Potions.REGENERATION_EXTENDED) {} 116 class RegenerationPlusSpashPotion : SplashPotion!(Potions.REGENERATION_PLUS) {} 117 class StrengthSpashPotion : SplashPotion!(Potions.STRENGTH) {} 118 class StrengthExtendedSplashPotion : SplashPotion!(Potions.STRENGTH_EXTENDED) {} 119 class StrengthPlusSplashPotion : SplashPotion!(Potions.STRENGTH_PLUS) {} 120 class WeaknessSplashPotion : SplashPotion!(Potions.WEAKNESS) {} 121 class WeaknessExtendedSplashPotion : SplashPotion!(Potions.WEAKNESS_EXTENDED) {} 122 */