public override int CalcValue(GameLiving living, eProperty property) 
		{
			/* PATCH 1.87 COMBAT AND REGENERATION
			  - While in combat, health and power regeneration ticks will happen twice as often.
    		  - Each tick of health and power is now twice as effective.
              - All health and power regeneration aids are now twice as effective.
             */

			double regen = 5 + (living.Level / 2.75);

			if (living is GameNPC && living.InCombat)
				regen /= 2.0;

			// tolakram - there is no difference per tic between combat and non combat

			if (regen != 0 && ServerProperties.Properties.MANA_REGEN_RATE != 1)
				regen *= ServerProperties.Properties.MANA_REGEN_RATE;

			double decimals = regen - (int)regen;
			if (Util.ChanceDouble(decimals)) 
			{
				regen += 1;	// compensate int rounding error
			}

			int debuff = living.SpecBuffBonusCategory[(int)property];
			if (debuff < 0)
				debuff = -debuff;

			regen += living.BaseBuffBonusCategory[(int)property] + living.AbilityBonus[(int)property] + living.ItemBonus[(int)property] - debuff;

			if (regen < 1)
				regen = 1;

			return (int)regen;
		}
Exemple #2
0
        /// <summary>
        /// Calculate the actual resist amount for the given living and the given
        /// resist type, applying all possible caps and cap increases.
        /// </summary>
        /// <param name="living">The living the resist amount is to be determined for.</param>
        /// <param name="property">The resist type.</param>
        /// <returns>The actual resist amount.</returns>
        public override int CalcValue(GameLiving living, eProperty property)
        {
            int propertyIndex = (int)property;

            // Abilities/racials/debuffs.

            int debuff = living.DebuffCategory[propertyIndex];
			int abilityBonus = living.AbilityBonus[propertyIndex];
			int racialBonus = SkillBase.GetRaceResist( living.Race, (eResist)property );

            // Items and buffs.

            int itemBonus = CalcValueFromItems(living, property);
            int buffBonus = CalcValueFromBuffs(living, property);

            // Apply debuffs. 100% Effectiveness for player buffs, but only 50%
            // effectiveness for item bonuses.

            buffBonus -= Math.Abs(debuff);

            if (buffBonus < 0)
            {
                itemBonus += buffBonus / 2;
                buffBonus = 0;
                if (itemBonus < 0)
                    itemBonus = 0;
            }

            // Add up and apply hardcap.

            return Math.Min(itemBonus + buffBonus + abilityBonus + racialBonus, HardCap);
		}
Exemple #3
0
        public override int CalcValue(GameLiving living, eProperty property)
        {
            int percent = 100
                +living.BaseBuffBonusCategory[(int)property];

            return percent;
        }
        public override int CalcValue(GameLiving living, eProperty property)
        {
            int propertyIndex = (int)property;

            // Base stats/abilities/debuffs/death.

            int baseStat = living.GetBaseStat((eStat)property);
            int abilityBonus = living.AbilityBonus[propertyIndex];
            int debuff = living.DebuffCategory[propertyIndex];
			int deathConDebuff = 0;

            int itemBonus = CalcValueFromItems(living, property);
            int buffBonus = CalcValueFromBuffs(living, property);

			// Special cases:
			// 1) ManaStat (base stat + acuity, players only).
			// 2) As of patch 1.64: - Acuity - This bonus will increase your casting stat, 
			//    whatever your casting stat happens to be. If you're a druid, you should get an increase to empathy, 
			//    while a bard should get an increase to charisma.  http://support.darkageofcamelot.com/kb/article.php?id=540
			// 3) Constitution lost at death, only affects players.

			if (living is GamePlayer)
			{
				GamePlayer player = living as GamePlayer;
				if (property == (eProperty)(player.CharacterClass.ManaStat))
				{
					if (player.CharacterClass.ID != (int)eCharacterClass.Scout && player.CharacterClass.ID != (int)eCharacterClass.Hunter && player.CharacterClass.ID != (int)eCharacterClass.Ranger)
					{
						abilityBonus += player.AbilityBonus[(int)eProperty.Acuity];
					}
				}

				deathConDebuff = player.TotalConstitutionLostAtDeath;
			}

			// Apply debuffs, 100% effectiveness for player buffs, 50% effectiveness
			// for item and base stats

			int unbuffedBonus = baseStat + itemBonus;
			buffBonus -= Math.Abs(debuff);

			if (buffBonus < 0)
			{
				unbuffedBonus += buffBonus / 2;
				buffBonus = 0;
				if (unbuffedBonus < 0)
					unbuffedBonus = 0;
			}

			// Add up and apply any multiplicators.

			int stat = unbuffedBonus + buffBonus + abilityBonus;
			stat = (int)(stat * living.BuffBonusMultCategory1.Get((int)property));

			// Possibly apply constitution loss at death.

			stat -= (property == eProperty.Constitution)? deathConDebuff : 0;

			return Math.Max(1, stat);
        }
		public override int CalcValue(GameLiving living, eProperty property) 
		{
			if (living is GamePlayer) 
			{
				GamePlayer player = living as GamePlayer;
				if (player.CharacterClass.ManaStat == eStat.UNDEFINED) 
                    return 1000000;

				int concBase = (int)((player.Level * 4) * 2.2);
				int stat = player.GetModified((eProperty)player.CharacterClass.ManaStat);
				int factor = (stat > 50) ? (stat - 50) / 2 : (stat - 50);
				int conc = (concBase + concBase * factor / 100) / 2;
				conc = (int)(player.Effectiveness * (double)conc);

				if (conc < 0)
				{
					if (log.IsWarnEnabled)
						log.WarnFormat(living.Name+": concentration is less than zerro (conc:{0} eff:{1:R} concBase:{2} stat:{3} factor:{4})", conc, player.Effectiveness, concBase, stat, factor);
					conc = 0;
				}

                if (player.GetSpellLine("Perfecter") != null
				   && player.MLLevel >= 4)
                    conc += (20 * conc / 100);

				return conc;
			} 
			else 
			{
				return 1000000;	// default
			}
		}
		public override int CalcValue(GameLiving living, eProperty property)
		{
			return Math.Max(1, 100
				- living.BaseBuffBonusCategory[(int)property] // less is faster = buff
				+ living.DebuffCategory[(int)property] // more is slower = debuff
				- Math.Min(10, living.ItemBonus[(int)property])); // ?
		}
		public override int CalcValue(GameLiving living, eProperty property) 
		{
//			DOLConsole.WriteSystem("calc skill prop "+property+":");
			if (living is GamePlayer) 
			{
				GamePlayer player = (GamePlayer)living;

				int itemCap = player.Level/5+1;

				int itemBonus = player.ItemBonus[(int)property];

				if (SkillBase.CheckPropertyType(property, ePropertyType.SkillMeleeWeapon))
					itemBonus += player.ItemBonus[(int)eProperty.AllMeleeWeaponSkills];
				if (SkillBase.CheckPropertyType(property, ePropertyType.SkillMagical))
					itemBonus += player.ItemBonus[(int)eProperty.AllMagicSkills];
				if (SkillBase.CheckPropertyType(property, ePropertyType.SkillDualWield))
					itemBonus += player.ItemBonus[(int)eProperty.AllDualWieldingSkills];
				if (SkillBase.CheckPropertyType(property, ePropertyType.SkillArchery))
					itemBonus += player.ItemBonus[(int)eProperty.AllArcherySkills];

				itemBonus += player.ItemBonus[(int)eProperty.AllSkills];

				if (itemBonus > itemCap)
					itemBonus = itemCap;
				int buffs = player.BaseBuffBonusCategory[(int)property]; // one buff category just in case..

//				DOLConsole.WriteLine("item bonus="+itemBonus+"; buffs="+buffs+"; realm="+player.RealmLevel/10);
				return itemBonus + buffs + player.RealmLevel/10;
			} 
			else 
			{
				// TODO other living types
			}
			return 0;
		}
 public override int CalcValue(GameLiving living, eProperty property)
 {
     return (int)(
         +living.BaseBuffBonusCategory[(int)property]
         + living.SpecBuffBonusCategory[(int)property]
         - living.DebuffCategory[(int)property]
         + living.BuffBonusCategory4[(int)property]);
 }
 public override int CalcValue(GameLiving living, eProperty property)
 {
     if (living is GamePlayer)
     {
         return living.ItemBonus[(int)property];
     }
     return 0;
 }
 /// <summary>
 /// Constructs a new calculator attribute for range of properties
 /// </summary>
 /// <param name="min">The lowest property in range</param>
 /// <param name="max">The highest property in range</param>
 public PropertyCalculatorAttribute(eProperty min, eProperty max)
 {
     if (min > max)
         throw new ArgumentException("min property is higher than max (min=" + (int)min + " max=" + (int)max + ")");
     if (min < 0 || max > eProperty.MaxProperty)
         throw new ArgumentOutOfRangeException("max", (int)max, "property must be in 0 .. eProperty.MaxProperty range");
     m_min = min;
     m_max = max;
 }
		public override int CalcValue(GameLiving living, eProperty property)
		{
			// Hardcap 10%
			int percent = Math.Min(10, living.BaseBuffBonusCategory[(int)property]
				-living.DebuffCategory[(int)property]
				+living.ItemBonus[(int)property]);

			return percent;
		}
Exemple #12
0
        public override int CalcValue(GameLiving living, eProperty property)
        {
            GamePlayer player = living as GamePlayer;
            if(player == null)
            {
                return 0;
            }

            return Math.Min(living.ItemBonus[(int) property], 25);
        }
Exemple #13
0
		public override int CalcValue(GameLiving living, eProperty property)
		{
			double percent = 100
			+ living.BaseBuffBonusCategory[(int)property] // enchance the weaponskill
			+ living.SpecBuffBonusCategory[(int)property] // enchance the weaponskill
				//hotfix for poisons where both debuff components have same value
			- (int)(living.DebuffCategory[(int)property] / 5.4) // reduce
		   + living.ItemBonus[(int)property];
			return (int)Math.Max(1, percent);
		}
Exemple #14
0
		public override int CalcValue(GameLiving living, eProperty property)
		{
			return (int)(
				+living.BaseBuffBonusCategory[(int)property]
				+ living.SpecBuffBonusCategory[(int)property]
				- living.DebuffCategory[(int)property]
				+ living.BuffBonusCategory4[(int)property]
				+ living.AbilityBonus[(int)property]
				+ Math.Min(10, living.ItemBonus[(int)property]));
		}
		/// <summary>
		/// calculates the final property value
		/// </summary>
		/// <param name="living"></param>
		/// <param name="property"></param>
		/// <returns></returns>
		public override int CalcValue(GameLiving living, eProperty property)
		{
			if (living.IsDiseased)
				return 0; // no HP regen if diseased
			if (living is GameKeepDoor)
				return (int)(living.MaxHealth * 0.05); //5% each time for keep door

			double regen = 1;

			/* PATCH 1.87 COMBAT AND REGENERATION
			  - While in combat, health and power regeneration ticks will happen twice as often.
    		  - Each tick of health and power is now twice as effective.
              - All health and power regeneration aids are now twice as effective.
             */

			if (living.Level < 26)
			{
				regen = 10 + (living.Level * 0.2);
			}
			else
			{
				regen = living.Level * 0.6;
			}

			// assumes NPC regen is now half as effective as GamePlayer (as noted above) - tolakram
			// http://www.dolserver.net/viewtopic.php?f=16&t=13197

			if (living is GameNPC)
			{
				if (living.InCombat)
					regen /= 2.0;
			}
            
			if (regen != 0 && ServerProperties.Properties.HEALTH_REGEN_RATE != 1)
				regen *= ServerProperties.Properties.HEALTH_REGEN_RATE;

			double decimals = regen - (int)regen;
			if (Util.ChanceDouble(decimals)) 
			{
				regen += 1;	// compensate int rounding error
			}

			regen += living.ItemBonus[(int)property];

			int debuff = living.SpecBuffBonusCategory[(int)property];
			if (debuff < 0)
				debuff = -debuff;

			regen += living.BaseBuffBonusCategory[(int)property] - debuff;

			if (regen < 1)
				regen = 1;

			return (int)regen;
		}
Exemple #16
0
        /// <summary>
        /// Calculate modified resists from buffs only.
        /// </summary>
        /// <param name="living"></param>
        /// <param name="property"></param>
        /// <returns></returns>
        public override int CalcValueFromBuffs(GameLiving living, eProperty property)
        {
            int buffBonus = living.BaseBuffBonusCategory[(int)property]
                            + living.BuffBonusCategory4[(int)property];

            if (living is GameNPC)
            {
                return(buffBonus);
            }
            return(Math.Min(buffBonus, BuffBonusCap));
        }
Exemple #17
0
 public int this[eProperty index]
 {
     get
     {
         return(this[(int)index]);
     }
     set
     {
         this[(int)index] = value;
     }
 }
Exemple #18
0
		public int this[eProperty index]
		{
			get
			{
				return this[(int)index];
			}
			set
			{
				this[(int)index] = value;
			}
		}
        public override int CalcValue(GameLiving living, eProperty property)
        {
            GamePlayer player = living as GamePlayer;

            if (player == null)
            {
                return(0);
            }

            return(Math.Min(living.ItemBonus[(int)property], 25));
        }
        public override int CalcValue(GameLiving living, eProperty property)
        {
            double percent = 100
                             + living.BaseBuffBonusCategory[(int)property]       // enchance the weaponskill
                             + living.SpecBuffBonusCategory[(int)property]       // enchance the weaponskill
                                                                                 //hotfix for poisons where both debuff components have same value
                             - (int)(living.DebuffCategory[(int)property] / 5.4) // reduce
                             + living.ItemBonus[(int)property];

            return((int)Math.Max(1, percent));
        }
        /// <summary>
        /// Calculate modified resists from items only.
        /// </summary>
        /// <param name="living"></param>
        /// <param name="property"></param>
        /// <returns></returns>
        public override int CalcValueFromItems(GameLiving living, eProperty property)
        {
            int itemBonus = living.ItemBonus[(int)property];

            // Item bonus cap and cap increase from Mythirians.

            int itemBonusCap         = living.Level / 2 + 1;
            int itemBonusCapIncrease = GetItemBonusCapIncrease(living, property);

            return(Math.Min(itemBonus, itemBonusCap + itemBonusCapIncrease));
        }
 public override int CalcValue(GameLiving living, eProperty property)
 {
     int chance = 0;
     if (living is GamePlayer)
     {
         if ((living as GamePlayer).CharacterClass.ClassType == eClassType.ListCaster)
             chance += 10;
     }
     chance += living.AbilityBonus[(int)property];
     return Math.Min(chance, 50);
 }
Exemple #23
0
        public override int CalcValue(GameLiving living, eProperty property)
        {
            int chance = 0;

            if ((living as GamePlayer)?.CharacterClass.ClassType == eClassType.ListCaster)
            {
                chance += 10;
            }

            chance += living.AbilityBonus[(int)property];
            return(Math.Min(chance, 50));
        }
        public override int CalcValue(GameLiving living, eProperty property)
        {
            //hardcap at 10%
            int itemPercent = Math.Min(10, living.ItemBonus[(int)property]);
            int debuffPercent = Math.Min(10, living.DebuffCategory[(int)property]);
            int percent = living.BaseBuffBonusCategory[(int)property] + living.SpecBuffBonusCategory[(int)property] + itemPercent - debuffPercent;

            // Apply RA bonus
            percent += living.AbilityBonus[(int)property];

            return percent;
        }
Exemple #25
0
        public override int CalcValue(GameLiving living, eProperty property)
        {
            // hardcap at 10%
            int itemPercent   = Math.Min(10, living.ItemBonus[(int)property]);
            int debuffPercent = Math.Min(10, living.DebuffCategory[(int)property]);
            int percent       = living.BaseBuffBonusCategory[(int)property] + living.SpecBuffBonusCategory[(int)property] + itemPercent - debuffPercent;

            // Apply RA bonus
            percent += living.AbilityBonus[(int)property];

            return(percent);
        }
		public override int CalcValue(GameLiving living, eProperty property) 
		{
			int debuff = living.DebuffCategory[(int)property];
			if(debuff > 0)
			{
				GameSpellEffect nsreduction = SpellHandler.FindEffectOnTarget(living, "NearsightReduction");
				if(nsreduction!=null) debuff *= (int)(1.00 - nsreduction.Spell.Value * 0.01);
			}
			int buff = CalcValueFromBuffs(living, property);
		    int item = CalcValueFromItems(living, property);
		    return Math.Max(0, 100 + (buff + item) - debuff);
		}
Exemple #27
0
        public override int CalcValue(GameLiving living, eProperty property)
        {
            int propertyIndex = (int)property;

            // Abilities/racials/debuffs.

            int debuff       = Math.Abs(living.DebuffCategory[propertyIndex]);
            int abilityBonus = living.AbilityBonus[propertyIndex];
            int racialBonus  = SkillBase.GetRaceResist(living.Race, (eResist)property);

            // Items and buffs.
            int itemBonus = CalcValueFromItems(living, property);
            int buffBonus = CalcValueFromBuffs(living, property);

            switch (property)
            {
            case eProperty.Resist_Body:
            case eProperty.Resist_Cold:
            case eProperty.Resist_Energy:
            case eProperty.Resist_Heat:
            case eProperty.Resist_Matter:
            case eProperty.Resist_Natural:
            case eProperty.Resist_Spirit:
                debuff       += Math.Abs(living.DebuffCategory[eProperty.MagicAbsorption]);
                abilityBonus += living.AbilityBonus[eProperty.MagicAbsorption];
                buffBonus    += living.BaseBuffBonusCategory[eProperty.MagicAbsorption];
                break;
            }

            if (living is GameNPC)
            {
                double constitutionPerMagicAbsorptionPercent = 8;
                var    constitutionBuffBonus           = living.BaseBuffBonusCategory[eProperty.Constitution] + living.SpecBuffBonusCategory[eProperty.Constitution];
                var    constitutionDebuffMalus         = Math.Abs(living.DebuffCategory[eProperty.Constitution] + living.SpecDebuffCategory[eProperty.Constitution]);
                var    magicAbsorptionFromConstitution = (int)((constitutionBuffBonus - constitutionDebuffMalus) / constitutionPerMagicAbsorptionPercent);
                buffBonus += magicAbsorptionFromConstitution;
            }

            buffBonus -= Math.Abs(debuff);

            // Apply debuffs. 100% Effectiveness for player buffs, but only 50%
            // effectiveness for item bonuses.
            if (living is GamePlayer && buffBonus < 0)
            {
                itemBonus += buffBonus / 2;
                buffBonus  = 0;
            }

            // Add up and apply hardcap.

            return(Math.Min(itemBonus + buffBonus + abilityBonus + racialBonus, HardCap));
        }
		public override int CalcValue(GameLiving living, eProperty property) 
		{
			int percent = 100
				-living.BaseBuffBonusCategory[(int)property] // buff reduce the duration
				+living.DebuffCategory[(int)property]
				-living.ItemBonus[(int)property]
				-living.AbilityBonus[(int)property];

			if (living.HasAbility(Abilities.Stoicism))
				percent -= 25;

			return Math.Max(1, percent);
		}
Exemple #29
0
		public override int CalcValue(GameLiving living, eProperty property)
		{
			if (living is GamePlayer)
			{
				GamePlayer player = living as GamePlayer;

				int endurance = player.DBMaxEndurance;
				endurance += (int)(endurance * (Math.Min(15, living.ItemBonus[(int)property]) * .01));
				return endurance;
			}

			return 100;
		}
        public override int CalcValue(GameLiving living, eProperty property)
        {
            if (living is GamePlayer)
            {
                GamePlayer player = living as GamePlayer;

                int endurance = player.DBMaxEndurance;
                endurance += (int)(endurance * (Math.Min(15, living.ItemBonus[(int)property]) * .01));
                return(endurance);
            }

            return(100);
        }
 /// <summary>
 /// Constructs a new calculator attribute for range of properties
 /// </summary>
 /// <param name="min">The lowest property in range</param>
 /// <param name="max">The highest property in range</param>
 public PropertyCalculatorAttribute(eProperty min, eProperty max)
 {
     if (min > max)
     {
         throw new ArgumentException("min property is higher than max (min=" + (int)min + " max=" + (int)max + ")");
     }
     if (min < 0 || max > eProperty.MaxProperty)
     {
         throw new ArgumentOutOfRangeException("max", (int)max, "property must be in 0 .. eProperty.MaxProperty range");
     }
     m_min = min;
     m_max = max;
 }
        public void SetBonus(string propertyName, InventoryItem item, GamePlayer player)
        {
            Console.WriteLine("1");
            eProperty prop = strToProperty(propertyName);

            if (prop == eProperty.MaxSpeed)
            {
                return;
            }
            Console.WriteLine("2");
            ItemUnique unique = new ItemUnique(item.Template);

            player.Inventory.RemoveItem(item);
            player.TempProperties.removeProperty(CRAFT_ITEM);

            int bonusVal = prop >= eProperty.Resist_First && prop <= eProperty.Resist_Last ? 5 : 20;

            if (unique.Bonus1Type == 0)
            {
                unique.Bonus1Type = (int)prop;
                unique.Bonus1     = 20;
            }
            else if (unique.Bonus2Type == 0)
            {
                unique.Bonus2Type = (int)prop;
                unique.Bonus2     = 20;
            }
            else if (unique.Bonus3Type == 0)
            {
                unique.Bonus3Type = (int)prop;
                unique.Bonus3     = 20;
            }
            else if (unique.Bonus4Type == 0)
            {
                unique.Bonus4Type = (int)prop;
                unique.Bonus4     = 20;
            }
            else if (unique.Bonus5Type == 0)
            {
                unique.Bonus5Type = (int)prop;
                unique.Bonus5     = 20;
            }
            Console.WriteLine("3");
            GameServer.Database.AddObject(unique);
            InventoryItem newInventoryItem = GameInventoryItem.Create <ItemUnique>(unique);

            player.Inventory.AddItem(eInventorySlot.FirstEmptyBackpack, newInventoryItem);
            SendReply(player, "I have now imbued your " + unique.Name + " with the power of " + propertyName + "!");
            player.Out.SendInventoryItemsUpdate(new InventoryItem[] { newInventoryItem });
        }
Exemple #33
0
 /// <summary>
 /// Method used to apply bonuses
 /// </summary>
 /// <param name="owner"></param>
 /// <param name="BonusCat"></param>
 /// <param name="Property"></param>
 /// <param name="Value"></param>
 /// <param name="IsSubstracted"></param>
 protected void ApplyBonus(GameLiving owner, eBuffBonusCategory BonusCat, eProperty Property, int Value, bool IsSubstracted)
 {
     if (Property != eProperty.Undefined)
     {
         var tblBonusCat = GetBonusCategory(owner, BonusCat);
         if (IsSubstracted)
         {
             tblBonusCat[(int)Property] -= Value;
         }
         else
         {
             tblBonusCat[(int)Property] += Value;
         }
     }
 }
Exemple #34
0
        public override int CalcValue(GameLiving living, eProperty property)
        {
            int percent = 100
                          - living.BaseBuffBonusCategory[(int)property]      // buff reduce the duration
                          + living.DebuffCategory[(int)property]
                          - living.ItemBonus[(int)property]
                          - living.AbilityBonus[(int)property];

            if (living.HasAbility(Abilities.Stoicism))
            {
                percent -= 25;
            }

            return(Math.Max(1, percent));
        }
        /// <summary>
        /// Constructs a new calculator attribute for range of properties
        /// </summary>
        /// <param name="min">The lowest property in range</param>
        /// <param name="max">The highest property in range</param>
        public PropertyCalculatorAttribute(eProperty min, eProperty max)
        {
            if (min > max)
            {
                throw new ArgumentException($"min property is higher than max (min={(int) min} max={(int) max})");
            }

            if (min < 0 || max > eProperty.MaxProperty)
            {
                throw new ArgumentOutOfRangeException(nameof(max), (int)max, "property must be in 0 .. eProperty.MaxProperty range");
            }

            Min = min;
            Max = max;
        }
		/// <summary>
		/// calculates the final property value
		/// </summary>
		/// <param name="living"></param>
		/// <param name="property"></param>
		/// <returns></returns>
		public override int CalcValue(GameLiving living, eProperty property)
		{
			int debuff = living.SpecBuffBonusCategory[(int)property];
			if (debuff < 0)
				debuff = -debuff;

			// buffs allow to regenerate endurance even in combat and while moving
			double regen =
				 living.BaseBuffBonusCategory[(int)property]
				+living.ItemBonus[(int)property];

			if (regen == 0 && living is GamePlayer) //&& ((GamePlayer)living).HasAbility(Abilities.Tireless))
				regen++;

			/*    Patch 1.87 - COMBAT AND REGENERATION CHANGES
    			- The bonus to regeneration while standing out of combat has been greatly increased. The amount of ticks 
				  a player receives while standing has been doubled and it will now match the bonus to regeneration while sitting.
 				  Players will no longer need to sit to regenerate faster.
			    - Fatigue now regenerates at the standing rate while moving.
			*/
			if (!living.InCombat)
			{
				if (living is GamePlayer)
				{
					if (!((GamePlayer)living).IsSprinting)
					{
						regen += 4;
					}
				}
			}
				

			regen -= debuff;

			if (regen < 0)
				regen = 0;

			if (regen != 0 && ServerProperties.Properties.ENDURANCE_REGEN_RATE != 1)
				regen *= ServerProperties.Properties.ENDURANCE_REGEN_RATE;

			double decimals = regen - (int)regen;
			if (Util.ChanceDouble(decimals))
			{
				regen += 1;	// compensate int rounding error
			}

			return (int)regen;
		}
        public override int CalcValue(GameLiving living, eProperty property)
        {
            GamePlayer player = living as GamePlayer;

            if (player != null)
            {
                int buff = player.BaseBuffBonusCategory[(int)property] * 10
                           + player.SpecBuffBonusCategory[(int)property] * 10
                           - player.DebuffCategory[(int)property] * 10
                           + player.BuffBonusCategory4[(int)property] * 10
                           + player.AbilityBonus[(int)property] * 10;
                int parrySpec = 0;
                if (player.HasSpecialization(Specs.Parry))
                {
                    parrySpec = (player.Dexterity * 2 - 100) / 4 + (player.GetModifiedSpecLevel(Specs.Parry) - 1) * (10 / 2) + 50;
                }
                if (parrySpec > 500)
                {
                    parrySpec = 500;
                }
                return(parrySpec + buff);
            }
            NecromancerPet pet = living as NecromancerPet;

            if (pet != null)
            {
                IControlledBrain brain = pet.Brain as IControlledBrain;
                if (brain != null)
                {
                    int buff = pet.BaseBuffBonusCategory[(int)property] * 10
                               + pet.SpecBuffBonusCategory[(int)property] * 10
                               - pet.DebuffCategory[(int)property] * 10
                               + pet.BuffBonusCategory4[(int)property] * 10
                               + pet.AbilityBonus[(int)property] * 10
                               + (pet.GetModified(eProperty.Dexterity) * 2 - 100) / 4
                               + pet.ParryChance * 10;
                    return(buff);
                }
            }
            GameNPC npc = living as GameNPC;

            if (npc != null)
            {
                return(npc.ParryChance * 10);
            }

            return(0);
        }
Exemple #38
0
 public override int CalcValueBase(GameLiving living, eProperty property)
 {
     int propertyIndex = (int)property;
     int debuff = living.DebuffCategory[propertyIndex];
     int racialBonus = (living is GamePlayer) ? SkillBase.GetRaceResist(((living as GamePlayer).Race), (eResist)property) : 0;
     int itemBonus = CalcValueFromItems(living, property);
     int buffBonus = CalcValueFromBuffs(living, property);
     buffBonus -= Math.Abs(debuff);
     if (buffBonus < 0)
     {
         itemBonus += buffBonus / 2;
         buffBonus = 0;
         if (itemBonus < 0) itemBonus = 0;
     }
     return Math.Min(itemBonus + buffBonus + racialBonus, HardCap);
 }
 public override int CalcValue(GameLiving living, eProperty property)
 {
     if (living is GamePlayer)
     {
         //				GamePlayer player = (GamePlayer)living;
         return living.Level + living.ItemBonus[(int)property] + living.BaseBuffBonusCategory[(int)property];
     }
     else if (living is GameNPC)
     {
         IControlledBrain brain = ((GameNPC)living).Brain as IControlledBrain;
         if (brain != null)
             return brain.Owner.Level + living.ItemBonus[(int)property] + living.BaseBuffBonusCategory[(int)property];
         return living.Level + living.ItemBonus[(int)property] + living.BaseBuffBonusCategory[(int)property];
     }
     return 0;
 }
Exemple #40
0
        public override int CalcValue(GameLiving living, eProperty property)
        {
            if (living is GamePlayer)
            {
                int af;

                // 1.5*1.25 spec line buff cap
                af = Math.Min((int)(living.Level * 1.875), living.SpecBuffBonusCategory[(int)property]);
                // debuff
                af -= living.DebuffCategory[(int)property];
                // TrialsOfAtlantis af bonus
                af += Math.Min(living.Level, living.ItemBonus[(int)property]);
                // uncapped category
                af += living.BuffBonusCategory4[(int)property];

                return(af);
            }
            else if (living is GameKeepDoor || living is GameKeepComponent)
            {
                GameKeepComponent component = null;
                if (living is GameKeepDoor)
                {
                    component = (living as GameKeepDoor).Component;
                }
                if (living is GameKeepComponent)
                {
                    component = living as GameKeepComponent;
                }

                int amount = component.AbstractKeep.BaseLevel;
                if (component.Keep is GameKeep)
                {
                    return(amount);
                }
                else
                {
                    return(amount / 2);
                }
            }
            else
            {
                return((int)((1 + (living.Level / 170.0)) * (living.Level << 1) * 4.67)
                       + living.SpecBuffBonusCategory[(int)property]
                       - living.DebuffCategory[(int)property]
                       + living.BuffBonusCategory4[(int)property]);
            }
        }
Exemple #41
0
        public override int GetModified(eProperty property)
        {
            switch (property)
            {
            case eProperty.LivingEffectiveLevel:
                return(modifiedEffectiveLevel);

            case eProperty.MaxHealth:
                return(0);

            case eProperty.Intelligence:
                return(Intelligence);

            default:
                throw new ArgumentException("There is no property with that name");
            }
        }
        public override int CalcValue(GameLiving living, eProperty property)
        {
            if (living is GamePlayer player)
            {
                int itemBonus  = player.ItemBonus[(int)property];
                int focusLevel = player.BaseBuffBonusCategory[(int)property];
                if (SkillBase.CheckPropertyType(property, ePropertyType.Focus) && player.CharacterClass.ClassType == eClassType.ListCaster)
                {
                    focusLevel += player.BaseBuffBonusCategory[(int)eProperty.AllFocusLevels];
                    itemBonus   = Math.Max(itemBonus, player.ItemBonus[(int)eProperty.AllFocusLevels]);
                }

                return(focusLevel + Math.Min(50, itemBonus));
            }

            return(0);
        }
        public override int CalcValue(GameLiving living, eProperty property)
        {
            int debuff = living.DebuffCategory[(int)property];

            if (debuff > 0)
            {
                GameSpellEffect nsreduction = SpellHandler.FindEffectOnTarget(living, "NearsightReduction");
                if (nsreduction != null)
                {
                    debuff *= (int)(1.00 - nsreduction.Spell.Value * 0.01);
                }
            }
            int buff = CalcValueFromBuffs(living, property);
            int item = CalcValueFromItems(living, property);

            return(Math.Max(0, 100 + (buff + item) - debuff));
        }
		public override int CalcValue(GameLiving living, eProperty property)
		{
			
			GamePlayer player = living as GamePlayer;
			if (player != null)
			{
				int buff = player.BaseBuffBonusCategory[(int)property] * 10
				+ player.SpecBuffBonusCategory[(int)property] * 10
				- player.DebuffCategory[(int)property] * 10
				+ player.BuffBonusCategory4[(int)property] * 10
				+ player.AbilityBonus[(int)property] * 10;
				int parrySpec = 0;
				if (player.HasSpecialization(Specs.Parry))
				{					
					parrySpec = (player.Dexterity * 2 - 100) / 4 + (player.GetModifiedSpecLevel(Specs.Parry) - 1) * (10 / 2) + 50;
				}
                if (parrySpec > 500)
                {
                    parrySpec = 500;
                }
				return parrySpec + buff;
			}
			NecromancerPet pet = living as NecromancerPet;
			if (pet != null)
			{
				IControlledBrain brain = pet.Brain as IControlledBrain;
				if (brain != null)
				{
					int buff = pet.BaseBuffBonusCategory[(int)property] * 10
					+ pet.SpecBuffBonusCategory[(int)property] * 10
					- pet.DebuffCategory[(int)property] * 10
					+ pet.BuffBonusCategory4[(int)property] * 10
					+ pet.AbilityBonus[(int)property] * 10
					+ (pet.GetModified(eProperty.Dexterity) * 2 - 100) / 4
					+ pet.ParryChance * 10;
					return buff;
				}
			}			
			GameNPC npc = living as GameNPC;
			if (npc != null)
			{
				return npc.ParryChance * 10;
			}

			return 0;
		}
        public override int GetModified(eProperty property)
        {
            switch (property)
            {
            case eProperty.LivingEffectiveLevel:
                return(modifiedEffectiveLevel);

            case eProperty.MaxHealth:
                return(0);

            case eProperty.Intelligence:
                return(Intelligence);

            default:
                return(base.GetModified(property));
            }
        }
Exemple #46
0
        public override int CalcValue(GameLiving living, eProperty property)
        {
            //hardcap at 25%
            int percent = Math.Min(25, living.BaseBuffBonusCategory[(int)property]
                - living.DebuffCategory[(int)property]
                + living.ItemBonus[(int)property]);
            // Add RA bonus
            percent += living.AbilityBonus[(int)property];

            // Relic bonus calculated before RA bonuses
			if (living is GamePlayer || living is GamePet)
			{
				percent += (int)(100 * RelicMgr.GetRelicBonusModifier(living.Realm, eRelicType.Magic));
			}

            return percent;
        }
        public override int CalcValue(GameLiving living, eProperty property)
        {
            /* PATCH 1.87 COMBAT AND REGENERATION
             * - While in combat, health and power regeneration ticks will happen twice as often.
             * - Each tick of health and power is now twice as effective.
             * - All health and power regeneration aids are now twice as effective.
             */

            double regen = 5 + (living.Level / 2.75);

            if (living is GameNPC && living.InCombat)
            {
                regen /= 2.0;
            }

            // tolakram - there is no difference per tic between combat and non combat

            if (regen != 0 && ServerProperties.Properties.MANA_REGEN_RATE != 1)
            {
                regen *= ServerProperties.Properties.MANA_REGEN_RATE;
            }

            double decimals = regen - (int)regen;

            if (Util.ChanceDouble(decimals))
            {
                regen += 1;                     // compensate int rounding error
            }

            int debuff = living.SpecBuffBonusCategory[(int)property];

            if (debuff < 0)
            {
                debuff = -debuff;
            }

            regen += living.BaseBuffBonusCategory[(int)property] + living.AbilityBonus[(int)property] + living.ItemBonus[(int)property] - debuff;

            if (regen < 1)
            {
                regen = 1;
            }

            return((int)regen);
        }
Exemple #48
0
        public override int CalcValue(GameLiving living, eProperty property)
        {
//			DOLConsole.WriteSystem("calc skill prop "+property+":");
            if (living is GamePlayer)
            {
                GamePlayer player = (GamePlayer)living;

                int itemCap = player.Level / 5 + 1;

                int itemBonus = player.ItemBonus[(int)property];

                if (SkillBase.CheckPropertyType(property, ePropertyType.SkillMeleeWeapon))
                {
                    itemBonus += player.ItemBonus[(int)eProperty.AllMeleeWeaponSkills];
                }
                if (SkillBase.CheckPropertyType(property, ePropertyType.SkillMagical))
                {
                    itemBonus += player.ItemBonus[(int)eProperty.AllMagicSkills];
                }
                if (SkillBase.CheckPropertyType(property, ePropertyType.SkillDualWield))
                {
                    itemBonus += player.ItemBonus[(int)eProperty.AllDualWieldingSkills];
                }
                if (SkillBase.CheckPropertyType(property, ePropertyType.SkillArchery))
                {
                    itemBonus += player.ItemBonus[(int)eProperty.AllArcherySkills];
                }

                itemBonus += player.ItemBonus[(int)eProperty.AllSkills];

                if (itemBonus > itemCap)
                {
                    itemBonus = itemCap;
                }
                int buffs = player.BaseBuffBonusCategory[(int)property];                 // one buff category just in case..

//				DOLConsole.WriteLine("item bonus="+itemBonus+"; buffs="+buffs+"; realm="+player.RealmLevel/10);
                return(itemBonus + buffs + player.RealmLevel / 10);
            }
            else
            {
                // TODO other living types
            }
            return(0);
        }
Exemple #49
0
        public override int CalcValue(GameLiving living, eProperty property)
        {
            if (living is GamePlayer player)
            {
                int shield  = (player.GetModifiedSpecLevel(Specs.Shields) - 1) * (10 / 2);
                int ability = player.AbilityBonus[(int)property] * 10;
                int chance  = 50 + shield + ((player.Dexterity * 2 - 100) / 4) + ability;

                return(chance);
            }

            if (living is GameNPC npc)
            {
                return(npc.BlockChance * 10);
            }

            return(0);
        }
        public override int CalcValue(GameLiving living, eProperty property)
        {
            // hardcap at 25%
            int percent = Math.Min(25, living.BaseBuffBonusCategory[(int)property]
                                   - living.DebuffCategory[(int)property]
                                   + living.ItemBonus[(int)property]);

            // Add RA bonus
            percent += living.AbilityBonus[(int)property];

            // Relic bonus calculated before RA bonuses
            if (living is GamePlayer || living is GamePet)
            {
                percent += (int)(100 * RelicMgr.GetRelicBonusModifier(living.Realm, eRelicType.Magic));
            }

            return(percent);
        }
Exemple #51
0
        public override int CalcValue(GameLiving living, eProperty property)
        {
            if (living is GameNPC)
            {
                int strengthPerMeleeDamagePercent = 8;
                var strengthBuffBonus             = living.BaseBuffBonusCategory[eProperty.Strength] + living.SpecBuffBonusCategory[eProperty.Strength];
                var strengthDebuffMalus           = living.DebuffCategory[eProperty.Strength] + living.SpecDebuffCategory[eProperty.Strength];
                return(living.AbilityBonus[property] + (strengthBuffBonus - strengthDebuffMalus) / strengthPerMeleeDamagePercent);
            }

            int hardCap      = 10;
            int abilityBonus = living.AbilityBonus[(int)property];
            int itemBonus    = Math.Min(hardCap, living.ItemBonus[(int)property]);
            int buffBonus    = living.BaseBuffBonusCategory[(int)property] + living.SpecBuffBonusCategory[(int)property];
            int debuffMalus  = Math.Min(hardCap, Math.Abs(living.DebuffCategory[(int)property]));

            return(abilityBonus + buffBonus + itemBonus - debuffMalus);
        }
        public override int CalcValue(GameLiving living, eProperty property)
        {
            if (living is GamePlayer)
            {
//				GamePlayer player = (GamePlayer)living;
                return(living.Level + living.ItemBonus[(int)property] + living.BaseBuffBonusCategory[(int)property]);
            }
            else if (living is GameNPC)
            {
                IControlledBrain brain = ((GameNPC)living).Brain as IControlledBrain;
                if (brain != null)
                {
                    return(brain.Owner.Level + living.ItemBonus[(int)property] + living.BaseBuffBonusCategory[(int)property]);
                }
                return(living.Level + living.ItemBonus[(int)property] + living.BaseBuffBonusCategory[(int)property]);
            }
            return(0);
        }
Exemple #53
0
        public override int GetModified(eProperty property)
        {
            switch (property)
            {
            case eProperty.Intelligence:
                return(modifiedIntelligence);

            case eProperty.SpellLevel:
                return(modifiedSpellLevel);

            case eProperty.ToHitBonus:
                return(modiefiedToHitBonus);

            case eProperty.LivingEffectiveLevel:
                return(modifiedEffectiveLevel);

            default: throw new ArgumentException("There is no property with that name");
            }
        }
		public override int CalcValue(GameLiving living, eProperty property)
		{
			int abs = Math.Min(living.BaseBuffBonusCategory[(int)property]
				- living.DebuffCategory[(int)property]
				+ living.ItemBonus[(int)property]
				+ living.AbilityBonus[(int)property], 50);

			if (living is GameNPC)
			{
				if (living.Level >= 30) abs += 27;
				else if (living.Level >= 20) abs += 19;
				else if (living.Level >= 10) abs += 10;

				abs += (living.GetModified(eProperty.Constitution)
					+ living.GetModified(eProperty.Dexterity) - 120) / 12;
			}

			return abs;
		}
		public override int CalcValue(GameLiving living, eProperty property)
		{
			// cap at living.level/5
			return Math.Min(Math.Max(1,living.Level/5),
				living.BaseBuffBonusCategory[(int)property]
				- living.DebuffCategory[(int)property]
				+ living.ItemBonus[(int)property]); 
			/*
			* 
			* Test Version 1.70v Release Notes June 1, 2004
			* NEW THINGS AND BUG FIXES
			* - Spell Piercing bonuses now correctly modify resistances downward instead of upward,
			* for direct damage spells, debuffs and damage over time spells.
			* A level 50 character can not have more than 10% Spell Piercing effect up at any one time 
			* (from items or spells); any Spell Piercing over 10% is ignored 
			* (previously Spell Piercing was "capped" at 25% for a level 50 character). 
			*/
			// http://www.camelotherald.com/more/1325.shtml
		}
        public override int CalcValue(GameLiving living, eProperty property)
        {
            if (living is GamePlayer player)
            {
                int itemCap = player.Level / 5 + 1;

                int itemBonus = player.ItemBonus[(int)property];

                if (SkillBase.CheckPropertyType(property, ePropertyType.SkillMeleeWeapon))
                {
                    itemBonus += player.ItemBonus[(int)eProperty.AllMeleeWeaponSkills];
                }

                if (SkillBase.CheckPropertyType(property, ePropertyType.SkillMagical))
                {
                    itemBonus += player.ItemBonus[(int)eProperty.AllMagicSkills];
                }

                if (SkillBase.CheckPropertyType(property, ePropertyType.SkillDualWield))
                {
                    itemBonus += player.ItemBonus[(int)eProperty.AllDualWieldingSkills];
                }

                if (SkillBase.CheckPropertyType(property, ePropertyType.SkillArchery))
                {
                    itemBonus += player.ItemBonus[(int)eProperty.AllArcherySkills];
                }

                itemBonus += player.ItemBonus[(int)eProperty.AllSkills];

                if (itemBonus > itemCap)
                {
                    itemBonus = itemCap;
                }

                int buffs = player.BaseBuffBonusCategory[(int)property]; // one buff category just in case..

                return(itemBonus + buffs + player.RealmLevel / 10);
            }

            return(0);
        }
		public override int CalcValue(GameLiving living, eProperty property)
		{
			int abs = Math.Min(living.BaseBuffBonusCategory[(int)property]
				- living.DebuffCategory[(int)property]
				+ living.ItemBonus[(int)property]
				+ living.AbilityBonus[(int)property], 50);


            bool bTest = false;
            if (living is GamePlayer)
            {
                GamePlayer player = (GamePlayer)living;
                if (player.TempProperties.getProperty<string>(GamePlayer.AFK_MESSAGE) == "test") bTest = true;
            }

            if (bTest)
            {
                GamePlayer player = (GamePlayer)living;
                player.Out.SendMessage("/// ArmorAbsorptionCalculator ///", eChatType.CT_System, eChatLoc.CL_SystemWindow);
                player.Out.SendMessage("living.BaseBuffBonusCategory[(int)property] : " + living.BaseBuffBonusCategory[(int)property], eChatType.CT_System, eChatLoc.CL_SystemWindow);
                player.Out.SendMessage("living.DebuffCategory[(int)property] : " + living.DebuffCategory[(int)property], eChatType.CT_System, eChatLoc.CL_SystemWindow);
                player.Out.SendMessage("living.ItemBonus[(int)property] : " + living.ItemBonus[(int)property], eChatType.CT_System, eChatLoc.CL_SystemWindow);
                player.Out.SendMessage("living.AbilityBonus[(int)property] : " + living.AbilityBonus[(int)property], eChatType.CT_System, eChatLoc.CL_SystemWindow);

                player.Out.SendMessage("int abs = Math.Min(living.BaseBuffBonusCategory[(int)property] - living.DebuffCategory[(int)property] + living.ItemBonus[(int)property] + living.AbilityBonus[(int)property], 50); : " + abs, eChatType.CT_System, eChatLoc.CL_SystemWindow);

                
            }


			if (living is GameNPC)
			{
				if (living.Level >= 30) abs += 27;
				else if (living.Level >= 20) abs += 19;
				else if (living.Level >= 10) abs += 10;

				abs += (living.GetModified(eProperty.Constitution)
					+ living.GetModified(eProperty.Dexterity) - 120) / 12;
			}

			return abs;
		}
 public override int CalcValue(GameLiving living, eProperty property)
 {
     if (living is GamePlayer)
     {
         int itemBonus = living.ItemBonus[(int)property];
         int focusLevel = living.BaseBuffBonusCategory[(int)property];
         if (SkillBase.CheckPropertyType(property, ePropertyType.Focus)
          && ((GamePlayer)living).CharacterClass.ClassType == eClassType.ListCaster)
         {
             focusLevel += living.BaseBuffBonusCategory[(int)eProperty.AllFocusLevels];
             itemBonus = Math.Max(itemBonus, living.ItemBonus[(int)eProperty.AllFocusLevels]);
         }
         return focusLevel + Math.Min(50, itemBonus);
     }
     else
     {
         // TODO other living types
     }
     return 0;
 }
        public override int CalcValueBase(GameLiving living, eProperty property)
        {
            int propertyIndex = (int)property;
            int debuff        = living.DebuffCategory[propertyIndex];
            int racialBonus   = (living is GamePlayer) ? SkillBase.GetRaceResist(((living as GamePlayer).Race), (eResist)property) : 0;
            int itemBonus     = CalcValueFromItems(living, property);
            int buffBonus     = CalcValueFromBuffs(living, property);

            buffBonus -= Math.Abs(debuff);
            if (buffBonus < 0)
            {
                itemBonus += buffBonus / 2;
                buffBonus  = 0;
                if (itemBonus < 0)
                {
                    itemBonus = 0;
                }
            }
            return(Math.Min(itemBonus + buffBonus + racialBonus, HardCap));
        }
        public override int CalcValue(GameLiving living, eProperty property)
        {
            int propertyIndex = (int)property;
            int debuff        = living.DebuffCategory[propertyIndex];
            int abilityBonus  = living.AbilityBonus[propertyIndex];
            int itemBonus     = CalcValueFromItems(living, property);
            int buffBonus     = CalcValueFromBuffs(living, property);

            buffBonus -= Math.Abs(debuff);
            if (buffBonus < 0)
            {
                itemBonus += buffBonus / 2;
                buffBonus  = 0;
                if (itemBonus < 0)
                {
                    itemBonus = 0;
                }
            }
            return(itemBonus + buffBonus + abilityBonus);
        }