Exemple #1
0
 def kill(self):
     self.stop()
     try:
         self.bubber.dragons.remove(self)
     except ValueError:
         pass
     ActiveSprite.kill(self)
Exemple #2
0
 def __init__(self, x0, y0, poplist, dirs=None, countdown=0, flip=''):
     ico = images.sprget((flip, Fire.ground[0]))
     ActiveSprite.__init__(self, ico, x0 * CELL, y0 * CELL)
     if not countdown:
         dirs = []
     self.poplist = poplist
     self.gen.append(self.burning(dirs, countdown))
     self.setimages(self.cyclic([(flip, n) for n in Fire.ground], 1))
Exemple #3
0
 def __init__(self, paddle):
     self.paddle = paddle
     imglist1 = GreenAndBlue.new_bubbles[paddle.bubber.pn]
     ActiveSprite.__init__(self, images.sprget(imglist1[0]),
                           paddle.x + paddle.ico.w // 2,
                           paddle.y - Ball.Y_MARGIN)
     self.missed = 0
     self.setimages(self.imgseq(imglist1[1:], 6))
     self.bounceangle(0.2)
     self.gen.append(self.flying())
Exemple #4
0
 def __init__(self, pacman, bubber, x, y, dcap):
     ico = GreenAndBlue.normal_bubbles[bubber.pn][1]
     PacSprite.__init__(self, images.sprget(('eyes', 0, 0)), x, y)
     self.bubble = ActiveSprite(images.sprget(ico), x, y)
     self.bubber = bubber
     self.pacman = pacman
     self.ready = 0
     self.gen.append(self.playing())
     self.pacman.pacs.append(self)
     self.dcap = dcap
Exemple #5
0
 def __init__(self, ico, x, y):
     import boards
     if y < -2 * CELL:
         y = -2 * CELL
     elif y > boards.bheight:
         y = boards.bheight
     x = (x + HALFCELL) & -CELL
     y = (y + HALFCELL) & -CELL
     ActiveSprite.__init__(self, ico, x, y)
     self.wannadx = self.wannady = 0
Exemple #6
0
 def crash(self):
     self.move(self.x - self.dir[0], self.y - self.dir[1],
               self.icons[self.dir+self.dir])
     self.to_back()
     self.play(snd_crash)
     ico = images.sprget(Monky.decay_weapon[1])
     s = ActiveSprite(ico, self.x + self.ico.w//2 - CELL,
                           self.y + self.ico.h//2 - CELL)
     s.gen.append(s.die(Monky.decay_weapon[1:], 4))
     self.stop()
Exemple #7
0
 def __init__(self, x, y, hspeed, author):
     if hspeed > 0:
         imgs = PlayerBubbles.right_weapon
     else:
         imgs = PlayerBubbles.left_weapon
     ActiveSprite.__init__(self, images.sprget(imgs[-1]), x, y)
     self.setimages(self.cyclic(imgs, 2))
     self.author = author
     self.gen.append(self.moving(hspeed))
     self.play(images.Snd.Shh)
Exemple #8
0
 def __init__(self, dragon, target, timeout):
     img = images.sprget(PlayerBubbles.explosion[2])
     ActiveSprite.__init__(self, img, -img.w, 0)
     self.dragon = dragon
     self.target = target
     self.timeout = timeout
     self.gen.append(self.follow())
     self.recenter(PlayerBubbles.explosion[2])
     for imgnum, delay in self.numlist:
         images.sprget(imgnum)  # preload
Exemple #9
0
 def __init__(self, arkanoid, bubber, px, py):
     ico = images.sprget(('ark-paddle', bubber.pn))
     ActiveSprite.__init__(self, ico, px - (ico.w - 2 * CELL) // 2,
                           py - (ico.h - 2 * CELL) // 2)
     self.arkanoid = arkanoid
     self.bubber = bubber
     self.timeleft = None
     self.gen.append(self.bounce_down())
     self.gen.append(self.bkgndstuff())
     self.arkanoid.paddles.append(self)
Exemple #10
0
 def __init__(self, x, y, poplist):
     ActiveSprite.__init__(self, images.sprget(SpinningBalls.free[-1]), x,
                           y)
     self.poplist = poplist
     self.gen.append(self.dropping())
     imgs = SpinningBalls.free
     if random.random() < 0.5:
         imgs = list(imgs)
         imgs.reverse()
     self.setimages(self.cyclic(imgs, random.randrange(2, 5)))
     self.touchable = 1
Exemple #11
0
 def to_front(self):
     ActiveSprite.to_front(self)
     if self.dcap['overlayglasses']:
         ico = images.sprget(('glasses', self.dir))
         y = self.y + self.overlayyoffset
         if self.overlaysprite is None or not self.overlaysprite.alive:
             self.overlaysprite = images.ActiveSprite(ico, self.x, y)
         else:
             self.overlaysprite.to_front()
             self.overlaysprite.move(self.x, y, ico)
         self.overlaysprite.gen = [self.overlaysprite.die([None])]
Exemple #12
0
 def kill(self):
     self.play(images.Snd.Pop)
     self.bubble.gen = [self.bubble.die(Bubble.exploding_bubbles)]
     self.pacman.latestposition[self.bubber] = self.x, self.y
     try:
         self.bubber.dragons.remove(self)
     except ValueError:
         pass
     try:
         self.pacman.pacs.remove(self)
     except ValueError:
         pass
     ActiveSprite.kill(self)
Exemple #13
0
 def kill(self):
     from monsters import Monster
     for s in self.take_with_me[:]:
         if isinstance(s, Monster) and s.alive:
             s.argh(self.poplist, onplace=1)
     del self.take_with_me[:]
     ActiveSprite.kill(self)
     if not self.watercells[None].alive:
         del self.watercells[None]
         for s in self.watercells.values():
             if s.alive:
                 s.in_charge()
                 break
Exemple #14
0
 def kill(self):
     images.Snd.Pop.play(1.0, pad=0.0)
     images.Snd.Pop.play(1.0, pad=1.0)
     ico = images.sprget(Bubble.exploding_bubbles[0])
     for i in range(11):
         s = ActiveSprite(ico, self.x + random.randrange(self.ico.w) - CELL,
                          self.y + random.randrange(self.ico.h) - CELL)
         s.gen.append(s.die(Bubble.exploding_bubbles))
     try:
         self.arkanoid.paddles.remove(self)
     except ValueError:
         pass
     ActiveSprite.kill(self)
Exemple #15
0
 def kill(self):
     try:
         BubPlayer.DragonList.remove(self)
     except ValueError:
         pass
     try:
         self.bubber.dragons.remove(self)
     except ValueError:
         pass
     ActiveSprite.kill(self)
     if self.hatsprite is not None:
         if self.hatsprite.alive:
             self.hatsprite.kill()
         self.hatsprite = None
Exemple #16
0
 def __init__(self, x, y, dir, watercells, poplist, repeat):
     ActiveSprite.__init__(self, images.sprget(Water.top), x, y)
     self.poplist = poplist
     self.take_with_me = []
     self.ping = 0
     self.repeat = repeat
     self.watercells = watercells
     self.touchable = repeat % 3 == 1
     if (x, y, dir) not in watercells:
         watercells[x, y, dir] = self
         if None not in watercells or not watercells[None].alive:
             self.in_charge()
     else:
         watercells[x, y, dir].join(self)
Exemple #17
0
 def __init__(self, mnstrdef, x=None, y=None, dir=None, in_list=None):
     self.mdef = mnstrdef
     self.ptag = None
     if dir is None: dir = mnstrdef.dir
     if x is None: x = mnstrdef.x * CELL
     if y is None: y = mnstrdef.y * CELL
     self.dir = dir
     ActiveSprite.__init__(self, images.sprget(self.imgrange()[0]), x, y)
     self.gen.append(self.waiting())
     if in_list is None:
         in_list = BubPlayer.MonsterList
     self.in_list = in_list
     self.in_list.append(self)
     self.no_shoot_before = 0
Exemple #18
0
 def __init__(self, owner, dx=CELL, dy=0):
     self.owner = owner
     self.speed = owner.dir * self.speed
     if owner.dir < 0:
         nimages = owner.mdef.left_weapon
     else:
         nimages = owner.mdef.right_weapon
     ActiveSprite.__init__(self, images.sprget(nimages[0]), owner.x,
                           owner.y + dy)
     self.step((owner.ico.w - self.ico.w) // 2,
               (owner.ico.h - self.ico.h) // 2)
     if not self.blocked():
         self.step(dx * owner.dir, 0)
     if len(nimages) > 1:
         self.setimages(self.cyclic(nimages, 3))
     self.gen.append(self.moving())
Exemple #19
0
    def __init__(self, camel, bubber, dcap, x, y, dirhint=None):
        self.bubber = bubber
        self.dcap = dcap
        self.camel = camel
        self.shotlist = camel.score.setdefault(bubber, {})

        if x < x_min:
            x = x_min
        elif x > x_max:
            x = x_max

        if y < 4 * CELL:
            y = 4 * CELL
        elif y > (curboard.height - 4) * CELL - 36:
            y = (curboard.height - 4) * CELL - 36

        if dirhint not in (1, -1):
            controldelay = 5
            if x < boards.bwidth // 2:
                dir = 1
            else:
                dir = -1
        else:
            controldelay = 20
            if x < boards.bwidth // 3:
                dir = 1
            elif x >= boards.bwidth * 2 // 3:
                dir = -1
            else:
                dir = dirhint
        if dir > 0:
            self.angle = 0
            self.flipped = False
        else:
            self.angle = 180
            self.flipped = True

        ActiveSprite.__init__(self, self.getico(), x, y)
        self.fx = self.x
        self.fy = self.y
        self.controlgen = self.control(delay=controldelay)
        self.gen.append(self.fly())
        self.gen.append(self.controlgen)
        self.gen.append(self.blink())
        self.gen.append(self.bob())
Exemple #20
0
 def emotic(self, dragon, strenght):
     bottom_up = hasattr(dragon, 'bottom_up') and dragon.bottom_up()
     vshift = getattr(dragon, 'up', 0.0)
     for i in range(7):
         angle = math.pi / 6 * i
         dx, dy = -math.cos(angle), -math.sin(angle)
         nx = random.randrange(3, 12) * dx
         ny = random.randrange(3, 9) * dy - 12
         if bottom_up:
             dy = -dy
             ny = -ny
         e = ActiveSprite(
             images.sprget(('vflip' * bottom_up, ('emotic', i))),
             int(dragon.x + 8 + nx), int(dragon.y + 8 + ny - vshift))
         e.gen.append(
             e.straightline((3.3 + random.random()) * dx,
                            (2.3 + random.random()) * dy))
         e.gen.append(e.die([None], strenght))
Exemple #21
0
 def __init__(self, tron, bubber, dcap, cx, cy, dir):
     self.tron = tron
     self.bubber = bubber
     self.dcap = dcap
     self.cx = cx
     self.cy = cy
     self.dir = dir
     self.icons = {}
     for key in localmap:
         ico = images.sprget((key, bubber.pn))
         key = key[1:]
         self.icons[key] = ico
         if len(key) == 4:
             dx1, dy1, dx2, dy2 = key
             key = -dx2, -dy2, -dx1, -dy1
             self.icons[key] = ico
     ActiveSprite.__init__(self, self.icons[self.dir],
                           self.cx*8-2, self.cy*8-2)
     self.gen.append(self.trailing())
Exemple #22
0
 def breakwalls(self, x, y0, dir):
     if self.dcap['breakwalls'] > BubPlayer.FrameCounter:
         return  # wait before breaking more walls
     if not (2 <= x < boards.curboard.width - 2):
         return
     ys = []
     for y in (y0, y0 - 1):
         if 0 <= y < boards.curboard.height and bget(x, y) == '#':
             ys.append(y)
     if len(ys) == 2:
         from bonuses import DustStar
         dir *= self.dcap['hspeed']
         for y in ys:
             w = boards.curboard.killwall(x, y)
             s = ActiveSprite(w.ico, w.x, w.y)
             dxy = [dir + random.random() - 0.5, -random.random() * 3.0]
             DustStar(w.x, w.y, dxy[0], dxy[1], big=0)
             s.gen.append(s.parabolic(dxy))
         self.dcap['breakwalls'] = BubPlayer.FrameCounter + 40
Exemple #23
0
 def control(self, delay=0):
     bubber = self.bubber
     prev_key_jump = 0
     for i in range(delay):
         yield None
     shootdelay = 0
     while True:
         wannago = bubber.wannago(self.dcap)
         self.turn(wannago)
         if shootdelay:
             shootdelay -= 1
         elif bubber.key_fire:
             x = self.x + self.ico.w // 2
             y = self.y + self.ico.h // 2
             acos, asin = ANGLE_TABLE[self.angle]
             x += acos * 20
             y += asin * 20
             if self.flipped:
                 acos = -acos
                 asin = -asin
             x -= asin * 5
             y += acos * 5
             self.play(snd_fire)
             Shot(self, int(x), int(y), self.angle, 2)
             Shot(self, int(x), int(y), self.angle)
             shootdelay = 7
         for i in range(2):
             if bubber.key_jump > prev_key_jump:
                 self.flipped = not self.flipped
             prev_key_jump = bubber.key_jump
             yield None
         for s in self.touching(12):
             if isinstance(s, Plane) and s is not self:
                 ico = images.sprget(Monky.decay_weapon[1])
                 s1 = ActiveSprite(
                     ico, (self.x + s.x) // 2 + self.ico.w // 2 - CELL,
                     (self.y + s.y) // 2 + self.ico.h // 2 - CELL)
                 s1.gen.append(s1.die(Monky.decay_weapon[1:], 4))
                 s1.play(snd_crash)
                 self.gen = [self.godowninflames(s)]
                 s.gen = [s.godowninflames(self)]
Exemple #24
0
 def godowninflames(self, hit_by_plane=None):
     if hit_by_plane and hit_by_plane in self.shotlist:
         hittime = self.shotlist[hit_by_plane]
         if BubPlayer.FrameCounter < hittime + 60:
             del self.shotlist[hit_by_plane]
             scoreboard()
     self.seticon(self.getico())
     self.gen.append(self.fly())
     trail = [(self.x, self.y)] * 7
     ico = images.sprget(PlayerBubbles.explosion[0])
     s = ActiveSprite(ico, self.x + self.ico.w // 2 - CELL,
                      self.y + self.ico.h // 2 - CELL)
     s.gen.append(s.die(PlayerBubbles.explosion))
     self.bubber.emotic(self, 4)
     while True:
         yield None
         if random.random() < 0.37:
             ico = images.sprget(Bubble.exploding_bubbles[0])
             x, y = random.choice(trail)
             x += random.randint(-10, 10)
             y += random.randint(-10, 10)
             s = ActiveSprite(ico, x + 2, y + 2)
             s.gen.append(s.die(Bubble.exploding_bubbles))
         if random.random() < 0.5:
             yield None
             if 90 <= self.angle < 270:
                 lst = [0, 0, 0, 0, -1, -1, -1, 1, 1]
             else:
                 lst = [0, 0, 0, 0, -1, -1, 1, 1, 1]
             self.turn(random.choice(lst))
         trail.pop(0)
         trail.append((self.x, self.y))
Exemple #25
0
 def __init__(self, bubber, x, y, dir, dcap=DCAP):
     self.bubber = bubber
     self.dir = dir
     icobubber = dcap.get('bubbericons', bubber)
     ActiveSprite.__init__(self, icobubber.icons[0, dir], x, y)
     self.fire = 0
     self.up = 0.0
     self.watermoveable = 0
     self.dcap = dcap.copy()
     self.dcap.update(self.bubber.pcap)
     BubPlayer.DragonList.append(self)
     self.gen.append(self.normal_movements())
     self.overlaysprite = None
     self.overlayyoffset = 4
     self.hatsprite = None
     self.hatangle = 1
     self.isdying = 0
     self.lifegained = 0
     self.playing_fish = False
     if BubPlayer.SuperSheep:
         self.become_monster('Sheep', immed=1)
     elif BubPlayer.SuperFish:
         self.become_fish()
Exemple #26
0
 def __init__(self, x, y, poplist=None):
     ActiveSprite.__init__(self, images.sprget(Fire.drop), x, y)
     self.poplist = poplist or [None]
     self.gen.append(self.dropping())
Exemple #27
0
 def __init__(self, bubber, saved_caps, bubble):
     ico = images.sprget(('eyes', 0, 0))
     ActiveSprite.__init__(self, ico, bubble.x, bubble.y)
     self.bubber = bubber
     self.dcap = saved_caps
     self.gen = [self.playing_bubble(bubble)]
Exemple #28
0
 def __init__(self, x, y, dir, poplist, diry=0):
     ActiveSprite.__init__(self, images.sprget(Lightning.fired), x, y)
     self.dir = int(13 * dir)
     self.diry = int(13 * diry)
     self.gen.append(self.moving(poplist))
Exemple #29
0
 def to_front(self):
     if self.gen:
         ActiveSprite.to_front(self)
Exemple #30
0
    def normal_movements(self):
        yfp = 0.0
        hfp = 0
        angryticks = 0
        mytime = 0
        privatetime = 0
        while 1:
            dcap = self.dcap
            self.poplist = [self]
            carrying = dcap['carrying']
            while carrying and carrying[0][0] < BubPlayer.FrameCounter:
                timeout, bonus = carrying.pop(0)
                if bonus.endaction:
                    bonus.endaction(self)
                del bonus

            bubber = self.bubber
            wannafire = bubber.getkey(dcap, 'key_fire')
            wannajump = bubber.getkey(dcap, 'key_jump')
            wannago = bubber.wannago(dcap)
            bottom_up = self.bottom_up()
            onground1 = (onground, underground)[bottom_up]

            if dcap['autofire']:
                wannafire = 1
            if dcap['pinball']:
                wannajump = 1
                if dcap['pinball'] > 1:
                    if self.up:
                        self.up *= 0.982**dcap['pinball']
            if dcap['hotstuff']:
                if not wannago:
                    if self.dir * (random.random() - 0.07) < 0:
                        wannago = -1
                    else:
                        wannago = 1
                wannafire = 1
                if self.fire > (11 // dcap['hotstuff']):
                    self.fire = 0
##                    if dcap['hotstuff'] > 1 and random.random() < 0.4:
##                        from bubbles import FireDrop
##                        FireDrop(self.x + HALFCELL, self.y + HALFCELL)
            if wannago:
                self.dir = wannago * dcap['lookforward']
            if self.x & 1:
                self.step(self.dir, 0)
            if dcap['slippy']:
                vx = dcap['vslippy']
                if wannago:
                    vx += wannago * 0.05
                else:
                    vx *= 0.95
                if vx < 0.0:
                    wannago = -1
                else:
                    wannago = 1
                dcap['vslippy'] = vx
                mytime = (mytime + dcap['lookforward']) % 12
                hfp += abs(vx)
            else:
                hfp += dcap['hspeed']


##            if self.glueddown:
##                if wannajump or not dcap['nojump']:
##                    del self.glueddown
##                else:
##                    # glued gliding movements
##                    self.step(self.x & 1, self.y & 1)
##                    if wannago:
##                        mytime = (mytime+dcap['lookforward']) % 12
##                    else:
##                        hfp = 0
##                    while hfp > 0 and self.glueddown:
##                        gx, gy = self.glueddown
##                        dx = wannago*gy
##                        dy = -wannago*gx
##                        x0 = (self.x + gx + dx) // CELL + 1
##                        y0 = (self.y + gy + dy) // CELL + 1
##                        if ' ' == bget(x0+dx, y0+dy) == bget(x0+dx-gx, y0+dy-gy):
##                            self.step(2*dx, 2*dy)
##                            # detached from this wall?
##                            x1 = (self.x + gx + dx) // CELL + 1
##                            y1 = (self.y + gy + dy) // CELL + 1
##                            if (' ' == bget(x1-dx+gx, y1-dy+gy)
##                                    == bget(x0   +gx, y0   +gy)
##                                    == bget(x0+dx+gx, y0+dy+gy)):
##                                if bget(x0-dx+gx, y0-dy+gy) != ' ':
##                                    # rotate around the corner
##                                    self.glueddown = -dx, -dy
##                                    self.step(2*gx, 2*gy)
##                                else:
##                                    del self.glueddown
##                        elif bget(x0-gx, y0-gy) == ' ':
##                            # attach to the wall into which we are running
##                            if (self.x*dx | self.y*dy) % CELL != 0:
##                                if ((((self.x-2*dx)*dx | (self.y-2*dy)*dy) &
##                                     ((self.x-4*dx)*dx | (self.y-4*dy)*dy))
##                                    % CELL == 0):
##                                    self.step(-2*dx, -2*dy)
##                                else:
##                                    del self.glueddown
##                            else:
##                                self.glueddown = dx, dy
##                        else:
##                            del self.glueddown
##                        self.vertical_warp()
##                        hfp -= 0.82   # slightly faster than usual
# normal left or right movements
            breakwalls = dcap['breakwalls']
            while hfp > 0:
                hfp -= 1
                dir = 0
                if wannago == -1:
                    x0 = (self.x + 1) // CELL
                    y0 = (self.y + 4 - bottom_up * (CELL + 4)) // CELL + 1
                    y0bis = (self.y + CELL - 1) // CELL + 1 - bottom_up
                    if bget(x0, y0) == ' ' == bget(x0, y0bis):
                        dir = -1
                    elif breakwalls:
                        self.breakwalls(x0, y0bis, -1)
                elif wannago == 1:
                    x0 = (self.x - 3) // CELL + 2
                    y0 = self.y // CELL + 1 - bottom_up
                    y0bis = (self.y + CELL - 1) // CELL + 1 - bottom_up
                    if bget(x0, y0) == ' ' == bget(x0, y0bis):
                        dir = +1
                    elif breakwalls:
                        self.breakwalls(x0, y0bis, 1)
                self.step(2 * dir, 0)
                if dir:
                    mytime = (mytime + dcap['lookforward']) % 12
                else:
                    f = -dcap['vslippy'] * (dcap['slippy'] + 1) / 3.0
                    dcap['vslippy'] = max(min(f, 10.0), -10.0)
                    hfp = 0
            onbubble = None
            if not dcap['infinite_shield']:
                touching = images.touching(self.x + 1, self.y + 1, 30, 30)
                touching.reverse()
                for s in touching:
                    if s.touched(self):
                        onbubble = s
            elif bubber.key_left or bubber.key_right or bubber.key_jump or bubber.key_fire:
                dcap['infinite_shield'] = 0

            dir = self.dir
            icons = self.getcurrenticons('vflip' * bottom_up)

            if self.playing_fish:
                mode = self.one_fish_frame(onground1, bottom_up)
            elif self.up:
                # going up
                mode = 9
                self.up -= dcap['gravity']
                if (self.up, -self.up)[bottom_up] < 4.0:
                    self.up = 0.0
                    mode = 10
                else:
                    ny = self.y + yfp - self.up
                    self.move(self.x, int(ny))
                    yfp = ny - self.y
                    self.vertical_warp()
                if wannago and dcap['teleport']:
                    for t in self.teleport(wannago, icons, 0):
                        yield t
            else:
                # going down or staying on ground
                if wannajump and onbubble:
                    ground = True
                    onbubble.dragon_jumped = True, bottom_up
                else:
                    ground = onground1(self.x, self.y)
                if ground:
                    if wannajump:
                        self.play(images.Snd.Jump)
                        if dcap['jumpdown'] and not onbubble:
                            self.step(0, (1, -1)[bottom_up])
                            mode = 10
                            bubber.emotic(self, 4)
                        else:
                            yfp = 0.0
                            self.up = (7.5, -7.5)[bottom_up]
                            mode = 9
                    else:
                        mode = mytime // 4
                        if wannago and dcap['teleport']:
                            for t in self.teleport(wannago, icons):
                                yield t
                else:
                    mode = 10
                    if dcap['fly']:
                        self.fly_counter += 1
                        if self.fly_counter < dcap['fly']:
                            ny = self.y
                        else:
                            del self.fly_counter
                            ny = self.y + (1, -1)[bottom_up]
                    else:
                        ny = (self.y + (4, -1)[bottom_up]) & ~3
                    nx = self.x
                    if nx < 32:
                        nx += 2
                    elif nx > boards.bwidth - 64:
                        nx -= 2
                    self.move(nx, ny)
                    self.vertical_warp()
                    if wannago and dcap['teleport']:
                        for t in self.teleport(wannago, icons, 0):
                            yield t

            if wannafire and not self.fire:
                self.firenow()
            self.hatangle = 1
            if self.fire:
                if self.fire <= 5:
                    mode = 3
                    self.hatangle = 2
                elif self.fire <= 10:
                    mode = 4
                    self.hatangle = 3
                self.fire += 1
                if self.fire >= 64 // dcap['firerate']:
                    self.fire = 0

            s = dcap['shield']
            if s:
                if dcap['infinite_shield'] and s < 20:
                    s += 4
                s -= 1
                if dcap['overlayglasses']:
                    self.overlayyoffset = ({
                        3: 2,
                        4: 0,
                        9: 3,
                        10: 5
                    }.get(mode, 4) + self.playing_fish * 2)
                elif s & 2:
                    mode = 11
                dcap['shield'] = s
            if dcap['ring']:  # and random.random() > 0.1:
                if dcap['ring'] > 1:
                    mode = 12
                else:
                    mode = 11
            self.seticon(icons[mode, dir])
            self.watermoveable = not wannajump

            privatetime += BubPlayer.PlayersPrivateTime
            while privatetime >= 100:
                yield None
                privatetime -= 100

            if self.angry:
                if angryticks == 0:
                    s = ActiveSprite(icons[11, self.dir], self.x, self.y)
                    s.gen.append(s.die([None], speed=10))
                    angryticks = 6
                angryticks -= 1