火影忍者多人对战

namespace 火影忍者多人对战
{
    class Program
    {   //创建一个Player的结构体
        struct Player
        {
            public string name;
            public int hp;
            public int attack;
            public int defend;
            public int grade;
            public JiNeng jineng;
        }
        //创建一个JiNeng属于Player的子结构体
        struct JiNeng
        {
            public string q;
            public string w;
            public string e;
            public string r;
        }
        static void Main(string[] args)
        {
            Console.WriteLine("\t\t**************火影忍者大乱斗*************");
            Console.WriteLine("可使用的英雄主要有:(1)日向宁次(2)漩涡鸣人(3)宇智波鼬(4)六道佩恩(5)纲手");
            Player wanjia1 = new Player();
            Player wanjia2 = new Player();
            Random r = new Random();
            wanjia1.hp = r.Next(500, 700) + 10000;
            wanjia2.hp = r.Next(500, 700) + 10000;
            wanjia1.attack = r.Next(100, 200) + 200;
            wanjia2.attack = r.Next(100, 200) + 200;
            wanjia1.defend = r.Next(50, 100) + 50;
            wanjia2.defend = r.Next(50, 100) + 50;
            wanjia1.grade = r.Next(1, 18);
            wanjia2.grade = r.Next(1, 18);
   
            Console.WriteLine("请第一个玩家选择您想要使用的英雄:");
            int a = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("请第二个玩家选择您想要使用的英雄:");
            int b = Convert.ToInt32(Console.ReadLine());
            if (a == 1)
            {
                wanjia1.name = "日向宁次";

wanjia1.jineng.q = "八卦空掌";
                wanjia1.jineng.w = "八卦掌·回天";
                wanjia1.jineng.e = "白眼";
                wanjia1.jineng.r = "八卦六十四掌";
            }
            else if (a == 2)
            {
                wanjia1.name = "漩涡鸣人";
                wanjia1.jineng.q = "大玉螺旋丸";
                wanjia1.jineng.w = "多重影分身术";
                wanjia1.jineng.e = "漩涡鸣人2000连弹";
                wanjia1.jineng.r = "仙法·风遁螺旋手里剑";
            }
            else if (a == 3)
            {
                wanjia1.name = "宇智波鼬";
                wanjia1.jineng.q = "幻术·泡沫";
                wanjia1.jineng.w = "幻术·月渎";
                wanjia1.jineng.e = "万花筒写轮眼";
                wanjia1.jineng.r = "瞳术·天照";
            }
            else if (a == 4)
            {
                wanjia1.name = "六道佩恩";
                wanjia1.jineng.q = "万象天引";
                wanjia1.jineng.w = "神罗天征";
                wanjia1.jineng.e = "轮回眼";
                wanjia1.jineng.r = "地爆天星";
            }
            else if (a == 5)
            {
                wanjia1.name = "纲手";
                wanjia1.jineng.q = "治疗术";
                wanjia1.jineng.w = "崩拳";
                wanjia1.jineng.e = "怪力攻击";
                wanjia1.jineng.r = "忍法·再生";
            }
            else
            {
                Console.WriteLine("请输入正确的选项");
            }
            if (b == 1)
            {
                wanjia2.name = "日向宁次";
                wanjia2.jineng.q = "八卦空掌";
                wanjia2.jineng.w = "八卦掌·回天";
                wanjia2.jineng.e = "白眼";
                wanjia2.jineng.r = "八卦六十四掌";
            }
            else if (b == 2)
            {
                wanjia2.name = "漩涡鸣人";
                wanjia2.jineng.q = "大玉螺旋丸";
                wanjia2.jineng.w = "多重影分身术";
                wanjia2.jineng.e = "漩涡鸣人2000连弹";
                wanjia2.jineng.r = "仙法·风遁螺旋手里剑";
            }
            else if (b == 3)
            {
                wanjia2.name = "宇智波鼬";
                wanjia2.jineng.q = "幻术·泡沫";
                wanjia2.jineng.w = "幻术·月渎";
                wanjia2.jineng.e = "万花筒写轮眼";
                wanjia2.jineng.r = "瞳术·天照";
            }
            else if (b == 4)
            {
                wanjia2.name = "六道佩恩";
                wanjia2.jineng.q = "万象天引";
                wanjia2.jineng.w = "神罗天征";
                wanjia2.jineng.e = "轮回眼";
                wanjia2.jineng.r = "地爆天星";
            }
            else if (b == 5)
            {
                wanjia2.name = "纲手";
                wanjia2.jineng.q = "治疗术";
                wanjia2.jineng.w = "崩拳";
                wanjia2.jineng.e = "怪力攻击";
                wanjia2.jineng.r = "忍法·再生";
            }
            else
            {
                Console.WriteLine("请输入正确的选项");
            }

Console.WriteLine("第一个玩家的名字:"+wanjia1.name+"\t生命值:"+wanjia1.hp+"\t攻击力:"+wanjia1.attack+"\t防御力:"+wanjia1.defend+"\t等级:"+wanjia1.grade);
            Console.WriteLine("所使用的技能:" + wanjia1.jineng.q+"\t"+wanjia1.jineng.w+"\t"+wanjia1.jineng.e+"\t"+wanjia1.jineng.r);
            Console.WriteLine("第二个玩家的名字:" + wanjia2.name + "\t生命值:" + wanjia2.hp + "\t攻击力:" + wanjia2.attack + "\t防御力:" + wanjia2.defend + "\t等级:" + wanjia2.grade);
            Console.WriteLine("所使用的技能:" + wanjia2.jineng.q + "\t" + wanjia2.jineng.w + "\t" + wanjia2.jineng.e + "\t" + wanjia2.jineng.r);
            Console.WriteLine("按任意键开始游戏");
            Console.ReadKey();

//下面开始进行对战
            while (true)
         {

//跳出循环的条件
            if(wanjia1.hp<=0&&wanjia2.hp<=0)
            {
                Console.WriteLine("平局");
                break;
            }
            if (wanjia1.hp <= 0)
            {
                Console.WriteLine(wanjia2.name+"把"+wanjia1.name+"打败。");
                break;
            }
            if (wanjia2.hp <= 0)
            {
                Console.WriteLine(wanjia1.name + "把" + wanjia2.name + "打败。");
                break;
            }
          
            if (wanjia2.hp < 0)
            {
                wanjia2.hp = 0;
            }
                //玩家1打玩家2
                Random m=new Random();

if(m.Next(10)>7)
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine(wanjia1.name+"使用超大技能"+wanjia1.jineng.r);
                    wanjia2.hp = wanjia2.hp + wanjia2.defend - wanjia1.attack- m.Next(500, 1000) ;
                    Console.ForegroundColor = ConsoleColor.Red;
                }
                else if(m.Next(10)>5&&m.Next(10)<=7)
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine(wanjia1.name + "使用大技能" + wanjia1.jineng.e);
                    wanjia2.hp = wanjia2.hp + wanjia2.defend - wanjia1.attack - m.Next(300, 500);
                    Console.ForegroundColor = ConsoleColor.Red;
                }
                else if(m.Next(10)>3&&m.Next(10)<=5)
                {
                    Console.ForegroundColor = ConsoleColor.DarkYellow;
                    Console.WriteLine(wanjia1.name + "使用无敌技能" + wanjia1.jineng.w);
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(wanjia1.name + "剩余的气血为" + wanjia1.hp);
                }
                else if (m.Next(10) <= 3)
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine(wanjia1.name + "使用超小技能" + wanjia1.jineng.q);
                    wanjia2.hp = wanjia2.hp + wanjia2.defend - wanjia1.attack - m.Next(100, 200);
                    Console.ForegroundColor = ConsoleColor.Red;
                }
                else
                {   
                    Console.WriteLine(wanjia1.name + "使用普通攻击");
                    wanjia2.hp = wanjia2.hp + wanjia2.defend - wanjia1.attack;
                    Console.ForegroundColor = ConsoleColor.Red;
                }
                if (wanjia2.hp < 0)
                {
                    wanjia2.hp = 0;
                }
                Console.WriteLine(wanjia2.name + "剩余的气血为" + wanjia2.hp);

//玩家2打玩家1

if (m.Next(10) > 7)
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine(wanjia2.name + "使用超大技能" + wanjia2.jineng.r);
                    wanjia1.hp = wanjia1.hp + wanjia1.defend - wanjia2.attack - m.Next(500, 1000);
                    Console.ForegroundColor = ConsoleColor.Red;
                }
                else if (m.Next(10) > 5 && m.Next(10) <= 7)
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine(wanjia2.name + "使用大技能" + wanjia2.jineng.e);
                    wanjia1.hp = wanjia1.hp + wanjia1.defend - wanjia2.attack - m.Next(300, 500);
                    Console.ForegroundColor = ConsoleColor.Red;
                }
                else if (m.Next(10) > 3 && m.Next(10) <= 5)
                {
                    Console.ForegroundColor = ConsoleColor.DarkYellow;
                    Console.WriteLine(wanjia2.name + "使用无敌技能" + wanjia2.jineng.w);
                   
                    Console.ForegroundColor = ConsoleColor.Red;
                }
                else if (m.Next(10) <= 3)
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine(wanjia2.name + "使用超小技能" + wanjia2.jineng.q);
                    wanjia1.hp = wanjia1.hp + wanjia1.defend - wanjia2.attack - m.Next(100, 200);
                    Console.ForegroundColor = ConsoleColor.Red;  
                }
                else
                {
                    Console.WriteLine(wanjia2.name + "使用普通攻击");
                    wanjia1.hp = wanjia1.hp + wanjia1.defend - wanjia2.attack;
                    Console.ForegroundColor = ConsoleColor.Red;
                }
                if (wanjia1.hp < 0)
                {
                    wanjia1.hp = 0;
                }
                Console.WriteLine(wanjia1.name + "剩余的气血为" + wanjia1.hp);
                Thread.Sleep(500);
             
            } //while的花括号
            Console.ReadLine();
        }
    }
}

时间: 2024-10-17 23:11:29

火影忍者多人对战的相关文章

小游戏●两人对战

利用结构体编写的两人对战小游戏,代码及简要分析如下 1 public struct Fighter 2 { 3 public string name; 4 public int blood; 5 public int attack; 6 public int defense; 7 public int hit; 8 public int hide; 9 } 10 11 12 static void Main(string[] arge) 13 { 14 15 //定义一组对手 16 Fighte

局域网多人对战飞行棋的实现

在项目之间有段“空项期”,上个项目刚刚完成,下个项目还没落实,时间比较充裕.去年9月份就经历了这么一次短暂的“空项期”,那时偶还是一名前端工作者,C#使用起来毫不含糊,还自己整过一个类SCSF的MVP框架AngelFrame(详见之前博客:http://www.cnblogs.com/wgp13x/p/99c2adc52d8f0dff30a038841ac32872.html).在那段“空项期”之前,有位朋友托我做个小游戏,偶也满口的答应,只可惜之前项目太忙没时间做,就一直耽搁了,正好有这段“空

多人对战游戏观察者模式分析

一.观察者模式 观察者模式是使用频率最高的设计模式之一,它用于建立一种对象与对象之间的依赖关系,一个对象发生改变时将自动通知其他对象,其他对象将相应作出反应.在观察者模式中,发生改变的对象称为观察目标,而被通知的对象称为观察者,一个观察目标可以对应多个观察者,而且这些观察者之间可以没有任何相互联系,可以根据需要增加和删除观察者,使得系统更易于扩展. 观察者模式定义如下: 观察者模式(Observer Pattern):定义对象之间的一种一对多依赖关系,使得每当一个对象状态发生改变时,其相关依赖对

二人对战游戏 结构体+函数

class 对战713 { struct Player { public string Name; public int Blood; public int Attact; public int Defence; public int DuoBi; public ArrayList JiNeng; public ArrayList ShangHai; } static void Main (string[] args) { #region 定义技能库 string[] JN; int[] SH;

nodejs 打造 多人对战游戏服务器(初级入门)

使用socket.set 和 socket.get 在存取玩家信息 百牛信息技术bainiu.ltd整理发布于博客园 socket.get('playerinfo', function (err, player) { if(player == null) { console.log("[new player]",data.name); var player = new Player(socket, data); } else { console.log("[wait play

技术人,为什么需要构建知识图谱

这个时代,信息极大丰富,人每时每刻都被各种各样的知识.信息轰炸着.如何有效的选择对自己有价值的知识,如何构建一个独属于自己的知识体系并让它为自己创造价值,变得越来越重要.只有知识经过了你的选择和应用,内化为自己的隐性经验,纳入到你的知识体系中,才能真正地为你创造财富. 怎样才能建立自己的知识体系呢? 选择方向,设定目标 学习.实践.输出.内化 同主题扩散 运用工具整理记录知识图谱 迭代与更新知识图谱 有目标,才有知识体系 如果只能选择一个方向,你希望在什么方向上做到出类拔萃? 对这个问题的思考,

JAVASCRIPT开发HTML5游戏--斗地主(网络对战PART4)

继之前用游戏引擎(青瓷引擎)做了斗地主单机版游戏之后,这里分享下使用socket.io来实现网络对战,代码可已放到github上,在此谈谈自己整个的开发思路吧. 客户端代码 服务端代码 (点击图片进入游戏体验) 前文链接: javascript开发HTML5游戏--斗地主(单机模式part1) javascript开发HTML5游戏--斗地主(单机模式part2) javascirpt开发HTML5游戏--斗地主(单机模式part3) 本文章为网络对战第一部分内容.主要内容如下: 简介 服务端项

网络游戏(联网进行的多人电子游戏)

网络游戏(联网进行的多人电子游戏)网络游戏:英文名称为Online Game,又称 "在线游戏",简称"网游". 指以互联网为传输媒介,以游戏运营商服务器和用户计算机为处理终端, 以游戏客户端软件为信息交互窗口的旨在实现娱乐.休闲.交流和取得虚拟成就的具有可持续性的个体性多人在线游戏. 定义 魔兽世界 网络游戏区别与单机游戏而言的,是指玩家必须通过互联网连接来进行多人游戏. 一般指由多名玩家通过计算机网络在虚拟的环境下对人物角色及场景按照一定的规则进行操作以达到娱乐

借鉴炉石传说的战棋游戏《DarkWar》

<炉石传说>是现在很火的休闲对战游戏,本人也非常喜欢玩,玩的时候经常想能不能把炉石的这些元素融入到战棋类游戏中,于是思索良久,又恰逢游戏蛮牛开展第三届蛮牛杯游戏开发大赛,于是用Unity3D制作了这款游戏. 至于为什么叫DarkWar,那是因为一开始准备做成暗黑风格的,残酷的现实告诉我我不适合谈风格……游戏没有完全做好,素材还都是东拼西凑的,音效也就寥寥数个,因为要参加比赛只好先发出来了,正好有喜欢的玩家可以一起探讨下,欢迎加群:330838373.安卓版apk下载地址:http://yun.