Beispiel #1
0
 def __init__(self,  position, grid, tilesize, tiles):
     #NOTE: This object has Player information that a battlefield does not have.
     #pane_area = (((tilesize* tiles[0]) + tilesize/2), ((tilesize * tiles[1]) +4))
     pane_area = ((34 * (tiles[0] + 1) + 5), (30 * tiles[1]) + 5)
     Battlefield.__init__(self)
     
     Pane.__init__(self, pane_area, title=None)
     self.bgcolor = black
     self.rect.x, self.rect.y = position
     
     self.grid = grid
     self.contentimgs = pygame.sprite.RenderUpdates()
     self.defender = battle.Player()
     self.attacker = battle.Player()
     self.defender.squads = [self.trans_squad(yaml_store.load('yaml/pt_0.yaml'))]
     self.attacker.squads = [self.trans_squad(yaml_store.load('yaml/pt_1.yaml'))]
     
     self.defsquad = self.defender.squads[0]
     self.atksquad = self.attacker.squads[0]
     
     self.defender.name = 'Defender'
     self.defsquad.num  = '1'
     
     self.attacker.name = 'Attacker'
     self.atksquad.num  = '2'
             
     self.squads = (self.defsquad, self.atksquad)
     self.units = self.get_units()
     for u in self.units:
         u.draw_text()
     self.get_contents_image()
Beispiel #2
0
from binary_tactics.zodb_hex_battle import Game, Action
from stores.yaml_store import load
from binary_tactics.hex_battlefield import Battlefield
from binary_tactics.player import Player
from binary_tactics.grid import Loc


def hp():
    for s in btl.squads:
        print s.name
        for u in s:
            print "     %s\n    %s" % (u.name, u.hp)
        print ""


p1 = Player(name='p1', squads=[load('yaml/ice_maxes.yaml')])
p2 = Player(name='p2', squads=[load('yaml/fire_maxes.yaml')])

game = Game(defender=p1, attacker=p2)

btl = game.battlefield

for s in range(2):
    for x in range(4):
        btl.place_object(btl.squads[s][x], Loc(x, s))

game.log['init_locs'] = game.log.init_locs()


def show_squad(squad):
    for u in squad:
Beispiel #3
0
#

from binary_tactics.hex_battle import Game, Action
from stores.yaml_store import load
from binary_tactics.hex_battlefield import Battlefield
from binary_tactics.player import Player
from binary_tactics.grid import Loc

def hp():
    for s in btl.squads:
        print s.name
        for u in s:
            print "     %s\n    %s" %(u.name, u.hp)
        print ""

p1   = Player(name='p1', squads=[load('yaml/ice_maxes.yaml')])
p2   = Player(name='p2', squads=[load('yaml/fire_maxes.yaml')])

game = Game(defender=p1, attacker=p2)

btl = game.battlefield

for s in range(2):
    for x in range(4):
        btl.place_object(btl.squads[s][x], Loc(x, s))

game.log['init_locs'] = game.log.init_locs()

def show_squad(squad):
    for u in squad:
        print u.name, u.location, u.hp