Tell me which PC needs the reagent for spellcasting

This commit is contained in:
2025-03-17 13:07:48 -05:00
parent 13c50a25fd
commit d6521de826
4 changed files with 12 additions and 2 deletions

View File

@@ -1243,7 +1243,7 @@ void do_combat_cast(location target) {
if(stat_window == univ.cur_pc)
put_item_screen(stat_window);
do_mindduel(univ.cur_pc,cur_monst);
} else add_string_to_buf(" You need a smoky crystal. ");
} else add_pc_needs_to_buf("a smoky crystal");
}
store_sound = 24;
break;

View File

@@ -748,7 +748,7 @@ void do_mage_spell(short pc_num,eSpell spell_num,bool freebie) {
{
cInvenSlot item = univ.party[pc_num].has_abil(eItemAbil::SAPPHIRE);
if(!item && !freebie)
add_string_to_buf(" You need a sapphire.");
add_pc_needs_to_buf("a sapphire");
else if(univ.town->defy_scrying || univ.town->defy_mapping)
add_string_to_buf(" The spell fails.");
else {

View File

@@ -1064,6 +1064,15 @@ void add_string_to_buf(std::string str, unsigned short indent) {
}
void add_pc_needs_to_buf(std::string needs_what, unsigned short pre_indent, unsigned short indent) {
std::ostringstream sout;
for(int i = 0; i < pre_indent; ++i){
sout << ' ';
}
sout << univ.party[univ.cur_pc].name << " needs " << needs_what << ".";
add_string_to_buf(sout.str(), indent);
}
void init_buf() {
for(short i = 0; i < TEXT_BUF_LEN; i++)
sprintf((char *) text_buffer[buf_pointer].line, " ");

View File

@@ -31,6 +31,7 @@ void print_nums(short a,short b,short c);
short print_terrain(location space);
void add_string_to_buf(std::string str, unsigned short indent); // Set second parameter to nonzero to auto-split the line if it's too long
void add_string_to_buf(std::string str);
void add_pc_needs_to_buf(std::string needs_what, unsigned short pre_indent = 2, unsigned short indent = 4);
void init_buf();
void print_buf () ;
void restart_printing();