推箱子
//只做了两关
class Program
{
static void Main(string[] args)
{
int x = ;
int y = ;
int z = ; int end1x = ;
int end1y = ; int end2x = ;
int end2y = ; #region 地图绘制
string[,,] map = new string[, , ]
{
{ {"●", "●", "●", "●", "●", "●", "●", "●", "●", "●"},
{"●", " ", " ", " ", " ", " ", " ", " ", " ", "●"},
{"●", " ", " ", " ", " ", " ", " ", " ", " ", "●"},
{"●", " ", " ", " ", " ", " ", "☆", " ", " ", "●"},
{"●", " ", "□", " ", " ", " ", " ", " ", " ", "●"},
{"●", " ", " ", " ", " ", " ", " ", " ", " ", "●"},
{"●", " ", " ", " ", " ", " ", " ", " ", " ", "●"},
{"●", " ", " ", " ", " ", " ", " ", " ", " ", "●"},
{"●", "♀", " ", " ", " ", " ", " ", " ", " ", "●"},
{"●", "●", "●", "●", "●", "●", "●", "●", "●", "●"} }, { {"●", "●", "●", "●", "●", "●", "●", "●", "●", " "},
{"●", " ", " ", "●", " ", " ", " ", " ", "●", " "},
{"●", " ", " ", "●", " ", " ", " ", " ", "●", " "},
{"●", " ", " ", "●", " ", " ", "☆", " ", "●", " "},
{"●", " ", "□", " ", " ", " ", " ", " ", "●", "●"},
{"●", " ", " ", " ", " ", " ", " ", " ", " ", "●"},
{"●", "●", "●", " ", " ", "●", " ", " ", " ", "●"},
{"●", " ", " ", " ", " ", "●", " ", " ", " ", "●"},
{"●", "♀", " ", " ", " ", "●", " ", " ", " ", "●"},
{"●", "●", "●", "●", "●", "●", "●", "●", "●", "●"} }, { {" ", " ", "●", "●", "●", "●", "●", "●", "●", " "},
{" ", " ", "●", " ", " ", " ", " ", " ", "●", " "},
{" ", " ", "●", " ", "□", " ", " ", " ", "●", " "},
{" ", " ", "●", " ", " ", " ", " ", " ", "●", " "},
{"●", "●", "●", " ", " ", " ", "□", " ", "●", "●"},
{"●", " ", " ", " ", " ", " ", " ", " ", " ", "●"},
{"●", " ", " ", " ", " ", "●", " ", " ", " ", "●"},
{"●", "☆", "●", " ", " ", "●", " ", " ", "♀", "●"},
{"●", " ", "●", " ", " ", "●", " ", "☆", " ", "●"},
{"●", "●", "●", "●", "●", "●", "●", "●", "●", "●"} } };
#endregion while (true)
{
Console.Clear(); #region 打印地图
//打印地图
for (int i = ; i <= ; i++)
{
for (int j = ; j <= ; j++)
{
Console.Write(map[z, i, j]);
}
Console.WriteLine();
}
#endregion if (map[z, end1y, end1x] == "★")
{
Console.WriteLine("你赢了!!");
Console.WriteLine("按任意键进入下一关...");
Console.ReadKey(); int x1 = ;
int y1 = ; while (true)
{
Console.Clear(); for (int i = ; i <= ; i++)
{
for (int j = ; j <= ; j++)
{
Console.Write(map[z + , i, j]);
}
Console.WriteLine();
} if (map[z + , end2y, end2x] == "★")
{
Console.WriteLine("你赢了!!");
Console.WriteLine("按任意键进入下一关...");
Console.ReadKey();
} ConsoleKeyInfo Key = Console.ReadKey(); #region 第二关向上
if (Key.Key.ToString() == "UpArrow")
{
if (map[z + , y1 - , x1] == "●")
{ }
else
{
if (map[z + , y1 - , x1] == "□")
{
if (map[z + , y1 - , x1] == "●")
{ }
else
{
if (map[z + , y1 - , x1] == "☆")
{
map[z + , y1 - , x1] = "★";
map[z + , y1 - , x1] = " ";
string D = map[z + , y1, x1];
map[z + , y1, x1] = map[z + , y1 - , x1];
map[z + , y1 - , x1] = D;
y1--;
}
else
{
string D = map[z + , y1 - , x1];
map[z + , y1 - , x1] = map[z + , y1 - , x1];
map[z + , y1 - , x1] = D;
D = map[z + , y1, x1];
map[z + , y1, x1] = map[z + , y1 - , x1];
map[z + , y1 - , x1] = D;
y1--; }
}
}
else
{
string D = map[z + , y1, x1];
map[z + , y1, x1] = map[z + , y1 - , x1];
map[z + , y1 - , x1] = D;
y1--;
}
}
}
#endregion #region 第二关向下
else if (Key.Key.ToString() == "DownArrow")
{
if (map[z + , y1 + , x1] == "●")
{ }
else
{
if (map[z + , y1 + , x1] == "□")
{
if (map[z + , y1 + , x1] == "●")
{ }
else
{
if (map[z + , y1 + , x1] == "☆")
{
map[z + , y1 + , x1] = "★";
map[z + , y1 + , x1] = " ";
string D = map[z + , y1, x1];
map[z + , y1, x1] = map[z + , y1 + , x1];
map[z + , y1 + , x1] = D;
y1++;
}
else
{
string D = map[z + , y1 + , x1];
map[z + , y1 + , x1] = map[z + , y1 + , x1];
map[z + , y1 + , x1] = D;
D = map[z + , y1, x1];
map[z + , y1, x1] = map[z + , y1 + , x1];
map[z + , y1 + , x1] = D;
y1++; }
}
}
else
{
string D = map[z + , y1, x1];
map[z + , y1, x1] = map[z + , y1 + , x1];
map[z + , y1 + , x1] = D;
y1++;
}
}
}
#endregion #region 第二关向左
else if (Key.Key.ToString() == "LeftArrow")
{
if (map[z + , y1, x1 - ] == "●")
{ }
else
{
if (map[z + , y1, x1 - ] == "□")
{
if (map[z + , y1, x1 - ] == "●")
{ }
else
{
if (map[z + , y1, x1 - ] == "☆")
{
map[z + , y1, x1 - ] = "★";
map[z + , y1, x1 - ] = " ";
string D = map[z + , y1, x1];
map[z + , y1, x1] = map[z + , y1, x1 - ];
map[z + , y1, x1 - ] = D;
x1--;
}
else
{
string D = map[z + , y1, x1 - ];
map[z + , y1, x1 - ] = map[z + , y1, x1 - ];
map[z + , y1, x1 - ] = D;
D = map[z + , y1, x1];
map[z + , y1, x1] = map[z + , y1, x1 - ];
map[z + , y1, x1 - ] = D;
x1--; }
}
}
else
{
string D = map[z + , y1, x1];
map[z + , y1, x1] = map[z + , y1, x1 - ];
map[z + , y1, x1 - ] = D;
x1--;
}
}
}
#endregion #region 第二关向右
else if (Key.Key.ToString() == "RightArrow")
{
if (map[z + , y1, x1 + ] == "●")
{ }
else
{
if (map[z + , y1, x1 + ] == "□")
{
if (map[z + , y1, x1 + ] == "●")
{ }
else
{
if (map[z + , y1, x1 + ] == "☆")
{
map[z + , y1, x1 + ] = "★";
map[z + , y1, x1 + ] = " ";
string D = map[z + , y1, x1];
map[z + , y1, x1] = map[z + , y1, x1 + ];
map[z + , y1, x1 + ] = D;
x1++;
}
else
{
string D = map[z + , y1, x1 + ];
map[z + , y1, x1 + ] = map[z + , y1, x1 + ];
map[z + , y1, x1 + ] = D;
D = map[z + , y1, x1];
map[z + , y1, x1] = map[z + , y1, x1 + ];
map[z + , y1, x1 + ] = D;
x1++; }
}
}
else
{
string D = map[z + , y1, x1];
map[z + , y1, x1] = map[z + , y1, x1 + ];
map[z + , y1, x1 + ] = D;
x1++;
}
}
}
#endregion }
}
ConsoleKeyInfo K = Console.ReadKey();
#region 往上走
//往上走
if (K.Key.ToString() == "UpArrow")
{
if (map[z, y - , x] == "●")
{ }
else
{
if (map[z, y - , x] == "□")
{
if (map[z, y - , x] == "●")
{ }
else
{
if (map[z, y - , x] == "☆")
{
map[z, y - , x] = "★";
map[z, y - , x] = " ";
string D = map[z, y, x];
map[z, y, x] = map[z, y - , x];
map[z, y - , x] = D;
y--;
}
else
{
string D = map[z, y - , x];
map[z, y - , x] = map[z, y - , x];
map[z, y - , x] = D;
D = map[z, y, x];
map[z, y, x] = map[z, y - , x];
map[z, y - , x] = D;
y--; }
}
}
else
{
string D = map[z, y, x];
map[z, y, x] = map[z, y - , x];
map[z, y - , x] = D;
y--;
}
}
}
#endregion #region 往下走
//往下走
else if (K.Key.ToString() == "DownArrow")
{
if (map[z, y + , x] == "●")
{ }
else
{
if (map[z, y + , x] == "□")
{
if (map[z, y + , x] == "●")
{ }
else
{
if (map[z, y + , x] == "☆")
{
map[z, y + , x] = "★";
map[z, y + , x] = " ";
string D = map[z, y, x];
map[z, y, x] = map[z, y + , x];
map[z, y + , x] = D;
y++;
}
else
{
string D = map[z, y + , x];
map[z, y + , x] = map[z, y + , x];
map[z, y + , x] = D;
D = map[z, y, x];
map[z, y, x] = map[z, y + , x];
map[z, y + , x] = D;
y++;
}
}
}
else
{
string D = map[z, y, x];
map[z, y, x] = map[z, y + , x];
map[z, y + , x] = D;
y++;
}
}
}
#endregion #region 往左走
//往左走
else if (K.Key.ToString() == "LeftArrow")
{
if (map[z, y, x - ] == "●")
{ }
else
{
if (map[z, y, x - ] == "□")
{
if (map[z, y, x - ] == "●")
{ }
else
{
if (map[z, y, x - ] == "☆")
{
map[z, y, x - ] = "★";
map[z, y, x - ] = " ";
string D = map[z, y, x];
map[z, y, x] = map[z, y, x - ];
map[z, y, x - ] = D;
x--;
}
else
{
string D = map[z, y, x - ];
map[z, y, x - ] = map[z, y, x - ];
map[z, y, x - ] = D;
D = map[z, y, x];
map[z, y, x] = map[z, y, x - ];
map[z, y, x - ] = D;
x--;
}
}
}
else
{
string D = map[z, y, x];
map[z, y, x] = map[z, y, x - ];
map[z, y, x - ] = D;
x--;
} }
}
#endregion #region 往右走
//往右走
else if (K.Key.ToString() == "RightArrow")
{
if (map[z, y, x + ] == "●")
{ }
else
{
if (map[z, y, x + ] == "□")
{
if (map[z, y, x + ] == "●")
{ }
else
{
if (map[z, y, x + ] == "☆")
{
map[z, y, x + ] = "★";
map[z, y, x + ] = " ";
string D = map[z, y, x];
map[z, y, x] = map[z, y, x + ];
map[z, y, x + ] = D;
x++;
}
else
{
string D = map[z, y, x + ];
map[z, y, x + ] = map[z, y, x + ];
map[z, y, x + ] = D;
D = map[z, y, x];
map[z, y, x] = map[z, y, x + ];
map[z, y, x + ] = D;
x++;
}
}
}
else
{
string D = map[z, y, x];
map[z, y, x] = map[z, y, x + ];
map[z, y, x + ] = D;
x++;
} }
}
}
#endregion
}
}
对战游戏
class Program
{
public struct ChengXiang // 创建
{
public string name;
public int shanghai;
public int xueliang;
public int minjie;
}
public struct JiNeng // 技能
{
public string name;
public double shanghai;
}
public struct ZhuangBei//装备
{
public string name;
public int GongJi;
} public struct ZhiLiao
{
public string name;
public int HP;
}
public struct HuJia
{
public string name;
public int hj;
} static void Main(string[] args)
{
Random RA = new Random(); #region 装备
ArrayList ZB = new ArrayList();
ZhuangBei ZB1 = new ZhuangBei
{
name = "青龙偃月刀",
GongJi =
};
ZhuangBei ZB2 = new ZhuangBei
{
name = "阴阳剑",
GongJi =
};
ZhuangBei ZB3 = new ZhuangBei
{
name = "八丈矛",
GongJi =
};
ZhuangBei ZB4 = new ZhuangBei
{
name = "峨眉玄孤刺",
GongJi =
};
ZhuangBei ZB5 = new ZhuangBei
{
name = "凤翅镏金镋",
GongJi =
};
ZhuangBei ZB6 = new ZhuangBei
{
name = "方天画戟",
GongJi =
};
ZhuangBei ZB7 = new ZhuangBei
{
name = "鑗斧",
GongJi =
};
ZB.Add(ZB1);
ZB.Add(ZB2);
ZB.Add(ZB3);
ZB.Add(ZB4);
ZB.Add(ZB5);
ZB.Add(ZB6);
ZB.Add(ZB7); #endregion #region 护甲装
ArrayList HJZ = new ArrayList();
HuJia HJ1 = new HuJia
{
name = "锁子甲",
hj =
};
HuJia HJ2 = new HuJia
{
name = "木甲",
hj =
};
HuJia HJ3 = new HuJia
{
name = "宣纸甲",
hj =
};
HJZ.Add(HJ1);
HJZ.Add(HJ2);
HJZ.Add(HJ3);
#endregion #region 技能
ArrayList JiNenga = new ArrayList();
JiNeng JN1 = new JiNeng();
JN1.name = "天外飞仙";
JN1.shanghai = ;
JiNeng JN2 = new JiNeng();
JN2.name = "无影腿";
JN2.shanghai = ;
JiNeng JN3 = new JiNeng();
JN3.name = "九阴白骨爪";
JN3.shanghai = 2.5;
JiNeng JN4 = new JiNeng();
JN4.name = "蛤蟆功";
JN4.shanghai = ;
JiNeng JN5 = new JiNeng();
JN5.name = "圆舞斩";
JN5.shanghai = 3.8;
JiNeng JN6 = new JiNeng();
JN6.name = "六脉神剑";
JN6.shanghai = 4.2;
JiNenga.Add(JN1);
JiNenga.Add(JN2);
JiNenga.Add(JN3);
JiNenga.Add(JN4);
JiNenga.Add(JN5);
JiNenga.Add(JN6); #endregion #region 治疗
ArrayList ZL = new ArrayList();
ZhiLiao ZL1 = new ZhiLiao
{
name = "回天术",
HP =
};
ZhiLiao ZL2 = new ZhiLiao
{
name = "冲虚养气",
HP =
};
ZhiLiao ZL3 = new ZhiLiao
{
name = "春花秋月",
HP =
}; ZL.Add(ZL1);
ZL.Add(ZL2);
ZL.Add(ZL3); #endregion #region 创建人物
ChengXiang CX1 = new ChengXiang();
Console.Write("请输入第一个丞相的名称:");
CX1.name = Console.ReadLine(); CX1.minjie = RA.Next(, );
CX1.shanghai = RA.Next(, );
CX1.xueliang = RA.Next(, );
int zhuangb = RA.Next(, );
int hujia = RA.Next(, );
if(hujia <= )
{
Console.WriteLine(CX1.name + "获得了护甲:" + HJ3.name);
HJ3.hj += CX1.xueliang; }else if (hujia <= )
{
Console.WriteLine(CX1.name + "获得了护甲:" + HJ2.name);
HJ2.hj += CX1.xueliang;
}else if (hujia <= )
{
Console.WriteLine(CX1.name + "获得了护甲:" + HJ1.name);
HJ1.hj += CX1.xueliang;
}
else
{
Console.WriteLine("运气真差!");
} if (zhuangb <= )
{
Console.WriteLine(CX1.name + "获得了武器:" + ZB7.name);
ZB7.GongJi += CX1.shanghai; }
else if (zhuangb <= )
{
Console.WriteLine(CX1.name + "获得了武器:" + ZB6.name);
ZB6.GongJi += CX1.shanghai;
}
else if (zhuangb <= )
{
Console.WriteLine(CX1.name + "获得了武器:" + ZB5.name);
ZB5.GongJi += CX1.shanghai;
}
else if (zhuangb <= )
{
Console.WriteLine(CX1.name + "获得了武器:" + ZB1.name);
ZB1.GongJi += CX1.shanghai;
}
else if (zhuangb <= )
{
Console.WriteLine(CX1.name + "获得了武器:" + ZB4.name);
ZB4.GongJi += CX1.shanghai;
}
else if (zhuangb <= )
{
Console.WriteLine(CX1.name + "获得了武器:" + ZB3.name);
ZB3.GongJi += CX1.shanghai;
}
else if (zhuangb <= )
{
Console.WriteLine(CX1.name + "获得了武器:" + ZB2.name);
ZB2.GongJi += CX1.shanghai;
}
else
{
Console.WriteLine("哈哈哈,啥都没有");
} Console.WriteLine("丞相的名字为:" + CX1.name + " " + "攻击力为:" + CX1.shanghai + " " + "血量为:" + CX1.xueliang + "敏捷为:" + CX1.minjie); //第二个丞相
ChengXiang CX2 = new ChengXiang();
Console.Write("请输入第二个丞相的名称:");
CX2.name = Console.ReadLine(); CX2.minjie = RA.Next(, );
CX2.shanghai = RA.Next(, );
CX2.xueliang = RA.Next(, );
int zhuangb1 = RA.Next(, );
int hujia1 = RA.Next(, );
if (hujia1 <= )
{
Console.WriteLine(CX2.name + "获得了护甲:" + HJ3.name);
HJ3.hj += CX2.xueliang; }
else if (hujia1 <= )
{
Console.WriteLine(CX2.name + "获得了护甲:" + HJ2.name);
HJ2.hj += CX2.xueliang;
}
else if (hujia1 <= )
{
Console.WriteLine(CX2.name + "获得了护甲:" + HJ1.name);
HJ1.hj += CX2.xueliang;
}
else
{
Console.WriteLine("运气真差!");
} if (zhuangb1 <= )
{
Console.WriteLine(CX2.name + "获得了武器:" + ZB7.name);
ZB7.GongJi += CX2.shanghai; }
else if (zhuangb1 <= )
{
Console.WriteLine(CX2.name + "获得了武器:" + ZB6.name);
ZB6.GongJi += CX2.shanghai;
}
else if (zhuangb1 <= )
{
Console.WriteLine(CX2.name + "获得了武器:" + ZB5.name);
ZB5.GongJi += CX2.shanghai;
}
else if (zhuangb1 <= )
{
Console.WriteLine(CX2.name + "获得了武器:" + ZB1.name);
ZB1.GongJi += CX2.shanghai;
}
else if (zhuangb1 <= )
{
Console.WriteLine(CX2.name + "获得了武器:" + ZB4.name);
ZB4.GongJi += CX2.shanghai;
}
else if (zhuangb1 <= )
{
Console.WriteLine(CX2.name + "获得了武器:" + ZB3.name);
ZB3.GongJi += CX2.shanghai;
}
else if (zhuangb1 <= )
{
Console.WriteLine(CX2.name + "获得了武器:" + ZB2.name);
ZB2.GongJi += CX2.shanghai;
}
else
{
Console.WriteLine("哈哈哈,啥都没有");
}
Console.WriteLine("丞相的名字为:" + CX2.name + " " + "攻击力为:" + CX2.shanghai + " " + "血量为:" + CX2.xueliang + "敏捷为:" + CX2.minjie);
Console.WriteLine("请按任意键开始游戏");
Console.ReadKey(); #endregion #region 对战
while (true)
{ Console.ForegroundColor = ConsoleColor.White;
//对战第一个 if (CX1.minjie > CX2.minjie)
{
for (var s = ; s <= RA.Next(, ); s++)
{
int zhil = RA.Next(, );
int gongji = ;
int FDZ = RA.Next(, ); if (FDZ <= )
{
JiNeng DZ = (JiNeng)JiNenga[RA.Next(, JiNenga.Count)];
gongji = Convert.ToInt32(Program.GJ(CX1.shanghai) * DZ.shanghai);
CX2.xueliang = CX2.xueliang - gongji; Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(CX1.name + "发动了" + "〓〓〓〓" + DZ.name + "〓〓〓〓" + "打了" + gongji + "的伤害," + CX2.name + "剩余血量" + CX2.xueliang + "滴血"); Console.WriteLine();
System.Threading.Thread.Sleep();
}
else
{
Console.ForegroundColor = ConsoleColor.Green;
if (zhil <= )
{
Console.WriteLine(CX1.name + "发动了" + ZL3.name +" "+ "剩余血量:" + CX1.xueliang + "滴血");
ZL3.HP += CX1.xueliang;
}
else if (zhil <= )
{
Console.WriteLine(CX1.name + "发动了" + ZL2.name + " " + "剩余血量:" + CX1.xueliang + "滴血");
ZL2.HP += CX1.xueliang;
}
else if (zhil <= )
{
Console.WriteLine(CX1.name + "发动了" + ZL1.name + " " + "剩余血量:" + CX1.xueliang + "滴血");
ZL1.HP += CX1.xueliang;
} Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White;
gongji = GJ(CX1.shanghai);
CX2.xueliang = CX2.xueliang - gongji;
Console.WriteLine(CX1.name + "发动了普通攻击,打了" + gongji + "的伤害," + CX2.name + "剩余血量" + CX2.xueliang + "滴血"); Console.WriteLine();
System.Threading.Thread.Sleep();
} } //对战第二个
int zhil1 = RA.Next(, );
int gongji1 = ;
int FDZ1 = RA.Next(, );
if (FDZ1 <= )
{
JiNeng DZ = (JiNeng)JiNenga[RA.Next(, JiNenga.Count)];
gongji1 = Convert.ToInt32(Program.GJ(CX2.shanghai) * DZ.shanghai);
CX1.xueliang = CX1.xueliang - gongji1; Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine(CX2.name + "发动了" + "〓〓〓〓" + DZ.name + "〓〓〓〓" + "打了" + gongji1 + "的伤害," + CX1.name + "剩余血量" + CX1.xueliang + "滴血"); Console.WriteLine();
System.Threading.Thread.Sleep();
}
else
{
Console.ForegroundColor = ConsoleColor.Green;
if (zhil1 <= )
{
Console.WriteLine(CX2.name + "发动了" + ZL3.name + " " + "剩余血量:" + CX2.xueliang + "滴血");
ZL3.HP += CX2.xueliang;
}
else if (zhil1 <= )
{
Console.WriteLine(CX2.name + "发动了" + ZL2.name + " " + "剩余血量:" + CX2.xueliang + "滴血");
ZL2.HP += CX2.xueliang;
}
else if (zhil1 <= )
{
Console.WriteLine(CX2.name + "发动了" + ZL1.name + " " + "剩余血量:" + CX2.xueliang + "滴血");
ZL1.HP += CX2.xueliang;
} Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White;
gongji1 = Program.GJ(CX2.shanghai);
CX1.xueliang = CX1.xueliang - gongji1;
Console.WriteLine(CX2.name + "发动了普通攻击,打了" + gongji1 + "的伤害," + CX1.name + "剩余血量" + CX1.xueliang + "滴血"); Console.WriteLine();
System.Threading.Thread.Sleep();
} } else
{
for (var s = ; s <= RA.Next(, ); s++)
{
int zhil = RA.Next(, );
int gongji = ;
int FDZ = RA.Next(, );
if (FDZ <= )
{
JiNeng DZ = (JiNeng)JiNenga[RA.Next(, JiNenga.Count)];
gongji = Convert.ToInt32(Program.GJ(CX2.shanghai) * DZ.shanghai);
CX1.xueliang = CX1.xueliang - gongji; Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(CX2.name + "发动了" + "〓〓〓〓" + DZ.name + "〓〓〓〓" + "打了" + gongji + "的伤害," + CX1.name + "剩余血量" + CX1.xueliang + "滴血"); Console.WriteLine();
System.Threading.Thread.Sleep();
}
else
{
Console.ForegroundColor = ConsoleColor.Green;
if (zhil <= )
{
Console.WriteLine(CX1.name + "发动了" + ZL3.name + " " + "剩余血量:" + CX1.xueliang + "滴血");
ZL3.HP += CX1.xueliang;
}
else if (zhil <= )
{
Console.WriteLine(CX2.name + "发动了" + ZL2.name + " " + "剩余血量:" + CX1.xueliang + "滴血");
ZL2.HP += CX1.xueliang;
}
else if (zhil <= )
{
Console.WriteLine(CX2.name + "发动了" + ZL1.name + " " + "剩余血量:" + CX1.xueliang + "滴血");
ZL1.HP += CX1.xueliang;
} Console.WriteLine(); gongji = GJ(CX2.shanghai);
CX2.xueliang = CX2.xueliang - gongji; Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine(CX2.name + "发动了普通攻击,打了" + gongji + "的伤害," + CX1.name + "剩余血量" + CX1.xueliang + "滴血"); Console.WriteLine();
System.Threading.Thread.Sleep();
} } //对战第二个
int zhil1 = RA.Next(, );
int gongji1 = ;
int FDZ1 = RA.Next(, );
if (FDZ1 <= )
{
JiNeng DZ = (JiNeng)JiNenga[RA.Next(, JiNenga.Count)];
gongji1 = Convert.ToInt32(Program.GJ(CX1.shanghai) * DZ.shanghai);
CX2.xueliang = CX2.xueliang - gongji1;
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine(CX1.name + "发动了" + "〓〓〓〓" + DZ.name + "〓〓〓〓" + "打了" + gongji1 + "的伤害," + CX2.name + "剩余血量" + CX2.xueliang + "滴血"); Console.WriteLine();
System.Threading.Thread.Sleep();
}
else
{
Console.ForegroundColor = ConsoleColor.Green;
if (zhil1 <= )
{
Console.WriteLine(CX2.name + "发动了" + ZL3.name + " " + "剩余血量:" + CX2.xueliang + "滴血");
ZL3.HP += CX2.xueliang;
}
else if (zhil1 <= )
{
Console.WriteLine(CX2.name + "发动了" + ZL2.name + " " + "剩余血量:" + CX2.xueliang + "滴血");
ZL2.HP += CX2.xueliang;
}
else if (zhil1 <= )
{
Console.WriteLine(CX2.name + "发动了" + ZL1.name + " " + "剩余血量:" + CX2.xueliang + "滴血");
ZL1.HP += CX2.xueliang;
} Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White;
gongji1 = Program.GJ(CX1.shanghai);
CX2.xueliang = CX2.xueliang - gongji1;
Console.WriteLine(CX1.name + "发动了普通攻击,打了" + gongji1 + "的伤害," + CX2.name + "剩余血量" + CX2.xueliang + "滴血"); Console.WriteLine();
System.Threading.Thread.Sleep();
}
} //开始对战
Console.ForegroundColor = ConsoleColor.White;
if (CX1.xueliang <= || CX2.xueliang <= )
{
if (CX1.xueliang <= && CX2.xueliang <= )
{
Console.WriteLine("GM发动大招同归于尽!!");
}
else
{
if (CX2.xueliang <= )
{
Console.WriteLine("恭喜" + CX1.name + "取胜");
}
else
{
Console.WriteLine("恭喜" + CX2.name + "取胜");
}
}
break;
} }
Console.ReadKey();
}
#endregion #region 随机攻击力浮动
/// <summary>
/// 随机攻击力
/// </summary>
/// <param name="sh">攻击力浮动</param>
/// <returns></returns> public static int GJ(int sh)
{
int a = ;
Random r = new Random();
int b = r.Next(, );
int c = r.Next(, );
if (c == )
{
a = sh + b;
}
else
{
a = sh - b;
}
return a; }
#endregion }