Esempio n. 1
0
 public BattleStatistics(BaseCharacter character, BaseCharacter enemy)
 {
     Character             = character;
     enemyAC               = enemy.ArmorClass;
     ExpectedAccuracy      = Math.Min(Math.Max((21 - (enemyAC - (character.AttackRoll(rollMax: true) - 20))) / 20.0, 0.05), 0.95);
     ExpectedAverageDamage = enemy.ReceiveDamage(character.DamageRoll(rollMax: true) - character.Weapon.DamageDie(true) + DiceRoller.averageRoll[character.Weapon.DamageDie], character.Weapon.DamageType, justKidding: true);
 }
Esempio n. 2
0
 public Attack(BattleStatistics attackerStats, BaseCharacter defender, bool?advantage)
 {
     this.attacker         = attackerStats.Character;
     this.defender         = defender;
     this.advantage        = advantage;
     defenderArmorClass    = defender.ArmorClass;
     defenderInitialHealth = defender.CurHitPoints;
     attackRoll            = attacker.AttackRoll(advantage: advantage);
     criticalHit           = attackRoll == Int32.MaxValue;
     criticalMiss          = attackRoll == Int32.MinValue;
     hit = (criticalHit || attackRoll >= defenderArmorClass) && !criticalMiss;
     if (hit)
     {
         damageRoll  = attacker.DamageRoll(critical: criticalHit);
         damageDealt = defender.ReceiveDamage(damageRoll);
     }
     attackerStats.ReportAttackResults(hit, criticalHit, criticalMiss, damageDealt);
     ToString();
 }