fix: AI only plays lands — sync card enrichment, mana pool check, field alignment
- Add _enrichCardFromCache() in precon-loader.js for synchronous card enrichment at draw time (typeLine, cmc, oracle roles available before async Scryfall batch completes) - Call _enrichCardFromCache in drawCard() so AI has complete card data on its first turn - Improve _canAfford in ai-bridge.js: check actual mana pool before falling back to untapped land count; free spells (cmc 0) always castable - Fix totalCards field name mismatch in ui.js and engine.js (lab.py returns totalCards, not card_count/total_cards) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
9eaa41a4ae
commit
44123f7622
4 files changed
+40
-3
No files matched your search
@@ -8241,6 +8241,7 @@ function drawCard(playerId) {
|
||||
}
|
||||
|
||||
const card = player.zones.library.shift(); // Take from top (index 0)
|
||||
if (typeof _enrichCardFromCache === 'function') _enrichCardFromCache(card);
|
||||
player.zones.hand.push(card);
|
||||
addLogEntry('<strong>' + player.name + '</strong> drew a card (' + player.zones.hand.length + ' in hand)');
|
||||
updatePlayerZones();
|
||||
@@ -12604,7 +12605,7 @@ function _loadUserDecksForSetup() {
|
||||
var html = '';
|
||||
for (var di = 0; di < decks.length; di++) {
|
||||
var d = decks[di];
|
||||
var cardCount = d.card_count || d.total_cards || 0;
|
||||
var cardCount = d.totalCards || d.card_count || d.total_cards || 0;
|
||||
var cmdr = d.commander || '';
|
||||
html += '<button class="setup-custom-deck-btn" id="setup-custom-deck-btn-' + i + '-' + di + '"' +
|
||||
' onclick="selectSetupUserDeck(' + i + ',' + d.deck_id + ',\'' + (d.name || 'Untitled').replace(/'/g, "\\'") + '\')">' +
|
||||
|
||||
Reference in new issue
Block a user