コード例 #1
0
 /// <summary>
 /// Create a new <see cref="WeaponAttackDetails"/>.
 /// </summary>
 /// <param name="target">
 /// What the attack affects.
 /// </param>
 /// <param name="attackBonus">
 /// The <see cref="Score"/> for the attack bonus. If the attack does not use an 
 /// attack roll, this can be null. This is added to Scores if not null.
 /// </param>
 /// <param name="damage">
 /// The power's base damage. If the attack does not deal damage, this can be null.
 /// </param>
 /// <param name="damageBonus">
 /// The <see cref="Score"/> for the damage bonus. If the attack does not deal damage,
 /// this can be null. This is added to Scores if not null.
 /// </param>
 /// <param name="attackedDefense">
 /// The defense attacked. If there is no attack roll, this value is ignored.
 /// </param>
 /// <param name="additionalScores">
 /// Additional scores used by the attack, usually for additional effects like 
 /// "pushes the target Wisdom modifier squares" or "an ally gains Charisma modifier temporary hit points".
 /// </param>
 /// <param name="additionalText">
 /// Additional details of the attack included immediately after the damage bonus. This supports "{0}"
 /// being the attack bonus (if specified), "{1}" the damage (if specified), "{2}" the damage bonus (if specified)
 /// and the values in <paramref name="additionalScores"/> with the first value starting at "{3}" (assuming
 /// attack bonus, damage and damage bonus were all specified).
 /// </param>
 /// <param name="missText">
 /// A description of the effect of the power on a miss or null, if the power does nothing on a miss. This 
 /// supports the same string substitution parameters as <paramref name="additionalText"/>.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// Either <paramref name="damage"/> and <paramref name="damageBonus"/> must be supplied or both must be null.
 /// <paramref name="additionalText"/> must also be specified. <paramref name="target"/> cannot be null.
 /// </exception>
 public WeaponAttackDetails(string target, Score attackBonus, PowerDamage damage, Score damageBonus,
     ScoreType attackedDefense, IList<ModifierSource> additionalScores, string additionalText, 
     string missText)
     : base(target, attackBonus, damage, damageBonus, attackedDefense, additionalScores, 
         additionalText, missText)
 {
     // Do nothing
 }
コード例 #2
0
        /// <summary>
        /// Create a new <see cref="AttackDetails"/>.
        /// </summary>
        /// <param name="target">
        /// What the attack affects.
        /// </param>
        /// <param name="attackBonus">
        /// The <see cref="Score"/> for the attack bonus. If the attack does not use an 
        /// attack roll, this can be null. This is added to Scores if not null.
        /// </param>
        /// <param name="damage">
        /// The power's base damage. If the attack does not deal damage, this can be null.
        /// </param>
        /// <param name="damageBonus">
        /// The <see cref="Score"/> for the damage bonus. If the attack does not deal damage,
        /// this can be null. This is added to Scores if not null.
        /// </param>
        /// <param name="attackedDefense">
        /// The defense attacked. If there is no attack roll, this value is ignored.
        /// </param>
        /// <param name="additionalScores">
        /// Additional scores used by the attack, usually for additional effects like 
        /// "pushes the target Wisdom modifier squares" or "an ally gains Charisma modifier temporary hit points".
        /// </param>
        /// <param name="additionalText">
        /// Additional details of the attack included immediately after the damage bonus. This supports "{0}"
        /// being the first score in <paramref name="additionalScores"/>, "{1}" being the second and so on.
        /// </param>
        /// <param name="missText">
        /// A description of the effect of the power on a miss or null, if the power does nothing on a miss. This 
        /// supports the same string substitution parameters as <paramref name="additionalText"/>.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Either <paramref name="damage"/> and <paramref name="damageBonus"/> must be supplied or both must be null.
        /// <paramref name="additionalText"/> must also be specified. <paramref name="target"/> cannot be null.
        /// </exception>
        public AttackDetails(string target, Score attackBonus, PowerDamage damage, Score damageBonus, ScoreType attackedDefense,
            IList<ModifierSource> additionalScores, string additionalText, string missText)
        {
            if (string.IsNullOrEmpty(target))
            {
                throw new ArgumentNullException("target");
            }
            if ((damage != null && damageBonus == null) || (damage != null && damageBonus == null))
            {
                throw new ArgumentNullException("damage",
                    "Either damage and damageBonus must be supplied or both must be null.");
            }
            if (additionalScores == null)
            {
                throw new ArgumentNullException("additionalScores");
            }
            if (additionalScores.Contains(null))
            {
                throw new ArgumentNullException("additionalScores", "One or more elements are null");
            }
            if (string.IsNullOrEmpty(additionalText))
            {
                throw new ArgumentNullException("additionalText");
            }

            this.attackBonus = attackBonus;
            this.attackedDefense = attackedDefense;
            this.damage = damage;
            this.damageBonus = damageBonus;
            this.additionalText = additionalText;
            this.missText = missText;
            this.modifierSources = new List<ModifierSource>();
            this.target = target;

            if (attackBonus != null)
            {
                AddModifierSource(attackBonus);
            }
            if (damage != null)
            {
                AddModifierSource(damage);
            }
            if (damageBonus != null)
            {
                AddModifierSource(damageBonus);
            }
            this.additionalScores = new List<ModifierSource>();
            this.additionalScores.AddRange(additionalScores);
            this.modifierSources.AddRange(additionalScores);
        }