reworked potion priority (5 -> 3) (5 is too much)

This commit is contained in:
2024-07-18 19:10:58 -04:00
parent 145e094684
commit b750081a1b
7 changed files with 35 additions and 23 deletions

View File

@ -97,11 +97,9 @@ enum potion_type : int {restore_health = 0, boost_atk, boost_def,
};
// Calculation priorities
static const int CALC_ADD_BASE = 0;
static const int CALC_MUL_BASE = 1;
static const int CALC_ADD_LATER = 2;
static const int CALC_MUL_LATER = 3;
static const int CALC_ADD_FIXED = 4;
static const int CALC_BASE = 0;
static const int CALC_MID = 1;
static const int CALC_LAST = 2;
static const int DIRECTION_CNT = 8;

View File

@ -12,14 +12,17 @@ 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) tmp *= DROW_POTION_MUL;
if (race == rdrow)
tmp *= DROW_POTION_MUL;
ATK += tmp;
--remaining_duration;
}
}
int boost_atk::get_priority() const {
return CALC_ADD_BASE;
return CALC_BASE;
}
const char *boost_atk::get_name() const {

View File

@ -11,14 +11,17 @@ 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) tmp *= DROW_POTION_MUL;
if (race == rdrow)
tmp *= DROW_POTION_MUL;
DEF += tmp;
--remaining_duration;
}
}
int boost_def::get_priority() const {
return CALC_ADD_BASE;
return CALC_BASE;
}
const char *boost_def::get_name() const {

View File

@ -10,14 +10,17 @@ 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) tmp *= DROW_POTION_MUL;
if (race == rdrow)
tmp *= DROW_POTION_MUL;
HP = std::max(HP - tmp, 0);
--remaining_duration;
}
}
int poison_health::get_priority() const {
return CALC_ADD_BASE;
return CALC_BASE;
}
const char *poison_health::get_name() const {

View File

@ -10,14 +10,17 @@ 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) tmp *= DROW_POTION_MUL;
if (race == rdrow)
tmp *= DROW_POTION_MUL;
HP = std::min(HP + tmp, MAX_HP[race]);
--remaining_duration;
}
}
int restore_health::get_priority() const {
return CALC_ADD_BASE;
return CALC_BASE;
}
const char *restore_health::get_name() const {

View File

@ -3,9 +3,6 @@
#include <algorithm>
#include "../constants.h"
const int WOUND_ATK = 5;
const int WOUND_ATK_DROW = 7;
wound_atk::wound_atk(const position &pos):
potion{potion_type::wound_atk, -1, pos} {}
@ -13,14 +10,17 @@ 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) tmp *= DROW_POTION_MUL;
if (race == rdrow)
tmp *= DROW_POTION_MUL;
ATK = std::max(ATK - tmp, 0);
--remaining_duration;
}
}
int wound_atk::get_priority() const {
return CALC_ADD_BASE;
return CALC_BASE;
}
const char *wound_atk::get_name() const {

View File

@ -3,7 +3,6 @@
#include <algorithm>
#include "../constants.h"
wound_def::wound_def(const position &pos):
potion{potion_type::wound_def, -1, pos} {}
@ -11,14 +10,17 @@ 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) tmp *= DROW_POTION_MUL;
if (race == rdrow)
tmp *= DROW_POTION_MUL;
DEF = std::max(DEF - tmp, 0);
--remaining_duration;
}
}
int wound_def::get_priority() const {
return CALC_ADD_BASE;
return CALC_BASE;
}
const char *wound_def::get_name() const {