mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Redeal stack for Archway (discussed in issue #332).
This commit is contained in:
parent
622c8a455c
commit
be1929a33e
2 changed files with 45 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
<h1>Archway</h1>
|
||||
<p>
|
||||
Two-Deck game type. 2 decks. No redeal.
|
||||
Two-Deck game type. 2 decks. Unlimited redeals.
|
||||
|
||||
<h3>Object</h3>
|
||||
<p>
|
||||
|
@ -15,5 +15,8 @@ four foundations have an ace of each suit dealt to them, and are built up
|
|||
by suit, while the other four foundations have a king dealt to them and
|
||||
are built down by suit.
|
||||
<p>
|
||||
Additionally, every card from the reserve piles is available to play. Hitting
|
||||
the redeal button will shift the topmost card of each reserve.
|
||||
<p>
|
||||
As not all aces are dealt to the foundations, a thirteenth reserve pile
|
||||
on the far left is used for extra aces.
|
||||
|
|
|
@ -33,10 +33,12 @@ from pysollib.stack import \
|
|||
DealRowRedealTalonStack, \
|
||||
DealRowTalonStack, \
|
||||
InitialDealTalonStack, \
|
||||
InvisibleStack, \
|
||||
KingAC_RowStack, \
|
||||
OpenStack, \
|
||||
RK_FoundationStack, \
|
||||
RK_RowStack, \
|
||||
RedealTalonStack, \
|
||||
ReserveStack, \
|
||||
SS_FoundationStack, \
|
||||
SS_RowStack, \
|
||||
|
@ -368,6 +370,8 @@ class LadyOfTheManor(Game):
|
|||
Foundation_Class_1 = RK_FoundationStack
|
||||
Foundation_Class_2 = RK_FoundationStack
|
||||
|
||||
Talon_Class = InitialDealTalonStack
|
||||
|
||||
ACE_STACK = False
|
||||
|
||||
def createGame(self):
|
||||
|
@ -380,8 +384,6 @@ class LadyOfTheManor(Game):
|
|||
l.YM + max(4 * l.YS, 3 * l.YS + 14 * l.YOFFSET))
|
||||
|
||||
x, y = l.XM, self.height-l.YS
|
||||
if self.ACE_STACK:
|
||||
x += (l.XS / 2)
|
||||
for i in range(4):
|
||||
suit = i
|
||||
if self.Foundation_Class_1 is RK_FoundationStack:
|
||||
|
@ -415,8 +417,8 @@ class LadyOfTheManor(Game):
|
|||
x, y = l.XM+i*l.XS, l.YM+j*l.YS
|
||||
s.reserves.append(LadyOfTheManor_Reserve(x, y, self, max_accept=0))
|
||||
|
||||
s.talon = InitialDealTalonStack(
|
||||
self.width-l.XS, self.height-2*l.YS, self)
|
||||
s.talon = self.Talon_Class(
|
||||
self.width-l.XS, self.height-l.YS, self)
|
||||
|
||||
l.defaultAll()
|
||||
|
||||
|
@ -442,12 +444,46 @@ class LadyOfTheManor(Game):
|
|||
self.moveMove(1, self.s.talon, r, frames=4)
|
||||
|
||||
|
||||
class Archway_Talon(RedealTalonStack):
|
||||
|
||||
def dealCards(self, sound=False):
|
||||
old_state = self.game.enterState(self.game.S_DEAL)
|
||||
ncards = 0
|
||||
intern1, intern2 = self.game.s.internals
|
||||
if sound and self.game.app.opt.animations:
|
||||
self.game.startDealSample()
|
||||
for r in self.game.s.reserves:
|
||||
if len(r.cards) <= 1:
|
||||
continue
|
||||
ncards += len(r.cards)
|
||||
# move cards to internal stacks
|
||||
while len(r.cards) != 1:
|
||||
self.game.moveMove(1, r, intern1, frames=0)
|
||||
self.game.moveMove(1, r, intern2, frames=0)
|
||||
# move back
|
||||
while intern1.cards:
|
||||
self.game.moveMove(1, intern1, r, frames=0)
|
||||
self.game.moveMove(1, intern2, r, frames=0)
|
||||
self.game.nextRoundMove(self)
|
||||
if sound:
|
||||
self.game.stopSamples()
|
||||
self.game.leaveState(old_state)
|
||||
return ncards
|
||||
|
||||
|
||||
class Archway(LadyOfTheManor):
|
||||
Foundation_Class_1 = SS_FoundationStack
|
||||
Foundation_Class_2 = StackWrapper(SS_FoundationStack, dir=-1)
|
||||
Talon_Class = StackWrapper(Archway_Talon, max_rounds=-1)
|
||||
|
||||
ACE_STACK = True
|
||||
|
||||
def createGame(self):
|
||||
LadyOfTheManor.createGame(self)
|
||||
|
||||
self.s.internals.append(InvisibleStack(self))
|
||||
self.s.internals.append(InvisibleStack(self))
|
||||
|
||||
def _shuffleHook(self, cards):
|
||||
return self._shuffleHookMoveToTop(
|
||||
cards,
|
||||
|
@ -1448,4 +1484,4 @@ registerGame(GameInfo(745, DesertIsland, "Desert Island",
|
|||
registerGame(GameInfo(761, CatherineTheGreat, "Catherine the Great",
|
||||
GI.GT_2DECK_TYPE, 2, 0, GI.SL_BALANCED))
|
||||
registerGame(GameInfo(844, Archway, "Archway",
|
||||
GI.GT_2DECK_TYPE, 2, 0, GI.SL_MOSTLY_LUCK))
|
||||
GI.GT_2DECK_TYPE, 2, -1, GI.SL_MOSTLY_LUCK))
|
||||
|
|
Loading…
Add table
Reference in a new issue