Пример #1
0
    def damageAndPull(self, l):
        for e in self.nearbyMobs(l, .5, 2, .5):
            pull_dir = self.totem.getLocation().clone().subtract(
                e.getLocation()).toVector()
            pull_dir = Vector(Math.max(Math.min(pull_dir.getX() / 5, 1), -1),
                              0.2,
                              Math.max(Math.min(pull_dir.getZ() / 5, 1), -1))

            e.setVelocity(pull_dir)

            if e in self.hit:
                continue
            self.hit.add(e)

            self.damage(e, False, 2, .7, 0, 0, .3, 0, 0)
Пример #2
0
    def tick(self):
        if self.t == 0 and self.clone:
            self.sound(Sound.ENTITY_EVOKER_CAST_SPELL, .7, .7)

        if self.t <= 5:
            self.ripple_loc.add(self.ripple_dir)

            self.sound(
                self.ripple_loc, Sound.BLOCK_GLASS_BREAK if self.clone else
                Sound.ENTITY_WITHER_BREAK_BLOCK, 1 if self.clone else .2, 1)
            if self.clone:
                self.sound(self.ripple_loc, Sound.BLOCK_LAVA_EXTINGUISH, .6,
                           1.2)

            self.particle(self.ripple_loc, Particle.BLOCK_CRACK, 10, .5, .5,
                          .5, .5, (Material.GLOWSTONE if self.clone else
                                   Material.DIRT).createBlockData())

            for e in self.nearbyMobs(self.ripple_loc, 3, 3, 3):
                self.castSpell('WARRIOR', 5, e)
            else:
                self.hit = True

        if self.t == 5 and self.hit and self.shift:
            self.player.setVelocity(Vector(0, 1.5, 0))
Пример #3
0
    def tick(self):
        v = self.player.getEyeLocation().getDirection()
        self.player.setVelocity(v.clone().setY(
            v.getY() * (.6 if v.getY() >= 0 else .2)).multiply(1.3).add(
                Vector(0, .5, 0)))

        self.player.addPotionEffect(
            PotionEffect(PotionEffectType.SPEED, 100, 4, True, False, True))
        self.player.addPotionEffect(
            PotionEffect(PotionEffectType.INCREASE_DAMAGE, 100, 4, True, False,
                         True))
        self.player.addPotionEffect(
            PotionEffect(PotionEffectType.INVISIBILITY, 100, 0, True, False,
                         True))

        self.particle(self.player.getEyeLocation(), Particle.SQUID_INK, 30, 1,
                      2, 1, .2)
        self.particle(self.player.getEyeLocation(), Particle.SPELL_WITCH, 40,
                      1, 2, 1, .5)

        self.sound(Sound.ENTITY_EVOKER_CAST_SPELL, 1, 1.6)
        self.sound(Sound.ENTITY_GHAST_SHOOT, .6, 1)

        self.player.addScoreboardTag('invis')

        for p in Bukkit.getOnlinePlayers():
            p.hidePlayer(plugin, self.player)
Пример #4
0
    def tick(self):
        if self.t == 0:
            if not self.player.getWorld().getBlockAt(
                    self.player.getLocation().clone().subtract(
                        0, 1,
                        0)).isEmpty() or not self.player.getWorld().getBlockAt(
                            self.player.getLocation().clone().subtract(
                                0, 2, 0)).isEmpty():
                #self.player.addScoreboardTag('escape')
                eye_dir = self.player.getEyeLocation().getDirection()
                self.player.setVelocity(
                    eye_dir.setY(Math.min(-.4 * Math.abs(eye_dir.getY()),
                                          -.4)).multiply(-4))

                self.sound(self.player.getLocation(), Sound.ENTITY_BLAZE_SHOOT,
                           1, 1.2)
                self.particle(
                    self.player.getLocation().clone().add(0, 1, 0),
                    Particle.VILLAGER_HAPPY if self.clone else
                    Particle.SQUID_INK, 10 if self.clone else 5, .3, 2, .3, .2)
                if self.clone:
                    self.particle(
                        self.player.getLocation().clone().add(0, 1, 0),
                        Particle.CLOUD, 5, .3, 2, .3, .1)
            else:
                self.cancel()
            return

        if not self.player.isOnGround():
            self.delay()

            if self.player.isSneaking():
                self.player.setVelocity(
                    self.player.getVelocity().clone().subtract(Vector(0, 1,
                                                                      0)))
            elif self.player.getVelocity().getY() <= -.5:
                self.player.getVelocity().setY(-.5)
        else:
            if self.player.isSneaking():
                for i in range(0, 360, 60):
                    for j in range(9):
                        l = self.player.getLocation().clone().add(
                            Math.sin(i * DEG2RAD) * j, 0,
                            Math.cos(i * DEG2RAD) * j)
                        self.particle(l, Particle.SQUID_INK, 2, 0, 0, 0, .2)
                        self.particle(l, Particle.CLOUD, 2, 0, 0, 0, .2)
                        self.particle(l, Particle.CRIT, 2, 0, 0, 0, .3)

                self.sound(Sound.ENTITY_GENERIC_EXPLODE, .5, 1.2)
                self.sound(Sound.ENTITY_IRON_GOLEM_DEATH, 1, 1)

                for e in self.nearbyMobs(8, 10, 8):
                    self.damage(e, 4)

            self.player.addPotionEffect(
                PotionEffect(PotionEffectType.SPEED, 3600, 2, True, False,
                             True))
Пример #5
0
    def tick(self):
        if self.t == 0:
            self.e.setVelocity(Vector(0, 1.75, 0))
            self.damage(self.e, 5)
            self.sound(self.e.getLocation(), Sound.ENTITY_ENDER_DRAGON_HURT,
                       1 if self.clone else .5, 1)

        elif self.t < 8:
            self.particle(self.e.getLocation(),
                          Particle.CLOUD if self.clone else Particle.LAVA,
                          3 if self.clone else 1, .6, .1, .6, 0)
            if self.clone:
                self.particle(self.e.getLocation(), Particle.FIREWORKS_SPARK,
                              1, .6, .1, .6, .5)

        elif self.t == 8:
            self.e.setVelocity(Vector(0, 0, 0))
            self.damage(self.e, 2)

            self.explode()

            self.sound(self.e.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1,
                       .9)
            if self.clone:
                self.sound(self.e.getLocation(), Sound.ENTITY_BLAZE_AMBIENT,
                           .2, .8)

        elif self.t == 10:
            self.e.setVelocity(Vector(0, -2, 0))

        elif (not self.e.isOnGround()) and self.t < 20:
            self.particle(
                self.e.getLocation(), Particle.FIREWORKS_SPARK
                if self.clone else Particle.SMOKE_LARGE,
                10 if self.clone else 2, .6, .6, .6, .5 if self.clone else 0)

        else:
            self.damage(self.e, 3)
            self.explode()
            self.cancel()
Пример #6
0
def move_away(player, entity):
    # Pushes entity away from player

    player_loc = player.getLocation()
    entity_loc = entity.getLocation()

    dx = entity_loc.getX() - player_loc.getX()
    vx = sin(Xv * dx)
    dy = entity_loc.getY() - player_loc.getY()
    vy = sin(Xv * dy)
    dz = entity_loc.getZ() - player_loc.getZ()
    vz = sin(Xv * dz)
    entity.setVelocity(Vector(vx, vy, vz))
Пример #7
0
    def tick(self):
        if self.t == 0:
            # Find totem
            totem = None
            totem_id = PersistentDataAPI.getInt(PersistentDataAPI.getData(self.player), 'totem', None)
            for e in self.player.getWorld().getEntities():
                if e.getEntityId() == totem_id:
                    totem = e

            if totem is None:
                PlayerAPI.sendWynnMessage(self.player, 'messages.totem_out')
                self.cancel()
                return

            vector = totem.getLocation().clone().subtract(self.player.getLocation()).add(0, 2, 0).toVector()
            vector = Vector(Math.max(Math.min(vector.getX(), 6), -6), Math.max(Math.min(vector.getY(), 2), -2), Math.max(Math.min(vector.getZ(), 6), -6))
            self.player.setVelocity(vector.clone().multiply(0.5).setY(vector.getY()).multiply(0.5));

            self.particle(self.player.getLocation(), Particle.CLOUD, 6, 1, 1, 1, 0.1)
            self.particle(self.player.getLocation(), Particle.SQUID_INK, 6, 1, 1, 1, 0.1)

            self.sound(Sound.ENTITY_PLAYER_ATTACK_KNOCKBACK, .4, .8)
            self.sound(Sound.ENTITY_BLAZE_SHOOT, 1, 1)
            self.sound(Sound.ENTITY_IRON_GOLEM_HURT, .8, .8)
            if self.clone:
                self.sound(Sound.ENTITY_BLAZE_AMBIENT, .1, .9)

        elif self.t > 10:
            if self.player.isOnGround():
                self.particle(self.player.getLocation().clone().add(0, 1, 0), Particle.FIREWORKS_SPARK if self.clone else Particle.TOTEM, 5, 1, 2, 1, .2)
                self.particle(self.player.getLocation(), Particle.CLOUD, 6, 1, .2, 1, .1)
                self.particle(self.player.getLocation(), Particle.SQUID_INK, 6, 1, .2, 1, .1)
                if self.clone:
                    self.particle(self.player.getLocation(), Particle.SPELL_MOB, 0, 1, 1, 1, 1)

                self.sound(Sound.BLOCK_STONE_STEP, 1, .9)
                self.sound(Sound.BLOCK_STONE_FALL, 1, .9)

                self.player.setVelocity(Vector(0, .5, 0))

                self.cancel()

            else:
                for e in self.nearbyMobs(1, 1, 1):
                    if e in self.hit:
                        continue
                    self.hit.add(e)

                    self.damage(e, False, 1, .8, 0, .2, 0, 0, 0)
                    PySpell.knockback(e, VectorUP, 2)
                    e.addPotionEffect(PotionEffect(PotionEffectType.BLINDNESS, 100, 0, True, False))
Пример #8
0
    def tick(self):
        if self.t < 10:
            for i in range(3):
                l = self.player.getLocation().clone().add(
                    Math.sin((10 * self.t + 60 * (i - 1)) * DEG2RAD) *
                    (1.5 - .15 * self.t), self.t,
                    Math.cos((10 * self.t + 60 *
                              (i - 1)) * DEG2RAD) * (1.5 - .15 * self.t))
                self.particle(
                    l,
                    Particle.FIREWORKS_SPARK if self.clone else Particle.CRIT,
                    5, 0, 0, 0, .1 if self.clone else .3)
                self.particle(l, Particle.SQUID_INK, 3, 0, 0, 0, 0)
                self.sound(l, Sound.ENTITY_ARROW_SHOOT, 1, 1 + self.t / 20)
            return

        l = self.player.getLocation().clone().add(0, 10, 0)
        self.sound(l, Sound.ENTITY_ARROW_SHOOT, 1, .8)
        self.sound(
            l, Sound.ITEM_ARMOR_EQUIP_GOLD if self.clone else
            Sound.ENTITY_GENERIC_EXPLODE, .8, 1 if self.clone else 1.8)
        if self.clone:
            self.sound(l, Sound.ITEM_TOTEM_USE, .8, .8)

        for i in range(0, 360, 30):
            for j in range(3):
                arrow = self.player.getWorld().spawnArrow(
                    l,
                    Vector(Math.sin(i * DEG2RAD), .5 * (j - 1) - 1,
                           Math.cos(i * DEG2RAD)), 3, 1)
                if self.clone:
                    snowball = self.player.getWorld().spawnEntity(
                        arrow.getLocation(), EntityType.SNOWBALL)
                    snowball.setVelocity(arrow.getVelocity())
                    snowball.setItem(ItemStack(Material.FLINT))
                    arrow.remove()
                    arrow = snowball

                arrow.setShooter(self.player)
                arrow.addScoreboardTag('rain_arrow')
Пример #9
0
    def tick(self):
        if self.t == 0 and self.player.getScoreboardTags().contains('totem'):
            # Find totem
            totem = None
            totem_id = PersistentDataAPI.getInt(
                PersistentDataAPI.getData(self.player), 'totem', None)
            for e in self.player.getWorld().getEntities():
                if e.getEntityId() == totem_id:
                    totem = e

            if totem is None:
                self.t += 1
                return

            # Reset Totem
            totem_loc = totem.getLocation()
            totem.remove()

            holo_id = PersistentDataAPI.getInt(
                PersistentDataAPI.getData(self.player), 'totem_holo', None)
            if not holo_id is None:
                for e in self.player.getWorld().getEntities():
                    if e.getEntityId() == holo_id:
                        e.remove()

            task_id = PersistentDataAPI.getInt(
                PersistentDataAPI.getData(self.player), 'totem_task', None)
            if not task_id is None:
                Bukkit.getScheduler().cancelTask(task_id)

            totem = self.player.getWorld().spawnEntity(totem_loc,
                                                       EntityType.ARMOR_STAND)
            totem.setGravity(True)
            totem.setInvulnerable(True)
            totem.setVisible(True)
            totem.addScoreboardTag('totem')

            totem_item = ItemStack(Material.STONE_SHOVEL)
            totem_meta = totem_item.getItemMeta()
            totem_meta.setUnbreakable(True)
            totem_meta.setDamage(29 if self.clone else 28)
            totem_item.setItemMeta(totem_meta)

            totem.getEquipment().setHelmet(totem_item)

            PersistentDataAPI.setInt(PersistentDataAPI.getData(self.player),
                                     'totem', totem.getEntityId())

            holo = self.player.getWorld().spawnEntity(
                totem.getLocation().clone().add(0, 2.7, 0),
                EntityType.ARMOR_STAND)
            holo.setMarker(True)
            holo.setVisible(False)
            holo.setInvulnerable(True)
            holo.setCustomName(PySpell.colorText('20s', 'c'))
            holo.setCustomNameVisible(True)

            PersistentDataAPI.setInt(PersistentDataAPI.getData(self.player),
                                     'totem_holo', holo.getEntityId())

            self.castSpell('SHAMAN', 5, totem, holo, True)

        v = self.player.getEyeLocation().getDirection()
        vr = Vector(1, 0, 0) if v.getY() == 0 else (
            v.clone().setY(0).normalize().rotateAroundY(Math.PI / 2))
        vi = v.clone().rotateAroundAxis(vr, Math.PI / 2)

        l = self.player.getEyeLocation().clone().add(v.clone().multiply(
            self.t))

        if self.t < 20:
            self.catch_mobs = self.catchable_mobs(l)
            if self.catch_mobs.size() > 0:
                self.catch(l, v, vi)
                self.cancel()

            l1 = l.clone().add(vi.clone().multiply(2).rotateAroundAxis(
                v, self.t / 4))
            l2 = l.clone().add(vi.clone().multiply(2).rotateAroundAxis(
                v, (self.t / 4) + Math.PI))

            self.particle(
                l1, Particle.FIREWORKS_SPARK if self.clone else Particle.TOTEM,
                2, 0, 0, 0, .1)
            self.particle(
                l2, Particle.FIREWORKS_SPARK if self.clone else Particle.TOTEM,
                2, 0, 0, 0, .1)

            self.sound(l, Sound.BLOCK_LAVA_EXTINGUISH, .1, .7)
        else:
            self.catch(l, v, vi)
Пример #10
0
    def activate(self, e):
        self.damage(e, 2)

        e.setVelocity(e.getLocation().toVector().subtract(self.player.getLocation().toVector()).setY(0).normalize().add(Vector(0, 1, 0)))

        self.sound(Sound.ENTITY_ARROW_HIT, 1, .9)
        self.sound(Sound.ENTITY_WITHER_BREAK_BLOCK, .1, 1.9)
        self.sound(Sound.ENTITY_PLAYER_ATTACK_KNOCKBACK, 1, 1)