Several little tweaks.

- Unify PC start adjustments into the cPlayer class; add start items for vahnatai race
- Allow healing missiles to heal PCs
- Fix display of spell names in the spellcasting dialog
- Expand list of statuses that affect_pc allows to be negative
This commit is contained in:
2015-01-12 01:10:12 -05:00
parent 908652d168
commit ac7a1c1d88
6 changed files with 74 additions and 49 deletions

View File

@@ -62,7 +62,6 @@ extern bool flushingInput;
bool ghost_mode;
rectangle startup_top;
cItem start_items[6] = {cItem('nife'),cItem('buck'),cItem('bow '),cItem('arrw'),cItem('pole'),cItem('helm')};
bool item_area_button_active[8][6];
bool pc_area_button_active[6][5];
short item_bottom_button_active[9] = {0,0,0,0,0, 0,1,1,1};
@@ -2611,28 +2610,11 @@ void start_new_game() {
// everyone gets a weapon
for(i = 0; i < 6; i++)
for(i = 0; i < 6; i++) {
if(univ.party[i].main_status == eMainStatus::ALIVE) {
int raceCode = (int) univ.party[i].race;
univ.party[i].items[0] = start_items[raceCode * 2];
univ.party[i].equip[0] = true;
univ.party[i].items[1] = start_items[raceCode * 2 + 1];
univ.party[i].equip[1] = true;
}
// PCs get adjustments
for(i = 0; i < 6; i++)
if(univ.party[i].main_status == eMainStatus::ALIVE) {
// Do stat adjs for selected race.
if(univ.party[i].race == eRace::NEPHIL)
univ.party[i].skills[eSkill::DEXTERITY] += 2;
if(univ.party[i].race == eRace::SLITH) {
univ.party[i].skills[eSkill::STRENGTH] += 2;
univ.party[i].skills[eSkill::INTELLIGENCE] += 1;
}
// TODO: Vahnatai
univ.party[i].max_sp += univ.party[i].skills[eSkill::MAGE_SPELLS] * 3 + univ.party[i].skills[eSkill::PRIEST_SPELLS] * 3;
univ.party[i].cur_sp = univ.party[i].max_sp;
univ.party[i].finish_create();
}
}
fs::path file = nav_put_party();
if(!file.empty()) save_party(file, univ);
party_in_memory = true;

View File

@@ -1543,10 +1543,10 @@ void fire_missile(location target) {
poison_monst(cur_monst,poison_amt);
}
}
// else if((targ_monst = pc_there(target)) < 6 && univ.party[current_pc].items[ammo_inv_slot].ability == 176){
// ASB(" There is a flash of light.");
// heal_pc(targ_monst,r2);
// }
else if((targ_monst = pc_there(target)) < 6 && univ.party[current_pc].items[ammo_inv_slot].ability == eItemAbil::MISSILE_HEAL_TARGET){
ASB(" There is a flash of light.");
heal_pc(targ_monst,r2);
}
else hit_space(target,r2,DAMAGE_WEAPON,1,0);
}

View File

@@ -49,7 +49,6 @@ short who_cast,which_pc_displayed;
eSpell town_spell;
extern bool spell_freebie;
bool spell_button_active[90];
extern cItem start_items[6];
extern short fast_bang;
extern bool flushingInput;
@@ -323,24 +322,8 @@ bool create_pc(short spot,cDialog* parent) {
univ.party[spot].main_status = eMainStatus::ALIVE;
if(overall_mode != MODE_STARTUP) {
// TODO: start_items will need to be extended for Vahnatai race
int raceCode = (int) univ.party[spot].race;
univ.party[spot].items[0] = start_items[raceCode * 2];
univ.party[spot].equip[0] = true;
univ.party[spot].items[1] = start_items[raceCode * 2 + 1];
univ.party[spot].equip[1] = true;
// Do stat adjs for selected race.
if(univ.party[spot].race == eRace::NEPHIL)
univ.party[spot].skills[eSkill::DEXTERITY] += 2;
if(univ.party[spot].race == eRace::SLITH) {
univ.party[spot].skills[eSkill::STRENGTH] += 2;
univ.party[spot].skills[eSkill::INTELLIGENCE] += 1;
}
// TODO: Vahnatai
// TODO: Why is this code in two different places?
univ.party[spot].max_sp += univ.party[spot].skills[eSkill::MAGE_SPELLS] * 3 + univ.party[spot].skills[eSkill::PRIEST_SPELLS] * 3;
univ.party[spot].cur_sp = univ.party[spot].max_sp;
// TODO: Why only when not in MODE_STARTUP?
univ.party[spot].finish_create();
}
return true;
@@ -1939,9 +1922,7 @@ static void put_spell_led_buttons(cDialog& me, const eSkill store_situation,cons
}
static void put_spell_list(cDialog& me, const eSkill store_situation) {
short i;
std::ostringstream name;
if(on_which_spell_page == 0) {
me["col1"].setText("Level 1:");
@@ -1949,6 +1930,7 @@ static void put_spell_list(cDialog& me, const eSkill store_situation) {
me["col3"].setText("Level 3:");
me["col4"].setText("Level 4:");
for(i = 0; i < 38; i++) {
std::ostringstream name;
std::string id = "spell" + boost::lexical_cast<std::string>(i + 1);
name << get_str("magic-names", i + (store_situation == eSkill::MAGE_SPELLS ? 1 : 101));
name << " (";
@@ -1967,6 +1949,7 @@ static void put_spell_list(cDialog& me, const eSkill store_situation) {
me["col3"].setText("Level 7:");
me["col4"].setText("");
for(i = 0; i < 38; i++) {
std::ostringstream name;
std::string id = "spell" + boost::lexical_cast<std::string>(i + 1);
if(spell_index[i] < 90) {
name << get_str("magic-names", spell_index[i] + (store_situation == eSkill::MAGE_SPELLS ? 1 : 101));
@@ -2553,13 +2536,20 @@ void poison_party(short how_much) {
}
//type; // which status to affect
void affect_pc(short which_pc,eStatus type,short how_much) {
static const std::set<eStatus> allow_negative = {
// The obvious ones:
eStatus::BLESS_CURSE, eStatus::HASTE_SLOW,
// The ones that BoE previously allowed:
eStatus::POISONED_WEAPON, eStatus::POISON, eStatus::ASLEEP,
// (Note: Negative levels of sleep can be obtained from the Hyperactivity spell. The other two never go negative.)
// The additional ones that make sense in the negative:
eStatus::MAGIC_RESISTANCE, eStatus::DUMB,
};
if(univ.party[which_pc].main_status != eMainStatus::ALIVE)
return;
univ.party[which_pc].status[type] = minmax (-8,8,univ.party[which_pc].status[type] + how_much);
// TODO: Original code also allowed poisoned weapon, poison, and sleep to be negative; should this be restored?
// TODO: For certain other status effects it could make sense to allow negatives, eg magic resistance or dumbfounded
if(type != eStatus::BLESS_CURSE && type != eStatus::HASTE_SLOW)
if(!allow_negative.count(type))
univ.party[which_pc].status[type] = max(univ.party[which_pc].status[type],0);
put_pc_screen();
}

View File

@@ -174,6 +174,22 @@ cItem::cItem(long preset){
name = "Helm";
ident = true;
break;
case 'rdsk':
variety = eItemType::THROWN_MISSILE;
item_level = 9;
awkward = 0;
bonus = 1;
protection = 0;
charges = 8;
weap_type = eSkill::INVALID;
magic_use_type = 0;
graphic_num = 59;
value = 10;
weight = 1;
full_name = "Iron Razordisks";
name = "Razordisks";
ident = true;
break;
case 'food':
variety = eItemType::FOOD;
item_level = 0;

View File

@@ -75,6 +75,41 @@ short cPlayer::get_tnl(){
return tnl;
}
void cPlayer::finish_create() {
// Start items
switch(race) {
case eRace::HUMAN:
items[0] = cItem('nife');
items[1] = cItem('buck');
break;
case eRace::NEPHIL:
items[0] = cItem('bow ');
items[1] = cItem('arrw');
break;
case eRace::SLITH:
items[0] = cItem('pole');
items[1] = cItem('helm');
break;
case eRace::VAHNATAI:
items[0] = cItem('nife');
items[1] = cItem('rdsk');
break;
}
equip[0] = true;
equip[1] = true;
// Racial stat adjustments
if(race == eRace::NEPHIL)
skills[eSkill::DEXTERITY] += 2;
if(race == eRace::SLITH) {
skills[eSkill::STRENGTH] += 2;
skills[eSkill::INTELLIGENCE] += 1;
}
// TODO: Vahnatai
// Bonus spell points for spellcasters
max_sp += skills[eSkill::MAGE_SPELLS] * 3 + skills[eSkill::PRIEST_SPELLS] * 3;
cur_sp = max_sp;
}
cPlayer::cPlayer(){
short i;
main_status = eMainStatus::ABSENT;

View File

@@ -48,6 +48,8 @@ public:
location combat_pos;
short marked_damage, dir, parry, last_attacked;
void finish_create();
void append(legacy::pc_record_type old);
cPlayer();
cPlayer(long key,short slot);