加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
tip.c 1.99 KB
一键复制 编辑 原始数据 按行查看 历史
buzhibujue 提交于 2021-12-16 00:32 . Add card J.
#include "zgs.h" /*锦囊牌实现*/
extern int player_number, MP;
extern Pig player[MAX_PLAYER];
void use_f(int id,int recipient){/*决斗*/
printf("Player[%d] fight Player[%d]\n",id,recipient);
int x=can_use(id,'F');
use(id,x);
jump(id,recipient);
if(suc(id,recipient,0))
for(;;){
if(can_use(recipient,'K')&&(!player[recipient].is_human||will_use(recipient,'K'))){
use_kk(recipient);
}else {
hurt(recipient,id,1);
break;
}
if(can_use(id,'K')&&(!player[id].is_human||will_use(id,'K'))){
use_kk(id);
} else {
hurt(id,recipient,1);
break;
}
}
}
void use_n(int id){/*南蛮入侵*/
printf("Player[%d] use %s\n",id,CARD_NAME('N'));
int x=can_use(id,'N');
use(id,x);
for(int i=id%player_number+1;i!=id;i=i%player_number+1)if(!is_dead(i)&&(printf(" ->Player[%d]:\n",i),suc(id,i,0))){
if(can_use(i,'K')&&(!player[i].is_human||will_use(i,'K'))){
use_kk(i);
}else
hurt(i,id,0);
}
}
void use_w(int id){/*万箭齐发*/
printf("Player[%d] use %s\n",id,CARD_NAME('W'));
int x=can_use(id,'W');
use(id,x);
for(int i=id%player_number+1;i!=id;i=i%player_number+1)if(!is_dead(i)&&(printf(" ->Player[%d]:\n",i),suc(id,i,0))){
if(can_use(i,'D')&&(!player[i].is_human||will_use(i,'D'))){
use_d(i);
}else
hurt(i,id,0);
}
}
bool suc(int id,int rec,int tab){
for(int i=id%player_number+1;i!=id;i=i%player_number+1)if(!is_dead(i)&&can_use(i,'J')){
if(player[i].is_human){
if(will_use(i,'J')){
jump(i,id);
xyq(i,rec);
return !use_j(i,id,tab);
}
}else{
if((is_fp(rec)&&player[i].id=='F')||(is_zp(rec)&&(player[i].id=='Z'||player[i].id=='M'))){
jump(i,id);
xyq(i,rec);
return !use_j(i,id,tab);
}
}
}
return 1;
}
bool use_j(int id, int rec,int tab){/*无懈可击*/
for(int i=1;i<=tab;i++)putchar(' ');
printf("Player[%d] use %s against Player[%d]\n",id,CARD_NAME('J'),rec);
int x=can_use(id,'J');
use(id,x);
return suc(id,rec,tab+2);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化