public function __construct(Entity $target, Player $whose, $tick)
 {
     parent::__construct(Archery::getInstance());
     $this->tick = $tick;
     $this->whose = $whose;
     $this->target = $target;
 }
 public function onActiveUse(PlayerInteractEvent $event)
 {
     $directionVector = $this->player->getPlayer()->getDirectionVector()->multiply(3);
     $pos = $event->getPlayer()->getPosition()->add(0, $event->getPlayer()->getEyeHeight(), 0);
     $arrow = Archery::createEffectArrow($event->getPlayer(), $pos->add(0.5 - 1 / mt_rand(1, 3), 0.5 - 1 / mt_rand(1, 3), 0.5 - 1 / mt_rand(1, 3)), $directionVector, $event->getPlayer()->getYaw(), $event->getPlayer()->getPitch(), 0, 255, 255, false);
     $arrow->namedtag["Handler"] = new String("Handler", HandleLightning::HANDLER_NAME);
     $arrow->namedtag["ArcheryDamage"] = new Double("ArcheryDamage", 0);
     $arrow->namedtag["Custom"] = new Int("Custom", 2);
     $event->getPlayer()->getLevel()->addEntity($arrow);
     $arrow->spawnToAll();
     return true;
 }
 public function onActiveUse(PlayerInteractEvent $event)
 {
     $directionVector = $this->player->getPlayer()->getDirectionVector()->multiply(3);
     $pos = $event->getPlayer()->getPosition()->add(0, $event->getPlayer()->getEyeHeight(), 0);
     $arrow = Archery::createEffectArrow($event->getPlayer(), $pos->add(0.5 - 1 / mt_rand(1, 3), 0.5 - 1 / mt_rand(1, 3), 0.5 - 1 / mt_rand(1, 3)), $directionVector, $event->getPlayer()->getYaw(), $event->getPlayer()->getPitch(), 255, 120, 0, false);
     $arrow->namedtag["ExplosionDamage"] = new Int("ExplosionDamage", $this->level);
     $arrow->setOnFire(PHP_INT_MAX);
     $arrow->namedtag["Custom"] = new Int("Custom", 1);
     $event->getPlayer()->getLevel()->addEntity($arrow);
     $arrow->spawnToAll();
     return true;
 }
 public function onActiveUse(PlayerInteractEvent $event)
 {
     $directionVector = $this->player->getPlayer()->getDirectionVector()->multiply(3);
     $pos = $event->getPlayer()->getPosition()->add(0, $event->getPlayer()->getEyeHeight(), 0);
     for ($i = 0; $i < 2; $i++) {
         $arrow = Archery::createEffectArrow($event->getPlayer(), $pos->add(0.5 - 1 / mt_rand(1, 3), 0.5 - 1 / mt_rand(1, 3), 0.5 - 1 / mt_rand(1, 3)), $directionVector, $event->getPlayer()->getYaw(), $event->getPlayer()->getPitch(), 0, 255, 120, true);
         $arrow->namedtag["ArcheryDamage"] = new Double("ArcheryDamage", $this->getPlayer()->getCurrentJob()->getFinalDamage($this->getPlayer()) * (1 + $this->level / 10));
         $arrow->namedtag["Custom"] = new Int("Custom", 1);
         $event->getPlayer()->getLevel()->addEntity($arrow);
         $arrow->spawnToAll();
     }
     return true;
 }
 public function onRun($currentTick)
 {
     if (!ToAruPG::getInstance()->isValidPlayer($this->player->getPlayer())) {
         return;
     }
     $pos = $this->player->getPlayer()->getPosition();
     for ($i = 0; $i < self::SPLIT_SHOT_COUNT; $i++) {
         $arrow = Archery::createEffectArrow($this->player->getPlayer(), $pos, new Vector3(mt_rand(-5, 5) / 5, -1, mt_rand(-5, 5) / 5), 0, -90, 255, 0, 120, false);
         $arrow->namedtag["ArcheryDamage"] = new Double("ArcheryDamage", $this->player->getCurrentJob()->getFinalDamage($this->player) * (2 + $this->level / 10));
         $arrow->namedtag["Custom"] = new Int("Custom", 1);
         $this->player->getPlayer()->getLevel()->addEntity($arrow);
         $arrow->spawnToAll();
     }
 }
 public function onRun($currentTick)
 {
     if ($this->startTick === -1) {
         $this->startTick = $currentTick;
     }
     $arrow = Archery::createEffectArrow($this->player->getPlayer(), $this->player->getPlayer()->getPosition()->add(0, $this->player->getPlayer()->getEyeHeight(), 0), $this->player->getPlayer()->getDirectionVector()->multiply(3), $this->player->getPlayer()->getYaw(), $this->player->getPlayer()->getPitch(), 255, 255, 0, true);
     $arrow->namedtag["ArcheryDamage"] = new Double("ArcheryDamage", $this->player->getCurrentJob()->getFinalDamage($this->player) * (1 / 2 + $this->level / 10));
     $arrow->namedtag["Custom"] = new Int("Custom", 1);
     $this->player->getPlayer()->getLevel()->addEntity($arrow);
     $arrow->spawnToAll();
     if ($currentTick - $this->startTick > $this->duration) {
         $this->getHandler()->cancel();
     }
 }