
---

PAST NOTES FROM AI THAT WE MIGHT NEED TO GO BACK TO LATER

LOOT PHASE RECS FROM AI:

2. Test Combat → Loot → Combat Flow
Right now loot is isolated with start: true. Need to:
Change start: true back to combat phase
Verify victory in combat triggers loot phase correctly
Verify "Next Room" button transitions back to combat
Make sure equipment changes persist through phase transitions

3. Handle "New Loot" Acquisition
Currently starts with test inventory. Need to:
Show newly acquired items in the top section (per design doc)
Add visual effects for new items flying into tableau
Track which items are "new" (maybe G.player.newlyAcquired array)
Clear the "NEW" badges after player acknowledges them

4. Verify Upgrades Work in Combat
Test that upgraded equipment actually behaves differently:
Upgrade blaster capacity → verify it has more charges in next combat
Upgrade wide beam damage → verify it deals more damage
Make sure upgradeLevel persists and upgrades apply correctly

5. Polish & Edge Cases
Remove debug logging from console
Test scrapping while item is selected (should deselect)
Test upgrading consumables (should show "cannot upgrade" properly)
Add upgrade points from somewhere (currently starts at 0, need to earn them)
Consider: Should upgrade points carry between runs, or reset on death?

onus: Visual Improvements
Animations for scrap/upgrade actions
Sound effects for scrap/upgrade (you have lots of sounds!)
Better feedback when buttons are disabled
Show stat changes more clearly in upgrade preview



CARD-CREATION RECS FROM AI:

Recommended Refactors
Priority 1: Make useWeapon Generic
Create a card property system that defines behavior constraints:

```
// In cards.js
blaster: {
  // ... existing properties
  usage: {
    chargesCost: 1,
    targetMode: 'single', // 'single', 'all', 'self', 'multi'
    targetType: 'enemy',  // 'enemy', 'ally', 'any'
    constraints: ['requiresCharge'], // can add 'oncePerFight', 'oncePerLevel'
  }
}
```

Then refactor CombatGame.js to have a more generic action system:

```
// Replace useWeapon with more generic useEquipment
useEquipment: ({ G, effects, events }, equipmentId, ...targets) => {
  const equipment = G.player.equipment[equipmentId];
  const def = getEquipmentDefinition(equipmentId);
  
  // Validate using card definition
  if (!validateUsage(equipment, def.usage)) return;
  
  // Apply costs
  applyCosts(equipment, def.usage);
  
  // Execute effect
  def.effect(G, ...targets);
  
  // Rest of combat flow...
}
```

Priority 2: Extract Damage/Combat Helpers
Create helper functions to encapsulate common operations:

```
// In cards.js or new combatHelpers.js
export function dealDamage(G, robotIndex, damage, damageType = 'physical') {
  // This is where you'd add shields, armor, damage modifiers later
  if (robotIndex >= 0 && robotIndex < G.robots.length) {
    G.robots[robotIndex].hp -= damage;
  }
}

export function rechargeEquipment(equipment, amount = 1) {
  if (equipment.charges !== undefined) {
    equipment.charges = Math.min(
      equipment.charges + amount, 
      equipment.maxCharges
    );
  }
}
```

Then card effects become:
```
effect: (G, targetIndex) => {
  dealDamage(G, targetIndex, G.player.equipment.blaster.damage);
}
```

Priority 3: Data-Driven UI Rendering
Instead of hard-coding specific equipment, make the UI generic:

```
// Add to card definitions
blaster: {
  // ... existing
  ui: {
    displayType: 'weapon',
    showCharges: true,
    showDamage: true,
    clickable: true,
  }
}

charger: {
  // ... existing
  ui: {
    displayType: 'gear',
    showButton: true,
    buttonText: 'Use',
  }
}
```

Recommendation Summary
Before adding many new cards, I'd recommend:
First - Refactor the charge/constraint system (this is already in your TODO)
Second - Add combat helper functions for common operations
Third - Make targeting more flexible (support AoE, self-target, etc.)
Later - Make UI more data-driven (can wait until you have 5-10 cards and patterns emerge)

