Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
External war: Give one temple point to
winner.
  • Loading branch information
chellmuth committed Sep 25, 2008
1 parent 37fc33d commit 8eb12e7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion views.py
Expand Up @@ -66,11 +66,15 @@ def internal_defend(request, game_id, player_no, num_committed):
defend_amount = num_committed + defend_info['defend_board']
attack_amount = defend_info['attack_board'] + int(defend_info['attack_committed'])

winner = None
if defend_amount < attack_amount:
board[defend_info['defend_cell_no']] = Ground()
board[defend_info['attack_cell_no']].piece = _convert_ruler(defend_info['ruler_type'], defend_info['attack_player'])
winner = defend_info['attack_player']
else:
pass
winner = player_no

_give_points(game=g, player_no=winner, count=1, type='temple')

g.state = 'REGULAR'

Expand All @@ -81,6 +85,11 @@ def internal_defend(request, game_id, player_no, num_committed):

return game_state_json(request, game_id, player_no)

def _give_points(game, player_no, count, type):
attr_name = 'player_' + str(player_no) + '_points_' + type
game.__setattr__(attr_name, game.__getattribute__(attr_name) + count)


def internal_attack(request, game_id, player_no, cell_no, civ, num_committed):
cell_no = int(cell_no)

Expand Down

0 comments on commit 8eb12e7

Please sign in to comment.