Pygame Game Development Essentials
Pygame Game Development Essentials
import random
import json
import os
import math
from datetime import datetime, timedelta
from enum import Enum
from typing import List, Dict, Optional, Tuple
# Inicializar Pygame
[Link]()
[Link]()
# Configurações
SCREEN_WIDTH = 1366
SCREEN_HEIGHT = 768
FPS = 60
# Cores Premium
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
BLUE = (41, 128, 185)
DARK_BLUE = (27, 79, 114)
LIGHT_BLUE = (174, 214, 241)
GREEN = (46, 204, 113)
LIGHT_GREEN = (171, 235, 198)
RED = (231, 76, 60)
LIGHT_RED = (236, 112, 99)
GOLD = (241, 196, 15)
GRAY = (149, 165, 166)
DARK_GRAY = (52, 73, 94)
LIGHT_GRAY = (236, 240, 241)
PURPLE = (155, 89, 182)
ORANGE = (230, 126, 34)
CYAN = (26, 188, 156)
# Gradientes Premium
GRADIENT_DARK = [(20, 20, 40), (40, 40, 80)]
GRADIENT_BLUE = [(41, 128, 185), (27, 79, 114)]
GRADIENT_GREEN = [(46, 204, 113), (39, 174, 96)]
GRADIENT_RED = [(231, 76, 60), (192, 57, 43)]
# Estados do Jogo
class GameState(Enum):
SPLASH = "splash"
MENU = "menu"
NEW_GAME = "new_game"
TEAM_SELECT = "team_select"
DASHBOARD = "dashboard"
ROSTER = "roster"
TRAINING = "training"
MARKET = "market"
FINANCES = "finances"
MATCH = "match"
MATCH_LIVE = "match_live"
CALENDAR = "calendar"
TACTICS = "tactics"
FACILITIES = "facilities"
STATISTICS = "statistics"
SCOUT = "scout"
CONTRACTS = "contracts"
HISTORY = "history"
SETTINGS = "settings"
ACHIEVEMENTS = "achievements"
# Sistema de Partículas
class Particle:
def __init__(self, x, y, vel_x, vel_y, color, size, lifetime):
self.x = x
self.y = y
self.vel_x = vel_x
self.vel_y = vel_y
[Link] = color
[Link] = size
[Link] = lifetime
self.max_lifetime = lifetime
def update(self):
self.x += self.vel_x
self.y += self.vel_y
self.vel_y += 0.2 # Gravidade
[Link] -= 1
[Link] *= 0.98
class ParticleSystem:
def __init__(self):
[Link] = []
def update(self):
[Link] = [p for p in [Link] if [Link] > 0]
for particle in [Link]:
[Link]()
# Sistema de Animação
class Animation:
def __init__(self, start, end, duration, ease_type="linear"):
[Link] = start
[Link] = end
[Link] = duration
self.ease_type = ease_type
[Link] = 0
[Link] = False
def update(self):
if not [Link]:
[Link] += 1
if [Link] >= [Link]:
[Link] = True
def get_value(self):
if [Link]:
return [Link]
t = [Link] / [Link]
# Sistema de Notificações
class Notification:
def __init__(self, text, type="info", duration=180):
[Link] = text
[Link] = type
[Link] = duration
[Link] = 0
self.y = -50
self.target_y = 100
[Link] = Animation(self.y, self.target_y, 20, "ease_out")
def update(self):
if not [Link]:
[Link]()
self.y = [Link].get_value()
else:
[Link] += 1
if [Link] >= [Link]:
# Animação de saída
if self.y > -50:
self.y -= 5
# Fundo da notificação
text_surface = [Link](f"{icon} {[Link]}", True, WHITE)
rect = text_surface.get_rect(center=(SCREEN_WIDTH//2, self.y))
# Sombra
shadow_rect = [Link](rect.x - 20, rect.y - 10 + 5, [Link] + 40,
[Link] + 20)
shadow_surface = [Link]((shadow_rect.width, shadow_rect.height))
shadow_surface.set_alpha(100)
shadow_surface.fill(BLACK)
[Link](shadow_surface, shadow_rect)
# Caixa principal
box_rect = [Link](rect.x - 20, rect.y - 10, [Link] + 40,
[Link] + 20)
[Link](screen, color, box_rect, border_radius=10)
[Link](screen, WHITE, box_rect, 2, border_radius=10)
# Texto
[Link](text_surface, rect)
# Botão Avançado
class Button:
def __init__(self, x, y, width, height, text, color=BLUE, text_color=WHITE,
font=None, icon=None, tooltip=None, sound=None):
[Link] = [Link](x, y, width, height)
[Link] = text
[Link] = color
self.original_color = color
self.text_color = text_color
[Link] = font or [Link](None, 24)
[Link] = icon
[Link] = tooltip
[Link] = sound
# Estados
[Link] = False
[Link] = False
[Link] = True
[Link] = True
# Animações
[Link] = 1.0
self.scale_animation = None
self.color_animation = None
mouse_pos = [Link].get_pos()
if [Link](mouse_pos):
if not [Link]:
[Link] = True
self.scale_animation = Animation(1.0, 1.05, 10, "ease_out")
return False
def update(self):
if self.scale_animation and not self.scale_animation.finished:
self.scale_animation.update()
[Link] = self.scale_animation.get_value()
# Sombra
shadow_rect = scaled_rect.copy()
shadow_rect.x += 4
shadow_rect.y += 4
shadow_surface = [Link]((shadow_rect.width, shadow_rect.height))
shadow_surface.set_alpha(80)
shadow_surface.fill(BLACK)
[Link](shadow_surface, shadow_rect)
# Botão principal
[Link](screen, color, scaled_rect, border_radius=10)
# Gradiente
for i in range(scaled_rect.height // 2):
alpha = 255 - (i * 2)
gradient_color = tuple(min(255, c + 20) for c in color)
gradient_rect = [Link](scaled_rect.x, scaled_rect.y + i,
scaled_rect.width, 2)
gradient_surface = [Link]((gradient_rect.width, 2))
gradient_surface.set_alpha(alpha // 4)
gradient_surface.fill(gradient_color)
[Link](gradient_surface, gradient_rect)
# Borda
[Link](screen, tuple(max(0, c - 30) for c in color),
scaled_rect, 2, border_radius=10)
# Ícone e texto
text_offset = 0
if [Link]:
icon_surface = [Link]([Link], True, self.text_color)
icon_rect = icon_surface.get_rect(midleft=(scaled_rect.x + 10,
scaled_rect.centery))
[Link](icon_surface, icon_rect)
text_offset = 30
# Texto
text_surface = [Link]([Link], True, self.text_color)
text_rect = text_surface.get_rect(center=(scaled_rect.centerx +
text_offset//2,
scaled_rect.centery))
[Link](text_surface, text_rect)
# Tooltip
if [Link] and [Link]:
self.draw_tooltip(screen)
# Fundo do tooltip
bg_rect = [Link](tooltip_rect.x - 10, tooltip_rect.y - 5,
tooltip_rect.width + 20, tooltip_rect.height + 10)
[Link](screen, DARK_GRAY, bg_rect, border_radius=5)
[Link](screen, WHITE, bg_rect, 1, border_radius=5)
[Link](tooltip_surface, tooltip_rect)
# Card Avançado
class Card:
def __init__(self, x, y, width, height, data=None):
[Link] = [Link](x, y, width, height)
[Link] = data
[Link] = False
[Link] = False
[Link] = None
self.offset_y = 0
if [Link](mouse_pos):
if not [Link]:
[Link] = True
[Link] = Animation(0, -5, 10, "ease_out")
return False
def update(self):
if [Link] and not [Link]:
[Link]()
self.offset_y = [Link].get_value()
class PlayerStats:
"""Estatísticas detalhadas do jogador"""
def __init__(self):
[Link] = {"kills": 0, "deaths": 0, "assists": 0}
self.cs_per_min = 0
self.vision_score = 0
self.damage_share = 0
self.gold_per_min = 0
self.kill_participation = 0
self.games_played = 0
[Link] = 0
[Link] = 0
[Link] = 0
[Link] = 0
self.perfect_games = 0
def calculate_kda(self):
if [Link]["deaths"] == 0:
return ([Link]["kills"] + [Link]["assists"])
return ([Link]["kills"] + [Link]["assists"]) / [Link]["deaths"]
def win_rate(self):
if self.games_played == 0:
return 0
return ([Link] / self.games_played) * 100
class Player:
"""Jogador com sistema completo"""
def __init__(self, name, position, age=20, nationality="BR"):
# Informações básicas
[Link] = self.generate_id()
[Link] = name
[Link] = name
[Link] = position
[Link] = age
[Link] = nationality
[Link] = None
# Overall e potencial
self.calculate_overall()
[Link] = min(99, [Link] + [Link](5, 20))
self.growth_rate = [Link](["slow", "normal", "fast"])
# Champion pool
self.champion_pool = self.generate_champion_pool()
self.signature_champions = []
# Lesões e condições
[Link] = None
self.injury_severity = 0
self.injury_recovery_days = 0
self.chronic_issues = []
# Contrato e finanças
[Link] = self.calculate_salary()
self.contract_years = 2
self.contract_months_remaining = 24
self.buyout_clause = [Link] * 24
self.market_value = self.calculate_market_value() # Agora [Link] já
existe
self.wage_demands = [Link]
self.signing_bonus = 0
self.performance_bonus = 0
self.stream_revenue = [Link](1000, 50000)
# Histórico
[Link] = []
[Link] = []
[Link] = []
[Link] = []
# Personalidade
[Link] = self.generate_personality()
[Link] = self.generate_playstyle()
self.preferred_champions = []
# Relacionamentos
[Link] = {} # Com outros jogadores
self.fan_favorite = False
def calculate_initial_popularity(self):
"""Calcula a popularidade inicial baseada em múltiplos fatores"""
base_popularity = 30
def calculate_social_media_followers(self):
"""Calcula seguidores baseado na popularidade"""
base_followers = [Link] * 1000
def calculate_salary(self):
"""Calcula salário baseado em múltiplos fatores"""
base = 50000
# Modificadores
age_mod = 1.0
if [Link] < 20:
age_mod = 0.7
elif [Link] > 28:
age_mod = 0.85
# Desenvolvimento
self.training_focus = None
[Link] = None
self.improvement_areas = []
self.bad_habits = []
def generate_id(self):
return f"player_{[Link](10000, 99999)}"
def calculate_overall(self):
# Peso diferente para cada atributo baseado na posição
weights = self.get_position_weights()
total = sum([Link][attr] * [Link](attr, 1.0)
for attr in [Link])
[Link] = int(total / sum([Link]()))
def get_position_weights(self):
"""Retorna pesos dos atributos baseado na posição"""
position_weights = {
"Top": {
"mechanics": 1.2, "laning": 1.3, "teamfighting": 1.1,
"mental": 1.2, "consistency": 1.1, "farming": 1.2
},
"Jungle": {
"game_sense": 1.5, "vision": 1.3, "shotcalling": 1.4,
"adaptability": 1.3, "mental": 1.1, "clutch": 1.2
},
"Mid": {
"mechanics": 1.5, "laning": 1.3, "positioning": 1.2,
"farming": 1.1, "clutch": 1.3, "aggression": 1.1
},
"ADC": {
"mechanics": 1.5, "positioning": 1.4, "farming": 1.3,
"teamfighting": 1.2, "consistency": 1.3, "mental": 1.1
},
"Support": {
"vision": 1.5, "shotcalling": 1.3, "communication": 1.4,
"game_sense": 1.3, "teamfighting": 1.2, "leadership": 1.2
}
}
return position_weights.get([Link], {attr: 1.0 for attr in
[Link]})
def generate_champion_pool(self):
"""Gera pool de campeões baseado na posição"""
champions_by_role = {
"Top": ["Aatrox", "Camille", "Darius", "Fiora", "Garen", "Gnar",
"Gragas",
"Gwen", "Irelia", "Jax", "Jayce", "K'Sante", "Kennen",
"Malphite",
"Mordekaiser", "Nasus", "Ornn", "Renekton", "Rumble", "Sion"],
"Jungle": ["Bel'Veth", "Briar", "Diana", "Ekko", "Elise", "Evelynn",
"Fiddlesticks",
"Graves", "Hecarim", "Ivern", "Jarvan IV", "Karthus", "Kayn",
"Kha'Zix",
"Kindred", "Lee Sin", "Lillia", "Maokai", "Master Yi",
"Nidalee"],
"Mid": ["Ahri", "Akali", "Akshan", "Anivia", "Annie", "Aurelion Sol",
"Azir",
"Cassiopeia", "Corki", "Diana", "Fizz", "Galio", "Hwei",
"Irelia",
"Kassadin", "Katarina", "LeBlanc", "Lissandra", "Lux",
"Malzahar"],
"ADC": ["Aphelios", "Ashe", "Caitlyn", "Draven", "Ezreal", "Jhin",
"Jinx",
"Kai'Sa", "Kalista", "Kog'Maw", "Lucian", "Miss Fortune",
"Nilah",
"Samira", "Senna", "Sivir", "Tristana", "Twitch", "Varus",
"Vayne"],
"Support": ["Alistar", "Bard", "Blitzcrank", "Braum", "Janna", "Karma",
"Leona",
"Lulu", "Lux", "Milio", "Morgana", "Nami", "Nautilus",
"Pyke",
"Rakan", "Rell", "Renata Glasc", "Senna", "Seraphine",
"Sona"]
}
pool = {}
champions = champions_by_role.get([Link], [])
return pool
def generate_personality(self):
"""Gera traços de personalidade"""
traits = {
"competitive": [Link](1, 10),
"teamwork": [Link](1, 10),
"leadership": [Link](1, 10),
"toxicity": [Link](1, 10),
"motivation": [Link](1, 10),
"discipline": [Link](1, 10),
"creativity": [Link](1, 10),
"pressure_handling": [Link](1, 10),
"learning_ability": [Link](1, 10),
"ego": [Link](1, 10)
}
return traits
def generate_playstyle(self):
"""Define estilo de jogo"""
styles = ["Aggressive", "Defensive", "Balanced", "Roamer", "Farmer",
"Playmaker", "Supportive", "Carry", "Tank", "Assassin"]
return [Link](styles)
def calculate_salary(self):
"""Calcula salário baseado em múltiplos fatores"""
base = 50000
# Modificadores
age_mod = 1.0
if [Link] < 20:
age_mod = 0.7
elif [Link] > 28:
age_mod = 0.85
def calculate_market_value(self):
"""Calcula valor de mercado complexo"""
base = 1000000
# Idade
age_value = 1.0
if [Link] < 21:
age_value = 1.4
elif [Link] < 24:
age_value = 1.2
elif [Link] > 27:
age_value = 0.8
# Potencial
potential_value = ([Link] - [Link]) * 50000
# Performance
performance_value = [Link].win_rate() * 10000
# Popularidade
popularity_value = [Link] * 5000
# Intensidades
intensities = {
"recovery": {"gain": 0.3, "energy_cost": 5, "stress": -10},
"light": {"gain": 0.6, "energy_cost": 10, "stress": -5},
"normal": {"gain": 1.0, "energy_cost": 20, "stress": 5},
"intensive": {"gain": 1.5, "energy_cost": 35, "stress": 15},
"extreme": {"gain": 2.0, "energy_cost": 50, "stress": 30}
}
# Calcula ganhos
improvements = {}
if training_type == "specific" and self.training_focus:
# Treino específico
attr = self.training_focus
if attr in [Link]:
max_gain = self.calculate_training_gain(attr)
gain = int(max_gain * intensity_data["gain"] * coach_bonus)
old_value = [Link][attr]
[Link][attr] = min([Link], [Link][attr] +
gain)
actual_gain = [Link][attr] - old_value
if actual_gain > 0:
improvements[attr] = actual_gain
else: # general
# Treino geral
for attr in [Link]:
if [Link]() < 0.3: # 30% chance para cada atributo
gain = int([Link](0, 2) * intensity_data["gain"] *
coach_bonus)
old_value = [Link][attr]
[Link][attr] = min([Link],
[Link][attr] + gain)
if [Link][attr] > old_value:
improvements[attr] = [Link][attr] - old_value
# Aplica custos
[Link] -= intensity_data["energy_cost"]
[Link] += intensity_data["stress"]
[Link] = max(0, min(100, [Link]))
# Risco de lesão
injury_risk = intensity_data["energy_cost"] / 200
if [Link] < 30:
injury_risk *= 2
if [Link] > 70:
injury_risk *= 1.5
# Burnout check
if [Link] > 90:
[Link] += 10
# Atualiza overall
self.calculate_overall()
if improvements:
return True, f"{[Link]} melhorou: {improvements}"
return True, f"{[Link]} treinou mas não melhorou significativamente"
# Modificador de idade
if [Link] < 20:
age_mod = 1.5
elif [Link] < 24:
age_mod = 1.2
elif [Link] < 27:
age_mod = 1.0
else:
age_mod = 0.7
# Modificador de potencial
potential_room = [Link] - [Link][attribute]
potential_mod = min(2.0, potential_room / 10)
injuries = {
"minor": {
"types": ["Muscle strain", "Minor sprain", "Bruise", "Fatigue"],
"days": (3, 7),
"severity": 1
},
"moderate": {
"types": ["Pulled muscle", "Ankle sprain", "Back pain",
"Tendinitis"],
"days": (7, 21),
"severity": 2
},
"severe": {
"types": ["Torn ligament", "Stress fracture", "Herniated disc",
"Severe sprain"],
"days": (21, 60),
"severity": 3
},
"career-threatening": {
"types": ["ACL tear", "Chronic wrist injury", "Severe burnout",
"Major surgery needed"],
"days": (60, 180),
"severity": 4
}
}
injury_data = injuries[severity]
[Link] = [Link](injury_data["types"])
self.injury_severity = injury_data["severity"]
self.injury_recovery_days = [Link](*injury_data["days"])
[Link] = 0
[Link] = max(0, [Link] - 30)
def recover_from_injury(self):
"""Recuperação de lesão"""
if self.injury_recovery_days > 0:
self.injury_recovery_days -= 1
# Recuperação gradual
if self.injury_recovery_days == 0:
[Link] = None
self.injury_severity = 0
[Link] = 50
self.calculate_overall() # Recalcula overall
return f"{[Link]} se recuperou completamente!"
elif self.injury_recovery_days < 7:
return f"{[Link]} está na fase final de recuperação
({self.injury_recovery_days} dias)"
return None
def age_progression(self):
"""Progressão com a idade"""
[Link] += 1
# Peak performance
if [Link] == self.peak_age:
# Bônus no peak
for attr in [Link]:
[Link][attr] = min(99, [Link][attr] +
[Link](1, 3))
self.calculate_overall()
# Modificadores
form_mod = [Link] / 100
energy_mod = [Link] / 100
morale_mod = [Link] / 100
stress_mod = 1 - ([Link] / 200) # Stress negativo
# Consistência
consistency = [Link]["consistency"] / 100
variance = [Link](1 - (1 - consistency) * 0.3, 1 + (1 -
consistency) * 0.3)
class Team:
"""Time com sistema completo"""
def __init__(self, name, tag, region="Brazil"):
# Identidade
[Link] = self.generate_id()
[Link] = name
[Link] = tag # Abreviação (ex: "LLL" para LOUD)
[Link] = region
self.founded_year = [Link](2010, 2020)
[Link] = self.generate_colors()
[Link] = None
# Elenco
[Link] = []
self.academy_players = []
self.starting_lineup = []
[Link] = None
[Link] = None
self.max_players = 10
# Staff técnico
[Link] = {
"head_coach": None,
"strategic_coach": None,
"assistant_coach": None,
"analyst": None,
"psychologist": None,
"physical_trainer": None,
"nutritionist": None,
"manager": None
}
# Tática e estratégia
[Link] = {
"playstyle": "balanced", # aggressive, defensive, balanced, etc
"early_game_focus": 50,
"late_game_focus": 50,
"objective_focus": 50,
"teamfight_focus": 50,
"split_push_focus": 50,
"vision_priority": 50
}
# Finanças
[Link] = [Link](3000000, 15000000)
self.wage_budget = [Link] * 0.6 # 60% para salários
[Link] = []
self.prize_money = 0
self.merchandise_revenue = 0
self.streaming_revenue = 0
# Instalações
[Link] = {
"gaming_house": 1, # 1-5 estrelas
"training_facility": 1,
"bootcamp_room": False,
"streaming_setup": False,
"gym": False,
"kitchen": False,
"relaxation_area": False,
"medical_center": False,
"analytics_room": False,
"content_studio": False
}
# Torcida e popularidade
[Link] = [Link](10000, 500000)
self.fan_satisfaction = 75
[Link] = 50
self.brand_value = [Link](1000000, 10000000)
self.social_media = {
"twitter": [Link](10000, 1000000),
"instagram": [Link](10000, 1000000),
"tiktok": [Link](10000, 1000000),
"youtube": [Link](10000, 1000000)
}
# Performance e estatísticas
self.season_stats = {
"games": 0,
"wins": 0,
"losses": 0,
"win_streak": 0,
"loss_streak": 0,
"best_streak": 0,
"worst_streak": 0,
"championships": [],
"tournament_placements": {}
}
# Histórico
[Link] = []
[Link] = []
[Link] = []
# Sinergia e química
self.team_chemistry = 50
self.team_cohesion = 50
self.internal_conflicts = []
# Objetivos
self.season_objectives = []
self.long_term_objectives = []
def generate_id(self):
return f"team_{[Link](10000, 99999)}"
def generate_colors(self):
"""Gera cores do time"""
color_schemes = [
{"primary": BLUE, "secondary": WHITE, "accent": GOLD},
{"primary": RED, "secondary": BLACK, "accent": WHITE},
{"primary": GREEN, "secondary": WHITE, "accent": BLACK},
{"primary": PURPLE, "secondary": GOLD, "accent": WHITE},
{"primary": ORANGE, "secondary": BLACK, "accent": WHITE},
{"primary": BLACK, "secondary": GOLD, "accent": RED},
{"primary": CYAN, "secondary": WHITE, "accent": BLACK}
]
return [Link](color_schemes)
def calculate_team_power(self):
"""Calcula poder total do time"""
if len([Link]) < 5:
return 0
def get_starting_lineup(self):
"""Retorna escalação titular"""
if self.starting_lineup:
# Verifica se todos estão disponíveis
available = []
for player_id in self.starting_lineup:
player = self.get_player_by_id(player_id)
if player and not [Link]:
[Link](player)
# Substitui lesionados
if len(available) < 5:
positions_needed = ["Top", "Jungle", "Mid", "ADC", "Support"]
for pos in positions_needed:
if not any([Link] == pos for p in available):
# Busca substituto
sub = self.find_substitute(pos)
if sub:
[Link](sub)
return available[:5]
def auto_select_lineup(self):
"""Seleciona automaticamente o melhor lineup"""
lineup = []
positions = ["Top", "Jungle", "Mid", "ADC", "Support"]
return lineup
# Contrata o jogador
[Link] = salary
player.contract_years = years
player.contract_months_remaining = years * 12
player.signing_bonus = signing_bonus
[Link](player)
[Link] -= signing_bonus
if len([Link]) <= 5:
return False, "Não pode dispensar! Mínimo de 5 jogadores!"
[Link](player)
[Link] -= buyout
def calculate_finances(self):
"""Calcula situação financeira"""
# Receitas
income = {
"sponsors": sum(s["value"] for s in [Link]) / 12, # Mensal
"prize_money": self.prize_money / 12,
"merchandise": self.merchandise_revenue,
"streaming": self.streaming_revenue,
"league_participation": 100000 # Participação na liga
}
# Despesas
expenses = {
"salaries": sum([Link] for p in [Link]),
"staff": sum(50000 for s in [Link]() if s),
"facilities": sum(10000 for f, v in [Link]()
if isinstance(v, int) and v > 0) * v,
"operations": 50000,
"travel": 20000,
"marketing": 30000
}
def update_chemistry(self):
"""Atualiza química do time"""
# Fatores que afetam química
factors = []
# Nacionalidades em comum
nationalities = [[Link] for p in [Link]]
most_common = max(set(nationalities), key=[Link])
common_ratio = [Link](most_common) / len([Link])
[Link](common_ratio * 20) # Até 20 pontos
# Idade similar
ages = [[Link] for p in [Link]]
age_variance = max(ages) - min(ages)
[Link](max(0, 20 - age_variance)) # Até 20 pontos
# Vitórias recentes
if self.season_stats["games"] > 0:
win_rate = self.season_stats["wins"] / self.season_stats["games"]
[Link](win_rate * 20) # Até 20 pontos
# Personalidades compatíveis
personality_conflicts = 0
for i, p1 in enumerate([Link]):
for p2 in [Link][i+1:]:
if [Link]["toxicity"] > 7 or [Link]["toxicity"] >
7:
personality_conflicts += 1
[Link](max(0, 20 - personality_conflicts * 2)) # Até 20 pontos
# Bônus do coach
coach_bonus = 1.0
if [Link]["head_coach"]:
coach_bonus = 1 + ([Link]["head_coach"].level / 10)
for player in [Link]:
if not [Link]:
success, message = [Link](focus, intensity, coach_bonus)
[Link](([Link], success, message))
return results
# Resultado
[Link] = None
[Link] = None
[Link] = {"team1": 0, "team2": 0} # Melhor de 1, 3 ou 5
# Estatísticas do jogo
self.game_stats = [] # Stats de cada jogo
self.match_duration = 0
[Link] = None
# Eventos do jogo
[Link] = []
[Link] = []
# Draft
[Link] = {
"team1": {"bans": [], "picks": []},
"team2": {"bans": [], "picks": []}
}
if game_result["winner"] == self.team1:
team1_wins += 1
else:
team2_wins += 1
self.game_stats.append(game_result)
[Link]["team1"] = team1_wins
[Link]["team2"] = team2_wins
if team1_wins > team2_wins:
[Link] = self.team1
[Link] = self.team2
else:
[Link] = self.team2
[Link] = self.team1
# Escolhe MVP
self.select_mvp()
return [Link]
def simulate_game(self):
"""Simula um jogo individual"""
# Draft phase
self.simulate_draft()
# Determina vencedor
if team1_power > team2_power:
winner = self.team1
else:
winner = self.team2
# Duração do jogo
duration = [Link](20, 45)
return {
"winner": winner,
"duration": duration,
"events": game_events,
"team1_power": team1_power,
"team2_power": team2_power
}
def simulate_draft(self):
"""Simula o draft (pick/ban)"""
# Lista de campeões meta por posição
meta_champions = {
"Top": ["K'Sante", "Aatrox", "Jax", "Gnar", "Renekton"],
"Jungle": ["Viego", "Maokai", "Vi", "Jarvan IV", "Lee Sin"],
"Mid": ["Azir", "Orianna", "Ahri", "Sylas", "Akali"],
"ADC": ["Kalista", "Xayah", "Kai'Sa", "Aphelios", "Lucian"],
"Support": ["Nami", "Lulu", "Rakan", "Thresh", "Renata"]
}
# Simula bans (3 para cada time)
all_champions = [champ for role in meta_champions.values() for champ in
role]
for _ in range(3):
if all_champions:
ban = [Link](all_champions)
[Link]["team1"]["bans"].append(ban)
all_champions.remove(ban)
if all_champions:
ban = [Link](all_champions)
[Link]["team2"]["bans"].append(ban)
all_champions.remove(ban)
# Simula picks
for position in ["Top", "Jungle", "Mid", "ADC", "Support"]:
available = [c for c in meta_champions[position] if c in all_champions]
if available:
pick = [Link](available)
[Link]["team1"]["picks"].append(pick)
all_champions.remove(pick)
if available:
available = [c for c in available if c != pick]
if available:
pick = [Link](available)
[Link]["team2"]["picks"].append(pick)
all_champions.remove(pick)
# First Blood
fb_time = [Link](2, 8)
if [Link]() < team1_power / (team1_power + team2_power):
[Link]({
"time": fb_time,
"type": "first_blood",
"team": [Link],
"description": f"First Blood para {[Link]}!"
})
else:
[Link]({
"time": fb_time,
"type": "first_blood",
"team": [Link],
"description": f"First Blood para {[Link]}!"
})
# Dragons
dragon_times = [5, 10, 15, 20, 25, 30]
for time in dragon_times:
if [Link]() < 0.7: # 70% chance de dragon ser feito
if [Link]() < team1_power / (team1_power + team2_power):
team = [Link]
else:
team = [Link]
[Link]({
"time": time,
"type": "dragon",
"team": team,
"description": f"{team} conquista o Dragão!"
})
[Link]({
"time": baron_time,
"type": "baron",
"team": team,
"description": f"{team} derrota o Baron Nashor!"
})
# Team fights
for _ in range([Link](3, 7)):
tf_time = [Link](10, 40)
if [Link]() < team1_power / (team1_power + team2_power):
team = [Link]
result = "vence"
else:
team = [Link]
result = "vence"
[Link]({
"time": tf_time,
"type": "teamfight",
"team": team,
"description": f"{team} {result} uma teamfight!"
})
# Ordena eventos por tempo
[Link](key=lambda x: x["time"])
return events
def select_mvp(self):
"""Seleciona o MVP da partida"""
# MVP geralmente vem do time vencedor
mvp_team = [Link].get_starting_lineup()
if mvp_team:
# Calcula score de cada jogador
mvp_scores = []
for player in mvp_team:
score = [Link]
mvp_scores.append((player, score))
# Escolhe o MVP
mvp_scores.sort(key=lambda x: x[1], reverse=True)
[Link] = mvp_scores[0][0]
[Link] += 1
def update_team_stats(self):
"""Atualiza estatísticas dos times"""
# Time vencedor
[Link].season_stats["games"] += 1
[Link].season_stats["wins"] += 1
[Link].season_stats["win_streak"] += 1
[Link].season_stats["loss_streak"] = 0
if [Link].season_stats["win_streak"] >
[Link].season_stats["best_streak"]:
[Link].season_stats["best_streak"] =
[Link].season_stats["win_streak"]
# Time perdedor
[Link].season_stats["games"] += 1
[Link].season_stats["losses"] += 1
[Link].season_stats["loss_streak"] += 1
[Link].season_stats["win_streak"] = 0
if [Link].season_stats["loss_streak"] >
[Link].season_stats["worst_streak"]:
[Link].season_stats["worst_streak"] =
[Link].season_stats["loss_streak"]
# Ícone
icon_surface = [Link]((32, 32))
[Link](icon_surface, GOLD, (16, 16), 15)
[Link].set_icon(icon_surface)
# Clock e FPS
[Link] = [Link]()
[Link] = True
[Link] = FPS
[Link] = 0
# Fontes
[Link] = {
"tiny": [Link](None, 16),
"small": [Link](None, 20),
"medium": [Link](None, 28),
"large": [Link](None, 36),
"huge": [Link](None, 48),
"title": [Link](None, 64)
}
# Estado do jogo
[Link] = [Link]
self.previous_state = None
[Link] = None
# Dados do jogo
self.user_team = None
self.all_teams = []
self.all_players = []
self.free_agents = []
self.staff_available = []
# Competições
[Link] = {}
[Link] = []
self.current_season = 1
self.current_split = "Spring"
self.current_week = 1
# Interface
[Link] = {}
[Link] = []
[Link] = []
self.scroll_offset = 0
self.selected_item = None
# Sistemas
self.particle_system = ParticleSystem()
[Link] = []
[Link] = []
# Sons
[Link] = {}
self.music_volume = 0.5
self.sfx_volume = 0.7
# Configurações
[Link] = {
"auto_save": True,
"notifications": True,
"particles": True,
"animations": True,
"tutorial": True,
"difficulty": "normal"
}
# Inicialização
self.init_sounds()
self.init_game_data()
self.create_interface()
def init_sounds(self):
"""Inicializa sistema de som"""
try:
# Sons de UI
# [Link]["click"] = [Link]("assets/sounds/[Link]")
# [Link]["hover"] = [Link]("assets/sounds/[Link]")
# [Link]["success"] =
[Link]("assets/sounds/[Link]")
# [Link]["error"] = [Link]("assets/sounds/[Link]")
pass
except:
print("Sons não encontrados, continuando sem áudio")
def init_game_data(self):
"""Inicializa todos os dados do jogo"""
# Cria times da LTA Sul
self.create_lta_teams()
# Cria ligas
self.create_leagues()
def create_lta_teams(self):
"""Cria times reais da LTA Sul"""
teams_data = [
{"name": "LOUD", "tag": "LLL", "budget": 15000000},
{"name": "paiN Gaming", "tag": "PNG", "budget": 12000000},
{"name": "RED Canids", "tag": "RED", "budget": 10000000},
{"name": "FURIA", "tag": "FUR", "budget": 11000000},
{"name": "INTZ", "tag": "ITZ", "budget": 8000000},
{"name": "Fluxo", "tag": "FLX", "budget": 7000000},
{"name": "Liberty", "tag": "LBR", "budget": 6000000},
{"name": "Vivo Keyd", "tag": "VKS", "budget": 5000000}
]
# Reservas
for i in range(2):
pos = [Link](positions)
player = Player(
f"{team_data['tag']}_Sub{i+1}",
pos,
[Link](17, 22),
"BR"
)
team.sign_player(player)
self.all_players.append(player)
self.all_teams.append(team)
def create_free_agents(self):
"""Cria jogadores livres no mercado"""
for i in range(50):
positions = ["Top", "Jungle", "Mid", "ADC", "Support"]
nationalities = ["BR", "BR", "KR", "CN", "EU", "NA", "TR", "JP"]
player = Player(
f"FreeAgent_{i+1}",
[Link](positions),
[Link](16, 28),
[Link](nationalities)
)
self.free_agents.append(player)
self.all_players.append(player)
def create_available_staff(self):
"""Cria staff disponível para contratação"""
# Implementar criação de coaches, analistas, etc
pass
def create_leagues(self):
"""Cria as ligas e competições"""
# LTA Sul
[Link]["LTA Sul"] = {
"teams": self.all_teams,
"schedule": [],
"standings": [],
"current_round": 1,
"total_rounds": 18
}
def create_interface(self):
"""Cria interface do jogo"""
self.create_menu_buttons()
self.create_dashboard_buttons()
def create_menu_buttons(self):
"""Cria botões do menu principal"""
[Link]["menu"] = [
Button(SCREEN_WIDTH//2 - 200, 320, 400, 70, "Novo Jogo", GREEN,
icon="🎮", tooltip="Começar uma nova carreira"),
Button(SCREEN_WIDTH//2 - 200, 400, 400, 70, "Carregar Jogo", BLUE,
icon="📁", tooltip="Continuar jogo salvo"),
Button(SCREEN_WIDTH//2 - 200, 480, 400, 70, "Configurações", PURPLE,
icon="⚙️", tooltip="Ajustar configurações"),
Button(SCREEN_WIDTH//2 - 200, 560, 400, 70, "Sair", RED,
icon="🚪", tooltip="Sair do jogo")
]
def create_dashboard_buttons(self):
"""Cria botões do dashboard"""
# Implementar botões do dashboard
pass
def handle_events(self):
"""Processa eventos do jogo"""
for event in [Link]():
if [Link] == [Link]:
[Link] = False
def update(self):
"""Atualiza lógica do jogo"""
# Atualiza animações
if hasattr(self, 'animations'):
for anim in [Link]:
[Link]()
# Atualiza partículas
if [Link]["particles"]:
self.particle_system.update()
# Atualiza notificações
for notif in [Link][:]:
[Link]()
if [Link] >= [Link] and notif.y <= -50:
[Link](notif)
# Atualiza botões
for button_group in [Link]():
if isinstance(button_group, list):
for button in button_group:
[Link]()
# Atualiza cards
for card in [Link]:
[Link]()
def draw(self):
"""Desenha o jogo"""
# Desenha baseado no estado
if [Link] == [Link]:
self.draw_splash()
elif [Link] == [Link]:
self.draw_menu()
elif [Link] == GameState.NEW_GAME:
self.draw_new_game()
elif [Link] == GameState.TEAM_SELECT:
self.draw_team_select()
elif [Link] == [Link]:
self.draw_dashboard()
# Adicionar outros estados...
def draw_splash(self):
"""Desenha splash screen"""
# Fundo gradiente
self.draw_gradient(GRADIENT_DARK[0], GRADIENT_DARK[1])
# Logo
logo_text = [Link]["title"].render("LoL MANAGER", True, GOLD)
logo_rect = logo_text.get_rect(center=(SCREEN_WIDTH//2, SCREEN_HEIGHT//2 -
50))
[Link](logo_text, logo_rect)
# Subtítulo
subtitle = [Link]["large"].render("ULTIMATE EDITION", True, WHITE)
subtitle_rect = subtitle.get_rect(center=(SCREEN_WIDTH//2, SCREEN_HEIGHT//2
+ 20))
[Link](subtitle, subtitle_rect)
# Versão
version = [Link]["small"].render("v1.0.0 Ultimate", True, GRAY)
version_rect = version.get_rect(bottomright=(SCREEN_WIDTH - 10,
SCREEN_HEIGHT - 10))
[Link](version, version_rect)
def draw_menu(self):
"""Desenha menu principal"""
# Fundo
self.draw_gradient(GRADIENT_BLUE[0], GRADIENT_BLUE[1])
# Painel central
panel_rect = [Link](SCREEN_WIDTH//2 - 250, 100, 500, 550)
[Link]([Link], (*BLACK, 180), panel_rect, border_radius=20)
# Logo
logo_text = [Link]["huge"].render("LoL MANAGER", True, GOLD)
logo_rect = logo_text.get_rect(center=(SCREEN_WIDTH//2, 180))
[Link](logo_text, logo_rect)
# Linha decorativa
[Link]([Link], GOLD,
(SCREEN_WIDTH//2 - 150, 260),
(SCREEN_WIDTH//2 + 150, 260), 2)
# Desenha botões
for button in [Link]["menu"]:
[Link]([Link])
# Informações adicionais
info_text = [Link]["small"].render("© 2024 - Desenvolvido com Pygame",
True, GRAY)
info_rect = info_text.get_rect(center=(SCREEN_WIDTH//2, SCREEN_HEIGHT -
30))
[Link](info_text, info_rect)
def draw_new_game(self):
"""Desenha tela de novo jogo"""
self.draw_gradient(GRADIENT_DARK[0], GRADIENT_DARK[1])
# Título
title = [Link]["large"].render("CONFIGURAR NOVO JOGO", True, GOLD)
title_rect = title.get_rect(center=(SCREEN_WIDTH//2, 50))
[Link](title, title_rect)
# Painel de configurações
config_panel = [Link](100, 100, SCREEN_WIDTH - 200, SCREEN_HEIGHT -
200)
[Link]([Link], (*WHITE, 240), config_panel,
border_radius=15)
[Link]([Link], DARK_GRAY, config_panel, 3, border_radius=15)
# Opções
y = 150
# Nome do técnico
name_label = [Link]["medium"].render("Nome do Técnico:", True, BLACK)
[Link](name_label, (150, y))
y += 60
# Dificuldade
diff_label = [Link]["medium"].render("Dificuldade:", True, BLACK)
[Link](diff_label, (150, y))
y += 60
# Região inicial
region_label = [Link]["medium"].render("Região:", True, BLACK)
[Link](region_label, (150, y))
# Botões de ação
start_btn = Button(SCREEN_WIDTH//2 - 250, SCREEN_HEIGHT - 150, 200, 60,
"Começar", GREEN, icon="▶️")
start_btn.draw([Link])
def draw_team_select(self):
"""Desenha seleção de time"""
self.draw_gradient(GRADIENT_DARK[0], GRADIENT_DARK[1])
# Título
title = [Link]["large"].render("ESCOLHA SEU TIME", True, GOLD)
title_rect = title.get_rect(center=(SCREEN_WIDTH//2, 40))
[Link](title, title_rect)
# Grid de times
x, y = 100, 100
card_width, card_height = 300, 150
# Borda
[Link]([Link], WHITE, card_rect, 3, border_radius=10)
# Nome do time
team_name = [Link]["large"].render([Link], True, WHITE)
name_rect = team_name.get_rect(center=(x + card_width//2, y + 30))
[Link](team_name, name_rect)
# Tag
tag_text = [Link]["medium"].render(f"[{[Link]}]", True, WHITE)
tag_rect = tag_text.get_rect(center=(x + card_width//2, y + 60))
[Link](tag_text, tag_rect)
# Informações
info_texts = [
f"Orçamento: ${[Link]:,}",
f"Jogadores: {len([Link])}",
f"Poder: {team.calculate_team_power():.1f}"
]
info_y = y + 85
for info in info_texts:
info_surface = [Link]["small"].render(info, True, WHITE)
info_rect = info_surface.get_rect(center=(x + card_width//2,
info_y))
[Link](info_surface, info_rect)
info_y += 20
# Próximo card
x += card_width + 20
if (i + 1) % 4 == 0:
x = 100
y += card_height + 20
def draw_dashboard(self):
"""Desenha dashboard principal"""
if not self.user_team:
return
# Fundo
[Link](DARK_GRAY)
# Header
self.draw_header()
# Menu lateral
self.draw_side_menu()
# Conteúdo principal
self.draw_main_content()
# Widgets
self.draw_widgets()
def draw_header(self):
"""Desenha cabeçalho do dashboard"""
header_rect = [Link](0, 0, SCREEN_WIDTH, 80)
[Link]([Link], BLACK, header_rect)
# Gradiente
for i in range(header_rect.height):
alpha = 255 - (i * 3)
color = (*self.user_team.colors["primary"], min(255, alpha))
line_rect = [Link](0, i, SCREEN_WIDTH, 1)
[Link]([Link], color[:3], (0, i), (SCREEN_WIDTH, i))
# Logo/Nome do time
team_name = [Link]["large"].render(self.user_team.name, True, WHITE)
[Link](team_name, (20, 20))
# Tag
tag_text = [Link]["medium"].render(f"[{self.user_team.tag}]", True,
GOLD)
[Link](tag_text, (team_name.get_width() + 30, 25))
# Informações rápidas
quick_info = [
f"💰 ${self.user_team.budget:,}",
f"🏆 {self.user_team.season_stats['wins']}V-
{self.user_team.season_stats['losses']}D",
f"⚡ {self.user_team.calculate_team_power():.1f}",
f"📅 Semana {self.current_week}"
]
x = SCREEN_WIDTH - 400
for info in quick_info:
info_surface = [Link]["small"].render(info, True, WHITE)
[Link](info_surface, (x, 30))
x += 100
def draw_side_menu(self):
"""Desenha menu lateral"""
menu_rect = [Link](0, 80, 250, SCREEN_HEIGHT - 80)
[Link]([Link], DARK_BLUE, menu_rect)
# Título do menu
menu_title = [Link]["medium"].render("MENU", True, WHITE)
title_rect = menu_title.get_rect(center=(125, 110))
[Link](menu_title, title_rect)
# Opções do menu
menu_items = [
("📊", "Dashboard", [Link]),
("👥", "Elenco", [Link]),
("💪", "Treino", [Link]),
("💰", "Mercado", [Link]),
("📈", "Finanças", [Link]),
("📅", "Calendário", [Link]),
("🎯", "Táticas", [Link]),
("🏢", "Instalações", [Link]),
("📊", "Estatísticas", [Link]),
("🔍", "Scout", [Link]),
("📝", "Contratos", [Link]),
("🏆", "Conquistas", [Link])
]
y = 150
for icon, text, state in menu_items:
# Botão do menu
btn_rect = [Link](10, y, 230, 40)
# Hover effect
mouse_pos = [Link].get_pos()
if btn_rect.collidepoint(mouse_pos):
[Link]([Link], BLUE, btn_rect, border_radius=5)
else:
[Link]([Link], (*DARK_BLUE, 200), btn_rect,
border_radius=5)
# Ícone e texto
icon_surface = [Link]["medium"].render(icon, True, WHITE)
[Link](icon_surface, (20, y + 10))
y += 45
def draw_main_content(self):
"""Desenha conteúdo principal do dashboard"""
content_rect = [Link](260, 90, SCREEN_WIDTH - 270, SCREEN_HEIGHT -
100)
[Link]([Link], WHITE, content_rect, border_radius=10)
# Título da seção
section_title = [Link]["large"].render("VISÃO GERAL", True, BLACK)
[Link](section_title, (280, 110))
# Cards de informação
self.draw_info_cards()
# Gráficos
self.draw_charts()
# Próximas partidas
self.draw_upcoming_matches()
def draw_info_cards(self):
"""Desenha cards de informação"""
cards_data = [
("Posição na Liga", f"{self.user_team.season_stats.get('position',
'N/A')}º", GREEN),
("Sequência Atual", f"{self.user_team.season_stats.get('win_streak',
0)} vitórias", BLUE),
("Média de Poder", f"{self.user_team.calculate_team_power():.1f}",
PURPLE),
("Satisfação da Torcida", f"{self.user_team.fan_satisfaction}%",
ORANGE)
]
x = 280
y = 160
# Título
title_surface = [Link]["small"].render(title, True, WHITE)
title_rect = title_surface.get_rect(center=(x + 100, y + 30))
[Link](title_surface, title_rect)
# Valor
value_surface = [Link]["large"].render(value, True, WHITE)
value_rect = value_surface.get_rect(center=(x + 100, y + 60))
[Link](value_surface, value_rect)
x += 220
if x > 900:
x = 280
y += 120
def draw_charts(self):
"""Desenha gráficos de performance"""
chart_rect = [Link](280, 400, 400, 200)
[Link]([Link], LIGHT_GRAY, chart_rect, border_radius=10)
[Link]([Link], DARK_GRAY, chart_rect, 2, border_radius=10)
# Título do gráfico
chart_title = [Link]["medium"].render("Performance Recente", True,
BLACK)
[Link](chart_title, (290, 410))
# Ponto
[Link]([Link], BLUE, (int(x), int(y)), 4)
def draw_upcoming_matches(self):
"""Desenha próximas partidas"""
matches_rect = [Link](700, 400, 400, 200)
[Link]([Link], LIGHT_GRAY, matches_rect, border_radius=10)
[Link]([Link], DARK_GRAY, matches_rect, 2, border_radius=10)
# Título
matches_title = [Link]["medium"].render("Próximas Partidas", True,
BLACK)
[Link](matches_title, (710, 410))
# Texto da partida
match_text = f"Semana {self.current_week + i} vs {[Link]}"
match_surface = [Link]["small"].render(match_text, True, BLACK)
[Link](match_surface, (720, y))
# Poder do adversário
power_text = f"Poder: {opponent.calculate_team_power():.1f}"
power_surface = [Link]["small"].render(power_text, True, GRAY)
[Link](power_surface, (720, y + 20))
y += 50
def draw_widgets(self):
"""Desenha widgets do dashboard"""
# Widget de notificações
notif_rect = [Link](SCREEN_WIDTH - 320, 100, 300, 150)
[Link]([Link], (*WHITE, 240), notif_rect, border_radius=10)
[Link]([Link], ORANGE, notif_rect, 2, border_radius=10)
def draw_particles(self):
"""Desenha partículas"""
if [Link]["particles"]:
self.particle_system.draw([Link])
def draw_notifications(self):
"""Desenha notificações"""
for notif in [Link]:
[Link]([Link], [Link]["medium"])
# Salva arquivo
filename = f"saves/save_slot_{slot}.json"
with open(filename, 'w') as f:
[Link](save_data, f, indent=2, default=str)
if not [Link](filename):
self.add_notification(f"Nenhum save encontrado no slot {slot}",
"error")
return False
try:
with open(filename, 'r') as f:
save_data = [Link](f)
# Restaura dados
self.current_season = save_data["season"]
self.current_split = save_data["split"]
self.current_week = save_data["week"]
[Link] = save_data["settings"]
except Exception as e:
self.add_notification(f"Erro ao carregar: {str(e)}", "error")
return False
def run(self):
"""Loop principal do jogo"""
while [Link]:
# Delta time
[Link] = [Link]([Link]) / 1000.0
# Processa eventos
self.handle_events()
# Atualiza lógica
[Link]()
# Desenha
[Link]()
# Atualiza display
[Link]()
# FPS no título
fps_text = f"LoL Manager Ultimate - FPS: {int([Link].get_fps())}"
[Link].set_caption(fps_text)
# Cleanup
[Link]()
# Executar o jogo
if __name__ == "__main__":
print("=" * 60)
print("LOL MANAGER - ULTIMATE EDITION")
print("=" * 60)
print("\n🎮 RECURSOS ULTIMATE:")
print("✅ Interface profissional com animações e partículas")
print("✅ Sistema completo de jogadores com 15+ atributos")
print("✅ Personalidade e relacionamentos entre jogadores")
print("✅ Sistema de lesões e recuperação realista")
print("✅ Draft completo com picks e bans")
print("✅ Simulação detalhada de partidas")
print("✅ Sistema financeiro complexo")
print("✅ Instalações e melhorias")
print("✅ Sistema de scout e descoberta de talentos")
print("✅ Química e sinergia do time")
print("✅ Múltiplas competições e torneios")
print("✅ Sistema de conquistas e recordes")
print("✅ Save/Load completo")
print("✅ Notificações e feedback visual")
print("✅ Dashboard com gráficos e estatísticas")
print("\n CONTROLES:")
print("• Mouse para todos os controles")
print("• Scroll para navegar em listas")
print("• Hover para tooltips")
print("• Drag & Drop para organizar lineup")
game = LoLManagerUltimate()
[Link]()