标签:
namespace 结构体英雄联盟练一练
{
class Program
{
struct player
{
public string name;
public int dengji;
public zy z;
public zb cz;
}
struct zy
{
public int ll;
public int zh;
public int mj;
public int fy;
}
struct zb
{
public string sx;
public string wj;
public string yx;
public string ny;
}
static void Main(string[] args)
{
player a = new player();
a.name = "李青";
a.dengji = 1;
a.z.ll = 50;
a.z.zh = 30;
a.z.mj = 100;
a.z.fy = 43;
a.cz.sx = "三项之力";
a.cz.wj = "无尽之刃";
a.cz.yx = "饮血剑";
a.cz.ny = "女妖面纱";
player b = new player();
b.name = "亚索";
b.dengji = 1;
b.z.ll = 100;
b.z.zh = 15;
b.z.mj = 100;
b.z.fy = 43;
b.cz.sx = "斯塔缇克电刃";
b.cz.wj = "无尽之刃";
b.cz.yx = "破败王者之刃";
b.cz.ny = "春哥甲";
Console.WriteLine("英雄名称:"+a.name+"\n等级:"+a.dengji+"\n力量:"+a.z.ll+"\n智慧:"+a.z.zh+"\n敏捷:"+a.z.mj+"\n防御:"+a.z.fy+"\n装备:"+(a.cz.sx+"\t"+a.cz.wj+"\t"+a.cz.yx+"\t"+a.cz.ny));
Console.WriteLine();
Console.WriteLine("英雄名称:" + b.name + "\n等级:" + b.dengji + "\n力量:" + b.z.ll + "\n智慧:" + b.z.zh + "\n敏捷:" + b.z.mj + "\n防御:" +b.z.fy+ "\n装备:" + (b.cz.sx + "\t" + b.cz.wj + "\t" + b.cz.yx + "\t" + b.cz.ny));
//下面开始计算伤害
//气血=默认值+力量*等级*1+防御*等级*2
//能量=默认值+智慧*等级*2+敏捷*等级
int qx = 200 + a.z.ll * a.dengji * 1 + a.z.fy * a.dengji* 2;
int nl =100 + a.z.zh * a.dengji * 1 + a.z.mj * a.dengji * 2;
int qx1 = 200 + b.z.ll * b.dengji * 1 + b.z.fy * b.dengji * 2;
int nl1 = 100 + b.z.zh * b.dengji * 1 + b.z.mj * b.dengji * 2;
Console.WriteLine(a.name+"气血:"+qx+"\t能量:"+nl+"\n"+b.name+"气血:"+qx1+"\t能量:"+nl1);
Console.ReadLine();
}
}
}
标签:
原文地址:http://www.cnblogs.com/lk-kk/p/4404209.html