Exemple #1
0
def battleStart(Enemies,bg,farBG):
	global graphicsEngine
	global graphicsEngineB
	global battleEngine
	global Player
	global PlayerB
	global BATTLING

	graphicsEngineB = BattleGraphicsEngine(graphicsEngine.getScreen(),graphicsEngine.getIsScaled(),bg,farBG)
	battleEngine = BattleEngine(graphicsEngineB)
	PlayerB = Player.getBattleObject()

	x = len(Player.getParty())*50
	PlayerB.setX(x)
	PlayerB.setState("Idle")
	PlayerB.setDirection(1)
	PlayerB.playerStatus = True

#	if Player.getInventory().getArm1()!=None and PlayerB.getGraphicObject().weapon!=None:
#		if Player.getInventory().getArm1().getStyle() != PlayerB.getGraphicObject().weapon.getStyle():
#			PlayerB.updateWeapon(Player.getInventory().getArm1(),Player.constructBattleAnimations())
#	else:
#		if Player.getInventory().getArm1() != PlayerB.getGraphicObject().weapon:
#			PlayerB.updateWeapon(Player.getInventory().getArm1(),Player.constructBattleAnimations())
	PlayerB.updateWeapon(Player.getInventory().getArm1(),Player.constructBattleAnimations())

	battleEngine.addAlly(PlayerB)
	for ally in Player.getParty():
		x-=50
		allyb = ally.getBattleObject()
		allyb.setX(x)
		allyb.setState("Idle")
		allyb.setDirection(1)
		battleEngine.addAlly(allyb)

	x = 800
	for enemy in Enemies:
		if config.Difficulty <= 2:
			lvl = max(PlayerB.getLevel()+random.randint(-4,2),1)
		elif config.Difficulty == 3:
			lvl = max(PlayerB.getLevel()+random.randint(-2,4),1)
		elif config.Difficulty >= 4:
			lvl = max(PlayerB.getLevel()+random.randint(0,6),1)
		print lvl
		temp = EnemyFactory.createEnemy(enemy,lvl,x)
		battleEngine.addEnemy(temp)
		x-= 50

	graphicsEngineB.setFocus(PlayerB.getGraphicObject())
	graphicsEngineB.getHud().update(battleEngine.playerParty)

	BATTLING = True

	oldScreen = screen.screen.copy()
	battleEngine.update(0)
	newScreen = screen.screen.copy()
	transitions.blurTrans(clock,screen,oldScreen,newScreen)
Exemple #2
0
			if PlayerB.getState()=="Idle":
				PlayerB.setState("Run")
		if (not move[1] and not move[3]) or (move[1] and move[3]):
			if PlayerB.getState()=="Run":
				PlayerB.setState("Idle")

		if battleEngine.update(tick):
			BATTLING = False
			loot = []
			for item in battleEngine.getLoot():
				loot.append(ItemFactory.createItem(item))
			battleEngine.getGraphicsEngine().victoryScreen(clock,inputEngine,battleEngine.getPlayerParty(),battleEngine.getGold(),battleEngine.getExp(),loot)
			oldScreen = screen.copy()
			graphicsEngine.update(0)
			newScreen = screen.copy()
			transitions.blurTrans(clock,screen,oldScreen,newScreen)
			Player.getInventory().addGold(battleEngine.getGold())
			for item in loot:
				Player.getInventory().addItem(item)
			for ally in battleEngine.getPlayerParty():
				ally.addExp(battleEngine.getExp())
	else:	#Overworld
		for inp in inputEngine.getInput():
			if inp[0] == "Quit":
				PLAYING = False
			elif inp[1] == "Down":
				if graphicsEngine.getInven() == False and graphicsEngine.getPause() == False and graphicsEngine.getShop() == False:
					if inp[0] == "Accept":
						if Player.getTalking():
							graphicsEngine.getTalking().Cont()
						else: