Set() public method

Enables option(s)
public Set ( TargetOptions option ) : void
option TargetOptions
return void
Exemplo n.º 1
0
        /// <summary>
        /// Checks if attacker has Critical Hit and applies crit bonus
        /// by chance. Also sets the target action's critical option if a
        /// crit happens.
        /// </summary>
        /// <param name="attacker"></param>
        /// <param name="critChance"></param>
        /// <param name="damage"></param>
        /// <param name="tAction"></param>
        public static void HandleCritical(Creature attacker, float critChance, ref float damage, TargetAction tAction)
        {
            // Check if attacker actually has critical hit
            var critSkill = attacker.Skills.Get(SkillId.CriticalHit);

            if (critSkill == null)
            {
                return;
            }

            // Does the crit happen?
            if (RandomProvider.Get().NextDouble() > critChance)
            {
                return;
            }

            // Add crit bonus
            var bonus = critSkill.RankData.Var1 / 100f;

            damage = damage + (damage * bonus);

            // Set target option
            tAction.Set(TargetOptions.Critical);
        }
Exemplo n.º 2
0
		/// <summary>
		/// Calculates and sets splash damage reductions and bonuses against splashTarget.
		/// </summary>
		/// <param name="splashTarget"></param>
		/// <param name="damageSplash"></param>
		/// <param name="skill"></param>
		/// <param name="critSkill"></param>
		/// <param name="aAction"></param>
		/// <param name="tAction"></param>
		/// <param name="tSplashAction"></param>
		public void CalculateSplashDamage(Creature splashTarget, ref float damageSplash, Skill skill, Skill critSkill, AttackerAction aAction, TargetAction tAction, TargetAction tSplashAction, Item weapon = null)
		{
			//Splash Damage Reduction
			if (skill.Info.Id == SkillId.Smash)
				damageSplash *= skill.Info.Rank < SkillRank.R1 ? 0.1f : 0.2f;
			else
				damageSplash *= weapon != null ? weapon.Data.SplashDamage : 0f;

			// Critical Hit
			if (critSkill != null && tAction.Has(TargetOptions.Critical))
			{
				// Add crit bonus
				var bonus = critSkill.RankData.Var1 / 100f;
				damageSplash = damageSplash + (damageSplash * bonus);

				// Set splashTarget option
				tSplashAction.Set(TargetOptions.Critical);
			}

			var maxDamageSplash = damageSplash; //Damage without Defense and Protection
			// Subtract splashTarget def/prot
			SkillHelper.HandleDefenseProtection(splashTarget, ref damageSplash);

			// Defense
			Channel.Skills.Combat.Defense.Handle(aAction, tSplashAction, ref damageSplash);

			// Mana Shield
			ManaShield.Handle(splashTarget, ref damageSplash, tSplashAction, maxDamageSplash);

			if (damageSplash <= 0f)
				damageSplash = 1f;
		}