package jp.jias.bukkit.bossmonster; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.ThrownPotion; import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; /** * スプラッシュダメージポーションを投げる * * @author i_shi_ba_shi ( jias.jp ) */ public class ThrowPotion extends Skill{ /** * 投げるスプラッシュダメージポーションの数 */ private int amount; /** * 投げるスプラッシュダメージポーションのダメージ値 */ private short potionType; /** * コンストラクタ * * @param plugin * プラグイン * @param level * スキルのレベル */ public ThrowPotion(BossMonster plugin,int level){ super(plugin); // レベルが10以下ならダメージポーションLv1、それ以上ならダメージポーションLv2を使う potionType=(short) (level <= 10?16476:16492); // 投げるダメージポーションの数はレベルの1/5に3を足したもの amount=level / 5 + 3; // ダメージポーションを投げる間隔は、レベル15以下なら10ticks/1回、それ以上は5ticks/1回 int interval=level <= 15?10:5; // 呪文を唱える getBoss().getServer().broadcastMessage(ChatColor.GOLD + "ヒールポーション!"); // 呪文を聞いて逃げる時間として1.5秒待ったあとスキルを開始する runTaskTimer(plugin,30,interval); } /** * スキル処理 */ protected void fire(){ // 頭上にポーションを撒く ThrownPotion item=(ThrownPotion) getBoss().getWorld().spawnEntity(getBoss().getLocation().add(0,3,0),EntityType.SPLASH_POTION); item.setItem(new ItemStack(Material.POTION,1,potionType)); item.setShooter(getBoss()); // 上に向けて発射 item.setVelocity(new Vector(0,0.6,0)); // 投げるポーションをひとつ減らす amount--; // 投げるポーションがなくなったらスキル終了 if(amount == 0){ cancel(); } } }