C++#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
using namespace std;
int r[2], gm, card1[10], card2[10], sl, hp, lvl, Exp, exn, moy;
void slowsay(string s){
for(int i = 0; i < s.size(); i++) {
printf("%c",s[i]);
Sleep(20);
}
}
void printcard() {
if(gm == 1) {
slowsay("你现在的卡组是:----------\n");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),2);
slowsay("Common: ");
printf("%d\n", card1[1]);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),6);
slowsay("Unusual: ");
printf("%d\n", card1[2]);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),9);
slowsay("Rare: ");
printf("%d\n", card1[3]);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),5);
slowsay("Epic: ");
printf("%d\n", card1[4]);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),4);
slowsay("Legendary: ");
printf("%d\n", card1[5]);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),11);
slowsay("Mythic: ");
printf("%d\n", card1[6]);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),13);
slowsay("Ultra: ");
printf("%d\n", card1[7]);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),10);
slowsay("Super: ");
printf("%d\n", card1[8]);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),7);
slowsay("--------------------------\n");
slowsay("按任意键以继续...");
char ch = getch();
system("cls");
} else {
}
}
void printrarity(int r) {
if(r == 1) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),2);
slowsay("Common");
} else if(r == 2) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),6);
slowsay("Unusual");
} else if(r == 3) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),9);
slowsay("Rare");
} else if(r == 4) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),5);
slowsay("Epic");
} else if(r == 5) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),4);
slowsay("Legendary");
} else if(r == 6) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),11);
slowsay("Mythic");
} else if(r == 7) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),13);
slowsay("Ultra");
} else {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),10);
slowsay("Super");
}
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),7);
}
int gethp(int r) {
if(r == 1) return rand() % 20 + 30;
if(r == 2) return rand() % 50 + 100;
if(r == 3) return rand() % 200 + 300;
if(r == 4) return rand() % 500 + 1000;
if(r == 5) return rand() % 2000 + 3000;
if(r == 6) return rand() % 5000 + 10000;
if(r == 7) return rand() % 20000 + 30000;
else return rand() * rand() % 50000 + 100000;
}
void drop(int r) {
int a = rand() % 2 + 1 + max(rand() % 4 - 2, 0);
int b = max(rand() % r - r + 2, 0);
if(r == 8) b = 0;
printf("%d", a);
slowsay("张");
printrarity(r);
if(b > 0) {
slowsay(",");
printf("%d", b);
slowsay("张");
printrarity(r + 1);
}
card1[r] += a;
card1[r + 1] += b;
sl += (a << r) + (b << (r + 1));
}
int killmobday() {
slowsay("今天是刷怪日!\n");
slowsay("你会遇到随机的野怪(野怪的强度根据你的实力调整),然后尝试击败它们!\n");
slowsay("今天你遇到的是——————\n");
int mobrty = rand() % sl;
if(mobrty <= 3) mobrty = 1;
else if(mobrty <= 9) mobrty = 2;
else if(mobrty <= 27) mobrty = 3;
else if(mobrty <= 81) mobrty = 4;
else if(mobrty <= 243) mobrty = 5;
else if(mobrty <= 729) mobrty = 6;
else if(mobrty <= 2187) mobrty = 7;
else mobrty = 8;
printrarity(mobrty);
slowsay("等级的怪!\n");
slowsay("你是否要迎战?\n");
slowsay("1. 是\n");
slowsay("2. 否\n");
int opt;
cin >> opt;
if(opt == 1) {
int df = 1;
slowsay("战斗开始!\n");
slowsay("你现在的血量是:");
printf("%d", hp);
slowsay(" 敌人的血量是:");
int dhp = gethp(mobrty);
printf("%d\n", dhp);
while(hp > 0 && dhp > 0) {
slowsay("现在是你的回合!\n");
slowsay("请问你要选择:\n");
slowsay("1. 攻击\n");
slowsay("2. 叠伤害(使下一次造成的伤害*2)\n");
slowsay("3. 回复\n");
slowsay("4. 逃跑\n");
int gj;
cin >> gj;
if(gj == 1) {
int dmg = (sl + rand() % sl - rand() % sl) * rand() % 10 + 5;
dmg *= df;
df = 1;
slowsay("你造成了");
printf("%d", dmg);
slowsay("点伤害!");
dhp -= dmg;
if(dhp <= 0) {
slowsay("\n你击败了敌人!\n");
slowsay("敌人掉落了:\n");
drop(mobrty);
slowsay("\n你现在实力值为:");
printf("%d\n", sl);
Exp += 1<<mobrty;
while(Exp > exn){
lvl++;
slowsay("你升级了!\n");
Exp -= exn;
exn *= 2;
}
hp = lvl * 50 + 150;
slowsay("按任意键以继续...");
char ch = getch();
system("cls");
break;
}
Sleep(500);
system("cls");
} else if(gj == 2) {
df *= 2;
slowsay("你正在蓄力。。。目前伤害翻倍数:");
printf("%d\n",df);
Sleep(500);
system("cls");
} else if(gj == 3) {
int dmg = (sl + rand() % sl - rand() % sl) * rand() % 3 + 2;
dmg *= df;
df = 1;
slowsay("你恢复了");
printf("%d", dmg);
slowsay("点血量!");
hp += dmg;
} else {
int k = rand() % 3;
if(k <= 2) {
slowsay("你逃跑了。。。\n");
slowsay("按任意键以继续...");
char ch = getch();
system("cls");
break;
} else {
slowsay("敌人并没有让你逃出它的手掌心。");
}
}
int edmg = (1 << mobrty) + rand()%((1<<mobrty)) - rand()%((1<<mobrty));
slowsay("敌人造成了");
printf("%d", edmg);
slowsay("点伤害!");
hp -= edmg;
if(hp < 0) {
slowsay("你死了。。。\n");
slowsay("下次再来试一试吧。。。\n");
slowsay("----------R.I.P----------\n");
return -1;
}
slowsay("按任意键以继续...");
char ch = getch();
system("cls");
slowsay("你现在的血量是:");
printf("%d", hp);
slowsay(" 敌人的血量是:");
printf("%d\n", dhp);
}
} else {
slowsay("好吧,改日再战。。。也许你比较保守,或者你的实力还不足以战胜怪物。\n");
slowsay("按任意键以继续...");
char ch = getch();
system("cls");
}
return 0;
}
int craftday() {
slowsay("今天是合成日!\n");
slowsay("你可以合成你的卡片,以及连线一位NPC:Trader\n");
while(1) {
slowsay("请问你要:\n");
slowsay("1. 退出(开始下一天)\n");
slowsay("2. 合成(机制与florr相同)\n");
slowsay("3. 连线 Trader\n");
int ipt;
cin >> ipt;
if(ipt == 1) {
break;
} else if(ipt == 2) {
system("cls");
slowsay("请问你要合成哪个等级?\n");
printrarity(1);
slowsay("对应1,");
printrarity(2);
slowsay("对应2,以此类推。\n");
slowsay("输入0来退出。\n");
char ch;
while(ch != '0') {
ch = getch();
if(ch == '9' || ch == '8') slowsay("输入错误\n");
else {
int k = ch - '0';
if(card1[k] >= 5) {
int rd = rand() % (1 << k) + 2;
if(rd > (1 << k)){
slowsay("合成成功,你获得了1张");
printrarity(k + 1);
slowsay("\n");
card1[k] -= 5;
card1[k + 1] += 1;
sl += (rand() % 2 + 1) * (1 << (k + 1));
} else {
slowsay("合成失败\n");
card1[k] -= rand() % 4 + 1;
sl -= (rand () % 2 + 1) * (1 << (k / 2));
}
} else {
slowsay("卡片不够\n");
}
}
}
} else if(ipt == 3) {
system("cls");
slowsay("你好,我是Trader!我是这个世界的商人,你可以在我这里出售和换取卡牌!\n");
slowsay("请问你要干什么?\n");
slowsay("0. 我不干什么了,溜了溜了\n");
slowsay("1. 出售卡牌\n");
slowsay("2. 购买卡牌\n");
slowsay("3. 谈话\n");
char ch;
while(ch != '0') {
ch = getch();
if(ch == '2') {
system("cls");
slowsay("好的,请问你要购买哪个等级的卡牌?\n");
slowsay("你的金币数量:");
printf("%d", moy);
printrarity(1);
slowsay("对应1,");
printrarity(2);
slowsay("对应2,以此类推。\n");
slowsay("输入0来退出。\n");
while(ch != '0') {
ch = getch();
if(ch == '9') {
slowsay("那是一个神秘而未知的等级。。。\n");
slowsay("你的实力,甚至我的实力都离那个等级差距很大。\n");
slowsay("但是我有个朋友知道一些信息。\n");
slowsay("他的名字叫 Titan。\n");
} else {
ch -= '0';
if(ch == 0) break;
slowsay("请问你要购买多少张(1-1000)?");
int t;
cin >> t;
if(t < 1 || t > 1000) {
slowsay("你是想跟我开玩笑吗?\n");
} else {
int ndm = t * (rand() % (1 << 2*ch)) + 1 << 2*ch;
if(moy < ndm) {
slowsay("你的钱似乎还不足以成交。。。\n");
}
else {
slowsay("你需要支付");
printf("%d", ndm);
slowsay("元。所以,这笔交易成吗?(y成功):");
char cd;
cin >> cd;
if(cd == 'y') {
slowsay("\n好的,成交!\n");
sl += (1<<ch) * t;
moy -= ndm;
} else {
slowsay("\n好吧。。。也许你需要再考虑一下,但是我是不准讲价的!\n");
}
}
}
}
}
} else if(ch == '1') {
system("cls");
slowsay("好的,请问你要出售哪个等级的卡牌?\n");
slowsay("你的金币数量:");
printf("%d", moy);
printrarity(1);
slowsay("对应1,");
printrarity(2);
slowsay("对应2,以此类推。\n");
slowsay("输入0来退出。\n");
while(ch != '0') {
ch = getch();
if(ch == '9') {
slowsay("那是一个神秘而未知的等级。。。\n");
slowsay("你的实力,甚至我的实力都离那个等级差距很大。\n");
slowsay("但是我有个朋友知道一些信息。\n");
slowsay("他的名字叫 Titan。\n");
} else {
ch -= '0';
if(ch == 0) break;
slowsay("请问你要出售多少张(1-1000)?");
int t;
cin >> t;
if(t < 1 || t > 1000) {
slowsay("你是想跟我开玩笑吗?\n");
} else {
int ndm = t * (rand() % (1 << 2*ch));
if(card1[ch] < t) {
slowsay("你的花瓣似乎还不够多。。。\n");
}
else {
slowsay("你可以获得");
printf("%d", ndm);
slowsay("元。所以,这笔交易成吗?(y成功):");
char cd;
cin >> cd;
if(cd == 'y') {
slowsay("\n好的,成交!\n");
sl -= (1<<(ch/2)) * t;
moy += ndm;
} else {
slowsay("\n好吧。。。也许你需要再考虑一下,但是我是不会抬价的!\n");
}
}
}
}
}
} else if(ch == '3') {
system("cls");
slowsay ("好吧,你想谈些什么?\n");
slowsay("1. Trader的来历\n");
slowsay("2. 你自己\n");
slowsay("3. florr世界\n");
int dj;
cin >> dj;
if(dj == 1) {
slowsay("其实我就是一朵非常普通的花,和你们没有什么区别。\n");
slowsay("其实很久之前,我也过着跟你们一样的生活。\n");
slowsay("想起那时候可真是快乐啊。\n");
slowsay("但是我发现,花朵们都逐渐开始不待见我了。\n");
slowsay("它们说我过于强大,经常干扰它们打怪,还说我都这么强了打怪有什么用?\n");
slowsay("想想也确实是这样。。。\n");
slowsay("于是我就变成了一个商人,每日都在florr世界里奔波。\n");
slowsay("就这样过了很久,然后我就变成了今天这个样子。\n");
slowsay("有的时候,也许强大也是一种悲哀。\n");
} else if(dj == 2) {
slowsay("年轻人,我能从你身上看出一些不平常的的东西。\n");
slowsay("你好像是这个世界上唯一具有清醒意志的普通花。\n");
slowsay("现在florr大陆逐渐离心离德了,花朵们经常互相残杀来夺取花瓣。\n");
slowsay("你现在应该不太坏吧?\n");
slowsay("但是一个人的力量似乎不足以改变一切。。。\n");
slowsay("反正你要记得,在生存下来的前提上,你不要乱杀人。\n");
} else if(dj == 3) {
slowsay("florr世界是M28创造的。\n");
slowsay("我其实是他安排的一个NPC,生来就与其他花朵不同。\n");
slowsay("这个世界原本很美好的。。。\n");
slowsay("直到出现了corruption,mark这两大邪恶花瓣。\n");
slowsay("真不知道为什么M28要加入这种东西。。。\n");
slowsay("反正现在这个世界是逐渐崩坏了,我们都在尽力生存。\n");
slowsay("但是,你永远要相信这个世界上,友好的花朵还是有的。\n");
}
Sleep(1000);
}
system("cls");
slowsay("你好,我是Trader!我是这个世界的商人,你可以在我这里出售和换取卡牌!\n");
slowsay("请问你要干什么?\n");
slowsay("0. 我不干什么了,溜了溜了\n");
slowsay("1. 出售卡牌\n");
slowsay("2. 购买卡牌\n");
slowsay("3. 谈话\n");
}
}
}
return 0;
}
int flowerday() {
slowsay("今天,你遇到了一位陌生的花朵。。。\n");
slowsay("它的卡槽装着一些花瓣,你似乎可以通过杀掉它来获得这些装备。\n");
slowsay("然而,它表现友好,想要进行一些合作。\n");
slowsay("它的卡槽里面装着:\n");
int ecard[10];
int elv = rand() % 8 + 1, esl;
for(int i = 1; i <= elv; i++){
ecard[i] = rand() % (1<<(elv - i + 1)) + 1;
printrarity(i);
slowsay(":");
printf("%d\n", ecard[i]);
esl += (1 << i) * ecard[i];
}
int ehp = 150 + 50 *(rand()%(1 << (elv/2)) + 1 << (elv/2));
slowsay("它的血量是:");
printf("%d\n", ehp);
slowsay("请问你要选择:\n");
slowsay("1. 攻击\n");
slowsay("2. 合作\n");
int opt;
cin >> opt;
if(opt == 1) {
slowsay("对面微微一笑,轻轻逃走了。\n");
slowsay("你没能追上它。。。\n");
slowsay("你颇感挫败,准备检查你的卡组。\n");
slowsay("然而,你发现了一件事情:你的");
printrarity(1);
slowsay("卡牌全部丢失了。\n");
slowsay("果然,害人之心不可有啊。。。\n");
card1[1] = 0;
} else {
slowsay("那朵花提出了一个要求。\n");
slowsay("他说,它找到了一个刷怪宝地,想要邀请你一起去刷怪,刷完之后分你一些花瓣。\n");
slowsay("但是,那个地方凶险异常,你需要尝试和我一起,我们可以互相叠加伤害,互相回血。\n");
slowsay("目前,我们会被怪物一起攻击,但是怪物对我们的伤害没有那么高。\n");
slowsay("你要接受这个邀请吗?\n");
slowsay("1. 接受\n");
slowsay("2. 拒绝\n");
int o;
cin >> o;
if(o == 1) {
int wvs = rand() % 5 + 3;
slowsay("我已经调查过了。\n");
slowsay("这次探险一共会有");
printf("%d", wvs);
slowsay("个波次,");
slowsay("怪物的等级依次为:\n");
int mxr = rand() % (sl / 2 + esl / 2);
int rty[10];
if(mxr <= 3) mxr = 1;
else if(mxr <= 9) mxr = 2;
else if(mxr <= 27) mxr = 3;
else if(mxr <= 81) mxr = 4;
else if(mxr <= 243) mxr = 5;
else if(mxr <= 729) mxr = 6;
else if(mxr <= 2187) mxr = 7;
else mxr = 8;
for(int i = 1; i <= wvs; i++) {
rty[i] = max(mxr - rand() % 3, 1);
printrarity(rty[i]);
slowsay(",");
}
Sleep(1000);
for(int i = 1; i <= wvs; i++) {
slowsay("现在是第");
printf("%d", i);
slowsay("场战斗!\n");
slowsay("怪物的等级为:");
printrarity(rty[i]);
int enyhp = gethp(rty[i]);
int df = 1, edf = 1;
while((hp > 0 || ehp > 0) && enyhp > 0) {
slowsay("现在是你的回合!\n");
slowsay("请问你要选择:\n");
slowsay("1. 攻击\n");
slowsay("2. 叠伤害(使下一次造成的伤害*2)\n");
slowsay("3. 回复\n");
slowsay("4. 逃跑\n");
int gj;
cin >> gj;
if(gj == 1) {
int dmg = (sl + rand() % sl - rand() % sl) * rand() % 10 + 5;
dmg *= df;
df = 1;
slowsay("你造成了");
printf("%d", dmg);
slowsay("点伤害!");
enyhp -= dmg;
if(enyhp <= 0) {
slowsay("\n你们击败了敌人!\n");
slowsay("敌人掉落了:\n");
drop(rty[i]);
slowsay("\n你现在实力值为:");
printf("%d\n", sl);
Exp += 1<<rty[i];
while(Exp > exn){
lvl++;
slowsay("你升级了!\n");
Exp -= exn;
exn *= 2;
}
hp = lvl * 50 + 150;
ehp = 150 + 50 *(rand()%(1 << (elv/2)) + 1 << (elv/2));
slowsay("按任意键以继续...");
char ch = getch();
system("cls");
break;
}
Sleep(500);
system("cls");
} else if(gj == 2) {
df *= 2;
slowsay("你正在蓄力。。。目前伤害翻倍数:");
edf *= 2;
printf("%d\n",df);
Sleep(500);
system("cls");
} else if(gj == 3) {
int dmg = (sl + rand() % sl - rand() % sl) * rand() % 3 + 2;
dmg *= df;
df = 1;
slowsay("你和队友一起恢复了");
printf("%d", dmg);
slowsay("点血量!");
hp += dmg;
ehp += dmg;
} else {
slowsay("队友阻止了你逃跑。\n");
}
int dydmg = (1 << elv) + rand()%((1<<elv)) - rand()%((1<<elv));
dydmg *= edf;
edf = 1;
slowsay("你的队友对敌人造成了");
printf("%d", dydmg);
slowsay("点伤害!\n");
enyhp -= dydmg;
if(enyhp <= 0) {
slowsay("\n你们击败了敌人!\n");
slowsay("敌人掉落了:\n");
drop(rty[i]);
slowsay("\n你现在实力值为:");
printf("%d\n", sl);
Exp += 1<<rty[i];
while(Exp > exn){
lvl++;
slowsay("你升级了!\n");
Exp -= exn;
exn *= 2;
}
hp = lvl * 50 + 150;
ehp = 150 + 50 *(rand()%(1 << (elv/2)) + 1 << (elv/2));
slowsay("按任意键以继续...");
char ch = getch();
system("cls");
break;
}
int edmg = (1 << rty[i]) + rand()%((1<<rty[i])) - rand()%((1<<rty[i]));
edmg /= 2;
slowsay("敌人对你们造成了");
printf("%d", edmg);
slowsay("点伤害!");
hp -= edmg;
ehp -= edmg;
if(hp < 0) {
slowsay("你死了。。。\n");
slowsay("下次再来试一试吧。。。\n");
slowsay("----------R.I.P----------\n");
return -1;
}
if(ehp < 0) {
slowsay("你的队友阵亡了。。。\n");
slowsay("战友死亡使你失去了刷怪的信心。\n");
slowsay("你选择了逃跑。这一次,你的身手格外敏捷,没多久就逃了出来。\n");
slowsay("你发誓,一定要回来报仇。\n");
return 0;
}
slowsay("按任意键以继续...");
char ch = getch();
system("cls");
slowsay("你现在的血量是:");
printf("%d", hp);
slowsay(" 你队友现在的血量是:");
printf("%d", ehp);
slowsay(" 敌人的血量是:");
printf("%d\n", enyhp);
}
}
} else {
slowsay("好吧,也许你还没有做好心理准备。。。\n");
slowsay("陌生人,我们在广大的florr世界中这次相逢,可能此生无缘再会了。\n");
slowsay("但是,我还是会去那个凶险的地方,即使我可能无法生还。\n");
slowsay("祝你好运,陌生人。\n");
}
}
Sleep(1000);
return 0;
}
int selectday() {
int n = rand()%3;
int rt;
if(n == 0) rt=killmobday();
else if(n == 1) rt=craftday();
else rt = flowerday();
if(rt == -1) return -1;
else return 0;
}
int main() {
srand(time(0));
system("title florr 重开模拟器");
slowsay("------florr 重开模拟器------\n\n");
slowsay("请选择模式:\n1. 单人\n2. 双人 \n");
cin >> gm;
system("cls");
if(gm == 1) {
card1[1] = 5;
sl = 5;
hp = 150;
exn = 5;
Exp = 0;
lvl = 1;
moy = 2000;
printcard();
while(1) {
int rr=selectday();
if(rr == -1) return 0;
printcard();
}
} else {
slowsay("正在加紧开发中。。。敬请期待\n");
}
return 0;
}