Move creature text member functions into general file

- This finally fixes the PC editor build
This commit is contained in:
2015-02-02 12:44:39 -05:00
parent ea49a13ff8
commit 8d23bbc788
2 changed files with 235 additions and 227 deletions

View File

@@ -874,17 +874,6 @@ void print_monst_name(mon_num_t m_type) {
add_string_to_buf((char *) msg.c_str());
}
void cCreature::print_attacks(iLiving* target) {
std::string msg = m_name;
msg += " attacks ";
if(cPlayer* who = dynamic_cast<cPlayer*>(target))
msg += who->name;
else if(cCreature* monst = dynamic_cast<cCreature*>(target))
msg += monst->m_name;
else msg += "you";
add_string_to_buf(msg);
}
void damaged_message(short damage,eMonstMelee type) {
std::ostringstream sout;
sout << " " << get_str("monster-abilities",130 + int(type));
@@ -900,222 +889,6 @@ std::string print_monster_going(mon_num_t m_num,short ap) {
return sout.str();
}
void cCreature::spell_note(int which_mess) {
std::string msg = m_name;
switch(which_mess) {
case 1:
msg = " " + msg + " scared.";
break;
case 2:
msg = " " + msg + " slowed.";
break;
case 3:
msg = " " + msg + " weakened.";
break;
case 4:
msg = " " + msg + " poisoned.";
break;
case 5:
msg = " " + msg + " cursed.";
break;
case 6:
msg = " " + msg + " ravaged.";
break;
case 7:
msg = " " + msg + " undamaged.";
break;
case 8:
msg = " " + msg + " is stoned.";
break;
case 9:
msg = " Gazes at " + msg + '.';
break;
case 10:
msg = " " + msg + " resists.";
break;
case 11:
msg = " Drains " + msg + '.';
break;
case 12:
msg = " Shoots at " + msg + '.';
break;
case 13:
msg = " Throws spear at " + msg + '.';
break;
case 14:
msg = " Throws rock at " + msg + '.';
break;
case 15:
msg = " Throws razordisk at " + msg + '.';
break;
case 16:
msg = " Hits " + msg + '.';
break;
case 17:
msg = " " + msg + " disappears.";
break;
case 18:
msg = " Misses " + msg + '.';
break;
case 19:
msg = " " + msg + " is webbed.";
break;
case 20:
msg = " " + msg + " chokes.";
break;
case 21:
msg = " " + msg + " summoned.";
break;
case 22:
msg = " " + msg + " is dumbfounded.";
break;
case 23:
msg = " " + msg + " is charmed.";
break;
case 24:
msg = " " + msg + " is recorded.";
break;
case 25:
msg = " " + msg + " is diseased.";
break;
case 26:
msg = " " + msg + " is an avatar!";
break;
case 27:
msg = " " + msg + " splits!";
break;
case 28:
msg = " " + msg + " falls asleep.";
break;
case 29:
msg = " " + msg + " wakes up.";
break;
case 30:
msg = " " + msg + " paralyzed.";
break;
case 31:
msg = " " + msg + " covered with acid.";
break;
case 32:
msg = " Fires spines at " + msg + '.';
break;
case 33:
msg = " " + msg + " summons aid.";
break;
case 34:
msg = " " + msg + " is cured.";
break;
case 35:
msg = " " + msg + " is hasted.";
break;
case 36:
msg = " " + msg + " is blessed.";
break;
case 37:
msg = " " + msg + " cleans webs.";
break;
case 38:
msg = " " + msg + " feels better.";
break;
case 39:
msg = " " + msg + " mind cleared.";
break;
case 40:
msg = " " + msg + " feels alert.";
break;
case 41:
msg = " " + msg + " is healed.";
break;
case 42:
msg = " " + msg + " drained of health.";
break;
case 43:
msg = " " + msg + " magic recharged.";
break;
case 44:
msg = " " + msg + " drained of magic.";
break;
case 45:
msg = " " + msg + " returns to life!";
break;
case 46:
msg = " " + msg + " dies.";
break;
case 47:
msg = " " + msg + " rallies its courage.";
break;
case 48:
msg = " " + msg + " cleans off acid.";
break;
case 49:
msg = " " + msg + " breaks barrier.";
break;
case 50:
msg = " " + msg + " breaks force cage.";
break;
case 51:
msg = " " + msg + " is obliterated!";
break;
case 52:
msg = " " + msg + " is trapped!";
break;
case 53:
msg = " Throws dart at " + msg + '.';
break;
case 54:
msg = " Throws knife at " + msg + '.';
break;
case 55:
msg = " Fires ray at " + msg + '.';
break;
case 56:
msg = " Gazes at " + msg + '.';
break;
case 57:
msg = " Breathes on " + msg + '.';
break;
case 58:
msg = " Throws web at " + msg + '.';
break;
case 59:
msg = " Spits at " + msg + '.';
break;
default:
msg += ": Unknown action " + std::to_string(which_mess);
}
if(which_mess > 0)
add_string_to_buf((char *) msg.c_str());
}
void cCreature::cast_spell_note(eSpell spell) {
add_string_to_buf(m_name + " casts:");
add_string_to_buf(" " + (*spell).name());
}
void cCreature::breathe_note() {
add_string_to_buf(m_name + " breathes.");
}
void cCreature::damaged_msg(int how_much,int how_much_spec) {
std::ostringstream sout;
sout << " " << m_name << " takes " << how_much;
if(how_much_spec > 0)
sout << '+' << how_much_spec;
add_string_to_buf(sout.str());
}
void cCreature::killed_msg() {
add_string_to_buf(" " + m_name + " dies.");
}
void print_nums(short a,short b,short c) {
std::ostringstream sout;
sout << "debug: " << a << ' ' << b << ' ' << c;

View File

@@ -12,6 +12,8 @@
#include <sstream>
#include "oldstructs.h"
#include "mathutil.hpp"
#include "pc.h"
#include "spell.hpp"
const short cCreature::charm_odds[20] = {90,90,85,80,78, 75,73,60,40,30, 20,10,4,1,0, 0,0,0,0,0};
@@ -415,3 +417,236 @@ void cCreature::readFrom(std::istream& file) {
}
}
}
void cCreature::print_attacks(iLiving* target) {
if(!print_result) return;
std::string msg = m_name;
msg += " attacks ";
if(cPlayer* who = dynamic_cast<cPlayer*>(target))
msg += who->name;
else if(cCreature* monst = dynamic_cast<cCreature*>(target))
msg += monst->m_name;
else msg += "you";
print_result(msg);
}
void cCreature::spell_note(int which_mess) {
if(!print_result) return;
std::string msg = m_name;
switch(which_mess) {
case 1:
msg = " " + msg + " scared.";
break;
case 2:
msg = " " + msg + " slowed.";
break;
case 3:
msg = " " + msg + " weakened.";
break;
case 4:
msg = " " + msg + " poisoned.";
break;
case 5:
msg = " " + msg + " cursed.";
break;
case 6:
msg = " " + msg + " ravaged.";
break;
case 7:
msg = " " + msg + " undamaged.";
break;
case 8:
msg = " " + msg + " is stoned.";
break;
case 9:
msg = " Gazes at " + msg + '.';
break;
case 10:
msg = " " + msg + " resists.";
break;
case 11:
msg = " Drains " + msg + '.';
break;
case 12:
msg = " Shoots at " + msg + '.';
break;
case 13:
msg = " Throws spear at " + msg + '.';
break;
case 14:
msg = " Throws rock at " + msg + '.';
break;
case 15:
msg = " Throws razordisk at " + msg + '.';
break;
case 16:
msg = " Hits " + msg + '.';
break;
case 17:
msg = " " + msg + " disappears.";
break;
case 18:
msg = " Misses " + msg + '.';
break;
case 19:
msg = " " + msg + " is webbed.";
break;
case 20:
msg = " " + msg + " chokes.";
break;
case 21:
msg = " " + msg + " summoned.";
break;
case 22:
msg = " " + msg + " is dumbfounded.";
break;
case 23:
msg = " " + msg + " is charmed.";
break;
case 24:
msg = " " + msg + " is recorded.";
break;
case 25:
msg = " " + msg + " is diseased.";
break;
case 26:
msg = " " + msg + " is an avatar!";
break;
case 27:
msg = " " + msg + " splits!";
break;
case 28:
msg = " " + msg + " falls asleep.";
break;
case 29:
msg = " " + msg + " wakes up.";
break;
case 30:
msg = " " + msg + " paralyzed.";
break;
case 31:
msg = " " + msg + " covered with acid.";
break;
case 32:
msg = " Fires spines at " + msg + '.';
break;
case 33:
msg = " " + msg + " summons aid.";
break;
case 34:
msg = " " + msg + " is cured.";
break;
case 35:
msg = " " + msg + " is hasted.";
break;
case 36:
msg = " " + msg + " is blessed.";
break;
case 37:
msg = " " + msg + " cleans webs.";
break;
case 38:
msg = " " + msg + " feels better.";
break;
case 39:
msg = " " + msg + " mind cleared.";
break;
case 40:
msg = " " + msg + " feels alert.";
break;
case 41:
msg = " " + msg + " is healed.";
break;
case 42:
msg = " " + msg + " drained of health.";
break;
case 43:
msg = " " + msg + " magic recharged.";
break;
case 44:
msg = " " + msg + " drained of magic.";
break;
case 45:
msg = " " + msg + " returns to life!";
break;
case 46:
msg = " " + msg + " dies.";
break;
case 47:
msg = " " + msg + " rallies its courage.";
break;
case 48:
msg = " " + msg + " cleans off acid.";
break;
case 49:
msg = " " + msg + " breaks barrier.";
break;
case 50:
msg = " " + msg + " breaks force cage.";
break;
case 51:
msg = " " + msg + " is obliterated!";
break;
case 52:
msg = " " + msg + " is trapped!";
break;
case 53:
msg = " Throws dart at " + msg + '.';
break;
case 54:
msg = " Throws knife at " + msg + '.';
break;
case 55:
msg = " Fires ray at " + msg + '.';
break;
case 56:
msg = " Gazes at " + msg + '.';
break;
case 57:
msg = " Breathes on " + msg + '.';
break;
case 58:
msg = " Throws web at " + msg + '.';
break;
case 59:
msg = " Spits at " + msg + '.';
break;
default:
msg += ": Unknown action " + std::to_string(which_mess);
}
if(which_mess > 0)
print_result((char *) msg.c_str());
}
void cCreature::cast_spell_note(eSpell spell) {
if(!print_result) return;
print_result(m_name + " casts:");
print_result(" " + (*spell).name());
}
void cCreature::breathe_note() {
if(!print_result) return;
print_result(m_name + " breathes.");
}
void cCreature::damaged_msg(int how_much,int how_much_spec) {
if(!print_result) return;
std::ostringstream sout;
sout << " " << m_name << " takes " << how_much;
if(how_much_spec > 0)
sout << '+' << how_much_spec;
print_result(sout.str());
}
void cCreature::killed_msg() {
if(!print_result) return;
print_result(" " + m_name + " dies.");
}