正文
增加 147 行删除 17 行
12345678910111213141516171819202122232425262728293031322 行未改动353637383940414243444546474849505152535455565758596061626364656667686970717273747576774 行未改动82838485868788899091929394959697989910010110210310410510610710810911011115 行未改动127128129130131132133134```cpp//wake-up war 1V1 version//Created by seanli1008 on 2025/9/26.//Copyright (c) 2025年 seanli1008. All rights reserved.#include <bits/stdc++.h>using namespace std;mt19937 rnd(time(0));bool over(){if(!pl[1].hp){cout<<"player 2 is the winner!"<<endl;return true;}if(!pl[2].hp){cout<<"player 1 is the winner!"<<endl;return true;}return false;}void job_skill(int x){}void sleeping(int x){if(pl[x].asleep){pl[x].sleep_round++;if(pl[x].sleep_round==3)pl[x].sleep_round=pl[x].asleep=0;}}void move(int x,string dest){int to=0;if(dest=="shop")to=1;2 行未改动if(dest=="car shop")to=3;if(dest=="factory")to=4;if(dest=="pool")to=5;pl[x].pos=to;if(place[dest].electric_web_exist){pl[x].at_door=1;if(!pl[x].taipingtianshu){if(!pl[x].rubber)pl[x].hp-=0.5;elsepl[x].rubber_hp-=0.5;}}}void purchase(int x,string item){if(pl[x].pos==0 || pl[x].pos==5){cout<<"Invalid operation!"<<endl;return;}if(pl[x].pos==4){if(item=="hammer")pl[x].hammer_num++;else if(item=="lightning"){pl[x].ltn_num++;pl[x].ltn_time+=3;}else if(item=="laser"){pl[x].laser_num++;pl[x].laser_time++;}}if(pl[x].pos==3){if(item=="car"){pl[x].car_num++;pl[x].powered=0;pl[x].car_fix=2;pl[x].car_hp=3;}if(item=="oil")pl[x].oil_num++;4 行未改动if(item=="speed medicine")pl[x].speed_med_num++;if(item=="poison")pl[x].poison_num++;if(item=="jisu")pl[x].jisu_num++;if(item=="instruction")pl[x].instruction++;if(item=="mask")pl[x].on_mask=1;}}int main(){cout<<"wake-up war developed by seanli1008"<<endl;Sleep(200);system("cls");cout<<"player 1, please choose your job: 1 - shop assistance 2 - doctor 3 - racer 4 - swimmer 5 - physicist 6 - madman 7 - Alzheimer 8 - magician"<<endl;cin>>pl[1].job;cout<<"player 2, please choose your job: 1 - shop assistance 2 - doctor 3 - racer 4 - swimmer 5 - physicist 6 - madman 7 - Alzheimer 8 - magician"<<endl;cin>>pl[2].job;job_skill(1);job_skill(2);while(!over()){sleeping(1);sleeping(2);int x=rnd()%2+1;cout<<"player "<<x<<"'s turn"<<endl;string op;cin>>op;getline(cin,op);15 行未改动for(int i=4;i<op.size();i++)item+=op[i];purchase(x,item);}}return 0;}```1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311322 行未改动1351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851864 行未改动19119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423515 行未改动251252253254255256257258259260261262263264```cpp//wake-up war 1V1 version//Created by seanli1008 on 2025/9/26.//Copyright (c) 2025年 seanli1008. All rights reserved.//Acknowledgements: sfy666 for checking my code and giving useful advice#include <bits/stdc++.h>#include <windows.h>using namespace std;mt19937 rnd(time(0));int round_cnt;struct player{double hp,rubber_hp,car_hp;int job,med_num,mask_num,second_pos,third_pos,change_item_time,change_data_num,pos,sleep_round,on_fire_num,on_laser_num,hammer_num,ltn_num,ltn_time,mimic_num,laser_num,laser_time,electric_web_num,car_num,oil_num,speed_med_num,poison_num,hormone_num;bool on_mask,need_return,can_swim,dice,magic_used,change_data_used,is_alz,at_door,asleep,on_fire,rattan_armor,on_cps_car,taipingtianshu,on_laser,car_powered,car_fixed,on_car,instruction,awake,swimming_circle;}pl[10];struct car{//all things about car}car[10];struct compass_car{//all things about compass car}cps_car[10];struct location{bool destroyed,electric_web_exist;int electric_web_time,electric_web_belong;}place[10];void init(){}bool over(){if(pl[1].hp<=0){cout<<"player 2 is the winner!"<<endl;return true;}if(pl[2].hp<=0){cout<<"player 1 is the winner!"<<endl;return true;}return false;}void job_skill(int x){if(pl[x].job==1){cout<<"player "<<x<<" please choose a item"<<endl;string item;cin>>item;//get item}if(pl[x].job==2){pl[x].med_num++;pl[x].mask_num++;pl[x].on_mask=1;}if(pl[x].job==3)pl[x].need_return=0;if(pl[x].job==4)pl[x].can_swim=1;if(pl[x].job==5){cout<<"Please decide where do you want to put your first portal"<<endl;cout<<"1 - shop 2 - pharmacy 3 - car shop 4 - factory 5 - home 6 - pool"<<endl;int portal_pos;cin>>portal_pos;pl[x].second_pos=portal_pos;cout<<"Please decide where do you want to put your first portal"<<endl;cout<<"1 - shop 2 - pharmacy 3 - car shop 4 - factory 5 - home 6 - pool"<<endl;cin>>portal_pos;pl[x].third_pos=portal_pos;}if(pl[x].job==6)pl[x].dice=1;if(pl[x].job==8 && !pl[x].magic_used)pl[x].change_item_time=3;if(pl[x].job==9 && !pl[x].change_data_used)pl[x].change_data_num=3;}void clear(int x){}void alz(int x){if(!pl[x].is_alz)return;if(round_cnt%5==0){cout<<"Player "<<x<<" is Alzheimer. He forgot who he is. Please choose your job again"<<endl;cout<<"1 - shop assistance 2 - doctor 3 - racer 4 - swimmer 5 - physicist 6 - madman 7 - Alzheimer 8 - magician 9 - OIer"<<endl;cin>>pl[x].job;job_skill(x);}if(round_cnt%10==0)clear(x);}void swim(int x){if(pl[x].job==4 && pl[x].pos==5 && pl[x].at_door)pl[x].hp+=0.5;else if(pl[x].job!=4 && pl[x].pos==5 && !pl[x].at_door && !pl[x].swimming_circle)pl[x].hp-=1.0;}void sleeping(int x){if(pl[x].asleep){pl[x].sleep_round++;if(pl[x].sleep_round==3)pl[x].sleep_round=pl[x].asleep=0;}}void on_fire_check(int x){if(!pl[x].on_fire)return;double dmg=pl[x].on_fire_num;if(pl[x].rattan_armor)dmg++;if(pl[x].on_cps_car)dmg++;if(pl[x].taipingtianshu)dmg/=2;pl[x].hp-=dmg;}void on_laser_check(int x){if(!pl[x].on_laser)return;double dmg=pl[x].on_laser_num;if(pl[x].pos==5 && pl[x].at_door==0)dmg++;if(pl[x].taipingtianshu)dmg/=2;if(pl[x].rubber_hp>=0){double tmp=dmg;dmg-=pl[x].rubber_hp;pl[x].rubber_hp-=min(pl[x].rubber_hp,tmp);}pl[x].hp-=min(dmg,0.0);}void move(int x,string dest){int to=0;if(dest=="shop")to=1;2 行未改动if(dest=="car shop")to=3;if(dest=="factory")to=4;if(dest=="pool")to=5;pl[x].pos=to;if(place[to].electric_web_exist && place[to].electric_web_belong!=x){pl[x].at_door=1;if(!pl[x].taipingtianshu){if(pl[x].rubber_hp<=0)pl[x].hp-=0.5;elsepl[x].rubber_hp-=0.5;}place[to].electric_web_time--;if(place[to].electric_web_time==0)place[to].electric_web_exist=0;if(pl[x].on_car)pl[x].car_hp-=0.5;}}void purchase(int x,string item){if(pl[x].pos==0 || pl[x].pos==5 || pl[x].at_door==true){cout<<"Invalid operation!"<<endl;return;}if(pl[x].pos==4){if(item=="hammer")pl[x].hammer_num++;if(item=="lightning"){pl[x].ltn_num++;pl[x].ltn_time+=3;}if(item=="laser"){pl[x].laser_num++;pl[x].laser_time++;}if(item=="mimic")pl[x].mimic_num++;if(item=="electric web")pl[x].electric_web_num++;}if(pl[x].pos==3){if(item=="car"){pl[x].car_num++;pl[x].car_powered=0;pl[x].car_fixed=2;pl[x].car_hp=3;}if(item=="oil")pl[x].oil_num++;4 行未改动if(item=="speed medicine")pl[x].speed_med_num++;if(item=="poison")pl[x].poison_num++;if(item=="hormone")pl[x].hormone_num++;if(item=="instruction")pl[x].instruction++;if(item=="mask")pl[x].on_mask=1;}if(pl[x].pos==1){}}int main(){init();cout<<"wake-up war developed by seanli1008"<<endl;Sleep(500);system("cls");cout<<"player 1, please choose your job: 1 - shop assistance 2 - doctor 3 - racer 4 - swimmer 5 - physicist 6 - madman 7 - Alzheimer 8 - magician 9 - OIer"<<endl;cin>>pl[1].job;if(pl[1].job==7)pl[1].is_alz=1;job_skill(1);system("cls");cout<<"player 2, please choose your job: 1 - shop assistance 2 - doctor 3 - racer 4 - swimmer 5 - physicist 6 - madman 7 - Alzheimer 8 - magician 9 - OIer"<<endl;cin>>pl[2].job;if(pl[2].job==7)pl[2].is_alz=1;job_skill(2);system("cls");while(!over()){round_cnt++;alz(1);alz(2);sleeping(1);sleeping(2);int x=rnd()%2+1;while(!pl[x].asleep)x=3-x;cout<<"player "<<x<<"'s turn"<<endl;string op;cin>>op;getline(cin,op);15 行未改动for(int i=4;i<op.size();i++)item+=op[i];purchase(x,item);}swim(1);swim(2);on_fire_check(1);on_fire_check(2);on_laser_check(1);on_laser_check(2);}return 0;}```