import pygame
import os

# Configuration
WIDTH, HEIGHT = 64, 64
ASSET_DIR = os.path.join(os.path.dirname(__file__), "assets")
if not os.path.exists(ASSET_DIR):
    os.makedirs(ASSET_DIR)

pygame.init()
screen = pygame.Surface((WIDTH, HEIGHT), pygame.SRCALPHA)

def save_texture(name):
    pygame.image.save(screen, os.path.join(ASSET_DIR, name))

# 1. NOEUD COMBAT (Glaive/Epée)
screen.fill((0, 0, 0, 0))
pygame.draw.circle(screen, (255, 0, 100, 100), (32, 32), 30) # Aura rose
# Dessin d'une épée simple
pygame.draw.rect(screen, (200, 200, 200), (30, 10, 4, 40)) # Lame
pygame.draw.rect(screen, (150, 150, 150), (20, 40, 24, 4)) # Garde
pygame.draw.rect(screen, (100, 50, 0), (30, 44, 4, 10)) # Manche
save_texture("node_combat.png")

# 2. NOEUD ELITE (Crane/Tête de mort)
screen.fill((0, 0, 0, 0))
pygame.draw.circle(screen, (255, 0, 0, 150), (32, 32), 30) # Aura rouge
# Dessin crane
pygame.draw.ellipse(screen, (255, 255, 255), (16, 16, 32, 28)) # Crane
pygame.draw.rect(screen, (255, 255, 255), (22, 38, 20, 12)) # Machoire
pygame.draw.circle(screen, (0, 0, 0), (24, 28), 6) # Oeil G
pygame.draw.circle(screen, (0, 0, 0), (40, 28), 6) # Oeil D
save_texture("node_elite.png")

# 3. NOEUD BOUTIQUE (Sac d'or)
screen.fill((0, 0, 0, 0))
pygame.draw.circle(screen, (255, 255, 0, 100), (32, 32), 30) # Aura jaune
# Dessin sac
pygame.draw.ellipse(screen, (218, 165, 32), (16, 24, 32, 30)) # Corps sac
pygame.draw.rect(screen, (218, 165, 32), (24, 16, 16, 10)) # Sommet sac
pygame.draw.rect(screen, (0, 0, 0), (16, 36, 32, 4)) # Corde
save_texture("node_shop.png")

# 4. NOEUD ESQUIVE (Eclat/Vague)
screen.fill((0, 0, 0, 0))
pygame.draw.circle(screen, (0, 255, 255, 100), (32, 32), 30) # Aura cyan
# Dessin vagues
pygame.draw.lines(screen, (255, 255, 255), False, [(10, 32), (22, 20), (32, 32), (42, 20), (54, 32)], 4)
pygame.draw.lines(screen, (255, 255, 255), False, [(10, 44), (22, 32), (32, 44), (42, 32), (54, 44)], 4)
save_texture("node_dodge.png")

# 5. NOEUD CIBLES (Cible)
screen.fill((0, 0, 0, 0))
pygame.draw.circle(screen, (0, 255, 0, 100), (32, 32), 30) # Aura verte
pygame.draw.circle(screen, (255, 255, 255), (32, 32), 25, 4)
pygame.draw.circle(screen, (255, 255, 255), (32, 32), 15, 4)
pygame.draw.circle(screen, (255, 0, 0), (32, 32), 5)
save_texture("node_targets.png")

# 6. NOEUD REPOS (Feu/Coeur)
screen.fill((0, 0, 0, 0))
pygame.draw.circle(screen, (255, 150, 0, 100), (32, 32), 30) # Aura orange
# Dessin Coeur
points = [(32, 50), (12, 30), (12, 18), (22, 10), (32, 20), (42, 10), (52, 18), (52, 30)]
pygame.draw.polygon(screen, (255, 50, 50), points)
save_texture("node_rest.png")

print("Textures de noeuds générées avec succès dans /assets.")
pygame.quit()
