working updates

This commit is contained in:
2026-01-26 16:14:57 -05:00
parent b1e99fa952
commit c8228f200d
8055 changed files with 142307 additions and 867 deletions

View File

@@ -130,34 +130,36 @@ func dull_backup_for_cp(card: CardInstance) -> bool:
return true
## Play a card from hand to field
func play_card(card: CardInstance) -> bool:
## Returns dictionary of CP spent, or empty dict on failure
func play_card(card: CardInstance) -> Dictionary:
if not hand.has_card(card):
return false
return {}
# Check if we can afford it
if not cp_pool.can_afford_card(card.card_data):
return false
return {}
# Check field restrictions
if card.is_backup():
if field_backups.get_count() >= MAX_BACKUPS:
return false
return {}
# Check unique name restriction
# Check unique name restriction (non-generic cards can't share names across entire field)
if not card.card_data.is_generic:
if card.is_forward() and field_forwards.has_card_with_name(card.card_data.name):
return false
if card.is_backup() and field_backups.has_card_with_name(card.card_data.name):
return false
if field_forwards.has_card_with_name(card.card_data.name):
return {}
if field_backups.has_card_with_name(card.card_data.name):
return {}
# Check Light/Dark restriction
if card.is_light_or_dark():
if field_forwards.has_light_or_dark() or field_backups.has_light_or_dark():
return false
return {}
# Pay the cost
if not cp_pool.spend_for_card(card.card_data):
return false
# Pay the cost (returns dict of spent CP, empty if failed)
var spent = cp_pool.spend_for_card(card.card_data)
if spent.is_empty():
return {}
# Move to field
hand.remove_card(card)
@@ -171,7 +173,29 @@ func play_card(card: CardInstance) -> bool:
card.entered_field()
return true
return spent
## Cast a summon from hand (pays cost, removes from hand, returns card for effect resolution)
func cast_summon(card: CardInstance) -> CardInstance:
if not hand.has_card(card):
return null
if not card.is_summon():
return null
# Check if we can afford it
if not cp_pool.can_afford_card(card.card_data):
return null
# Pay the cost (returns dict of spent CP, empty if failed)
var spent = cp_pool.spend_for_card(card.card_data)
if spent.is_empty():
return null
# Remove from hand - card will be moved to break zone after effect resolves
hand.remove_card(card)
return card
## Break a card (move from field to break zone)
func break_card(card: CardInstance) -> bool: