using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 技术折腾
{
class Program
{
static void Main(string[] args)
{
Pat p = new Pat();
bool result = true;
while (result)
{
Console.WriteLine("请选择:1.聊天 2.喂东西 3.运动 4.退出");
Console.WriteLine("Health:{0} fullLevel:{1} ", p.Health, p.FullLevel);
switch (Console.ReadLine())
{
case "1":
p.Chat();
break;
case "2":
p.Eat();
break;
case "3":
p.Play();
break;
case "4":
Console.WriteLine("按任意键退出程序......");
Console.ReadKey();
result = false;
break;
default:
Console.WriteLine("输入错误 !请重新输入!");
break;
}
}
}
}
class Pat
{
private int health=20;
public int Health
{
set { value = health; }
get { return health; }
}
private int amount = 0;
public int Amount
{
get { return amount; }
set { amount = value; }
}
private int fullLevel = 20;
public int FullLevel
{
set { value = fullLevel; }
get { return fullLevel; }
}
public void Eat()
{
if (fullLevel > -1&health>0)
{
Console.WriteLine("请输入要喂的数量");
amount = Convert.ToInt32(Console.ReadLine());
if (amount > 3)
{
fullLevel = -1;
Console.WriteLine("吃的太多了,撑死了!");
}
else if (amount < 0)
{
Console.WriteLine("你是上帝派来玩我的吧!");
}
else
{
fullLevel = fullLevel + amount;
health = health - 2;
}
}
else
{
Console.WriteLine("本猫已死,有事烧纸!");
}
}
public void Play()
{
if (fullLevel < -1||health<0)
{
Console.WriteLine("本猫已死,有事烧纸!");
}
else
{
health = health + 5;
fullLevel = fullLevel - 2;
}
}
public void Chat()
{
if (this.fullLevel >= 0&health>-1)
{
fullLevel = fullLevel - 2;
health = health + 2;
Console.WriteLine("想聊点什么?都是你消费!");
string str=Console.ReadLine();
if (str.Contains("你妹") || str.Contains("你妈"))
{
Console.WriteLine("请文明用语!");
}
else
{
fullLevel = fullLevel - 2;
health = health + 1;
Console.WriteLine("我叫小手手!非常高兴认识你!");
}
}
else
{
if (fullLevel > -1)
{
Console.WriteLine("我饿了,想吃东西了!");
}
else
{
Console.WriteLine("本猫已死,有事烧纸!");
}
}
}
}
}