首页 > 代码库 > 聊天机器人改写版

聊天机器人改写版

/*改写的聊天机器人之华山论剑,写着玩儿的,还很粗劣,有待完善*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class sword
    {
        static void Main(string[] args)
        {
            int fullBlood = 10;
            while (true)
            {
                Console.WriteLine("华山论剑,出招吧!");
                if (fullBlood < 0)
                {
                    Console.WriteLine("我挂了···");
                    return;
                }
                if(fullBlood == 0)
                {
                    Console.WriteLine("我。。。要挂了~,给补个桃吧");
                    string strTao = Console.ReadLine();
                    int tao = Convert.ToInt32(strTao);//输入一旦不是数字,程序就会出错!!
                    if (tao == 0)
                    {
                        Console.WriteLine("你丫逗我吧!死了。。。");
                        return;
                    }
                    if (tao < 0)
                    {
                        Console.WriteLine("居然补刀!!!我做鬼也不会放过你的!");
                        return;
                    }
                    if (tao > 10)
                    {
                        Console.WriteLine("我满血复活啦!阁下大恩大德,没齿难忘!");
                        fullBlood = 10; //血量不能超过10,超过10置为10.
                    }
                    fullBlood += tao;
                    Console.WriteLine("及时补血!       =======血量:{0}",fullBlood);
                    continue;
                }
                string mySkill = Console.ReadLine();
                if (mySkill == "降龙十八掌")
                {
                    fullBlood -= 3;
                    Console.WriteLine("啊,掉血!-3     =======血量:{0}",fullBlood);
                }
                else if (mySkill == "九阴白骨爪")
                {
                    fullBlood -= 1;
                    Console.WriteLine("啊,掉血!-1     =======血量:{0}",fullBlood);
                }
                else if (mySkill == "一阳指")
                {
                    fullBlood -= 2;
                    Console.WriteLine("啊,掉血!-2     =======血量:{0}", fullBlood);
                }
                else if (mySkill == "蛤蟆功")
                {
                    fullBlood -= 3;
                    Console.WriteLine("啊,掉血!-3     =======血量:{0}", fullBlood);
                }
                else
                {
                    Console.WriteLine("出招啊,你妹的!");
                }
            }
            Console.ReadKey();
         }
        
    }
}