def __init__(self, element): self.battleManager = battle.getBattleManager() self.sceneManager = scene.getSceneManager() self.name = element.getAttribute("name") spriteElement = element.getElementsByTagName("sprite")[0] if spriteElement.hasAttribute("x1"): self.setSprite(str(spriteElement.getAttribute("filename")), int(spriteElement.getAttribute("x1")), int(spriteElement.getAttribute("y1")), int(spriteElement.getAttribute("x2")), int(spriteElement.getAttribute("y2"))) else: self.setSprite(str(spriteElement.getAttribute("filename"))) statusElement = element.getElementsByTagName("status")[0] self.status = Status(statusElement) strategiesElement = element.getElementsByTagName("strategies")[0] self.strategies = map(lambda s: s.lower(), strategiesElement.firstChild.data.split()) experienceElements = element.getElementsByTagName("experience") if len(experienceElements): self.experience = Status(experienceElements[0]) else: self.experience = Status() self.reset()
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)
def __init__(self, combatants): self.engine = annchienta.getEngine() self.videoManager = annchienta.getVideoManager() self.inputManager = annchienta.getInputManager() self.mapManager = annchienta.getMapManager() self.audioManager = annchienta.getAudioManager() self.cacheManager = annchienta.getCacheManager() self.mathManager = annchienta.getMathManager() self.sceneManager = scene.getSceneManager() self.battleManager = getBattleManager() self.activeCombatants = self.combatants = combatants self.running = True self.enemies = filter(lambda c: c.hostile, self.activeCombatants) self.allies = filter(lambda c: not c.hostile, self.activeCombatants) # Set positions for combatants for i in range(len(self.allies)): a = self.allies[i] w, h = a.getSize() a.setPosition( self.videoManager.getScreenWidth() / 2 - 30 - i * 10 - w, 100 + i * 40 - h) for i in range(len(self.enemies)): e = self.enemies[i] w, h = e.getSize() e.setPosition(self.videoManager.getScreenWidth() / 2 + 30 + i * 10, 100 + i * 40 - h) self.updateCombatantArrays() self.background = None
def __init__(self, name, toolTip=None): MenuItem.__init__(self, name, toolTip) self.inputManager = annchienta.getInputManager() self.videoManager = annchienta.getVideoManager() self.mapManager = annchienta.getMapManager() self.sceneManager = scene.getSceneManager() self.options = []
def __init__(self, m_battle, m_combatant): self.cacheManager = annchienta.getCacheManager() self.audioManager = annchienta.getAudioManager() self.mathManager = annchienta.getMathManager() self.sceneManager = scene.getSceneManager() self.m_combatant = m_combatant self.m_battle = m_battle self.turns = 0
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(
def __init__(self): self.inputManager = annchienta.getInputManager() self.mapManager = annchienta.getMapManager() self.sceneManager = scene.getSceneManager() self.lastMaps = []