Exemplo n.º 1
0
 //image or at least image path if gonna show
 /// <summary>
 /// Create a new hull
 /// </summary>
 /// <param name="name">name of the hull</param>
 /// <param name="speed">base speed of the hull</param>
 /// <param name="man">base manoeuvrability of hull</param>
 /// <param name="det">base detection rating of hull</param>
 /// <param name="hullint">base hull integrity of the hull</param>
 /// <param name="armour">base armour value of the hull</param>
 /// <param name="space">base available space in hull</param>
 /// <param name="sp">cost of the hull</param>
 /// <param name="type">which type(s) this hull can mount components for</param>
 /// <param name="special">special rules for this hull</param>
 /// <param name="origin">rulebook this hull can be found in</param>
 /// <param name="page">page number to find the hull on</param>
 /// <param name="turrets">turret rating of the hull</param>
 /// <param name="prow">number of prow weapon slots</param>
 /// <param name="dorsal">number of dorsal weapon slots</param>
 /// <param name="side">number of port weapon slots</param>
 /// <param name="keel">number of keel weapon slots</param>
 /// <param name="aft">number of aft weapon slots</param>
 /// <param name="frontal">Default prow weapon</param>
 /// <param name="broadside">Default broadside weapons</param>
 /// <param name="comps">Default supplemental components</param>
 /// <param name="command">Command modifier of this hull</param>
 /// <param name="maxspeed">maximum speed of ship. &lt;1 = unlimited</param>
 /// <param name="power">Power generated(or used)by hull, not including built in systems(those should be listed in themselves)</param>
 /// <param name="history">History this hull always has</param>
 /// <param name="bs">Modifier to ballistic skill tests with this hull</param>
 /// <param name="locked">If the ship has been locked so it may not add more armour</param>
 /// <param name="navigate">modifier to navigate warp</param>
 /// <param name="shields">hulltypes of the shields which may be added</param>
 public Hull(string name, int speed, int man, int det, int hullint, int armour, int space, int sp, HullType type,
     String special, RuleBook origin, byte page, int turrets = 1, int prow = 0, int dorsal = 0,
     int side = 0, int keel = 0, int aft = 0, Weapon frontal = null, Weapon broadside = null,
     Supplemental[] comps = null, int command = 0, int maxspeed = 0, int power = 0, ShipHistory history = ShipHistory.None,
     int bs = 0, bool locked = false, int navigate = 0, HullType shields = HullType.None)
     : base(name, sp, power, space, special, origin, page, type)
 {
     this.Speed = speed;
     this.Manoeuvrability = man;
     this.DetectionRating = det;
     this.HullIntegrity = hullint;
     this.Armour = armour;
     this.TurretRating = turrets;
     this.ProwSlots = prow;
     this.DorsalSlots = dorsal;
     this.SideSlots = side;
     this.KeelSlots = keel;
     this.AftSlots = aft;
     this.DefaultProw = frontal;
     this.DefaultBroadside = broadside;
     this.DefaultComponents = comps;
     this.Command = command;
     this.MaxSpeed = maxspeed;
     this.History = history;
     this.BSModifier = bs;
     this.ArmourLocked = locked;
     this.NavigateWarp = navigate;
     this.VoidShields = (shields == HullType.None ? type : shields);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Public constructors called for TorpedoTubes or Landing Bay, private constructor to handle either in same manner as WeaponTemplate
 /// </summary>
 /// <param name="facing">Weapon slot</param>
 /// <param name="weapon">Torpedo tube or Landing Bay</param>
 private AmmoWeapon(WeaponSlot facing, StarshipCreator parent, int index, Weapon weapon, bool enabled)
 {
     this.Parent = parent;
     this.Index = index;
     InitializeComponent();
     this.WeaponFacing = facing;
     Facing.Content = WeaponFacing.ToString();
     this.Weapon = weapon;
     if (!enabled)
     {
         WeaponChoice.Visibility = Visibility.Collapsed;
         WeaponName.Visibility = Visibility.Visible;
     }
 }
Exemplo n.º 3
0
 //Also pass in method for button - do after making said method
 public WeaponTemplate(WeaponSlot facing, StarshipCreator parent, int index, Weapon weapon = null, int macrodamage = 0, bool enabled = true)
 {
     this.Parent = parent;
     this.Index = index;
     InitializeComponent();
     this.WeaponFacing = facing;
     Facing.Content = WeaponFacing.ToString();
     this.Weapon = weapon;
     Macrodamage = macrodamage;
     if (!enabled)
     {
         WeaponChoice.Visibility = Visibility.Collapsed;
         WeaponName.Visibility = Visibility.Visible;
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Create a new supplemental Component
 /// </summary>
 /// <param name="name">name of the component</param>
 /// <param name="types">Classes of ship that can use this component</param>
 /// <param name="power">power used or granted by this component</param>
 /// <param name="space">space used by this component</param>
 /// <param name="sp">cost of this component</param>
 /// <param name="origin">rulebook this component is found in</param>
 /// <param name="page">page number to find this component</param>
 /// <param name="special">special rules of the component</param>
 /// <param name="quality">quality of the component</param>
 /// <param name="speed">speed modifier of the component</param>
 /// <param name="man">manoeuvrability modifier of the component</param>
 /// <param name="hullint">hull integrity modifier of the component</param>
 /// <param name="armour">armour modifier of the component</param>
 /// <param name="turrets">turret modifier of the component</param>
 /// <param name="morale">morale modifier of the component</param>
 /// <param name="crew">crew population modifier of the component</param>
 /// <param name="prowArmour">armour modifier to only the prow from this component</param>
 /// <param name="ramming">Additional damage dealt by ramming with this component</param>
 /// <param name="crewRating">Bonus or penalty to crew rating</param>
 /// <param name="mining">modifier to mining objectives</param>
 /// <param name="creed">modifier to creed objectives</param>
 /// <param name="military">modifier to military objectives</param>
 /// <param name="trade">modifier to trade objectives</param>
 /// <param name="criminal">modifier to criminal objectives</param>
 /// <param name="exploration">modifier to exploration objectives</param>
 /// <param name="generated">If the power listed is generated instead of used</param>
 /// <param name="detection">modifier to detection rating fromt he component</param>
 /// <param name="aux">Auxiliary weapons like hold landing bay granted by this component</param>
 /// <param name="macrodamage">damage modifier to macrobatteries such as from the munitorium</param>
 /// <param name="bs">ballistic skill modifier from this component</param>
 /// <param name="navigate">modifer to navigate the warp</param>
 /// <param name="crewLoss">modifier to crew losses</param>
 /// <param name="moraleLoss">modifier to morale losses</param>
 public Supplemental(string name, HullType types, int power, int space, int sp, RuleBook origin, byte page,
     DiceRoll ramming, String special = null, Quality quality = Quality.Common, int speed = 0, int man = 0,
     int hullint = 0, int armour = 0, int turrets = 0, int morale = 0, int crew = 0,
     int prowArmour = 0, int crewRating = 0,
     int mining = 0, int creed = 0, int military = 0, int trade = 0, int criminal = 0,
     int exploration = 0, bool generated = false, int detection = 0, Weapon aux = null, 
     int macrodamage = 0, int bs = 0, int navigate = 0, int crewLoss = 0, int moraleLoss = 0,
     ComponentOrigin comp = ComponentOrigin.Standard, string replace = null, int max = 0, Condition cond = Condition.Intact)
     : base(name, sp, power, space, special, origin, page, types, quality, comp, cond)
 {
     this.Speed = speed;
     this.Manoeuvrability = man;
     this.HullIntegrity = hullint;
     this.Armour = armour;
     this.TurretRating = turrets;
     this.Morale = morale;
     this.CrewPopulation = crew;
     this.ProwArmour = prowArmour;
     this.RamDamage = ramming;
     this.CrewRating = crewRating;
     this.MiningObjective = mining;
     this.CreedObjective = creed;
     this.MilitaryObjective = military;
     this.TradeObjective = trade;
     this.CriminalObjective = criminal;
     this.ExplorationObjective = exploration;
     this.PowerGenerated = generated;
     this.DetectionRating = detection;
     this.AuxiliaryWeapon = aux;
     this.MacrobatteryModifier = macrodamage;
     this.BSModifier = bs;
     this.NavigateWarp = navigate;
     this.CrewLoss = crewLoss;
     this.MoraleLoss = moraleLoss;
     this.Replace = replace;
     this.Max = max;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Create a new supplemental Component
 /// </summary>
 /// <param name="name">name of the supplemental component</param>
 /// <param name="types">Classes of ship that can use this component</param>
 /// <param name="power">power used or granted by this component</param>
 /// <param name="space">space used by this component</param>
 /// <param name="sp">cost of this component</param>
 /// <param name="origin">rulebook this component is found in</param>
 /// <param name="page">page number to find this component</param>
 /// <param name="ramming">Additional damage dealt by ramming with this component</param>
 /// <param name="special">special rules of the component</param>
 /// <param name="quality">quality of the component</param>
 /// <param name="speed">speed modifier of the component</param>
 /// <param name="man">manoeuvrability modifier of the component</param>
 /// <param name="hullint">hull integrity modifier of the component</param>
 /// <param name="armour">armour modifier of the component</param>
 /// <param name="turrets">turret modifier of the component</param>
 /// <param name="morale">morale modifier of the component</param>
 /// <param name="crew">crew population modifier of the component</param>
 /// <param name="prowArmour">armour modifier to only the prow from this component</param>
 /// <param name="crewRating">Bonus or penalty to crew rating</param>
 /// <param name="mining">modifier to mining objectives</param>
 /// <param name="creed">modifier to creed objectives</param>
 /// <param name="military">modifier to military objectives</param>
 /// <param name="trade">modifier to trade objectives</param>
 /// <param name="criminal">modifier to criminal objectives</param>
 /// <param name="exploration">modifier to exploration objectives</param>
 /// <param name="generated">If the power listed is generated instead of used</param>
 /// <param name="detection">modifier to detection rating fromt he component</param>
 /// <param name="aux">Auxiliary weapons like hold landing bay granted by this component</param>
 /// <param name="macrodamage">damage modifier to macrobatteries such as from the munitorium</param>
 /// <param name="bs">ballistic skill modifier from this component</param>
 /// <param name="navigate">modifer to navigate the warp</param>
 /// <param name="crewLoss">modifier to crew losses</param>
 /// <param name="moraleLoss">modifier to morale losses</param>
 public Supplemental(string name, HullType types, int power, int space, int sp, RuleBook origin, byte page,
     String ramming = null, String special = null, Quality quality = Quality.Common, int speed = 0,
     int man = 0, int hullint = 0, int armour = 0, int turrets = 0, int morale = 0,
     int crew = 0, int prowArmour = 0, int crewRating = 0, int mining = 0, int creed = 0, int military = 0,
     int trade = 0, int criminal = 0, int exploration = 0, bool generated = false, int detection = 0,
     Weapon aux = null, int macrodamage = 0, int bs = 0, int navigate = 0, int crewLoss = 0, int moraleLoss = 0,
     ComponentOrigin comp = ComponentOrigin.Standard, string replace = null, int max = 0, Condition cond = Condition.Intact)
     : this(name, types, power, space, sp, origin, page, new DiceRoll(ramming), special, quality, speed, man, hullint,
         armour, turrets, morale, crew, prowArmour, crewRating,
         mining, creed, military, trade, criminal, exploration, generated, detection, aux,
         macrodamage, bs, navigate, crewLoss, moraleLoss, comp, replace, max, cond)
 {
 }
Exemplo n.º 6
0
 public void AddWeapon(WeaponSlot facing, Weapon weapon, int count, bool update = true, bool enabled = true)
 {
     UserControl NewWeapon = null;
     if (weapon == null || weapon.Type == WeaponType.Macrobattery || weapon.Type == WeaponType.Lance)
         NewWeapon = new WeaponTemplate(facing, this, count, weapon, Starship.MacrobatteryModifier);
     else if (weapon.Type == WeaponType.TorpedoTube)
         NewWeapon = new AmmoWeapon(facing, this, count, weapon as TorpedoTubes, enabled);
     else if (weapon.Type == WeaponType.LandingBay)
         NewWeapon = new AmmoWeapon(facing, this, count, weapon as LandingBay, enabled);
     else if (weapon.Type == WeaponType.NovaCannon)
         NewWeapon = new NovaCannonTemplate(facing, this, count, weapon as NovaCannon, enabled);
     if (NewWeapon != null)
     {
         Grid.SetRow(NewWeapon, WeaponRowCount++);//Add the extra row as you place this one
         Grid.SetColumnSpan(NewWeapon, 7);
         Weapons.Children.Add(NewWeapon);
         if (weapon != null && update)
         {
             UpdateSP();
             UpdateUsedSpace();
             UpdateUsedPower();
         }
     }
 }
Exemplo n.º 7
0
 public WeaponChooser(Starship starship, WeaponSlot slot, int index, Loader loader)
 {
     if (starship == null || starship.Hull == null)
         throw new ArgumentException("Cannot create weapon chooser without starship or hull");
     this.Starship = starship;
     this.Index = index;
     WeaponRowCount = 0;
     InitializeComponent();
     Label label;
     Button button;
     TextBox textbox;
     TextBlock textblock;
     button = new Button();
     button.Content = "Clear Weapon";
     button.Click += ((s, e) => SetCurrent(null));
     Grid.SetRow(button, WeaponRowCount);
     Grid.SetColumn(button, 0);
     WeaponGrid.Children.Add(button);
     foreach (var group in loader.Weapons.Where(x => (x.HullTypes & starship.Hull.HullTypes) != 0 && (x.Slots & slot) != 0).GroupBy(x => x.ComponentOrigin).OrderBy(x => x.Key))
     {
         if (group.Key != ComponentOrigin.Standard)
         {
             label = new Label();
             label.Content = group.Key.ToString();
             Grid.SetRow(label, WeaponRowCount++);
             Grid.SetColumn(label, 0);
             WeaponGrid.Children.Add(label);
         }
         foreach (Weapon weapon in group)
         {
             button = new Button();
             button.Content = weapon.Name;
             button.Click += ((s,e) => SetCurrent(weapon, weapon.Quality, weapon.WeaponQuality));
             Grid.SetRow(button, WeaponRowCount);
             Grid.SetColumn(button, 0);
             WeaponGrid.Children.Add(button);
             textbox = new TextBox();
             textbox.Text = weapon.Type.ToString();
             textbox.IsReadOnly = true;
             Grid.SetRow(textbox, WeaponRowCount);
             Grid.SetColumn(textbox, 1);
             WeaponGrid.Children.Add(textbox);
             textbox = new TextBox();
             textbox.Text = weapon.Power.ToString();
             textbox.IsReadOnly = true;
             textbox.TextAlignment = TextAlignment.Center;
             Grid.SetRow(textbox, WeaponRowCount);
             Grid.SetColumn(textbox, 2);
             WeaponGrid.Children.Add(textbox);
             textbox = new TextBox();
             textbox.Text = weapon.Space.ToString();
             textbox.IsReadOnly = true;
             textbox.TextAlignment = TextAlignment.Center;
             Grid.SetRow(textbox, WeaponRowCount);
             Grid.SetColumn(textbox, 3);
             WeaponGrid.Children.Add(textbox);
             textbox = new TextBox();
             textbox.Text = weapon.SP.ToString();
             textbox.IsReadOnly = true;
             textbox.TextAlignment = TextAlignment.Center;
             Grid.SetRow(textbox, WeaponRowCount);
             Grid.SetColumn(textbox, 4);
             WeaponGrid.Children.Add(textbox);
             textbox = new TextBox();
             textbox.Text = weapon.Strength.ToString();
             textbox.IsReadOnly = true;
             textbox.TextAlignment = TextAlignment.Center;
             Grid.SetRow(textbox, WeaponRowCount);
             Grid.SetColumn(textbox, 5);
             WeaponGrid.Children.Add(textbox);
             textbox = new TextBox();
             textbox.Text = weapon.Damage.ToString();
             textbox.IsReadOnly = true;
             textbox.TextAlignment = TextAlignment.Center;
             Grid.SetRow(textbox, WeaponRowCount);
             Grid.SetColumn(textbox, 6);
             WeaponGrid.Children.Add(textbox);
             textbox = new TextBox();
             textbox.Text = weapon.DisplayRange;
             textbox.IsReadOnly = true;
             textbox.TextAlignment = TextAlignment.Center;
             Grid.SetRow(textbox, WeaponRowCount);
             Grid.SetColumn(textbox, 7);
             WeaponGrid.Children.Add(textbox);
             textbox = new TextBox();
             textbox.Text = weapon.Crit.ToString();
             textbox.IsReadOnly = true;
             textbox.TextAlignment = TextAlignment.Center;
             Grid.SetRow(textbox, WeaponRowCount);
             Grid.SetColumn(textbox, 8);
             WeaponGrid.Children.Add(textbox);
             textbox = new TextBox();
             textbox.Text = weapon.Origin.Name();
             textbox.IsReadOnly = true;
             textbox.ToolTip = weapon.Origin.LongName() + ", Page: " + weapon.PageNumber;
             Grid.SetRow(textbox, WeaponRowCount++);
             Grid.SetColumn(textbox, 10);
             WeaponGrid.Children.Add(textbox);
             if (!String.IsNullOrWhiteSpace(weapon.Description))
             {
                 textblock = new TextBlock();
                 textblock.Text = weapon.Description;
                 textblock.Margin = new Thickness(2, 2, 2, 2);
                 textblock.TextWrapping = TextWrapping.WrapWithOverflow;
                 Grid.SetRow(textblock, WeaponRowCount++);
                 Grid.SetColumnSpan(textblock, 11);
                 WeaponGrid.Children.Add(textblock);
             }
         }
     }
     Current = Starship.Weapons[Index];
     UpdateCurrent();
 }
Exemplo n.º 8
0
 private void SetCurrent(Weapon weapon, Quality quality = Quality.None, WeaponQuality wq = WeaponQuality.None)
 {
     if (weapon == null)
         Current = null;
     else if (weapon is NovaCannon)
         Current = new NovaCannon(weapon.Name, weapon.HullTypes, weapon.RawPower, weapon.RawSpace, weapon.RawSP, weapon.RawDamage, weapon.RawRange, weapon.Origin, weapon.PageNumber, weapon.RawSpecial,
             quality, wq, weapon.ComponentOrigin, weapon.Condition, ((NovaCannon)weapon).Ammo);
     else if (weapon is LandingBay)
         Current = new LandingBay(weapon.Name, weapon.HullTypes, weapon.Slots, weapon.RawPower, weapon.RawSpace, weapon.RawSP, weapon.RawStrength, weapon.Origin, weapon.PageNumber, quality, wq,
             weapon.RawSpecial, weapon.ComponentOrigin, weapon.Condition);
     else if (weapon is TorpedoTubes)
         Current = new TorpedoTubes(weapon.Name, weapon.HullTypes, weapon.RawPower, weapon.RawSpace, weapon.RawSP, weapon.RawStrength, ((TorpedoTubes)weapon).Capacity, weapon.Origin, weapon.PageNumber,
             quality, wq, weapon.RawSpecial, weapon.ComponentOrigin, weapon.Condition);
     else
         Current = new Weapon(weapon.Name, weapon.Type, weapon.HullTypes, weapon.Slots, weapon.RawPower, weapon.RawSpace, weapon.RawSP, weapon.RawStrength, weapon.RawDamage, weapon.RawCrit, weapon.RawRange,
         weapon.Origin, weapon.PageNumber, quality, wq, weapon.RawSpecial, Quality.None, weapon.ComponentOrigin, weapon.Condition);
     UpdateCurrent();
 }