小游戏(初次做,勿吐!)
2026-07-28 18:01:40
发布于:广东
#include "bits/stdc++.h"
#include <windows.h>
using namespace std;
int p1_hp [3] = {5, 10, 15};
int p2_hp [3] = {5, 10, 15};
int p1_to [5] = {0, 0, 0, 0, 0};
int p2_to [5] = {0, 0, 0, 0, 0};
//道具:放大镜,手铐,小刀,烟,番茄汁(饮料 )
bool p1_us [5] = {0, 0, 0, 0, 0};
bool p2_us [5] = {0, 0, 0, 0, 0};
string tool [5] = {"放大镜", "手铐", "小刀", "烟", "饮料"};
queue <bool> q;
void game(int i) {
if(p1_hp [i] == 0) {
cout << "p2胜利!";
Sleep (1000);
system ("cls");
return;
}
if(p2_hp [i] == 0){
cout << "p1胜利!";
Sleep (1000);
system ("cls");
return;
}
for(int j = 0;j < 5;j++) {
int a=rand()%5;
int b=rand()%5;
p1_to[a]++;
p2_to[b]++;
}
if(q.empty()) {
for(int j = 0;j < 10;j++) {
int randint = rand()%2;
q.push (randint);
}
}
for(int j = 0;j <= p1_us [1];j++) {
for(int k = 0;k <= 4;k++) {
cout << tool [k] << ":" << p1_to [k];
}cout << endl;
int x = 114514;
while(x > 2) {
cout << "你要干啥?1,对对方开2,对自己开(推荐)3,用放大镜(看子弹是实弹还是空弹)4,用手铐(禁对方一局)5,用小刀(攻击力+1)6,用烟(回一条血)7,用饮料(退一发)\n";
cin >> x;
if (x == 1) {
if(q.front ()) {
cout << "是实弹\n";
p2_hp [i] --;
p2_hp [i] -=p1_us [2];
p1_us [2] = 0;
q.pop ();
}else {
cout << "是空弹\n";
q.pop ();
}
}
if (x==2) {
if(q.front ()) {
cout << "是实弹\n";
p1_hp [i] --;
p1_hp [i] -=p1_us [2];
p1_us [2] = 0;
q.pop ();
}else {
cout << "是空弹\n";
q.pop ();
}
}
if (x==3) {
if (p1_to [0]) {
p1_to [0] --;
cout << (q.front() ? "实弹" : "空弹");
}else cout<<"你是不是想开BUFF?\n";
}
if(x == 4){
if (p1_to [1]) {
p1_to [1] --;
p1_us [1] = 1;
}else cout<<"你是不是想开BUFF?\n";
}
if(x == 5){
if (p1_to [2]) {
p1_to [2] --;
p1_us [2] = 1;
}else cout<<"你是不是想开BUFF?\n";
}
if(x == 6){
if (p1_to [3]) {
p1_to [3] --;
p1_hp [i] ++;
}else cout<<"你是不是想开BUFF?\n";
}
if(x == 7) {
if(p1_to [4]) {
p1_to [0] --;
p1_us [0] = 1;
}else cout<<"你是不是想开BUFF?\n";
}
Sleep (1000);
system ("cls");
}
}
for(int j = 0;j <= p1_us [1];j++) {
for(int k = 0;k <= 4;k++) {
cout << tool [k] << ":" << p1_to [k];
}cout << endl;
int x = 114514;
while(x > 2) {
cout << "你要干啥?1,对对方开2,对自己开(推荐)3,用放大镜(看子弹是实弹还是空弹)4,用手铐(禁对方一局)5,用小刀(攻击力+1)6,用烟(回一条血)7,用饮料(退一发)\n";
cin >> x;
if (x == 1) {
if(q.front ()) {
cout << "是实弹\n";
p1_hp [i] --;
p1_hp [i] -=p2_us [2];
p2_us [2] = 0;
q.pop ();
}else {
cout << "是空弹\n";
q.pop ();
}
}
if (x==2) {
if(q.front ()) {
cout << "是实弹\n";
p2_hp [i] --;
p2_hp [i] -=p2_us [2];
p2_us [2] = 0;
q.pop ();
}else {
cout << "是空弹\n";
q.pop ();
}
}
if (x==3) {
if (p2_to [0]) {
p2_to [0] --;
cout << (q.front() ? "实弹" : "空弹");
}else cout<<"你是不是想开BUFF?\n";
}
if(x == 4){
if (p2_to [1]) {
p2_to [1] --;
p2_us [1] = 1;
}else cout<<"你是不是想开BUFF?\n";
}
if(x == 5){
if (p2_to [2]) {
p2_to [2] --;
p2_us [2] = 1;
}else cout<<"你是不是想开BUFF?\n";
}
if(x == 6){
if (p2_to [3]) {
p2_to [3] --;
p2_hp [i] ++;
}else cout<<"你是不是想开BUFF?\n";
}
if(x == 7) {
if(p2_to [4]) {
p2_to [0] --;
p2_us [0] = 1;
}else cout<<"你是不是想开BUFF?\n";
}
Sleep (1000);
system ("cls");
}
}
game (i);
return;
}
int main(){
srand (time (0));
// cout<<p1_hp[0];
for (int i = 0;i < 3;i++) {
game (0);
}
}
全部评论 3
怎么才算赢
1小时前 来自 广东
0血条都没有
1小时前 来自 广东
0有兴趣刊登在useful-tools.top上吗?
2026-07-28 来自 浙江
0you
1小时前 来自 广东
0



























有帮助,赞一个