Site en construction ...

<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Créateur de Personnage Moderne</title>
    <link rel="stylesheet" href="styles.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dragula/3.7.2/dragula.min.css">
</head>
<body>
    <div class="container">
        <h1>Créateur de Personnage Moderne</h1>
        <div class="points-display">
            <h2>Points Restants: <span id="remaining-points">9</span></h2>
        </div>
        <div class="card-piles">
            <div class="pile element-water" id="pv-pile">
                <h2>Points de Vie (PV)</h2>
                <div class="card-container">
                    <div class="card" data-value="10" data-cost="0">0 - 10</div>
                    <div class="card" data-value="20" data-cost="1">1 - 20</div>
                    <div class="card" data-value="25" data-cost="2">2 - 25</div>
                    <div class="card" data-value="30" data-cost="3">3 - 30</div>
                    <div class="card" data-value="35" data-cost="4">4 - 35</div>
                </div>
            </div>
            <div class="pile element-air" id="atk-pile">
                <h2>Attaque (ATK)</h2>
                <div class="card-container">
                    <div class="card" data-value="1" data-cost="0">0 - 1</div>
                    <div class="card" data-value="3" data-cost="1">1 - 3</div>
                    <div class="card" data-value="4" data-cost="2">2 - 4</div>
                    <div class="card" data-value="5" data-cost="3">3 - 5</div>
                    <div class="card" data-value="6" data-cost="4">4 - 6</div>
                </div>
            </div>
            <div class="pile element-lightning" id="mvt-pile">
                <h2>Mouvement (MVT)</h2>
                <div class="card-container">
                    <div class="card" data-value="2" data-cost="0">0 - 2</div>
                    <div class="card" data-value="3" data-cost="1">1 - 3</div>
                    <div class="card" data-value="4" data-cost="2">2 - 4</div>
                    <div class="card" data-value="5" data-cost="3">3 - 5</div>
                    <div class="card" data-value="6" data-cost="4">4 - 6</div>
                </div>
            </div>
            <div class="pile element-fire" id="def-pile">
                <h2>Défense (DEF)</h2>
                <div class="card-container">
                    <div class="card" data-value="0" data-cost="0">0 - 0</div>
                    <div class="card" data-value="1" data-cost="1">1 - 1</div>
                    <div class="card" data-value="2" data-cost="2">2 - 2</div>
                    <div class="card" data-value="3" data-cost="3">3 - 3</div>
                    <div class="card" data-value="4" data-cost="4">4 - 4</div>
                </div>
            </div>
        </div>
        <div class="character-slots">
            <div class="slot element-earth" id="pv-slot">
                <h2>Points de Vie (PV)</h2>
                <div class="card-container"></div>
            </div>
            <div class="slot element-earth" id="atk-slot">
                <h2>Attaque (ATK)</h2>
                <div class="card-container"></div>
            </div>
            <div class="slot element-earth" id="mvt-slot">
                <h2>Mouvement (MVT)</h2>
                <div class="card-container"></div>
            </div>
            <div class="slot element-earth" id="def-slot">
                <h2>Défense (DEF)</h2>
                <div class="card-container"></div>
            </div>
        </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/dragula/3.7.2/dragula.min.js"></script>
    <script src="script.js"></script>
</body>
</html>
body {
    font-family: 'Helvetica Neue', sans-serif;
    background-color: #f4f4f9;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

.container {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 75vw;
}

h1 {
    font-family: 'Montserrat', sans-serif;
    color: #4a90e2;
}

h2 {
    font-size: 12pt;
}
.points-display {
    margin-bottom: 20px;
    color: #555;
}

.card-piles, .character-slots {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
}

.pile, .slot {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    flex: 1;
    min-width: 150px;
    max-width: calc(25% - 40px);
    box-sizing: border-box;
    background-color: #f9f9f9;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-container {
    min-height: 100px;
}

.card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: grab;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card:active {
    cursor: grabbing;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.element-water {
    border-color: #4a90e2;
    color: #4a90e2;
}

.element-air {
    border-color: #50e3c2;
    color: #50e3c2;
}

.element-lightning {
    border-color: #f5a623;
    color: #f5a623;
}

.element-fire {
    border-color: #e74c3c;
    color: #e74c3c;
}

.element-earth {
    border-color: #9b59b6;
    color: #9b59b6;
}
document.addEventListener('DOMContentLoaded', () => {
    const slots = {
        'pv': document.querySelector('#pv-slot .card-container'),
        'atk': document.querySelector('#atk-slot .card-container'),
        'mvt': document.querySelector('#mvt-slot .card-container'),
        'def': document.querySelector('#def-slot .card-container')
    };

    const piles = {
        'pv': document.querySelector('#pv-pile .card-container'),
        'atk': document.querySelector('#atk-pile .card-container'),
        'mvt': document.querySelector('#mvt-pile .card-container'),
        'def': document.querySelector('#def-pile .card-container')
    };

    let remainingPoints = 9;
    const pointsDisplay = document.getElementById('remaining-points');

    const drakes = {
        'pv': dragula([piles.pv, slots.pv], {
            moves: function (el, container, handle) {
                return el.classList.contains('card');
            }
        }),
        'atk': dragula([piles.atk, slots.atk], {
            moves: function (el, container, handle) {
                return el.classList.contains('card');
            }
        }),
        'mvt': dragula([piles.mvt, slots.mvt], {
            moves: function (el, container, handle) {
                return el.classList.contains('card');
            }
        }),
        'def': dragula([piles.def, slots.def], {
            moves: function (el, container, handle) {
                return el.classList.contains('card');
            }
        })
    };

    Object.values(drakes).forEach(drake => {
        drake.on('drop', (el, target, source, sibling) => {
            const cardCost = parseInt(el.getAttribute('data-cost'), 10);
            const targetSlotId = target.parentElement.id;

            if (targetSlotId.includes('slot')) {
                if (target.children.length > 1) {
                    const removedCard = target.firstChild;
                    const removedCardCost = parseInt(removedCard.getAttribute('data-cost'), 10);
                    remainingPoints += removedCardCost;
                    piles[targetSlotId.split('-')[0]].appendChild(removedCard);
                }

                if (remainingPoints >= cardCost) {
                    remainingPoints -= cardCost;
                    pointsDisplay.textContent = remainingPoints;
                } else {
                    source.appendChild(el);
                }
            }
        });

        drake.on('drag', (el) => {
            const cardCost = parseInt(el.getAttribute('data-cost'), 10);
            if (remainingPoints >= cardCost) {
                pointsDisplay.textContent = remainingPoints - cardCost;
            }
        });

        drake.on('cancel', (el, container, source) => {
            pointsDisplay.textContent = remainingPoints;
        });
    });

    // Ajout de la fonctionnalité de clic pour ajouter une carte à un slot
    document.querySelectorAll('.card').forEach(card => {
        card.addEventListener('click', () => {
            const cardCost = parseInt(card.getAttribute('data-cost'), 10);
            const cardValue = card.getAttribute('data-value');
            const pileId = card.closest('.pile').id.split('-')[0];

            if (remainingPoints >= cardCost) {
                slots[pileId].appendChild(card);
                remainingPoints -= cardCost;
                pointsDisplay.textContent = remainingPoints;
            }
        });
    });

    // Ajout de la fonctionnalité de clic pour retirer une carte d'un slot
    document.querySelectorAll('.slot .card-container').forEach(slot => {
        slot.addEventListener('click', (event) => {
            if (event.target.classList.contains('card')) {
                const card = event.target;
                const cardCost = parseInt(card.getAttribute('data-cost'), 10);
                const slotId = card.closest('.slot').id.split('-')[0];

                remainingPoints += cardCost;
                pointsDisplay.textContent = remainingPoints;
                piles[slotId].appendChild(card);
            }
        });
    });
});