Compare commits

...

10 Commits

Author SHA1 Message Date
ff72fb5dc0 submission 2024-07-26 08:12:53 -04:00
655a557778 changed PH to be able to kill 2024-07-25 19:34:16 -04:00
03a462632f ignores cc3k.zip 2024-07-25 19:32:42 -04:00
6c27a1510b added fallback option to enemy movement when out of space 2024-07-25 19:32:04 -04:00
410b31c96a added a playground for the demo 2024-07-25 19:19:16 -04:00
b4137467a7 fixed some grammar, fixed some constants 2024-07-25 19:17:20 -04:00
d61342b9f1 fixed bug where merchants are not moving
reading map data from file will now generate only the specified entities (if none are specified, randomly generate them
2024-07-25 18:55:18 -04:00
b04884e44a moved files out of subdirectories, added required documentation 2024-07-25 13:08:39 -04:00
546909b4aa added fallback for human gold generation upon death 2024-07-25 11:28:11 -04:00
535533206f fixed: adjacent merchants under The World will now no move unless hostile
fixed typo
2024-07-25 11:26:05 -04:00
104 changed files with 347 additions and 230 deletions

2
src/.gitignore vendored
View File

@ -1 +1,3 @@
testing* testing*
cc3k.zip

View File

@ -7,12 +7,12 @@
#include <sstream> #include <sstream>
#include "constants.h" #include "constants.h"
#include "input/file_input.h" #include "file_input.h"
#include "output/file_output.h" #include "file_output.h"
#include "input/console_input.h" #include "console_input.h"
#include "output/console_output.h" #include "console_output.h"
#include "input/curses_input.h" #include "curses_input.h"
#include "output/curses_output.h" #include "curses_output.h"
#include "rng.h" #include "rng.h"
feature proc_args(int argc, char **argv, feature proc_args(int argc, char **argv,
@ -348,7 +348,7 @@ const char *POTIONS_LIST = "\
Gets 3x final ATK multiplier;\n\ Gets 3x final ATK multiplier;\n\
Gets 0.5x final DEF multiplier;\n\ Gets 0.5x final DEF multiplier;\n\
Lasts 12 turns.\n\n\ Lasts 12 turns.\n\n\
- Bezerk Brew (BB):\n\ - Berzerk Brew (BB):\n\
Gets 2x basic ATK multiplier;\n\ Gets 2x basic ATK multiplier;\n\
Gets 0.5x basic DEF multiplier;\n\ Gets 0.5x basic DEF multiplier;\n\
Lasts 15 turns.\n\n\ Lasts 15 turns.\n\n\

View File

@ -1,6 +1,6 @@
#include "assassin.h" #include "assassin.h"
#include "../constants.h" #include "constants.h"
assassin::assassin(RNG *rng, const feature enabled_features): assassin::assassin(RNG *rng, const feature enabled_features):
player_base{rng, enabled_features, race::ASSASSIN} {}; player_base{rng, enabled_features, race::ASSASSIN} {};

View File

@ -1,7 +1,7 @@
#ifndef __ASSASSIN_H__ #ifndef __ASSASSIN_H__
#define __ASSASSIN_H__ #define __ASSASSIN_H__
#include "../player.h" #include "player.h"
class assassin final: public player_base { class assassin final: public player_base {
inline static const fraction INF_HIT_RATE = {0x3F3F3F3F, 1}; inline static const fraction INF_HIT_RATE = {0x3F3F3F3F, 1};

View File

@ -1,6 +1,6 @@
#include "baby_dragon.h" #include "baby_dragon.h"
#include "../constants.h" #include "constants.h"
baby_dragon::baby_dragon(RNG *rng, const feature enabled_features, baby_dragon::baby_dragon(RNG *rng, const feature enabled_features,
const position &pos, const int gen_room_num): const position &pos, const int gen_room_num):

View File

@ -1,7 +1,7 @@
#ifndef __BABY_DRAGON_H__ #ifndef __BABY_DRAGON_H__
#define __BABY_DRAGON_H__ #define __BABY_DRAGON_H__
#include "../enemy.h" #include "enemy.h"
class baby_dragon final: public enemy_base { class baby_dragon final: public enemy_base {
public: public:

24
src/berzerk_brew.cc Normal file
View File

@ -0,0 +1,24 @@
#include "berzerk_brew.h"
#include <algorithm>
#include "constants.h"
berzerk_brew::berzerk_brew(const position &pos):
potion{potion_type::BERZERK_BREW, DURATION, pos} {}
void berzerk_brew::apply(const enum race &race, int &HP, int &ATK,
int &DEF, fraction &base_hit_rate) {
if (remaining_duration != 0) {
ATK *= ATK_MUL * (race == DROW ? DROW_POTION_MUL : 1);
DEF *= DEF_MUL * (race == DROW ? DROW_POTION_MUL : 1);
--remaining_duration;
}
}
int berzerk_brew::get_priority() const {
return CALC_MID;
}
const char *berzerk_brew::get_name() const {
return "BB";
}

View File

@ -1,14 +1,14 @@
#ifndef __BEZERK_BREW_H__ #ifndef __BERZERK_BREW_H__
#define __BEZERK_BREW_H__ #define __BERZERK_BREW_H__
#include "../potion.h" #include "potion.h"
class bezerk_brew final: public potion { class berzerk_brew final: public potion {
static const int ATK_MUL = 2; static const int ATK_MUL = 2;
inline static const float DEF_MUL = 0.5f; inline static const float DEF_MUL = 0.5f;
static const int DURATION = 15; static const int DURATION = 15;
public: public:
bezerk_brew(const position &pos); berzerk_brew(const position &pos);
void apply(const enum race &race, int &HP, int &ATK, int &DEF, void apply(const enum race &race, int &HP, int &ATK, int &DEF,
fraction &base_hit_rate) override; fraction &base_hit_rate) override;
int get_priority() const override; int get_priority() const override;

View File

@ -1,7 +1,7 @@
#include "boost_atk.h" #include "boost_atk.h"
#include <algorithm> #include <algorithm>
#include "../constants.h" #include "constants.h"

View File

@ -1,7 +1,7 @@
#ifndef __BOOST_ATK_H__ #ifndef __BOOST_ATK_H__
#define __BOOST_ATK_H__ #define __BOOST_ATK_H__
#include "../potion.h" #include "potion.h"
class boost_atk final: public potion { class boost_atk final: public potion {
static const int BOOST_ATK = 5; static const int BOOST_ATK = 5;

View File

@ -1,7 +1,7 @@
#include "boost_def.h" #include "boost_def.h"
#include <algorithm> #include <algorithm>
#include "../constants.h" #include "constants.h"
boost_def::boost_def(const position &pos): boost_def::boost_def(const position &pos):

View File

@ -1,7 +1,7 @@
#ifndef __BOOST_DEF_H__ #ifndef __BOOST_DEF_H__
#define __BOOST_DEF_H__ #define __BOOST_DEF_H__
#include "../potion.h" #include "potion.h"
class boost_def final: public potion { class boost_def final: public potion {
static const int BOOST_DEF = 5; static const int BOOST_DEF = 5;

View File

@ -1,7 +1,7 @@
#include "borrow_life.h" #include "borrow_life.h"
#include <algorithm> #include <algorithm>
#include "../constants.h" #include "constants.h"
borrow_life::borrow_life(const position &pos): borrow_life::borrow_life(const position &pos):
potion{potion_type::BORROW_LIFE, DURATION, pos} {} potion{potion_type::BORROW_LIFE, DURATION, pos} {}

View File

@ -1,7 +1,7 @@
#ifndef __BORROW_LIFE_H__ #ifndef __BORROW_LIFE_H__
#define __BORROW_LIFE_H__ #define __BORROW_LIFE_H__
#include "../potion.h" #include "potion.h"
class borrow_life final: public potion { class borrow_life final: public potion {
static const int GIVE_HP = 50; static const int GIVE_HP = 50;

View File

@ -1,6 +1,6 @@
#include "brawler.h" #include "brawler.h"
#include "../constants.h" #include "constants.h"
brawler::brawler(RNG *rng, const feature enabled_features): brawler::brawler(RNG *rng, const feature enabled_features):
player_base{rng, enabled_features, race::BRAWLER} {}; player_base{rng, enabled_features, race::BRAWLER} {};

View File

@ -1,7 +1,7 @@
#ifndef __BRAWLER_H__ #ifndef __BRAWLER_H__
#define __BRAWLER_H__ #define __BRAWLER_H__
#include "../player.h" #include "player.h"
class brawler final: public player_base { class brawler final: public player_base {
public: public:

View File

@ -2,7 +2,7 @@
#include <utility> #include <utility>
#include <string> #include <string>
#include "../constants.h" #include "constants.h"
console_input::console_input(std::istream &cin): console_input::console_input(std::istream &cin):
in{cin} {} in{cin} {}

View File

@ -2,7 +2,7 @@
#define __CONSOLE_INPUT_H__ #define __CONSOLE_INPUT_H__
#include <iostream> #include <iostream>
#include "../input.h" #include "input.h"
class console_input final : public input { class console_input final : public input {
private: private:

View File

@ -4,7 +4,7 @@
#include <utility> #include <utility>
#include <ncurses.h> #include <ncurses.h>
#include "../constants.h" #include "constants.h"
console_output::console_output(std::ostream &cout): out{cout} {} console_output::console_output(std::ostream &cout): out{cout} {}

View File

@ -2,7 +2,7 @@
#define __CONSOLE_OUTPUT_H__ #define __CONSOLE_OUTPUT_H__
#include <iostream> #include <iostream>
#include "../output.h" #include "output.h"
class console_output final : public output { class console_output final : public output {
private: private:

View File

@ -96,7 +96,7 @@ 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, CONTINUOUS_RESTORATION, SAVAGE_STRIKE,
ECHOING_RESIL, TEMPEST_TANTRUM, ECHOING_RESIL, TEMPEST_TANTRUM,
BEZERK_BREW, BORROW_LIFE, BERZERK_BREW, BORROW_LIFE,
FINE_BOOZE, IRONCLAD_WARD FINE_BOOZE, IRONCLAD_WARD
}; };
@ -162,8 +162,8 @@ static const int RETURN_PANICKED = 1;
static const int COLOR_BLACK_ON_WHITE = 8; static const int COLOR_BLACK_ON_WHITE = 8;
static const int GOLD_NORMAL = 1; static const int GOLD_NORMAL = 2;
static const int GOLD_SMALL = 2; static const int GOLD_SMALL = 1;
static const int GOLD_MERCHANT = 4; static const int GOLD_MERCHANT = 4;
static const int GOLD_DRAGON = 6; static const int GOLD_DRAGON = 6;

View File

@ -1,7 +1,7 @@
#include "continuous_restoration.h" #include "continuous_restoration.h"
#include <algorithm> #include <algorithm>
#include "../constants.h" #include "constants.h"
continuous_restoration::continuous_restoration(const position &pos): continuous_restoration::continuous_restoration(const position &pos):
potion{potion_type::CONTINUOUS_RESTORATION, DURATION, pos} {} potion{potion_type::CONTINUOUS_RESTORATION, DURATION, pos} {}

View File

@ -1,7 +1,7 @@
#ifndef __CONTINUOUS_RESTORATION_H__ #ifndef __CONTINUOUS_RESTORATION_H__
#define __CONTINUOUS_RESTORATION_H__ #define __CONTINUOUS_RESTORATION_H__
#include "../potion.h" #include "potion.h"
class continuous_restoration final: public potion { class continuous_restoration final: public potion {
static const int GAIN_HEALTH = 3; static const int GAIN_HEALTH = 3;

View File

@ -1,6 +1,6 @@
#include "curses_input.h" #include "curses_input.h"
#include "../constants.h" #include "constants.h"
curses_input::curses_input(cursor *new_curse): curses_input::curses_input(cursor *new_curse):
curse{new_curse} {} curse{new_curse} {}

View File

@ -2,8 +2,8 @@
#define __CURSES_INPUT_H__ #define __CURSES_INPUT_H__
#include <memory> #include <memory>
#include "../input.h" #include "input.h"
#include "../cursor.h" #include "cursor.h"
class curses_input final: public input { class curses_input final: public input {
private: private:

View File

@ -1,6 +1,6 @@
#include "curses_output.h" #include "curses_output.h"
#include "../constants.h" #include "constants.h"
curses_output::curses_output(cursor *new_curse): curses_output::curses_output(cursor *new_curse):
curse{new_curse} {} curse{new_curse} {}

View File

@ -3,8 +3,8 @@
#include <utility> #include <utility>
#include <memory> #include <memory>
#include "../cursor.h" #include "cursor.h"
#include "../output.h" #include "output.h"
class curses_output final : public output { class curses_output final : public output {
private: private:

BIN
src/design.pdf Normal file

Binary file not shown.

View File

@ -1,7 +1,7 @@
#include "dragon.h" #include "dragon.h"
#include "../constants.h" #include "constants.h"
#include "../level.h" #include "level.h"
dragon::dragon(RNG *rng, const feature enabled_features, const position &pos, dragon::dragon(RNG *rng, const feature enabled_features, const position &pos,
const int gen_room_num, const position &guards): const int gen_room_num, const position &guards):

View File

@ -1,7 +1,7 @@
#ifndef __DRAGON_H__ #ifndef __DRAGON_H__
#define __DRAGON_H__ #define __DRAGON_H__
#include "../enemy.h" #include "enemy.h"
class dragon final: public enemy_base { class dragon final: public enemy_base {
const position guards; const position guards;

View File

@ -1,6 +1,6 @@
#include "drow.h" #include "drow.h"
#include "../constants.h" #include "constants.h"
drow::drow(RNG *rng, const feature enabled_features): drow::drow(RNG *rng, const feature enabled_features):
player_base{rng, enabled_features, race::DROW} {} player_base{rng, enabled_features, race::DROW} {}

View File

@ -1,7 +1,7 @@
#ifndef __DROW_H__ #ifndef __DROW_H__
#define __DROW_H__ #define __DROW_H__
#include "../player.h" #include "player.h"
class drow final: public player_base { class drow final: public player_base {
public: public:

View File

@ -1,6 +1,6 @@
#include "dwarf.h" #include "dwarf.h"
#include "../constants.h" #include "constants.h"
dwarf::dwarf(RNG *rng, const feature enabled_features, const position &pos, dwarf::dwarf(RNG *rng, const feature enabled_features, const position &pos,
const int gen_room_num): const int gen_room_num):

View File

@ -1,7 +1,7 @@
#ifndef __DWARF_H__ #ifndef __DWARF_H__
#define __DWARF_H__ #define __DWARF_H__
#include "../enemy.h" #include "enemy.h"
class dwarf final: public enemy_base { class dwarf final: public enemy_base {
public: public:

View File

@ -1,7 +1,7 @@
#include "echoing_resilience.h" #include "echoing_resilience.h"
#include <algorithm> #include <algorithm>
#include "../constants.h" #include "constants.h"
echoing_resilience::echoing_resilience(const position &pos): echoing_resilience::echoing_resilience(const position &pos):
potion{potion_type::ECHOING_RESIL, DURATION, pos} {} potion{potion_type::ECHOING_RESIL, DURATION, pos} {}

View File

@ -1,7 +1,7 @@
#ifndef __ECHOING_RESILIENCE_H__ #ifndef __ECHOING_RESILIENCE_H__
#define __ECHOING_RESILIENCE_H__ #define __ECHOING_RESILIENCE_H__
#include "../potion.h" #include "potion.h"
class echoing_resilience final: public potion { class echoing_resilience final: public potion {
static const int GAIN_HEALTH = 7; static const int GAIN_HEALTH = 7;

View File

@ -1,6 +1,6 @@
#include "elf.h" #include "elf.h"
#include "../constants.h" #include "constants.h"
elf::elf(RNG *rng, const feature enabled_features, const position &pos, elf::elf(RNG *rng, const feature enabled_features, const position &pos,
const int gen_room_num): const int gen_room_num):

View File

@ -1,7 +1,7 @@
#ifndef __ELF_H__ #ifndef __ELF_H__
#define __ELF_H__ #define __ELF_H__
#include "../enemy.h" #include "enemy.h"
class elf final: public enemy_base { class elf final: public enemy_base {
public: public:

View File

@ -1,19 +1,19 @@
#include "enemies.h" #include "enemies.h"
#include "constants.h" #include "constants.h"
#include "enemies/dragon.h" #include "dragon.h"
#include "enemies/dwarf.h" #include "dwarf.h"
#include "enemies/elf.h" #include "elf.h"
#include "enemies/halfling.h" #include "halfling.h"
#include "enemies/human.h" #include "human.h"
#include "enemies/merchant.h" #include "merchant.h"
#include "enemies/orc.h" #include "orc.h"
#include "enemies/viking.h" #include "viking.h"
#include "enemies/swordsman.h" #include "swordsman.h"
#include "enemies/leprechaun.h" #include "leprechaun.h"
#include "enemies/witch.h" #include "witch.h"
#include "enemies/hacker.h" #include "hacker.h"
#include "enemies/baby_dragon.h" #include "baby_dragon.h"
std::unique_ptr<enemy_base> new_dragon(RNG *rng, const position &pos, std::unique_ptr<enemy_base> new_dragon(RNG *rng, const position &pos,
const position &fallback, const position &fallback,

View File

@ -34,7 +34,9 @@ long_result enemy_base::act(level *lvl, character *pc, bool hostile) {
target = tmp; target = tmp;
} }
if (target.x != BIG_NUMBER)
pos = target; pos = target;
return {NOTHING, ""}; return {NOTHING, ""};
} }

View File

@ -2,7 +2,7 @@
#include <utility> #include <utility>
#include <string> #include <string>
#include "../constants.h" #include "constants.h"
file_input::file_input(std::ifstream &&ifs): file_input::file_input(std::ifstream &&ifs):
in{std::move(ifs)} {} in{std::move(ifs)} {}

View File

@ -2,7 +2,7 @@
#define __FILE_INPUT_H__ #define __FILE_INPUT_H__
#include <fstream> #include <fstream>
#include "../input.h" #include "input.h"
class file_input final : public input { class file_input final : public input {
private: private:

View File

@ -2,7 +2,7 @@
#include <utility> #include <utility>
#include "../constants.h" #include "constants.h"
file_output::file_output(std::ofstream &&ofs): file_output::file_output(std::ofstream &&ofs):
out{std::move(ofs)} {} out{std::move(ofs)} {}

View File

@ -2,7 +2,7 @@
#define __FILE_OUTPUT_H__ #define __FILE_OUTPUT_H__
#include <fstream> #include <fstream>
#include "../output.h" #include "output.h"
class file_output final : public output { class file_output final : public output {
private: private:

View File

@ -1,7 +1,7 @@
#include "fine_booze.h" #include "fine_booze.h"
#include <algorithm> #include <algorithm>
#include "../constants.h" #include "constants.h"
fine_booze::fine_booze(const position &pos): fine_booze::fine_booze(const position &pos):
potion{potion_type::FINE_BOOZE, DURATION, pos} {} potion{potion_type::FINE_BOOZE, DURATION, pos} {}

View File

@ -1,8 +1,8 @@
#ifndef __FINE_BOOZE_H__ #ifndef __FINE_BOOZE_H__
#define __FINE_BOOZE_H__ #define __FINE_BOOZE_H__
#include "../potion.h" #include "potion.h"
#include "../constants.h" #include "constants.h"
class fine_booze final: public potion { class fine_booze final: public potion {
static const int GAIN_HP = 2; static const int GAIN_HP = 2;

View File

@ -2,7 +2,7 @@
#include "constants.h" #include "constants.h"
#include "pc.h" #include "pc.h"
#include "enemies/dragon.h" #include "dragon.h"
game::game(const enum race starting_race, game::game(const enum race starting_race,
const feature enabled_features, const feature enabled_features,
@ -91,7 +91,11 @@ character *game::move_enemies() {
continue; continue;
} }
if (the_world && !(is_adjacent(ch->get_pos(), player->get_pos()) || if (the_world && ch->get_race() == MERCHANT) {
if (!hostile_merchants)
continue;
} else if (the_world &&
!(is_adjacent(ch->get_pos(), player->get_pos()) ||
(ch->get_race() == DRAGON && (ch->get_race() == DRAGON &&
is_adjacent(static_cast<dragon * >(ch)->get_guards(), is_adjacent(static_cast<dragon * >(ch)->get_guards(),
player->get_pos())))) player->get_pos()))))

View File

@ -1,6 +1,6 @@
#include "goblin.h" #include "goblin.h"
#include "../constants.h" #include "constants.h"
goblin::goblin(RNG *rng, const feature enabled_features): goblin::goblin(RNG *rng, const feature enabled_features):
player_base{rng, enabled_features, race::GOBLIN} {}; player_base{rng, enabled_features, race::GOBLIN} {};

View File

@ -1,7 +1,7 @@
#ifndef __GOBLIN_H__ #ifndef __GOBLIN_H__
#define __GOBLIN_H__ #define __GOBLIN_H__
#include "../player.h" #include "player.h"
class goblin final: public player_base { class goblin final: public player_base {
static const int GAIN_GOLD = 5; static const int GAIN_GOLD = 5;

View File

@ -1,6 +1,6 @@
#include "hacker.h" #include "hacker.h"
#include "../constants.h" #include "constants.h"
hacker::hacker(RNG *rng, const feature enabled_features, const position &pos, hacker::hacker(RNG *rng, const feature enabled_features, const position &pos,
const int gen_room_num): const int gen_room_num):

View File

@ -1,7 +1,7 @@
#ifndef __HACKER_H__ #ifndef __HACKER_H__
#define __HACKER_H__ #define __HACKER_H__
#include "../enemy.h" #include "enemy.h"
class hacker final: public enemy_base { class hacker final: public enemy_base {
static const int RAND_STR_LEN_MIN = 10; static const int RAND_STR_LEN_MIN = 10;

View File

@ -1,6 +1,6 @@
#include "halfling.h" #include "halfling.h"
#include "../constants.h" #include "constants.h"
fraction halfling::HIT_RATE_MUL = {1, 2}; fraction halfling::HIT_RATE_MUL = {1, 2};
@ -35,5 +35,5 @@ long_result halfling::get_hit(character *ch, const int tATK,
} }
return {MISS, "PC tried to hit " + abbrev + return {MISS, "PC tried to hit " + abbrev +
" but missed. The halfling laughed. "}; " but missed. The halfling laughs. "};
} }

View File

@ -1,7 +1,7 @@
#ifndef __HALFLING_H__ #ifndef __HALFLING_H__
#define __HALFLING_H__ #define __HALFLING_H__
#include "../enemy.h" #include "enemy.h"
class halfling final: public enemy_base { class halfling final: public enemy_base {
static fraction HIT_RATE_MUL; static fraction HIT_RATE_MUL;

View File

@ -1,7 +1,7 @@
#include "human.h" #include "human.h"
#include "../constants.h" #include "constants.h"
#include "../level.h" #include "level.h"
human::human(RNG *rng, const feature enabled_features, const position &pos, human::human(RNG *rng, const feature enabled_features, const position &pos,
const int gen_room_num): const int gen_room_num):
@ -14,6 +14,10 @@ const char *human::get_race_name() const {
int human::dies(level *lvl) { int human::dies(level *lvl) {
lvl->add_gold(gold{pos, GOLD_NORMAL}); lvl->add_gold(gold{pos, GOLD_NORMAL});
auto plist = lvl->get_available_around_all(pos); auto plist = lvl->get_available_around_all(pos);
if (plist.size())
lvl->add_gold(gold{rng->get_rand_in_vector(plist), GOLD_NORMAL}); lvl->add_gold(gold{rng->get_rand_in_vector(plist), GOLD_NORMAL});
else
lvl->add_gold(gold{pos, GOLD_NORMAL});
return 0; return 0;
} }

View File

@ -1,7 +1,7 @@
#ifndef __HUMAN_H__ #ifndef __HUMAN_H__
#define __HUMAN_H__ #define __HUMAN_H__
#include "../enemy.h" #include "enemy.h"
class human final: public enemy_base { class human final: public enemy_base {
public: public:

View File

@ -1,7 +1,7 @@
#include "ironclad_ward.h" #include "ironclad_ward.h"
#include <algorithm> #include <algorithm>
#include "../constants.h" #include "constants.h"
ironclad_ward::ironclad_ward(const position &pos): ironclad_ward::ironclad_ward(const position &pos):
potion{potion_type::IRONCLAD_WARD, DURATION, pos} {} potion{potion_type::IRONCLAD_WARD, DURATION, pos} {}

View File

@ -1,7 +1,7 @@
#ifndef __IRONCLAD_WARD_H__ #ifndef __IRONCLAD_WARD_H__
#define __IRONCLAD_WARD_H__ #define __IRONCLAD_WARD_H__
#include "../potion.h" #include "potion.h"
class ironclad_ward final: public potion { class ironclad_ward final: public potion {
inline static const float ATK_MUL = 0.5f; inline static const float ATK_MUL = 0.5f;

View File

@ -1,8 +1,8 @@
#include "leprechaun.h" #include "leprechaun.h"
#include "../constants.h" #include "constants.h"
#include "../player.h" #include "player.h"
#include "../level.h" #include "level.h"
leprechaun::leprechaun(RNG *rng, const feature enabled_features, leprechaun::leprechaun(RNG *rng, const feature enabled_features,
const position &pos, const position &pos,

View File

@ -1,7 +1,7 @@
#ifndef __LEPRECHAUN_H__ #ifndef __LEPRECHAUN_H__
#define __LEPRECHAUN_H__ #define __LEPRECHAUN_H__
#include "../enemy.h" #include "enemy.h"
class leprechaun final: public enemy_base { class leprechaun final: public enemy_base {
static const int STEAL_GOLD = 3; static const int STEAL_GOLD = 3;

View File

@ -41,6 +41,12 @@ level::level(const level_data &lvl, character *player, RNG *rng,
if (enabled_features & FEATURE_READ_MAP) if (enabled_features & FEATURE_READ_MAP)
fill(lvl, tiles, rng); fill(lvl, tiles, rng);
if (enabled_features & FEATURE_READ_MAP &&
(lvl.enemies.size() ||
lvl.potions.size() ||
lvl.gold_piles.size()))
return;
gen_potions(rng, tiles); gen_potions(rng, tiles);
gen_gold(rng, tiles); gen_gold(rng, tiles);
gen_enemies(lvl, rng, tiles); gen_enemies(lvl, rng, tiles);
@ -109,9 +115,9 @@ bool level::is_in_glist(gold &g, const gold_list &gl) {
void level::gen_enemies(const level_data &lvl, RNG *rng, void level::gen_enemies(const level_data &lvl, RNG *rng,
std::vector<position_list> &tiles) { std::vector<position_list> &tiles) {
auto dhoard = dragon_hoard(lvl); auto dhoard = dragon_hoard(lvl);
int cnt = enabled_features & FEATURE_EXTRA_STUFF ? int cnt = (enabled_features & FEATURE_EXTRA_STUFF ?
rng->rand_between(MIN_ENEMIE_CNT, MAX_ENEMIE_CNT + 1) : rng->rand_between(MIN_ENEMIE_CNT, MAX_ENEMIE_CNT + 1) :
MIN_ENEMIE_CNT + dhoard.size(); MIN_ENEMIE_CNT) + dhoard.size();
elist.reserve(cnt); elist.reserve(cnt);
pelist.reserve(cnt); pelist.reserve(cnt);

View File

@ -29,9 +29,13 @@ int main(int argc, char **argv) {
CC3K game_proc(enabled_features, in.get(), out.get(), rng.get(), data); CC3K game_proc(enabled_features, in.get(), out.get(), rng.get(), data);
while (1) while (true) {
if (game_proc.run() == game_status::TERMINATED) if (game_proc.run() == game_status::TERMINATED)
break; break;
if (enabled_features & FEATURE_IN_FILE)
getchar();
}
return RETURN_FINE; return RETURN_FINE;
} }

View File

@ -1,8 +1,8 @@
#include "merchant.h" #include "merchant.h"
#include "../constants.h" #include "constants.h"
#include "../gold.h" #include "gold.h"
#include "../level.h" #include "level.h"
merchant::merchant(RNG *rng, const feature enabled_features, merchant::merchant(RNG *rng, const feature enabled_features,
const position &pos, const int gen_room_num): const position &pos, const int gen_room_num):

View File

@ -1,7 +1,7 @@
#ifndef __MERCHANT_H__ #ifndef __MERCHANT_H__
#define __MERCHANT_H__ #define __MERCHANT_H__
#include "../enemy.h" #include "enemy.h"
class merchant final: public enemy_base { class merchant final: public enemy_base {
public: public:

View File

@ -1,6 +1,6 @@
#include "monk.h" #include "monk.h"
#include "../constants.h" #include "constants.h"
monk::monk(RNG *rng, const feature enabled_features): monk::monk(RNG *rng, const feature enabled_features):
player_base{rng, enabled_features, MONK} {} player_base{rng, enabled_features, MONK} {}

View File

@ -1,7 +1,7 @@
#ifndef __MONK_H__ #ifndef __MONK_H__
#define __MONK_H__ #define __MONK_H__
#include "../player.h" #include "player.h"
class monk final: public player_base { class monk final: public player_base {
static const int GAIN_HP = 2; static const int GAIN_HP = 2;

View File

@ -1,6 +1,6 @@
#include "mr_goose.h" #include "mr_goose.h"
#include "../constants.h" #include "constants.h"
mr_goose::mr_goose(RNG *rng, const feature enabled_features): mr_goose::mr_goose(RNG *rng, const feature enabled_features):
player_base{rng, enabled_features, race::MR_GOOSE} { player_base{rng, enabled_features, race::MR_GOOSE} {

View File

@ -1,7 +1,7 @@
#ifndef __MR_GOOSE_H__ #ifndef __MR_GOOSE_H__
#define __MR_GOOSE_H__ #define __MR_GOOSE_H__
#include "../player.h" #include "player.h"
class mr_goose final: public player_base { class mr_goose final: public player_base {
public: public:

View File

@ -1,6 +1,6 @@
#include "orc.h" #include "orc.h"
#include "../constants.h" #include "constants.h"
orc::orc(RNG *rng, const feature enabled_features, const position &pos, orc::orc(RNG *rng, const feature enabled_features, const position &pos,
const int gen_room_num): const int gen_room_num):

View File

@ -1,7 +1,7 @@
#ifndef __ORC_H__ #ifndef __ORC_H__
#define __ORC_H__ #define __ORC_H__
#include "../enemy.h" #include "enemy.h"
class orc final: public enemy_base { class orc final: public enemy_base {
public: public:

View File

@ -1,16 +1,16 @@
#include "pc.h" #include "pc.h"
#include "constants.h" #include "constants.h"
#include "player/goblin.h" #include "goblin.h"
#include "player/drow.h" #include "drow.h"
#include "player/shade.h" #include "shade.h"
#include "player/troll.h" #include "troll.h"
#include "player/vampire.h" #include "vampire.h"
#include "player/t_800.h" #include "t_800.h"
#include "player/assassin.h" #include "assassin.h"
#include "player/monk.h" #include "monk.h"
#include "player/brawler.h" #include "brawler.h"
#include "player/mr_goose.h" #include "mr_goose.h"
std::unique_ptr<player_base> init_player(RNG *rng, std::unique_ptr<player_base> init_player(RNG *rng,
const feature enabled_features, const enum race &r) { const feature enabled_features, const enum race &r) {

View File

@ -52,7 +52,7 @@ long_result player_base::apply(std::unique_ptr<potion> p) {
"PC gets rusty joints (-50 HP). "}; "PC gets rusty joints (-50 HP). "};
return {result::APPLIED, return {result::APPLIED,
"PC applied potion of " + name + ". "}; "PC uses potion of " + name + ". "};
} }
long_result player_base::attack(character *ch) { long_result player_base::attack(character *ch) {
@ -90,9 +90,9 @@ long_result player_base::move(level *lvl,
} }
} else if (lvl->get_up_stairs() == p && } else if (lvl->get_up_stairs() == p &&
enabled_features & FEATURE_REVISIT) { enabled_features & FEATURE_REVISIT) {
return {result::GO_UP, "PC went up the stairs. "}; return {result::GO_UP, "PC goes up the stairs. "};
} else if (lvl->get_down_stairs() == p) { } else if (lvl->get_down_stairs() == p) {
return {result::GO_DOWN, "PC went down the stairs. "}; return {result::GO_DOWN, "PC goes down the stairs. "};
} else if (lvl->is_available(p, true)) { } else if (lvl->is_available(p, true)) {
pos = p; pos = p;
return {result::MOVED, ""}; return {result::MOVED, ""};
@ -109,7 +109,7 @@ void player_base::pickup_gold(level *lvl, std::string &msg) {
gold_tmp += g.get_amount(); gold_tmp += g.get_amount();
if (gold_tmp) if (gold_tmp)
msg += "PC picked up " + std::to_string(gold_tmp) + msg += "PC picks up " + std::to_string(gold_tmp) +
" pieces of gold. "; " pieces of gold. ";
bool locked = false; bool locked = false;
@ -163,7 +163,7 @@ long_result player_base::throw_potion(level *lvl, std::unique_ptr<potion> p,
size_t flag = lvl->what_is_at(tmp); size_t flag = lvl->what_is_at(tmp);
if (flag & WHAT_WALL) if (flag & WHAT_WALL)
return {THROWN, "The potion shattered against a wall. "}; return {THROWN, "The potion shatters against a wall. "};
else if (flag & WHAT_ENEMY) { else if (flag & WHAT_ENEMY) {
std::string name{p->get_name()}; std::string name{p->get_name()};
character *ch = lvl->get_elist()[flag ^ WHAT_ENEMY]; character *ch = lvl->get_elist()[flag ^ WHAT_ENEMY];
@ -172,15 +172,15 @@ long_result player_base::throw_potion(level *lvl, std::unique_ptr<potion> p,
if (ch->get_race() != BABY_DRAGON) if (ch->get_race() != BABY_DRAGON)
return {THROWN, "The potion of " + name + return {THROWN, "The potion of " + name +
"'s contents spilled on " + "'s contents spills on " +
ch->get_abbrev() + ". "}; ch->get_abbrev() + ". "};
return {THROWN, "The potion of " + name + return {THROWN, "The potion of " + name +
" didn't seem to affect B. "}; " doesn't seem to affect B. "};
} }
} }
return {THROWN, "The potion shattered against the floor. "}; return {THROWN, "The potion shatters against the floor. "};
} }
long_result player_base::interpret_command(level *lvl, game_command cmd) { long_result player_base::interpret_command(level *lvl, game_command cmd) {
@ -222,7 +222,7 @@ long_result player_base::interpret_command(level *lvl, game_command cmd) {
if (idx != lvl->get_plist().size() && if (idx != lvl->get_plist().size() &&
inv.owns.size() < INV_MAX_CNT) { inv.owns.size() < INV_MAX_CNT) {
inv.insert(lvl->detach_potion(idx)); inv.insert(lvl->detach_potion(idx));
res.msg += "PC picked up a potion. "; res.msg += "PC picks up a potion. ";
} else if (idx != lvl->get_plist().size()) { } else if (idx != lvl->get_plist().size()) {
res.msg += "PC already has a full knapsack. "; res.msg += "PC already has a full knapsack. ";
} }
@ -262,21 +262,21 @@ long_result player_base::interpret_command(level *lvl, game_command cmd) {
} else if (cmd == UP_STAIRS) { } else if (cmd == UP_STAIRS) {
if (lvl->get_up_stairs() == pos && if (lvl->get_up_stairs() == pos &&
enabled_features & FEATURE_REVISIT) enabled_features & FEATURE_REVISIT)
return {GO_UP, "PC went up the stairs. "}; return {GO_UP, "PC goes up the stairs. "};
return {result::NOTHING, return {result::NOTHING,
"PC tried to fly through the ceiling. "}; "PC tried to fly through the ceiling. "};
} else if (cmd == DOWN_STAIRS) { } else if (cmd == DOWN_STAIRS) {
if (lvl->get_down_stairs() == pos) if (lvl->get_down_stairs() == pos)
return {GO_DOWN, "PC went down the stairs. "}; return {GO_DOWN, "PC goes down the stairs. "};
return {result::NOTHING, return {result::NOTHING,
"PC tried to dig through the floor. "}; "PC tried to dig through the floor. "};
} else if (cmd == THE_WORLD) { } else if (cmd == THE_WORLD) {
return {TOGGLE_THE_WORLD, "PC toggled Stand: The World! "}; return {TOGGLE_THE_WORLD, "PC toggles Stand: The World! "};
} else if (cmd == STAR_PLATINUM) { } else if (cmd == STAR_PLATINUM) {
return {TOGGLE_STAR_PLATINUM, return {TOGGLE_STAR_PLATINUM,
"PC toggled Stand: Star Platinum: The World! "}; "PC toggles Stand: Star Platinum: The World! "};
} else if (cmd == GAME_RESTART) { } else if (cmd == GAME_RESTART) {
return {RESTART_GAME, ""}; return {RESTART_GAME, ""};
} else if (cmd == GAME_COMMAND_PASS) { } else if (cmd == GAME_COMMAND_PASS) {

125
src/playground.txt Normal file
View File

@ -0,0 +1,125 @@
|-----------------------------------------------------------------------------|
| |
| |--------------------------| |-----------------------| |
| |.......@..................| |.......................| |
| |..........................+########+..6789D.....678.9D.....| |
| |..012345...012345.........| # |.......................+####### |
| |..........................| # |.......................| # |
| |----------+---------------| # |----+------------------| # |
| # ############# # |
| # # |-----+------| |--------+------| |
| # # |............| |...............| |
| ################### |....\.......+#########+.........M.....| |
| # # |............| # |...............| |
| # # |-----+------| # |--------+------| |
| |---------+-----------| # # # # |
| |..........H..........| # # # |----+------| |
| |.....................+############################# |...........| |
| |---------+-----------| # # |...........| |
| # # |------+-| |---------| |...........| |
| |---------+-----------| # |........| |...E.....|######|....O......| |
| |........W............+##########+..H.....+#+.........+# #+...........| |
| |.....................| |........| |.........| |...........| |
| |---------------------| |--------| |---------| |-----------| |
| |
|-----------------------------------------------------------------------------|
|-----------------------------------------------------------------------------|
| |
| |--------------------------| |-----------------------| |
| |..........................| |.......................| |
| |..........................+########+.......................| |
| |..........................| # |......................@+####### |
| |..........................| # |.......................| # |
| |----------+---------------| # |----+------------------| # |
| # ############# # |
| # # |-----+------| |--------+------| |
| # # |............| |...............| |
| ########################+....\.......+#########+...............| |
| # # |............| # |...............| |
| # # |-----+------| # |--------+------| |
| |---------+-----------| # # # # |
| |.....................| # # # |----+------| |
| |.....................+############################# |...........| |
| |---------+-----------| # # |...........| |
| # # |------+-| |---------| |...........| |
| |---------+-----------| # |........| |.........|######|...........| |
| |.....................+##########+........+#+.........+# #+...........| |
| |.....................| |........| |.........| |...........| |
| |---------------------| |--------| |---------| |-----------| |
| |
|-----------------------------------------------------------------------------|
|-----------------------------------------------------------------------------|
| |
| |--------------------------| |-----------------------| |
| |..........................| |.......................| |
| |..........................+########+..6789D.....678.9D.....| |
| |..012345...012345.........| # |......................@+####### |
| |..........................| # |.......................| # |
| |----------+---------------| # |----+------------------| # |
| # ############# # |
| # # |-----+------| |--------+------| |
| # # |............| |...............| |
| ########################+....\.......+#########+.........M.....| |
| # # |............| # |...............| |
| # # |-----+------| # |--------+------| |
| |---------+-----------| # # # # |
| |..........H..........| # # # |----+------| |
| |.....................+############################# |...........| |
| |---------+-----------| # # |...........| |
| # # |------+-| |---------| |...........| |
| |---------+-----------| # |........| |...E.....|######|....O......| |
| |........W............+##########+..H.....+#+.........+# #+...........| |
| |.....................| |........| |.........| |...........| |
| |---------------------| |--------| |---------| |-----------| |
| |
|-----------------------------------------------------------------------------|
|-----------------------------------------------------------------------------|
| |
| |--------------------------| |-----------------------| |
| |..........................| |.......................| |
| |..........................+########+..6789D.....678.9D.....| |
| |..012345...012345.........| # |......................@+####### |
| |..........................| # |.......................| # |
| |----------+---------------| # |----+------------------| # |
| # ############# # |
| # # |-----+------| |--------+------| |
| # # |............| |...............| |
| ########################+....\.......+#########+.........M.....| |
| # # |............| # |...............| |
| # # |-----+------| # |--------+------| |
| |---------+-----------| # # # # |
| |..........H..........| # # # |----+------| |
| |.....................+############################# |...........| |
| |---------+-----------| # # |...........| |
| # # |------+-| |---------| |...........| |
| |---------+-----------| # |........| |...E.....|######|....O......| |
| |........W............+##########+..H.....+#+.........+# #+...........| |
| |.....................| |........| |.........| |...........| |
| |---------------------| |--------| |---------| |-----------| |
| |
|-----------------------------------------------------------------------------|
|-----------------------------------------------------------------------------|
| |
| |--------------------------| |-----------------------| |
| |..........................| |.......................| |
| |..........................+########+..6789D.....678.9D.....| |
| |..012345...012345.........| # |......................@+####### |
| |..........................| # |.......................| # |
| |----------+---------------| # |----+------------------| # |
| # ############# # |
| # # |-----+------| |--------+------| |
| # # |............| |...............| |
| ########################+....\.......+#########+.........M.....| |
| # # |............| # |...............| |
| # # |-----+------| # |--------+------| |
| |---------+-----------| # # # # |
| |..........H..........| # # # |----+------| |
| |.....................+############################# |...........| |
| |---------+-----------| # # |...........| |
| # # |------+-| |---------| |...........| |
| |---------+-----------| # |........| |...E.....|######|....O......| |
| |........W............+##########+..H.....+#+.........+# #+...........| |
| |.....................| |........| |.........| |...........| |
| |---------------------| |--------| |---------| |-----------| |
| |
|-----------------------------------------------------------------------------|

View File

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

View File

@ -1,7 +1,7 @@
#ifndef __POISON_HEALTH_H__ #ifndef __POISON_HEALTH_H__
#define __POISON_HEALTH_H__ #define __POISON_HEALTH_H__
#include "../potion.h" #include "potion.h"
class poison_health final: public potion { class poison_health final: public potion {
static const int LOSE_HEALTH = 10; static const int LOSE_HEALTH = 10;

View File

@ -1,20 +1,20 @@
#include "potions.h" #include "potions.h"
#include "constants.h" #include "constants.h"
#include "potions/restore_health.h" #include "restore_health.h"
#include "potions/boost_atk.h" #include "boost_atk.h"
#include "potions/boost_def.h" #include "boost_def.h"
#include "potions/poison_health.h" #include "poison_health.h"
#include "potions/wound_atk.h" #include "wound_atk.h"
#include "potions/wound_def.h" #include "wound_def.h"
#include "potions/continuous_restoration.h" #include "continuous_restoration.h"
#include "potions/savage_strike.h" #include "savage_strike.h"
#include "potions/echoing_resilience.h" #include "echoing_resilience.h"
#include "potions/tempest_tantrum.h" #include "tempest_tantrum.h"
#include "potions/bezerk_brew.h" #include "berzerk_brew.h"
#include "potions/borrow_life.h" #include "borrow_life.h"
#include "potions/fine_booze.h" #include "fine_booze.h"
#include "potions/ironclad_ward.h" #include "ironclad_ward.h"
std::unique_ptr<potion> new_potion(potion_type type, const position &pos) { std::unique_ptr<potion> new_potion(potion_type type, const position &pos) {
switch (type) { switch (type) {
@ -48,8 +48,8 @@ std::unique_ptr<potion> new_potion(potion_type type, const position &pos) {
case TEMPEST_TANTRUM: case TEMPEST_TANTRUM:
return std::make_unique<tempest_tantrum>(pos); return std::make_unique<tempest_tantrum>(pos);
case BEZERK_BREW: case BERZERK_BREW:
return std::make_unique<bezerk_brew>(pos); return std::make_unique<berzerk_brew>(pos);
case BORROW_LIFE: case BORROW_LIFE:
return std::make_unique<borrow_life>(pos); return std::make_unique<borrow_life>(pos);

View File

@ -1,24 +0,0 @@
#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 == DROW ? DROW_POTION_MUL : 1);
DEF *= DEF_MUL * (race == DROW ? DROW_POTION_MUL : 1);
--remaining_duration;
}
}
int bezerk_brew::get_priority() const {
return CALC_MID;
}
const char *bezerk_brew::get_name() const {
return "BB";
}

View File

@ -1,7 +1,7 @@
#include "restore_health.h" #include "restore_health.h"
#include <algorithm> #include <algorithm>
#include "../constants.h" #include "constants.h"
restore_health::restore_health(const position &pos): restore_health::restore_health(const position &pos):
potion{potion_type::RESTORE_HEALTH, 1, pos} {} potion{potion_type::RESTORE_HEALTH, 1, pos} {}

View File

@ -1,7 +1,7 @@
#ifndef __RESTORE_HEALTH_H__ #ifndef __RESTORE_HEALTH_H__
#define __RESTORE_HEALTH_H__ #define __RESTORE_HEALTH_H__
#include "../potion.h" #include "potion.h"
class restore_health final: public potion { class restore_health final: public potion {
static const int GAIN_HEALTH = 10; static const int GAIN_HEALTH = 10;

View File

@ -88,7 +88,7 @@ const char *LOSE_SCREEN =
| | | \\. _|_. | . || |\ | | | \\. _|_. | . || |\
| | || |\ | | || |\
| * | * ** * ** |** ** |\ | * | * ** * ** |** ** |\
| \\))...../.,(//,,..,,\\||(,,.,\\\\,.((// |\ | \\))....,(//,,..,,\\||(,,.,\\\\,.((// |\
| |\ | |\
| Loser! |\ | Loser! |\
| |\ | |\

View File

@ -1,7 +1,7 @@
#include "savage_strike.h" #include "savage_strike.h"
#include <algorithm> #include <algorithm>
#include "../constants.h" #include "constants.h"
savage_strike::savage_strike(const position &pos): savage_strike::savage_strike(const position &pos):
potion{potion_type::SAVAGE_STRIKE, DURATION, pos} {} potion{potion_type::SAVAGE_STRIKE, DURATION, pos} {}

View File

@ -1,7 +1,7 @@
#ifndef __SAVAGE_STRIKE_H__ #ifndef __SAVAGE_STRIKE_H__
#define __SAVAGE_STRIKE_H__ #define __SAVAGE_STRIKE_H__
#include "../potion.h" #include "potion.h"
class savage_strike final: public potion { class savage_strike final: public potion {
inline static const float ATK_MUL = 1.25f; inline static const float ATK_MUL = 1.25f;

View File

@ -1,6 +1,6 @@
#include "shade.h" #include "shade.h"
#include "../constants.h" #include "constants.h"
shade::shade(RNG *rng, const feature enabled_features): shade::shade(RNG *rng, const feature enabled_features):
player_base{rng, enabled_features, race::SHADE} {} player_base{rng, enabled_features, race::SHADE} {}

View File

@ -1,7 +1,7 @@
#ifndef __SHADE_H__ #ifndef __SHADE_H__
#define __SHADE_H__ #define __SHADE_H__
#include "../player.h" #include "player.h"
class shade final: public player_base { class shade final: public player_base {
public: public:

View File

@ -1,6 +1,6 @@
#include "swordsman.h" #include "swordsman.h"
#include "../constants.h" #include "constants.h"
swordsman::swordsman(RNG *rng, const feature enabled_features, swordsman::swordsman(RNG *rng, const feature enabled_features,
const position &pos, const position &pos,

View File

@ -1,7 +1,7 @@
#ifndef __SWORDSMAN_H__ #ifndef __SWORDSMAN_H__
#define __SWORDSMAN_H__ #define __SWORDSMAN_H__
#include "../enemy.h" #include "enemy.h"
class swordsman final: public enemy_base { class swordsman final: public enemy_base {
public: public:

View File

@ -1,6 +1,6 @@
#include "t_800.h" #include "t_800.h"
#include "../constants.h" #include "constants.h"
t_800::t_800(RNG *rng, const feature enabled_features): t_800::t_800(RNG *rng, const feature enabled_features):
player_base{rng, enabled_features, race::RT_800} {} player_base{rng, enabled_features, race::RT_800} {}

View File

@ -1,7 +1,7 @@
#ifndef __T_800_H__ #ifndef __T_800_H__
#define __T_800_H__ #define __T_800_H__
#include "../player.h" #include "player.h"
class potion; class potion;
class t_800 final: public player_base { class t_800 final: public player_base {

View File

@ -1,7 +1,7 @@
#include "tempest_tantrum.h" #include "tempest_tantrum.h"
#include <algorithm> #include <algorithm>
#include "../constants.h" #include "constants.h"
tempest_tantrum::tempest_tantrum(const position &pos): tempest_tantrum::tempest_tantrum(const position &pos):
potion{potion_type::TEMPEST_TANTRUM, DURATION, pos} {} potion{potion_type::TEMPEST_TANTRUM, DURATION, pos} {}

View File

@ -1,7 +1,7 @@
#ifndef __TEMPEST_TANTRUM_H__ #ifndef __TEMPEST_TANTRUM_H__
#define __TEMPEST_TANTRUM_H__ #define __TEMPEST_TANTRUM_H__
#include "../potion.h" #include "potion.h"
class tempest_tantrum final: public potion { class tempest_tantrum final: public potion {
static const int ATK_MUL = 3; static const int ATK_MUL = 3;

View File

@ -1,6 +1,6 @@
#include "troll.h" #include "troll.h"
#include "../constants.h" #include "constants.h"
troll::troll(RNG *rng, const feature enabled_features): troll::troll(RNG *rng, const feature enabled_features):
player_base{rng, enabled_features, TROLL} {} player_base{rng, enabled_features, TROLL} {}

View File

@ -1,7 +1,7 @@
#ifndef __TROLL_H__ #ifndef __TROLL_H__
#define __TROLL_H__ #define __TROLL_H__
#include "../player.h" #include "player.h"
class troll final: public player_base { class troll final: public player_base {
static const int GAIN_HP = 5; static const int GAIN_HP = 5;

View File

BIN
src/uml-final.pdf Normal file

Binary file not shown.

View File

@ -1,6 +1,6 @@
#include "vampire.h" #include "vampire.h"
#include "../constants.h" #include "constants.h"
vampire::vampire(RNG *rng, const feature enabled_features): vampire::vampire(RNG *rng, const feature enabled_features):
player_base{rng, enabled_features, race::VAMPIRE} {}; player_base{rng, enabled_features, race::VAMPIRE} {};

View File

@ -1,7 +1,7 @@
#ifndef __VAMPIRE_H__ #ifndef __VAMPIRE_H__
#define __VAMPIRE_H__ #define __VAMPIRE_H__
#include "../player.h" #include "player.h"
class vampire final: public player_base { class vampire final: public player_base {
static const int GAIN_HP = 5; static const int GAIN_HP = 5;

View File

@ -1,6 +1,6 @@
#include "viking.h" #include "viking.h"
#include "../constants.h" #include "constants.h"
viking::viking(RNG *rng, const feature enabled_features, const position &pos, viking::viking(RNG *rng, const feature enabled_features, const position &pos,
const int gen_room_num): const int gen_room_num):

View File

@ -1,7 +1,7 @@
#ifndef __VIKING_H__ #ifndef __VIKING_H__
#define __VIKING_H__ #define __VIKING_H__
#include "../enemy.h" #include "enemy.h"
class viking final: public enemy_base { class viking final: public enemy_base {
public: public:

View File

@ -1,30 +0,0 @@
t ea ea se se se ne ea ea ea ea ea ea ea no no no no
ea ea ea ea ea ea ea ea ea ea ea ea
no no no so so no no
a no a no a no a no a no a no a no a no
so so so no no no no ea ea ea ea
no no a se a se a se a se a se a se a se ea so
so so so so ea u ne ea ea ea ea ea u ea
ea ea ne
a so a so a so a so a so a so a so a so a so a so a so a so a so a so a so a so
se ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea se ea ea ea ea u ea
ne ne sw ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea
u sw we we we we we we we so we we we we we
a we a we we we we we we
a we a we a we a we a we a we a we a we a we ne
we we we we we we we we we we we we we we we we we we
no no no no no no we we we we we we we we we we we we we we we we
so so so
no no
we u we
ea so we we we we we we
no no no no no
ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea
no no no
so ea ea u ea ea a ea a ea a ea a ea a ea a ea a ea a ea a ea
so ea no
ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea ea
no no no no
ea ea ea ea ea ea ea ea ea ea ea ea
no no no
no so so no no we we

View File

@ -1,7 +1,7 @@
#include "witch.h" #include "witch.h"
#include "../constants.h" #include "constants.h"
#include "../player.h" #include "player.h"
witch::witch(RNG *rng, const feature enabled_features, const position &pos, witch::witch(RNG *rng, const feature enabled_features, const position &pos,
const int gen_room_num): const int gen_room_num):
@ -22,7 +22,7 @@ long_result witch::attack(character *ch) {
DEFAULT_POTION_TYPE_CNT)); DEFAULT_POTION_TYPE_CNT));
auto npotion = new_potion(type, {0, 0}); auto npotion = new_potion(type, {0, 0});
res.msg += std::string("Z's potion of ") + res.msg += std::string("Z's potion of ") +
npotion->get_name() + " spilled onto PC. "; npotion->get_name() + " spills onto PC. ";
static_cast<player_base *>(ch)->set_potion_known( static_cast<player_base *>(ch)->set_potion_known(
npotion->get_type()); npotion->get_type());
ch->apply_effect(std::move(npotion)); ch->apply_effect(std::move(npotion));

View File

@ -1,7 +1,7 @@
#ifndef __WITCH_H__ #ifndef __WITCH_H__
#define __WITCH_H__ #define __WITCH_H__
#include "../enemy.h" #include "enemy.h"
class witch final: public enemy_base { class witch final: public enemy_base {
inline static const fraction POTION_RATE = {1, 5}; inline static const fraction POTION_RATE = {1, 5};

Some files were not shown because too many files have changed in this diff Show More