namespace 英雄联盟对战
{
class Program
{
struct player
{
public string name;
public int hp;
public int gj;
public int fy;
public int dj;
public jn jineng;
//public wg w;
}
struct jn
{
public string q;
public string w;
public string e;
public string r;
}
//struct wg
//{
// public string name;
// public int atk;
//}
static void Main(string[] args)
{
//wg[] wg1=new wg[4];
//wg1[0].name = "哎呀喂。。。";
//wg1[0].atk = 100;
player a = new player();
player b = new player();
Console.WriteLine("请输入第一个英雄的名字:");
a.name = Console.ReadLine();
Console.WriteLine("请输入第二个英雄的名字:");
b.name = Console.ReadLine();
Random r =new Random();
a.hp = r.Next(1, 100) + 5000;
a.gj = r.Next(1, 100)+100;
a.fy = r.Next(1, 100);
a.dj = r.Next(6, 18);
a.jineng.q = "大玉螺旋丸";
a.jineng.w = "多重影分身术";
a.jineng.e = "风遁:螺旋手里剑";
a.jineng.r = "六道模式";
b.hp = r.Next(1, 100) + 5000;
b.gj = r.Next(1, 100) + 100;
b.fy = r.Next(1, 100);
b.dj = r.Next(6, 18);
b.jineng.q = "火遁:豪火球之术";
b.jineng.w = "千鸟";
b.jineng.e = "天照";
b.jineng.r = "麒麟";
Console.WriteLine("玩家1的英雄:"+a.name+"\t气血:"+a.hp+"\t攻击"+a.gj+"\t防御:"+a.fy+"\t等级:"+a.dj);
Console.WriteLine("所使用的技能:"+"Q:"+a.jineng.q+"\tW:"+a.jineng.w+"\tE:"+a.jineng.e+"\tR:"+a.jineng.r);
Console.WriteLine("玩家2的英雄:" + b.name + "\t气血:" + b.hp + "\t攻击" + b.gj + "\t防御:" + b.fy + "\t等级:" + b.dj);
Console.WriteLine("所使用的技能:" + "Q:" + b.jineng.q + "\tW:" + b.jineng.w + "\tE:" + b.jineng.e + "\tR:" + b.jineng.r);
Console.WriteLine("按任意键开始游戏");
Console.ReadKey();
while (true)
{
if (a.hp <= 0 && b.hp <= 0)
{
Console.WriteLine("平局");
break;
}
else if(a.hp<=0)
{
Console.WriteLine(b.name+"获胜");
break;
}
else if (b.hp <= 0)
{
Console.WriteLine(a.name + "获胜");
break;
}
else
{
Random m=new Random();
//玩家a攻击玩家b
if(m.Next(1,10)>7) //超过7使用大招
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("玩家"+a.name+"使用大技能"+a.jineng.r);
b.hp = b.hp - r.Next(300, 400);
}
else if(m.Next(1,10)>5&&m.Next(1,10)<=7)
{
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("玩家"+a.name+"使用小技能"+a.jineng.q);
b.hp = b.hp - r.Next(50, 100);
}
else if (m.Next(1, 10) > 3 && m.Next(1, 10) <= 5)
{
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("玩家" + a.name + "使用小技能" + a.jineng.w);
b.hp = b.hp - r.Next(50, 150);
}
else
{
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("玩家" + a.name + "使用小技能" + a.jineng.e);
b.hp = b.hp - r.Next(100, 200);
}
if (b.hp < 0)
{
b.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("玩家" + b.name + "的气血剩余为:" + b.hp);
//玩家b攻击玩家a
if (m.Next(1, 10) > 7) //超过7使用大招
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("玩家" + b.name + "使用大技能" + b.jineng.r);
a.hp = a.hp - r.Next(300, 400);
}
else if (m.Next(1, 10) > 5 && m.Next(1, 10) <= 7)
{
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("玩家" + b.name + "使用小技能" + b.jineng.q);
a.hp =a.hp - r.Next(50, 100);
}
else if (m.Next(1, 10) > 3 && m.Next(1, 10) <= 5)
{
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("玩家" + b.name + "使用小技能" + b.jineng.w);
a.hp = a.hp - r.Next(50, 150);
}
else
{
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("玩家" + b.name + "使用小技能" + b.jineng.e);
a.hp = a.hp - r.Next(100, 200);
}
if (a.hp < 0)
{
a.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("玩家" + a.name + "的气血剩余为:" + a.hp);
Thread.Sleep(800);
}
Console.WriteLine();
}//while的花括号
Console.ReadLine();
}
}
}