Esempio n. 1
0
 public bool doesHeroHave(AidType aid, bool consume, ref List <ItemStack> used)
 {
     foreach (ItemStack stack in inventory)
     {
         if (stack.doesStackHave(aid))
         {
             if (used != null)
             {
                 used.Add(stack);
             }
             if (consume && stack.item.isConsumable && stack.stackSize > 0)
             {
                 stack.stackSize--;
             }
             else
             {
                 stack.numTimesUsedOnQuest++;
                 stack.onUsedDuringQuest(this);
                 if (_obstacles[this.questStep] is IQuestGoal)
                 {
                     stack.numTimesUsedOnQuest += 2;
                 }
             }
             return(true);
         }
     }
     return(false);
 }
Esempio n. 2
0
        protected float getArmorValueFor(ItemStack stack, EnumRestriction restrict)
        {
            float enhance = 0;

            if (stack.doesStackHave(Enchantments.ENHANCEMENT))
            {
                foreach (Enchantment en in stack.enchants)
                {
                    if (en == Enchantments.ENHANCEMENT)
                    {
                        enhance += 0.05f;
                    }
                }
            }
            AidType p    = stack.getAllAids();
            float   best = 0;

            for (int i = 1; i < 32; i *= 2)
            {
                float a = getArmorValue((p & (AidType)i), restrict);
                if (a > best)
                {
                    best = a;
                }
            }
            if ((restrict ^ EnumRestriction.MAGIC) == 0)
            {
                enhance = 0;
            }
            if ((restrict ^ EnumRestriction.SHIELD) == 0)
            {
                enhance /= 5;
            }
            return((best > 0)?enhance + best:0);
        }
Esempio n. 3
0
        public Industry addAidType(AidType type)
        {
            aidProperties |= type;
            industryItem.addAidType(type);

            if ((type & (AidType.HEALING_LARGE | AidType.HEALING_MEDIUM | AidType.HEALING_SMALL | AidType.HEALING_TINY)) > 0)
            {
                this.addReqType(RequirementType.HEALING);
            }
            if ((type & (AidType.MANA_LARGE | AidType.MANA_MEDIUM | AidType.MANA_SMALL | AidType.MANA_TINY)) > 0)
            {
                this.addReqType(RequirementType.MANA);
            }
            if ((type & AidType.WEAPON) > 0)
            {
                this.addReqType(RequirementType.WEAPON);
            }
            if ((type & AidType.RANGED_WEAPON) > 0)
            {
                this.addReqType(RequirementType.RANGED);
            }
            if ((type & (AidType.LIGHT_ARMOR | AidType.MEDIUM_ARMOR | AidType.HEAVY_ARMOR | AidType.BARKSKIN | AidType.LIGHT_SHIELD | AidType.HEAVY_SHIELD)) > 0)
            {
                this.addReqType(RequirementType.ARMOR);
            }
            return(this);
        }
Esempio n. 4
0
 public AidItemModel(string name, float weight, float maxCondition, bool unique, bool essential,
                     AidType aType, RestoreType rType, float amount)
     : base(name, weight, maxCondition, unique, essential)
 {
     AType  = aType;
     RType  = rType;
     Amount = amount;
 }
Esempio n. 5
0
        //TODO conditions, exec script on use, etc

        public AidItemModel(string name, float weight, float value, float maxCondition, bool hidden, bool essential, string[] flags, string worldModel,
                            AidType aType, RestoreType rType, float amount)
            : base(name, weight, value, maxCondition, hidden, essential, flags, worldModel)
        {
            AType  = aType;
            RType  = rType;
            Amount = amount;
        }
Esempio n. 6
0
 public bool doesStackHave(AidType type)
 {
     /*foreach(Enchantment e in enchants) {
      *      if((e.reqTypes & type) > 0) {
      *              return true;
      *      }
      * }*/
     return(item.hasAidType(type));
 }
Esempio n. 7
0
 public ItemStack getHeroItemWith(AidType aid)
 {
     foreach (ItemStack stack in inventory)
     {
         if (stack.doesStackHave(aid) && stack.stackSize > 0)
         {
             return(stack);
         }
     }
     return(null);
 }
Esempio n. 8
0
 public override bool hasAidType(AidType type)
 {
     if (type == 0)
     {
         return(false);
     }
     if (healingTypes.Contains(type))
     {
         return(false);
     }
     return(true);            //(aidProperties & type) > 0;
 }
Esempio n. 9
0
        protected float getArmorValue(AidType type, EnumRestriction restrict)
        {
            switch (type)
            {
            case AidType.HEAVY_ARMOR:
                return((restrict & EnumRestriction.ARMOR) > 0 ? 0.3f : 0);

            case AidType.MEDIUM_ARMOR:
                return((restrict & EnumRestriction.ARMOR) > 0 ? 0.2f : 0);

            case AidType.LIGHT_ARMOR:
                return((restrict & EnumRestriction.ARMOR) > 0 ? 0.1f : 0);

            case AidType.LIGHT_SHIELD:
                return((restrict & EnumRestriction.SHIELD) > 0 ? 0.05f : 0);

            case AidType.HEAVY_SHIELD:
                return((restrict & EnumRestriction.SHIELD) > 0 ? 0.1f : 0);

            case AidType.BARKSKIN:
                return((restrict & EnumRestriction.MAGIC) > 0 ? 0.1f : 0);
            }
            return(0);
        }
Esempio n. 10
0
 public Item addAidType(AidType type)
 {
     aidProperties |= type;
     return(this);
 }
Esempio n. 11
0
        public AidType getAllAids()
        {
            AidType ty = item.getAllAids();

            return(ty);
        }
Esempio n. 12
0
 public ComboAidItemModel(string name, float weight, float value, float maxCondition, int maxQuantity, bool hidden, bool essential, string[] flags, ItemScriptNode scripts, string worldModel,
                          AidType aType, RestoreType rType, float amount, string script, ComboAidItemRestoreNode[] restoreNodes) : base(name, weight, value, maxCondition, maxQuantity, hidden, essential, flags, scripts, worldModel, aType, rType, amount, script)
 {
     RestoreNodes = restoreNodes;
 }
Esempio n. 13
0
        public bool doesHeroHave(AidType aid, bool consume)
        {
            List <ItemStack> used = null;

            return(doesHeroHave(aid, true, ref used));
        }
Esempio n. 14
0
 public bool doesHeroHave(AidType aid)
 {
     return(doesHeroHave(aid, true));
 }
Esempio n. 15
0
 public virtual bool hasAidType(AidType type)
 {
     return((aidProperties & type) > 0);
 }
Esempio n. 16
0
 public bool doesHeroHave(AidType aid, ref List <ItemStack> used)
 {
     return(doesHeroHave(aid, true, ref used));
 }
Esempio n. 17
0
        protected static float ApplyNode(AidType aType, RestoreType rType, float amount, CharacterModel player)
        {
            float amountRestored = 0;

            //this is super gross but I will improve it later
            switch (aType)
            {
            case AidType.Health:
            {
                switch (rType)
                {
                case RestoreType.Add:
                    float oldHealth = player.Health;
                    player.Health  = Math.Min(player.Health + amount, player.DerivedStats.MaxHealth);
                    amountRestored = player.Health - oldHealth;
                    break;

                case RestoreType.Boost:
                    player.Health += amount;
                    amountRestored = amount;
                    break;

                case RestoreType.Override:
                    player.Health  = amount;
                    amountRestored = amount;
                    break;

                default:
                    break;
                }
            }
            break;

            case AidType.Energy:
            {
                switch (rType)
                {
                case RestoreType.Add:
                    float oldEnergy = player.Energy;
                    player.Energy  = Math.Min(player.Energy + amount, player.DerivedStats.MaxEnergy);
                    amountRestored = player.Energy - oldEnergy;
                    break;

                case RestoreType.Boost:
                    player.Energy += amount;
                    amountRestored = amount;
                    break;

                case RestoreType.Override:
                    player.Energy  = amount;
                    amountRestored = amount;
                    break;

                default:
                    break;
                }
            }
            break;

            case AidType.Magic:
            {
                switch (rType)
                {
                case RestoreType.Add:
                    float oldMagic = player.Magic;
                    player.Magic   = Math.Min(player.Magic + amount, player.DerivedStats.MaxMagic);
                    amountRestored = player.Magic - oldMagic;
                    break;

                case RestoreType.Boost:
                    player.Magic  += amount;
                    amountRestored = amount;
                    break;

                case RestoreType.Override:
                    player.Magic   = amount;
                    amountRestored = amount;
                    break;

                default:
                    break;
                }
            }
            break;

            case AidType.Shields:
            {
                switch (rType)
                {
                case RestoreType.Add:
                    float oldShields = player.Shields;
                    player.Shields = Math.Min(player.Shields + amount, player.DerivedStats.ShieldParams.MaxShields);
                    amountRestored = player.Shields - oldShields;
                    break;

                case RestoreType.Boost:
                    player.Shields += amount;
                    amountRestored  = amount;
                    break;

                case RestoreType.Override:
                    player.Shields = amount;
                    amountRestored = amount;
                    break;

                default:
                    break;
                }
            }
            break;
            }

            return(amountRestored);
        }