#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <limits>
#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif
using namespace std;
// 技能类
class Skill {
private:
string name;
int damageMultiplier; // 伤害倍数
int mpCost; // 魔法消耗
string description;
public:
Skill(string n, int mult, int mp, string desc)
: name(n), damageMultiplier(mult), mpCost(mp), description(desc) {}
};
class Player {
private:
string name;
int health;
int maxHealth;
int attackPower;
int defensePower;
int mp; // 魔法值
int maxMp;
int level;
int exp;
int coins;
vector<Skill> skills;
int skillIndex; // 当前选中的技能
bool isDefending; // 是否处于防御状态
public:
Player(string n) : name(n), health(100), maxHealth(100),
attackPower(15 + rand() % 10), defensePower(5 + rand() % 5),
mp(50), maxMp(50), level(1), exp(0), coins(0),
skillIndex(0), isDefending(false) {
// 初始化技能
skills.push_back(Skill("普通攻击", 1, 0, "基本的物理攻击"));
skills.push_back(Skill("重击", 2, 10, "强力一击,造成2倍伤害"));
skills.push_back(Skill("治疗术", 0, 15, "恢复20点生命值"));
skills.push_back(Skill("防御姿态", 0, 5, "下回合防御力翻倍"));
private:
void levelUp() {
while (exp >= level * 100) {
exp -= level * 100;
level++;
};
// 修改函数参数
void showBattleAnimation(const string& attacker, const string& skill) {
cout << "\n";
cout << "\n";
cout << attacker << " 发动了 " << skill << "!\n";
cout << "\n";
cout << "\n";
}
void clearScreen() {
#ifdef _WIN32
system("cls");
#else
system("clear");
#endif
}
void showHeader(int round, int turn) {
cout << "\n";
cout << "\n";
cout << " 第 " << round << " 轮战斗\n";
cout << " 回合 " << turn << "\n";
cout << "\n\n";
}
int main() {
srand(time(0));
}