Example #1
0
def initBattle(surface, player, enemyGrp, enemySubGrp):
	toBattle = [["TeamA", []], ["TeamB", []]]
	for i in player.getTeam():
		toBattle[0][1] += [[i[0], i[1], i[2], i[3]]]
	toBattle[1][1] = loadRandomEnemyGroup(enemyGrp, enemySubGrp)
	if Battle.startBattle(toBattle, surface) == "TeamA":
		if toBattle[0][0]:
			xp = 0
			for i in toBattle[1][1]:
				xp += int(i[1])
			xp /= len(toBattle[0][1])
			player.giveXP(xp)
			player.checkEvolutions(surface, toBattle[1][1])
	player.save()