コード例 #1
0
    def tick(self):
        if self.t == 0:
            if self.player.hasPotionEffect(PotionEffectType.INVISIBILITY):
                self.castSpell('ASSASSIN', 5)

            if self.clone:
                self.sound(Sound.ENTITY_EVOKER_CAST_SPELL, .5, 1.6)
                self.sound(Sound.ENTITY_BLAZE_AMBIENT, .2, 1.5)

        l = self.player.getEyeLocation().clone().add(
            Math.sin(self.t * -22.5 * DEG2RAD) * 5, 0,
            Math.cos(self.t * -22.5 * DEG2RAD) * 5)

        for e in self.nearbyMobs(l, 3, 3, 3):
            if e in self.hit:
                continue
            self.hit.add(e)

            self.damage(e, False, 1.5, .7, 0, .3, 0, 0, 0)
            PySpell.knockback(e, VectorUP, .5)
            e.addPotionEffect(PotionEffect(PotionEffectType.BLINDNESS, 100, 1))
            e.addPotionEffect(PotionEffect(PotionEffectType.SLOW, 20, 8))

        self.particle(l.clone().subtract(0, .5, 0), Particle.SWEEP_ATTACK, 4,
                      .5, .5, .5, 0)
        self.particle(l, Particle.CLOUD if self.clone else Particle.SQUID_INK,
                      5, .5, .5, .5, .1)
        self.particle(
            l, Particle.SPELL_WITCH if self.clone else Particle.CRIT_MAGIC, 10,
            .5, .5, .5, .2)

        self.sound(l, Sound.ENTITY_PLAYER_ATTACK_SWEEP, 1, 1.2)
        self.sound(l, Sound.ITEM_FLINTANDSTEEL_USE, 1, 1.3)
コード例 #2
0
ファイル: haul.py プロジェクト: WynnLab/WynnLab
    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))
コード例 #3
0
ファイル: smoke_bomb_tick.py プロジェクト: WynnLab/WynnLab
    def tick(self):
        if self.t > 0 and self.player.getScoreboardTags().contains(
                'smoke_bomb'):
            self.cancel()

        if self.t % 4 == 0:
            self.particle(self.l, Particle.CLOUD, 16, 3, 3, 3, 0.1)
            self.particle(
                self.l,
                Particle.SPELL_WITCH if self.clone else Particle.SQUID_INK, 16,
                3, 3, 3, .2 if self.clone else .1)

        if self.t % 20 == 0:
            self.sound(self.l, Sound.BLOCK_FIRE_EXTINGUISH, .3, 1)

            for e in self.nearbyMobs(self.l, 3, 3, 3):
                self.damage(e, False, .6, .45, .25, 0, 0, 0, .3)
                PySpell.knockback(e, VectorUP, .5)
                e.addPotionEffect(PotionEffect(PotionEffectType.SLOW, 101, 2))

        if self.t == 0:
            self.player.removeScoreboardTag('smoke_bomb')
コード例 #4
0
    def tick(self):
        if self.t == 0:
            PersistentDataAPI.setInt(PersistentDataAPI.getData(self.player),
                                     'totem_task', self.getTaskId())

        if not self.hit:
            if not self.totem.isOnGround():
                self.particle(
                    self.totem.getLocation().clone().add(0, 1, 0),
                    Particle.END_ROD
                    if self.clone else Particle.VILLAGER_HAPPY, 1, 0, 0, 0, 0)
                self.delay()

            else:
                self.hit = True

                self.totem.setMarker(True)

                self.holo = self.player.getWorld().spawnEntity(
                    self.totem.getLocation().clone().add(0, 2.7, 0),
                    EntityType.ARMOR_STAND)

                self.holo.setMarker(True)
                self.holo.setVisible(False)
                self.holo.setInvulnerable(True)
                self.holo.setCustomName(PySpell.colorText('20s', 'c'))
                self.holo.setCustomNameVisible(True)

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

                l = self.totem.getLocation()

                self.particle(l.clone().add(0, -1, 0), Particle.EXPLOSION_HUGE,
                              1, 0, 0, 0, 1)
                self.particle(
                    l, Particle.FIREWORKS_SPARK
                    if self.clone else Particle.CRIT_MAGIC, 5, 2, 2, 2, .8)
                self.particle(l, Particle.SQUID_INK, 5, 2, 2, 2, .5)

                self.sound(l, Sound.ENTITY_EVOKER_PREPARE_SUMMON, .9, 1.1)
                self.sound(l, Sound.ENTITY_IRON_GOLEM_DEATH, 1, .8)
                self.sound(l, Sound.ITEM_TOTEM_USE, .9, 1)
                if self.clone:
                    self.sound(l, Sound.ENTITY_FIREWORK_ROCKET_BLAST_FAR, 1,
                               .7)
                    self.sound(l, Sound.BLOCK_FIRE_EXTINGUISH, .5, .5)
                    self.sound(l, Sound.ENTITY_BLAZE_DEATH, .3, 1)

                for e in self.nearbyMobs(l, 4, 4, 4):
                    self.damage(e, False, 1, .8, 0, 0, 0, .2, 0)
                    PySpell.knockback(e, VectorUP, .5)

        else:
            if self.totem.isOnGround() and self.t >= 20:
                self.totem.setMarker(True)

            if self.t < 400:
                if self.t % 20 == 0:
                    self.holo.setCustomName(
                        PySpell.colorText('{0}s'.format((400 - self.t) // 20),
                                          'c'))

                    for e in self.player.getWorld().getNearbyEntities(
                            self.totem.getLocation(), 8, 4, 8):
                        if not isinstance(e, Mob):
                            continue

                        if isinstance(e, Player):
                            PySpell.heal(
                                e,
                                self.player.getAttribute(
                                    Attribute.GENERIC_MAX_HEALTH).getValue() /
                                10)

                        else:
                            self.damage(e, False, .2, .8, 0, 0, 0, 0, .2)

                l = self.totem.getLocation().clone().add(
                    Math.sin(self.t * 10 * DEG2RAD) * 8, .7,
                    Math.cos(self.t * 10 * DEG2RAD) * 8)
                self.particle(
                    l,
                    Particle.FIREWORKS_SPARK if self.clone else Particle.TOTEM,
                    1, 0, 0, 0, 0)

                self.particle(self.totem.getLocation().clone().add(0, 1, 0),
                              Particle.SPELL_MOB, 2, .5, 1, .5, .5)

                self.holo.teleport(self.totem.getLocation().clone().add(
                    0, 2.7, 0))

            else:
                self.totem.remove()
                self.holo.remove()

                self.player.removeScoreboardTag('totem')
コード例 #5
0
def delete_arrow(event):
    hit = event.getHitEntity()
    if not hit is None and not isinstance(hit, Player):
        PySpell.damage(event.getEntity().getShooter(), hit, 4)

    event.getEntity().remove()
コード例 #6
0
        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')


def delete_arrow(event):
    hit = event.getHitEntity()
    if not hit is None and not isinstance(hit, Player):
        PySpell.damage(event.getEntity().getShooter(), hit, 4)

    event.getEntity().remove()


PySpell.registerProjectileHit('rain_arrow', delete_arrow)
コード例 #7
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)
コード例 #8
0
 def catchable_mobs(self, l):
     return PySpell.nearbyMobsAndTag(self.player, l, 3, 3, 3, 'totem')
コード例 #9
0
ファイル: smoke_bomb.py プロジェクト: WynnLab/WynnLab
def bomb_hit(event):
    event.getEntity().remove()
    PySpell.castSpell(event.getEntity().getShooter(), 'ASSASSIN', 6, event.getHitEntity().getLocation() if not event.getHitEntity() is None else event.getHitBlock().getLocation())
コード例 #10
0
ファイル: smoke_bomb.py プロジェクト: WynnLab/WynnLab
from com.wynnlab.spells import PySpell

class Spell(PySpell):
    def tick(self):
        if self.player.hasPotionEffect(PotionEffectType.INVISIBILITY):
            self.castSpell('ASSASSIN', 5)

        self.sound(Sound.ENTITY_ENDER_PEARL_THROW if self.clone else Sound.ENTITY_SNOWBALL_THROW, .8, 1.3)
        self.sound(Sound.ENTITY_FIREWORK_ROCKET_BLAST_FAR, .8, 1.3)
        self.sound(Sound.ENTITY_GENERIC_EXTINGUISH_FIRE, 1, 1.6)

        v = self.player.getEyeLocation().getDirection().multiply(3)
        snowballs = (
            self.player.launchProjectile(Snowball, v),
            self.player.launchProjectile(Snowball, v.rotateAroundY(.4)),
            self.player.launchProjectile(Snowball, v.rotateAroundY(-.8))
        )

        for snowball in snowballs:
            if self.clone:
                snowball.setItem(ItemStack(Material.ENDER_PEARL))
            snowball.addScoreboardTag('smoke_bomb')

        self.player.addScoreboardTag('smoke_bomb')

def bomb_hit(event):
    event.getEntity().remove()
    PySpell.castSpell(event.getEntity().getShooter(), 'ASSASSIN', 6, event.getHitEntity().getLocation() if not event.getHitEntity() is None else event.getHitBlock().getLocation())

PySpell.registerProjectileHit('smoke_bomb', bomb_hit)
コード例 #11
0
    def tick(self):
        if self.t == 0:
            p_loc = self.player.getLocation().clone().add(0, 1, 0)
            self.particle(
                p_loc, Particle.VILLAGER_HAPPY
                if self.clone else Particle.SMOKE_LARGE, 5, .5, 2, .5, 0.1)
            self.particle(p_loc, Particle.CLOUD, 5, .5, 2, .5, .3)
            self.particle(p_loc, Particle.SQUID_INK, 8, .5, 2, .5, .2)

            self.sound(
                Sound.ENTITY_PLAYER_ATTACK_KNOCKBACK
                if self.clone else Sound.ENTITY_PLAYER_ATTACK_CRIT, .3, .6)
            self.sound(Sound.ENTITY_FIREWORK_ROCKET_LAUNCH, .8, 1)
            self.sound(Sound.ENTITY_BLAZE_SHOOT, 1, 1.1)

            if self.player.isOnGround():
                self.ground_start = True
            #else:
            #    self.player.playSound(self.player.getLocation(), Sound.ITEM_ELYTRA_FLYING, 1, .9)

            self.player.setVelocity(self.player.getEyeLocation().getDirection(
            ).setY(1) if self.ground_start else self.player.getEyeLocation().
                                    getDirection().multiply(2).setY(.2))

        if self.t <= 5:
            self.particle(self.player.getLocation(),
                          Particle.CLOUD if self.clone else Particle.SQUID_INK,
                          3, .2, .2, .2, .6)

        elif self.t < 10:
            if not self.player.isOnGround():
                self.player.setVelocity(
                    self.player.getEyeLocation().getDirection().multiply(
                        2).setY(-.3))
                self.particle(
                    self.player.getLocation(),
                    Particle.FIREWORKS_SPARK if self.clone else Particle.LAVA,
                    5 if self.clone else 2, .1, .1, .1, .4)
            else:
                self.particle(
                    self.player.getLocation().clone().add(0, 2, 0),
                    Particle.VILLAGER_HAPPY if self.clone else Particle.FLAME,
                    1, 0, 0, 0, .05)

                self.sound(Sound.ENTITY_GENERIC_EXPLODE, 1, 1.3)
                self.sound(Sound.BLOCK_STONE_STEP, 1, 1.3)
                if self.clone:
                    self.sound(Sound.ENTITY_FIREWORK_ROCKET_BLAST, 1, 1.3)
                    self.sound(Sound.ENTITY_BLAZE_AMBIENT, .2, 1.3)

                #self.player.stopSound(Sound.ITEM_ELYTRA_FLYING)

                self.cancel()

        else:
            self.sound(Sound.ENTITY_GENERIC_EXPLODE, 1, 1.3)
            self.sound(Sound.BLOCK_STONE_STEP, 1, 1.3)

            #self.player.stopSound(Sound.ITEM_ELYTRA_FLYING)

        hit_count = 0
        for e in self.nearbyMobs(1.5, 2, 1.5):
            self.damage(e, False, 1.5, .6, 0, 0, 0, .4, 0)
            PySpell.knockback(
                e,
                e.getLocation().clone().subtract(
                    self.player.getLocation()).toVector(), 1)
            hit_count += 1

        self.player.addPotionEffect(
            PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, hit_count * 20, 1,
                         True, False, True))
コード例 #12
0
def bomb_hit(event):
    arrow = event.getEntity()

    player = arrow.getShooter()
    clone = player.getScoreboardTags().contains('clone')

    if not arrow.getScoreboardTags().contains('bomb_hit_2'):
        next = arrow.getWorld().spawnArrow(
            arrow.getLocation().clone().add(0, .2, 0),
            arrow.getVelocity().clone().rotateAroundAxis(
                arrow.getFacing().getDirection(),
                Math.PI / 2).multiply(3).setY(1), .6, 0)
        if clone:
            snowball = arrow.getWorld().spawnEntity(next.getLocation(),
                                                    EntityType.SNOWBALL)
            snowball.setVelocity(next.getVelocity())
            snowball.setItem(ItemStack(Material.FLINT))
            next.remove()
            next = snowball

        next.setShooter(player)
        next.addScoreboardTag('bomb_arrow')
        next.addScoreboardTag('bomb_hit_2' if arrow.getScoreboardTags().
                              contains('bomb_hit_1') else 'bomb_hit_1')

    for e in PySpell.nearbyMobs(arrow.getWorld(), arrow.getLocation(), 4, 4,
                                4):
        PySpell.damage(player, e, 14)
        e.addPotionEffect(
            PotionEffect(PotionEffectType.SLOW, 60, 4, True, False, True))

    PySpell.sound(player, arrow.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1,
                  1.3)
    if clone:
        PySpell.sound(player, arrow.getLocation(),
                      Sound.ENTITY_FIREWORK_ROCKET_BLAST, .9, 1.1)
    particle_location = arrow.getLocation().clone().add(0, .5, 0)
    PySpell.particle(player, particle_location,
                     Particle.FIREWORKS_SPARK if clone else Particle.FLAME, 20,
                     .3, .3, .3, .1)
    PySpell.particle(player, particle_location,
                     Particle.VILLAGER_HAPPY if clone else Particle.SQUID_INK,
                     10, .3, .3, .3, .1)
    if not clone:
        PySpell.particle(player, particle_location, Particle.CLOUD, 5, .2, .2,
                         .2, .1)
    PySpell.particle(player, particle_location, Particle.EXPLOSION_LARGE, 1, 0,
                     0, 0, 0)

    arrow.remove()
コード例 #13
0
                              contains('bomb_hit_1') else 'bomb_hit_1')

    for e in PySpell.nearbyMobs(arrow.getWorld(), arrow.getLocation(), 4, 4,
                                4):
        PySpell.damage(player, e, 14)
        e.addPotionEffect(
            PotionEffect(PotionEffectType.SLOW, 60, 4, True, False, True))

    PySpell.sound(player, arrow.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1,
                  1.3)
    if clone:
        PySpell.sound(player, arrow.getLocation(),
                      Sound.ENTITY_FIREWORK_ROCKET_BLAST, .9, 1.1)
    particle_location = arrow.getLocation().clone().add(0, .5, 0)
    PySpell.particle(player, particle_location,
                     Particle.FIREWORKS_SPARK if clone else Particle.FLAME, 20,
                     .3, .3, .3, .1)
    PySpell.particle(player, particle_location,
                     Particle.VILLAGER_HAPPY if clone else Particle.SQUID_INK,
                     10, .3, .3, .3, .1)
    if not clone:
        PySpell.particle(player, particle_location, Particle.CLOUD, 5, .2, .2,
                         .2, .1)
    PySpell.particle(player, particle_location, Particle.EXPLOSION_LARGE, 1, 0,
                     0, 0, 0)

    arrow.remove()


PySpell.registerProjectileHit('bomb_arrow', bomb_hit)