Exemple #1
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)
Exemple #2
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)
Exemple #3
0
def OnCommandFast(sender, args):
    for potion in sender.getActivePotionEffects():
        sender.removePotionEffect(potion.getType())

    sender.addPotionEffect(PotionEffect(PotionEffectType.SPEED, 5000, 50,
                                        True))
    sender.addPotionEffect(
        PotionEffect(PotionEffectType.FAST_DIGGING, 5000, 50, True))
    sender.addPotionEffect(PotionEffect(PotionEffectType.JUMP, 5000, 8, True))

    SendInfo(sender, "SUPER SPEED!")

    return True
Exemple #4
0
def OnCommandQuick(sender, args):
    for potion in sender.getActivePotionEffects():
        sender.removePotionEffect(potion.getType())

    sender.addPotionEffect(PotionEffect(PotionEffectType.SPEED, 50000, 3,
                                        True))
    sender.addPotionEffect(PotionEffect(PotionEffectType.JUMP, 50000, 2, True))
    sender.addPotionEffect(
        PotionEffect(PotionEffectType.NIGHT_VISION, 50000, 2, True))
    sender.addPotionEffect(
        PotionEffect(PotionEffectType.INCREASE_DAMAGE, 50000, 2, True))

    SendInfo(sender, "Super powers!")

    return True
Exemple #5
0
def OnCommandFoodfight(sender, args):
    if len(args) == 0:
        SendError(sender, "You must specify who you are to throw food at.")
        return True

    Item = random.choice(Food.items())

    receiver = Bukkit.getPlayer(args[0])

    if receiver == None:
        SendError(sender, 'No such player.')
        return True

    GiveItem(receiver, Item[1])

    Singular = ('a ', 'an ')[Item[0][0] in Vowels]

    Name = sender.getName()
    RName = receiver.getName()

    Bukkit.broadcastMessage(
        Color("5") + Name + Color("e") + " threw " + Singular + Color("6") +
        Item[0] + Color("c") + " at " + Color("5") + RName)

    if random.randint(1, 5) == 1:
        receiver.addPotionEffect(
            PotionEffect(PotionEffectType.BLINDNESS, 40, 1, True))

        Bukkit.broadcastMessage(Color("5") + "Headshot!")

    return True
Exemple #6
0
    def tick(self):
        self.ice_loc.add(
            BukkitUtils.normalizeOnXZ(
                self.player.getEyeLocation().getDirection()))

        ice_block = self.player.getWorld().spawnFallingBlock(
            self.ice_loc,
            Material.OBSIDIAN.createBlockData()
            if self.clone else Material.PACKED_ICE.createBlockData())
        ice_block.setDropItem(False)
        ice_block.setHurtEntities(False)

        self.particle(self.ice_loc, Particle.FIREWORKS_SPARK, 1, 1, 1, 1, .1)
        self.particle(
            self.ice_loc, Particle.BLOCK_CRACK, 9, 1, 1, 1, 1,
            Material.OBSIDIAN.createBlockData()
            if self.clone else Material.ICE.createBlockData())
        self.sound(
            self.ice_loc,
            Sound.BLOCK_STONE_PLACE if self.clone else Sound.BLOCK_GLASS_BREAK,
            2 if self.clone else 1, .75)
        self.sound(
            self.ice_loc, Sound.ENTITY_WITHER_BREAK_BLOCK
            if self.clone else Sound.BLOCK_FIRE_EXTINGUISH,
            .25 if self.clone else .5, 1.5 if self.clone else 1)

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

            e.addPotionEffect(PotionEffect(PotionEffectType.SLOW, 300, 4))
            self.damage(e, 1)
Exemple #7
0
def onMove(event):
    if event.getPlayer().getWorld().getName() != "minigames":
        return
    player = event.getPlayer()
    for arena in arenas:
        if arena.in_players(player):
            loc = player.getLocation()
            block = player.getWorld().getBlockAt(int(loc.x), int(loc.y) - 1, int(loc.z))
            if block != None:
                material = block.getType()
                if material == Material.SPONGE:
                    player.addPotionEffect(PotionEffect(PotionEffectType.JUMP, 60, 0))
                elif material == Material.GLASS or material == Material.STAINED_GLASS:
                    player.addPotionEffect(PotionEffect(PotionEffectType.SPEED, 60, 0))
                elif material == Material.OBSIDIAN:
                    player.addPotionEffect(PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 300, 0))
            break
Exemple #8
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))
Exemple #9
0
    def tick(self):
        if self.t == 0:
            self.sound(Sound.ENTITY_PLAYER_ATTACK_KNOCKBACK, .5, .5)
            self.sound(Sound.ENTITY_ENDER_DRAGON_FLAP, 1, 1)
            self.sound(Sound.ENTITY_ENDER_DRAGON_GROWL, .4, 1)

            for p in self.player.getWorld().getNearbyEntities(
                    self.player.getLocation(), 8, 8, 8):
                if not isinstance(p, Player):
                    continue

                p.addPotionEffect(
                    PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 4800, 2,
                                 True, False, True))
                p.addPotionEffect(
                    PotionEffect(PotionEffectType.INCREASE_DAMAGE, 4800, 1,
                                 True, False, True))

        if self.t <= 8:
            for i in range(0, 360, 45):
                l = self.player.getLocation().clone().add(
                    Math.sin(i * DEG2RAD) * (self.t + 1), .2,
                    Math.cos(i * DEG2RAD) * (self.t + 1))
                self.particle(
                    l, Particle.CLOUD if self.clone else Particle.SQUID_INK, 3,
                    .1, 0, .1, .1)
                self.particle(l, Particle.CRIT, 3, .1, 0, .1, .1)
                self.particle(
                    l, Particle.SPELL_MOB if self.clone else Particle.LAVA,
                    5 if self.clone else 1, .2, .2, .2, .5)

        self.scream_loc.add(self.scream_dir)

        if self.t >= 2:
            self.particle(self.scream_loc, Particle.EXPLOSION_LARGE, 1, 0, 0,
                          0, 0)

            for e in self.nearbyMobs(self.scream_loc, 3, 3, 3):
                self.damage(e, False, .3, 0, 0, 0, 0, .75, .25)
Exemple #10
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))
Exemple #11
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()
Exemple #12
0
    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, 2)
                e.addPotionEffect(PotionEffect(PotionEffectType.SLOW, 101, 2))

        if self.t == 0:
            self.player.removeScoreboardTag('smoke_bomb')
Exemple #13
0
    def bash(self):
        if not self.clone:
            self.particle(self.bash_loc, Particle.SMOKE_LARGE, 15, .5, .5, .5,
                          .1)
        self.particle(
            self.bash_loc,
            Particle.FIREWORKS_SPARK if self.clone else Particle.SQUID_INK,
            10 if self.clone else 5, .4, .4, .4, .4 if self.clone else .2)
        self.particle(self.bash_loc, Particle.CLOUD, 5, .2, .2, .2, .2)
        self.particle(self.bash_loc, Particle.EXPLOSION_LARGE, 1, 0, 0, 0, 0)
        self.sound(self.bash_loc, Sound.ENTITY_GENERIC_EXPLODE, 1, 1)

        hit_count = 0
        for e in self.nearbyMobs(self.bash_loc, 6, 6, 6):
            self.damage(e, False, 1.3, .6, .4, 0, 0, 0, 0)
            self.knockback(e, 2)
            hit_count += 1

        self.player.addPotionEffect(
            PotionEffect(PotionEffectType.INCREASE_DAMAGE, hit_count * 20, 1,
                         True, False, True))
Exemple #14
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))
Exemple #15
0
def OnCommandItemname(sender, args):
    if len(args) == 0:
        SendError(
            sender, "You must have an argument -" + Color("6") +
            " /eff [effect] [power] [duration]" + Color("c") +
            " you can also use 'rem' and 'list' as effects, for special functions"
        )
        return True

    if args[0] == "rem":
        if len(args) < 2:
            for effect in sender.getActivePotionEffects():
                sender.removePotionEffect(effect.getType())

            return True

        elif int(args[1]) < sender.getActivePotionEffects():
            effect = sender.getActivePotionEffects()[int(args[1])]
            sender.removePotionEffect(effect.getType())

            return True

    if args[0] == "list":
        if len(args) < 2:
            Bukkit.dispatchCommand(sender, "e")
        else:
            Bukkit.dispatchCommand(sender, "e " + args[1])

        return True

    if len(args) < 3:
        SendError(
            sender, "You must have the correct amount of arguments -" +
            Color("6") + " /eff [effect] [power] [duration]")
        return True

    for i in range(1, 2):
        if args[i].isdigit() == False:
            sender.sendMessage(
                Color("c") + "Your power and duration must be integers -" +
                Color("6") + " /eff [effect] [power] [duration]")
            return False

    args[0] = args[0].upper()
    args[0] = args[0].replace(" ", "")
    args[0] = args[0].replace(".", "")

    if len(args) == 4:
        receiver = Bukkit.getPlayer(args[3])

        if receiver == None:
            SendError("Invalid player")
            return True

    else:
        receiver = sender

    EffectStr = "PotionEffectType." + args[0]

    try:
        receiver.addPotionEffect(
            PotionEffect(eval(EffectStr), int(args[2]), int(args[1] - 1)))
    except:
        sender.sendMessage("Invalid effect")

    return True
Exemple #16
0
    def tick(self):
        if self.t == 0:
            # Find totem
            totem_id = PersistentDataAPI.getInt(
                PersistentDataAPI.getData(self.player), 'totem', None)
            for e in self.player.getNearbyEntities(16, 16, 16):
                if e.getEntityId() == totem_id:
                    self.totem = e

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

            self.sound(self.totem.getLocation(),
                       Sound.ENTITY_PLAYER_ATTACK_STRONG, .4, 1)
            self.sound(self.totem.getLocation(), Sound.ENTITY_SHULKER_SHOOT,
                       .9, .7)
            self.sound(self.totem.getLocation(),
                       Sound.ENTITY_EVOKER_CAST_SPELL, 1, 1.3)
            self.sound(self.totem.getLocation(),
                       Sound.ENTITY_EVOKER_PREPARE_SUMMON, .7, .5)

            if self.clone:
                self.sound(self.totem.getLocation(), Sound.ENTITY_BLAZE_SHOOT,
                           .7, .7)
                self.sound(self.totem.getLocation(),
                           Sound.ENTITY_FIREWORK_ROCKET_LAUNCH, .4, .6)

        elif self.t <= 10:
            i = 0
            while i < 360:
                l = self.totem.getLocation().clone().add(
                    Math.sin(i * DEG2RAD) * (self.t + 1), .4,
                    Math.cos(i * DEG2RAD) * (self.t + 1))

                self.particle(
                    l,
                    Particle.SPELL_MOB if self.clone else Particle.CRIT_MAGIC,
                    0 if self.clone else 1, self.clone, self.clone, self.clone,
                    self.clone)
                self.damageAndPull(l)

                i += 15 - self.t

        elif 15 < self.t <= 25:
            i = 0
            while i < 360:
                l = self.totem.getLocation().clone().add(
                    Math.sin(i * DEG2RAD) * (26 - self.t), .4,
                    Math.cos(i * DEG2RAD) * (26 - self.t))

                self.particle(
                    l,
                    Particle.SPELL_MOB if self.clone else Particle.CRIT_MAGIC,
                    0 if self.clone else 1, self.clone, self.clone, self.clone,
                    self.clone)
                self.damageAndPull(l)

                i += self.t - 14

        if self.t % 10 == 0:
            for i in range(0, 360, 20):
                self.particle(
                    self.totem.getLocation().clone().add(
                        Math.sin(i * DEG2RAD) * 2, 1.6,
                        Math.cos(i * DEG2RAD) * 2), Particle.FIREWORKS_SPARK,
                    1, 0, 0, 0, 0)

            for e in self.nearbyMobs(self.totem.getLocation(), 1, 1, 1):
                e.addPotionEffect(
                    PotionEffect(PotionEffectType.SLOW, 20, 9, True, False))

        if self.t == 10 or self.t == 25:
            self.hit = set()
Exemple #17
0
def OnCommandFoodfight(sender, args):
    if len(args) == 0:
        SendError(sender, "Usage: /slap [Player] [Object]")
        return True

    receiver = Bukkit.getPlayer(args[0])

    if receiver == None:
        SendError(sender, 'No such player.')
        return True

    if len(args) > 1:
        item = ' '.join(args[1:])
        number = '1'

        for i in args[1:]:
            if not i.isdigit() and i != 'some':
                if number != 1:
                    if i[len(i) - 1:] == 's':
                        Sudo(' '.join(('give', receiver.getName(),
                                       i[:len(i) - 1], number)))

                        if i[len(i) - 2:] == 'es':
                            Sudo(' '.join(('give', receiver.getName(),
                                           i[:len(i) - 2], number)))

                    else:
                        Sudo(' '.join(
                            ('give ', receiver.getName(), i, number)))

                else:
                    Sudo(' '.join(('give ', receiver.getName(), i, '1')))

            number = 1

            if i == 'some':
                number = str(random.randint(2, 8))

            if i.isdigit():
                number = i

        Word1 = args[1]

    else:
        item = 'large trout'
        i = 'fishy'
        Word1 = 'large'

        material = None

        GiveItem(receiver, 349)  # Fish

    if receiver == sender:
        receiverName = 'themselves'
    else:
        receiverName = receiver.getName()

    if not (Word1 == 'some' or Word1.isdigit()):
        if Word1[0].lower() in Vowels:
            amount = 'an '
        else:
            amount = 'a '
    else:
        amount = ''

    Bukkit.broadcastMessage(
        Color("5") + sender.getName() + Color("c") + " slapped " + Color("5") +
        receiverName + Color("c") + " about a bit with " + amount +
        Color("6") + item)

    if random.randint(0, 1):
        receiver.addPotionEffect(
            PotionEffect(PotionEffectType.CONFUSION, 160, 3, True))
    else:
        receiver.addPotionEffect(
            PotionEffect(PotionEffectType.SLOW, 40, 1, True))

    return True