魔幻牌小游戏
#include
#include
#include
#include
#include
using namespace std;
struct DG
{
char name[100];
int brick,jewel,monster,castle,rampart;//砖头 宝石 怪物 城堡 城墙
int brick_yield,jewel_yield,monster_yield;//砖头产量 宝石产量 怪物产量
};
DG input(DG &s)
{
cout<<setw(40)<<“设定双方城堡高度:”;
cin>>s.castle;
cout<<setw(40)<<“设定双方城墙高度:”;
cin>>s.rampart;
cout<<setw(41)<<“设置砖头的初始资源:”;
cin>>s.brick;
cout<<setw(41)<<“设置宝石的初始资源:”;
cin>>s.jewel;
cout<<setw(41)<<“设置怪物的初始资源:”;
cin>>s.monster;
cout<<setw(41)<<“设置砖头的初始产量:”;
cin>>s.brick_yield;
cout<<setw(41)<<“设置宝石的初始产量:”;
cin>>s.jewel_yield;
cout<<setw(41)<<“设置怪物的初始产量:”;
cin>>s.monster_yield;
}
void card(int n)//卡牌
{
switch(n)
{
case 1: cout<<"<生死抗争>(砖头0)双方同时失去8块砖头"<<endl;
break;
case 2: cout<<"<伟大矿工>(砖头3)砖头产量+1"<<endl;
break;
case 3: cout<<"<矿石之脉>(砖头4)如果砖头产量少于对手,则砖头产量+2,否则+1"<<endl;
break;
case 4: cout<<"<矮人之矿>(砖头7)城墙+1,砖头产量+1"<<endl;
break;
case 5: cout<<"<努力工作>(砖头2)城墙+5,宝石-6"<<endl;
break;
case 6: cout<<"<幻影之手>(砖头5)如果砖头产量少于对手,则砖头产量等于对手"<<endl;
break;
case 7: cout<<"<基础之墙>(砖头2)城墙+3"<<endl;
break;
case 8: cout<<"<稳固之墙>(砖头3)城墙+4"<<endl;
break;
case 9: cout<<"<迷幻之手>(宝石2)城堡+3"<<endl;
break;
case 10: cout<<"<魔法高手>(宝石3)宝石产量+1"<<endl;
break;
case 11: cout<<"<怪石缠身>(宝石5)城堡+3,这张牌不能换,只能使用"<<endl;
break;
case 12: cout<<"<阳光普照>(宝石4)城堡+2,对手城堡-2"<<endl;
break;
case 13: cout<<"<钻石魔阵>(宝石6)宝石产量+1,城堡+3,对手城堡+1"<<endl;
break;
case 14: cout<<"<宝石裂痕>(宝石2)对手城堡-3"<<endl;
break;
case 15: cout<<"<深红宝石>(宝石3)城堡+3"<<endl;
break;
case 16: cout<<"<水晶之矛>(宝石4)对手城堡-5"<<endl;
break;
case 17: cout<<"<凶恶蛮牛>(怪物0)双方怪物同时-6"<<endl;
break;
case 18: cout<<"<狂野蛮族>(怪物1)4点攻击,宝石-3"<<endl;
break;
case 19: cout<<"<百科全书>(怪物3)怪物产量+1"<<endl;
break;
case 20: cout<<"<敌我不分>(怪物3)6点攻击,己方遭受3点攻击"<<endl;
break;
case 21: cout<<"<野蛮射手>(怪物4)对手城堡-3,己方城堡-1"<<endl;
break;
case 22: cout<<"<食人巨魔>(怪物3)5点攻击"<<endl;
break;
case 23: cout<<"<矮人工匠>(怪物5)4点攻击,城墙+3"<<endl;
break;
case 24: cout<<"<灵蛇剧毒>(怪物6)对手城堡-4"<<endl;
break;
case 25: cout<<"<幸运宝藏>(砖头0)砖头+2,宝石+2,再次出牌"<<endl;
break;
case 26: cout<<"<友谊之地>(砖头1)城墙+1,再次出牌"<<endl;
break;
case 27: cout<<"<发明创造>(砖头2)双方砖头产量同时+1,你还得到4个宝石"<<endl;
break;
case 28: cout<<"<稳固基础>(砖头3)如果没有城墙,则城墙+6,否则城墙+3"<<endl;
break;
case 29: cout<<"<颤动之地>(砖头7)双方城墙同时-5,再次出牌"<<endl;
break;
case 30: cout<<"<神秘小屋>(砖头8)宝石产量+1,再次出牌"<<endl;
break;
case 31: cout<<"<山崩地裂>(砖头0)双方砖头产量同时-1"<<endl;
break;
case 32: cout<<"<雄伟之墙>(砖头5)城墙+6"<<endl;
break;
case 33: cout<<"<粉碎之锤>(砖头4)对手砖头产量-1"<<endl;
break;
case 34: cout<<"<完美工具>(砖头6)砖头产量+2"<<endl;
break;
case 35: cout<<"<矮人之锤>(砖头0)砖头产量-1,城墙+10,宝石+5"<<endl;
break;
case 36: cout<<"<神奇之石>(砖头8)城墙+8"<<endl;
break;
case 37: cout<<"<神秘之力>(砖头9)城墙+5,怪物产量+1"<<endl;
break;
case 38: cout<<"<奇幻宝石>(砖头9)城墙+7,宝石+7"<<endl;
break;
case 39: cout<<"<幻想乐曲>(砖头11)城墙+6,城堡+3"<<endl;
break;
case 40: cout<<"<牢不可破>(砖头13)城墙+12"<<endl;
break;
case 41: cout<<"<完美设计>(砖头15)城墙+8,城堡+5"<<endl;
break;
case 42: cout<<"<魔幻之墙>(砖头16)城墙+15"<<endl;
break;
case 43: cout<<"<巨石轰击>(砖头18)城墙+6,对手城墙-10"<<endl;
break;
case 44: cout<<"<神龙之心>(砖头24)城墙+20,城堡+8"<<endl;
break;
case 45: cout<<"<死命工作>(砖头7)城墙+9,怪物-5"<<endl;
break;
case 46: cout<<"<蓝色宝石>(宝石1)城堡+1,再次出牌"<<endl;
break;
case 47: cout<<"<奇幻之烟>(宝石2)对手城堡-1,再次出牌"<<endl;
break;
case 48: cout<<"<三棱魔镜>(宝石2)换一张牌后,再次出牌"<<endl;
break;
case 49: cout<<"<焚心之火>(宝石3)宝石产量+2,城堡-5"<<endl;
break;
case 50: cout<<"<忠诚代价>(宝石7)宝石产量+1,城堡+3,城墙+3"<<endl;
break;
case 51: cout<<"<公平竞争>(宝石7)双方宝石产量等于产量高的一方"<<endl;
break;
case 52: cout<<"<神奇翡翠>(宝石6)城堡+3"<<endl;
break;
case 53: cout<<"<智慧翡翠>(宝石9)宝石产量+1,城堡+5"<<endl;
break;
case 54: cout<<"<赌命狂徒>(宝石8)宝石产量-1,对手城堡-9"<<endl;
break;
case 55: cout<<"<崩溃之石>(宝石7)城堡+5,对手砖头-6"<<endl;
break;
case 56: cout<<"<蓝色水晶>(宝石10)城堡+11"<<endl;
break;
case 57: cout<<"<生死相斗>(宝石5)双方宝石产量同时-1,城堡同时-7"<<endl;
break;
case 58: cout<<"<幻火之石>(宝石13)城堡+6,对手城堡-4"<<endl;
break;
case 59: cout<<"<巨人奴仆>(宝石4)城堡+7,砖头-10"<<endl;
break;
case 60: cout<<"<水晶护体>(宝石12)城堡+8,城墙+3"<<endl;
break;
case 61: cout<<"<心领神会>(宝石14)城堡+8,怪物产量+1"<<endl;
break;
case 62: cout<<"<钻石永恒>(宝石16)城堡+15"<<endl;
break;
case 63: cout<<"<神圣领域>(宝石15)城堡+10,城墙+5,怪物+5"<<endl;
break;
case 64: cout<<"<岩浆飞溅>(宝石17)城堡+12,对手城堡-6"<<endl;
break;
case 65: cout<<"<神龙之眼>(宝石21)城堡+20"<<endl;
break;
case 66: cout<<"<魔幻宝石>(宝石8)城堡+11,城墙-6"<<endl;
break;
case 67: cout<<"<幻境仙女>(怪物1)2点攻击,再次出牌"<<endl;
break;
case 68: cout<<"<精灵密探>(怪物2)换一张牌后,再次出牌"<<endl;
break;
case 69: cout<<"<神奇仙女>(怪物6)对手城堡-2,再次出牌"<<endl;
break;
case 70: cout<<"<驯兽专家>(怪物7)怪物产量+2"<<endl;
break;
case 71: cout<<"<高塔之妖>(怪物8)2点攻击,城墙+4,城堡+2"<<endl;
break;
case 72: cout<<"<月圆之夜>(怪物0)双方怪物产量同时+1,你再得到3个怪物"<<endl;
break;
case 73: cout<<"<杀手无情>(怪物5)5点攻击"<<endl;
break;
case 74: cout<<"<嗜血巨魔>(怪物6)7点攻击"<<endl;
break;
case 75: cout<<"<恶灵魔兽>(怪物6)6点攻击,对手怪物-3"<<endl;
break;
case 76: cout<<"<恶鬼作怪>(怪物5)6点攻击,双方砖头、宝石和怪物同时-5"<<endl;
break;
case 77: cout<<"<喷火甲虫>(怪物8)对手没有城墙时10点攻击,否则6点攻击"<<endl;
break;
case 78: cout<<"<半人半狼>(怪物9)9点攻击"<<endl;
break;
case 79: cout<<"<冷血杀手>(怪物11)对手没有城墙时7点攻击,否则10点攻击"<<endl;
break;
case 80: cout<<"<独角神兽>(怪物9)宝石产量多余对手时12点攻击,否则8点"<<endl;
break;
case 81: cout<<"<精灵射手>(怪物10)城墙少于对手时6点攻击,否则对手城堡-6"<<endl;
break;
case 82: cout<<"<绝命女妖>(怪物14)对手城堡-5,怪物-8"<<endl;
break;
case 83: cout<<"<上古魔兽>(怪物11)8点攻击,对手砖头产量-1"<<endl;
break;
case 84: cout<<"<无影神偷>(怪物12)对手宝石-10,砖头-5,你得到其中一半"<<endl;
break;
case 85: cout<<"<岩石巨人>(怪物15)10点攻击,城墙+4"<<endl;
break;
case 86: cout<<"<吸血僵尸>(怪物17)10点攻击,对手怪物-5,怪物产量-1"<<endl;
break;
case 87: cout<<"<无敌天龙>(怪物25)20点攻击,对手宝石-10,怪物产量-1"<<endl;
break;
}
}
int Random(int m,int n)//随机
{
int pos,dis;
pos=m;
dis=n-m+1;
return rand()%dis+pos;
}
int p1(DG &s1,DG &s2,int t)//生死抗争 //卡牌功能
{
if(t0)
{
s1.brick-=8;
s2.brick-=8;
}
else
{
s1.brick-=8;
s2.brick-=8;
}
}
int p2(DG &s1,DG &s2,int t)//伟大矿工
{
if(t0)
{
s1.brick-=3;
s1.brick_yield+=1;
}
else
{
s2.brick-=3;
s2.brick_yield+=1;
}
}
int p3(DG &s1,DG &s2,int t)//矿石之脉
{
if(t0)
{
s1.brick-=4;
if(s1.brick_yield<s2.brick_yield) s1.brick_yield+=2;
else s1.brick_yield+=1;
}
else
{
s2.brick-=4;
if(s2.brick_yield<s1.brick_yield) s2.brick_yield+=2;
else s2.brick_yield+=1;
}
}
int p4(DG &s1,DG &s2,int t)//矮人之矿
{
if(t0)
{
s1.brick-=7;
s1.rampart+=1;
s1.brick_yield+=1;
}
else
{
s2.brick-=7;
s1.rampart+=1;
s2.brick_yield+=1;
}
}
int p5(DG &s1,DG &s2,int t)//努力工作
{
if(t0)
{
s1.brick-=2;
s1.rampart+=5;
s1.jewel-=6;
}
else
{
s2.brick-=2;
s2.rampart+=5;
s2.jewel-=6;
}
}
int p6(DG &s1,DG &s2,int t)//幻影之手
{
if(t0)
{
s1.brick-=5;
if(s1.brick_yield <s2.brick_yield)
s1.brick_yield=s2.brick_yield;
}
else
{
s2.brick-=5;
if(s2.brick_yield<s1.brick_yield)
s2.brick_yield=s1.brick_yield;
}
}
int p7(DG &s1,DG &s2,int t)//基础之盾
{
if(t0)
{
s1.brick-=2;
s1.rampart+=3;
}
else
{
s2.brick-=2;
s2.rampart+=3;
}
}
int p8(DG &s1,DG &s2,int t)//稳固之墙
{
if(t0)
{
s1.brick-=3;
s1.rampart+=4;
}
else
{
s2.brick-=3;
s2.rampart+=4;
}
}
int p9(DG &s1,DG &s2,int t)//迷幻之手
{
if(t0)
{
s1.jewel-=2;
s1.castle+=3;
}
else
{
s2.jewel-=2;
s2.castle+=3;
}
}
int p10(DG &s1,DG &s2,int t)//魔法高手
{
if(t0)
{
s1.jewel-=3;
s1.jewel_yield+=1;
}
else
{
s2.jewel-=3;
s2.jewel_yield+=1;
}
}
int p11(DG &s1,DG &s2,int t)//怪石缠身
{
if(t0)
{
s1.jewel-=5;
s1.castle+=3;
}
else
{
s2.jewel-=5;
s2.castle+=3;
}
}
int p12(DG &s1,DG &s2,int t)//阳光普照
{
if(t0)
{
s1.jewel-=4;
s1.castle+=2;
s2.castle-=2;
}
else
{
s2.jewel-=4;
s2.castle+=2;
s1.castle-=2;
}
}
int p13(DG &s1,DG &s2,int t)//钻石迷阵
{
if(t0)
{
s1.jewel-=6;
s1.jewel_yield+=1;
s1.castle+=3;
s2.castle+=1;
}
else
{
s2.jewel-=6;
s2.jewel_yield+=1;
s2.castle+=3;
s1.castle+=1;
}
}
int p14(DG &s1,DG &s2,int t)//宝石裂痕
{
if(t0)
{
s1.jewel-=2;
s2.castle-=3;
}
else
{
s2.jewel-=2;
s1.castle-=3;
}
}
int p15(DG &s1,DG &s2,int t)//深红宝石
{
if(t0)
{
s1.jewel-=3;
s1.castle+=3;
}
else
{
s2.jewel-=3;
s2.castle+=3;
}
}
int p16(DG &s1,DG &s2,int t)//水晶之矛
{
if(t0)
{
s1.jewel-=4;
s2.castle-=5;
}
else
{
s2.jewel-=4;
s1.castle-=5;
}
}
int p17(DG &s1,DG &s2,int t)//凶恶蛮牛
{
if(t0)
{
s1.monster-=6;
s2.monster-=6;
}
else
{
s1.monster-=6;
s2.monster-=6;
}
}
int p18(DG &s1,DG &s2,int t)//狂野蛮族
{
if(t0)
{
s1.monster-=1;
if(s2.rampart>=4) s2.rampart-=4;
else
{
s2.castle-=(4-s2.rampart);
s2.rampart=0;
}
s1.jewel-=3;
}
else
{
s2.monster-=1;
if(s1.rampart>=4) s1.rampart-=4;
else
{
s1.castle-=(4-s1.rampart);
s1.rampart=0;
}
s2.jewel-=3;
}
}
int p19(DG &s1,DG &s2,int t)//百科全书
{
if(t0)
{
s1.monster-=3;
s1.monster_yield+=1;
}
else
{
s2.monster-=3;
s2.monster_yield+=1;
}
}
int p20(DG &s1,DG &s2,int t)//敌我不分
{
if(t0)
{
s1.monster-=3;
if(s2.rampart>=6) s2.rampart-=6;
else s2.castle-=(6-s2.rampart);
if(s1.rampart>=3) s1.rampart-=3;
else s1.castle-=(3-s1.rampart);
}
else
{
s2.monster-=3;
if(s1.rampart>=6) s1.rampart-=6;
else
{
s1.castle-=(6-s1.rampart);
s1.rampart=0;
}
if(s2.rampart>=3) s2.rampart-=3;
else
{
s2.castle-=(3-s2.rampart);
s2.rampart=0;
}
}
}
int p21(DG &s1,DG &s2,int t)//野蛮射手
{
if(t0)
{
s1.monster-=4;
s2.castle-=3;
s1.castle-=1;
}
else
{
s2.monster-=4;
s1.castle-=3;
s2.castle-=1;
}
}
int p22(DG &s1,DG &s2,int t)//食人巨魔
{
if(t0)
{
s1.monster-=3;
if(s2.rampart>=5) s2.rampart-=5;
else
{
s2.castle-=(5-s2.rampart);
s2.rampart=0;
}
}
else
{
s2.monster-=3;
if(s1.rampart>=5) s1.rampart-=5;
else
{
s1.castle-=(5-s1.rampart);
s1.rampart=0;
}
}
}
int p23(DG &s1,DG &s2,int t)//矮人工匠
{
if(t0)
{
s1.monster-=5;
if(s2.rampart>=4) s2.rampart-=4;
else
{
s2.castle-=(4-s2.rampart);
s2.rampart=0;
}
s1.rampart+=3;
}
else
{
s2.monster-=5;
if(s1.rampart>=4) s1.rampart-=4;
else
{
s1.castle-=(4-s1.rampart);
s1.rampart=0;
}
s2.rampart+=3;
}
}
int p24(DG &s1,DG &s2,int t)//灵蛇剧毒
{
if(t0)
{
s1.monster-=6;
s2.castle-=4;
}
else
{
s2.monster-=6;
s1.castle-=4;
}
}
int p25(DG &s1,DG &s2,int t)//幸运宝箱
{
if(t0)
{
s1.brick+=2;
s1.jewel+=2;
}
else
{
s2.brick+=2;
s2.brick+=2;
}
}
int p26(DG &s1,DG &s2,int t)//友谊之地
{
if(t0)
{
s1.brick-=1;
s1.rampart+=1;
}
else
{
s2.brick-=1;
s2.rampart+=1;
}
}
int p27(DG &s1,DG &s2,int t)//发明创造
{
if(t0)
{
s1.brick-=2;
s1.brick_yield+=1;
s2.brick_yield+=1;
s1.jewel+=4;
}
else
{
s2.brick-=2;
s1.brick_yield+=1;
s2.brick_yield+=1;
s2.jewel+=4;
}
}
int p28(DG &s1,DG &s2,int t)//稳固基础
{
if(t0)
{
s1.brick-=3;
if(s1.rampart0) s1.rampart+=6;
else s1.rampart+=3;
}
else
{
s2.brick-=3;
if(s2.rampart0) s2.rampart+=6;
else s2.rampart+=3;
}
}
int p29(DG &s1,DG &s2,int t)//颤动之地
{
if(t0)
{
s1.brick-=7;
s1.rampart-=5;
s2.rampart-=5;
}
else
{
s2.brick-=7;
s1.rampart-=5;
s2.rampart-=5;
}
}
int p30(DG &s1,DG &s2,int t)// 神秘小屋
{
if(t0)
{
s1.brick-=8;
s1.jewel_yield+=1;
}
else
{
s2.brick-=8;
s2.jewel_yield+=1;
}
}
int p31(DG &s1,DG &s2,int t)//山崩地裂
{
if(t0)
{
s1.brick_yield-=1;
s2.brick_yield-=1;
}
else
{
s1.brick_yield-=1;
s2.brick_yield-=1;
}
}
int p32(DG &s1,DG &s2,int t)//雄伟之墙
{
if(t0)
{
s1.brick-=5;
s1.rampart+=6;
}
else
{
s2.brick-=5;
s2.rampart+=6;
}
}
int p33(DG &s1,DG &s2,int t)//粉碎之锤
{
if(t0)
{
s1.brick-=4;
s2.brick_yield-=1;
}
else
{
s2.brick-=4;
s1.brick_yield-=1;
}
}
int p34(DG &s1,DG &s2,int t)//完美工具
{
if(t0)
{
s1.brick-=6;
s1.brick_yield+=2;
}
else
{
s2.brick-=6;
s2.brick_yield+=2;
}
}
int p35(DG &s1,DG &s2,int t)//矮人之锤
{
if(t0)
{
s1.brick_yield-=1;
s1.rampart+=10;
s1.jewel+=5;
}
else
{
s2.brick_yield-=1;
s2.rampart+=10;
s2.jewel+=5;
}
}
int p36(DG &s1,DG &s2,int t)//神奇之石
{
if(t0)
{
s1.brick-=8;
s1.rampart+=8;
}
else
{
s2.brick-=8;
s2.rampart+=8;
}
}
int p37(DG &s1,DG &s2,int t)//神秘之力
{
if(t0)
{
s1.brick-=9;
s1.rampart+=5;
s1.monster_yield+=1;
}
else
{
s2.brick-=9;
s2.rampart+=5;
s2.monster_yield+=1;
}
}
int p38(DG &s1,DG &s2,int t)//奇幻宝石
{
if(t0)
{
s1.brick-=9;
s1.rampart+=7;
s1.jewel+=7;
}
else
{
s2.brick-=9;
s2.rampart+=7;
s2.jewel+=7;
}
}
int p39(DG &s1,DG &s2,int t)//幻想乐曲
{
if(t0)
{
s1.brick-=11;
s1.rampart+=6;
s1.castle+=3;
}
else
{
s2.brick-=11;
s2.rampart+=6;
s2.castle+=3;
}
}
int p40(DG &s1,DG &s2,int t)//牢不可破
{
if(t0)
{
s1.brick-=13;
s1.rampart+=12;
}
else
{
s2.brick-=13;
s2.rampart+=12;
}
}
int p41(DG &s1,DG &s2,int t)//完美设计
{
if(t0)
{
s1.brick-=15;
s1.rampart+=8;
s1.castle+=5;
}
else
{
s2.brick-=15;
s2.rampart+=8;
s2.castle+=5;
}
}
int p42(DG &s1,DG &s2,int t)//魔幻之墙
{
if(t0)
{
s1.brick-=16;
s1.rampart+=15;
}
else
{
s2.brick-=16;
s2.rampart+=15;
}
}
int p43(DG &s1,DG &s2,int t)//巨石轰击
{
if(t0)
{
s1.brick-=18;
s1.rampart+=6;
s2.rampart-=10;
}
else
{
s2.brick-=18;
s2.rampart+=6;
s1.rampart-=10;
}
}
int p44(DG &s1,DG &s2,int t)//神龙之心
{
if(t0)
{
s1.brick-=24;
s1.rampart+=20;
s1.castle+=8;
}
else
{
s2.brick-=24;
s2.rampart+=20;
s2.castle+=8;
}
}
int p45(DG &s1,DG &s2,int t)//死命工作
{
if(t0)
{
s1.brick-=7;
s1.rampart+=9;
s1.monster-=5;
}
else
{
s2.brick-=7;
s2.rampart+=9;
s2.monster-=5;
}
}
int p46(DG &s1,DG &s2,int t)//蓝色宝石
{
if(t0)
{
s1.jewel-=1;
s1.castle+=1;
}
else
{
s2.jewel-=1;
s2.castle+=1;
}
}
int p47(DG &s1,DG &s2,int t)//奇幻之烟
{
if(t0)
{
s1.jewel-=2;
s2.castle-=1;
}
else
{
s2.jewel-=2;
s1.castle-=1;
}
}
int p48(DG &s1,DG &s2,int t)//三棱魔镜
{
if(t0)
{
s1.jewel-=2;
}
else
{
s2.jewel-=2;
}
}
int p49(DG &s1,DG &s2,int t)//焚心之火
{
if(t0)
{
s1.jewel-=3;
s1.jewel_yield+=2;
s1.castle-=5;
}
else
{
s2.jewel-=3;
s2.jewel_yield+=2;
s2.castle-=5;
}
}
int p50(DG &s1,DG &s2,int t)//忠诚代价
{
if(t0)
{
s1.jewel-=7;
s1.jewel_yield+=1;
s1.castle+=3;
s1.rampart+=3;
}
else
{
s2.jewel-=7;
s2.jewel_yield+=1;
s2.castle+=3;
s2.rampart+=3;
}
}
int p51(DG &s1,DG &s2,int t)//公平竞争
{
if(t0)
{
s1.jewel-=7;
if(s1.jewel_yield>s2.jewel_yield) s2.jewel_yield=s1.jewel_yield;
else s1.jewel_yield=s2.jewel_yield;
}
else
{
s2.jewel-=7;
if(s1.jewel_yield>s2.jewel_yield) s2.jewel_yield=s1.jewel_yield;
else s1.jewel_yield=s2.jewel_yield;
}
}
int p52(DG &s1,DG &s2,int t)//神奇翡翠
{
if(t0)
{
s1.jewel-=6;
s1.castle+=3;
}
else
{
s2.jewel-=6;
s2.castle+=3;
}
}
int p53(DG &s1,DG &s2,int t)//智慧翡翠
{
if(t0)
{
s1.jewel-=9;
s1.jewel_yield+=1;
s1.castle+=5;
}
else
{
s2.jewel-=9;
s2.jewel_yield+=1;
s2.castle+=5;
}
}
int p54(DG &s1,DG &s2,int t)//赌命狂徒
{
if(t0)
{
s1.jewel-=8;
s1.jewel_yield-=1;
s2.castle-=9;
}
else
{
s2.jewel-=8;
s2.jewel_yield-=1;
s1.castle-=9;
}
}
int p55(DG &s1,DG &s2,int t)//崩溃之石
{
if(t0)
{
s1.jewel-=7;
s1.castle+=5;
s2.brick-=6;
}
else
{
s2.jewel-=7;
s2.castle+=5;
s1.brick-=6;
}
}
int p56(DG &s1,DG &s2,int t)//蓝色水晶
{
if(t0)
{
s1.jewel-=10;
s1.castle+=11;
}
else
{
s2.jewel-=10;
s2.castle+=11;
}
}
int p57(DG &s1,DG &s2,int t)//生死相斗
{
if(t0)
{
s1.jewel-=5;
s1.jewel_yield-=1;
s2.jewel_yield-=1;
s1.castle-=7;
s2.castle-=7;
}
else
{
s2.jewel-=5;
s1.jewel_yield-=1;
s2.jewel_yield-=1;
s1.castle-=7;
s2.castle-=7;
}
}
int p58(DG &s1,DG &s2,int t)//欢火之石
{
if(t0)
{
s1.jewel-=13;
s1.castle+=6;
s2.castle-=4;
}
else
{
s2.jewel-=13;
s2.castle+=6;
s1.castle-=4;
}
}
int p59(DG &s1,DG &s2,int t)//巨人奴仆
{
if(t0)
{
s1.jewel-=4;
s1.castle+=7;
s1.brick-=10;
}
else
{
s2.jewel-=4;
s2.castle+=7;
s2.brick-=10;
}
}
int p60(DG &s1,DG &s2,int t)//水晶护体
{
if(t0)
{
s1.jewel-=12;
s1.castle+=8;
s1.rampart+=3;
}
else
{
s2.jewel-=12;
s2.castle+=8;
s2.rampart+=3;
}
}
int p61(DG &s1,DG &s2,int t)//心领神会
{
if(t0)
{
s1.jewel-=14;
s1.castle+=8;
s1.monster_yield+=1;
}
else
{
s2.jewel-=14;
s2.castle+=8;
s2.monster_yield+=1;
}
}
int p62(DG &s1,DG &s2,int t)//钻石永恒
{
if(t0)
{
s1.jewel-=16;
s1.castle+=15;
}
else
{
s2.jewel-=16;
s2.castle+=15;
}
}
int p63(DG &s1,DG &s2,int t)//神圣领域
{
if(t0)
{
s1.jewel-=15;
s1.castle+=10;
s1.rampart+=5;
s1.monster+=5;
}
else
{
s2.jewel-=15;
s2.castle+=10;
s2.rampart+=5;
s2.monster+=5;
}
}
int p64(DG &s1,DG &s2,int t)//岩浆飞溅
{
if(t0)
{
s1.jewel-=17;
s1.castle+=12;
s2.castle-=6;
}
else
{
s2.jewel-=17;
s2.castle+=12;
s1.castle-=6;
}
}
int p65(DG &s1,DG &s2,int t)//神龙之眼
{
if(t0)
{
s1.jewel-=20;
s1.castle+=20;
}
else
{
s2.jewel-=20;
s2.castle+=20;
}
}
int p66(DG &s1,DG &s2,int t)//魔幻宝石
{
if(t0)
{
s1.jewel-=8;
s1.castle+=11;
s1.rampart-=6;
}
else
{
s2.jewel-=8;
s2.castle+=11;
s2.rampart-=6;
}
}
int p67(DG &s1,DG &s2,int t)//幻境仙女
{
if(t0)
{
s1.monster-=1;
if(s2.rampart>=2) s2.rampart-=2;
else
{
s2.castle-=(2-s2.rampart);
s2.rampart=0;
}
}
else
{
s2.monster-=1;
if(s1.rampart>=2) s1.rampart-=2;
else
{
s1.castle-=(2-s1.rampart);
s1.rampart=0;
}
}
}
int p68(DG &s1,DG &s2,int t)//精灵密探
{
if(t0)
{
s1.monster-=2;
}
else
{
s2.monster-=2;
}
}
int p69(DG &s1,DG &s2,int t)//神奇仙女
{
if(t0)
{
s1.monster-=6;
s2.castle-=2;
}
else
{
s2.monster-=6;
s1.castle-=2;
}
}
int p70(DG &s1,DG &s2,int t)//驯兽专家
{
if(t0)
{
s1.monster-=7;
s1.monster_yield+=2;
}
else
{
s2.monster-=7;
s2.monster_yield+=2;
}
}
int p71(DG &s1,DG &s2,int t)// 高塔之跃
{
if(t0)
{
s1.monster-=8;
s1.rampart+=4;
s1.castle+=2;
if(s2.rampart>=2) s2.rampart-=2;
else
{
s2.castle-=(2-s2.rampart);
s2.rampart=0;
}
}
else
{
s2.monster-=8;
s2.rampart+=4;
s2.castle+=2;
if(s1.rampart>=2) s1.rampart-=2;
else
{
s1.castle-=(2-s1.rampart);
s1.rampart=0;
}
}
}
int p72(DG &s1,DG &s2,int t)// 月圆之夜
{
if(t0)
{
s1.monster_yield+=1;
s2.monster_yield+=1;
s1.monster+=3;
}
else
{
s2.monster_yield+=1;
s1.monster_yield+=1;
s2.monster+=3;
}
}
int p73(DG &s1,DG &s2,int t)// 杀手无情
{
if(t0)
{
s1.monster-=5;
if(s2.rampart>=5) s2.rampart-=5;
else
{
s2.castle-=(5-s2.rampart);
s2.rampart=0;
}
}
else
{
s2.monster-=5;
if(s1.rampart>=5) s1.rampart-=5;
else
{
s1.castle-=(5-s1.rampart);
s1.rampart=0;
}
}
}
int p74(DG &s1,DG &s2,int t)// 嗜血巨魔
{
if(t0)
{
s1.monster-=6;
if(s2.rampart>=7) s2.rampart-=7;
else
{
s2.castle-=(7-s2.rampart);
s2.rampart=0;
}
}
else
{
s2.monster-=6;
if(s1.rampart>=7) s1.rampart-=7;
else
{
s1.castle-=(7-s1.rampart);
s1.rampart=0;
}
}
}
int p75(DG &s1,DG &s2,int t)// 恶灵魔兽
{
if(t0)
{
s1.monster-=6;
s2.monster-=3;
if(s2.rampart>=6) s2.rampart-=6;
else
{
s2.castle-=(6-s2.rampart);
s2.rampart=0;
}
}
else
{
s2.monster-=6;
s1.monster-=3;
if(s1.rampart>=6) s1.rampart-=6;
else
{
s1.castle-=(6-s1.rampart);
s1.rampart=0;
}
}
}
int p76(DG &s1,DG &s2,int t)// 恶鬼作怪
{
if(t0)
{
s1.monster-=5;
s1.brick-=5;
s1.jewel-=5;
s1.monster-=5;
s2.brick-=5;
s2.jewel-=5;
s2.monster-=5;
if(s2.rampart>=6) s2.rampart-=6;
else
{
s2.castle-=(6-s2.rampart);
s2.rampart=0;
}
}
else
{
s2.monster-=5;
s1.brick-=5;
s1.jewel-=5;
s1.monster-=5;
s2.brick-=5;
s2.jewel-=5;
s2.monster-=5;
if(s1.rampart>=6) s1.rampart-=6;
else
{
s1.castle-=(6-s1.rampart);
s1.rampart=0;
}
}
}
int p77(DG &s1,DG &s2,int t)// 喷火甲虫
{
if(t0)
{
s1.monster-=8;
if(s2.rampart0) s2.castle-=10;
else
{
if(s2.rampart>=6) s2.rampart-=6;
else
{
s2.castle-=(6-s2.rampart);
s2.rampart=0;
}
}
}
else
{
s2.monster-=8;
if(s1.rampart0) s1.castle-=10;
else
{
if(s1.rampart>=6) s1.rampart-=6;
else
{
s1.castle-=(6-s1.rampart);
s1.rampart=0;
}
}
}
}
int p78(DG &s1,DG &s2,int t)// 半人半狼
{
if(t0)
{
s1.monster-=9;
if(s2.rampart>=9) s2.rampart-=9;
else
{
s2.castle-=(9-s2.rampart);
s2.rampart=0;
}
}
else
{
s2.monster-=9;
if(s1.rampart>=9) s1.rampart-=9;
else
{
s1.castle-=(9-s1.rampart);
s1.rampart=0;
}
}
}
int p79(DG &s1,DG &s2,int t)// 冷血杀手
{
if(t0)
{
s1.monster-=11;
if(s2.rampart0) s2.castle-=7;
else
{
if(s2.rampart>=10) s2.rampart-=10;
else
{
s2.castle-=(10-s2.rampart);
s2.rampart=0;
}
}
}
else
{
s2.monster-=11;
if(s1.rampart0) s1.castle-=7;
else
{
if(s1.rampart>=10) s1.rampart-=10;
else
{
s1.castle-=(10-s1.rampart);
s1.rampart=0;
}
}
}
}
int p80(DG &s1,DG &s2,int t)// 独角神兽
{
if(t0)
{
s1.monster-=9;
if(s1.jewel_yield>s2.jewel_yield)
{
if(s2.rampart>=12) s2.rampart-=12;
else
{
s2.castle-=(12-s2.rampart);
s2.rampart=0;
}
}
else
{
if(s2.rampart>=8) s2.rampart-=8;
else
{
s2.castle-=(8-s2.rampart);
s2.rampart=0;
}
}
}
else
{
s2.monster-=9;
if(s2.jewel_yield>s1.jewel_yield)
{
if(s1.rampart>=12) s1.rampart-=12;
else
{
s1.castle-=(12-s1.rampart);
s1.rampart=0;
}
}
else
{
if(s1.rampart>=8) s1.rampart-=8;
else
{
s1.castle-=(8-s1.rampart);
s1.rampart=0;
}
}
}
}
int p81(DG &s1,DG &s2,int t)// 精灵射手
{
if(t0)
{
s1.monster-=10;
if(s1.rampart<s2.rampart)
{
if(s1.rampart>=6) s1.rampart-=6;
else
{
s1.castle-=(6-s1.rampart);
s1.rampart=0;
}
}
else s2.castle-=6;
}
else
{
s2.monster-=10;
if(s2.rampart<s1.rampart)
{
if(s2.rampart>=6) s2.rampart-=6;
else
{
s2.castle-=(6-s2.rampart);
s2.rampart=0;
}
}
else s1.castle-=6;
}
}
int p82(DG &s1,DG &s2,int t)// 绝命女妖
{
if(t0)
{
s1.monster-=14;
s2.castle-=5;
s2.monster-=8;
}
else
{
s2.monster-=14;
s1.castle-=5;
s1.monster-=8;
}
}
int p83(DG &s1,DG &s2,int t)// 上古魔兽
{
if(t0)
{
s1.monster-=11;
s2.brick_yield-=1;
if(s2.rampart>=8) s2.rampart-=8;
else
{
s2.castle-=(8-s2.rampart);
s2.rampart=0;
}
}
else
{
s2.monster-=11;
s1.brick_yield-=1;
if(s1.rampart>=8) s1.rampart-=8;
else
{
s1.castle-=(8-s1.rampart);
s1.rampart=0;
}
}
}
int p84(DG &s1,DG &s2,int t)// 无影神偷
{
if(t0)
{
s1.monster-=12;
s2.jewel-=10;
s2.brick-=5;
s1.brick+=2;
s1.jewel+=5;
}
else
{
s2.monster-=12;
s1.jewel-=10;
s1.brick-=5;
s2.brick+=2;
s2.jewel+=5;
}
}
int p85(DG &s1,DG &s2,int t)// 岩石巨魔
{
if(t0)
{
s1.monster-=15;
s1.rampart+=4;
if(s2.rampart>=10) s2.rampart-=10;
else
{
s2.castle-=(10-s2.rampart);
s2.rampart=0;
}
}
else
{
s2.monster-=15;
s2.rampart+=4;
if(s1.rampart>=10) s1.rampart-=10;
else
{
s1.castle-=(10-s1.rampart);
s1.rampart=0;
}
}
}
int p86(DG &s1,DG &s2,int t)// 吸血僵尸
{
if(t0)
{
s1.monster-=17;
s2.monster-=5;
s2.monster_yield-=1;
if(s2.rampart>=10) s2.rampart-=10;
else
{
s2.castle-=(10-s2.rampart);
s2.rampart=0;
}
}
else
{
s2.monster-=17;
s1.monster-=5;
s1.monster_yield-=1;
if(s1.rampart>=10) s1.rampart-=10;
else
{
s1.castle-=(10-s1.rampart);
s1.rampart=0;
}
}
}
int p87(DG &s1,DG &s2,int t)// 无敌天龙
{
if(t0)
{
s1.monster-=25;
s2.jewel-=10;
s2.monster_yield-=1;
if(s2.rampart>=20) s2.rampart-=20;
else
{
s2.castle-=(20-s2.rampart);
s2.rampart=0;
}
}
else
{
s2.monster-=25;
s1.jewel-=10;
s1.monster_yield-=1;
if(s1.rampart>=20) s1.rampart-=20;
else
{
s1.castle-=(20-s1.rampart);
s1.rampart=0;
}
}
}
int card_use(DG &s1,DG &s2,int n,int t)//出牌
{
switch(n)
{
case 1: p1(s1,s2,t);
break;
case 2: p2(s1,s2,t);
break;
case 3: p3(s1,s2,t);
break;
case 4: p4(s1,s2,t);
break;
case 5: p5(s1,s2,t);
break;
case 6: p6(s1,s2,t);
break;
case 7: p7(s1,s2,t);
break;
case 8: p8(s1,s2,t);
break;
case 9: p9(s1,s2,t);
break;
case 10: p10(s1,s2,t);
break;
case 11: p11(s1,s2,t);
break;
case 12: p12(s1,s2,t);
break;
case 13: p13(s1,s2,t);
break;
case 14: p14(s1,s2,t);
break;
case 15: p15(s1,s2,t);
break;
case 16: p16(s1,s2,t);
break;
case 17: p17(s1,s2,t);
break;
case 18: p18(s1,s2,t);
break;
case 19: p19(s1,s2,t);
break;
case 20: p20(s1,s2,t);
break;
case 21: p21(s1,s2,t);
break;
case 22: p22(s1,s2,t);
break;
case 23: p23(s1,s2,t);
break;
case 24: p24(s1,s2,t);
break;
case 25: p25(s1,s2,t);
break;
case 26: p26(s1,s2,t);
break;
case 27: p27(s1,s2,t);
break;
case 28: p28(s1,s2,t);
break;
case 29: p29(s1,s2,t);
break;
case 30: p30(s1,s2,t);
break;
case 31: p31(s1,s2,t);
break;
case 32: p32(s1,s2,t);
break;
case 33: p33(s1,s2,t);
break;
case 34: p34(s1,s2,t);
break;
case 35: p35(s1,s2,t);
break;
case 36: p36(s1,s2,t);
break;
case 37: p37(s1,s2,t);
break;
case 38: p38(s1,s2,t);
break;
case 39: p39(s1,s2,t);
break;
case 40: p40(s1,s2,t);
break;
case 41: p41(s1,s2,t);
break;
case 42: p42(s1,s2,t);
break;
case 43: p43(s1,s2,t);
break;
case 44: p44(s1,s2,t);
break;
case 45: p45(s1,s2,t);
break;
case 46: p46(s1,s2,t);
break;
case 47: p47(s1,s2,t);
break;
case 48: p48(s1,s2,t);
break;
case 49: p49(s1,s2,t);
break;
case 50: p50(s1,s2,t);
break;
case 51: p51(s1,s2,t);
break;
case 52: p52(s1,s2,t);
break;
case 53: p53(s1,s2,t);
break;
case 54: p54(s1,s2,t);
break;
case 55: p55(s1,s2,t);
break;
case 56: p56(s1,s2,t);
break;
case 57: p57(s1,s2,t);
break;
case 58: p58(s1,s2,t);
break;
case 59: p59(s1,s2,t);
break;
case 60: p60(s1,s2,t);
break;
case 61: p61(s1,s2,t);
break;
case 62: p62(s1,s2,t);
break;
case 63: p63(s1,s2,t);
break;
case 64: p64(s1,s2,t);
break;
case 65: p65(s1,s2,t);
break;
case 66: p66(s1,s2,t);
break;
case 67: p67(s1,s2,t);
break;
case 68: p68(s1,s2,t);
break;
case 69: p69(s1,s2,t);
break;
case 70: p70(s1,s2,t);
break;
case 71: p71(s1,s2,t);
break;
case 72: p72(s1,s2,t);
break;
case 73: p73(s1,s2,t);
break;
case 74: p74(s1,s2,t);
break;
case 75: p75(s1,s2,t);
break;
case 76: p76(s1,s2,t);
break;
case 77: p77(s1,s2,t);
break;
case 78: p78(s1,s2,t);
break;
case 79: p79(s1,s2,t);
break;
case 80: p80(s1,s2,t);
break;
case 81: p81(s1,s2,t);
break;
case 82: p82(s1,s2,t);
break;
case 83: p83(s1,s2,t);
break;
case 84: p84(s1,s2,t);
break;
case 85: p85(s1,s2,t);
break;
case 86: p86(s1,s2,t);
break;
case 87: p87(s1,s2,t);
break;
}
}
bool judge(int s[],int n,int k)
{
int i;
for(i=1;i<n;i++)
if(ks[i]) return 1;
return 0;
}
int main()
{
system(“mode con cols=80 lines=25”);
DG s1,s2,s3,s4;
int T,judge_yield,judge_castle,judge_sum,M;
int p1[10],p2[10],s[10],a[10],b[10];
int i,j,k,q,p,row,col,m,n,m1,m2,n1,n2,sum,N;
srand(time(0));
cout<<“魔幻牌游戏规则:”<<endl;
cout<<“1.输入双方名字,游戏开始,随机发给双方各6张牌。”<<endl;
cout<<“2.城堡和城墙用字符排列的矩形表示,出牌方的手牌内容按行输出。”<<endl;
cout<<“3.每回合先按产量生产资源,然后提示某方出牌,输入手牌的序号完成出牌。”<<endl;
cout<<“4.资源不足的牌不允许出,可以弃牌,无牌可出必须弃牌一张。”<<endl;
cout<<“5.出牌后自动抓取一张牌,刷新界面,”<<endl;
cout<<“6.显示出牌后的数值效果。发牌和抓牌都是随机的,卡牌可以多次使用。”<<endl;
cout<<“7.当某方达到胜利条件时,宣布某方胜利;或者当达到某回合时,宣布平局,结束游戏。” <<endl;
system(“pause”);
system(“cls”);
system(“cls”);
cout<<setw(40)<<“输入一号玩家名称:”;
cin>>s1.name;
cout<<setw(40)<<“输入二号玩家名称:”;
cin>>s2.name;
cout<<setw(20)<<" "<<“按1进入配置资源,按2使用默认资源”;
cin>>T;
system(“cls”);
if(T1)
{
input(s1);
s2.brick=s1.brick;
s2.brick_yield=s1.brick_yield;
s2.castle=s1.castle;
s2.jewel=s1.jewel;
s2.jewel_yield=s1.jewel_yield;
s2.monster=s1.monster;
s2.monster_yield=s1.monster_yield;
s2.rampart=s1.rampart;
cout<<setw(40)<<“设置资源总量目标:”;
cin>>judge_yield;
cout<<setw(40)<<“设置城堡高度目标:”;
cin>>judge_castle;
cout<<setw(40)<<“设置平局回合数:”;
cin>>judge_sum;
}
else
{
s2.brick=s1.brick=10;
s2.brick_yield=s1.brick_yield=2;
s2.castle=s1.castle=25;
s2.jewel=s1.jewel=10;
s2.jewel_yield=s1.jewel_yield=2;
s2.monster=s1.monster=10;
s2.monster_yield=s1.monster_yield=2;
s2.rampart=s1.rampart=10;
judge_yield=50;
judge_castle=50;
judge_sum=30;
}
for(i=1;i<=6;i++)
{
p1[i]=Random(1,87);
}
for(i=1;i<=6;i++)
{
p2[i]=Random(1,87);
}
for(i=0;i<2*judge_sum;i++)
{
sum=i/2+1;
s3=s1;
s4=s2;
system(“cls”);
cout<<setw(10)<<" “<<s1.name<<setw(25)<<“回合(”<<sum<<”/"<<judge_sum<<")"<<setw(25)<<s2.name<<endl;
cout<<“砖头”<<s1.brick<<"(+"<<s1.brick_yield<<")"<<setw(6)<<“宝石”<<s1.jewel<<"(+"<<s1.jewel_yield<<")"<<setw(6)<<“怪物”<<s1.monster<<"(+"<<s1.monster_yield<<")";
cout<<setw(15)<<“砖头”<<s2.brick<<"(+"<<s2.brick_yield<<")"<<setw(6)<<“宝石”<<s2.jewel<<"(+"<<s2.jewel_yield<<")"<<setw(6)<<“怪物”<<s2.monster<<"(+"<<s2.monster_yield<<")"<<endl;
if(i%21)
{
if(s[0]==25||s[0]==26||s[0]==29||s[0]==30||s[0]==46||s[0]==47||s[0]==67||s[0]==69||s[0]==48||s[0]68)
{
cout<<setw(10)<<s2.name<<“上回合出牌:”;
card(s[0]);
}
else
{
if(judge(b,p,k))
{
cout<<setw(10)<<s1.name<<“上回合弃牌:”;
card(s[0]);
}
else
{
cout<<setw(10)<<s1.name<<“上回合出牌:”;
card(s[0]);
}
}
}
else
{
if(i/20)
{
cout<<setw(10)<<s1.name<<“上回合出牌:”;
card(s[0]);
}
else
{
if(s[0]==25||s[0]==26||s[0]==29||s[0]==30||s[0]==46||s[0]==47||s[0]==67||s[0]==69||s[0]==48||s[0]==68)
{
cout<<setw(10)<<s1.name<<“上回合出牌:”;
card(s[0]);
}
else
{
if(judge(b,p,k))
{
cout<<setw(10)<<s2.name<<“上回合弃牌”;
card(s[0]);
}
else
{
cout<<setw(10)<<s2.name<<“上回合出牌:”;
card(s[0]);
}
}
}
}
m1=s1.castle/5;
m2=s2.castle/5;
n1=s1.rampart/5;
n2=s2.rampart/5;
for(row=9;row>=0;row--)//输出
{
cout<<setw(10)<<" ";
if(m1<row) cout<<setw(5)<<" ";
else
{
if(m1==row)
{
for(k=0;k<s1.castle%5;k++)
cout<<"T";
cout<<setw(5-s1.castle%5)<<" ";
}
else cout<<"TTTTT";
}
cout<<setw(5)<<" ";
if(n1<row) cout<<setw(5)<<" ";
else
{
if(n1==row)
{
for(k=0;k<s1.rampart%5;k++)
cout<<"W";
cout<<setw(5-s1.rampart%5)<<" ";
}
else cout<<setw(5)<<"WWWWW";
}
cout<<setw(30)<<" ";
if(n2<row) cout<<setw(5)<<" ";
else
{
if(n2==row)
{
cout<<setw(5-s2.rampart%5)<<" ";
for(k=0;k<s2.rampart%5;k++)
cout<<"W";
}
else cout<<setw(5)<<"WWWWW";
}
cout<<setw(5)<<" ";
if(m2<row) cout<<setw(5)<<" "<<endl;
else
{
if(m2==row)
{
cout<<setw(5-s2.castle%5)<<" ";
for(k=0;k<s2.castle%5;k++)
cout<<"T";
cout<<endl;
}
else cout<<setw(5)<<"TTTTT"<<endl;
}
}
cout<<setw(10)<<" "<<s1.castle<<"/50"<<setw(7)<<" "<<s1.rampart<<setw(33)<<" "<<s2.rampart<<setw(6)<<" "<<s2.castle<<"/50"<<endl;
if(i%2==0)//player1出牌
{
cout<<s1.name<<"的手牌:"<<endl;
for(j=1;j<=6;j++)
{
cout<<j;
card(p1[j]);
}
cout<<s1.name<<"出牌(可出";
for(j=1,q=1,p=1;j<=6;j++)
{
card_use(s3,s4,p1[j],i%2);
if(s3.brick>=0&&s3.jewel>=0&&s3.monster>=0&&s3.brick_yield>=0&&s3.jewel_yield>=0&&s3.monster_yield>=0)
{
a[q]=j;
q++;
}
else
{
b[p]=j;
p++;
}
s3=s1;
s4=s2;
}
for(j=1;j<q;j++) cout<<a[j]<<",";
cout<<";可弃";
for(j=1;j<p;j++) cout<<b[j]<<",";
cout<<"):";
cin>>k;
if(k>=1&&k<=6)
{
if(judge(b,p,k))
{
s[0]=p1[k];
p1[k]=Random(1,87);
}
else
{
card_use(s1,s2,p1[k],i%2);
s[0]=p1[k];
if(p1[k]==25||p1[k]==26||p1[k]==29||p1[k]==30||p1[k]==46||p1[k]==47||p1[k]==67||p1[k]==69)
i--;
p1[k]=Random(1,87);
}
}
else
{
cout<<"重新输入:";
cin>>k;
}
if(s1.brick<0) s1.brick=0;
if(s1.jewel<0) s1.jewel=0;
if(s1.monster<0) s1.monster=0;
if(s2.brick<0) s2.brick=0;
if(s2.jewel<0) s2.jewel=0;
if(s2.monster<0) s2.monster=0;
if(s1.brick_yield<0) s1.brick_yield=0;
if(s1.jewel_yield<0) s1.jewel_yield=0;
if(s1.monster_yield<0) s1.monster_yield=0;
if(s2.brick_yield<0) s2.brick_yield=0;
if(s2.jewel_yield<0) s2.jewel_yield=0;
if(s2.monster_yield<0) s2.monster_yield=0;
if(s1.rampart<0) s1.rampart=0;
if(s2.rampart<0) s2.rampart=0;
if(s1.brick>=judge_yield&&s1.jewel>=judge_yield&&s1.monster>=judge_yield||s2.castle<=0||s1.castle>=judge_castle)
{
system("cls");
cout<<s1.name<<"win";
break;
}
if(s2.brick>=judge_yield&&s2.jewel>=judge_yield&&s2.monster>=judge_yield||s1.castle<=0||s2.castle>=judge_castle)
{
system("cls");
cout<<s2.name<<"win";
break;
}
}
else//player2出牌
{
cout<<s2.name<<"的手牌"<<endl;
for(j=1;j<=6;j++)
{
cout<<j;
card(p2[j]);
}
cout<<s2.name<<"出牌(可出";
for(j=1,q=1,p=1;j<=6;j++)
{
card_use(s3,s4,p2[j],i%2);
if(s4.brick>=0&&s4.jewel>=0&&s4.monster>=0&&s4.brick_yield>=0&&s4.jewel_yield>=0&&s4.monster_yield>=0)
{
a[q]=j;
q++;
}
else
{
b[p]=j;
p++;
}
s3=s1;
s4=s2;
}
for(j=1;j<q;j++) cout<<a[j]<<",";
cout<<"可弃";
for(j=1;j<p;j++) cout<<b[j]<<",";
cout<<"):";
cin>>k;
if(k>=1&&k<=6)
{
if(judge(b,p,k))
{
s[0]=p2[k];
p2[k]=Random(1,87);
}
else
{
card_use(s1,s2,p2[k],i%2);
s[0]=p2[k];
if(p2[k]==25||p2[k]==26||p2[k]==29||p2[k]==30||p2[k]==46||p2[k]==47||p2[k]==67||p2[k]==69)
i--;
p2[k]=Random(1,87);
}
}
else
{
cout<<"重新输入:";
cin>>k;
}
if(s1.brick<0) s1.brick=0;
if(s1.jewel<0) s1.jewel=0;
if(s1.monster<0) s1.monster=0;
if(s2.brick<0) s2.brick=0;
if(s2.jewel<0) s2.jewel=0;
if(s2.monster<0) s2.monster=0;
if(s1.brick_yield<0) s1.brick_yield=0;
if(s1.jewel_yield<0) s1.jewel_yield=0;
if(s1.monster_yield<0) s1.monster_yield=0;
if(s2.brick_yield<0) s2.brick_yield=0;
if(s2.jewel_yield<0) s2.jewel_yield=0;
if(s2.monster_yield<0) s2.monster_yield=0;
if(s1.rampart<0) s1.rampart=0;
if(s2.rampart<0) s2.rampart=0;
if(s[0]!=25&&s[0]!=26&&s[0]!=29&&s[0]!=30&&s[0]!=47&&s[0]!=67&&s[0]!=69&&s[0]!=48&&s[0]!=68)
{
s1.brick+=s1.brick_yield;
s1.jewel+=s1.jewel_yield;
s1.monster+=s1.monster_yield;
s2.brick+=s2.brick_yield;
s2.jewel+=s2.jewel_yield;
s2.monster+=s2.monster_yield;
}
if(s1.brick>=judge_yield&&s1.jewel>=judge_yield&&s1.monster>=judge_yield||s2.castle<=0||s1.castle>=judge_castle)
{
system("cls");
cout<<s1.name<<"win";
break;
}
if(s2.brick>=judge_yield&&s2.jewel>=judge_yield&&s2.monster>=judge_yield||s1.castle<=0||s2.castle>=judge_castle)
{
system("cls");
cout<<s2.name<<"win";
break;
}
}
if(sum==judge_sum)
{
system("cls");
cout<<"双方平局";
break;
}
}