public void startup() { Log("Called startup"); specificStartup(); Params param = new Params(); param.loadFromFile(); map = new Map(param); GraphicalMap.map = map; GraphicalMap.world = this; Property_Prototype.loadProperties(map); EconTrait.loadTraits(map); map.world = this; map.gen(); staticMap = map; if (!developer) { for (int i = 0; i < param.mapGen_burnInSteps; i++) { map.turnTick(); } } ui.setToWorld(); displayMessages = true; Log("Got to end of initial startup"); ui.checkData(); }
public void bStartGameSeeded(int seed, PopupGameOptions opts) { audioStore.playActivate(); Eleven.random = new System.Random(seed); startup(opts); for (int i = 0; i < map.param.mapGen_burnInSteps; i++) { map.turnTick(); } map.overmind.namesChosen.AddRange(chosenGods); foreach (God chosenGod in chosenGods) { chosenGod.onStart(map); } map.overmind.addDefaultAbilities(); chosenGods = null;//Just in case this f***s with something ui.setToWorld(); }
public void bEndTurn() { if (turnLock) { return; } if (ui.blocker != null) { return; } turnLock = true; if (map != null) { map.turnTick(); } turnLock = false; ui.checkData(); }
public void progressToNextAge() { map.automatic = false; map.world.displayMessages = false; map.burnInComplete = false; panicFromCluesDiscovered = 0; panicFromPowerUse = 0; List <Location> monsters = new List <Location>(); foreach (Location loc in map.locations) { if (loc.soc != null && loc.soc.isDark() && (loc.soc is Society == false)) { monsters.Add(loc); } } lightbringerCasters = null; lightRitualProgress = 0; lightbringerLocations.Clear(); while (monsters.Count > 3) { int q = Eleven.random.Next(monsters.Count); Location loc = monsters[q]; loc.soc = null; if (loc.settlement != null) { loc.settlement = null; } monsters.RemoveAt(q); } int lastIndexPerson = 0; foreach (SocialGroup sg in map.socialGroups) { if (sg is Society) { Society soc = (Society)sg; foreach (Person p in soc.people) { lastIndexPerson = Math.Max(p.index, lastIndexPerson); } soc.isDarkEmpire = false; } } if (enthralled != null) { enthralled.die("Died as the age changed", false); } int burnTurns = 300; for (int i = 0; i < burnTurns; i++) { map.turnTick(); if (i % 25 == 0) { bool hasHumanity = false; foreach (Location loc in map.locations) { if (loc.isOcean) { continue; } if (loc.soc is Society && loc.settlement is SettlementHuman) { hasHumanity = true; } } if (!hasHumanity) { foreach (Location loc in map.locations) { if (loc.isOcean) { continue; } if (loc.hex.getHabilitability() > map.param.mapGen_minHabitabilityForHumans && loc.isMajor) { loc.settlement = new Set_City(loc); Society soc = new Society(map, loc); soc.setName(loc.shortName); loc.soc = soc; map.socialGroups.Add(soc); } } } if (map.data_avrgEnshadowment > 0.1) { foreach (SocialGroup sg in map.socialGroups) { if (sg is Society) { Society soc = (Society)sg; List <Person> dead = new List <Person>(); foreach (Person p in soc.people) { if (p.state == Person.personState.broken && Eleven.random.Next(2) == 0) { dead.Add(p); } else if (p.shadow > 0 && Eleven.random.Next(2) == 0) { p.shadow = 0; } } foreach (Person p in dead) { p.die("Died of old age", false); } } } } } foreach (SocialGroup sg in map.socialGroups) { if (sg is Society) { Society soc = (Society)sg; List <Person> dead = new List <Person>(); foreach (Person p in soc.people) { if (p.index <= lastIndexPerson) { if (p.index % 100 == i) { dead.Add(p); } } } foreach (Person p in dead) { p.die("Died of old age", false); } } } if (i == burnTurns / 2) { List <Unit> units = new List <Unit>(); units.AddRange(map.units); foreach (Unit u in units) { u.die(map, "Old age"); } } } foreach (Person p in map.persons) { if (p == null) { continue; } for (int i = 0; i < map.persons.Count; i++) { if ((map.persons[i] == null || map.persons[i].isDead) && p.relations.ContainsKey(i)) { p.relations.Remove(i); } } } map.burnInComplete = true; map.world.displayMessages = true; startedComplete(); endOfGameAchieved = false; map.firstPlayerTurn = map.turn; }