def initialize(self): self.titletext = typefaces.prepare_title("Onslaught of Enormities",colour=(255,64,64)) self.scenery = chromographs.obtain("background.png") self.cursor = chromographs.obtain("iconic/unit-cursor.png") self.chapter = chapters.open_chapter(self.situation.chapter) wave = self.situation.wave self.dinosaurs = self.chapter.spawn_wave(wave) phonographs.play(self.dinosaurs[-1].attack_phonograph) for name in self.chapter.beasts_in_this_chapter(): if name not in self.situation.seen_dinosaurs: self.situation.seen_dinosaurs.append(name) self.finished = False self.result = "Preparation" self.statusbar = gui.StatusBar() self.statusbar.push_messages( "Protect your ships!", "Cannons need soldiers nearby to man them", "Click again on the field to direct a soldier", "Click on a soldier to select them", ) if self.situation.chapter == 0: self.statusbar.flash(80) self.situation.update_status_bar(self.statusbar) self.selected_unit = None # orchestrate the battle music phonographs.orchestrate("onslaughtmusic.ogg")
def new_inventions(self): situation = self.situation chapter = chapters.open_chapter(situation.chapter) for name in chapter.inventions: if name not in situation.unit_plans: situation.unit_plans.append(name) for name in chapter.fences: if name not in situation.fence_plans: situation.fence_plans.append(name) for name in chapter.facilities: if name not in situation.facility_plans: situation.facility_plans.append(name)
def initialize(self): situation = self.situation chapter = chapters.open_chapter(situation.chapter) self.ribbon = chromographs.obtain("flourish/ribbon-white.png") self.portrait = chromographs.obtain("illustrations/%s"%chapter.illustration) self.title = typefaces.prepare_title("Chapter %s:"% chapter.number) self.summary = gui.make_titledbox((400,100), chapter.subtitle, chapter.summary, 500,gap=12) self.menu = gui.make_menu((700,550), [("We are prepared!","begin"), ("We are scared!","back"), ("Consult Encyclopaedia", "encyclopaedia"), ],300) new_inventions = [] situation.death_stats = defaultdict(int) for name in chapter.inventions: if name not in situation.unit_plans: new_inventions.append(name) for name in chapter.fences: if name not in situation.fence_plans: new_inventions.append(name) for name in chapter.facilities: if name not in situation.facility_plans: new_inventions.append(name) invention_names = [all_things_known.find_by_name(n) for n in new_inventions] dinos_in_chapter = chapter.beasts_in_this_chapter() dino_names = [] for name in dinos_in_chapter: if name in self.situation.seen_dinosaurs: continue information = all_things_known.find_by_name(name) if information: dino_names.append(information.name) tabulation = [] if new_inventions: tabulation.append(["NEW INVENTIONS:"]) tabulation.extend([" " + n] for n in new_inventions) if dino_names: tabulation.append(["WATCH OUT FOR:"]) tabulation.extend([" " + n] for n in dino_names) self.table = None if tabulation: self.table = typefaces.prepare_table(tabulation)