还在编写中…
#include<bits/stdc++.h>
#include<windows.h>
#include<stdio.h>
#include<conio.h>
#include<time.h>
#define RED(s) std::cout << RED << s << RESET;
#define GREEN(s) std::cout << GREEN << s << RESET;
#define YELLOW(s) std::cout << YELLOW << s << RESET;
#define BLUE(s) std::cout << BLUE << s << RESET;
#define PURPLE(s) std::cout << PURPLE << s << RESET;
#define PINK(s) color(3), cout << s, color(0);
#define CYAN(s) color(1), cout << s, color(0);
#define BROWN(s) color(6), cout << s, color(0);
using namespace std;
const int MAXN = 1e2, MAXK = 1e6;
const std::string RED = "\033[31m"; // 红色
const std::string GREEN = "\033[32m"; // 绿色
const std::string YELLOW = "\033[33m"; // 黄色
const std::string BLUE = "\033[34m"; // 蓝色
const std::string PURPLE = "\033[35m"; // 粉色
const std::string RESET = "\033[0m"; // 重置颜色
void color(int a) {
if (a == 0)
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
if (a == 1)
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE);
if (a == 2)
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_GREEN);
if (a == 3)
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE);
if (a == 4)
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
if (a == 5)
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN);
if (a == 6)
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN);
}
void Read();
void Save();
void slowsay();
void Game_Start();
void cout_grade(int x);
void garden();
void desert();
void ocean();
void jungle();
void hell();
void backpack();
void ant_hell1();
void ant_hell2();
void ant_hell3();
char garden_map[11][11] = {
{"....#....."},
{"........#."},
{".#....#..."},
{"....#....O"},
{".#........"},
{"...A.#...."},
{".........J"},
{"..#......."},
{"......#..."},
{"...#D....."}
};
char desert_map[11][11] = {
{"....#G...."},
{"........#."},
{".#....#..."},
{"....#..#.J"},
{".#........"},
{"....F#...."},
{".........."},
{"..#......."},
{"......#..."},
{"...#......"}
};
char ocean_map[11][11] = {
{"....#....."},
{"........#."},
{".#....#..."},
{"....#....."},
{".#.#...#.."},
{"...#...##."},
{"...#....#."},
{"...#...##."},
{"#..#..#.#."},
{"...#J.#..G"}
};
char jungle_map[11][11] = {
{".D.G#....."},
{"....#...#."},
{".#..#.#..."},
{"....#....."},
{".#..#....."},
{"....#....."},
{"....#....."},
{"..#.#....."},
{".T....#..."},
{".........."}
};
char hell_map[11][11] = {
{"......####"},
{"###....###"},
{"##......##"},
{"#........#"},
{".........."},
{".........."},
{"#........#"},
{"##......##"},
{"###....###"},
{"####..####"}
};
char Ant_Hell1_map[11][11] = {
{".D........"},
{".........."},
{".###....##"},
{"....#....."},
{"A.#..#.#.."},
{".....#.#.."},
{".....#.#.T"},
{".....#.#.."},
{".....#.#.."},
{".....#.#.."}
};
char Ant_Hell2_map[11][11] = {
{".........."},
{"....#....."},
{"########.."},
{".#..#....."},
{".........T"},
{"....#....."},
{".#..##.###"},
{".#..##..##"},
{".#..###..."},
{"F#.G###..."}
};
char Ant_Hell3_map[11][11] = {
{"A...#....."},
{".#..#....."},
{"..#..##..."},
{"...#..#..."},
{".#.##.##.."},
{"###......."},
{"F.......##"},
{"##....#..."},
{"##....#..."},
{"##.#..#..J"}
};
map<int, string> mp;
int now_world;
struct player {
string name;
int grade = 1, hp = 50, demage = 10, exp = 0, need_exp = 50, nowhp = 50;
int num[9];
map<string, int> petal[9];
int load = 5;
pair<string, int> use[11];
}you;
bool world[MAXN];
struct node {
int hp, atk, poison, poison_time;
};
struct node2 {
int len;
pair<string, int> drop[MAXN];
};
map<string, node2> mob_drop;
map<string, node> petal[9];
struct enemy {
string name;
int grade, blood, atk, rb, poison, poison_time, p; // p表示怪物的状态,0障碍,1被动,2中立,3敌对,4召唤
}garden_mobs[] = {
{"\0", 0, 0, 0, 0, 0}, {"rock", 1, 50, 10, 0, 0, 0, 0}, {"rock", 2, 187, 30, 0, 0, 0, 0}, {"rock", 3, 675, 90, 0, 0, 0, 0}, {"rock", 4, 2700, 270, 0, 0, 0, 0}, {"rock", 5, 2020, 810, 0, 0, 0, 0}, {"rock", 6, 122000, 2400, 0, 0, 0, 0}, {"rock", 7, 1500000, 7300, 0, 0, 0, 0}, {"rock", 8, 66000000, 21900, 0, 0, 0, 0},
{"ladybug", 1, 62, 10, 0, 0, 0, 1}, {"ladybug", 2, 234, 30, 0, 0, 0, 1}, {"ladybug", 3, 843, 90, 0, 0, 0, 2}, {"ladybug", 4, 3400, 270, 0, 0, 0, 2}, {"ladybug", 5, 25300, 810, 0, 0, 0, 2}, {"ladybug", 6, 152000, 2400, 0, 0, 0, 2}, {"ladybug", 7, 1800000, 7300, 0, 0, 0, 2}, {"ladybug", 8, 82000000, 21900, 0, 0, 0, 2},
{"bee", 1, 37, 50, 0, 0, 0, 1}, {"bee", 2, 140, 150, 0, 0, 0, 1}, {"bee", 3, 506, 450, 0, 0, 0, 2}, {"bee", 4, 2000, 1400, 0, 0, 0, 2}, {"bee", 5, 15180, 4050, 0, 0, 0, 2}, {"bee", 6, 91100, 12200, 0, 0, 0, 2}, {"bee", 7, 1640000, 36300, 0, 0, 0, 2}, {"bee", 8, 82000000, 108900, 0, 0, 0, 2},
{"Centipede", 1, 20, 10, 0, 0, 0, 1}, {"Centipede", 2, 32, 11, 0, 0, 0, 1}, {"Centipede", 3, 50, 13, 0, 0, 0, 2}, {"Centipede", 4, 80, 16, 0, 0, 0, 2}, {"Centipede", 5, 500, 20, 0, 0, 0, 2}, {"Centipede", 6, 2000, 35, 0, 0, 0, 2}, {"Centipede", 7, 10000, 100, 0, 0, 0, 2}, {"Centipede", 8, 150000, 640, 0, 0, 0, 2},
{"spider", 1, 25, 25, 0, 0, 0, 3}, {"spider", 2, 40, 27, 0, 0, 0, 3}, {"spider", 3, 630, 320, 0, 0, 0, 3}, {"spider", 4, 1000, 400, 0, 0, 0, 3}, {"spider", 5, 32500, 500, 0, 0, 0, 3}, {"spider", 6, 250000, 3700, 0, 0, 0, 3}, {"spider", 7, 750000, 30000, 0, 0, 0, 3}, {"spider", 8, 12100000, 64000, 0, 0, 0, 3},
{"Ant Hole", 1, 750, 15, 0, 0, 0, 4}, {"Ant Hole", 2, 2800, 45, 0, 0, 0, 4}, {"Ant Hole", 3, 10100, 135, 0, 0, 0, 4}, {"Ant Hole", 4, 40500, 405, 0, 0, 0, 4}, {"Ant Hole", 5, 304000, 12000, 0, 0, 0, 4}, {"Ant Hole", 6, 1800000, 3600, 0, 0, 0, 4}, {"Ant Hole", 7, 3600000, 7300, 0, 0, 0, 4}, {"Ant Hole", 8, 82000000, 21900, 0, 0, 0, 4},
};
enemy Ant_Hell1_mobs[] = {
{"Fire Soldier Ant", 1, 100, 20, 0, 0, 0, 3}, {"Fire Soldier Ant", 2, 375, 60, 0, 0, 0, 3}, {"Fire Soldier Ant", 3, 1400, 180, 0, 0, 0, 3}, {"Fire Soldier Ant", 4, 5400, 540, 0, 0, 0, 3}, {"Fire Soldier Ant", 5, 40500, 1620, 0, 0, 0, 3}, {"Fire Soidier Ant", 6, 243000, 4800, 0, 0, 0, 3}, {"Fire Soldier Ant", 7, 2900000, 14600, 0, 0, 0, 3}, {"Fire Soldier Ant", 8, 5800000, 43800, 0, 0, 0, 3},
{"Fire Worker Ant", 1, 100, 20, 0, 0, 0, 1}, {"Fire Worker Ant", 2, 375, 60, 0, 0, 0, 1}, {"Fire Worker Ant", 3, 1400, 180, 0, 0, 0, 2}, {"Fire Worker Ant", 4, 5400, 540, 0, 0, 0, 2}, {"Fire Worker Ant", 5, 40500, 1620, 0, 0, 0, 2}, {"Fire Worker Ant", 6, 243000, 4800, 0, 0, 0, 2}, {"Fire Worker Ant", 7, 2900000, 14600, 0, 0, 0, 2}, {"Fire Worker Ant", 8, 5800000, 43800, 0, 0, 0, 2},
{"Fire Baby Ant", 1, 25, 20, 0, 0, 0, 1}, {"Fire Baby Ant", 2, 93, 60, 0, 0, 0, 1}, {"Fire Baby Ant", 3, 337, 180, 0, 0, 0, 1}, {"Fire Baby Ant", 4, 1400, 540, 0, 0, 0, 1}, {"Fire Baby Ant", 5, 10100, 1620, 0, 0, 0, 1}, {"Fire Baby Ant", 6, 60800, 4800, 0, 0, 0, 1}, {"Fire Baby Ant", 7, 729000, 14600, 0, 0, 0, 1}, {"Fire Baby Ant", 8, 1000000, 43800, 0, 0, 0, 1}
};
enemy Ant_Hell2_mobs[] = {
{"Soldier Ant", 1, 100, 10, 0, 0, 0, 3}, {"Soldier Ant", 2, 375, 30, 0, 0, 0, 3}, {"Soldier Ant", 3, 1400, 90, 0, 0, 0, 3}, {"Soldier Ant", 4, 5400, 270, 0, 0, 0, 3}, {"Soldier Ant", 5, 40500, 810, 0, 0, 0, 3}, {"Soidier Ant", 6, 243000, 2400, 0, 0, 0, 3}, {"Soldier Ant", 7, 2900000, 7300, 0, 0, 0, 3}, {"Soldier Ant", 8, 5800000, 21900, 0, 0, 0, 3},
{"Worker Ant", 1, 100, 10, 0, 0, 0, 1}, {"Worker Ant", 2, 375, 30, 0, 0, 0, 1}, {"Worker Ant", 3, 1400, 90, 0, 0, 0, 2}, {"Worker Ant", 4, 5400, 270, 0, 0, 0, 2}, {"Worker Ant", 5, 40500, 810, 0, 0, 0, 2}, {"Worker Ant", 6, 243000, 2400, 0, 0, 0, 2}, {"Worker Ant", 7, 2900000, 7300, 0, 0, 0, 2}, {"Worker Ant", 8, 5800000, 21900, 0, 0, 0, 2},
{"Baby Ant", 1, 25, 10, 0, 0, 0, 1}, {"Baby Ant", 2, 93, 30, 0, 0, 0, 1}, {"Baby Ant", 3, 337, 90, 0, 0, 0, 1}, {"Baby Ant", 4, 1400, 270, 0, 0, 0, 1}, {"Baby Ant", 5, 10100, 810, 0, 0, 0, 1}, {"Baby Ant", 6, 60800, 2400, 0, 0, 0, 1}, {"Baby Ant", 7, 729000, 7300, 0, 0, 0, 1}, {"Baby Ant", 8, 1000000, 21900, 0, 0, 0, 1}
};
enemy Ant_Hell3_mobs[] = {
{"Soldier termite", 1, 200, 10, 0, 0, 0, 3}, {"Soldier termite", 2, 750, 30, 0, 0, 0, 3}, {"Soldier termite", 3, 2800, 90, 0, 0, 0, 3}, {"Soldier termite", 4, 10800, 270, 0, 0, 0, 3}, {"Soldier termite", 5, 81000, 810, 0, 0, 0, 3}, {"Soldier termite", 6, 486000, 2400, 0, 0, 0, 3}, {"Soldier termite", 7, 5800000, 7300, 0, 0, 0, 3}, {"Soldier termite", 8, 11600000, 21900, 0, 0, 0, 3},
{"Worker termite", 1, 200, 10, 0, 0, 0, 1}, {"Worker termite", 2, 750, 30, 0, 0, 0, 1}, {"Worker termite", 3, 2800, 90, 0, 0, 0, 2}, {"Worker termite", 4, 10800, 270, 0, 0, 0, 2}, {"Worker termite", 5, 81000, 810, 0, 0, 0, 2}, {"Worker termite", 6, 486000, 2400, 0, 0, 0, 2}, {"Worker termite", 7, 5800000, 7300, 0, 0, 0, 2}, {"Worker termite", 8, 11600000, 21900, 0, 0, 0, 2},
{"Baby termite", 1, 50, 10, 0, 0, 0, 1}, {"Baby termite", 2, 186, 30, 0, 0, 0, 1}, {"Baby termite", 3, 674, 90, 0, 0, 0, 1}, {"Baby termite", 4, 1280, 270, 0, 0, 0, 1}, {"Baby termite", 5, 20200, 810, 0, 0, 0, 1}, {"Baby termite", 6, 121600, 2400, 0, 0, 0, 1}, {"Baby termite", 7, 1438000, 7300, 0, 0, 0, 1}, {"Baby termite", 8, 2000000, 21900, 0, 0, 0, 1}
};
map<int, int> craft_succes;
void Read() {
ifstream in("florr游戏存档.in");
in >> you.name >> you.hp >> you.demage;
for(int i = 1; i <= 8; i++) {
in >> you.num[i];
for(int j = 1; j <= you.num[i]; j++) {
string x;
int y;
in >> x >> y;
you.petal[i][x] = y;
}
}
in >> you.load;
for(int i = 1; i <= you.load; i++) {
string name;
int grade;
in >> name >> grade;
you.use[i] = {name, grade};
}
for(int i = 1; i <= 5; i++) {
in >> world[i];
}
in.close();
}
void Save() {
ofstream out("florr游戏存档.in");
out << you.name << " " << you.hp << " " << you.demage << "\n";
for(int i = 1; i <= 8; i++) {
out << you.num[i] << "\n";
for(auto j : you.petal[i]) {
out << j.first << " " << j.second << "\n";
}
}
out << you.load << "\n";
for(int i = 1; i <= you.load; i++) {
out << you.use[i].first << " " << you.use[i].second << "\n";
}
for(int i = 1; i <= 5; i++) {
out << world[i] << " ";
}
out.close();
}
void slowsay(string s, int x) {
for(int i = 0; i < s.size(); i++) {
cout << s[i];
Sleep(x);
}
return;
}
void cout_grade(int grade) {
if(grade == 1) {
GREEN(mp[grade]);
}
if(grade == 2) {
YELLOW(mp[grade]);
}
if(grade == 3) {
BLUE(mp[grade]);
}
if(grade == 4) {
PURPLE(mp[grade]);
}
if(grade == 5) {
RED(mp[grade]);
}
if(grade == 6) {
CYAN(mp[grade]);
}
if(grade == 7) {
PINK(mp[grade]);
}
if(grade == 8) {
GREEN(mp[grade]);
}
}
int x = 1, y = 1;
void respawn() {
system("cls");
if(now_world == 1) {
garden();
}
else if(now_world == 2) {
desert();
}
else if(now_world == 3) {
ocean();
}
else if(now_world == 4) {
jungle();
}
else if(now_world == 5) {
hell();
}
else if(now_world == 6) {
ant_hell1();
}
else if(now_world == 7) {
ant_hell2();
}
else if(now_world == 8) {
ant_hell3();
}
}
void die(int &x, int &y) {
cout << "你死了。\n";
cout << "你选择:\n";
while(1) {
int P;
cout << "1.重生\n";
if(now_world != 5) {
cout << "2.等一会\n";
}
cin >> P;
if(P == 1) {
x = 1, y = 1;
system("cls");
Game_Start();
}
else if(now_world != 5) {
cout << "你等了一会……\n";
int p = rand() % 3;
if(p == 0) {
cout << "一个玩家路过了你!\n";
int p2 = rand() % 2;
if(p2 == 0) {
cout << "然而他没有管你,离开了。\n";
}
else {
cout << "他停在了你旁边!\n";
Sleep(1000);
int help = rand() % 2;
if(rand() % 2 == 0) {
GREEN("他选择ygg你!\n");
Sleep(1000);
you.nowhp = you.hp / 10;
return;
}
else {
system("color 40");
cout << "他选择" << "mark" << "你!\n";
Sleep(1000);
system("color 07");
system("cls");
you.nowhp = you.hp;
hell();
}
}
}
else {
cout << "无事发生……\n";
Sleep(1000);
system("cls");
}
}
system("cls");
}
}
void change_load() {
system("cls");
backpack();
int x;
cout << "你选择:\n";
cout << "1.交换装备槽的两个花瓣\n";
cout << "2.交换背包里的花瓣和装备槽里的花瓣\n";
cout << "0.退出\n";
cin >> x;
if(x == 0) {
return;
}
else if(x == 1) {
cout << "输入你要交换的两个花瓣的编号(编号从1开始):";
int y;
cin >> x >> y;
if(x >= 1 && y <= you.load && x <= you.load && y >= 1) {
swap(you.use[x], you.use[y]);
}
change_load();
return;
}
else if(x == 2) {
cout << "输入你要交换的背包中的花瓣的名字与等级,最后输入你卡槽中花瓣的编号(等级从小到大,编号也是一样,都从1开始),比如:claw, 3, 1,会将Rare等级的claw放到1号槽位上:";
string name;
int grade;
int x;
cin >> name >> grade >> x;
if(you.petal[grade][name] != 0 && x >= 1 && x <= you.load) {
you.petal[you.use[x].second][you.use[x].first]++;
you.use[x] = {name, grade};
you.petal[you.use[x].second][you.use[x].first]--;
}
change_load();
}
else {
change_load();
}
}
void fight(int area) {
enemy M;
int p1 = 1, p2 = rand() % 100 + 1;
if(p2 <= 70) {
p1 += 1;
}
else if(p2 >= 71 && p2 <= 80) {
p1 += 2;
}
else if(p2 >= 71 && p2 <= 80) {
p1 += 2;
}
else if(p2 >= 81 && p2 <= 85) {
p1 += 3;
}
else if(p2 >= 86 && p2 <= 90) {
p1 += 4;
}
else if(p2 >= 90 && p2 <= 93) {
p1 += 5;
}
else if(p2 >= 94 && p2 <= 97) {
p1 += 6;
}
else if(p2 >= 98 && p2 <= 99) {
p1 += 7;
}
else {
p1 += 8;
}
if(area == 1) {
p1 += rand() % 6 * 8;
M = garden_mobs[p1];
}
else if(area == 2) {
// p1 += rand() % 6 * 8;
// M = garden_mobs[p1];
}
else if(area == 3) {
// p1 += rand() % 6 * 8;
// M = garden_mobs[p1];
}
else if(area == 4) {
// p1 += rand() % 6 * 8;
// M = garden_mobs[p1];
}
else if(area == 5) {
// p1 += rand() % 6 * 8;
// M = garden_mobs[p1];
}
else if(area == 6) {
p1 += rand() % 3 * 8;
M = Ant_Hell1_mobs[p1];
}
else if(area == 7) {
p1 += rand() % 3 * 8;
M = Ant_Hell2_mobs[p1];
}
else if(area == 8) {
p1 += rand() % 3 * 8;
M = Ant_Hell3_mobs[p1];
}
system("color 01");
system("color FB");
system("color 01");
system("color FB");
system("color 01");
system("color FB");
system("color 07");
cout << you.name << "与";
cout_grade(M.grade);
cout << " " << M.name << "展开了战斗!";
Sleep(3000);
system("cls");
int mob_now_hp = M.blood, mob_poison = 0, flower_poison = 0, flower_poison_time = 0, mob_poison_time = 0, p = 1;
while(you.nowhp > 0 && mob_now_hp > 0) {
cout << "你的血量:" << you.nowhp << " 怪物的血量:" << mob_now_hp << "\n";
bool q = false;
cout << "--- " << you.name << "的回合 ---\n";
cout << "你选择:1.攻击 2.躲避(小概率失败) 3.逃跑 4.撞上去\n";
bool sb = false;
int x;
cin >> x;
if(x == 1) {
q = true;
int L = max(petal[you.use[p].second][you.use[p].first].atk + rand() % 50 - 25, 1), l = petal[you.use[p].second][you.use[p].first].hp;
while(l > 0) {
cout << you.name << "的";
cout_grade(you.use[p].second);
cout << " " << you.use[p].first << " 撞向了" << M.name << "!" << "对其造成了" << L << "点伤害!\n";
mob_now_hp -= L;
l -= M.atk;
}
if(you.use[p].first == "claw" && mob_now_hp / 8 * 10 >= M.blood) {
cout << you.name << "的claw打出暴击,额外造成了" << petal[you.use[p].second][you.use[p].first].atk * 2 << "点伤害!\n";
mob_now_hp -= petal[you.use[p].second][you.use[p].first].atk * 2;
}
if(petal[you.use[p].second][you.use[p].first].poison > 0) {
cout << "触发毒伤!" << you.name << "对" << M.name << "造成了" << petal[you.use[p].second][you.use[p].first].poison << "点毒伤," << "持续" << petal[you.use[p].second][you.use[p].first].poison_time << "回合!" << (mob_poison_time > 0 ? "但覆盖掉了之前的毒伤!" : "");
mob_poison_time = petal[you.use[p].second][you.use[p].first].poison_time;
mob_poison = petal[you.use[p].second][you.use[p].first].poison;
}
if(M.p == 4) {
cout << you.name << "对" << M.name << "造成了伤害," << M.name << "召唤了怪物!\n";
if(M.name == "Ant Hole") {
fight(5);
}
else if(M.name == "Fire Ant borrow") {
fight(6);
}
else {
fight(7);
}
cout << "\n\n";
cout << you.name << "重新展开了和" << M.name << "的战斗!\n";
system("cls");
}
}
else if(x == 2) {
int p1 = rand() % 100 + 1;
if(p1 <= 70) {
cout << "闪避成功!\n";
sb = true;
}
else {
cout << "闪避失败!\n";
}
}
else if(x == 3) {
int p1 = rand() % 100 + 1;
if(p1 <= 30 || M.p != 3) {
cout << "溜了溜了……\n";
return;
}
else {
cout << you.name << "被怪物追上了!\n";
}
}
else if(x == 4) {
cout << "你直接撞了上去!\n";
cout << "你对怪物造成了" << you.demage << "点伤害!\n";
cout << "怪物对你造成了" << M.atk << "点伤害!\n";
you.nowhp -= M.atk;
mob_now_hp -= you.demage;
}
cout << "--- " << M.name << "的回合 ---\n";
if(M.p == 0 || M.p == 4) {
cout << M.name << "屹立不动……\n";
}
else if(M.p == 1) {
cout << M.name << "没有攻击" << you.name << "的意图……\n";
}
else if(M.p == 2) {
if(q) {
cout << M.name << "被激怒了,撞掉了" << you.name << "的" << M.atk * !sb << "点血量!\n";
you.nowhp -= M.atk;
M.p = 3;
}
else {
cout << M.name << "疑惑的注视着你。\n";
}
}
else {
cout << M.name << "早就忍" << you.name << "很久了,向着" << you.name << "撞了过来!\n";
if(M.poison > 0 && !sb) {
cout << you.name << "受到了" << M.poison << "点毒伤,持续" << M.poison_time << "回合!\n";
}
cout << you.name << "受到了" << M.atk * !sb << "点伤害。\n";
you.nowhp -= M.atk * !sb;
}
while(!kbhit()) {
}
system("cls");
cout << "--- 回合结束 ---\n";
if(flower_poison > 0) {
cout << you.name << "受到了" << flower_poison << "点毒伤!\n";
you.nowhp -= flower_poison;
flower_poison_time--;
if(flower_poison_time == 0) {
flower_poison = 0;
}
}
if(mob_poison > 0) {
cout << M.name << "受到了" << mob_poison << "点毒伤!\n";
mob_now_hp -= mob_poison;
mob_poison_time--;
if(mob_poison_time == 0) {
mob_poison = 0;
}
}
cout << "\n\n\n";
system("pause");
system("cls");
}
system("cls");
if(you.nowhp <= 0 && mob_now_hp < 0) {
cout << "与怪物同归于尽了!\n";
die(x, y);
}
else if(mob_now_hp < 0) {
cout << "怪物死了!\n";
}
else {
die(x, y);
}
}
void garden() {
x = 0, y = 0;
now_world = 1;
world[now_world] = true;
cout << "按下 Q 来改变装备,按下R停在原地,WASD移动(大写)。\n";
system("pause");
while(1) {
cout << "healthy:" << you.nowhp << " " << "demage:" << you.demage << "\n";
for(int i = 0; i < 10; i++) {
for(int j = 0; j < 10; j++) {
if(i == x && j == y) {
cout << "@";
}
else {
cout << garden_map[i][j];
}
}
cout << "\n";
}
while(!kbhit()) {
}
char g = getch();
if(g == 'Q') {
change_load();
}
else if(g == 'W' && garden_map[x - 1][y] != '#' && x > 0) {
x--;
}
else if(g == 'A' && garden_map[x][y - 1] != '#' && x < 9) {
y--;
}
else if(g == 'S' && garden_map[x + 1][y] != '#' && y > 0) {
x++;
}
else if(g == 'D' && garden_map[x][y + 1] != '#' && y < 9) {
y++;
}
if(garden_map[x][y] != '.' && garden_map[x][y] != '#') {
cout << "你发现了一个传送门,似乎通往……";
if(garden_map[x][y] == 'D' && world[2]) {
YELLOW("沙漠");
}
else if(garden_map[x][y] == 'J' && world[4]) {
GREEN("丛林");
}
else if(garden_map[x][y] == 'O' && world[3]) {
BLUE("海洋");
}
else if(garden_map[x][y] == 'A') {
BROWN("蚁穴");
}
else {
cout << "你不知道。";
}
cout << "\n你决定:\n";
cout << "1.进去\n";
cout << "2.不进\n";
int x;
cin >> x;
if(x == 1) {
now_world = (garden_map[x][y] == 'D' ? 2 : (garden_map[x][y] == 'J' ? 4 : (garden_map[x][y] == 'O' ? 3 : 7)));
cout << now_world << "\n";
Sleep(3000);
respawn();
}
system("cls");
}
if(rand() % 10 == 0) {
fight(1);
}
system("cls");
}
}
void desert() {
world[2] = true;
x = y = 0;
now_world = 1;
world[now_world] = true;
cout << "按下 Q 来改变装备,按下R停在原地,WASD移动(大写)。\n";
system("pause");
while(1) {
cout << "healthy:" << you.nowhp << " " << "demage:" << you.demage << "\n";
for(int i = 0; i < 10; i++) {
for(int j = 0; j < 10; j++) {
if(i == x && j == y) {
cout << "@";
}
else {
cout << desert_map[i][j];
}
}
cout << "\n";
}
while(!kbhit()) {
}
char g = getch();
if(g == 'Q') {
change_load();
}
else if(g == 'W' && desert_map[x - 1][y] != '#' && x > 0) {
x--;
}
else if(g == 'A' && desert_map[x][y - 1] != '#' && x < 9) {
y--;
}
else if(g == 'S' && desert_map[x + 1][y] != '#' && y > 0) {
x++;
}
else if(g == 'D' && desert_map[x][y + 1] != '#' && y < 9) {
y++;
}
if(desert_map[x][y] != '.' && desert_map[x][y] != '#') {
cout << "你发现了一个传送门,似乎通往……";
if(desert_map[x][y] == 'G' && world[1]) {
GREEN("花园");
}
else if(desert_map[x][y] == 'J' && world[4]) {
GREEN("丛林");
}
else if(desert_map[x][y] == 'O' && world[3]) {
BLUE("海洋");
}
else if(desert_map[x][y] == 'F') {
RED("火蚁穴");
}
else {
cout << "你不知道。";
}
cout << "\n你决定:\n";
cout << "1.进去\n";
cout << "2.不进\n";
int x;
cin >> x;
if(x == 1) {
now_world = (desert_map[x][y] == 'G' ? 1 : (desert_map[x][y] == 'J' ? 4 : (desert_map[x][y] == 'O' ? 2 : 7)));
respawn();
}
system("cls");
}
if(rand() % 10 == 0) {
fight(2);
}
system("cls");
}
}
void ocean() {
world[3] = true;
x = y = 0;
now_world = 1;
world[now_world] = true;
cout << "按下 Q 来改变装备,按下R停在原地,WASD移动(大写)。\n";
system("pause");
while(1) {
cout << "healthy:" << you.nowhp << " " << "demage:" << you.demage << "\n";
for(int i = 0; i < 10; i++) {
for(int j = 0; j < 10; j++) {
if(i == x && j == y) {
cout << "@";
}
else {
cout << ocean_map[i][j];
}
}
cout << "\n";
}
while(!kbhit()) {
}
char g = getch();
if(g == 'Q') {
change_load();
}
else if(g == 'W' && ocean_map[x - 1][y] != '#' && x > 0) {
x--;
}
else if(g == 'A' && ocean_map[x][y - 1] != '#' && x < 9) {
y--;
}
else if(g == 'S' && ocean_map[x + 1][y] != '#' && y > 0) {
x++;
}
else if(g == 'D' && ocean_map[x][y + 1] != '#' && y < 9) {
y++;
}
if(ocean_map[x][y] != '.' && ocean_map[x][y] != '#') {
cout << "你发现了一个传送门,似乎通往……";
if(ocean_map[x][y] == 'D' && world[2]) {
YELLOW("沙漠");
}
if(ocean_map[x][y] == 'G') {
GREEN("花园");
}
else if(ocean_map[x][y] == 'J' && world[4]) {
GREEN("丛林");
}
else if(ocean_map[x][y] == 'O' && world[3]) {
BLUE("海洋");
}
else {
cout << "你不知道。";
}
cout << "\n你决定:\n";
cout << "1.进去\n";
cout << "2.不进\n";
int x;
cin >> x;
if(x == 1) {
now_world = (ocean_map[x][y] == 'D' ? 2 : (ocean_map[x][y] == 'J' ? 4 : (ocean_map[x][y] == 'O' ? 2 : 1)));
respawn();
}
system("cls");
}
if(rand() % 10 == 0) {
fight(3);
}
system("cls");
}
}
void jungle() {
world[4] = true;
x = y = 0;
now_world = 1;
world[now_world] = true;
cout << "按下 Q 来改变装备,按下R停在原地,WASD移动(大写)。\n";
system("pause");
while(1) {
cout << "healthy:" << you.nowhp << " " << "demage:" << you.demage << "\n";
for(int i = 0; i < 10; i++) {
for(int j = 0; j < 10; j++) {
if(i == x && j == y) {
cout << "@";
}
else {
cout << jungle_map[i][j];
}
}
cout << "\n";
}
while(!kbhit()) {
}
char g = getch();
if(g == 'Q') {
change_load();
}
else if(g == 'W' && jungle_map[x - 1][y] != '#' && x > 0) {
x--;
}
else if(g == 'A' && jungle_map[x][y - 1] != '#' && x < 9) {
y--;
}
else if(g == 'S' && jungle_map[x + 1][y] != '#' && y > 0) {
x++;
}
else if(g == 'D' && jungle_map[x][y + 1] != '#' && y < 9) {
y++;
}
if(jungle_map[x][y] != '.' && jungle_map[x][y] != '#') {
cout << "你发现了一个传送门,似乎通往……";
if(jungle_map[x][y] == 'D' && world[2]) {
YELLOW("沙漠");
}
else if(jungle_map[x][y] == 'G' && world[1]) {
GREEN("花园");
}
else if(jungle_map[x][y] == 'O' && world[3]) {
BLUE("海洋");
}
else if(jungle_map[x][y] == 'T') {
BROWN("白蚁穴");
}
else {
cout << "你不知道。";
}
cout << "\n你决定:\n";
cout << "1.进去\n";
cout << "2.不进\n";
int x;
cin >> x;
if(x == 1) {
now_world = (jungle_map[x][y] == 'D' ? 2 : (jungle_map[x][y] == 'G' ? 1 : (jungle_map[x][y] == 'O' ? 2 : 7)));
respawn();
}
system("cls");
}
if(rand() % 10 == 0) {
fight(4);
}
system("cls");
}
}
void hell() {
world[5] = true;
x = y = 0;
now_world = 1;
world[now_world] = true;
cout << "按下 Q 来改变装备,按下R停在原地,WASD移动(大写)。\n";
system("pause");
while(1) {
cout << "healthy:" << you.nowhp << " " << "demage:" << you.demage << "\n";
for(int i = 0; i <= 9; i++) {
for(int j = 0; j <= 9; j++) {
if(i == x && j == y) {
cout << "@";
}
else {
cout << hell_map[i][j];
}
}
cout << "\n";
}
while(!kbhit()) {
}
char g = getch();
if(g == 'Q') {
change_load();
}
else if(g == 'W' && hell_map[x - 1][y] != '#' && x > 0) {
x--;
}
else if(g == 'A' && hell_map[x][y - 1] != '#' && x < 9) {
y--;
}
else if(g == 'S' && hell_map[x + 1][y] != '#' && y > 0) {
x++;
}
else if(g == 'D' && hell_map[x][y + 1] != '#' && y < 9) {
y++;
}
fight(5);
system("cls");
}
}
void ant_hell1() {
x = y = 0;
now_world = 1;
world[now_world] = true;
cout << "按下 Q 来改变装备,按下R停在原地,WASD移动(大写)。\n";
system("pause");
while(1) {
cout << "healthy:" << you.nowhp << " " << "demage:" << you.demage << "\n";
for(int i = 0; i < 10; i++) {
for(int j = 0; j < 10; j++) {
if(i == x && j == y) {
cout << "@";
}
else {
cout << Ant_Hell1_map[i][j];
}
}
cout << "\n";
}
while(!kbhit()) {
}
char g = getch();
if(g == 'Q') {
change_load();
}
else if(g == 'W' && Ant_Hell1_map[x - 1][y] != '#' && x > 0) {
x--;
}
else if(g == 'A' && Ant_Hell1_map[x][y - 1] != '#' && x < 9) {
y--;
}
else if(g == 'S' && Ant_Hell1_map[x + 1][y] != '#' && y > 0) {
x++;
}
else if(g == 'D' && Ant_Hell1_map[x][y + 1] != '#' && y < 9) {
y++;
}
if(Ant_Hell1_map[x][y] != '.' && Ant_Hell1_map[x][y] != '#') {
cout << "你发现了一个传送门,似乎通往……";
if(Ant_Hell1_map[x][y] == 'D' && world[2]) {
YELLOW("沙漠");
}
else if(Ant_Hell1_map[x][y] == 'T' && world[4]) {
BROWN("白蚁穴");
}
else if(Ant_Hell1_map[x][y] == 'A') {
BROWN("蚁穴");
}
else {
cout << "你不知道。";
}
cout << "\n你决定:\n";
cout << "1.进去\n";
cout << "2.不进\n";
int x;
cin >> x;
if(x == 1) {
now_world = (Ant_Hell1_map[x][y] == 'D' ? 2 : (Ant_Hell1_map[x][y] == 'T' ? 8 : (Ant_Hell1_map[x][y] == 'A' ? 6 : 1)));
respawn();
}
system("cls");
}
if(rand() % 10 == 0) {
fight(6);
}
system("cls");
}
}
void ant_hell2() {
x = y = 0;
now_world = 1;
world[now_world] = true;
cout << "按下 Q 来改变装备,按下R停在原地,WASD移动(大写)。\n";
system("pause");
while(1) {
cout << "healthy:" << you.nowhp << " " << "demage:" << you.demage << "\n";
for(int i = 1; i <= 10; i++) {
for(int j = 1; j <= 10; j++) {
if(i == x && j == y) {
cout << "@";
}
else {
cout << Ant_Hell2_map[i][j];
}
}
cout << "\n";
}
while(!kbhit()) {
}
char g = getch();
if(g == 'Q') {
change_load();
}
else if(g == 'W' && Ant_Hell2_map[x - 1][y] != '#' && x > 1) {
x--;
}
else if(g == 'A' && Ant_Hell2_map[x][y - 1] != '#' && x < 10) {
y--;
}
else if(g == 'S' && Ant_Hell2_map[x + 1][y] != '#' && y > 1) {
x++;
}
else if(g == 'D' && Ant_Hell2_map[x][y + 1] != '#' && y < 10) {
y++;
}
if(Ant_Hell1_map[x][y] != '.' && Ant_Hell1_map[x][y] != '#') {
cout << "你发现了一个传送门,似乎通往……";
if(Ant_Hell1_map[x][y] == 'D' && world[2]) {
YELLOW("沙漠");
}
else if(Ant_Hell1_map[x][y] == 'T' && world[4]) {
BROWN("白蚁穴");
}
else if(Ant_Hell1_map[x][y] == 'A') {
BROWN("蚁穴");
}
else {
cout << "你不知道。";
}
cout << "\n你决定:\n";
cout << "1.进去\n";
cout << "2.不进\n";
int x;
cin >> x;
if(x == 1) {
now_world = (garden_map[x][y] == 'D' ? 2 : (garden_map[x][y] == 'J' ? 4 : (garden_map[x][y] == 'O' ? 2 : 6)));
respawn();
}
system("cls");
}
if(rand() % 10 == 0) {
fight(6);
}
system("cls");
}
}
void ant_hell3() {
x = 1, y = 1;
now_world = 1;
world[now_world] = true;
cout << "按下 Q 来改变装备,按下R停在原地,WASD移动(大写)。\n";
system("pause");
while(1) {
cout << "healthy:" << you.nowhp << " " << "demage:" << you.demage << "\n";
for(int i = 1; i <= 10; i++) {
for(int j = 1; j <= 10; j++) {
if(i == x && j == y) {
cout << "@";
}
else {
cout << garden_map[i][j];
}
}
cout << "\n";
}
while(!kbhit()) {
}
char g = getch();
if(g == 'Q') {
change_load();
}
else if(g == 'W' && garden_map[x - 1][y] != '#' && x > 1) {
x--;
}
else if(g == 'A' && garden_map[x][y - 1] != '#' && x < 10) {
y--;
}
else if(g == 'S' && garden_map[x + 1][y] != '#' && y > 1) {
x++;
}
else if(g == 'D' && garden_map[x][y + 1] != '#' && y < 10) {
y++;
}
if(garden_map[x][y] != '.' && garden_map[x][y] != '#') {
cout << "你发现了一个传送门,似乎通往……";
if(garden_map[x][y] == 'D' && world[2]) {
YELLOW("沙漠");
}
else if(garden_map[x][y] == 'J' && world[4]) {
GREEN("丛林");
}
else if(garden_map[x][y] == 'O' && world[3]) {
BLUE("海洋");
}
else if(garden_map[x][y] == 'A') {
BROWN("蚁穴");
}
else {
cout << "你不知道。";
}
cout << "\n你决定:\n";
cout << "1.进去\n";
cout << "2.不进\n";
int x;
cin >> x;
if(x == 1) {
now_world = (garden_map[x][y] == 'D' ? 2 : (garden_map[x][y] == 'J' ? 4 : (garden_map[x][y] == 'O' ? 2 : 6)));
respawn();
}
system("cls");
}
if(rand() % 10 == 0) {
fight(8);
}
system("cls");
}
}
void Choose_World() {
system("cls");
int x;
cout << "你要前往...\n";
if(world[1]) {
slowsay("1.花园\n", 10);
}
if(world[2]) {
slowsay("2.沙漠\n", 10);
}
if(world[3]) {
slowsay("3.海洋\n", 10);
}
if(world[4]) {
slowsay("4.丛林\n", 10);
}
if(world[5]) {
RED("地狱\n");
}
cin >> x;
if(x == 1) {
garden();
}
else if(x == 2 && world[2]) {
desert();
}
else if(x == 3 && world[3]) {
ocean();
}
else if(x == 4 && world[4]) {
jungle();
}
else if(x == 5 && world[5]) {
hell();
}
else {
Choose_World();
}
}
void backpack() {
system("cls");
cout << you.name << "的背包:\n";
for(int i = 8; i >= 1; i--) {
cout << "---- ";
cout_grade(i);
cout << " ----\n";
for(auto j : you.petal[i]) {
cout << "花瓣名称:" << j.first << " *" << j.second << "\n";
}
cout << "\n\n";
}
cout << you.name << "装备的花瓣:\n";
for(int i = 1; i <= you.load; i++) {
cout << "名称:" << you.use[i].first << " " << "等级:";
cout_grade(you.use[i].second);
cout << "\n";
}
cout << you.name << "的状态:\n";
cout << "healthy:" << you.hp << " " << "demage:" << you.demage << "\n";
while(!kbhit()) {
}
}
void craft() {
backpack();
cout << "输入你要合成的背包中的花瓣的名字与等级,比如:claw, 3,会合成一次Rare等级的claw\n";
string name;
int grade;
cin >> name >> grade;
if(you.petal[grade][name] >= 5 && grade < 8) {
cout << "你选择合成几个?:";
int x;
cin >> x;
int get = 0;
for(int i = 1; i <= x; i++) {
if(you.petal[grade][name] < 5) {
break;
}
int Craft = rand() % 100 + 1;
if(Craft <= craft_succes[grade]) {
get++;
you.petal[grade + 1][name]++;
you.petal[grade][name] -= 5;
}
else {
you.petal[grade][name] -= rand() % 4 + 1;
}
}
cout << "合成成功,你还剩下" << you.petal[grade][name] << "个等级为";
cout_grade(grade);
cout << "的" << name << "\n";
if(get >= 1) {
cout << "恭喜!";
cout << "你得到了" << get << "个等级为";
cout_grade(grade + 1);
cout << "的" << name << "。";
}
else {
cout << "很可惜,你什么都没得到...\n";
}
}
Sleep(5000);
}
void Game_Start() {
system("cls");
int x;
slowsay("1.开始游戏\n", 10);
slowsay("2.合成卡片\n", 10);
slowsay("3.存档(不会自动保存)\n", 10);
slowsay("4.查看状态\n", 10);
if(you.grade >= 10) {
slowsay("5.更改名称\n", 10);
}
slowsay("6.更改构筑\n", 10);
cin >> x;
if(x == 1) {
Choose_World();
}
else if(x == 2) {
craft();
}
else if(x == 3) {
Save();
}
else if(x == 4) {
backpack();
}
else if(x == 5 && you.grade >= 10) {
system("cls");
cout << "你要改的名字:";
cin >> you.name;
cout << "\n" << you.name << "," << "你的名字已更改。\n";
}
else {
Game_Start();
}
Sleep(1000);
system("cls");
Game_Start();
}
void init() {
mp[1] = "Common", mp[2] = "Unusual", mp[3] = "Rare", mp[4] = "Epic", mp[5] = "Legendary", mp[6] = "Mythic", mp[7] = "Ultra", mp[8] = "Super";
petal[1]["basic"] = {10, 5, 0, 0};
you.name = "你";
craft_succes[1] = 77;
craft_succes[2] = 50;
craft_succes[3] = 30;
craft_succes[4] = 8;
craft_succes[5] = 3;
craft_succes[6] = 2;
craft_succes[7] = 1;
for(int i = 1; i <= 5; i++) {
you.use[i] = {"basic", 1};
}
world[1] = true;
}
int main() {
srand(time(0));
init();
cout << "是否读档?(y/n)\n";
char c;
cin >> c;
if(c == 'y') {
Read();
}
system("cls");
Game_Start();
return 0;
}