C++文字冒险小游戏《异世界1》

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int maxn = 1e6 + 7;
struct person {
	string name;
	ll maxhealth;
	ll health;
	ll fight;
	ll qian;
	ll shoulei;
	ll yzd;
};
struct guai {
	ll maxhealth;
	ll health;
	ll fight;
};
//小怪:{222,222,50}
//中等怪:{444,444,70}
//大怪:{666,666,90}
//Boss:{1000,1000,111}
person wo = {"", 130, 130, 30, 0, 0, 0};
void play(person g1, guai g, string name, int money) {
	person me = g1;
	guai zomb = g;
	int z = 5;
	while (1) {
		if (me.health <= 0 && zomb.health <= 0) {
			cout << "游戏结束!!!" << endl;
			cout << "你和" << name << "同归于尽了!" << endl;
			exit(0);
		}
		if (me.health <= 0) {
			cout << "游戏结束!!!" << endl;
			cout << "你被 " << name << "杀死了!" << endl;
			exit(0);
		}
		if (zomb.health <= 0) {
			cout << "你胜利了!!!" << endl;
			cout << name << "死了!" << endl;
			cout << "你获得了" << money << "个金币!!!" << endl;
			wo.qian += money;
			return ;
		}
		cout << "你的血量为:" << me.health << "/" << me.maxhealth << endl;
		cout << name << "的血量为:" << zomb.health << "/" << zomb.maxh
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值