throwing potions now identifies it
This commit is contained in:
@ -288,7 +288,7 @@ const char *ENEMIES_LIST = "\
|
|||||||
If PC doesn't have enough gold, hit instead with a strong attack of fixed Atk;\n\
|
If PC doesn't have enough gold, hit instead with a strong attack of fixed Atk;\n\
|
||||||
Upon death, drops all stolen gold plus 5 extra.\n\n\
|
Upon death, drops all stolen gold plus 5 extra.\n\n\
|
||||||
- Witch 'Z' (100 HP, 20 Atk, 15 Def, 1/2 Hit Rate):\n\
|
- Witch 'Z' (100 HP, 20 Atk, 15 Def, 1/2 Hit Rate):\n\
|
||||||
Upon a successful hit, has a 1/5 chance of applying a random potion onto PC.\n\n\
|
Upon a successful hit, has a 1/5 chance of applying a random potion onto PC (starts to take effect the next turn).\n\n\
|
||||||
- Hacker 'h' (90 HP, 15 Atk, 30 Def, 1/2 Hit Rate):\n\
|
- Hacker 'h' (90 HP, 15 Atk, 30 Def, 1/2 Hit Rate):\n\
|
||||||
He has been in grinding in MC for too long.\n\n\
|
He has been in grinding in MC for too long.\n\n\
|
||||||
- Baby Dragon 'B' (140 HP, 20 Atk, 40 Def, 1/3 Hit Rate):\n\
|
- Baby Dragon 'B' (140 HP, 20 Atk, 40 Def, 1/3 Hit Rate):\n\
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "witch.h"
|
#include "witch.h"
|
||||||
|
|
||||||
#include "../constants.h"
|
#include "../constants.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,6 +23,8 @@ long_result witch::attack(character *ch) {
|
|||||||
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() + " spilled onto PC. ";
|
||||||
|
static_cast<player_base *>(ch)->set_potion_known(
|
||||||
|
npotion->get_type());
|
||||||
ch->apply_effect(std::move(npotion));
|
ch->apply_effect(std::move(npotion));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,9 +141,12 @@ long_result player_base::throw_potion(level *lvl, std::unique_ptr<potion> p,
|
|||||||
if (flag & WHAT_WALL)
|
if (flag & WHAT_WALL)
|
||||||
return {THROWN, "The potion shattered against a wall. "};
|
return {THROWN, "The potion shattered against a wall. "};
|
||||||
else if (flag & WHAT_ENEMY) {
|
else if (flag & WHAT_ENEMY) {
|
||||||
|
std::string name{p->get_name()};
|
||||||
character *ch = lvl->get_elist()[flag ^ WHAT_ENEMY];
|
character *ch = lvl->get_elist()[flag ^ WHAT_ENEMY];
|
||||||
|
known_potions |= 1 << p->get_type();
|
||||||
ch->apply_effect(std::move(p));
|
ch->apply_effect(std::move(p));
|
||||||
return {THROWN, "The potion's contents spilled on " +
|
return {THROWN, "The potion of " + name +
|
||||||
|
"'s contents spilled on " +
|
||||||
ch->get_abbrev() + ". "};
|
ch->get_abbrev() + ". "};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,9 @@ protected:
|
|||||||
|
|
||||||
inventory inv;
|
inventory inv;
|
||||||
int MAX_THROW_DIST;
|
int MAX_THROW_DIST;
|
||||||
|
|
||||||
|
long_result throw_potion(level *lvl,
|
||||||
|
std::unique_ptr<potion> p, direction dir);
|
||||||
public:
|
public:
|
||||||
player_base(RNG *rng, const feature enabled_features,
|
player_base(RNG *rng, const feature enabled_features,
|
||||||
const enum race &nrace);
|
const enum race &nrace);
|
||||||
@ -59,9 +62,6 @@ public:
|
|||||||
int get_DEF() const;
|
int get_DEF() const;
|
||||||
int get_HP() const;
|
int get_HP() const;
|
||||||
|
|
||||||
long_result throw_potion(level *lvl,
|
|
||||||
std::unique_ptr<potion> p, direction dir);
|
|
||||||
|
|
||||||
void set_potion_known(const potion_type &type);
|
void set_potion_known(const potion_type &type);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user