1.技能3中的HP是最大生命值
2.(存疑)天赋2的附加伤害一次结算/分开结算?
3.回血时判断该角色死没死
4.技能10带来的游戏结束要在回合结束时判断
5.发动技能10要把所有人的技能10变成技能0
剩下的不知道了,代码先放这下次继续写
#include<bits/stdc++.h>
#define re register
using namespace std;
const int N=20,M=1e5;
int n,huihe,endA,endB;
int buffA[N][M];
int buffB[N][M];
struct node1{
int hp,id,shanghai;
}xtzqhy[N];
struct node{
int HP,hp;
int MP,mp;
int ATK,atk;
int DEF,def;
int atkorder[N];
int tf,x0,y0;
int jn,x,y,z;
int id;
}A[N],B[N];
inline bool cmp4(node1 a,node1 b){
if(a.hp==b.hp){
if(a.shanghai==b.shanghai){
return a.id>b.id;
}
return a.shanghai>b.shanghai;
}
return a.hp>b.hp;
}
inline node yichu(node a){
if(a.hp<0) a.hp=0;
if(a.mp<0) a.mp=0;
if(a.hp>a.HP) a.hp=a.HP;
if(a.mp>a.MP) a.mp=a.MP;
return a;
}
inline void couttf(int x){
switch(x){
case 0:cout<<"我自闭了"<<" ";break;
case 1:cout<<"血肉皮囊"<<" ";break;
case 2:cout<<"星河力量投射"<<" ";break;
case 3:cout<<"心胜于物"<<" ";break;
case 4:cout<<"超凡入圣"<<" ";break;
case 5:cout<<"科技至上"<<" ";break;
}
}
inline void coutjn(int x){
switch(x){
case 0:cout<<"心态崩了!"<<" ";break;
case 1:cout<<"格林炸裂!"<<" ";break;
case 2:cout<<"日昇之雨!"<<" ";break;
case 3:cout<<"天楼霸断剑!"<<" ";break;
case 4:cout<<"演出开始!"<<" ";break;
case 5:cout<<"天狼噬斩!"<<" ";break;
case 6:cout<<"地球蓝色闪电!"<<" ";break;
case 7:cout<<"极光绽放!"<<" ";break;
case 8:cout<<"流星!"<<" ";break;
case 9:cout<<"精灵庇护!"<<" ";break;
case 10:cout<<"全力超全开!轮回之终末!"<<" ";break;
}
}
inline void zhuangtai(){
cout<<"当前状态:"<<'\n';
cout<<"Alice:"<<'\n';
cout<<"是否受到“演出开始!”增益:";buffA[4][huihe]>0?cout<<"是":cout<<"否";
cout<<'\n';
cout<<"是否受到“极光绽放!”增益:";buffA[7][huihe]>0?cout<<"是":cout<<"否";
cout<<'\n';
cout<<"是否受到“精灵庇护!”增益:";buffA[9][huihe]>0?cout<<"是":cout<<"否";
cout<<'\n';
cout<<"是否受到“全力超全开!轮回之终末!”增益:";buffA[10][huihe]>0?cout<<"是":cout<<"否";
cout<<'\n';
cout<<"是否受到“地球蓝色闪电!”减益:";buffA[6][huihe]>0?cout<<"是":cout<<"否";
cout<<'\n';
cout<<"是否受到“流星!”减益:";buffA[8][huihe]>0?cout<<"是":cout<<"否";
cout<<'\n';
for(re int i=1;i<=n;++i){
A[i]=yichu(A[i]);
cout<<"第"<<i<<"位角色"<<'\n';
cout<<"血量:"<<A[i].hp<<"/"<<A[i].HP<<'\n';
cout<<"能量:"<<A[i].mp<<"/"<<A[i].MP<<'\n';
cout<<"基础攻击力:"<<A[i].ATK<<'\n';
cout<<"基础防御力:"<<A[i].DEF<<'\n';
cout<<"攻击力加成:"<<(A[i].atk+buffA[7][huihe]-buffA[6][huihe])<<'\n';
cout<<"防御力加成:"<<(A[i].def+buffA[9][huihe]-buffA[8][huihe])<<'\n';
cout<<"优先攻击目标:";
for(re int j=1;j<=n;++j){
if(B[A[i].atkorder[j]].hp>0){
cout<<B[A[i].atkorder[j]].id<<'\n';
break;
}
}
cout<<"天赋:";
couttf(A[i].tf);
if(A[i].x0!=0) cout<<A[i].x0<<" ";
if(A[i].y0!=0) cout<<A[i].y0<<" ";
cout<<'\n';
cout<<"技能:";
coutjn(A[i].jn);
if(A[i].x!=0) cout<<A[i].x<<" ";
if(A[i].y!=0) cout<<A[i].y<<" ";
if(A[i].z!=0) cout<<A[i].z<<" ";
cout<<'\n';
cout<<'\n';
}
cout<<"Bob:"<<'\n';
cout<<"是否受到“演出开始!”增益:";buffB[4][huihe]>0?cout<<"是":cout<<"否";
cout<<'\n';
cout<<"是否受到“极光绽放!”增益:";buffB[7][huihe]>0?cout<<"是":cout<<"否";
cout<<'\n';
cout<<"是否受到“精灵庇护!”增益:";buffB[9][huihe]>0?cout<<"是":cout<<"否";
cout<<'\n';
cout<<"是否受到“全力超全开!轮回之终末!”增益:";buffB[10][huihe]>0?cout<<"是":cout<<"否";
cout<<'\n';
cout<<"是否受到“地球蓝色闪电!”减益:";buffB[6][huihe]>0?cout<<"是":cout<<"否";
cout<<'\n';
cout<<"是否受到“流星!”减益:";buffB[8][huihe]>0?cout<<"是":cout<<"否";
cout<<'\n';
for(re int i=1;i<=n;++i){
B[i]=yichu(B[i]);
cout<<"第"<<i<<"位角色"<<'\n';
cout<<"血量:"<<B[i].hp<<"/"<<B[i].HP<<'\n';
cout<<"能量:"<<B[i].mp<<"/"<<B[i].MP<<'\n';
cout<<"基础攻击力:"<<B[i].ATK<<'\n';
cout<<"基础防御力:"<<B[i].DEF<<'\n';
cout<<"攻击力加成:"<<(B[i].atk+buffB[7][huihe]-buffB[6][huihe])<<'\n';
cout<<"防御力加成:"<<(B[i].def+buffB[9][huihe]-buffB[8][huihe])<<'\n';
cout<<"优先攻击目标:";
for(re int j=1;j<=n;++j){
if(A[B[i].atkorder[j]].hp>0){
cout<<A[B[i].atkorder[j]].id<<'\n';
break;
}
}
cout<<"天赋:";
couttf(B[i].tf);
if(B[i].x0!=0) cout<<B[i].x0<<" ";
if(B[i].y0!=0) cout<<B[i].y0<<" ";
cout<<'\n';
cout<<"技能:";
coutjn(B[i].jn);
if(B[i].x!=0) cout<<B[i].x<<" ";
if(B[i].y!=0) cout<<B[i].y<<" ";
if(B[i].z!=0) cout<<B[i].z<<" ";
cout<<'\n';
cout<<'\n';
}
}
inline void check(){
int cntA=0,cntB=0;
for(re int i=1;i<=n;++i){
A[i]=yichu(A[i]);
B[i]=yichu(B[i]);
if(A[i].hp<=0) cntA++;
if(B[i].hp<=0) cntB++;
}
if(cntA==cntB&&cntA==n){
cout<<"xtzqhy";
exit(0);
}
if(cntA==n){
cout<<huihe<<'\n';
cout<<"Bob"<<'\n';
for(re int i=1;i<=n;++i) cout<<B[i].hp<<" ";
exit(0);
}
if(cntB==n){
cout<<huihe<<'\n';
cout<<"Alice"<<'\n';
for(re int i=1;i<=n;++i) cout<<A[i].hp<<" ";
exit(0);
}
}
//6 atk减 7atk加 8def减 9def加 4mp加 10mp加
inline int AATK(node a){
return max(a.ATK+a.atk+buffA[7][huihe]-buffA[6][huihe],1);
}
inline int BATK(node b){
return max(b.ATK+b.atk+buffB[7][huihe]-buffB[6][huihe],1);
}
inline int ADEF(node a){
return max(a.DEF+a.def+buffA[9][huihe]-buffA[8][huihe],0);
}
inline int BDEF(node b){
return max(b.DEF+b.def+buffB[9][huihe]-buffB[8][huihe],0);
}
inline node kouxueA(node a,int shanghai,int zhenshang){
cout<<"Alice的第"<<a.id<<"位角色进入生命值扣除环节"<<'\n';
if(a.hp==0){
check();
cout<<"该角色已死亡!"<<'\n';
return a;
}
int D=ADEF(a);
int op=(max(shanghai-D,0)+zhenshang-zhenshang/2),po=(max(shanghai-D,0)+zhenshang);
if(a.tf==1) a.hp-=op,cout<<"Alice的第"<<a.id<<"位角色扣除"<<op<<"点生命值"<<'\n';
else a.hp-=po,cout<<"Alice的第"<<a.id<<"位角色扣除"<<po<<"点生命值"<<'\n';
check();
a.mp++;
yichu(a);
return a;
}
inline node kouxueB(node b,int shanghai,int zhenshang){
cout<<"Bob的第"<<b.id<<"位角色进入生命值扣除环节"<<'\n';
if(b.hp==0){
check();
cout<<"该角色已死亡!"<<'\n';
return b;
}
int D=BDEF(b);
int op=(max(shanghai-D,0)+zhenshang-zhenshang/2),po=(max(shanghai-D,0)+zhenshang);
if(b.tf==1) b.hp-=op,cout<<"Bob的第"<<b.id<<"位角色扣除"<<op<<"点生命值"<<'\n';
else b.hp-=po,cout<<"Bob的第"<<b.id<<"位角色扣除"<<po<<"点生命值"<<'\n';
check();
b.mp++;
yichu(b);
return b;
}
inline void round_end_A(){
check();
for(re int i=1;i<=n;++i){
A[i].mp++;
if(A[i].tf==3){
if(A[i].hp>0) A[i].hp+=A[i].x0;
A[i].mp+=A[i].y0;
}
A[i].mp+=(buffA[4][huihe]+buffA[10][huihe]);
A[i]=yichu(A[i]);
}
}
inline void round_end_B(){
check();
for(re int i=1;i<=n;++i){
B[i].mp++;
if(B[i].tf==3){
if(B[i].hp>0) B[i].hp+=B[i].x0;
B[i].mp+=B[i].y0;
}
B[i].mp+=(buffB[4][huihe]+buffB[10][huihe]);
B[i]=yichu(B[i]);
}
}
inline node act_end(node a,bool op){
check();
if(op==0){
if(a.tf==5){
if(a.hp>0) a.hp+=a.x0;
}
a.mp++;
a=yichu(a);
}
else{
if(a.tf==5) a.mp+=a.y0;
a.mp++;
a=yichu(a);
}
return a;
}
inline void pugongA(node a){
int shanghai=AATK(a);
for(re int i=1;i<=n;++i){
if(B[a.atkorder[i]].hp>0){
cout<<"攻击目标为"<<B[a.atkorder[i]].id<<'\n';
if(a.tf==4) B[a.atkorder[i]]=kouxueB(B[a.atkorder[i]],0,shanghai);
else if(a.tf==2){//存疑
B[a.atkorder[i]]=kouxueB(B[a.atkorder[i]],shanghai,a.x0);
// B[a.atkorder[i]]=kouxueB(B[a.atkorder[i]],shanghai,0);
// B[a.atkorder[i]]=kouxueB(B[a.atkorder[i]],0,a.x0);
}
else B[a.atkorder[i]]=kouxueB(B[a.atkorder[i]],shanghai,0);
break;
}
}
}
inline void pugongB(node b){
int shanghai=BATK(b);
for(re int i=1;i<=n;++i){
if(A[b.atkorder[i]].hp>0){
cout<<"攻击目标为"<<A[b.atkorder[i]].id<<'\n';
if(b.tf==4) A[b.atkorder[i]]=kouxueA(A[b.atkorder[i]],0,shanghai);
else if(b.tf==2){//存疑
A[b.atkorder[i]]=kouxueA(A[b.atkorder[i]],shanghai,b.x0);
// A[b.atkorder[i]]=kouxueA(A[b.atkorder[i]],shanghai,0);
// A[b.atkorder[i]]=kouxueA(A[b.atkorder[i]],0,b.x0);
}
else A[b.atkorder[i]]=kouxueA(A[b.atkorder[i]],shanghai,0);
break;
}
}
}
inline void jinengA(node a){
int id=a.jn;
if(id==0) return;
if(id==1){
int shanghai=a.x;
for(re int i=1;i<=n;++i){
if(B[i].hp<=0) continue;
B[i]=kouxueB(B[i],shanghai,0);
B[i].mp-=B[i].mp/10;
}
}
if(id==2){
int shanghai=AATK(a);
for(re int i=1;i<=n;++i){
if(B[i].hp<=0) continue;
B[i]=kouxueB(B[i],0,shanghai);
}
}
if(id==3){
int shanghai=AATK(a);
for(re int i=1;i<=n;++i){
if(B[i].hp<=0) continue;
int op=min(B[i].HP/10,a.x*shanghai);
B[i]=kouxueB(B[i],op,0);
}
}
if(id==4){
for(re int i=huihe;i<=min(huihe+a.x-1,23333);++i){
buffA[4][i]+=a.y;
}
}
if(id==5){
int shanghai=AATK(a);
for(re int i=1;i<=n;++i){
if(B[a.atkorder[i]].hp>0){
B[a.atkorder[i]].def-=a.x;
B[a.atkorder[i]]=kouxueB(B[a.atkorder[i]],0,shanghai);
break;
}
}
}
if(id==6){
int shanghai=AATK(a);
for(re int i=1;i<=n;++i){
if(B[a.atkorder[i]].hp>0){
B[a.atkorder[i]]=kouxueB(B[a.atkorder[i]],0,shanghai);
break;
}
}
for(re int i=huihe;i<=min(huihe+a.x-1,23333);++i){
buffB[6][i]+=a.y;
}
}
if(id==7){
long long mn=1e10,id1=0;
for(re int i=1;i<=n;++i){
if(A[i].hp>0){
if(mn>A[i].hp){
mn=A[i].hp;
id1=i;
}
else if(mn==A[i].hp){
if(A[id1].id>A[i].id) id1=i;
}
}
}
if(id1==0) check();
A[id1].hp+=a.z;
A[id1]=yichu(A[id1]);
for(re int i=huihe;i<=min(huihe+a.x-1,23333);++i){
buffA[7][i]+=a.y;
}
}
if(id==8){
int shanghai=AATK(a);
for(re int i=1;i<=n;++i){
if(B[i].hp<=0) continue;
B[i]=kouxueB(B[i],shanghai,0);
}
for(re int i=huihe;i<=min(huihe+a.x-1,23333);++i){
buffB[8][i]+=a.y;
}
}
if(id==9){
for(re int i=1;i<=n;++i){
if(A[i].hp<=0) continue;
A[i].hp+=a.z;
A[i]=yichu(A[i]);
}
for(re int i=huihe;i<=min(huihe+a.x-1,23333);++i){
buffA[9][i]+=a.y;
}
}
if(id==10){
endA=min(huihe+a.x-1,23333);
for(re int i=1;i<=n;++i){
if(A[i].jn==10) A[i].jn=0;
if(B[i].jn==10) B[i].jn=0;
}
for(re int i=1;i<=n;++i){
A[i].ATK*=2;
A[i].DEF*=2;
if(A[i].hp>0){
A[i].hp=max(A[i].HP/2,A[i].hp);
A[i].mp=max(A[i].MP/2,A[i].mp);
}
}
for(re int i=huihe;i<=min(huihe+a.x-1,23333);++i){
buffA[10][i]++;
}
}
}
inline void jinengB(node b){
int id=b.jn;
if(id==0) return;
if(id==1){
int shanghai=b.x;
for(re int i=1;i<=n;++i){
if(A[i].hp<=0) continue;
A[i]=kouxueA(A[i],shanghai,0);
A[i].mp-=A[i].mp/10;
}
}
if(id==2){
int shanghai=BATK(b);
for(re int i=1;i<=n;++i){
if(A[i].hp<=0) continue;
A[i]=kouxueA(A[i],0,shanghai);
}
}
if(id==3){
int shanghai=BATK(b);
for(re int i=1;i<=n;++i){
if(A[i].hp<=0) continue;
int op=min(A[i].HP/10,b.x*shanghai);
A[i]=kouxueA(A[i],op,0);
}
}
if(id==4){
for(re int i=huihe;i<=min(huihe+b.x-1,23333);++i){
buffB[4][i]+=b.y;
}
}
if(id==5){
int shanghai=BATK(b);
for(re int i=1;i<=n;++i){
if(A[b.atkorder[i]].hp>0){
A[b.atkorder[i]].def-=b.x;
A[b.atkorder[i]]=kouxueA(A[b.atkorder[i]],0,shanghai);
break;
}
}
}
if(id==6){
int shanghai=BATK(b);
for(re int i=1;i<=n;++i){
if(A[b.atkorder[i]].hp>0){
A[b.atkorder[i]]=kouxueA(A[b.atkorder[i]],0,shanghai);
break;
}
}
for(re int i=huihe;i<=min(huihe+b.x-1,23333);++i){
buffA[6][i]+=b.y;
}
}
if(id==7){
long long mn=1e10,id1=0;
for(re int i=1;i<=n;++i){
if(B[i].hp>0){
if(mn>B[i].hp){
mn=B[i].hp;
id1=i;
}
else if(mn==B[i].hp){
if(B[id1].id>B[i].id) id1=i;
}
}
}
if(id1==0) check();
B[id1].hp+=b.z;
B[id1]=yichu(B[id1]);
for(re int i=huihe;i<=min(huihe+b.x-1,23333);++i){
buffB[7][i]+=b.y;
}
}
if(id==8){
int shanghai=BATK(b);
for(re int i=1;i<=n;++i){
if(A[i].hp<=0) continue;
A[i]=kouxueA(A[i],shanghai,0);
}
for(re int i=huihe;i<=min(huihe+b.x-1,23333);++i){
buffA[8][i]+=b.y;
}
}
if(id==9){
for(re int i=1;i<=n;++i){
if(B[i].hp>0){
B[i].hp+=b.z;
B[i]=yichu(B[i]);
}
}
for(re int i=huihe;i<=min(huihe+b.x-1,23333);++i){
buffB[9][i]+=b.y;
}
}
if(id==10){
endB=min(huihe+b.x-1,23333);
for(re int i=1;i<=n;++i){
if(A[i].jn==10) A[i].jn=0;
if(B[i].jn==10) B[i].jn=0;
}
for(re int i=1;i<=n;++i){
B[i].ATK*=2;
B[i].DEF*=2;
if(B[i].hp>0) B[i].hp=max(B[i].HP/2,B[i].hp);
B[i].mp=max(B[i].MP/2,B[i].mp);
}
for(re int i=huihe;i<=min(huihe+b.x-1,23333);++i){
buffB[10][i]++;
}
}
}
inline void Alice_act(){
bool flag=0;
int tot=0,mx=-1,id=0;
for(re int i=1;i<=n;++i){
if(A[i].hp==0) continue;
if(A[i].mp==A[i].MP){
if(mx<A[i].jn){
mx=A[i].jn;
id=i;
}
else if(mx==A[i].jn){
if(A[id].id>A[i].id) id=i;
}
}
}
if(id!=0){
cout<<id<<"号角色释放";
coutjn(A[id].jn);
cout<<'\n';
A[id].mp=0;
jinengA(A[id]);
A[id]=act_end(A[id],1);
}
if(!id){
tot=0;
for(re int i=1;i<=n;++i){
for(re int j=1;j<=n;++j){
if(B[A[i].atkorder[j]].hp>0){
tot++;
xtzqhy[tot].id=A[i].id;
xtzqhy[tot].hp=B[A[i].atkorder[j]].hp;
int op=AATK(A[i]),po=BDEF(B[A[i].atkorder[j]]),shanghai=0,zhenshang=0;
if(B[A[i].atkorder[j]].tf==1){
if(A[i].tf==4) zhenshang=op;
else if(A[i].tf==2) shanghai=op,zhenshang=A[i].x0;
else shanghai=op;
xtzqhy[tot].shanghai=(max(shanghai-po,0)+zhenshang-zhenshang/2);
}
else{
if(A[i].tf==4) zhenshang=op;
else if(A[i].tf==2) shanghai=op,zhenshang=A[i].x0;
else shanghai=op;
xtzqhy[tot].shanghai=(max(shanghai-po,0)+zhenshang);
}
break;
}
}
}
sort(xtzqhy+1,xtzqhy+tot+1,cmp4);
cout<<xtzqhy[1].id<<"号角色普通攻击"<<'\n';
pugongA(A[xtzqhy[1].id]);
A[xtzqhy[1].id]=act_end(A[xtzqhy[1].id],0);
}
}
inline void Bob_act(){
bool flag=0;
int tot=0,mx=-1,id=0;
for(re int i=1;i<=n;++i){
if(B[i].hp==0) continue;
if(B[i].mp==B[i].MP){
if(mx<B[i].jn){
mx=B[i].jn;
id=i;
}
else if(mx==B[i].jn){
if(B[id].id>B[i].id) id=i;
}
}
}
if(id!=0){
cout<<id<<"号角色释放";
coutjn(B[id].jn);
cout<<'\n';
B[id].mp=0;
jinengB(B[id]);
B[id]=act_end(B[id],1);
}
if(!id){
tot=0;
for(re int i=1;i<=n;++i){
for(re int j=1;j<=n;++j){
if(A[B[i].atkorder[j]].hp>0){
tot++;
xtzqhy[tot].id=B[i].id;
xtzqhy[tot].hp=A[B[i].atkorder[j]].hp;
int op=BATK(B[i]),po=ADEF(A[B[i].atkorder[j]]),shanghai=0,zhenshang=0;
if(A[B[i].atkorder[j]].tf==1){
if(B[i].tf==4) zhenshang=op;
else if(B[i].tf==2) shanghai=op,zhenshang=B[i].x0;
else shanghai=op;
xtzqhy[tot].shanghai=(max(shanghai-po,0)+zhenshang-zhenshang/2);
}
else{
if(B[i].tf==4) zhenshang=op;
else if(B[i].tf==2) shanghai=op,zhenshang=B[i].x0;
else shanghai=op;
xtzqhy[tot].shanghai=(max(shanghai-po,0)+zhenshang);
}
break;
}
}
}
sort(xtzqhy+1,xtzqhy+tot+1,cmp4);
cout<<xtzqhy[1].id<<"号角色普通攻击"<<'\n';
pugongB(B[xtzqhy[1].id]);
B[xtzqhy[1].id]=act_end(B[xtzqhy[1].id],0);
}
}
inline void round_end(){
if(huihe==endA){
cout<<huihe<<'\n';
cout<<"Bob"<<'\n';
for(re int i=1;i<=n;++i) cout<<B[i].hp<<" ";
exit(0);
}
if(huihe==endB){
cout<<huihe<<'\n';
cout<<"Alice"<<'\n';
for(re int i=1;i<=n;++i) cout<<A[i].hp<<" ";
exit(0);
}
}
signed main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin>>n;
for(re int i=1;i<=n;++i){
A[i].id=i;
cin>>A[i].HP>>A[i].MP>>A[i].ATK>>A[i].DEF;
A[i].hp=A[i].HP;
A[i].mp=A[i].atk=A[i].def=0;
for(re int j=1;j<=n;++j) cin>>A[i].atkorder[j];
cin>>A[i].tf>>A[i].x0>>A[i].y0;
cin>>A[i].jn>>A[i].x>>A[i].y>>A[i].z;
}
for(re int i=1;i<=n;++i){
B[i].id=i;
cin>>B[i].HP>>B[i].MP>>B[i].ATK>>B[i].DEF;
B[i].hp=B[i].HP;
B[i].mp=B[i].atk=B[i].def=0;
for(re int j=1;j<=n;++j) cin>>B[i].atkorder[j];
cin>>B[i].tf>>B[i].x0>>B[i].y0;
cin>>B[i].jn>>B[i].x>>B[i].y>>B[i].z;
}
while(1){
check();
huihe++;
cout<<"当前回合:"<<huihe<<'\n';
zhuangtai();
cout<<"Alice行动"<<'\n';
Alice_act();
round_end_A();
cout<<"Alice行动结束"<<'\n';
cout<<"Bob行动"<<'\n';
Bob_act();
round_end_B();
cout<<"Bob行动结束"<<'\n';
cout<<"第"<<huihe<<"回合结束"<<'\n'<<'\n';
round_end();
}
}