From d3f80a73898686f6bcefe661ab3026d5f6208b15 Mon Sep 17 00:00:00 2001 From: jstadt Date: Sun, 8 Sep 2019 12:26:02 -0400 Subject: [PATCH 1/4] correct rejuvenate logging, game setup shuffle logging, and play allies at 3 above --- 383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py | 3 +++ 383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/engine.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py b/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py index 32a69b0..f799a92 100644 --- a/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py +++ b/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py @@ -111,6 +111,9 @@ def play(card, x = 0, y = 0): cardPlayed_y_offset = GuestPlayerCardPlayed_y_Offset card.moveToTable(cardPlayed_x_offset, cardPlayed_y_offset) notify("{} plays {} from their {}.".format(me, card, src.name)) + # When playing allies, automatically start at 3 stages + if card.Type.find("Ally") != -1: + card.markers[CounterMarker] = 3 def mulligan(group): mute() diff --git a/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/engine.py b/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/engine.py index 81dcac6..fa9edd6 100644 --- a/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/engine.py +++ b/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/engine.py @@ -21,6 +21,7 @@ def gameSetup(): faceUpAll() me.piles["Life Deck"].shuffle() + notify("{} shuffles their Life Deck.", me) for c in table: if c.controller == me and c.properties["Card Level"] is not "": c.markers[CounterMarker] = 5 @@ -145,9 +146,9 @@ def manageRejuvenatePhase(): def rejuvenate(count = 1, silent = False): for card in me.piles["Discard Pile"].top(count): mute() - card.moveToBottom(me.piles["Life Deck"]) if silent == False: notify("{} Rejuvenates {}.".format(me, card)) + card.moveToBottom(me.piles["Life Deck"]) def lookupAttackTable(group, x = 0, y = 0): mute() From 0e057e5c58bf42629ac1a4714d5f8e8c5656220a Mon Sep 17 00:00:00 2001 From: jstadt Date: Sun, 8 Sep 2019 15:15:40 -0400 Subject: [PATCH 2/4] be more pythonic --- 383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py b/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py index f799a92..9e809fa 100644 --- a/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py +++ b/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py @@ -112,7 +112,7 @@ def play(card, x = 0, y = 0): card.moveToTable(cardPlayed_x_offset, cardPlayed_y_offset) notify("{} plays {} from their {}.".format(me, card, src.name)) # When playing allies, automatically start at 3 stages - if card.Type.find("Ally") != -1: + if "Ally" in card.Type: card.markers[CounterMarker] = 3 def mulligan(group): From f1f877eec576c0a1b7108d99f8e789544f74f075 Mon Sep 17 00:00:00 2001 From: jstadt Date: Sun, 8 Sep 2019 15:30:59 -0400 Subject: [PATCH 3/4] nit: capitalization --- 383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py b/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py index cb75f64..6cff7e9 100644 --- a/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py +++ b/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py @@ -112,7 +112,7 @@ def play(card, x = 0, y = 0): card.moveToTable(cardPlayed_x_offset, cardPlayed_y_offset) notify("{} plays {} from their {}.".format(me, card, src.name)) # When playing allies, automatically start at 3 stages - if "Ally" in card.Type: + if "Ally" in card.type: card.markers[CounterMarker] = 3 def mulligan(group): From d3ecd7adf91b00615ebc50b1e21e5d9b4d2a68c7 Mon Sep 17 00:00:00 2001 From: jstadt Date: Mon, 9 Sep 2019 01:23:30 -0400 Subject: [PATCH 4/4] first pass at damage management --- .../definition.xml | 8 ++- .../scripts/actions.py | 18 +++++- .../scripts/engine.py | 60 +++++++++++++++++++ 3 files changed, 84 insertions(+), 2 deletions(-) diff --git a/383a6ac2-6e52-40a5-980f-fade09e4908b/definition.xml b/383a6ac2-6e52-40a5-980f-fade09e4908b/definition.xml index f47f1c0..5937329 100644 --- a/383a6ac2-6e52-40a5-980f-fade09e4908b/definition.xml +++ b/383a6ac2-6e52-40a5-980f-fade09e4908b/definition.xml @@ -74,7 +74,13 @@ - + + + + + + + diff --git a/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py b/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py index 6cff7e9..1816577 100644 --- a/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py +++ b/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/actions.py @@ -98,7 +98,23 @@ def setCounter(card, x = 0, y = 0): mute() quantity = askInteger("How many counters", 0) notify("{} sets {} counters on {}.".format(me, quantity, card)) - card.markers[CounterMarker] = quantity + card.markers[CounterMarker] = quantity + +def takeDamage(card, x = 0, y = 0): + mute() + manageDamage(card) + +def takeUnpreventableDamage(card, x = 0, y = 0): + mute() + manageDamage(card, True, False) + +def takeBanishedDamage(card, x = 0, y = 0): + mute() + manageDamage(card, False, True) + +def takeUnpreventableBanishedDamage(card, x = 0, y = 0): + mute() + manageDamage(card, True, True) def play(card, x = 0, y = 0): mute() diff --git a/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/engine.py b/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/engine.py index e2e020f..7ec2f23 100644 --- a/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/engine.py +++ b/383a6ac2-6e52-40a5-980f-fade09e4908b/scripts/engine.py @@ -153,6 +153,66 @@ def rejuvenate(cards = [], silent = False): for card in cards: card.moveToBottom(me.piles["Life Deck"]) +def manageDamage(card, unpreventable = False, banished = False): + mute() + stageDamage = askInteger("How many STAGES of damage?", 0) + remainingLifeDamage = askInteger("How many LIFE CARDS of damage?", 0) + takenDamage = [] + firstDragonBallRevealed = "" + if stageDamage > card.markers[CounterMarker]: + remainingLifeDamage += stageDamage - card.markers[CounterMarker] + if card.markers[CounterMarker] > 0: + notify("{} takes {} stages of damage on {}.".format(me, card.markers[CounterMarker], card)) + card.markers[CounterMarker] = 0 + elif stageDamage > 0: + notify("{} takes {} stages of damage on {}.".format(me, stageDamage, card)) + card.markers[CounterMarker] -= stageDamage + while remainingLifeDamage > 0: + if len(me.piles["Life Deck"]) == 0: + notify("{}'s Life Deck is empty".format(me)) + return + damageCard = me.piles["Life Deck"].top() + if banished: + damageCard.moveTo(me.piles["Removed from game"]) + else: + damageCard.moveTo(me.piles["Discard Pile"]) + remainingLifeDamage -= 1 + notify("{} reveals {} as damage.".format(me, damageCard)) + # add "if discarded from deck" check to pause damage + if len(me.piles["Life Deck"]) == 0: + notify("{}'s Life Deck is empty".format(me)) + return + if "Dragon Ball" in damageCard.name: + dbInPlay = False + for c in table: + if c.name == damageCard.name: + dbInPlay = True + break + if dbInPlay: + damageCard.moveTo(me.piles["Removed from game"]) + notify("{} is already in play, banishing this copy...".format(damageCard)) + elif firstDragonBallRevealed == damageCard.name: + notify("{} is in a Dragon Ball Loop".format(me)) + return + else: + if firstDragonBallRevealed == "": + firstDragonBallRevealed = damageCard.name + remainingLifeDamage += 1 + notify("{} is not in play, returning to bottom of Life Deck".format(damageCard)) + damageCard.moveToBottom(me.piles["Life Deck"]) + if damageCard.endurance != "": + preventableAmount = int(damageCard.endurance) + if preventableAmount > remainingLifeDamage: + preventableAmount = remainingLifeDamage + if unpreventable: + preventableAmount = 0 + choices = ['Banish to prevent {} life cards'.format(preventableAmount), 'Decline'] + choice = askChoice("Revealed {}. Remaining damage = {}. Banish this card for endurance?".format(damageCard.name, remainingLifeDamage), choices) + if choice == 1: + damageCard.moveTo(me.piles["Removed from game"]) + remainingLifeDamage -= preventableAmount + notify("{} prevented {} life cards of damage by banishing {} for endurance.".format(me, preventableAmount, damageCard)) + def lookupAttackTable(group, x = 0, y = 0): mute() defenderPL = remoteCall(players[1], "lookupPowerLevel", [group, x, y])