//1,对角色机制技能进行了略微修改
//2,增加了调整角色血量,攻击,防御,倍率的能力
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <windows.h>
#include <string>
using namespace std;
int hp,attack,defense;
struct Hero
{
string name;
int hp;
int maxHp;
int attack;
int defense;
bool shield;
int shieldValue;
bool isStun;
double critRate;
};
Hero createHero(int id)
{
Hero h;
switch(id)
{
case 1: //鲤逍遥
h.name = "鲤逍遥"; h.maxHp=1400hp; h.hp=h.maxHp; h.attack=230attack; h.defense=65defense;
h.shield=0; h.shieldValue=0; h.isStun=0; h.critRate=0.25; break;
case 2: //鹊瑶
h.name = "鹊瑶"; h.maxHp=1150hp; h.hp=h.maxHp; h.attack=270attack; h.defense=45defense;
h.shield=0; h.shieldValue=0; h.isStun=0; h.critRate=0.30; break;
case 3: //鹰乘风
h.name = "鹰乘风"; h.maxHp=1250hp; h.hp=h.maxHp; h.attack=250attack; h.defense=55defense;
h.shield=0; h.shieldValue=0; h.isStun=0; h.critRate=0.22; break;
case 4: //熊莫开
h.name = "熊莫开"; h.maxHp=1900hp; h.hp=h.maxHp; h.attack=180attack; h.defense=110defense;
h.shield=0; h.shieldValue=0; h.isStun=0; h.critRate=0.12; break;
case 5: //蛮神爪牙
h.name = "蛮神爪牙"; h.maxHp=1500hp; h.hp=h.maxHp; h.attack=240attack; h.defense=50defense;
h.shield=0; h.shieldValue=0; h.isStun=0; h.critRate=0.18; break;
case 6: //梅寒衣
h.name = "梅寒衣"; h.maxHp=1300hp; h.hp=h.maxHp; h.attack=260attack; h.defense=60defense;
h.shield=0; h.shieldValue=0; h.isStun=0; h.critRate=0.24; break;
case 7: //兔暗香
h.name = "兔暗香"; h.maxHp=1050hp; h.hp=h.maxHp; h.attack=280attack; h.defense=40defense;
h.shield=0; h.shieldValue=0; h.isStun=0; h.critRate=0.32; break;
case 8: //鲤余欢
h.name = "鲤余欢"; h.maxHp=1350hp; h.hp=h.maxHp; h.attack=240attack; h.defense=70defense;
h.shield=0; h.shieldValue=0; h.isStun=0; h.critRate=0.23; break;
case 9: //剑无忌
h.name = "剑无忌"; h.maxHp=1200hp; h.hp=h.maxHp; h.attack=270attack; h.defense=55defense;
h.shield=0; h.shieldValue=0; h.isStun=0; h.critRate=0.26; break;
case 10: //蛮神使者
h.name = "蛮神使者"; h.maxHp=1600hp; h.hp=h.maxHp; h.attack=250attack; h.defense=60defense;
h.shield=0; h.shieldValue=0; h.isStun=0; h.critRate=0.20; break;
default:
h.name = "蛮神爪牙"; h.maxHp=1500hp; h.hp=h.maxHp; h.attack=240attack; h.defense=50*defense;
h.shield=0; h.shieldValue=0; h.isStun=0; h.critRate=0.18; break;
}
return h;
}
void showStatus(Hero a, Hero b)
{
cout << "----------------------------------------" << endl;
cout << left << setw(12) << a.name << " HP:" << setw(5) << a.hp << "/" << a.maxHp;
if(a.shield) cout << " 护盾:" << a.shieldValue;
if(a.isStun) cout << " [眩晕]";
cout << endl;
}
// 新增:战斗结算画面
void showBattleResult(Hero p1, Hero p2, int totalRound)
{
Sleep(800);
cout << "\n\n";
cout << "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n";
cout << "┃ ?? 战 斗 结 算 ?? ┃\n";
cout << "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n";
cout << "总战斗回合:" << totalRound << "\n\n";
}
bool attackTarget(Hero &attacker, Hero &defender)
{
Sleep(600);
bool crit = false;
int damage = attacker.attack;
}
// 技能:增加角色行为描述
void useSkill(Hero &attacker, Hero &defender)
{
Sleep(700);
int sk = rand() % 3;
}
void battleRound(Hero &a, Hero &b)
{
cout<<"\n>> "<<a.name<<" 的回合"<<endl;
Sleep(800);
if(a.isStun)
{
cout << a.name << "被眩晕困住,浑身无法动弹!眩晕解除。" << endl;
Sleep(700);
a.isStun = false;
}
else
{
if(rand()%100 < 60)
{
attackTarget(a,b);
}
else
{
useSkill(a,b);
}
}
if(b.hp<=0)return;
}
int main()
{
srand((unsigned int)time(NULL));
cout<<"===== 龙腾宇宙·全自动对战模拟器 =====\n";
cout<<"【可选角色编号】\n";
cout<<"1 鲤逍遥 2 鹊瑶 3 鹰乘风 4 熊莫开 5 蛮神爪牙\n";
cout<<"6 梅寒衣 7 兔暗香 8 鲤余欢 9 剑无忌 10 蛮神使者\n";
}