Beispiel #1
0
 public bool PlayerAccuracyCalculation()
 {
     int attackRoll = RandomNumberGenerator.NumberBetween(0, 20) +
                  StatisticsCalculator.AbilityScoreCalculator(CurrentPlayer.Dexterity);
     
     
     //Perhaps checking that attackRoll is never greater than 30, else set it equal to 30
     if(attackRoll <=30)
     {
         if (attackRoll > CurrentMonster.ArmorClass)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     else
     {
         attackRoll = 30
         if (attackRoll > CurrentMonster.ArmorClass)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     
 }
Beispiel #2
0
 //I want to see if I can abstract this. PlayerAccuracyCalculation and MonsterAccuracyCalculation are 99% the same
 public bool MonsterAccuracyCalculation(//Maybe have this take a Player CurrentPlayer and Monster CurrentMonster object?)
 {
     int attackRoll = RandomNumberGenerator.NumberBetween(0, 20) +
                      StatisticsCalculator.AbilityScoreCalculator(CurrentPlayer.Dexterity);
     
     if (attackRoll > CurrentPlayer.ArmorClass //This is what I need to see if I can abstract)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Beispiel #3
0
        public void MonsterAttackDamageCalculation()
        {
            int damageDealtToPlayer = RandomNumberGenerator.NumberBetween
                                          (CurrentMonster.MinimumDamage, CurrentMonster.MaximumDamage) +
                                      StatisticsCalculator.AbilityScoreCalculator(CurrentMonster.Strength);
            MonsterAttackSuccessNotification(damageDealtToPlayer);

            CurrentPlayer.TakeDamage(damageDealtToPlayer);

            if (CurrentPlayer.IsDead)
            {
                CurrentLocation = CurrentWorld.LocationAt(0, -1);
                CurrentPlayer.CompletelyHeal();
            }
        }
Beispiel #4
0
        //I want to modify this function such that Weapon damage is doubled when the d20 roll is a 20
        //I probably need to make a local variable in PlayerAccuracyCalculations to hold the roll, then call it here. 
        //Then, I'd make a check for whether or not it was a nat20
        public void PlayerAttackDamageCalculation()
        {

            int damageDealtToMonster = RandomNumberGenerator.NumberBetween(CurrentWeapon.MinimumDamage, CurrentWeapon.MaximumDamage) 
                                       + StatisticsCalculator.AbilityScoreCalculator(CurrentPlayer.Strength);
            PlayerAttackSuccessNotification(damageDealtToMonster);

            CurrentMonster.TakeDamage(damageDealtToMonster);

            if (CurrentMonster.IsDead)
            {

                CurrentPlayer.AddExperience(CurrentMonster.RewardExperiencePoints);
                CurrentPlayer.ReceiveGold(CurrentMonster.Gold);
                foreach (GameItem gameItem in CurrentMonster.Inventory)
                {
                    CurrentPlayer.AddItemToInventory(gameItem);
                }

                GetMonsterAtLocation();
                return;
            }
            else //Monster's Turn
            {
                MonsterAccuracyCalculation();
                if (MonsterAccuracyCalculation())
                {
                    MonsterAttackDamageCalculation();
                }
                else
                {
                    MonsterAttackFailureNotification();
                }

            }
        }