internal Upgrade(
            string name,
            int cost,
            string cardText,
            bool unique,
            bool limited,
            IFaction faction,
            IUpgradeType upgradeType,
            UpgradeModifierPackage modifiers,
            IReadOnlyList <IXWingSpecification <IPilot> > upgradeRestrictions)
        {
            Id          = Guid.NewGuid();
            Name        = name;
            Cost        = cost;
            CardText    = cardText;
            Unique      = unique;
            Limited     = limited;
            Faction     = faction;
            UpgradeType = upgradeType;


            AddActionModifiers      = modifiers.AddActionModifiers;
            RemoveActionModifiers   = modifiers.RemoveActionModifiers;
            AddUpgradeModifiers     = modifiers.AddUpgradeModifiers;
            RemoveUpgradeModifiers  = modifiers.RemoveUpgradeModifiers;
            PilotAttributeModifiers = modifiers.PilotAttributeModifiers;
            SelectableAddedUpgrades = modifiers.ChooseableUpgradeModifiers;
            UpgradeRestrictions     = upgradeRestrictions;
        }
 /// <summary>
 /// Constructs a UpgradeProductionJob instance.
 /// </summary>
 /// <param name="ownerPlayer">The owner player of the entity that this job belongs to.</param>
 /// <param name="upgradeProduct">The type of upgrade to be created by this job.</param>
 /// <param name="jobID">The ID of this job.</param>
 public UpgradeProductionJob(Player ownerPlayer, IUpgradeType upgradeProduct, int jobID)
     : base(ownerPlayer, upgradeProduct, jobID)
 {
     this.upgradeProduct = upgradeProduct;
     this.dummyField     = this.ConstructField <int>("dummyField");
     this.dummyField.Write(0);
 }
Example #3
0
 public UpgradeSlot(IUpgradeType upgradeType, IUpgrade upgrade, IReadOnlyList <IXWingSpecification <IUpgrade> > restrictions, int costReduction = 0, bool isMutable = true)
 {
     UpgradeType     = upgradeType ?? throw new ArgumentNullException(nameof(upgradeType));
     this.upgrade    = upgrade ?? throw new ArgumentNullException(nameof(upgrade));
     CostReduction   = costReduction;
     RestrictionList = restrictions;
     IsMutable       = isMutable;
 }
        public IUpgradeSlot CreateEmpty(IUpgradeType type, IReadOnlyList <IXWingSpecification <IUpgrade> > restrictions = null, int costReduction = 0)
        {
            if (restrictions == null)
            {
                restrictions = new List <IXWingSpecification <IUpgrade> >();
            }

            return(new UpgradeSlot(type, upgradeFactory.CreateNullUpgrade(type), restrictions, costReduction));
        }
Example #5
0
        /// <see cref="IScenarioMetadata.GetUpgradeType"/>
        public IUpgradeType GetUpgradeType(string upgradeTypeName)
        {
            if (this.attachedMetadata == null)
            {
                throw new InvalidOperationException("Metadata not yet attached!");
            }

            IUpgradeType attachedUpgradeType = this.attachedMetadata.GetUpgradeType(upgradeTypeName);

            return(new IUpgradeType(this.GetElementTypeUpgradeImpl(attachedUpgradeType.Name)));
        }
        /// <see cref="ProductionLine.IsProductAvailableImpl"/>
        protected override bool IsProductAvailableImpl(string productName)
        {
            /// If the given upgrade has already been researched or is being researched in another production line -> the product is not available here.
            if (this.Owner.Owner.GetUpgradeStatus(productName) != UpgradeStatus.None)
            {
                return(false);
            }

            /// If the given upgrade has a previous level that is not yet researched -> the product is not available.
            IUpgradeType product = this.upgradeProducts[productName];

            if (product.PreviousLevel != null && this.Owner.Owner.GetUpgradeStatus(product.PreviousLevel.Name) != UpgradeStatus.Researched)
            {
                return(false);
            }

            /// The upgrade is available only if the owner entity is not flying.
            return(!this.Owner.MotionControl.IsFlying);
        }
 public bool Equals(IUpgradeType other)
 {
     return(Name.Equals(other.Name));
 }
 public int CompareTo(IUpgradeType other)
 {
     return(Name.CompareTo(other.Name));
 }
 public ContainsUpgradeSlotsSpecification(IUpgradeType upgradeType)
 {
     this.upgradeType = upgradeType;
 }
 public PilotHasRequiredUpgradeSlotsSpecification(IUpgradeType upgradeType, int slotsRequired)
 {
     this.upgradeType   = upgradeType;
     this.slotsRequired = slotsRequired;
 }
 public bool Equals(IUpgradeType other)
 {
     return(Name == other.Name && ImageUri == other.ImageUri);
 }
Example #12
0
        public void SetSelectedUpgradeType(IUpgradeType upgradeType)
        {
            var index = PivotMain.Items.IndexOf(PivotMain.Items.Cast <FilteredUpgradeDisplay>().Single(x => x.UpgradeType.Equals(upgradeType)));

            PivotMain.SelectedIndex = index;
        }
 public FilteredUpgradeDisplay(IUpgradeType upgradeType, IPilotViewModel pilot, IXWingRepository xWingRepository)
 {
     this.UpgradeType     = upgradeType;
     this.PilotViewModel  = pilot;
     this.xWingRepository = xWingRepository;
 }
 public NullUpgrade(IUpgradeType upgradeType)
 {
     UpgradeType = upgradeType;
 }
Example #15
0
 public IUpgrade CreateNullUpgrade(IUpgradeType type)
 {
     return(new NullUpgrade(type));
 }
 public IReadOnlyList <IUpgrade> GetAllUpgradesForType(IUpgradeType type)
 {
     return((dataPortal.InventoryRepository.UpgradeJson.Where(x => x.Type.Equals(type.Name)).Select(x =>
                                                                                                    upgradeFactory.CreateUpgrade(x))).ToList().AsReadOnly());
 }
 public IUpgrade GetNullUpgrade(IUpgradeType type)
 {
     return(upgradeFactory.CreateNullUpgrade(type));
 }
 public int CompareTo(IUpgradeType other)
 {
     throw new NotImplementedException();
 }