diff options
Diffstat (limited to 'src/q_bounty.cc')
-rw-r--r-- | src/q_bounty.cc | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/src/q_bounty.cc b/src/q_bounty.cc index bb84d48d..f0a431de 100644 --- a/src/q_bounty.cc +++ b/src/q_bounty.cc @@ -1,7 +1,10 @@ #include "q_bounty.hpp" +#include "game.hpp" #include "monster2.hpp" #include "monster_race.hpp" +#include "monster_race_flag.hpp" +#include "monster_spell_flag.hpp" #include "object1.hpp" #include "object2.hpp" #include "object_type.hpp" @@ -11,38 +14,42 @@ #include "util.hpp" #include "variable.hpp" +#include <fmt/format.h> + #define cquest (quest[QUEST_BOUNTY]) #define bounty_quest_monster (cquest.data[0]) static bool_ lua_mon_hook_bounty(int r_idx) { - monster_race* r_ptr = &r_info[r_idx]; + auto const &r_info = game->edit_data.r_info; + + auto r_ptr = &r_info[r_idx]; /* Reject uniques */ - if (r_ptr->flags1 & RF1_UNIQUE) return (FALSE); + if (r_ptr->flags & RF_UNIQUE) return (FALSE); /* Reject those who cannot leave anything */ - if (!(r_ptr->flags9 & RF9_DROP_CORPSE)) return (FALSE); + if (!(r_ptr->flags & RF_DROP_CORPSE)) return (FALSE); /* Accept only monsters that can be generated */ - if (r_ptr->flags9 & RF9_SPECIAL_GENE) return (FALSE); - if (r_ptr->flags9 & RF9_NEVER_GENE) return (FALSE); + if (r_ptr->flags & RF_SPECIAL_GENE) return (FALSE); + if (r_ptr->flags & RF_NEVER_GENE) return (FALSE); /* Reject pets */ - if (r_ptr->flags7 & RF7_PET) return (FALSE); + if (r_ptr->flags & RF_PET) return (FALSE); /* Reject friendly creatures */ - if (r_ptr->flags7 & RF7_FRIENDLY) return (FALSE); + if (r_ptr->flags & RF_FRIENDLY) return (FALSE); /* Accept only monsters that are not breeders */ - if (r_ptr->flags4 & RF4_MULTIPLY) return (FALSE); + if (r_ptr->spells & SF_MULTIPLY) return (FALSE); /* Forbid joke monsters */ - if (r_ptr->flags8 & RF8_JOKEANGBAND) return (FALSE); + if (r_ptr->flags & RF_JOKEANGBAND) return (FALSE); /* Accept only monsters that are not good */ - if (r_ptr->flags3 & RF3_GOOD) return (FALSE); + if (r_ptr->flags & RF_GOOD) return (FALSE); /* The rest are acceptable */ return (TRUE); @@ -74,9 +81,9 @@ static bool bounty_item_tester_hook(object_type const *o_ptr) return ((o_ptr->tval == TV_CORPSE) && (o_ptr->pval2 == bounty_quest_monster)); } -bool_ quest_bounty_init_hook(int dummy) +void quest_bounty_init_hook() { - return FALSE; + // Initialized by building action } bool_ quest_bounty_drop_item() @@ -104,6 +111,8 @@ bool_ quest_bounty_drop_item() bool_ quest_bounty_get_item() { + auto &s_info = game->s_info; + if (cquest.status != QUEST_STATUS_TAKEN) { msg_print("You do not have any bounty quest yet."); @@ -132,16 +141,19 @@ bool_ quest_bounty_get_item() skill_type *lore = &s_info[SKILL_LORE]; skill_type *preservation = &s_info[SKILL_PRESERVATION]; - if (lore->mod == 0) { + if (lore->mod == 0) + { lore->mod = 900; - lore->dev = TRUE; + lore->dev = true; } + lore->value += lore->mod; - if (preservation->mod == 0) { + if (preservation->mod == 0) + { preservation->value = 800; preservation->mod = 800; - preservation->dev = TRUE; + preservation->dev = true; msg_print("I see you don't know the corpse preservation skill, I shall teach you it too."); } @@ -151,20 +163,18 @@ bool_ quest_bounty_get_item() return FALSE; } -bool_ quest_bounty_describe(FILE *fff) +std::string quest_bounty_describe() { char mdesc[512]; + fmt::MemoryWriter w; if (cquest.status == QUEST_STATUS_TAKEN) { monster_race_desc(mdesc, bounty_quest_monster, 0); - fprintf(fff, "#####yBounty quest!\n"); - fprintf(fff, "You must bring back %s corpse to the beastmaster.\n", mdesc); - fprintf(fff, "\n"); - - return TRUE; + w.write("#####yBounty quest!\n"); + w.write("You must bring back {} corpse to the beastmaster.", mdesc); } - return FALSE; + return w.str(); } |