diff --git a/UNLICENSE b/UNLICENSE deleted file mode 100644 index 69843e4..0000000 --- a/UNLICENSE +++ /dev/null @@ -1,24 +0,0 @@ -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to [http://unlicense.org] diff --git a/gameloop.py b/gameloop.py index b72cd17..5b95419 100644 --- a/gameloop.py +++ b/gameloop.py @@ -5,7 +5,7 @@ from collections import namedtuple import cardcast_api class events(enum.Enum): - quit, nick_change, status, start, kill, join, leave, players, deck_add, deck_add_random, deck_remove, deck_list, limit, card = range(14) + quit, nick_change, status, start, kill, join, leave, players, deck_add, deck_add_random, deck_remove, deck_list, limit, card, cards = range(15) class limit_types(enum.Enum): points, rounds = range(2) @@ -76,6 +76,9 @@ def get_event(): nick = input('nick> ') choice = [int(i) for i in input('choice> ').split()] return (events.card, nick, choice) + elif t == 'cards': + nick = input('nick> ') + return (events.cards, nick) else: print('?') @@ -266,6 +269,10 @@ def game(): # Ignore selecting cards if it's not available pass + elif event == events.cards: + # Ignore listing cards if it's not available + pass + else: error('Unknown event type: %s' % event) @@ -501,6 +508,20 @@ def game(): choosers.remove(player) notice(nick, combine_cards(round_call_card, [player.hand[i] for i in selected_cards])) + elif event == events.cards: + nick, = args + + if nick not in players: + # Ignore those not in the game + continue + + player = players[nick] + + if player in choosers: + send_cards(nick) + else: + notice(nick, 'You can\'t choose now') + else: r = common_handler(event, args) if r is not None: return r