コード例 #1
0
ファイル: Mine.cs プロジェクト: mr-kevbot/capitalism
        private void CheckForInjury(Player player, ActionResults workResults)
        {
            var injuryRoll = new Random().Next(1, 100);

            // 1% chance of major injury
            if (injuryRoll <= 1)
            {
                player.ReduceHealth(20);
                workResults.AddResult(ActionResult.Warning("You suffered a major injury in the mines."));
            }
            // 4% chance of minor injury
            else if (injuryRoll <= 5)
            {
                player.ReduceHealth(5);
                workResults.AddResult(ActionResult.Warning("You suffered a minor injury in the mines."));
            }
            // 95% chance of no injury
            else
            {
            }
        }