二创击败大魔王
2025-04-03 13:24:26
发布于:广东
25w02a
#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
using namespace std;
const int N = 10000;
long long n=N,cs=11,hp,pw,d,s,px,py,m=1,num=1,cnt,san = 5,ab = 0,ba = 0;
double sum = 1.0;
long long x = n/2,y = n/2;
char mp[N+5][N+5];
bool flag = 1;
int ff=1;
int r(int i,int j){
return rand()%(j-i+1)+i;
}void up(){
int g = rand()%55+1;
int f = rand()%4+1;
cout << "已开始抽取加成,按任意键抽取"<<endl;
if(g<=1)g = 10;
else if(g<=3)g = 9;
else if(g<=6)g = 8;
else if(g<=10)g = 7;
else if(g<=15)g = 6;
else if(g<=21)g = 5;
else if(g<=28)g = 4;
else if(g<=36)g = 3;
else if(g<=45)g = 2;
else g = 1;
int SUM = sum;
if(f==1)cout << "生命增加"<<SUM*2*g<<endl;
else if(f==2)cout << "攻击力增加"<<SUM*g<<endl;
else if(f==3)cout << "防御增加"<<SUM*g<<endl;
else cout << "移速增加"<<SUM*g<<endl;
if(f==1)hp += sum*2*g;
else if(f==2)pw += num*g;
else if(f==3)d += num*g;
else s += num*g;
return;
}void win(char co,int hh){
cout << "你赢了"<<endl;
cout << "汲取了敌人的血量:"<<hh<<"*60%="<<(int)(hh*0.6)<<endl;
hp += hh * 0.8;
int _ = sum;
if(co=='C')sum+=1.0/sum*num*0.5;
if(co=='B')sum+=1.0/sum*num*1;
if(co=='A')sum+=1.0/sum*num*5;
if(co=='S')sum+=1.0/sum*num*20;
if(co=='X')sum+=1.0/sum*num*40;
if(co=='&')sum+=1.0/sum*num*10000;
cnt++;
getch();
if(int(sum)>_){
cout << "恭喜你从"<<_<<"级升到了"<<int(sum)<<"级"<<endl;
cout << "你可以抽取"<<int(sum)-_<<"次奖励"<<endl;
for(int i=1;i<=int(sum)-_;i++)up();
}getch();
return;
}void init(){
int cx=rand()%n+1,cy = rand()%n+1;
x = y = n/2;
for(int i=0;i<=n+1;i++){
for(int j=0;j<=n+1;j++){
if(i<1 or i>n or j<1 or j>n){
mp[i][j] = '#';
continue;
}if(i==cx and j==cy){
mp[i][j] == '0';
continue;
}
if(i==n/2 and j==n/2){
mp[i][j] = '@';
continue;
}
int num = rand()%128+1;
if(num>=64)mp[i][j] = '.';
else if(num>=32)mp[i][j] = 'C';
else if(num>=16)mp[i][j] = 'B';
else if(num>=8)mp[i][j] = 'A';
else if(num>=4)mp[i][j] = '$';
else if(num>=3)mp[i][j] = 'S';
else if(num>=2)mp[i][j] = 'X';
else if(num>=1)mp[i][j] = '&';
}
}
}void draw(){
system("cls");
for(int i=x-cs/2;i<=x+cs/2;i++){
for(int j=y-cs/2;j<=y+cs/2;j++){
if(i<0 or j<0 or i>N+1 or j>N+1)cout << " ";
else cout << mp[i][j] <<" ";
}cout << endl;
}cout << endl;
num = (abs(x-n/2)+abs(y-n/2))/6+1;
cout << "血量:"<<hp<<endl;
cout << "攻击力:"<<pw<<endl;
cout << "防御力:"<<d<<endl;
cout << "速度:"<<s<<endl;
cout << "当前等级:"<<(int)sum<<endl;
cout << "怪物等级:"<<num<<endl;
if(num>=100 and ff==1){
cout << "达成成就:怪物猎手"<<endl;
ff=2;
}if(num>=1000 and ff == 2){
cout << "你是我的神"<<endl;
}
if(ab >= 100000 || ba >= 100000 || ab <= -100000 || ba <= -100000 ){
cout << "达成成就:旅行者" <<endl;
}
}bool move(int dx,int dy){
mp[x][y] = '.';
x += dx;y += dy;
char co = mp[x][y];
mp[x][y] = '@';
num = (abs(x-n/2)+abs(y-n/2))/6+1;
if(num<=0)num = 1;
if(co=='O')return 2;
if(co=='#'){
mp[x][y] = '#';
x-=dx;y-=dy;
return 1;
}
draw();
long long gh,gp,gd,gs;
// C<B<A<S<X
if(co=='.')return 1;
else if(co=='C'){
gh = 1LL*num*num*r(5,8);
gp = 1LL*num*num*r(2,5);
gd = 1LL*num*num*r(1,3);
gs = 1LL*num*num*r(3,5);
}else if(co=='B'){
gh = 1LL*num*num*r(8,20);
gp = 1LL*num*num*r(8,12);
gd = 1LL*num*num*r(4,8);
gs = 1LL*num*num*r(6,12);
}else if(co=='A'){
gh = 1LL*num*num*r(30,50);
gp = 1LL*num*num*r(10,20);
gd = 1LL*num*num*r(15,25);
gs = 1LL*num*num*r(20,40);
}else if(co=='S'){
gh = 1LL*num*num*r(80,160);
gp = 1LL*num*num*r(40,80);
gd = 1LL*num*num*r(60,100);
gs = 1LL*num*num*r(80,140);
}else if(co=='X'){
gh = 1LL*num*num*r(200,400);
gp = 1LL*num*num*r(80,120);
gd = 1LL*num*num*r(100,140);
gs = 1LL*num*num*r(120,200);
}else if(co=='&'){
gh = 1LL*num*num*r(2000000,40000000);
gp = 1LL*num*num*r(800000000,1200000000);
gd = 1LL*num*num*r(139999900,140000000);
gs = 1LL*num*num*r(1200000000,2000000000);
}else if(co=='$'){
up();
return 1;
}
cout << endl;
cout << "对方是"<<co<<"级怪"<<endl;
cout << "对方实力:"<<endl;
cout << "血量:"<<gh<<endl;
cout << "攻击力:"<<gp<<endl;
cout << "防御力:"<<gd<<endl;
cout << "速度:"<<gs<<endl;
cout << endl;
cout << "我方实力:"<<endl;
cout << "血量:"<<hp<<endl;
cout << "攻击力:"<<pw<<endl;
cout << "防御力:"<<d<<endl;
cout << "速度:"<<s<<endl<<endl;
Sleep(1000);
int hh = gh,ds=0;
bool flag3 = 1;
if(gs>s){
cout << "敌方移速更高"<<endl;
if(m==2 and rand()%100>60){
cout << "盾兵被动触发"<<endl;
cout << "免疫这次伤害"<<endl;
cout << "造成"<<ceil((d>=gp?1:gp-d)*0.3)<<"的真实伤害"<<endl;
gh -= ceil((d>=gp?1:gp-d)*0.3);
cout << "他还剩"<<gh<<"点血"<<endl;
if(gh<=0){
win(co,hh);
draw();
return 1;
}
}else{
cout << "他对你造成了"<<(d>=gp?1:gp-d)<<"点伤害"<<endl;
hp -= (d>=gp?1:gp-d);
cout << "你还剩"<<hp<<"点血"<<endl;
}
Sleep(100);
if(flag3 and hp<=0 and m==3){
cout << "医疗兵被动触发"<<endl;
cout << "恢复"<<int(sum*10) << "点血"<<endl;
hp += sum * 10;
flag3 = 0;
}cout << endl;
if(hp<=0 and san > 0 and m == 5){
san--;
cout << "狂战士被动触发"<<endl;
cout << "增加"<<int(sum*1000000000) << "点伤害"<<endl;
cout << "被动使用次数还剩" << san<<"次";
hp = 1;
pw += sum*1000000000;
}cout << endl;
if(hp<=0 and san >= 0 and m == 6){
san--;
cout << "药剂师被动触发"<<endl;
cout << "增加"<<int(sum*100000000000) << "点伤害"<<int(sum*100000) << "点血量" <<endl;
cout << "被动使用次数还剩" << san<<"次";
pw = sum * 100000000000;
hp += sum*100000;
}cout << endl;
if(hp<=0){
cout << "你输了";
flag = 0;
getch();
return 0;
}
}else cout << "我方移速更高"<<endl;
while(true){
Sleep(500);
int pp = 0;
if(m==4 and rand()%30 and !ds){
ds = 2;
cout << "生物学家被动触发"<<endl;
cout << "你对他造成了"<<(gd>=pw?1:pw-gd)<<"+"<<int(pw*0.4)<<"点伤害"<<endl;
pp = pw*0.4;
}else if(ds){
cout << "你对他造成了"<<(gd>=pw?1:pw-gd)<<"+"<<int(pw*0.4)<<"点伤害"<<endl;
pp = pw*0.4;
ds--;
}else if(m==1 and gp > hp and rand()%100>20){
pp = pw;
cout << "战士被动触发"<<endl;
cout << "你对他造成了"<<(gd>=pw?1:pw-gd);
cout <<"+"<<pp<<"点伤害"<<endl;
}else{
cout << "你对他造成了"<<(gd>=pw?1:pw-gd)<<"点伤害"<<endl;
}gh -= (gd>=pw?1:pw-gd)+pp;
cout << "他还剩"<<gh<<"点血"<<endl;
cout << endl;
if(gh<=0){
win(co,hh);
draw();
return 1;
}
Sleep(100);
if(m==2 and rand()%100>60){
cout << "盾兵被动触发"<<endl;
cout << "免疫这次伤害"<<endl;
cout << "造成"<<ceil((d>=gp?1:gp-d)*0.3)<<"的真实伤害"<<endl;
gh -= ceil((d>=gp?1:gp-d)*0.3);
cout << "他还剩"<<gh<<"点血"<<endl;
if(gh<=0){
win(co,hh);
draw();
return 1;
}
}else{
cout << "他对你造成了"<<(d>=gp?1:gp-d)<<"点伤害"<<endl;
hp -= (d>=gp?1:gp-d);
cout << "你还剩"<<hp<<"点血"<<endl;
}
if(flag3 and hp<=0 and m==3){
cout << "医疗兵被动触发"<<endl;
cout << "恢复"<<int(sum*10) << "点血"<<endl;
hp += sum * 10;
flag3 = 0;
}cout << endl;
if(hp<=0 and san >= 1 and m == 5){
san--;
cout << "狂战士被动触发"<<endl;
cout << "增加"<<int(sum*1000000) << "点伤害"<<endl;
cout << "被动使用次数还剩" <<san <<"次";
hp = 1;
pw += sum*1000000;
}cout << endl;
if(hp<=0 and san >= 0 and m == 6){
cout << "药剂师被动触发"<<endl;
cout << "增加"<<int(sum*100000000000) << "点伤害"<<int(sum*100000) << "点血量" <<endl;
cout << "被动使用次数还剩" << san<<"次";
pw = sum * 100000000000;
hp += sum*100000;
}cout << endl;
if(hp<=0){
cout << "你输了";
getch();
flag = 0;
return 0;
}
}
}
int main(){
srand(time(0));
cout << "请选择你的角色"<<endl;
cout << "A.战士 如果对面生命高于我方则每次攻击80%打出双倍伤害"<<endl;
cout << "B.盾兵 被攻击时有40%概率免伤并反弹30%的向上取整真实伤害"<<endl;
cout << "C.治疗兵 第一次死亡后回复经验值*10的血量"<<endl;
cout << "D.生物学家 攻击时有30%使用毒药连续三回合在攻击之后造成攻击力40%的真实伤害"<<endl;
char js;cin >> js;
if(js=='A' or js=='a'){
m = 1;
hp = 10;
pw = 5;
d=3;
s=4;
}if(js=='B' or js=='b'){
m = 2;
hp = 6;
pw = 4;
d=6;
s=3;
}if(js=='C' or js=='c'){
m=3;
hp = 12;
pw = 4;
d=3;
s=5;
}if(js=='D' or js=='d'){
m=4;
hp = 5;
pw = 6;
d=2;
s=3;
}if(js=='E' or js=='e'){
m=5;
hp = 0x3f3f;
pw = 0x3f3f3f;
d = 0x3f3f3f;
s = 0x3f3f3f;
}if(js=='F' or js=='f'){
m=6;
hp = 5;
pw = 0x3f3f3f;
d = 0;
s = 0x3f3f3f3f3f3f;
}
cout << "开局奖励"<<endl;
up();
while(flag){
init();
draw();
while(1+1==2){
char index = getch();
px = py = 0;
if(index == 'w'){
px = -1;
ab += 1;
}
if(index == 'a'){
py = -1;
ba -= 1;
}
if(index == 's'){
px = 1;
ab -= 1;
}
if(index == 'd'){
py = 1;
ba += 1;
}
if(!move(px,py))break;
cout <<ab <<" " <<ba;
}
}system("cls");
cout << "你死了(*_*)"<<endl;
cout << "你一共击败了"<<cnt<<"个怪"<<endl;
}
全部评论 2
你这汉字炸了
2025-02-27 来自 广东
0我是原创
击败大魔王2025-02-17 来自 广东
0
有帮助,赞一个