Skip to content

Commit 7e8b197

Browse files
committed
fixes
1 parent 0ee39cf commit 7e8b197

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

server/rules/war/wargame.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import copy
2323

2424
class Wargame(broadcastable.Broadcastable):
25-
TURN_TIMER = 30
25+
TURN_TIMER = 120
2626

2727
LANDS = [
2828
'Alaska' ,
@@ -317,6 +317,7 @@ def handle_wargame_add_piece(self, session, message):
317317
return
318318

319319
session['land_data'][to_land]['turn_pieces'] += quantity
320+
session['remaining_pieces'] -= quantity
320321

321322
self.broadcast(None, { 'action' : 'wargame_status_update' , 'status' : 'player added piece', 'user' : session.username , 'where' : to_land, 'quantity' : message['quantity'] })
322323

@@ -342,6 +343,7 @@ def handle_wargame_remove_piece(self, session, message):
342343
return
343344

344345
session['land_data'][to_land]['turn_pieces'] -= quantity
346+
session['remaining_pieces'] += quantity
345347

346348
self.broadcast(None, { 'action' : 'wargame_status_update' , 'status' : 'player removed a piece', 'user' : session.username , 'where' : from_land, 'quantity' : message['quantity'] })
347349

test/simple_server_tester.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def __init__(self, ip, port, sock = None):
4747
('set ready' , { 'action' : 'wargame_lobby_set_self_ready', 'fields' : [ ('ready', str, True) ] }),
4848
('start game', { 'action' : 'wargame_lobby_start_game' , 'fields' : [] } )]
4949

50-
in_game_actions = [ ('remove a piece', {'action' : 'wargame_remove_piece', 'fields' : [ ('from', str, True) ] } ),
51-
('add a piece', {'action' : 'wargame_add_piece', 'fields' : [ ('to', str, True) ] } ),
50+
in_game_actions = [ ('remove a piece', {'action' : 'wargame_remove_piece', 'fields' : [ ('from', str, True) , ('quantity', int, True ) ] } ),
51+
('add a piece', {'action' : 'wargame_add_piece', 'fields' : [ ('to', str, True) , ('quantity', int, True ) ] } ),
5252
('say something' , { 'action' : 'wargame_chat', 'fields' : [ ('message', str, True ) ] } ),
5353
('attack a land', {'action' : 'wargame_attack_land', 'fields' : [ ('quantity', str, True), ('from', str, True), ('to', str, True) ] } ),
5454
('end turn' , { 'action' : 'wargame_end_turn', 'fields' : [] } ) ]
@@ -94,6 +94,7 @@ def respawn():
9494
return
9595

9696
reqd = { True : ' (required) ', False : ' (enter to proceed) ' }
97+
9798
for param in self.menu[self.current_state][value][1]['fields']:
9899
item_value = raw_input('{0}{1}: '.format(param[0], reqd[param[2]]))
99100
params[param[0]] = param[1](item_value)

0 commit comments

Comments
 (0)