public CrewMember(CrewMember baseCrewMember) { Id = baseCrewMember.Id; Pilot = baseCrewMember.Pilot; Fighter = baseCrewMember.Fighter; Trader = baseCrewMember.Trader; Engineer = baseCrewMember.Engineer; CurrentSystemId = baseCrewMember.CurrentSystemId; }
/* * Types currently supported: * CrewMember * Gadget * HighScoreRecord * Shield * StarSystem * Weapon * * If an array of a type not listed is converted using ArrayToArrayList, the type * needs to be added here. */ public static STSerializableObject[] ArrayListToArray(ArrayList list, string type) { STSerializableObject[] array = null; if (list != null) { switch (type) { case "CrewMember": array = new CrewMember[list.Count]; break; case "Gadget": array = new Gadget[list.Count]; break; case "HighScoreRecord": array = new HighScoreRecord[list.Count]; break; case "Shield": array = new Shield[list.Count]; break; case "StarSystem": array = new StarSystem[list.Count]; break; case "Weapon": array = new Weapon[list.Count]; break; } for (int index = 0; index < list.Count; index++) { Hashtable hash = (Hashtable)list[index]; STSerializableObject obj = null; if (hash != null) { switch (type) { case "CrewMember": obj = new CrewMember(hash); break; case "Gadget": obj = new Gadget(hash); break; case "HighScoreRecord": obj = new HighScoreRecord(hash); break; case "Shield": obj = new Shield(hash); break; case "StarSystem": obj = new StarSystem(hash); break; case "Weapon": obj = new Weapon(hash); break; } } array[index] = obj; } } return array; }
private string CurrentSystemDisplay(CrewMember merc) { return (merc.CurrentSystem == null ? Strings.Unknown : (game.Commander.Ship.HasCrew(merc.Id) ? Functions.StringVars(Strings.MercOnBoard, merc.CurrentSystem.Name) : merc.CurrentSystem.Name)); }
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; }
private void GenerateCrewMemberList() { int[] used = new int[Universe.Length]; int d = (int)Difficulty; // Zeethibal may be on Kravat used[(int)StarSystemId.Kravat] = 1; // special individuals: // Zeethibal, Jonathan Wild's Nephew - skills will be set later. // Wild, Jonathan Wild earns his keep now - JAF. // Jarek, Ambassador Jarek earns his keep now - JAF. // Dummy pilots for opponents. Mercenaries[(int)CrewMemberId.Zeethibal] = new CrewMember(CrewMemberId.Zeethibal, 5, 5, 5, 5, StarSystemId.Na); Mercenaries[(int)CrewMemberId.Opponent] = new CrewMember(CrewMemberId.Opponent, 5, 5, 5, 5, StarSystemId.Na); Mercenaries[(int)CrewMemberId.Wild] = new CrewMember(CrewMemberId.Wild, 7, 10, 2, 5, StarSystemId.Na); Mercenaries[(int)CrewMemberId.Jarek] = new CrewMember(CrewMemberId.Jarek, 3, 2, 10, 4, StarSystemId.Na); Mercenaries[(int)CrewMemberId.Princess] = new CrewMember(CrewMemberId.Princess, 4, 3, 8, 9, StarSystemId.Na); Mercenaries[(int)CrewMemberId.FamousCaptain] = new CrewMember(CrewMemberId.FamousCaptain, 10, 10, 10, 10, StarSystemId.Na); Mercenaries[(int)CrewMemberId.Dragonfly] = new CrewMember(CrewMemberId.Dragonfly, 4 + d, 6 + d, 1, 6 + d, StarSystemId.Na); Mercenaries[(int)CrewMemberId.Scarab] = new CrewMember(CrewMemberId.Scarab, 5 + d, 6 + d, 1, 6 + d, StarSystemId.Na); Mercenaries[(int)CrewMemberId.Scorpion] = new CrewMember(CrewMemberId.Scorpion, 8 + d, 8 + d, 1, 6 + d, StarSystemId.Na); Mercenaries[(int)CrewMemberId.SpaceMonster] = new CrewMember(CrewMemberId.SpaceMonster, 8 + d, 8 + d, 1, 1 + d, StarSystemId.Na); // JAF - Changing this to allow multiple mercenaries in each system, but no more // than three. for (int i = 1; i < Mercenaries.Length; i++) { // Only create a CrewMember object if one doesn't already exist in this slot in the array. if (Mercenaries[i] == null) { StarSystemId id; bool ok = false; do { id = (StarSystemId)Functions.GetRandom(Universe.Length); if (used[(int)id] < 3) { used[(int)id]++; ok = true; } } while (!ok); Mercenaries[i] = new CrewMember((CrewMemberId)i, Functions.RandomSkill(), Functions.RandomSkill(), Functions.RandomSkill(), Functions.RandomSkill(), id); } } }
public void Hire(CrewMember merc) { int skill = Trader; int slot = -1; for (int i = 0; i < Crew.Length && slot == -1; i++) if (Crew[i] == null) slot = i; if (slot >= 0) Crew[slot] = merc; if (Trader != skill) Game.CurrentGame.RecalculateBuyPrices(Game.CurrentGame.Commander.CurrentSystem); }
private void SelectedIndexChanged(object sender, System.EventArgs e) { if (!handlingSelect) { handlingSelect = true; object obj = ((ListBox)sender).SelectedItem; DeselectAll(); if (typeof(CrewMember).IsInstanceOfType(obj)) { ((ListBox)sender).SelectedItem = obj; selectedCrewMember = (CrewMember)obj; } else selectedCrewMember = null; handlingSelect = false; UpdateInfo(); } }
private void UpdateAll() { selectedCrewMember = null; UpdateForHire(); UpdateCurrentCrew(); UpdateInfo(); }
private int[] _priceCargo = new int[10]; // Total price paid for trade goods #endregion #region Methods public Commander(CrewMember baseCrewMember) : base(baseCrewMember) { // Start off with a crew of only the commander and a Pulse Laser. Ship.Crew[0] = this; Ship.AddEquipment(Consts.Weapons[(int)WeaponType.PulseLaser]); }