Beispiel #1
0
 protected override void DeleteItem(Models.Attack child)
 {
     if (child.Parent is CombatTable.Models.Stance)
     {
         (child.Parent as CombatTable.Models.Stance).Properties.Remove(child);
     }
 }
Beispiel #2
0
        private void AddAction(Models.Attack attack, Models.Creature creature)
        {
            var detailsBuilder = new StringBuilder();

            var attackModifier = creature.Statistics.First(s => s.Ability == attack.AttackRollAbility).Modifier + creature.ProficiencyBonus;

            detailsBuilder.Append($"{attackModifier.GetDisplayForAbility()} to hit, ");
            detailsBuilder.Append($"reach {attack.Reach}ft., ");
            detailsBuilder.Append($"one target. ");

            detailsBuilder.Append("Hit: ");

            var damageRollDisplays = new List <string>();

            foreach (var damageRoll in attack.DamageRolls)
            {
                var damageModifier = creature.Statistics.FirstOrDefault(s => s.Ability == damageRoll.AbilityModifier)?.Modifier ?? 0;
                if (damageModifier != 0)
                {
                    damageRollDisplays.Add($"{damageRoll.ToAverageDamage() + damageModifier} ({damageRoll.DamageDieCount}{damageRoll.DamageDie.GetDisplayName()} + {damageModifier}) {damageRoll.DamageType.ToString().ToLowerInvariant()} damage");
                }
                else
                {
                    damageRollDisplays.Add($"{damageRoll.ToAverageDamage()} ({damageRoll.DamageDieCount}{damageRoll.DamageDie.GetDisplayName()}) {damageRoll.DamageType.ToString().ToLowerInvariant()} damage");
                }
            }

            detailsBuilder.Append(String.Join(", plus ", damageRollDisplays));

            var creatureAttack = new Action(attack.Name, attack.AttackType.GetDisplayName(), detailsBuilder.ToString());

            this.Actions.Add(creatureAttack);
        }
Beispiel #3
0
 protected override void AddNewItem(Models.Attack parent)
 {
     parent.NewDamage("Damage " + parent.Properties.Count);
 }