capitalized all enums

This commit is contained in:
a25liang
2024-07-20 15:11:13 -04:00
parent af1522ba2f
commit 525226b763
53 changed files with 393 additions and 395 deletions

View File

@ -4,13 +4,13 @@
#include "../constants.h"
bezerk_brew::bezerk_brew(const position &pos):
potion{potion_type::bezerk_brew, DURATION, pos} {}
potion{potion_type::BEZERK_BREW, DURATION, pos} {}
void bezerk_brew::apply(const enum race &race, int &HP, int &ATK,
int &DEF, fraction &base_hit_rate) {
if (remaining_duration != 0) {
ATK *= ATK_MUL * (race == rdrow ? DROW_POTION_MUL : 1);
DEF *= DEF_MUL * (race == rdrow ? DROW_POTION_MUL : 1);
ATK *= ATK_MUL * (race == DROW ? DROW_POTION_MUL : 1);
DEF *= DEF_MUL * (race == DROW ? DROW_POTION_MUL : 1);
--remaining_duration;
}
}

View File

@ -6,14 +6,14 @@
boost_atk::boost_atk(const position &pos):
potion{potion_type::boost_atk, -1, pos} {}
potion{potion_type::BOOST_ATK, -1, pos} {}
void boost_atk::apply(const enum race &race, int &HP, int &ATK, int &DEF,
fraction &base_hit_rate) {
if (remaining_duration != 0) {
int tmp = BOOST_ATK;
if (race == rdrow)
if (race == DROW)
tmp *= DROW_POTION_MUL;
ATK += tmp;

View File

@ -5,14 +5,14 @@
boost_def::boost_def(const position &pos):
potion{potion_type::boost_def, -1, pos} {}
potion{potion_type::BOOST_DEF, -1, pos} {}
void boost_def::apply(const enum race &race, int &HP, int &ATK, int &DEF,
fraction &base_hit_rate) {
if (remaining_duration != 0) {
int tmp = BOOST_DEF;
if (race == rdrow)
if (race == DROW)
tmp *= DROW_POTION_MUL;
DEF += tmp;

View File

@ -4,18 +4,18 @@
#include "../constants.h"
borrow_life::borrow_life(const position &pos):
potion{potion_type::borrow_life, DURATION, pos} {}
potion{potion_type::BORROW_LIFE, DURATION, pos} {}
void borrow_life::apply(const enum race &race, int &HP, int &ATK,
int &DEF, fraction &base_hit_rate) {
if (remaining_duration == DURATION)
HP += GIVE_HP * (race == rdrow ? DROW_POTION_MUL : 1);
HP += GIVE_HP * (race == DROW ? DROW_POTION_MUL : 1);
if (remaining_duration != 0)
--remaining_duration;
if (remaining_duration == 0) {
HP -= LOSE_HP * (race == rdrow ? DROW_POTION_MUL : 1);
HP -= LOSE_HP * (race == DROW ? DROW_POTION_MUL : 1);
HP = HP < 0 ? 0 : HP;
}
}

View File

@ -4,14 +4,14 @@
#include "../constants.h"
continuous_restoration::continuous_restoration(const position &pos):
potion{potion_type::continuous_restoration, DURATION, pos} {}
potion{potion_type::CONTINUOUS_RESTORATION, DURATION, pos} {}
void continuous_restoration::apply(const enum race &race, int &HP, int &ATK,
int &DEF, fraction &base_hit_rate) {
if (remaining_duration != 0) {
int tmp = GAIN_HEALTH;
if (race == rdrow)
if (race == DROW)
tmp *= DROW_POTION_MUL;
HP = std::min(HP + tmp, MAX_HP[race]);

View File

@ -4,16 +4,16 @@
#include "../constants.h"
echoing_resilience::echoing_resilience(const position &pos):
potion{potion_type::echoing_resilience, DURATION, pos} {}
potion{potion_type::ECHOING_RESIL, DURATION, pos} {}
void echoing_resilience::apply(const enum race &race, int &HP, int &ATK,
int &DEF, fraction &base_hit_rate) {
if (remaining_duration != 0) {
int tmp = GAIN_HEALTH * (race == rdrow ? DROW_POTION_MUL : 1);
int tmp = GAIN_HEALTH * (race == DROW ? DROW_POTION_MUL : 1);
HP = std::min(HP + tmp, MAX_HP[race]);
ATK -= LOSE_ATK * (race == rdrow ? DROW_POTION_MUL : 1);
DEF -= LOSE_DEF * (race == rdrow ? DROW_POTION_MUL : 1);
ATK -= LOSE_ATK * (race == DROW ? DROW_POTION_MUL : 1);
DEF -= LOSE_DEF * (race == DROW ? DROW_POTION_MUL : 1);
ATK = ATK < 0 ? 0 : ATK;
DEF = DEF < 0 ? 0 : DEF;

View File

@ -4,19 +4,19 @@
#include "../constants.h"
fine_booze::fine_booze(const position &pos):
potion{potion_type::fine_booze, DURATION, pos} {}
potion{potion_type::FINE_BOOZE, DURATION, pos} {}
void fine_booze::apply(const enum race &race, int &HP, int &ATK,
int &DEF, fraction &base_hit_rate) {
if (remaining_duration != 0) {
int tmp = GAIN_HP;
if (race == rdrow)
if (race == DROW)
tmp *= DROW_POTION_MUL;
HP = std::min(HP + tmp, MAX_HP[race]);
if (race == rbrawler)
if (race == BRAWLER)
base_hit_rate = HR_TB;
else
base_hit_rate *= HR_MUL;

View File

@ -4,13 +4,13 @@
#include "../constants.h"
ironclad_ward::ironclad_ward(const position &pos):
potion{potion_type::ironclad_ward, DURATION, pos} {}
potion{potion_type::IRONCLAD_WARD, DURATION, pos} {}
void ironclad_ward::apply(const enum race &race, int &HP, int &ATK,
int &DEF, fraction &base_hit_rate) {
if (remaining_duration != 0) {
ATK *= ATK_MUL * (race == rdrow ? DROW_POTION_MUL : 1);
DEF *= DEF_MUL * (race == rdrow ? DROW_POTION_MUL : 1);
ATK *= ATK_MUL * (race == DROW ? DROW_POTION_MUL : 1);
DEF *= DEF_MUL * (race == DROW ? DROW_POTION_MUL : 1);
base_hit_rate *= HR_MUL;
--remaining_duration;
}

View File

@ -4,14 +4,14 @@
#include "../constants.h"
poison_health::poison_health(const position &pos):
potion{potion_type::poison_health, 1, pos} {}
potion{potion_type::POISON_HEALTH, 1, pos} {}
void poison_health::apply(const enum race &race, int &HP, int &ATK, int &DEF,
fraction &base_hit_rate) {
if (remaining_duration != 0) {
int tmp = LOSE_HEALTH;
if (race == rdrow)
if (race == DROW)
tmp *= DROW_POTION_MUL;
HP = std::max(HP - tmp, 0);

View File

@ -4,14 +4,14 @@
#include "../constants.h"
restore_health::restore_health(const position &pos):
potion{potion_type::restore_health, 1, pos} {}
potion{potion_type::RESTORE_HEALTH, 1, pos} {}
void restore_health::apply(const enum race &race, int &HP, int &ATK, int &DEF,
fraction &base_hit_rate) {
if (remaining_duration != 0) {
int tmp = GAIN_HEALTH;
if (race == rdrow)
if (race == DROW)
tmp *= DROW_POTION_MUL;
HP = std::min(HP + tmp, MAX_HP[race]);

View File

@ -4,12 +4,12 @@
#include "../constants.h"
savage_strike::savage_strike(const position &pos):
potion{potion_type::savage_strike, DURATION, pos} {}
potion{potion_type::SAVAGE_STRIKE, DURATION, pos} {}
void savage_strike::apply(const enum race &race, int &HP, int &ATK, int &DEF,
fraction &base_hit_rate) {
if (remaining_duration != 0) {
ATK *= ATK_MUL * (race == rdrow ? DROW_POTION_MUL : 1);
ATK *= ATK_MUL * (race == DROW ? DROW_POTION_MUL : 1);
base_hit_rate *= HR_MUL;
--remaining_duration;
}

View File

@ -4,17 +4,17 @@
#include "../constants.h"
tempest_tantrum::tempest_tantrum(const position &pos):
potion{potion_type::tempest_tantrum, DURATION, pos} {}
potion{potion_type::TEMPEST_TANTRUM, DURATION, pos} {}
void tempest_tantrum::apply(const enum race &race, int &HP, int &ATK,
int &DEF, fraction &base_hit_rate) {
if (remaining_duration == DURATION)
HP -= HP_RD_PERCENTAGE * HP *
(race == rdrow ? DROW_POTION_MUL : 1);
(race == DROW ? DROW_POTION_MUL : 1);
if (remaining_duration != 0) {
ATK *= ATK_MUL * (race == rdrow ? DROW_POTION_MUL : 1);
DEF *= DEF_MUL * (race == rdrow ? DROW_POTION_MUL : 1);
ATK *= ATK_MUL * (race == DROW ? DROW_POTION_MUL : 1);
DEF *= DEF_MUL * (race == DROW ? DROW_POTION_MUL : 1);
--remaining_duration;
}
}

View File

@ -4,14 +4,14 @@
#include "../constants.h"
wound_atk::wound_atk(const position &pos):
potion{potion_type::wound_atk, -1, pos} {}
potion{potion_type::WOUND_ATK, -1, pos} {}
void wound_atk::apply(const enum race &race, int &HP, int &ATK, int &DEF,
fraction &base_hit_rate) {
if (remaining_duration != 0) {
int tmp = WOUND_ATK;
if (race == rdrow)
if (race == DROW)
tmp *= DROW_POTION_MUL;
ATK = std::max(ATK - tmp, 0);

View File

@ -4,14 +4,14 @@
#include "../constants.h"
wound_def::wound_def(const position &pos):
potion{potion_type::wound_def, -1, pos} {}
potion{potion_type::WOUND_DEF, -1, pos} {}
void wound_def::apply(const enum race &race, int &HP, int &ATK, int &DEF,
fraction &base_hit_rate) {
if (remaining_duration != 0) {
int tmp = WOUND_DEF;
if (race == rdrow)
if (race == DROW)
tmp *= DROW_POTION_MUL;
DEF = std::max(DEF - tmp, 0);