added extra potions
This commit is contained in:
@ -90,10 +90,14 @@ static const fraction STARTING_HR[RACE_CNT] = {
|
||||
|
||||
|
||||
// Potion-related
|
||||
static const int POTION_TYPE_CNT = 6;
|
||||
static const int POTION_TYPE_CNT = 14;
|
||||
static const int DEFAULT_POTION_TYPE_CNT = 6;
|
||||
enum potion_type : int {restore_health = 0, boost_atk, boost_def,
|
||||
poison_health, wound_atk, wound_def
|
||||
poison_health, wound_atk, wound_def,
|
||||
continuous_restoration, savage_strike,
|
||||
echoing_resilience, tempest_tantrum,
|
||||
bezerk_brew, borrow_life,
|
||||
fine_booze, ironclad_ward
|
||||
};
|
||||
|
||||
// Calculation priorities
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "../enemy.h"
|
||||
|
||||
class witch final: public enemy_base {
|
||||
constexpr static const fraction POTION_RATE = {1, 5};
|
||||
inline static const fraction POTION_RATE = {1, 5};
|
||||
public:
|
||||
witch(RNG *rng, const feature enabled_features, const position &pos,
|
||||
const int gen_room_num);
|
||||
|
@ -192,6 +192,8 @@ long_result player_base::interpret_command(level *lvl, game_command cmd) {
|
||||
res.msg += "PC picked up " + std::to_string(gold_tmp) +
|
||||
" pieces of gold. ";
|
||||
|
||||
gold_cnt += gold_tmp;
|
||||
|
||||
|
||||
if (enabled_features & FEATURE_INVENTORY) {
|
||||
size_t idx = get_potion_at(pos, lvl->get_plist());
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include "../player.h"
|
||||
|
||||
class assassin final: public player_base {
|
||||
constexpr static const fraction INF_HIT_RATE = {0x3F3F3F3F, 1};
|
||||
constexpr static const fraction INSTAKILL_RATE = {1, 10};
|
||||
inline static const fraction INF_HIT_RATE = {0x3F3F3F3F, 1};
|
||||
inline static const fraction INSTAKILL_RATE = {1, 10};
|
||||
public:
|
||||
assassin(RNG *rng, const feature enabled_features);
|
||||
const char *get_race_name() const override;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
class goblin final: public player_base {
|
||||
static const int GAIN_GOLD = 5;
|
||||
constexpr static const float ORC_DMG_MUL = 1.5f;
|
||||
inline static const float ORC_DMG_MUL = 1.5f;
|
||||
public:
|
||||
goblin(RNG *rng, const feature enabled_features);
|
||||
const char *get_race_name() const override;
|
||||
|
@ -21,7 +21,7 @@ protected:
|
||||
potion_type type;
|
||||
int remaining_duration;
|
||||
position pos;
|
||||
constexpr static const float DROW_POTION_MUL = 1.5f;
|
||||
inline static const float DROW_POTION_MUL = 1.5f;
|
||||
public:
|
||||
potion(const potion_type type, const int duration, const position &pos);
|
||||
// apply decrements remaining_duration if it's positive, and
|
||||
|
@ -7,32 +7,58 @@
|
||||
#include "potions/poison_health.h"
|
||||
#include "potions/wound_atk.h"
|
||||
#include "potions/wound_def.h"
|
||||
#include "potions/continuous_restoration.h"
|
||||
#include "potions/savage_strike.h"
|
||||
#include "potions/echoing_resilience.h"
|
||||
#include "potions/tempest_tantrum.h"
|
||||
#include "potions/bezerk_brew.h"
|
||||
#include "potions/borrow_life.h"
|
||||
#include "potions/fine_booze.h"
|
||||
#include "potions/ironclad_ward.h"
|
||||
|
||||
std::unique_ptr<potion> new_potion(potion_type type, const position &pos) {
|
||||
switch (type) {
|
||||
case restore_health:
|
||||
return std::make_unique<class restore_health>(pos);
|
||||
break;
|
||||
|
||||
case boost_atk:
|
||||
return std::make_unique<class boost_atk>(pos);
|
||||
break;
|
||||
|
||||
case boost_def:
|
||||
return std::make_unique<class boost_def>(pos);
|
||||
break;
|
||||
|
||||
case poison_health:
|
||||
return std::make_unique<class poison_health>(pos);
|
||||
break;
|
||||
|
||||
case wound_atk:
|
||||
return std::make_unique<class wound_atk>(pos);
|
||||
break;
|
||||
|
||||
case wound_def:
|
||||
return std::make_unique<class wound_def>(pos);
|
||||
break;
|
||||
|
||||
case continuous_restoration:
|
||||
return std::make_unique<class continuous_restoration>(pos);
|
||||
|
||||
case savage_strike:
|
||||
return std::make_unique<class savage_strike>(pos);
|
||||
|
||||
case echoing_resilience:
|
||||
return std::make_unique<class echoing_resilience>(pos);
|
||||
|
||||
case tempest_tantrum:
|
||||
return std::make_unique<class tempest_tantrum>(pos);
|
||||
|
||||
case bezerk_brew:
|
||||
return std::make_unique<class bezerk_brew>(pos);
|
||||
|
||||
case borrow_life:
|
||||
return std::make_unique<class borrow_life>(pos);
|
||||
|
||||
case fine_booze:
|
||||
return std::make_unique<class fine_booze>(pos);
|
||||
|
||||
case ironclad_ward:
|
||||
return std::make_unique<class ironclad_ward>(pos);
|
||||
|
||||
default:
|
||||
break;
|
||||
|
24
src/potions/bezerk_brew.cc
Normal file
24
src/potions/bezerk_brew.cc
Normal file
@ -0,0 +1,24 @@
|
||||
#include "bezerk_brew.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "../constants.h"
|
||||
|
||||
bezerk_brew::bezerk_brew(const position &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);
|
||||
--remaining_duration;
|
||||
}
|
||||
}
|
||||
|
||||
int bezerk_brew::get_priority() const {
|
||||
return CALC_MID;
|
||||
}
|
||||
|
||||
const char *bezerk_brew::get_name() const {
|
||||
return "BB";
|
||||
}
|
18
src/potions/bezerk_brew.h
Normal file
18
src/potions/bezerk_brew.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef __BEZERK_BREW_H__
|
||||
#define __BEZERK_BREW_H__
|
||||
|
||||
#include "../potion.h"
|
||||
|
||||
class bezerk_brew final: public potion {
|
||||
static const int ATK_MUL = 2;
|
||||
inline static const float DEF_MUL = 0.5f;
|
||||
static const int DURATION = 15;
|
||||
public:
|
||||
bezerk_brew(const position &pos);
|
||||
void apply(const enum race &race, int &HP, int &ATK, int &DEF,
|
||||
fraction &base_hit_rate) override;
|
||||
int get_priority() const override;
|
||||
const char *get_name() const override;
|
||||
};
|
||||
|
||||
#endif
|
27
src/potions/borrow_life.cc
Normal file
27
src/potions/borrow_life.cc
Normal file
@ -0,0 +1,27 @@
|
||||
#include "borrow_life.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "../constants.h"
|
||||
|
||||
borrow_life::borrow_life(const position &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);
|
||||
|
||||
if (remaining_duration != 0)
|
||||
--remaining_duration;
|
||||
|
||||
if (remaining_duration == 0)
|
||||
HP -= LOSE_HP * (race == rdrow ? DROW_POTION_MUL : 1);
|
||||
}
|
||||
|
||||
int borrow_life::get_priority() const {
|
||||
return CALC_LAST;
|
||||
}
|
||||
|
||||
const char *borrow_life::get_name() const {
|
||||
return "BL";
|
||||
}
|
18
src/potions/borrow_life.h
Normal file
18
src/potions/borrow_life.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef __BORROW_LIFE_H__
|
||||
#define __BORROW_LIFE_H__
|
||||
|
||||
#include "../potion.h"
|
||||
|
||||
class borrow_life final: public potion {
|
||||
static const int GIVE_HP = 50;
|
||||
static const int LOSE_HP = 55;
|
||||
static const int DURATION = 25;
|
||||
public:
|
||||
borrow_life(const position &pos);
|
||||
void apply(const enum race &race, int &HP, int &ATK, int &DEF,
|
||||
fraction &base_hit_rate) override;
|
||||
int get_priority() const override;
|
||||
const char *get_name() const override;
|
||||
};
|
||||
|
||||
#endif
|
28
src/potions/continuous_restoration.cc
Normal file
28
src/potions/continuous_restoration.cc
Normal file
@ -0,0 +1,28 @@
|
||||
#include "continuous_restoration.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "../constants.h"
|
||||
|
||||
continuous_restoration::continuous_restoration(const position &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)
|
||||
tmp *= DROW_POTION_MUL;
|
||||
|
||||
HP = std::min(HP + tmp, MAX_HP[race]);
|
||||
--remaining_duration;
|
||||
}
|
||||
}
|
||||
|
||||
int continuous_restoration::get_priority() const {
|
||||
return CALC_BASE;
|
||||
}
|
||||
|
||||
const char *continuous_restoration::get_name() const {
|
||||
return "CR";
|
||||
}
|
17
src/potions/continuous_restoration.h
Normal file
17
src/potions/continuous_restoration.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef __CONTINUOUS_RESTORATION_H__
|
||||
#define __CONTINUOUS_RESTORATION_H__
|
||||
|
||||
#include "../potion.h"
|
||||
|
||||
class continuous_restoration final: public potion {
|
||||
static const int GAIN_HEALTH = 3;
|
||||
static const int DURATION = 5;
|
||||
public:
|
||||
continuous_restoration(const position &pos);
|
||||
void apply(const enum race &race, int &HP, int &ATK, int &DEF,
|
||||
fraction &base_hit_rate) override;
|
||||
int get_priority() const override;
|
||||
const char *get_name() const override;
|
||||
};
|
||||
|
||||
#endif
|
28
src/potions/echoing_resilience.cc
Normal file
28
src/potions/echoing_resilience.cc
Normal file
@ -0,0 +1,28 @@
|
||||
#include "echoing_resilience.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "../constants.h"
|
||||
|
||||
echoing_resilience::echoing_resilience(const position &pos):
|
||||
potion{potion_type::echoing_resilience, 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);
|
||||
|
||||
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);
|
||||
|
||||
--remaining_duration;
|
||||
}
|
||||
}
|
||||
|
||||
int echoing_resilience::get_priority() const {
|
||||
return CALC_LAST;
|
||||
}
|
||||
|
||||
const char *echoing_resilience::get_name() const {
|
||||
return "ER";
|
||||
}
|
19
src/potions/echoing_resilience.h
Normal file
19
src/potions/echoing_resilience.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef __ECHOING_RESILIENCE_H__
|
||||
#define __ECHOING_RESILIENCE_H__
|
||||
|
||||
#include "../potion.h"
|
||||
|
||||
class echoing_resilience final: public potion {
|
||||
static const int GAIN_HEALTH = 7;
|
||||
static const int LOSE_ATK = 10;
|
||||
static const int LOSE_DEF = 10;
|
||||
static const int DURATION = 20;
|
||||
public:
|
||||
echoing_resilience(const position &pos);
|
||||
void apply(const enum race &race, int &HP, int &ATK, int &DEF,
|
||||
fraction &base_hit_rate) override;
|
||||
int get_priority() const override;
|
||||
const char *get_name() const override;
|
||||
};
|
||||
|
||||
#endif
|
34
src/potions/fine_booze.cc
Normal file
34
src/potions/fine_booze.cc
Normal file
@ -0,0 +1,34 @@
|
||||
#include "fine_booze.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "../constants.h"
|
||||
|
||||
fine_booze::fine_booze(const position &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)
|
||||
tmp *= DROW_POTION_MUL;
|
||||
|
||||
HP = std::min(HP + tmp, MAX_HP[race]);
|
||||
|
||||
if (race == rbrawler)
|
||||
base_hit_rate = HR_TB;
|
||||
else
|
||||
base_hit_rate *= HR_MUL;
|
||||
|
||||
--remaining_duration;
|
||||
}
|
||||
}
|
||||
|
||||
int fine_booze::get_priority() const {
|
||||
return CALC_LAST;
|
||||
}
|
||||
|
||||
const char *fine_booze::get_name() const {
|
||||
return "FB";
|
||||
}
|
20
src/potions/fine_booze.h
Normal file
20
src/potions/fine_booze.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef __FINE_BOOZE_H__
|
||||
#define __FINE_BOOZE_H__
|
||||
|
||||
#include "../potion.h"
|
||||
#include "../constants.h"
|
||||
|
||||
class fine_booze final: public potion {
|
||||
static const int GAIN_HP = 2;
|
||||
inline static const fraction HR_MUL = {7, 10};
|
||||
inline static const fraction HR_TB = {INF, 1};
|
||||
static const int DURATION = 12;
|
||||
public:
|
||||
fine_booze(const position &pos);
|
||||
void apply(const enum race &race, int &HP, int &ATK, int &DEF,
|
||||
fraction &base_hit_rate) override;
|
||||
int get_priority() const override;
|
||||
const char *get_name() const override;
|
||||
};
|
||||
|
||||
#endif
|
25
src/potions/ironclad_ward.cc
Normal file
25
src/potions/ironclad_ward.cc
Normal file
@ -0,0 +1,25 @@
|
||||
#include "ironclad_ward.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "../constants.h"
|
||||
|
||||
ironclad_ward::ironclad_ward(const position &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);
|
||||
base_hit_rate *= HR_MUL;
|
||||
--remaining_duration;
|
||||
}
|
||||
}
|
||||
|
||||
int ironclad_ward::get_priority() const {
|
||||
return CALC_LAST;
|
||||
}
|
||||
|
||||
const char *ironclad_ward::get_name() const {
|
||||
return "IW";
|
||||
}
|
19
src/potions/ironclad_ward.h
Normal file
19
src/potions/ironclad_ward.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef __IRONCLAD_WARD_H__
|
||||
#define __IRONCLAD_WARD_H__
|
||||
|
||||
#include "../potion.h"
|
||||
|
||||
class ironclad_ward final: public potion {
|
||||
inline static const float ATK_MUL = 0.5f;
|
||||
static const int DEF_MUL = 3;
|
||||
inline static const fraction HR_MUL = {3, 4};
|
||||
static const int DURATION = 12;
|
||||
public:
|
||||
ironclad_ward(const position &pos);
|
||||
void apply(const enum race &race, int &HP, int &ATK, int &DEF,
|
||||
fraction &base_hit_rate) override;
|
||||
int get_priority() const override;
|
||||
const char *get_name() const override;
|
||||
};
|
||||
|
||||
#endif
|
24
src/potions/savage_strike.cc
Normal file
24
src/potions/savage_strike.cc
Normal file
@ -0,0 +1,24 @@
|
||||
#include "savage_strike.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "../constants.h"
|
||||
|
||||
savage_strike::savage_strike(const position &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);
|
||||
base_hit_rate *= HR_MUL;
|
||||
--remaining_duration;
|
||||
}
|
||||
}
|
||||
|
||||
int savage_strike::get_priority() const {
|
||||
return CALC_MID;
|
||||
}
|
||||
|
||||
const char *savage_strike::get_name() const {
|
||||
return "SS";
|
||||
}
|
18
src/potions/savage_strike.h
Normal file
18
src/potions/savage_strike.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef __SAVAGE_STRIKE_H__
|
||||
#define __SAVAGE_STRIKE_H__
|
||||
|
||||
#include "../potion.h"
|
||||
|
||||
class savage_strike final: public potion {
|
||||
inline static const float ATK_MUL = 1.25f;
|
||||
inline static const fraction HR_MUL = {4, 5};
|
||||
static const int DURATION = 20;
|
||||
public:
|
||||
savage_strike(const position &pos);
|
||||
void apply(const enum race &race, int &HP, int &ATK, int &DEF,
|
||||
fraction &base_hit_rate) override;
|
||||
int get_priority() const override;
|
||||
const char *get_name() const override;
|
||||
};
|
||||
|
||||
#endif
|
28
src/potions/tempest_tantrum.cc
Normal file
28
src/potions/tempest_tantrum.cc
Normal file
@ -0,0 +1,28 @@
|
||||
#include "tempest_tantrum.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "../constants.h"
|
||||
|
||||
tempest_tantrum::tempest_tantrum(const position &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);
|
||||
|
||||
if (remaining_duration != 0) {
|
||||
ATK *= ATK_MUL * (race == rdrow ? DROW_POTION_MUL : 1);
|
||||
DEF *= DEF_MUL * (race == rdrow ? DROW_POTION_MUL : 1);
|
||||
--remaining_duration;
|
||||
}
|
||||
}
|
||||
|
||||
int tempest_tantrum::get_priority() const {
|
||||
return CALC_LAST;
|
||||
}
|
||||
|
||||
const char *tempest_tantrum::get_name() const {
|
||||
return "TT";
|
||||
}
|
19
src/potions/tempest_tantrum.h
Normal file
19
src/potions/tempest_tantrum.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef __TEMPEST_TANTRUM_H__
|
||||
#define __TEMPEST_TANTRUM_H__
|
||||
|
||||
#include "../potion.h"
|
||||
|
||||
class tempest_tantrum final: public potion {
|
||||
static const int ATK_MUL = 3;
|
||||
inline static const float DEF_MUL = 0.5f;
|
||||
inline static const float HP_RD_PERCENTAGE = 0.25f;
|
||||
static const int DURATION = 12;
|
||||
public:
|
||||
tempest_tantrum(const position &pos);
|
||||
void apply(const enum race &race, int &HP, int &ATK, int &DEF,
|
||||
fraction &base_hit_rate) override;
|
||||
int get_priority() const override;
|
||||
const char *get_name() const override;
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user