Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions CInemon-IP/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
CINEMON IP - A Revolução

HISTÓRIA:
Você é um estudante da UFPE recrutado para conter a revolução de Pedro Noites, que criou criaturas digitais (CInemons) para dominar o campus e restaurar a grade antiga do CIn. Seu objetivo é escolher 3 CInemons e enfrentar os líderes revolucionários para restaurar a ordem acadêmica.

COMO JOGAR:
- Movimento: WASD ou setas
- Interação: Espaço
- Menu: ESC
- Batalhas:
1/2: Ataques
3: Trocar CInemon

CINEMONS DISPONÍVEIS:
🔥 Fogo: Heatbug, Patchburn
⚡ Elétrico: Pikacode, Ampereon
🌍 Terra: Minerbit, Terrabyte
💧 Água: Hydrabyte, Debbubble
🌿 Planta: Dataflora, Treebit

CHEFES:
1. (Área 2)
2. (CAC)
3. Pedro Noites (CIn) - com Paradoxium (tipo Discreto)

SISTEMA DE BATALHA:
Fogo > Planta > Terra > Elétrico > Água > Fogo
Tipos Especiais têm resistências únicas.

OBJETIVO FINAL:
Chegar no CIn, recuperando os pedaços dos crachás e impedindo Pedro Noites de restaurar a antiga grade do CIn

Gênero: RPG Acadêmico-Tático
Plataforma: PC (Python/Pygame)
Binary file added CInemon-IP/cinemons/Aetherbyte.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CInemon-IP/cinemons/Aqualynx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CInemon-IP/cinemons/Bitwhale.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CInemon-IP/cinemons/Butterfault.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CInemon-IP/cinemons/Discretex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CInemon-IP/cinemons/Emberfang.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CInemon-IP/cinemons/Firewall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CInemon-IP/cinemons/Granitex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CInemon-IP/cinemons/Grasscat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CInemon-IP/cinemons/Leafbyte.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CInemon-IP/cinemons/MinerByte.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CInemon-IP/cinemons/Paradoxium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CInemon-IP/cinemons/Redlion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CInemon-IP/cinemons/Serpython.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CInemon-IP/cinemons/Terrabyte.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added CInemon-IP/cinemons/pikacode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added CInemon-IP/code/__pycache__/gema.cpython-311.pyc
Binary file not shown.
Binary file added CInemon-IP/code/__pycache__/gema.cpython-312.pyc
Binary file not shown.
Binary file added CInemon-IP/code/__pycache__/gema.cpython-313.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added CInemon-IP/code/__pycache__/main.cpython-311.pyc
Binary file not shown.
Binary file added CInemon-IP/code/__pycache__/npc.cpython-311.pyc
Binary file not shown.
Binary file added CInemon-IP/code/__pycache__/npc.cpython-312.pyc
Binary file not shown.
Binary file added CInemon-IP/code/__pycache__/npc.cpython-313.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
221 changes: 221 additions & 0 deletions CInemon-IP/code/batalha_ui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
import pygame
import sys
import os
from jogo_base import JogoBase
from config import (tela, fonte, fonte_grande, relogio, CINZA, BRANCO, PRETO, VERMELHO, AZUL, VERDE, LARGURA, ALTURA)

class BatalhaUI(JogoBase):
def __init__(self):
super().__init__()
self.tempo_tremor_jogador = 0
self.tempo_tremor_inimigo = 0
self.tremor_offset_jogador = [0, 0]
self.tremor_offset_inimigo = [0, 0]
self.hp_jogador_anterior = None
self.hp_inimigo_anterior = None
self.sprites_cache = {}

def carregar_sprite_cinemon(self, nome, tamanho):
"""Carrega o sprite do CInemon com o tamanho especificado."""
chave_cache = f"{nome}_{tamanho[0]}x{tamanho[1]}"
if chave_cache in self.sprites_cache:
return self.sprites_cache[chave_cache]

sprite_path = os.path.join(r"Desktop\CInemon-IP\cinemons", f"{nome}.png")
try:
sprite = pygame.image.load(sprite_path).convert_alpha()
sprite = pygame.transform.scale(sprite, tamanho)
self.sprites_cache[chave_cache] = sprite
return sprite
except Exception as e:
print(f"Erro ao carregar sprite do CInemon {nome}: {e}")
return None

def desenhar_barra_vida(self, tela, x, y, hp_atual, hp_max, tempo_tremor, tremor_offset):
largura_barra = 200
altura_barra = 20
hp_atual = max(0, hp_atual)
proporcao = hp_atual / hp_max
largura_verde = int(largura_barra * proporcao)

offset_x = tremor_offset[0] if tempo_tremor > 0 else 0
offset_y = tremor_offset[1] if tempo_tremor > 0 else 0

pygame.draw.rect(tela, VERMELHO, (x + offset_x, y + offset_y, largura_barra, altura_barra))
pygame.draw.rect(tela, VERDE, (x + offset_x, y + offset_y, largura_verde, altura_barra))
pygame.draw.rect(tela, PRETO, (x + offset_x, y + offset_y, largura_barra, altura_barra), 2)

def renderizar_batalha(self, jogo):
tela.fill((200, 230, 255))

# Atualizar offsets de tremor
if self.tempo_tremor_jogador > 0:
self.tremor_offset_jogador = [pygame.time.get_ticks() % 2 * 4 - 2, pygame.time.get_ticks() % 2 * 4 - 2]
self.tempo_tremor_jogador -= 1
if self.tempo_tremor_inimigo > 0:
self.tremor_offset_inimigo = [pygame.time.get_ticks() % 2 * 4 - 2, pygame.time.get_ticks() % 2 * 4 - 2]
self.tempo_tremor_inimigo -= 1

pygame.draw.rect(tela, AZUL, (50, 50, 400, 200))
pygame.draw.rect(tela, VERMELHO, (LARGURA - 450, 50, 400, 200))

jogador = jogo.cinemon_jogador_atual
nome_jogador = fonte_grande.render(jogador.nome, True, BRANCO)
hp_jogador = fonte.render(f"HP: {max(0, jogador.hp)}/{jogador.hp_max}", True, BRANCO)
tela.blit(nome_jogador, (70, 70))
tela.blit(hp_jogador, (70, 110))
self.desenhar_barra_vida(tela, 70, 150, jogador.hp, jogador.hp_max,
self.tempo_tremor_jogador, self.tremor_offset_jogador)
sprite_jogador = self.carregar_sprite_cinemon(jogador.nome, (300, 300))
sprite_jogador_x = 70 + (self.tremor_offset_jogador[0] if self.tempo_tremor_jogador > 0 else 0)
sprite_jogador_y = 220 + (self.tremor_offset_jogador[1] if self.tempo_tremor_jogador > 0 else 0)
if sprite_jogador:
tela.blit(sprite_jogador, (sprite_jogador_x, sprite_jogador_y))
else:
pygame.draw.rect(tela, jogador.cor, (sprite_jogador_x, sprite_jogador_y, 300, 300))

inimigo = jogo.cinemon_inimigo_atual
nome_inimigo = fonte_grande.render(inimigo.nome, True, BRANCO)
hp_inimigo = fonte.render(f"HP: {max(0, inimigo.hp)}/{inimigo.hp_max}", True, BRANCO)
tela.blit(nome_inimigo, (LARGURA - 430, 70))
tela.blit(hp_inimigo, (LARGURA - 430, 110))
self.desenhar_barra_vida(tela, LARGURA - 430, 150, inimigo.hp, inimigo.hp_max,
self.tempo_tremor_inimigo, self.tremor_offset_inimigo)
sprite_inimigo = self.carregar_sprite_cinemon(inimigo.nome, (300, 300))
sprite_inimigo_x = (LARGURA - 430) + (self.tremor_offset_inimigo[0] if self.tempo_tremor_inimigo > 0 else 0)
sprite_inimigo_y = 220 + (self.tremor_offset_inimigo[1] if self.tempo_tremor_inimigo > 0 else 0)
if sprite_inimigo:
tela.blit(sprite_inimigo, (sprite_inimigo_x, sprite_inimigo_y))
else:
pygame.draw.rect(tela, inimigo.cor, (sprite_inimigo_x, sprite_inimigo_y, 300, 300))

pygame.draw.rect(tela, BRANCO, (50, ALTURA - 200, LARGURA - 100, 150))
pygame.draw.rect(tela, PRETO, (50, ALTURA - 200, LARGURA - 100, 150), 2)

linhas = jogo.mensagem_atual.split('\n')
for i, linha in enumerate(linhas):
texto = fonte.render(linha, True, PRETO)
tela.blit(texto, (70, ALTURA - 180 + i * 30))

if jogo.fase_batalha == 0 and jogo.turno_jogador and not jogo.aguardando_espaco:
opcoes = fonte.render(f"1. {jogador.ataques[0][0]} 2. {jogador.ataques[1][0]} 3. Trocar", True, PRETO)
tela.blit(opcoes, (LARGURA//2 - opcoes.get_width()//2, ALTURA - 50))

if jogo.aguardando_espaco:
instrucao = fonte.render("Pressione ESPAÇO para continuar", True, PRETO)
tela.blit(instrucao, (LARGURA//2 - instrucao.get_width()//2, ALTURA - 50))

self.hp_jogador_anterior = jogador.hp
self.hp_inimigo_anterior = inimigo.hp

def tela_trocar_cinemon(self, jogo):
for evento in pygame.event.get():
if evento.type == pygame.QUIT:
pygame.quit()
sys.exit()
if evento.type == pygame.KEYDOWN:
if evento.key == pygame.K_1 and len(jogo.jogador_cinemons) >= 1 and jogo.jogador_cinemons[0].hp > 0:
antigo = jogo.cinemon_jogador_atual.nome
jogo.cinemon_jogador_atual = jogo.jogador_cinemons[0]
jogo.mensagem_atual = f"Você trocou {antigo} por {jogo.cinemon_jogador_atual.nome}!"
jogo.estado = "batalha"
jogo.fase_batalha = 0
jogo.turno_jogador = True
jogo.aguardando_espaco = False
elif evento.key == pygame.K_2 and len(jogo.jogador_cinemons) >= 2 and jogo.jogador_cinemons[1].hp > 0:
antigo = jogo.cinemon_jogador_atual.nome
jogo.cinemon_jogador_atual = jogo.jogador_cinemons[1]
jogo.mensagem_atual = f"Você trocou {antigo} por {jogo.cinemon_jogador_atual.nome}!"
jogo.estado = "batalha"
jogo.fase_batalha = 0
jogo.turno_jogador = True
jogo.aguardando_espaco = False
elif evento.key == pygame.K_3 and len(jogo.jogador_cinemons) >= 3 and jogo.jogador_cinemons[2].hp > 0:
antigo = jogo.cinemon_jogador_atual.nome
jogo.cinemon_jogador_atual = jogo.jogador_cinemons[2]
jogo.mensagem_atual = f"Você trocou {antigo} por {jogo.cinemon_jogador_atual.nome}!"
jogo.estado = "batalha"
jogo.fase_batalha = 0
jogo.turno_jogador = True
jogo.aguardando_espaco = False
elif evento.key == pygame.K_ESCAPE:
jogo.estado = "batalha"

tela.fill((200, 200, 255))
titulo = fonte_grande.render("Escolha um CInemon", True, PRETO)
tela.blit(titulo, (LARGURA//2 - titulo.get_width()//2, 50))

for i, cinemon in enumerate(jogo.jogador_cinemons):
y = 150 + i * 150
retangulo_x = LARGURA//2 - 250
retangulo_largura = 500
retangulo_altura = 120

pygame.draw.rect(tela, BRANCO if cinemon.hp > 0 else CINZA,
(retangulo_x, y, retangulo_largura, retangulo_altura))
pygame.draw.rect(tela, PRETO,
(retangulo_x, y, retangulo_largura, retangulo_altura), 2)

sprite = self.carregar_sprite_cinemon(cinemon.nome, (100, 100))
sprite_x = retangulo_x + 20
sprite_y = y + (retangulo_altura - 100) // 2
if sprite:
tela.blit(sprite, (sprite_x, sprite_y))
else:
pygame.draw.rect(tela, cinemon.cor, (sprite_x, sprite_y, 100, 100))

texto_x = retangulo_x + 140
nome = fonte.render(f"{i+1}. {cinemon.nome} ({cinemon.tipo})", True, PRETO)
hp = fonte.render(f"HP: {max(0, cinemon.hp)}/{cinemon.hp_max}", True, PRETO)
status = fonte.render("ATIVO" if cinemon.hp > 0 else "DESMAIADO",
True, VERMELHO if cinemon.hp <= 0 else VERDE)

tela.blit(nome, (texto_x, y + 20))
tela.blit(hp, (texto_x, y + 50))
tela.blit(status, (texto_x, y + 80))

instrucao = fonte.render("Pressione 1-3 para escolher ou ESC para cancelar", True, PRETO)
tela.blit(instrucao, (LARGURA//2 - instrucao.get_width()//2, ALTURA - 50))

def processar_batalha(self, jogo):
for evento in pygame.event.get():
if evento.type == pygame.QUIT:
pygame.quit()
sys.exit()
if evento.type == pygame.KEYDOWN:
if evento.key == pygame.K_SPACE and jogo.aguardando_espaco:
jogo.aguardando_espaco = False
if jogo.cinemon_inimigo_atual.hp <= 0:
jogo.proximo_inimigo()
elif jogo.cinemon_jogador_atual.hp <= 0 and any(c.hp > 0 for c in jogo.jogador_cinemons):
jogo.estado = "trocar_cinemon"
elif jogo.cinemon_jogador_atual.hp <= 0 and not any(c.hp > 0 for c in jogo.jogador_cinemons):
pygame.quit()
sys.exit()
elif jogo.fase_batalha == 1:
jogo.fase_batalha = 2
jogo.turno_jogador = False
jogo.mensagem_atual = f"{jogo.cinemon_inimigo_atual.nome} está atacando..."
pygame.time.delay(1000)
hp_inimigo_antes = jogo.cinemon_inimigo_atual.hp
jogo.executar_ataque_inimigo()
if self.hp_jogador_anterior is not None and jogo.cinemon_jogador_atual.hp < self.hp_jogador_anterior:
self.tempo_tremor_jogador = 15
elif jogo.fase_batalha == 3:
jogo.fase_batalha = 0
jogo.turno_jogador = True
if jogo.fase_batalha == 0 and jogo.turno_jogador and not jogo.aguardando_espaco:
if evento.key == pygame.K_1:
jogo.acao_selecionada = 0
hp_inimigo_antes = jogo.cinemon_inimigo_atual.hp
jogo.executar_ataque_jogador()
if hp_inimigo_antes is not None and jogo.cinemon_inimigo_atual.hp < hp_inimigo_antes:
self.tempo_tremor_inimigo = 15
elif evento.key == pygame.K_2:
jogo.acao_selecionada = 1
hp_inimigo_antes = jogo.cinemon_inimigo_atual.hp
jogo.executar_ataque_jogador()
if hp_inimigo_antes is not None and jogo.cinemon_inimigo_atual.hp < hp_inimigo_antes:
self.tempo_tremor_inimigo = 15
elif evento.key == pygame.K_3:
jogo.estado = "trocar_cinemon"
22 changes: 22 additions & 0 deletions CInemon-IP/code/cinemon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from config import *

class CInemon:
def __init__(self, nome, tipo, hp_max, velocidade, ataques):
self.nome = nome
self.tipo = tipo
self.hp = hp_max
self.hp_max = hp_max
self.velocidade = velocidade
self.ataques = ataques
self.cor = self._definir_cor_tipo()

def _definir_cor_tipo(self):
cores = {
"FOGO": VERMELHO,
"AGUA": AZUL,
"PLANTA": VERDE,
"ELETRICO": AMARELO,
"TERRA": MARROM,
"ESPECIAL": ROXO
}
return cores.get(self.tipo, BRANCO)
35 changes: 35 additions & 0 deletions CInemon-IP/code/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# config.py
import pygame

# Constants
LARGURA = 1280
ALTURA = 720
VERDE = (0, 128, 0)
BRANCO = (255, 255, 255)
PRETO = (0, 0, 0)
VERMELHO = (255, 0, 0)
AZUL = (0, 0, 255)
ROXO = (128, 0, 128)
CINZA = (128, 128, 128)
AMARELO = (255, 255, 0)
AZUL_ESCURO = (0, 0, 128)
LARANJA = (255, 165, 0) # Added if needed
MARROM = (165, 42, 42) # Added if needed

# Type effectiveness (example, adjust as needed)
SISTEMA_DE_TIPOS = {
"FOGO": {"AGUA": 0.5, "PLANTA": 2.0, "FOGO": 0.5},
"AGUA": {"FOGO": 2.0, "TERRA": 0.5, "AGUA": 0.5},
"PLANTA": {"TERRA": 2.0, "FOGO": 0.5, "PLANTA": 0.5},
"TERRA": {"ELETRICO": 2.0, "AGUA": 2.0, "TERRA": 0.5},
"ELETRICO": {"AGUA": 2.0, "TERRA": 0.5, "ELETRICO": 0.5},
"ESPECIAL": {"ESPECIAL": 1.0} # Default for now
}

# Pygame initialization
pygame.init()
tela = pygame.display.set_mode((LARGURA, ALTURA))
pygame.display.set_caption("CINEMON IP - A Revolução")
relogio = pygame.time.Clock()
fonte = pygame.font.SysFont("Arial", 24)
fonte_grande = pygame.font.SysFont("Arial", 36)
37 changes: 37 additions & 0 deletions CInemon-IP/code/gema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import pygame
import os
import jogo_base



class Gema:
def __init__(self, x, y):
self.x = x # Posição X no mundo
self.y = y # Posição Y no mundo
self.collected = False # Estado de coleta
self.width = 32 # Tamanho visual do sprite
self.height = 32
self.rect = pygame.Rect(self.x + 8, self.y + 8, 16, 16) # Hitbox menor para colisão

# Carrega o sprite da gema
sprite_path = os.path.join("Desktop", "CInemon-IP", "sprites", "spr_gema_coletável_2.png")


self.sprite = pygame.image.load(sprite_path).convert_alpha()
self.sprite = pygame.transform.scale(self.sprite, (self.width, self.height))


def desenhar(self, tela, camera, zoom):
if not self.collected:
pos_x = (self.x - camera.x) * zoom
pos_y = (self.y - camera.y) * zoom
scaled_width = int(self.width * zoom)
scaled_height = int(self.height * zoom)

if self.sprite:
sprite_scaled = pygame.transform.scale(self.sprite, (scaled_width, scaled_height))

tela.blit(sprite_scaled, (pos_x, pos_y))
else:
rect_scaled = pygame.Rect(pos_x, pos_y, scaled_width, scaled_height)
pygame.draw.rect(tela, self.cor, rect_scaled)
Loading