Ejemplo n.º 1
0
            test_data.CardInfo('duel', 8, card.DIAMOND),
            test_data.CardInfo('-zixing', 13, card.DIAMOND),
            test_data.CardInfo('+dilu', 5, card.CLUB),

            test_data.CardInfo('slash', 1, card.CLUB),
            test_data.CardInfo('slash', 1, card.CLUB),
            test_data.CardInfo('slash', 1, card.CLUB),
            test_data.CardInfo('slash', 1, card.CLUB),

            test_data.CardInfo('steal', 9, card.HEART),
            test_data.CardInfo('steal', 10, card.CLUB),

            test_data.CardInfo('steal', 9, card.HEART),
            test_data.CardInfo('steal', 10, card.CLUB),
     ])), pc, ActionStack())
players = [Player(19, 3), Player(91, 4), Player(1729, 4)]
map(lambda p: pc.add_player(p), players)
gc.start()

last_event_id = len(gc.get_events(players[0].token, 0)) # until getting cards

# cards:
# name     | rank | id | suit

# -chitu   | 5    | 0  | HEART
# -dawan   | 13   | 1  | SPADE
# +jueying | 5    | 2  | SPADE
# slash    | 1    | 3  | CLUB
# steal    | 9    | 12 | HEART <- use this
# steal    | 10   | 13 | CLUB
Ejemplo n.º 2
0
pc = PlayersControl()
gc = GameControl(EventList(), test_data.CardPool(test_data.gen_cards([
            test_data.CardInfo('duel', 1, card.SPADE),
            test_data.CardInfo('fire attack', 2, card.HEART),
            test_data.CardInfo('slash', 3, card.DIAMOND),
            test_data.CardInfo('duel', 4, card.SPADE),

            test_data.CardInfo('slash', 5, card.CLUB),
            test_data.CardInfo('fire attack', 6, card.HEART),
            test_data.CardInfo('dodge', 7, card.DIAMOND),
            test_data.CardInfo('slash', 8, card.DIAMOND),

            test_data.CardInfo('duel', 9, card.SPADE),
            test_data.CardInfo('slash', 10, card.SPADE),
     ])), pc, ActionStack())
players = [Player(91, 4), Player(1729, 4)]
map(lambda p: pc.add_player(p), players)
gc.start()

last_event_id = len(gc.get_events(players[0].token, 0)) # until getting cards

# cards:
# name        | rank (id = rank - 1) | suit

# duel        | 1                    | SPADE   <- use this to duel
# fire attack | 2                    | HEART
# slash       | 3                    | DIAMOND
# duel        | 4                    | SPADE
# duel        | 9                    | SPADE
# slash       | 10                   | SPADE
Ejemplo n.º 3
0
 def __init__(self, token, max_vigor):
     ExtPlayer.__init__(self, token)
     self.max_vigor = max_vigor
     self.vigor = max_vigor
Ejemplo n.º 4
0
from core.src.game_control import GameControl
from core.src.event import EventList
from core.src.action_stack import ActionStack
import core.src.card as card
import core.src.ret_code as ret_code
from ext.src.players_control import PlayersControl
from ext.src.player import Player

from test_common import *
import test_data

players = [Player(19, 3), Player(91, 3), Player(1729, 3)]
pc = PlayersControl()
gc = GameControl(
    EventList(),
    test_data.CardPool(
        test_data.gen_cards([
            test_data.CardInfo('rattan armor', 2, card.CLUB),
            test_data.CardInfo('slash', 2, card.SPADE),
            test_data.CardInfo('slash', 3, card.HEART),
            test_data.CardInfo('peach', 4, card.HEART),
            test_data.CardInfo('slash', 5, card.HEART),
            test_data.CardInfo('fire attack', 6, card.HEART),
            test_data.CardInfo('fire attack', 7, card.HEART),
            test_data.CardInfo('peach', 8, card.HEART),
            test_data.CardInfo('peach', 9, card.HEART),
            test_data.CardInfo('peach', 10, card.HEART),
            test_data.CardInfo('peach', 11, card.HEART),
            test_data.CardInfo('peach', 12, card.HEART),
            test_data.CardInfo('slash', 13, card.SPADE),
            test_data.CardInfo('slash', 1, card.CLUB),
Ejemplo n.º 5
0
            test_data.CardInfo('slash', 7, card.CLUB),
            test_data.CardInfo('slash', 8, card.CLUB),
            test_data.CardInfo('slash', 9, card.CLUB),
            test_data.CardInfo('slash', 10, card.CLUB),
            test_data.CardInfo('slash', 11, card.CLUB),
            test_data.CardInfo('slash', 12, card.CLUB),
            test_data.CardInfo('slash', 13, card.CLUB),
            test_data.CardInfo('slash', 1, card.SPADE),
            test_data.CardInfo('slash', 2, card.SPADE),
            test_data.CardInfo('slash', 3, card.SPADE),
            test_data.CardInfo('slash', 4, card.SPADE),
            test_data.CardInfo('slash', 5, card.SPADE),
            test_data.CardInfo('slash', 6, card.SPADE),
            test_data.CardInfo('slash', 7, card.SPADE),
        ])), pc, ActionStack())
players = [Player(19, 1), Player(91, 1), Player(1729, 1)]
map(lambda p: pc.add_player(p), players)
gc.start()

# cards:
# name        | rank | id | suit

# fire attack | 1    | 0  | HEART <- use this
# slash       | 2    | 1  | SPADE <- show and discard this
# slash       | 3    | 2  | HEART
# slash       | 4    | 3  | HEART
# slash       | 13   | 12 | CLUB
# slash       | 1    | 13 | CLUB
result = gc.player_act({
    'token': players[0].token,
    'action': 'fire attack',
Ejemplo n.º 6
0
from ext.src.players_control import PlayersControl
from ext.src.player import Player

from test_common import *

pc = PlayersControl()
players = [Player(i, 1) for i in range(10000, 10008)]
for p in players:
    pc.add_player(p)

assert_eq(players[0], pc.current_player())
assert_eq([players[i] for i in range(1, 8)], pc.succeeding_players())

pc.next_player()
assert_eq(players[1], pc.current_player())
assert_eq([players[i] for i in range(2, 8)] + [players[0]],
          pc.succeeding_players())

players[3].alive = False
assert_eq(players[1], pc.current_player())
assert_eq([players[2]] + [players[i] for i in range(4, 8)] + [players[0]],
          pc.succeeding_players())

pc.next_player()
assert_eq(players[2], pc.current_player())
assert_eq([players[i] for i in range(4, 8)] + [players[0], players[1]],
          pc.succeeding_players())

pc.next_player()
assert_eq(players[4], pc.current_player())
assert_eq([players[i]
Ejemplo n.º 7
0
    test_data.CardPool(
        test_data.gen_cards([
            test_data.CardInfo('rattan armor', 2, card.CLUB),
            test_data.CardInfo('rattan armor', 2, card.SPADE),
            test_data.CardInfo('slash', 3, card.HEART),
            test_data.CardInfo('slash', 4, card.HEART),
            test_data.CardInfo('steal', 5, card.CLUB),
            test_data.CardInfo('fire attack', 6, card.HEART),
            test_data.CardInfo('dodge', 7, card.HEART),
            test_data.CardInfo('duel', 8, card.HEART),
            test_data.CardInfo('slash', 9, card.SPADE),
            test_data.CardInfo('slash', 10, card.CLUB),
            test_data.CardInfo('fire attack', 11, card.CLUB),
            test_data.CardInfo('dodge', 12, card.HEART),
        ])), pc, ActionStack())
players = [Player(91, 8), Player(1729, 8)]
map(lambda p: pc.add_player(p), players)
gc.start()

last_event_id = len(gc.get_events(players[0].token, 0))  # until getting cards

# cards:
# name         | rank | id | suit

# rattan armor | 2    | 0  | CLUB <- equip this
# rattan armor | 2    | 1  | SPADE <-  and this
# slash        | 3    | 2  | HEART
# slash        | 4    | 3  | HEART
# slash        | 9    | 8  | SPADE
# slash        | 10   | 9  | CLUB