def assert_attack_defend(): b = Board() p2u1 = Position.from_literal('55') p2u2 = Position.from_literal('66') p2u3 = Position.from_literal('61') #p2u4 = Position.from_literal('65') p1u1 = Position.from_literal('54') p1u2 = Position.from_literal('53') p1u3 = Position.from_literal('62') p1u4 = Position.from_literal('67') p1u5 = Position.from_literal('56') b.put(p2u1, Soldier(player_2)) b.put(p2u2, Rider(player_2, flip_skillset=True)) b.put(p2u3, Soldier(player_2)) #b.put(p2u4, Barbarian(player_2, flip_skillset=True))) b.put(p1u1, Rider(player_1)) b.put(p1u2, Soldier(player_1)) b.put(p1u3, Rider(player_1)) b.put(p1u4, Soldier(player_1)) b.put(p1u5, Soldier(player_1)) g = Game(b) g.replenish(100) # renderer.show_canvas( # paint.get_painted_canvas( # g, {player_1:'a', player_2:'b'}, player_1)) g = g.make_move([ PlayerMove.from_literal(player_2, "5554 6654 6162"), PlayerMove.from_literal(player_1, "5354 6254 6766 5655 5446") ]) # for clash_brief in g.round_brief.clash_briefs: # print(clash_brief.brief()) # for battle_brief in g.round_brief.battle_briefs: # print(battle_brief.brief()) assert (g.board.at(p2u1).owner == player_1) assert (g.board.at(p2u2).owner == player_1) assert (g.board.at(p2u3) is None) assert (g.board.at(p1u1) is None) assert (g.board.at(p1u2).owner == player_1) assert (g.board.at(p1u3).owner == player_2) assert (g.board.at(p1u4) is None) assert (g.board.at(p1u5) is None) assert (g.board.at(Position.from_literal('46')).owner == player_1)
def assert_buffs(): b = Board() b.put(Position.from_literal('55'), make_perfect(Lancer(player_1, SkillSet()))) b.put(Position.from_literal('66'), make_perfect(Knight(player_1, SkillSet()))) b.put(Position.from_literal('46'), make_perfect(Knight(player_1, SkillSet()))) b.put(Position.from_literal('68'), make_perfect(Warrior(player_2, SkillSet()))) b.put(Position.from_literal('78'), make_perfect(Spearman(player_1, SkillSet()))) b.put(Position.from_literal('88'), make_perfect(Spearman(player_1, SkillSet()))) b.put(Position.from_literal('53'), make_perfect(Soldier(player_1))) b.put(Position.from_literal('52'), make_perfect(Soldier(player_2))) b.put(Position.from_literal('59'), Swordsman(player_1, SkillSet())) g = Game(b) g = g.make_move([ PlayerMove.from_literal(player_1, "4241 4442 5563 4857 6757 7757"), PlayerMove.from_literal(player_2, "")]) assert(g.supply[player_1] == 29) # 40 - 16 + 5
def assert_attack_defend(): b = Board() p2u1 = Position.from_literal('55') p2u2 = Position.from_literal('66') p2u3 = Position.from_literal('61') p1u1 = Position.from_literal('54') p1u2 = Position.from_literal('53') p1u3 = Position.from_literal('62') p1u4 = Position.from_literal('67') p1u5 = Position.from_literal('56') b.put(p2u1, Soldier(player_2)) b.put(p2u2, make_perfect(Rider(player_2))) b.put(p2u3, Soldier(player_2)) b.put(p1u1, make_perfect(Rider(player_1))) b.put(p1u2, Soldier(player_1)) b.put(p1u3, make_perfect(Rider(player_1))) b.put(p1u4, Soldier(player_1)) b.put(p1u5, Soldier(player_1)) g = Game(b) g.replenish(100) g = g.make_move([ PlayerMove.from_literal(player_2, "4443 5543 5051"), PlayerMove.from_literal(player_1, "4243 5143 5655 4544 4335")]) assert(g.board.at(p2u1).owner == player_1) assert(g.board.at(p2u2).owner == player_1) assert(g.board.at(p2u3) is None) assert(g.board.at(p1u1) is None) assert(g.board.at(p1u2).owner == player_1) assert(g.board.at(p1u3).owner == player_2) assert(g.board.at(p1u4) is None) assert(g.board.at(p1u5) is None) assert(g.board.at(Position.from_literal('46')).owner == player_1)
def assert_recall(): b = Board() b.put(Position.from_literal('55'), King(player_1)) b.put(Position.from_literal('57'), make_perfect(Soldier(player_2, SkillSet()))) b.put(Position.from_literal('88'), make_perfect(Soldier(player_2, SkillSet()))) b.put(Position.from_literal('89'), make_perfect(Lancer(player_1, SkillSet()))) b.put(Position.from_literal('11'), make_perfect(Lancer(player_1, SkillSet()))) g = Game(b) try: g = g.make_move([ PlayerMove.from_literal(player_1, "5478"), PlayerMove.from_literal(player_2, "")]) except: pass else: raise Exception() try: g = g.make_move([ PlayerMove.from_literal(player_1, "4500"), PlayerMove.from_literal(player_2, "")]) except: pass else: raise Exception() g = g.make_move([ PlayerMove.from_literal(player_1, "5400"), PlayerMove.from_literal(player_2, "")]) assert(g.board.at(Position.from_literal('11')) is None) assert(g.board.at(Position.from_literal('65')).owner == player_1)