代码拉取完成,页面将自动刷新
#include "zgs.h"
extern int player_number, MP;
extern Pig player[MAX_PLAYER];
extern char identity;
void show_my_card(int id){
printf("Identity:%s Health:%d Weapon:%s\n",ID_NAME(player[id].id),player[id].health,player[id].has_z?CARD_NAME('Z'):"None");
printf(" Cards: ");
for(int i=1;i<=player[id].card_number;i++)
printf("(#%d)%s ",i,CARD_NAME(player[id].card[i].type));
puts("");
}
void human_play(int id){
pick_card(id,2);
int opt;
bool flag=0;
while(!game_end()){
show_my_card(id);
puts("*Input number of card you want to use. -1 to end your play stage.");
do{
opt=read_number();
}while((opt<1||opt>player[id].card_number)&&opt!=-1);
if(opt==-1)
return;
Card card=player[id].card[opt];
switch(card.type){
case 'K':case 'F':{
if(card.type=='K'&&!player[id].has_z&&flag){
printf("You can only use 1 %s in 1 play stage.\n",CARD_NAME('K'));
continue;
}
if(card.type=='K'){
for(int i=1;i<=player_number;i++)if(!is_dead(i)&&i!=id&&dis(i,id)<=1){
show_pig(i,1);
}
}else{
for(int i=1;i<=player_number;i++)if(!is_dead(i)&&i!=id)
show_pig(i,1);
}
int r;
do{
printf("Choose who to %s,-1 to cancel\n",CARD_NAME(card.type));
r=read_number();
if(r<1||r>player_number||is_dead(r)||(card.type=='K'&&!can_use_k(id,r))){
printf("Can't use %s to Player[%d]\n",CARD_NAME(card.type),r);
}
}while((r<1||r>player_number||is_dead(r)||(card.type=='K'&&!can_use_k(id,r)))&&r!=-1);
if(r==-1){
continue;
}
if(card.type=='K') use_k(id,r),flag=1;
else use_f(id,r);
break;
}
case 'Z':{
use_z(id);
break;
}
case 'P':{
use_p(id);
break;
}
case 'W':{
use_w(id);
break;
}
case 'N':{
use_n(id);
break;
}
case 'D':case 'J':{
printf("You can't use %s now\n",CARD_NAME(card.type));
continue;
}
}
}
}
bool will_use(int id,char card){
printf("Use %s? Yy/Nn (Y/y: Yes N/n: No)\n",CARD_NAME(card));
char ch=getchar();
while(ch^'Y'&&ch^'N'&&ch^'y'&&ch^'n')
ch=getchar();
return ch=='Y'||ch=='y';
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。