/// <summary> /// Determines whether the attacking army is victorious in a battle /// </summary> /// <returns>bool indicating whether attacking army is victorious</returns> /// <param name="attackerValue">uint containing attacking army battle value</param> /// <param name="defenderValue">uint containing defending army battle value</param> public static bool DecideBattleVictory(uint attackerValue, uint defenderValue) { bool attackerVictorious = false; // calculate chance of victory double attackerVictoryChance = Battle.CalcVictoryChance(attackerValue, defenderValue); // generate random percentage int randomPercentage = Globals_Game.myRand.Next(101); // compare random percentage to attackerVictoryChance if (randomPercentage <= attackerVictoryChance) { attackerVictorious = true; } return(attackerVictorious); }