推箱子

//只做了两关

    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 }

VS 游戏:推箱子&对战游戏的更多相关文章

  1. c语言游戏推箱子

    前两天做了推箱子小游戏,看似简单的一个小游戏背后却 有巨大的秘密,这秘密就是一大堆逻辑. 自从学习了函数过后,的确是解决了很多问题,而且调用很方便,尽管我现在都不是很会调用. 写完一个函数,准备测试一 ...

  2. C语言小游戏: 推箱子 支线(一)--1

    好家伙,考完试了 回顾一下2021 回顾一下某次的作业 妙啊 所以, 做一个推箱子小游戏 1.先去4399找一下关卡灵感 就它了 2.在百度上搜几篇推箱子, 参考其中的"■ ☆"图 ...

  3. C#小游戏(文字对战游戏)

    第一代,不是很完善,会在后续增加更多的功能 主: using System; using System.Collections.Generic; using System.Linq; using Sy ...

  4. c#部分---网吧充值系统;简易的闹钟;出租车计费;简单计算器;对战游戏;等额本金法计算贷款还款利息等;随机生成10个不重复的50以内的整数;推箱子;

    网吧充值系统namespace ConsoleApplication1 { class Program { struct huiyuan { public string name; public st ...

  5. C# 推箱子游戏&对战游戏

    推箱子游戏提纲,只有向右向上的操作,向左向下同理,后期需完善. namespace 推箱子 { class Program { static void Main(string[] args) { // ...

  6. JavaScript写一个小乌龟推箱子游戏

    推箱子游戏是老游戏了, 网上有各种各样的版本, 说下推箱子游戏的简单实现,以及我找到的一些参考视频和实例: 推箱子游戏的在线DEMO : 打开 如下是效果图: 这个拖箱子游戏做了移动端的适配, 我使用 ...

  7. 用C#制作推箱子小游戏

    思路分析: 一.制作一个地图 二.地图中放置墙.箱子.人.目标等 三.让小人动起来完成推箱子动作 游戏制作: 1.按照上述地图制作一个地图  (12行×13列) 地图可以看做是行和列组成的,即可以看做 ...

  8. [转]Flash ActionScript2.0面向对象游戏开发-推箱子

    本文转自:http://www.alixixi.com/Dev/W3C/Flash/2007/2007070868666.html 概述: Flash ActionScript2.0是一种面向对向的编 ...

  9. c++、c实现推箱子小游戏

    经过四次的修改和优化,终于将推箱子这个游戏完整的写出来了,今天就像大家分享一下这个游戏的编写. 这个游戏界面的编写总的来说不困难,主要是推动箱子的算法. (1)利用数组和windows api 即可写 ...

随机推荐

  1. Google的C++代码规范

      英文版:http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml 中文版:http://zh-google-styleguide ...

  2. loj #6121. 「网络流 24 题」孤岛营救问题

    #6121. 「网络流 24 题」孤岛营救问题   题目描述 1944 年,特种兵麦克接到国防部的命令,要求立即赶赴太平洋上的一个孤岛,营救被敌军俘虏的大兵瑞恩.瑞恩被关押在一个迷宫里,迷宫地形复杂, ...

  3. go 递归实现快排

    package main import ( "fmt" ) func main() { arr := []int{1,2,5,8,7,4,3,6,9,0,12,13,45,78,8 ...

  4. js去重方法

    function remove(array){ var obj={}; newarray=[]; for(var i in array){ console.log(i); var arg=array[ ...

  5. 2019.3.7考试T2 离线数论??

    $ \color{#0066ff}{ 题目描述 }$ 一天,olinr 在 luogu.org 刷题,一点提交,等了一分钟之后,又蛙又替. olinr 发动了他的绝招,说:"为啥啊???&q ...

  6. elasticsearch安装bigdest插件

    bigdest下载地址:https://github.com/hlstudio/bigdesk 对于bigdest插件来说,安装是非常简单的. 只要三个步骤就可以了,下载——解压——进入到_side文 ...

  7. 使用Jenkins进行Android自动打包,自定义版本号等信息【转】

    之前App在提交测试和最终部署的过程中App打包一直是由开发人员来完成的,由于项目比较大, 再加上Android打包本身就比较慢,所以每次打包还是很耗时的.并且按照严格的研发流程来讲,开发人员应该只负 ...

  8. oracle数据库操纵语言DML

    oracle数据库操纵语言:DML 添加数据: ()直接添加数据: insert into table_name(column_name1,column_name2,...) values(data1 ...

  9. pip不是内部或外部命令也不是可运行的程序或批处理文件的问题

    当我用windows电脑 pip install missingno 时 它居然会报pip不是内部或外部命令也不是可运行的程序或批处理文件的问题! 解决方法: 1)找到 pip.exe 所在位置,一般 ...

  10. Webstorm和 Eclipise 快捷键,慢慢总结下。

    Eclipise: 查找代码: ctrl + H 快速选择一行:                     shift + 下/shift + 上 到指定行: ctrl + L Webstorm: 查找 ...