Contains information about the source action part of the CombatActionPack. This part is sent first, before the target actions.
Inheritance: CombatAction
Example #1
0
        /// <summary>
        /// Checks if target has Defense skill activated and makes the necessary
        /// changes to the actions, stun times, and damage.
        /// </summary>
        /// <param name="aAction"></param>
        /// <param name="tAction"></param>
        /// <param name="damage"></param>
        /// <returns></returns>
        public static bool HandleDefense(AttackerAction aAction, TargetAction tAction, ref float damage)
        {
            // Defense
            if (!tAction.Creature.Skills.IsActive(SkillId.Defense))
            {
                return(false);
            }

            // Update actions
            tAction.Type          = CombatActionType.Defended;
            tAction.SkillId       = SkillId.Defense;
            tAction.Creature.Stun = tAction.Stun = DefenseTargetStun;
            aAction.Creature.Stun = aAction.Stun = DefenseAttackerStun;

            // Reduce damage
            var defenseSkill = tAction.Creature.Skills.Get(SkillId.Defense);

            if (defenseSkill != null)
            {
                damage -= defenseSkill.RankData.Var3;
            }

            Send.SkillUseStun(tAction.Creature, SkillId.Defense, 1000, 0);

            return(true);
        }
Example #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;
		}
Example #3
0
		/// <summary>
		/// Called when the AI hit someone with a skill.
		/// </summary>
		/// <param name="aAction"></param>
		public void OnUsedSkill(AttackerAction aAction)
		{
			if (this.Creature.Skills.ActiveSkill != null)
				this.ExecuteOnce(this.CompleteSkill());
		}