예제 #1
0
		private void InitializeCommander(string name, CrewMember commanderCrewMember)
		{
			_commander = new Commander(commanderCrewMember);
			Mercenaries[(int)CrewMemberId.Commander] = Commander;
			Strings.CrewMemberNames[(int)CrewMemberId.Commander] = name;

			while (Commander.CurrentSystem == null)
			{
				StarSystem system = Universe[Functions.GetRandom(Universe.Length)];
				if (system.SpecialEventType == SpecialEventType.Na &&
					system.TechLevel > TechLevel.PreAgricultural &&
					system.TechLevel < TechLevel.HiTech)
				{
					// Make sure at least three other systems can be reached
					int close = 0;
					for (int i = 0; i < Universe.Length && close < 3; i++)
					{
						if (i != (int)system.Id && Functions.Distance(Universe[i], system) <= Commander.Ship.FuelTanks)
							close++;
					}

					if (close >= 3)
						Commander.CurrentSystem = system;
				}
			}

			Commander.CurrentSystem.Visited = true;
		}
예제 #2
0
		public Game(Hashtable hash, SpaceTrader parentWin) : base(hash)
		{
			_game = this;
			ParentWindow = parentWin;

			string version = (string)GetValueFromHash(hash, "_version");
			if (version.CompareTo(Consts.CurrentVersion) > 0)
				throw new FutureVersionException();

			_universe = (StarSystem[])ArrayListToArray((ArrayList)GetValueFromHash(hash, "_universe"), "StarSystem");
			_wormholes = (int[])GetValueFromHash(hash, "_wormholes", _wormholes);
			_mercenaries = (CrewMember[])ArrayListToArray((ArrayList)GetValueFromHash(hash, "_mercenaries"), "CrewMember");
			_commander = new Commander((Hashtable)GetValueFromHash(hash, "_commander"));
			_dragonfly = new Ship((Hashtable)GetValueFromHash(hash, "_dragonfly", _dragonfly.Serialize()));
			_scarab = new Ship((Hashtable)GetValueFromHash(hash, "_scarab", _scarab.Serialize()));
			_scorpion = new Ship((Hashtable)GetValueFromHash(hash, "_scorpion", _scorpion.Serialize()));
			_spaceMonster = new Ship((Hashtable)GetValueFromHash(hash, "_spaceMonster", _spaceMonster.Serialize()));
			_opponent = new Ship((Hashtable)GetValueFromHash(hash, "_opponent", _opponent.Serialize()));
			_chanceOfTradeInOrbit = (int)GetValueFromHash(hash, "_chanceOfTradeInOrbit", _chanceOfTradeInOrbit);
			_clicks = (int)GetValueFromHash(hash, "_clicks", _clicks);
			_raided = (bool)GetValueFromHash(hash, "_raided", _raided);
			_inspected = (bool)GetValueFromHash(hash, "_inspected", _inspected);
			_tribbleMessage = (bool)GetValueFromHash(hash, "_tribbleMessage", _tribbleMessage);
			_arrivedViaWormhole = (bool)GetValueFromHash(hash, "_arrivedViaWormhole", _arrivedViaWormhole);
			_paidForNewspaper = (bool)GetValueFromHash(hash, "_paidForNewspaper", _paidForNewspaper);
			_litterWarning = (bool)GetValueFromHash(hash, "_litterWarning", _litterWarning);
			_newsEvents = new ArrayList((int[])GetValueFromHash(hash, "_newsEvents", _newsEvents.ToArray(System.Type.GetType("System.Int32"))));
			_difficulty = (Difficulty)GetValueFromHash(hash, "_difficulty", _difficulty);
			_cheatEnabled = (bool)GetValueFromHash(hash, "_cheatEnabled", _cheatEnabled);
			_autoSave = (bool)GetValueFromHash(hash, "_autoSave", _autoSave);
			_easyEncounters = (bool)GetValueFromHash(hash, "_easyEncounters", _easyEncounters);
			_endStatus = (GameEndType)GetValueFromHash(hash, "_endStatus", _endStatus);
			_encounterType = (EncounterType)GetValueFromHash(hash, "_encounterType", _encounterType);
			_selectedSystemId = (StarSystemId)GetValueFromHash(hash, "_selectedSystemId", _selectedSystemId);
			_warpSystemId = (StarSystemId)GetValueFromHash(hash, "_warpSystemId", _warpSystemId);
			_trackedSystemId = (StarSystemId)GetValueFromHash(hash, "_trackedSystemId", _trackedSystemId);
			_targetWormhole = (bool)GetValueFromHash(hash, "_targetWormhole", _targetWormhole);
			_priceCargoBuy = (int[])GetValueFromHash(hash, "_priceCargoBuy", _priceCargoBuy);
			_priceCargoSell = (int[])GetValueFromHash(hash, "_priceCargoSell", _priceCargoSell);
			_questStatusArtifact = (int)GetValueFromHash(hash, "_questStatusArtifact", _questStatusArtifact);
			_questStatusDragonfly = (int)GetValueFromHash(hash, "_questStatusDragonfly", _questStatusDragonfly);
			_questStatusExperiment = (int)GetValueFromHash(hash, "_questStatusExperiment", _questStatusExperiment);
			_questStatusGemulon = (int)GetValueFromHash(hash, "_questStatusGemulon", _questStatusGemulon);
			_questStatusJapori = (int)GetValueFromHash(hash, "_questStatusJapori", _questStatusJapori);
			_questStatusJarek = (int)GetValueFromHash(hash, "_questStatusJarek", _questStatusJarek);
			_questStatusMoon = (int)GetValueFromHash(hash, "_questStatusMoon", _questStatusMoon);
			_questStatusPrincess = (int)GetValueFromHash(hash, "_questStatusPrincess", _questStatusPrincess);
			_questStatusReactor = (int)GetValueFromHash(hash, "_questStatusReactor", _questStatusReactor);
			_questStatusScarab = (int)GetValueFromHash(hash, "_questStatusScarab", _questStatusScarab);
			_questStatusSculpture = (int)GetValueFromHash(hash, "_questStatusSculpture", _questStatusSculpture);
			_questStatusSpaceMonster = (int)GetValueFromHash(hash, "_questStatusSpaceMonster", _questStatusSpaceMonster);
			_questStatusWild = (int)GetValueFromHash(hash, "_questStatusWild", _questStatusWild);
			_fabricRipProbability = (int)GetValueFromHash(hash, "_fabricRipProbability", _fabricRipProbability);
			_justLootedMarie = (bool)GetValueFromHash(hash, "_justLootedMarie", _justLootedMarie);
			_canSuperWarp = (bool)GetValueFromHash(hash, "_canSuperWarp", _canSuperWarp);
			_chanceOfVeryRareEncounter = (int)GetValueFromHash(hash, "_chanceOfVeryRareEncounter", _chanceOfVeryRareEncounter);
			_veryRareEncounters = new ArrayList((int[])GetValueFromHash(hash, "_veryRareEncounters", _veryRareEncounters.ToArray(System.Type.GetType("System.Int32"))));
			_options = new GameOptions((Hashtable)GetValueFromHash(hash, "_options", _options.Serialize()));
		}