def throwRandomBattle(self): self.partyManager = party.getPartyManager() self.sceneManager = scene.getSceneManager() if self.randomBattleDelay > 0: self.randomBattleDelay -= 1 return else: self.randomBattleDelay = self.mathManager.randInt(300, 1000) # Return if there are no enemies in this level. if not len(self.enemiesInMap): return music = self.audioManager.getPlayingMusic() self.audioManager.playMusic("music/battle_" + str(self.mathManager.randInt(1, 4)) + ".ogg") self.sceneManager.rotateEffect() enames = map( lambda a: self.enemiesInMap[self.mathManager.randInt( 0, len(self.enemiesInMap))], range(self.mathManager.randInt(2, 4))) enemies = map(lambda n: self.createEnemy(n), enames) b = Battle(self.partyManager.team + enemies) b.background = annchienta.Surface(self.battleBackground) b.run() self.audioManager.playMusic(music)
import annchienta, scene, party partyManager = party.getPartyManager() sceneManager = scene.getSceneManager() def keepOnReading(): a = sceneManager.chat(None, "Do you want to keep on reading?", ["Read some more.", "That'll be enough."]) return (a == 0) def read(): sceneManager.text( "It is a book about the island Welsar. Welsar joined the Alliance seven years after the Creation of the Alliance." ) sceneManager.text( "... Welsar is naturally divided into two. There is the northern part, where Tetia is situated. And there is the southern part, with Anpere." ) sceneManager.text( "Most people live in the southern part, near Anpere. Anpere is the main city of Welsar, and the port..." ) if not keepOnReading(): return sceneManager.text( "... In the northern part is Tetia probably the only town worth mentioning. There is a large prison complex as well, built 84 years after the Creation of the Alliance." ) sceneManager.text(