本文整理汇总了C#中Monster.PrintStats方法的典型用法代码示例。如果您正苦于以下问题:C# Monster.PrintStats方法的具体用法?C# Monster.PrintStats怎么用?C# Monster.PrintStats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monster
的用法示例。
在下文中一共展示了Monster.PrintStats方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CombatPrompt
static ConsoleKeyInfo CombatPrompt(Character player, Monster enemy)
{
ConsoleKeyInfo playerPress = new ConsoleKeyInfo();
Console.Clear();
promptAction:
player.PrintStats();
enemy.PrintStats();
Console.WriteLine("What would you like to do?");
Console.WriteLine("\n Blunt Force Attack - A" +
"\n Piercing Attack - 1MP- S" +
"\n Obliterate -4MP - D" +
"\n Flee -1 Progress - F" +
"\n Instant Kill - G" +
"\n Heal Yourself - H");
playerPress = Console.ReadKey(true);
string playerPressString = playerPress.Key.ToString();
playerPressString = playerPressString.ToLower();
switch(playerPressString)
{
case"a":
case"s":
case"d":
case"f":
case"g":
case"h":
break;
default:
Console.Clear();
WriteRed("Please press the correct key.\n");
Console.ReadKey(true);
goto promptAction;
}
return playerPress;
}
示例2: CreateMonster
// The CreateMonster method accepts a scenario from 1-3, then generates a monster with stats.
// The method will also give a brief description to player before combat starts.
static void CreateMonster(Character player, int scenario, ref Monster enemy)
{
long progress = player.progress;
enemy.hp = progress * 15 + 20;
enemy.atk = progress / 2 + 2;
enemy.def = progress / 2 + 2;
enemy.bossMonster = false;
if(scenario == 1)
{
enemy.hp += progress * 0.5;
enemy.def += progress * 0.5;
Console.WriteLine("As you progress, the growls tell you that you are in claimed land...");
}
else if (scenario == 2)
{
enemy.atk += progress;
Console.WriteLine("You hear the roar of an angry beast...");
}
else if (scenario == 3)
{
enemy.hp = enemy.hp / 2;
enemy.atk = enemy.atk / 2;
enemy.def = enemy.def / 2;
Console.WriteLine("The creature in front of you cowers in fear, but won't let you progress.");
}
else if (scenario == 4)
{
enemy.hp = enemy.hp * 3;
enemy.atk = enemy.atk * 2;
enemy.def = enemy.def * 1.5;
enemy.bossMonster = true;
Random rng = new Random();
int rngInt = rng.Next(1,4);
if(rngInt == 1)
{
Console.WriteLine("You feel the air get heavy around you.");
Console.ReadKey(true);
Console.WriteLine("You turn.");
Console.ReadKey(true);
Console.WriteLine("You see a massive shadow.");
Console.ReadKey(true);
Console.WriteLine("In front of you, is the largest rat you've ever seen.");
}
if(rngInt == 2)
{
Console.WriteLine("You feel a strong gust of wind.");
Console.ReadKey(true);
Console.WriteLine("You turn.");
Console.ReadKey(true);
Console.WriteLine("You see a massive shadow.");
Console.ReadKey(true);
Console.WriteLine("In front of you, is the largest bird you've ever seen.");
}
if(rngInt == 3)
{
Console.WriteLine("You hear the voice of a another person.");
Console.ReadKey(true);
Console.WriteLine("No other human has come here in over a thousand years.");
Console.ReadKey(true);
Console.WriteLine("You turn.");
Console.ReadKey(true);
Console.WriteLine("In front of you, is the first human you've seen for a while now.");
}
}
enemy.PrintStats();
Console.ReadKey(true);
Console.Clear();
}