#include
#include
#include
#include
#include
#include <windows.h>
#include
#include
using namespace std;
// 基础结构体定义
struct Skill
{
string skillName;
string desc;
int baseValue;
bool isHeal;
};
struct Talisman
{
string name;
string intro;
bool unlock;
Skill skill;
};
struct Ability
{
string abilityName;
string detail;
int buyPrice;
Skill baseSkill;
int level;
int exp;
int expNeed;
int coinUpCost;
int coreUpCost;
bool owned;
};
struct MartialArt
{
string artName;
string artDesc;
int bonusAtk;
int bonusHp;
int price;
bool owned;
int artLv;
Skill artSkill;
};
struct Gun
{
string gunName;
string info;
int damage;
int bulletMax;
int bulletNow;
int buyPrice;
bool owned;
int modifyLevel;
int durability;
};
struct ShopItem
{
string itemName;
string tip;
int price;
int count;
};
struct Realm
{
string name;
int expNeed;
int freePoint;
};
enum TileType { EMPTY, ENEMY, SUPPLY, SAFE_HOUSE, BOSS_SPOT };
struct Tile
{
TileType type;
bool explored;
};
// 区块坐标(无限世界分块)
using ChunkKey = pair<long long, long long>;
map<ChunkKey, vector<vector>> chunkPool;
const int CHUNK_SIZE = 8;
struct Area
{
string zoneName;
int monsterLevel;
int expMin;
int expMax;
bool open;
};
struct Enemy
{
string enemyName;
int hp;
int hpMax;
int attack;
bool isBoss;
int dropCoin;
int dropCore;
Ability enemyAbility;
};
struct TeamMember
{
string memberName;
int hp;
int hpMax;
bool online;
};
struct Team
{
string teamName;
string leaderName;
vector memberList;
bool exist;
};
struct Shelter
{
string shelterName;
string owner;
bool builded;
int storeCoin;
int storeCore;
long long buildX;
long long buildY;
};
struct Player
{
string userName;
int hp;
int hpMax;
int exp;
int realmLv;
int pointPool;
int weekCount;
int crystalCoin;
int beastCore;
int yiYang;
int wisdom;
int spirit;
int will;
int speed;
int strength;
long long posX, posY;
const int PEAK_LIMIT = 999;
vector<Talisman> talismanList;
vector<Ability> myAbilityList;
vector<MartialArt> myMartialList;
vector<Gun> gunBag;
vector<ShopItem> bag;
vector<Ability> shopAbilityPool;
vector<MartialArt> shopMartialPool;
vector<Gun> shopGunPool;
vector<ShopItem> shopConsumePool;
int armorValue;
bool reachWorldPeak()
{
return yiYang >= PEAK_LIMIT && wisdom >= PEAK_LIMIT && spirit >= PEAK_LIMIT
&& will >= PEAK_LIMIT && speed >= PEAK_LIMIT && strength >= PEAK_LIMIT;
}
};
vector talismanOriginal = {
{“鼠符咒”,“赋予无机物生命,操控傀儡”,false,{“傀儡冲击”,“召唤傀儡重击敌人”,120,false}},
{“牛符咒”,“无穷肉身蛮力”,false,{“巨力崩击”,“爆发蛮力重创目标”,180,false}},
{“虎符咒”,“阴阳平衡,抵御精神侵蚀”,false,{“阴阳制衡”,“反弹部分伤害”,90,false}},
{“兔符咒”,“极速身法”,false,{“瞬影连打”,“高速连续斩击”,110,false}},
{“龙符咒”,“毁灭烈焰”,false,{“焚天龙息”,“高额火焰爆发”,220,false}},
{“蛇符咒”,“光学隐形潜行”,false,{“暗影突袭”,“隐身暴击”,140,false}},
{“马符咒”,“驱除一切伤势与负面状态”,false,{“圣光复原”,“大量回血”,0,true}},
{“羊符咒”,“灵魂离体,精神攻击”,false,{“魂念冲击”,“无视防御精神伤害”,130,false}},
{“猴符咒”,“物质变形改写”,false,{“物质畸变”,“扭曲敌方躯体”,150,false}},
{“鸡符咒”,“浮空飞行”,false,{“凌空坠击”,“高空俯冲重击”,135,false}},
{“狗符咒”,“不死自愈体质”,false,{“不朽守护”,“持续生命恢复”,0,true}},
{“猪符咒”,“双眼高能镭射光束”,false,{“毁灭镭射”,“穿透光束巨额伤害”,200,false}}
};
vector shopAbilityPool = {
{“烈焰掌控”,“自由操控高温火焰”,800,{“焚尽之炎”,“大范围灼烧”,160,false},1,0,100,300,2,false},
{“空间闪烁”,“短距空间跳跃规避伤害”,1000,{“空间斩”,“空间切割攻击”,190,false},1,0,120,350,2,false},
{“电磁脉冲”,“释放电磁波麻痹对手”,1200,{“电磁瘫痪”,“电击控制伤害”,170,false},1,0,110,380,3,false},
{“生命汲取”,“夺取敌人生命力恢复自身”,1500,{“血蚀汲取”,“吸血攻击”,185,false},1,0,130,420,3,false},
{“重力压制”,“改变重力压制敌方行动”,1800,{“重力崩塌”,“重力碾压重创”,210,false},1,0,150,500,4,false},
{“冰霜冻结”,“冻结敌人限制行动”,1300,{“凛冬冰封”,“寒冰爆破”,175,false},1,0,120,360,2,false}
};
vector shopMartialPool = {
{“崩山拳”,“强化近身肉搏,永久增加30攻击力”,30,0,1200, false,1,{“崩山裂”,“重拳冲击”,140,false}},
{“御风步”,“身法提升,永久增加20生命上限”,0,20,1000, false,1,{“风袭连踢”,“高速腿击”,125,false}},
{“裂刃刀法”,“近战刀刃招式,大幅提升斩击伤害”,45,0,1800, false,1,{“斩月横切”,“强力刀斩”,195,false}},
{“铁躯硬功”,“肉身锻体,永久提升60生命值上限”,0,60,1500, false,1,{“金刚格挡”,“减伤反击”,110,false}},
{“惊雷突袭”,“爆发一击,高额单体伤害”,55,0,2200, false,1,{“奔雷破”,“爆发重击”,230,false}}
};
vector shopGunPool = {
{“P92手枪”,“便携自卫手枪”,70,12,0,400,false,0,100},
{“霰弹枪”,“近距离高额爆发伤害”,160,6,0,900,false,0,80},
{“AK突击步枪”,“均衡稳定自动步枪”,120,30,0,1400,false,0,120},
{“AWM狙击枪”,“远程超高单发伤害”,280,5,0,2200,false,0,60}
};
vector shopConsumePool = {
{“初级医疗包”,“恢复80生命值”,150,0},
{“高级医疗包”,“恢复200生命值”,400,0},
{“破片手雷”,“战斗投掷,造成范围伤害”,300,0},
{“护甲片”,“永久增加10点护甲”,600,0},
{“力量增幅卷轴”,“本场战斗力量临时+50”,350,0},
{“符咒增幅药剂”,“单次符咒技能伤害提升50%”,700,0},
{“手枪弹药x20”,“补充手枪子弹”,100,0},
{“步枪弹药x30”,“补充突击步枪子弹”,250,0},
{“狙击枪弹药x10”,“补充狙击枪子弹”,350,0},
{“永久体质结晶”,“永久增加20最大生命值”,2000,0}
};
vector realmTable = {
{“凡人”,0,0},
{“淬体”,100,10},
{“凝意”,300,12},
{“聚灵”,600,15},
{“启神”,1200,18},
{“御灵”,2500,22},
{“通玄”,5000,28},
{“符咒至尊”,99999,99}
};
Player hero;
Team playerTeam;
Shelter myShelter;
vector worldZone;
int currentZoneID;
void wait(int sec){ Sleep(sec*1000); }
void slowPrint(string s){
for(char c : s){ cout << c; Sleep(25); }
cout << endl;
}
// 生成单个区块地图
vector<vector> genChunk()
{
vector<vector> grid(CHUNK_SIZE,vector(CHUNK_SIZE));
for(int i=0;i<CHUNK_SIZE;i++){
for(int j=0;j<CHUNK_SIZE;j++){
int r = rand()%100;
if(r < 30) grid[i][j].type = ENEMY;
else if(r < 45) grid[i][j].type = SUPPLY;
else if(r < 52) grid[i][j].type = SAFE_HOUSE;
else if(r >=92) grid[i][j].type = BOSS_SPOT;
else grid[i][j].type = EMPTY;
grid[i][j].explored = false;
}
}
return grid;
}
// 获取区块,不存在则新建
vector<vector>& getChunk(long long cx, long long cy)
{
ChunkKey key = {cx,cy};
if(chunkPool.find(key) == chunkPool.end()){
chunkPool[key] = genChunk();
}
return chunkPool[key];
}
// 全局坐标转区块内局部坐标
void globalToChunk(long long gx, long long gy, long long &cx, long long &cy, int &lx, int &ly)
{
cx = gx / CHUNK_SIZE;
cy = gy / CHUNK_SIZE;
lx = gx % CHUNK_SIZE;
ly = gy % CHUNK_SIZE;
if(lx < 0) { lx += CHUNK_SIZE; cx–; }
if(ly < 0) { ly += CHUNK_SIZE; cy–; }
}
// 获取当前格子Tile
Tile& getTile(long long gx, long long gy)
{
long long cx, cy;
int lx, ly;
globalToChunk(gx,gy,cx,cy,lx,ly);
auto &chunk = getChunk(cx,cy);
return chunk[lx][ly];
}
string getRealmName(int lv){
if(lv < 0) lv = 0;
if(lv >= realmTable.size()) return realmTable.back().name;
return realmTable[lv].name;
}
int calcAbilityDamage(Ability &ab)
{
float rate = 1.0f + (ab.level - 1) * 0.22f;
int dmg = ab.baseSkill.baseValue * rate;
if(ab.level == 5) dmg *= 1.3f;
if(ab.level == 10) dmg *= 1.6f;
return dmg;
}
void addAbilityExp(Ability &ab, int val = 15)
{
if(ab.level >= 10) return;
ab.exp += val;
ab.expNeed = ab.level * 100;
if(ab.exp >= ab.expNeed)
{
slowPrint(“\n【提示】” + ab.abilityName + “熟练度已满,可以升级!”);
}
}
bool tryUpgradeAbility(Ability &ab)
{
if(ab.level >= 10)
{
slowPrint(“该异能已满级Lv10!”);
return false;
}
int nextLv = ab.level + 1;
int needExp = nextLv * 100;
int needCoin = 300 * nextLv;
int needCore = 2 * nextLv;
if(ab.exp < needExp)
{
slowPrint("熟练度不足!");
return false;
}
if(hero.crystalCoin < needCoin)
{
slowPrint("灾厄晶币不足!");
return false;
}
if(hero.beastCore < needCore)
{
slowPrint("异兽晶核不足!");
return false;
}
hero.crystalCoin -= needCoin;
hero.beastCore -= needCore;
ab.level = nextLv;
ab.exp = 0;
ab.expNeed = ab.level * 100;
slowPrint("\n✅升级成功!当前等级:Lv" + to_string(ab.level));
if(ab.level == 5)
{
slowPrint("🔥【Lv5质变解锁】异能效果大幅增强,附加特殊效果!");
}
if(ab.level == 10)
{
slowPrint("💥【Lv10完全觉醒】异能达到巅峰形态!");
}
return true;
}
// 功法升级补充
bool tryUpgradeMartial(MartialArt &ma)
{
if(ma.artLv >= 5){
slowPrint(“功法已满级!”);
return false;
}
int cost = ma.price / 2 * ma.artLv;
if(hero.crystalCoin < cost){
slowPrint(“晶币不足!”);
return false;
}
hero.crystalCoin -= cost;
ma.artLv++;
ma.bonusAtk +=10;
ma.bonusHp +=15;
slowPrint(ma.artName + “升级至Lv” + to_string(ma.artLv));
return true;
}
void openUpgradePanel()
{
system(“cls”);
cout << “========异能升级面板========\n”;
cout << “灾厄晶币:” << hero.crystalCoin << “|异兽晶核:” << hero.beastCore << “\n\n”;
for(int i = 0; i < hero.myAbilityList.size(); i++)
{
Ability &a = hero.myAbilityList[i];
cout << i+1 << “.” << a.abilityName << “【Lv” << a.level << “】”;
cout << " 熟练度:" << a.exp << “/” << a.expNeed << “\n”;
if(a.level < 10)
{
int lv = a.level + 1;
cout << " 升级消耗:" << lv300 << “晶币,” << lv2 << “晶核\n”;
}
else
{
cout << " 已满级\n";
}
}
cout << “\n请输入序号升级,0退出:”;
int sel;
cin >> sel;
sel–;
if(sel >=0 && sel < hero.myAbilityList.size())
{
tryUpgradeAbility(hero.myAbilityList[sel]);
}
system(“pause”);
}
void buildShelter()
{
if(myShelter.builded)
{
slowPrint(“你已经拥有避难所,无需重复建造!”);
return;
}
int costCoin = 1500;
int costCore = 10;
if(hero.crystalCoin < costCoin || hero.beastCore < costCore)
{
slowPrint(“资源不足!建造避难所需要1500晶币 + 10异兽晶核”);
return;
}
hero.crystalCoin -= costCoin;
hero.beastCore -= costCore;
cout << “输入避难所名称:”;
cin >> myShelter.shelterName;
myShelter.owner = hero.userName;
myShelter.builded = true;
myShelter.storeCoin = 0;
myShelter.storeCore = 0;
myShelter.buildX = hero.posX;
myShelter.buildY = hero.posY;
slowPrint(“
避难所【” + myShelter.shelterName + “】建造完成!永久记录当前世界坐标”);
}
void shelterDeposit()
{
if(!myShelter.builded)
{
slowPrint(“你还没有建造避难所!”);
return;
}
int c1,c2;
cout << “存入多少晶币:”;cin >> c1;
cout << “存入多少晶核:”;cin >> c2;
if(c1 <= hero.crystalCoin && c2 <= hero.beastCore)
{
hero.crystalCoin -= c1;
hero.beastCore -= c2;
myShelter.storeCoin += c1;
myShelter.storeCore += c2;
slowPrint(“存放成功!仓库物资已更新”);
}else slowPrint(“自身资源不足!”);
}
void shelterTake()
{
if(!myShelter.builded)
{
slowPrint(“你还没有建造避难所!”);
return;
}
int c1,c2;
cout << “取出多少晶币:”;cin >> c1;
cout << “取出多少晶核:”;cin >> c2;
if(c1 <= myShelter.storeCoin && c2 <= myShelter.storeCore)
{
myShelter.storeCoin -= c1;
myShelter.storeCore -= c2;
hero.crystalCoin += c1;
hero.beastCore += c2;
slowPrint(“取出成功!”);
}else slowPrint(“仓库库存不足!”);
}
void abandonShelter()
{
if(!myShelter.builded)
{
slowPrint(“你没有避难所!”);
return;
}
cout<<“确认永久放弃避难所?1确认 / 其他取消:”;
int op;cin>>op;
if(op == 1)
{
myShelter = {“”,“”,false,0,0,0,0};
slowPrint(“已放弃避难所,仓库物资全部遗失!”);
}
}
void showShelterInfo()
{
system(“cls”);
if(!myShelter.builded)
{
slowPrint(“暂无自建避难所”);
}else
{
cout<<“====避难所信息【”<<myShelter.shelterName<<“】====”<<endl;
cout<<“拥有者:”<<myShelter.owner<<endl;
cout<<“建造坐标 X:”<<myShelter.buildX<<" Y:"<<myShelter.buildY<<endl;
cout<<“仓库晶币:”<<myShelter.storeCoin<<endl;
cout<<“仓库晶核:”<<myShelter.storeCore<<endl;
}
system(“pause”);
}
void createTeam()
{
if(playerTeam.exist)
{
slowPrint(“你已经是一支小队的队长!”);
return;
}
cout << “请输入小队名称:”;
cin >> playerTeam.teamName;
playerTeam.leaderName = hero.userName;
playerTeam.exist = true;
TeamMember self;
self.memberName = hero.userName;
self.hp = hero.hp;
self.hpMax = hero.hpMax;
self.online = true;
playerTeam.memberList.push_back(self);
slowPrint(“
小队【”+playerTeam.teamName+“】创建成功!”);
}
void inviteMember()
{
if(!playerTeam.exist)
{
slowPrint(“请先创建小队!”);
return;
}
string name;
cout << “输入邀请玩家昵称:”;
cin >> name;
TeamMember newMan;
newMan.memberName = name;
newMan.hp = 100;
newMan.hpMax = 100;
newMan.online = false;
playerTeam.memberList.push_back(newMan);
slowPrint(“已发送入队邀请给:” + name);
}
void tempJoinTeam(string tempName)
{
TeamMember temp;
temp.memberName = tempName;
temp.hp = 80;
temp.hpMax = 80;
temp.online = true;
playerTeam.memberList.push_back(temp);
slowPrint(tempName + “临时加入小队!”);
}
void kickMember()
{
if(!playerTeam.exist) return;
cout<<“队员列表:\n”;
for(int i=0;i<playerTeam.memberList.size();i++)
{
cout<<i+1<<“.”<<playerTeam.memberList[i].memberName<<endl;
}
int idx;
cout<<“输入踢出序号:”;cin>>idx;
idx–;
if(idx>=0 && idx<playerTeam.memberList.size())
{
if(playerTeam.memberList[idx].memberName == hero.userName)
{
slowPrint(“不能踢出自己!”);
return;
}
playerTeam.memberList.erase(playerTeam.memberList.begin()+idx);
slowPrint(“队员已移出小队”);
}
}
void showTeam()
{
system(“cls”);
if(!playerTeam.exist)
{
slowPrint(“暂无小队”);
}else
{
cout<<“====小队【”<<playerTeam.teamName<<“】队长:”<<playerTeam.leaderName<<endl;
for(auto &m : playerTeam.memberList)
{
cout<<“- “<<m.memberName<<” HP:”<<m.hp<<“/”<<m.hpMax<<" 在线:"<<(m.online?“是”:“否”)<<endl;
}
}
system(“pause”);
}
void disbandTeam()
{
if(!playerTeam.exist)
{
slowPrint(“没有小队可以解散!”);
return;
}
cout<<“确认解散整个小队?1确认 / 其他取消:”;
int op;cin>>op;
if(op == 1)
{
playerTeam = {“”,“”,{},false};
slowPrint(“小队已全部解散,临时队员清空!”);
}
}
void teamMenu()
{
while(true)
{
system(“cls”);
cout<<“=====小队管理菜单=====\n”;
cout<<“1 创建小队\n2 邀请永久队员\n3 添加临时队员\n4 查看队员列表\n5 踢出队员\n6 解散小队\n0 返回\n请选择:”;
int op;cin>>op;
if(op == 0) break;
if(op == 1) createTeam();
if(op == 2) inviteMember();
if(op == 3) {string s;cout<<“临时角色名:”;cin>>s; tempJoinTeam(s);}
if(op == 4) showTeam();
if(op == 5) kickMember();
if(op == 6) disbandTeam();
system(“pause”);
}
}
void battle(Enemy &e)
{
slowPrint(“\n====遭遇敌人:” + e.enemyName + “====”);
int playerTempHp = hero.hp;
int enemyTempHp = e.hp;
bool fight = true;
while(fight)
{
system(“cls”);
cout << “你的生命:” << playerTempHp << “/” << hero.hpMax << “\n”;
cout << e.enemyName << “生命:” << enemyTempHp << “/” << e.hpMax << “\n\n”;
cout << “【战斗指令】\n”;
cout << “1.普通攻击\n2.释放符咒\n3.释放异能\n4.施展功法\n5.使用枪械\n6.投掷手雷\n7.使用药品\n8.尝试逃跑\n请选择:”;
int op;
cin >> op;
if(op == 1)
{
int dmg = 20 + hero.strength;
enemyTempHp -= dmg;
slowPrint(“你挥拳攻击,造成 " + to_string(dmg) + " 点伤害!”);
}
else if(op == 3)
{
if(hero.myAbilityList.empty())
{
slowPrint(“你还没有任何异能!”);
}
else
{
for(int i=0;i<hero.myAbilityList.size();i++)
{
cout << i+1 << “.” << hero.myAbilityList[i].abilityName << “\n”;
}
int aid; cin >> aid; aid–;
if(aid >=0 && aid < hero.myAbilityList.size())
{
Ability &ab = hero.myAbilityList[aid];
int dmg = calcAbilityDamage(ab);
enemyTempHp -= dmg;
slowPrint(ab.abilityName + “释放成功,造成” + to_string(dmg) + “伤害!”);
addAbilityExp(ab,20);
}
}
}
else if(op == 8)
{
int ran = rand()%100;
if(ran > 40)
{
slowPrint(“逃跑成功!”);
fight = false;
break;
}
else
{
slowPrint(“逃跑失败!”);
}
}
if(enemyTempHp > 0)
{
int edmg = e.attack;
playerTempHp -= edmg;
slowPrint(e.enemyName + "发动攻击,对你造成 " + to_string(edmg) + " 伤害!");
}
if(enemyTempHp <= 0)
{
slowPrint("\n🎉战斗胜利!");
slowPrint("获得:" + to_string(e.dropCoin) + "灾厄晶币," + to_string(e.dropCore) + "异兽晶核");
hero.crystalCoin += e.dropCoin;
hero.beastCore += e.dropCore;
if(e.isBoss)
{
for(auto &tal : hero.talismanList)
{
if(!tal.unlock)
{
tal.unlock = true;
slowPrint("✨BOSS掉落解锁符咒:" + tal.name);
break;
}
}
}
fight = false;
}
if(playerTempHp <= 0)
{
slowPrint("你被击败了...");
fight = false;
}
system("pause");
}
hero.hp = playerTempHp;
}
Enemy createEnemy(int zoneLv)
{
vector names = {“变异狂犬”,“腐蚀蠕虫”,“觉醒流浪者”,“骨刺巨狼”,“腐蚀丧尸”};
Enemy en;
en.enemyName = names[rand()%names.size()];
en.hpMax = 80 + zoneLv * 40;
en.hp = en.hpMax;
en.attack = 12 + zoneLv * 6;
en.isBoss = false;
en.dropCoin = 60 + rand()%(80*zoneLv);
en.dropCore = 1 + rand()%zoneLv;
en.enemyAbility = shopAbilityPool[0];
return en;
}
Enemy createBoss(int zoneLv)
{
Enemy boss;
boss.enemyName = “区域畸变巨兽”;
boss.hpMax = 400 + zoneLv * 120;
boss.hp = boss.hpMax;
boss.attack = 30 + zoneLv * 12;
boss.isBoss = true;
boss.dropCoin = 800 + zoneLv300;
boss.dropCore = 10 + zoneLv5;
return boss;
}
// 绘制环绕式小地图(视野范围)
void drawInfiniteMap()
{
const int viewRange = 4;
cout<<“\n==== 无限环绕世界(走到边缘自动折返) ====\n”;
for(long long offX = -viewRange ; offX <= viewRange ; offX++)
{
for(long long offY = -viewRange ; offY <= viewRange ; offY++)
{
long long gx = hero.posX + offX;
long long gy = hero.posY + offY;
Tile &t = getTile(gx,gy);
if(offX == 0 && offY ==0){
cout<<"◎ “;
}else if(!t.explored){
cout<<”? “;
}else{
switch(t.type){
case EMPTY:cout<<”· ";break;
case ENEMY:cout<<"X ";break;
case SUPPLY:cout<<"□ ";break;
case SAFE_HOUSE:cout<<"○ ";break;
case BOSS_SPOT:cout<<“★ “;break;
}
}
}
cout<<endl;
}
cout<<“W上|S下|A左|D右|当前全局坐标 X:”<<hero.posX<<” Y:”<<hero.posY<<endl;
}
void openShop()
{
int sel;
while(true)
{
system(“cls”);
cout<<“==========【系统商城】==========\n”;
cout<<“灾厄晶币:”<<hero.crystalCoin<<“|异兽晶核:”<<hero.beastCore<<endl;
cout<<“1.异能兑换专区\n”;
cout<<“2.功法武技专区\n”;
cout<<“3.军火武器专区\n”;
cout<<“4.消耗物资专区\n”;
cout<<“5.货币兑换(晶核↔晶币)\n”;
cout<<“0.离开商城\n”;
cout<<“请输入选择:”;
cin>>sel;
if(sel == 0) break;
if(sel == 1)
{
slowPrint(“\n====异能列表====”);
for(int i=0;i<hero.shopAbilityPool.size();i++)
{
Ability &ab = hero.shopAbilityPool[i];
if(ab.owned) continue;
cout<<i+1<<“.”<<ab.abilityName<<“|价格:”<<ab.buyPrice<<“晶币|”<<ab.detail<<endl;
}
system(“pause”);
}
else if(sel == 2)
{
slowPrint(“\n====功法武技列表====”);
for(int i=0;i<hero.shopMartialPool.size();i++)
{
MartialArt &ma = hero.shopMartialPool[i];
if(ma.owned) continue;
cout<<i+1<<“.”<<ma.artName<<“|售价:”<<ma.price<<“|效果:”<<ma.artDesc<<endl;
}
system(“pause”);
}
else if(sel == 3)
{
slowPrint(“\n====军火库====”);
for(int i=0;i<hero.shopGunPool.size();i++)
{
Gun &g = hero.shopGunPool[i];
if(g.owned) continue;
cout<<i+1<<“.”<<g.gunName<<“|伤害:”<<g.damage<<“|价格:”<<g.buyPrice<<endl;
}
system(“pause”);
}
else if(sel == 4)
{
slowPrint(“\n====消耗物资====”);
for(int i=0;i<shopConsumePool.size();i++)
{
ShopItem &it = shopConsumePool[i];
cout<<i+1<<“.”<<it.itemName<<“|”<<it.tip<<“|价格:”<<it.price<<endl;
}
system(“pause”);
}
else if(sel == 5)
{
int op;
cout<<“1.晶核兑换晶币(1晶核=100晶币)\n2.晶币兑换晶核(1晶核=120晶币)\n选择:”;
cin>>op;
if(op == 1 && hero.beastCore >= 1)
{
hero.beastCore–;
hero.crystalCoin += 100;
slowPrint(“兑换完成!”);
}
else if(op == 2 && hero.crystalCoin >= 120)
{
hero.crystalCoin -= 120;
hero.beastCore +=1;
slowPrint(“兑换完成!”);
}
else slowPrint(“资源不足”);
system(“pause”);
}
}
}
void showPanel()
{
system(“cls”);
cout << “================个人信息面板================\n”;
cout << “境界:” << getRealmName(hero.realmLv) << “\n”;
cout << “生命值:” << hero.hp << “/” << hero.hpMax << “\n”;
cout << “灾厄晶币:” << hero.crystalCoin << “|异兽晶核:” << hero.beastCore << “\n\n”;
cout << “【已解锁异能】\n”;
for(auto &a : hero.myAbilityList)
{
cout << “- " << a.abilityName << " Lv” << a.level << " (" << a.exp << “/” << a.expNeed << “)\n”;
}
cout << “\n【习得功法】\n”;
for(auto &m : hero.myMartialList)
{
cout << “- " << m.artName << " Lv”<<m.artLv<<“\n”;
}
cout << “\n【武器背包】\n”;
for(auto &g : hero.gunBag)
{
if(g.owned) cout << “- " << g.gunName << " 弹药:” << g.bulletNow << “/” << g.bulletMax << “改装Lv”<<g.modifyLevel<<“\n”;
}
cout << “\n【符咒】\n”;
for(auto &t : hero.talismanList)
{
if(t.unlock) cout << “- " << t.name << “\n”;
else cout << “- " << t.name << “【未解锁】\n”;
}
cout << “\n【当前世界坐标】 X:”<<hero.posX<<” Y:”<<hero.posY;
cout << “\n===========================================\n”;
system(“pause”);
}
void movePlayer(char key)
{
long long nx = hero.posX;
long long ny = hero.posY;
if(key == ‘w’) nx–;
if(key == ‘s’) nx++;
if(key == ‘a’) ny–;
if(key == ‘d’) ny++;
hero.posX = nx;
hero.posY = ny;
Tile &cell = getTile(nx,ny);
cell.explored = true;
if(cell.type == ENEMY)
{
Enemy foe = createEnemy(1 + abs(nx+ny)/20);
battle(foe);
cell.type = EMPTY;
}
else if(cell.type == SUPPLY)
{
int coinGet = 100 + rand()%200;
hero.crystalCoin += coinGet;
slowPrint("📦搜刮物资,获得" + to_string(coinGet) + "灾厄晶币");
cell.type = EMPTY;
}
else if(cell.type == SAFE_HOUSE)
{
hero.hp = hero.hpMax;
slowPrint("🏠安全屋休息完毕,血量回满!");
}
else if(cell.type == BOSS_SPOT)
{
Enemy boss = createBoss(2 + abs(nx+ny)/15);
battle(boss);
cell.type = EMPTY;
}
}
void shelterMenu()
{
while(true)
{
system(“cls”);
cout<<“====避难所管理菜单====\n”;
cout<<“1 建造避难所\n2 查看避难所信息\n3 存入物资\n4 取出物资\n5 放弃避难所\n0 返回\n请选择:”;
int op;cin>>op;
if(op ==0) break;
if(op ==1) buildShelter();
if(op ==2) showShelterInfo();
if(op ==3) shelterDeposit();
if(op ==4) shelterTake();
if(op ==5) abandonShelter();
system(“pause”);
}
}
void initWorld(){
chunkPool.clear();
worldZone.clear();
worldZone.push_back({“废弃市区”,1,80,160,true,{}});
worldZone.push_back({“沦陷商业区”,3,140,240,false,{}});
worldZone.push_back({“灾厄核心区”,6,280,450,false,{}});
currentZoneID = 0;
hero.posX = 0;
hero.posY = 0;
hero.shopAbilityPool = shopAbilityPool;
hero.shopMartialPool = shopMartialPool;
hero.shopGunPool = shopGunPool;
hero.talismanList = talismanOriginal;
playerTeam = {"","",{},false};
myShelter = {"","",false,0,0,0,0};
}
int main()
{
srand((unsigned int)time(NULL));
initWorld();
hero.userName = “玩家”;
hero.hp = 120;
hero.hpMax = 120;
hero.crystalCoin = 500;
hero.beastCore = 5;
hero.realmLv = 0;
hero.pointPool = 0;
hero.weekCount = 1;
hero.yiYang = 10;
hero.wisdom = 10;
hero.spirit = 10;
hero.will = 10;
hero.speed = 10;
hero.strength = 10;
hero.armorValue = 0;
slowPrint("末世降临,系统绑定成功!");
slowPrint("无限环绕星球世界开启,向任意方向永远行走不会撞墙");
int mainCmd;
while(true)
{
system("cls");
drawInfiniteMap();
cout<<"\n====主菜单===="<<endl;
cout<<"1.移动探索(输入W/A/S/D)\n2.打开系统商城\n3.查看个人面板\n4.异能升级界面\n5.避难所管理\n6.小队管理\n0.退出游戏\n请选择:";
cin>>mainCmd;
if(mainCmd == 1)
{
char c;
cout << "输入移动按键:";
cin >> c;
movePlayer(c);
}
else if(mainCmd == 2) openShop();
else if(mainCmd == 3) showPanel();
else if(mainCmd == 4) openUpgradePanel();
else if(mainCmd == 5) shelterMenu();
else if(mainCmd == 6) teamMenu();
else if(mainCmd == 0) break;
}
slowPrint("游戏结束");
return 0;
}