结构体练习--自做对战练习
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace 对战练习
{
class Program
{
struct player
{
public string name;
public int atk;
public int hp;
public int defense;
public int quick;
public int power;
public int mp;
public renshu jn;
}
struct renshu
{
public renshuming name;
public int chakela;
}
struct renshuming
{
public string renshu1;
public string renshu2;
public string renshu3;
public string renshu4;
public JNshanghai shanghai;
}
struct JNshanghai
{
public int shanghai1;
public int shanghai2;
public int shanghai3;
public int shanghai4;
}
static void Main(string[] args)
{
Random r=new Random();
player wanjia1 = new player();
player wanjia2 = new player();
player p1 = new player();
player p2 = new player();
player p3 = new player();
player p4 = new player();
player p5 = new player();
p1.name = "初代-千手柱间";
p1.power = r.Next(60,80);
p1.hp = r.Next(3000, 3500) + p1.power * 10;
p1.quick = r.Next(30, 40);
p1.defense = p1.quick;
p1.mp = r.Next(40,50);
p1.atk = r.Next(130,150)+p1.power*2;
p1.atk = r.Next(80, 100) + p1.power * 2+p1.mp;
p1.jn.chakela = 1500;
p1.jn.name.renshu1 = "仙法-木遁-真数千手";
p1.jn.name.shanghai.shanghai1 = 900;
p1.jn.name.renshu2 = "木遁-花树界降临";
p1.jn.name.shanghai.shanghai2 = 800;
p1.jn.name.renshu3 = "木遁-树界降诞";
p1.jn.name.shanghai.shanghai3 = 700;
p1.jn.name.renshu4 = "木遁-巨木人之术";
p1.jn.name.shanghai.shanghai4 = 600;
p2.name = "旗木卡卡西";
p2.power = r.Next(40, 60);
p2.hp = r.Next(2800, 3300) + p2.power * 5;
p2.quick = r.Next(60, 80);
p2.defense = p2.quick * 2;
p2.mp = r.Next(30,40);
p2.atk = r.Next(90, 110) + p2.quick * 2+p2.mp;
p2.jn.chakela = 1000;
p2.jn.name.renshu1 = "神威";
p2.jn.name.shanghai.shanghai1 = 900;
p2.jn.name.renshu2 = "水遁·大瀑布之术";
p2.jn.name.shanghai.shanghai2 = 500;
p2.jn.name.renshu3 = "冰遁·一角白鲸";
p2.jn.name.shanghai.shanghai3 = 600;
p2.jn.name.renshu4 = "雷遁-雷切";
p2.jn.name.shanghai.shanghai4 = 650;
p3.name = "我爱罗";
p3.power = r.Next(20, 40);
p3.hp = r.Next(2700, 3200) + p3.power * 5;
p3.quick = r.Next(30, 50);
p3.defense = p3.quick;
p3.mp = r.Next(100, 120);
p3.atk = r.Next(100, 120) + p3.mp * 2+p3.quick;
p3.jn.chakela = 1200;
p3.jn.name.renshu1 = "砂之守鹤";
p3.jn.name.shanghai.shanghai1 = 850;
p3.jn.name.renshu2 = "守鹤之矛";
p3.jn.name.shanghai.shanghai2 = 800;
p3.jn.name.renshu3 = "砂瀑层大葬";
p3.jn.name.shanghai.shanghai3 = 600;
p3.jn.name.renshu4 = "风遁-无限砂尘大突破";
p3.jn.name.shanghai.shanghai4 = 650;
p4.name = "漩涡鸣人";
p4.power = r.Next(60, 80);
p4.hp = r.Next(3000, 3500) + p4.power * 10;
p4.quick = r.Next(80, 90);
p4.defense = p1.quick+30;
p4.mp = r.Next(1,10);
p4.atk = r.Next(80, 100) + p4.power * 2+p4.mp;
p4.jn.chakela = 1500;
p4.jn.name.renshu1 = "仙法-风遁-螺旋手里剑";
p4.jn.name.shanghai.shanghai1 = 800;
p4.jn.name.renshu2 = "超大玉螺旋丸";
p4.jn.name.shanghai.shanghai2 = 650;
p4.jn.name.renshu3 = "大玉螺旋丸";
p4.jn.name.shanghai.shanghai3 = 600;
p4.jn.name.renshu4 = "螺旋丸";
p4.jn.name.shanghai.shanghai4 = 500;
p5.name = "宇智波佐助";
p5.power = r.Next(40, 60);
p5.hp = r.Next(2800, 3300) + p5.power * 5;
p5.quick = r.Next(60, 80);
p5.defense = p2.quick * 2;
p5.mp = r.Next(20,30);
p5.atk = r.Next(90, 110) + p5.quick * 2+p5.mp;
p5.jn.chakela = 1000;
p5.jn.name.renshu1 = "须佐能乎";
p5.jn.name.shanghai.shanghai1= 850;
p5.jn.name.renshu2 = "天照";
p5.jn.name.shanghai.shanghai2 = 800;
p5.jn.name.renshu3 = "火遁-豪火球之术";
p5.jn.name.shanghai.shanghai3 = 500;
p5.jn.name.renshu4 = "雷遁-千鸟";
p5.jn.name.shanghai.shanghai4 = 600;
ArrayList p = new ArrayList();
p.Add(p1);
p.Add(p2);
p.Add(p3);
p.Add(p4);
p.Add(p5);
Console.WriteLine("火影第二版!暂时放出5个英雄,每个英雄四个专属技能。后续添加!"+
"欢迎各位大神指导修正!"+
"\n加入了查克拉,维持生命的基础查克拉量是200,也就是说查克拉如果低于200就无法施放技能。可以判断是否同归于尽,判定玩家一查克拉量是否高于"+
"150生命值是否低于250并且玩家二生命值高于玩家一生命值且玩家二生命值低于玩家一最强技能伤害值,满足条件玩家一可与玩家二同归于尽!");
Console.WriteLine("点击任意键继续。。。。");
Console.ReadKey();
Console.Clear();
Console.WriteLine("请玩家一选择英雄:\n1.初代 2.旗木卡卡西 3.我爱罗 4.漩涡鸣人 5.宇智波佐助");
int a1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请玩家二选择英雄:\n1.初代 2.旗木卡卡西 3.我爱罗 4.漩涡鸣人 5.宇智波佐助");
int a2 = Convert.ToInt32(Console.ReadLine());
wanjia1 = (player)p[a1-1];
wanjia2 = (player)p[a2-1];
Console.Clear();
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("英雄名称:"+wanjia1.name+" HP "+wanjia1.hp+" 防御 "+wanjia1.defense+" 攻击 "+wanjia1.atk+" 敏捷 "+wanjia1.quick+" 智商 "
+wanjia1.mp+" 查克拉 "+wanjia1.jn.chakela);
Console.WriteLine("VS");
Console.WriteLine("英雄名称:" + wanjia2.name + " HP " + wanjia2.hp + " 防御 " + wanjia2.defense + " 攻击 " + wanjia2.atk +" 敏捷 "+
wanjia2.quick+ " 智商 " + wanjia2.mp+" 查克拉 "+wanjia2.jn.chakela);
Console.ResetColor();
Console.WriteLine("点击任意键开始游戏.....");
Console.ReadKey();
while (true)
{
if (wanjia1.hp<=0&&wanjia2.hp<=0)
{
Console.WriteLine("卧槽~战的不爽~来~~再来大战三百回合");
break;
}
else if (wanjia1.hp<=0&&wanjia2.hp>0)
{
Console.WriteLine(" "+wanjia1.name+" 你丫~回家修炼十年再来比过");
break;
}
else if (wanjia1.hp>0&&wanjia2.hp<=0)
{
Console.WriteLine(" "+wanjia2.name+" 你丫~回家修炼十年再来比过");
break;
}
else if (wanjia1.hp<250&&wanjia1.jn.chakela>150&&wanjia2.hp>wanjia1.hp&&wanjia2.hp<wanjia1.jn.name.shanghai.shanghai1)
{
Console.WriteLine(" "+wanjia1.name+" 施放最强技能 "+wanjia1.jn.name+"与"+wanjia2.name+"同归于尽");
break;
}
else if (wanjia2.hp<250&&wanjia2.jn.chakela>150&&wanjia1.hp>wanjia2.hp&&wanjia1.hp<wanjia2.jn.name.shanghai.shanghai1)
{
Console.WriteLine(" "+wanjia2.name+" 施放最强技能 "+wanjia2.jn.name+"与"+wanjia1.name+"同归于尽");
break;
}
if (wanjia1.quick>wanjia2.quick)//敏捷高的先出手
{
int s1 = r.Next(0, 10);//随机取值,来调节技能的施放几率
if (s1 > 7 && wanjia1.jn.chakela > 200)//调节技能的施放几率,并且必须在查克拉量200以上才可以施放,200为基础查克拉量,低于这个值便进入虚弱状态
{
int c = r.Next(200,300);//随机取值,查克拉的消耗量
int x1 = r.Next(0,4);//取随机数,用来施放不同的技能
int dhp2;//玩家二的掉血量
int atk1 = wanjia1.atk - 50;//浮动玩家一的普通攻击
int defense2 = wanjia2.defense - 10;//浮动玩家二的防御
switch (x1)
{
case 0:
dhp2 = (atk1 + wanjia1.jn.name.shanghai.shanghai1 - defense2) < 0 ? 0 : (atk1 + wanjia1.jn.name.shanghai.shanghai1 - defense2);
wanjia2.hp -= dhp2;
wanjia1.jn.chakela -= c;
if (wanjia2.hp<0)
{
wanjia2.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(wanjia1.name + "消耗 " + c + " 点查克拉" + "施放 " + wanjia1.jn.name.renshu1 + " 对" + wanjia2.name + "造成" + dhp2 + "点伤害\n" + wanjia1.name + "剩余查克拉" + wanjia1.jn.chakela);
break;
case 1:
dhp2 = (atk1 + wanjia1.jn.name.shanghai.shanghai2 - defense2) < 0 ? 0 : (atk1 + wanjia1.jn.name.shanghai.shanghai2 - defense2);
wanjia2.hp -= dhp2;
wanjia1.jn.chakela -= c;
if (wanjia2.hp<0)
{
wanjia2.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(wanjia1.name + "消耗 " + c + " 点查克拉" + "施放 " + wanjia1.jn.name.renshu2 + " 对" + wanjia2.name + "造成" + dhp2 + "点伤害\n" + wanjia1.name + "剩余查克拉" + wanjia1.jn.chakela);
break;
case 2:
dhp2 = (atk1 + wanjia1.jn.name.shanghai.shanghai3 - defense2) < 0 ? 0 : (atk1 + wanjia1.jn.name.shanghai.shanghai3 - defense2);
wanjia2.hp -= dhp2;
wanjia1.jn.chakela -= c;
if (wanjia2.hp<0)
{
wanjia2.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(wanjia1.name + "消耗 " + c + " 点查克拉" + "施放 " + wanjia1.jn.name.renshu3 + " 对" + wanjia2.name + "造成" + dhp2 + "点伤害\n" + wanjia1.name + "剩余查克拉" + wanjia1.jn.chakela);
break;
case 3:
dhp2 = (atk1 + wanjia1.jn.name.shanghai.shanghai4 - defense2) < 0 ? 0 : (atk1 + wanjia1.jn.name.shanghai.shanghai4 - defense2);
wanjia2.hp -= dhp2;
wanjia1.jn.chakela -= c;
if (wanjia2.hp<0)
{
wanjia2.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(wanjia1.name + "消耗 " + c + " 点查克拉" + "施放 " + wanjia1.jn.name.renshu4 + " 对" + wanjia2.name + "造成" + dhp2 + "点伤害\n" + wanjia1.name + "剩余查克拉" + wanjia1.jn.chakela);
break;
}
}
else
{
int dodge = r.Next(0,10);
if (dodge>6)//取随机数,用来调节闪避的几率
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(wanjia2.name+" 躲避了 "+wanjia1.name+"的攻击");
}
else
{
int dhp2;//玩家二的掉血量
int atk1 = wanjia1.atk - 50;
int defense2 = wanjia2.defense - 10;
dhp2 = (atk1 - defense2) < 0 ? 0 : (atk1 - defense2);
wanjia2.hp -= dhp2;
if (wanjia2.hp < 0)
{
wanjia2.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine(wanjia1.name + "使用 普通攻击 对" + wanjia2.name + "造成" + dhp2 + "点伤害");
}
}
System.Threading.Thread.Sleep(1500);
int s2 = r.Next(0, 10);
if (s2 > 7&&wanjia2.jn.chakela>200)//调节技能的施放几率,并且必须在查克拉量200以上才可以施放,200为基础查克拉量,低于这个值便进入虚弱状态
{
int c = r.Next(200,300);//随机取值,表示查克拉的消耗量
int x2 = r.Next(0, 4);//取随机数,用来施放不同的技能
int dhp1;//玩家一的掉血量
int atk2 = wanjia2.atk - 50;//浮动玩家二的普通攻击
int defense1 = wanjia1.defense - 10;//浮动玩家一的防御
switch (x2)
{
case 0:
dhp1 = (atk2 + wanjia2.jn.name.shanghai.shanghai1 - defense1) < 0 ? 0 : (atk2 + wanjia2.jn.name.shanghai.shanghai1 - defense1);
wanjia1.hp -= dhp1;
wanjia2.jn.chakela -= c;
if (wanjia1.hp < 0)
{
wanjia1.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(wanjia2.name + "消耗 " + c + " 点查克拉" + "施放 " + wanjia2.jn.name.renshu1 + " 对" + wanjia1.name + "造成" + dhp1 + "点伤害\n" + wanjia2.name + "剩余查克拉量" + wanjia2.jn.chakela);
break;
case 1:
dhp1 = (atk2 + wanjia2.jn.name.shanghai.shanghai2 - defense1) < 0 ? 0 : (atk2 + wanjia2.jn.name.shanghai.shanghai2 - defense1);
wanjia1.hp -= dhp1;
wanjia2.jn.chakela -= c;
if (wanjia1.hp < 0)
{
wanjia1.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(wanjia2.name + "消耗 " + c + " 点查克拉" + "施放 " + wanjia2.jn.name.renshu2 + " 对" + wanjia1.name + "造成" + dhp1 + "点伤害\n" + wanjia2.name + "剩余查克拉量" + wanjia2.jn.chakela);
break;
case 2:
dhp1 = (atk2 + wanjia2.jn.name.shanghai.shanghai3 - defense1) < 0 ? 0 : (atk2 + wanjia2.jn.name.shanghai.shanghai3 - defense1);
wanjia1.hp -= dhp1;
wanjia2.jn.chakela -= c;
if (wanjia1.hp < 0)
{
wanjia1.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(wanjia2.name + "消耗 " + c + " 点查克拉" + "施放 " + wanjia2.jn.name.renshu3 + " 对" + wanjia1.name + "造成" + dhp1 + "点伤害\n" + wanjia2.name + "剩余查克拉量" + wanjia2.jn.chakela);
break;
case 3:
dhp1 = (atk2 + wanjia2.jn.name.shanghai.shanghai4 - defense1) < 0 ? 0 : (atk2 + wanjia2.jn.name.shanghai.shanghai4 - defense1);
wanjia1.hp -= dhp1;
wanjia2.jn.chakela -= c;
if (wanjia1.hp < 0)
{
wanjia1.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(wanjia2.name + "消耗 " + c + " 点查克拉" + "施放 " + wanjia2.jn.name.renshu4 + " 对" + wanjia1.name + "造成" + dhp1 + "点伤害\n" + wanjia2.name + "剩余查克拉量" + wanjia2.jn.chakela);
break;
}
}
else
{
int dodge = r.Next(0, 10);
if (dodge > 6)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(wanjia1.name + " 躲避了 " + wanjia2.name + "的攻击");
}
else
{
int dhp1;//玩家一的掉血量
int atk2 = wanjia2.atk - 50;
int defense1 = wanjia2.defense - 10;
dhp1 = (atk2 - defense1) < 0 ? 0 : (atk2 - defense1);
wanjia1.hp -= dhp1;
if (wanjia1.hp < 0)
{
wanjia1.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine(wanjia2.name + "使用 普通攻击 对" + wanjia1.name + "造成" + dhp1 + "点伤害");
}
}
System.Threading.Thread.Sleep(1500);
}
else
{
int s2 = r.Next(0, 10);
if (s2 > 7&&wanjia2.jn.chakela>200)
{
int c = r.Next(200,300);
int x2 = r.Next(0, 4);//取随机数,用来施放不同的技能
int dhp1;//玩家一的掉血量
int atk2 = wanjia2.atk - 50;//浮动玩家二的普通攻击
int defense1 = wanjia1.defense - 10;//浮动玩家一的防御
switch (x2)
{
case 0:
dhp1 = (atk2 + wanjia2.jn.name.shanghai.shanghai1 - defense1) < 0 ? 0 : (atk2 + wanjia2.jn.name.shanghai.shanghai1 - defense1);
wanjia1.hp -= dhp1;
wanjia2.jn.chakela -= c;
if (wanjia1.hp < 0)
{
wanjia1.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(wanjia2.name + "消耗 " + c + " 点查克拉" + "施放 " + wanjia2.jn.name.renshu1 + " 对" + wanjia1.name + "造成" + dhp1 + "点伤害\n" + wanjia2.name + "剩余查克拉量" + wanjia2.jn.chakela);
break;
case 1:
dhp1 = (atk2 + wanjia2.jn.name.shanghai.shanghai2 - defense1) < 0 ? 0 : (atk2 + wanjia2.jn.name.shanghai.shanghai2 - defense1);
wanjia1.hp -= dhp1;
wanjia2.jn.chakela -= c;
if (wanjia1.hp < 0)
{
wanjia1.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(wanjia2.name + "消耗 " + c + " 点查克拉" + "施放 " + wanjia2.jn.name.renshu2 + " 对" + wanjia1.name + "造成" + dhp1 + "点伤害\n" + wanjia2.name + "剩余查克拉量" + wanjia2.jn.chakela);
break;
case 2:
dhp1 = (atk2 + wanjia2.jn.name.shanghai.shanghai3 - defense1) < 0 ? 0 : (atk2 + wanjia2.jn.name.shanghai.shanghai3 - defense1);
wanjia1.hp -= dhp1;
wanjia2.jn.chakela -= c;
if (wanjia1.hp < 0)
{
wanjia1.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(wanjia2.name + "消耗 " + c + " 点查克拉" + "施放 " + wanjia2.jn.name.renshu3 + " 对" + wanjia1.name + "造成" + dhp1 + "点伤害\n" + wanjia2.name + "剩余查克拉量" + wanjia2.jn.chakela);
break;
case 3:
dhp1 = (atk2 + wanjia2.jn.name.shanghai.shanghai4 - defense1) < 0 ? 0 : (atk2 + wanjia2.jn.name.shanghai.shanghai4 - defense1);
wanjia1.hp -= dhp1;
wanjia2.jn.chakela -= c;
if (wanjia1.hp < 0)
{
wanjia1.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(wanjia2.name + "消耗 " + c + " 点查克拉" + "施放 " + wanjia2.jn.name.renshu4 + " 对" + wanjia1.name + "造成" + dhp1 + "点伤害\n" + wanjia2.name + "剩余查克拉量" + wanjia2.jn.chakela);
break;
}
}
else
{
int dodge = r.Next(0, 10);
if (dodge > 6)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(wanjia1.name + " 躲避了 " + wanjia2.name + "的攻击");
}
else
{
int dhp1;//玩家一的掉血量
int atk2 = wanjia2.atk - 50;
int defense1 = wanjia2.defense - 10;
dhp1 = (atk2 - defense1) < 0 ? 0 : (atk2 - defense1);
wanjia1.hp -= dhp1;
if (wanjia1.hp < 0)
{
wanjia1.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine(wanjia2.name + "使用 普通攻击 对" + wanjia1.name + "造成" + dhp1 + "点伤害");
}
}
System.Threading.Thread.Sleep(1500);
int s1 = r.Next(0, 10);
if (s1 > 7)
{
int c = r.Next(200,300);
int x1 = r.Next(0, 4);//取随机数,用来施放不同的技能
int dhp2;//玩家二的掉血量
int atk1 = wanjia1.atk - 50;//浮动玩家一的普通攻击
int defense2 = wanjia2.defense - 10;//浮动玩家二的防御
switch (x1)
{
case 0:
dhp2 = (atk1 + wanjia1.jn.name.shanghai.shanghai1 - defense2) < 0 ? 0 : (atk1 + wanjia1.jn.name.shanghai.shanghai1 - defense2);
wanjia2.hp -= dhp2;
wanjia1.jn.chakela -= c;
if (wanjia2.hp < 0)
{
wanjia2.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(wanjia1.name + "消耗 " + c + " 点查克拉" + "施放 " + wanjia1.jn.name.renshu1 + " 对" + wanjia2.name + "造成" + dhp2 + "点伤害\n" + wanjia1.name + "剩余查克拉" + wanjia1.jn.chakela);
break;
case 1:
dhp2 = (atk1 + wanjia1.jn.name.shanghai.shanghai2 - defense2) < 0 ? 0 : (atk1 + wanjia1.jn.name.shanghai.shanghai2 - defense2);
wanjia2.hp -= dhp2;
wanjia1.jn.chakela -= c;
if (wanjia2.hp < 0)
{
wanjia2.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(wanjia1.name + "消耗 " + c + " 点查克拉" + "施放 " + wanjia1.jn.name.renshu2 + " 对" + wanjia2.name + "造成" + dhp2 + "点伤害\n" + wanjia1.name + "剩余查克拉" + wanjia1.jn.chakela);
break;
case 2:
dhp2 = (atk1 + wanjia1.jn.name.shanghai.shanghai3 - defense2) < 0 ? 0 : (atk1 + wanjia1.jn.name.shanghai.shanghai3 - defense2);
wanjia2.hp -= dhp2;
wanjia1.jn.chakela -= c;
if (wanjia2.hp < 0)
{
wanjia2.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(wanjia1.name + "消耗 " + c + " 点查克拉" + "施放 " + wanjia1.jn.name.renshu3 + " 对" + wanjia2.name + "造成" + dhp2 + "点伤害\n" + wanjia1.name + "剩余查克拉" + wanjia1.jn.chakela);
break;
case 3:
dhp2 = (atk1 + wanjia1.jn.name.shanghai.shanghai4 - defense2) < 0 ? 0 : (atk1 + wanjia1.jn.name.shanghai.shanghai4 - defense2);
wanjia2.hp -= dhp2;
wanjia1.jn.chakela -= c;
if (wanjia2.hp < 0)
{
wanjia2.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(wanjia1.name + "消耗 " + c + " 点查克拉" + "施放 " + wanjia1.jn.name.renshu4 + " 对" + wanjia2.name + "造成" + dhp2 + "点伤害\n" + wanjia1.name + "剩余查克拉" + wanjia1.jn.chakela);
break;
}
}
else
{
int dodge = r.Next(0, 10);
if (dodge > 6)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(wanjia2.name + " 躲避了 " + wanjia1.name + "的攻击");
}
else
{
int dhp2;//玩家二的掉血量
int atk1 = wanjia1.atk - 50;
int defense2 = wanjia2.defense - 10;
dhp2 = (atk1 - defense2) < 0 ? 0 : (atk1 - defense2);
wanjia2.hp -= dhp2;
if (wanjia2.hp < 0)
{
wanjia2.hp = 0;
}
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine(wanjia1.name + "使用 普通攻击 对" + wanjia2.name + "造成" + dhp2 + "点伤害");
}
}
System.Threading.Thread.Sleep(1500);
}
Console.ResetColor();
Console.WriteLine();
Console.WriteLine(wanjia1.name+"剩余血量 "+wanjia1.hp+" "+wanjia2.name+"剩余血量 "+wanjia2.hp);
Console.WriteLine();
}
Console.ReadLine();
}
}
}