def __init__(self, owner, start, end, icon):
     self.owner = owner
     self.end = end
     self.delta = end - start
     self.pos = start
     self.elapsed = False
     self.t = self.delta.magnitude() / CARD_SPEED
     self.kwargs = {}
     self.image = loader.get_image_size(icon, (ICON_SIZE, ICON_SIZE))
Exemple #2
0
 def drawIconCount(self, surface, image, n, x, y):
     icon = loader.get_image_size(image, (ICON_SIZE, ICON_SIZE))
     surface.blit(icon, (x, y))
     if n != None:
         txt = self.titleFont.render(str(n), True, (0, 0, 0))
         surface.blit(
             txt,
             Vector(x + ICON_SIZE + MARGIN_SIZE / 2,
                    y + ICON_SIZE / 2 - txt.get_rect().h / 2).toInt())
     return (x, y, ICON_SIZE, ICON_SIZE)
Exemple #3
0
    def draw(self, surface, position, cardData):
        #Render card frame & image
        cardRect = (*position, CARD_W, CARD_H)
        pygame.draw.rect(
            surface,
            HIGHLIGHT_COLOR if cardData.highlight else BORDER_COLOR,
            cardRect,
            border_radius=11)
        innerCardRect = (*(position + Vector(HIGHLIGHT_SIZE, HIGHLIGHT_SIZE)),
                         CARD_W - HIGHLIGHT_SIZE * 2,
                         CARD_H - HIGHLIGHT_SIZE * 2)
        pygame.draw.rect(surface,
                         cardData.color,
                         innerCardRect,
                         border_radius=11)
        image = loader.get_image_size(cardData.image, (IMAGE_W, IMAGE_H))
        surface.blit(image,
                     position + Vector(MARGIN_SIZE, TITLE_SIZE + MARGIN_SIZE))
        #render mana cost and name
        pygame.draw.circle(
            surface, MANA_COLOR,
            position + Vector(MANA_RADIUS + MARGIN_SIZE // 2,
                              MANA_RADIUS + MARGIN_SIZE // 2), MANA_RADIUS)
        cost = self.titleFont.render(str(cardData.cost), False, (0, 0, 0))
        surface.blit(
            cost, position +
            (Vector(MARGIN_SIZE // 2 + MANA_RADIUS, MARGIN_SIZE // 2 +
                    MANA_RADIUS) - Vector(*cost.get_rect().size) / 2).toInt())
        name = self.titleFont.render(cardData.name, True, (0, 0, 0))
        surface.blit(
            name,
            position + Vector(MARGIN_SIZE + MANA_RADIUS * 2, MARGIN_SIZE // 2))
        #Text Box
        consumedH = MARGIN_SIZE * 2 + TITLE_SIZE + IMAGE_H
        boxRect = (*(Vector(MARGIN_SIZE, consumedH) + position).toInt(),
                   CARD_W - 2 * MARGIN_SIZE, CARD_H - consumedH - MARGIN_SIZE)
        pygame.draw.rect(surface, TEXTBOX_COLOR, boxRect)

        writeText((self.textFont, self.boldFont, self.italicFont), surface,
                  cardData.text, pygame.rect.Rect(boxRect))

        if cardData.showTooltips:
            y = position.y
            x = position.x + CARD_W + MARGIN_SIZE * 1
            self.drawTooltips(surface, x, y, cardData.tooltips)
Exemple #4
0
 def drawExitViewer(self, surface):
     icon = loader.get_image_size("assets/exit.png", (ICON_SIZE, ICON_SIZE))
     surface.blit(icon, (MARGIN_SIZE, MARGIN_SIZE))
     return (MARGIN_SIZE, MARGIN_SIZE, ICON_SIZE, ICON_SIZE)
Exemple #5
0
 def __init__(self,size,name):
     self.image = loader.get_image_size("assets/beholder.png",(size,size))
     self.size = size
     self.name = name
     self.hp = 10
     self.intent = Attack(int(random.random()*20))