Strictify race enum

- This incidentally fixes a lot of things that were broken in the previous commit due to the magic values changing
This commit is contained in:
2014-12-03 20:11:14 -05:00
parent 5b7649543f
commit 13116980fb
15 changed files with 196 additions and 173 deletions

View File

@@ -2547,21 +2547,23 @@ void start_new_game()
// everyone gets a weapon
for (i = 0; i < 6; i++)
if(univ.party[i].main_status == eMainStatus::ALIVE) {
univ.party[i].items[0] = start_items[univ.party[i].race * 2];
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[univ.party[i].race * 2 + 1];
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 == 1)
if (univ.party[i].race == eRace::NEPHIL)
univ.party[i].skills[1] += 2;
if (univ.party[i].race == 2) {
if (univ.party[i].race == eRace::SLITH) {
univ.party[i].skills[0] += 2;
univ.party[i].skills[2] += 1;
}
// TODO: Vahnatai
univ.party[i].max_sp += univ.party[i].skills[9] * 3 + univ.party[i].skills[10] * 3;
univ.party[i].cur_sp = univ.party[i].max_sp;
}

View File

@@ -658,7 +658,7 @@ void pc_attack(short who_att,short target)////
r1 += 25;
// race adj.
if ((univ.party[who_att].race == 2) && (univ.party[who_att].items[weap1].type == eWeapType::POLE))
if(univ.party[who_att].race == eRace::SLITH && univ.party[who_att].items[weap1].type == eWeapType::POLE)
r1 -= 10;
r2 = get_ran(1,1,univ.party[who_att].items[weap1].item_level) + dam_adj + 2 + univ.party[who_att].items[weap1].bonus;
@@ -790,7 +790,7 @@ void pc_attack(short who_att,short target)////
if (((univ.town.monst[target].status[10] > 0) || (univ.town.monst[target].spec_skill == 22))
&& (store_hp - univ.town.monst[target].health > 0)) {
add_string_to_buf(" Shares damage! ");
damage_pc(who_att, store_hp - univ.town.monst[target].health, DAMAGE_MAGIC,RACE_UNKNOWN,0);
damage_pc(who_att, store_hp - univ.town.monst[target].health, DAMAGE_MAGIC,eRace::UNKNOWN,0);
}
combat_posing_monster = current_working_monster = -1;
@@ -806,39 +806,39 @@ short calc_spec_dam(short abil,short abil_str,cCreature *monst) ////
store += get_ran(abil_str,1,6);
break;
case 2:
if (monst->m_type == 7)
if(monst->m_type == eRace::DEMON)
store += 8 * abil_str;
break;
case 175:
if (monst->m_type == 7)
if(monst->m_type == eRace::DEMON)
store += 25 + 8 * abil_str;
break;
case 174:
if (monst->m_type == 8)
if(monst->m_type == eRace::UNDEAD)
store += 20 + 6 * abil_str;
break;
case 3:
if (monst->m_type == 8)
if(monst->m_type == eRace::UNDEAD)
store += 6 * abil_str;
break;
case 4:
if (monst->m_type == 1)
if(monst->m_type == eRace::REPTILE)
store += 5 * abil_str;
break;
case 5:
if (monst->m_type == 9)
if(monst->m_type == eRace::GIANT)
store += 8 * abil_str;
break;
case 6:
if (monst->m_type == 4)
if(monst->m_type == eRace::MAGE)
store += 4 * abil_str;
break;
case 7:
if (monst->m_type == 5)
if(monst->m_type == eRace::PRIEST)
store += 4 * abil_str;
break;
case 8:
if (monst->m_type == 12)
if(monst->m_type == eRace::BUG)
store += 7 * abil_str;
break;
case 13:
@@ -1326,7 +1326,7 @@ void do_combat_cast(location target)////
break;
case 103: case 132:
if (cur_monst->m_type != 8) {
if (cur_monst->m_type != eRace::UNDEAD) {
add_string_to_buf(" Not undead. ");
store_m_type = -1;
break;
@@ -1343,7 +1343,7 @@ void do_combat_cast(location target)////
break;
case 155:
if (cur_monst->m_type != 7) {
if (cur_monst->m_type != eRace::DEMON) {
add_string_to_buf(" Not a demon. ");
store_m_type = -1;
break;
@@ -1398,7 +1398,7 @@ void handle_marked_damage()
for (i = 0; i < 6; i++)
if (pc_marked_damage[i] > 0)
{
damage_pc(i,pc_marked_damage[i],DAMAGE_MARKED,RACE_UNKNOWN,0);
damage_pc(i,pc_marked_damage[i],DAMAGE_MARKED,eRace::UNKNOWN,0);
pc_marked_damage[i] = 0;
}
for (i = 0; i < univ.town->max_monst(); i++)
@@ -1502,7 +1502,8 @@ void fire_missile(location target) {
}
// race adj.
if (univ.party[missile_firer].race == 1)
// TODO: Should this apply to sliths as well? The bladbase suggests otherwise, but it has been changed from the original; maybe the sliths were originally considered to be reptiles.
if(univ.party[missile_firer].race == eRace::REPTILE)
hit_bonus += 2;
if (univ.party[missile_firer].items[ammo_inv_slot].ability == 172)
@@ -1971,7 +1972,7 @@ void do_monster_turn()
// flee
if ((univ.town.monst[i].target != 6) && (((cur_monst->morale <= 0)
&& (cur_monst->spec_skill != 13) && (cur_monst->m_type != 8))
&& cur_monst->spec_skill != 13 && cur_monst->m_type != eRace::UNDEAD)
|| (current_monst_tactic == 1))) {
if (cur_monst->morale < 0)
cur_monst->morale++;
@@ -2329,9 +2330,9 @@ void monster_attack_pc(short who_att,short target)
draw_terrain(2);
// Check if hit, and do effects
if (r1 <= hit_chance[(attacker->skill + 4) / 2]) {
if(attacker->m_type == RACE_UNDEAD)
if(attacker->m_type == eRace::UNDEAD)
dam_type = DAMAGE_UNDEAD;
if(attacker->m_type == RACE_DEMON)
if(attacker->m_type == eRace::DEMON)
dam_type = DAMAGE_DEMON;
store_hp = univ.party[target].cur_health;
@@ -2429,14 +2430,14 @@ void monster_attack_pc(short who_att,short target)
&& (get_ran(1,0,8) < 6) && (pc_has_abil_equip(target,48) == 24)) {
add_string_to_buf(" Freezing touch!");
r1 = get_ran(3,1,10);
damage_pc(target,r1,DAMAGE_COLD,RACE_UNKNOWN,0);
damage_pc(target,r1,DAMAGE_COLD,eRace::UNKNOWN,0);
}
// Killing touch
if (attacker->spec_skill == 35)
{
add_string_to_buf(" Killing touch!");
r1 = get_ran(20,1,10);
damage_pc(target,r1,DAMAGE_UNBLOCKABLE,RACE_UNKNOWN,0);
damage_pc(target,r1,DAMAGE_UNBLOCKABLE,eRace::UNKNOWN,0);
}
}
}
@@ -2503,9 +2504,9 @@ void monster_attack_monster(short who_att,short attackee)
draw_terrain(2);
// Check if hit, and do effects
if (r1 <= hit_chance[(attacker->skill + 4) / 2]) {
if(attacker->m_type == RACE_DEMON)
if(attacker->m_type == eRace::DEMON)
dam_type = DAMAGE_DEMON;
if(attacker->m_type == RACE_UNDEAD)
if(attacker->m_type == eRace::UNDEAD)
dam_type = DAMAGE_UNDEAD;
store_hp = target->health;
@@ -2729,7 +2730,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor
if (target < 100) { // pc
sprintf ((char *) create_line, " Hits %s with heat ray.",(char *) univ.party[target].name.c_str());
add_string_to_buf((char *) create_line);
damage_pc(target,r1,DAMAGE_FIRE,RACE_UNKNOWN,0);
damage_pc(target,r1,DAMAGE_FIRE,eRace::UNKNOWN,0);
}
else { // on monst
add_string_to_buf(" Fires heat ray.");
@@ -2799,7 +2800,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor
// sprintf ((char *) create_line, " Hits %s.",(char *) univ.party[target].name);
// add_string_to_buf((char *) create_line);
if(damage_pc(target,r2,DAMAGE_WEAPON,RACE_UNKNOWN,13)) {
if(damage_pc(target,r2,DAMAGE_WEAPON,eRace::UNKNOWN,13)) {
// TODO: Uh, is something supposed to happen here!?
}
}
@@ -3504,7 +3505,7 @@ void damage_target(short target,short dam,eDamageType type)
{
if (target == 6) return;
if (target < 6)
damage_pc(target,dam,type,RACE_UNKNOWN,0);
damage_pc(target,dam,type,eRace::UNKNOWN,0);
else damage_monst(target - 100, 7, dam, 0, type,0);
}
@@ -3684,32 +3685,32 @@ void place_spell_pattern(effect_pat_type pat,location center,short type,bool pre
switch (effect) {
case 4:
r1 = get_ran(2,1,6);
damage_pc(k,r1,DAMAGE_MAGIC,RACE_UNKNOWN,0);
damage_pc(k,r1,DAMAGE_MAGIC,eRace::UNKNOWN,0);
break;
case 5:
r1 = get_ran(1,1,6) + 1;
damage_pc(k,r1,DAMAGE_FIRE,RACE_UNKNOWN,0);
damage_pc(k,r1,DAMAGE_FIRE,eRace::UNKNOWN,0);
break;
case 8:
r1 = get_ran(2,1,6);
damage_pc(k,r1,DAMAGE_COLD,RACE_UNKNOWN,0);
damage_pc(k,r1,DAMAGE_COLD,eRace::UNKNOWN,0);
break;
case 9:
r1 = get_ran(4,1,8);
damage_pc(k,r1,DAMAGE_WEAPON,RACE_UNKNOWN,0);
damage_pc(k,r1,DAMAGE_WEAPON,eRace::UNKNOWN,0);
break;
default:
if ((effect >= 50) && (effect < 80)) {
r1 = get_ran(effect - 50,1,6);
damage_pc(k,r1,DAMAGE_FIRE,RACE_UNKNOWN,0);
damage_pc(k,r1,DAMAGE_FIRE,eRace::UNKNOWN,0);
}
if ((effect >= 90) && (effect < 120)) {
r1 = get_ran(effect - 90,1,6);
damage_pc(k,r1,DAMAGE_COLD,RACE_UNKNOWN,0);
damage_pc(k,r1,DAMAGE_COLD,eRace::UNKNOWN,0);
}
if ((effect >= 130) && (effect < 160)) {
r1 = get_ran(effect - 130,1,6);
damage_pc(k,r1,DAMAGE_MAGIC,RACE_UNKNOWN,0);
damage_pc(k,r1,DAMAGE_MAGIC,eRace::UNKNOWN,0);
}
break;
}
@@ -3814,7 +3815,7 @@ void do_shockwave(location target)
for (i = 0; i < 6; i++)
if ((dist(target,pc_pos[i]) > 0) && (dist(target,pc_pos[i]) < 11)
&& univ.party[i].main_status == eMainStatus::ALIVE)
damage_pc(i, get_ran(2 + dist(target,pc_pos[i]) / 2, 1, 6), DAMAGE_UNBLOCKABLE,RACE_UNKNOWN,0);
damage_pc(i, get_ran(2 + dist(target,pc_pos[i]) / 2, 1, 6), DAMAGE_UNBLOCKABLE,eRace::UNKNOWN,0);
for (i = 0; i < univ.town->max_monst(); i++)
if ((univ.town.monst[i].active != 0) && (dist(target,univ.town.monst[i].cur_loc) > 0)
&& (dist(target,univ.town.monst[i].cur_loc) < 11)
@@ -3833,7 +3834,7 @@ void radius_damage(location target,short radius, short dam, eDamageType type)///
for (i = 0; i < 6; i++)
if ((dist(target,univ.town.p_loc) > 0) && (dist(target,univ.town.p_loc) <= radius)
&& univ.party[i].main_status == eMainStatus::ALIVE)
damage_pc(i, dam, type,RACE_UNKNOWN,0);
damage_pc(i, dam, type,eRace::UNKNOWN,0);
for (i = 0; i < univ.town->max_monst(); i++)
if ((univ.town.monst[i].active != 0) && (dist(target,univ.town.monst[i].cur_loc) > 0)
&& (dist(target,univ.town.monst[i].cur_loc) <= radius)
@@ -3846,7 +3847,7 @@ void radius_damage(location target,short radius, short dam, eDamageType type)///
for (i = 0; i < 6; i++)
if ((dist(target,pc_pos[i]) > 0) && (dist(target,pc_pos[i]) <= radius)
&& univ.party[i].main_status == eMainStatus::ALIVE)
damage_pc(i, dam, type,RACE_UNKNOWN,0);
damage_pc(i, dam, type,eRace::UNKNOWN,0);
for (i = 0; i < univ.town->max_monst(); i++)
if ((univ.town.monst[i].active != 0) && (dist(target,univ.town.monst[i].cur_loc) > 0)
&& (dist(target,univ.town.monst[i].cur_loc) <= radius)
@@ -3911,7 +3912,7 @@ void hit_space(location target,short dam,eDamageType type,short report,short hit
for (i = 0; i < 6; i++)
if(univ.party[i].main_status == eMainStatus::ALIVE && !stop_hitting)
if (pc_pos[i] == target) {
damage_pc(i,dam,type,RACE_UNKNOWN,0);
damage_pc(i,dam,type,eRace::UNKNOWN,0);
stop_hitting = (hit_all == 1) ? false : true;
}
if (overall_mode < MODE_COMBAT)
@@ -3944,7 +3945,7 @@ void do_poison()
if(univ.party[i].main_status == eMainStatus::ALIVE)
if (univ.party[i].status[2] > 0) {
r1 = get_ran(univ.party[i].status[2],1,6);
damage_pc(i,r1,DAMAGE_POISON,RACE_UNKNOWN,0);
damage_pc(i,r1,DAMAGE_POISON,eRace::UNKNOWN,0);
if (get_ran(1,0,8) < 6)
univ.party[i].status[2] = move_to_zero(univ.party[i].status[2]);
if (get_ran(1,0,8) < 6)
@@ -4022,7 +4023,7 @@ void handle_acid()
if(univ.party[i].main_status == eMainStatus::ALIVE)
if (univ.party[i].status[13] > 0) {
r1 = get_ran(univ.party[i].status[13],1,6);
damage_pc(i,r1,DAMAGE_MAGIC,RACE_UNKNOWN,0);
damage_pc(i,r1,DAMAGE_MAGIC,eRace::UNKNOWN,0);
univ.party[i].status[13] = move_to_zero(univ.party[i].status[13]);
}
if (overall_mode < MODE_COMBAT)
@@ -4820,17 +4821,17 @@ short get_monst_sound(cCreature *attacker,short which_att) {
break;
default:
if (attacker->m_type == 0) {
if(attacker->m_type == eRace::HUMAN) {
if (strength > 9)
return 3;
else return 2;
}
if ((attacker->m_type == 0) ||(attacker->m_type == 6) ||(attacker->m_type == 9) ){
if(attacker->m_type == eRace::HUMAN || attacker->m_type == eRace::IMPORTANT || attacker->m_type == eRace::GIANT) {
return 2;
}
if (attacker->m_type == 4)
if(attacker->m_type == eRace::MAGE)
return 1;
if (attacker->m_type == 5)
if(attacker->m_type == eRace::PRIEST)
return 4;
return 0;
break;

View File

@@ -382,26 +382,26 @@ void draw_startup_stats()
switch (univ.party[i].main_status) {
case eMainStatus::ALIVE:
switch (univ.party[i].race) {
case RACE_HUMAN: sprintf((char *) str,"Level %d Human",univ.party[i].level); break;
case RACE_NEPHIL: sprintf((char *) str,"Level %d Nephilim",univ.party[i].level); break;
case RACE_SLITH: sprintf((char *) str,"Level %d Slithzerikai",univ.party[i].level); break;
case RACE_VAHNATAI: sprintf((char *) str,"Level %d Vahnatai",univ.party[i].level); break;
case RACE_REPTILE: sprintf((char *) str,"Level %d Reptile",univ.party[i].level); break;
case RACE_BEAST: sprintf((char *) str,"Level %d Beast",univ.party[i].level); break;
case RACE_IMPORTANT: sprintf((char *) str,"Level %d V.I.P.",univ.party[i].level); break;
case RACE_MAGE: sprintf((char *) str,"Level %d Human Mage",univ.party[i].level); break;
case RACE_PRIEST: sprintf((char *) str,"Level %d Human Priest",univ.party[i].level); break;
case RACE_HUMANOID: sprintf((char *) str,"Level %d Humanoid",univ.party[i].level); break;
case RACE_DEMON: sprintf((char *) str,"Level %d Demon",univ.party[i].level); break;
case RACE_UNDEAD: sprintf((char *) str,"Level %d Undead",univ.party[i].level); break;
case RACE_GIANT: sprintf((char *) str,"Level %d Giant",univ.party[i].level); break;
case RACE_SLIME: sprintf((char *) str,"Level %d Slime",univ.party[i].level); break;
case RACE_STONE: sprintf((char *) str,"Level %d Golem",univ.party[i].level); break;
case RACE_BUG: sprintf((char *) str,"Level %d Bug",univ.party[i].level); break;
case RACE_DRAGON: sprintf((char *) str,"Level %d Dragon",univ.party[i].level); break;
case RACE_MAGICAL: sprintf((char *) str,"Level %d Magical Creature",univ.party[i].level); break;
case RACE_PLANT: sprintf((char *) str,"Level %d Plant",univ.party[i].level); break;
case RACE_BIRD: sprintf((char *) str,"Level %d Bird",univ.party[i].level); break;
case eRace::HUMAN: sprintf((char *) str,"Level %d Human",univ.party[i].level); break;
case eRace::NEPHIL: sprintf((char *) str,"Level %d Nephilim",univ.party[i].level); break;
case eRace::SLITH: sprintf((char *) str,"Level %d Slithzerikai",univ.party[i].level); break;
case eRace::VAHNATAI: sprintf((char *) str,"Level %d Vahnatai",univ.party[i].level); break;
case eRace::REPTILE: sprintf((char *) str,"Level %d Reptile",univ.party[i].level); break;
case eRace::BEAST: sprintf((char *) str,"Level %d Beast",univ.party[i].level); break;
case eRace::IMPORTANT: sprintf((char *) str,"Level %d V.I.P.",univ.party[i].level); break;
case eRace::MAGE: sprintf((char *) str,"Level %d Human Mage",univ.party[i].level); break;
case eRace::PRIEST: sprintf((char *) str,"Level %d Human Priest",univ.party[i].level); break;
case eRace::HUMANOID: sprintf((char *) str,"Level %d Humanoid",univ.party[i].level); break;
case eRace::DEMON: sprintf((char *) str,"Level %d Demon",univ.party[i].level); break;
case eRace::UNDEAD: sprintf((char *) str,"Level %d Undead",univ.party[i].level); break;
case eRace::GIANT: sprintf((char *) str,"Level %d Giant",univ.party[i].level); break;
case eRace::SLIME: sprintf((char *) str,"Level %d Slime",univ.party[i].level); break;
case eRace::STONE: sprintf((char *) str,"Level %d Golem",univ.party[i].level); break;
case eRace::BUG: sprintf((char *) str,"Level %d Bug",univ.party[i].level); break;
case eRace::DRAGON: sprintf((char *) str,"Level %d Dragon",univ.party[i].level); break;
case eRace::MAGICAL: sprintf((char *) str,"Level %d Magical Creature",univ.party[i].level); break;
case eRace::PLANT: sprintf((char *) str,"Level %d Plant",univ.party[i].level); break;
case eRace::BIRD: sprintf((char *) str,"Level %d Bird",univ.party[i].level); break;
default: sprintf((char *) str,"Level %d *ERROR INVALID RACE*",univ.party[i].level); break;
}
win_draw_string(mainPtr,pc_rect,str,eTextMode::WRAP,style,ul);

View File

@@ -235,8 +235,7 @@ void draw_monsters() ////
// in bed?
if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) &&
(scenario.ter_types[ter].special == TER_SPEC_BED) &&
((univ.town.monst[i].m_type < 7)
&& (univ.town.monst[i].m_type != 1) && (univ.town.monst[i].m_type != 2))
isHumanoid(univ.town.monst[i].m_type)
&& ((univ.town.monst[i].active == 1) || (univ.town.monst[i].target == 6)) &&
(width == 1) && (height == 1)) ////
draw_one_terrain_spot((short) where_draw.x,(short) where_draw.y,10000 + scenario.ter_types[ter].flag1.u);
@@ -250,8 +249,7 @@ void draw_monsters() ////
// in bed?
if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) &&
(scenario.ter_types[ter].special == TER_SPEC_BED) &&
((univ.town.monst[i].m_type < 7)
&& (univ.town.monst[i].m_type != 1) && (univ.town.monst[i].m_type != 2))
isHumanoid(univ.town.monst[i].m_type)
&& ((univ.town.monst[i].active == 1) || (univ.town.monst[i].target == 6)) &&
(width == 1) && (height == 1)) ////
draw_one_terrain_spot((short) where_draw.x,(short) where_draw.y,10000 + scenario.ter_types[ter].flag1.u);
@@ -281,8 +279,7 @@ void draw_monsters() ////
ter = univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y);
if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) &&
(scenario.ter_types[ter].special == TER_SPEC_BED) &&
((univ.town.monst[i].m_type < 7)
&& (univ.town.monst[i].m_type != 1) && (univ.town.monst[i].m_type != 2))
isHumanoid(univ.town.monst[i].m_type)
&& ((univ.town.monst[i].active == 1) || (univ.town.monst[i].target == 6)) &&
(width == 1) && (height == 1))
draw_one_terrain_spot((short) where_draw.x,(short) where_draw.y,10000 + scenario.ter_types[ter].flag1.u); ////
@@ -296,8 +293,7 @@ void draw_monsters() ////
ter = univ.town->terrain(univ.town.monst[i].cur_loc.x,univ.town.monst[i].cur_loc.y);
if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) &&
(scenario.ter_types[ter].special == TER_SPEC_BED) &&
((univ.town.monst[i].m_type < 7)
&& (univ.town.monst[i].m_type != 1) && (univ.town.monst[i].m_type != 2))
isHumanoid(univ.town.monst[i].m_type)
&& ((univ.town.monst[i].active == 1) || (univ.town.monst[i].target == 6)) &&
(width == 1) && (height == 1))
draw_one_terrain_spot((short) where_draw.x,(short) where_draw.y,10000 + scenario.ter_types[ter].flag1.u); ////

View File

@@ -285,7 +285,7 @@ void do_monsters()
l2 = (univ.town.monst[i].target <= 6) ? univ.town.p_loc : univ.town.monst[target - 100].cur_loc;
if ((univ.town.monst[i].morale < 0) && (univ.town.monst[i].spec_skill != 13)
&& (univ.town.monst[i].m_type != 8)) {
&& univ.town.monst[i].m_type != eRace::UNDEAD) {
acted_yet = flee_party(i,l1,l2);
if (get_ran(1,0,10) < 6)
univ.town.monst[i].morale++;
@@ -310,11 +310,9 @@ void do_monsters()
univ.town.monst[i].active = 2;
add_string_to_buf("Monster saw you!");
// play go active sound
switch (univ.town.monst[i].m_type) {
case 0: case 3: case 4: case 5: case 6: case 9:
play_sound(18); break;
default: play_sound(46); break;
}
if(isHumanoid(univ.town.monst[i].m_type) || univ.town.monst[i].m_type == eRace::GIANT)
play_sound(18);
else play_sound(46);
}
for (j = 0; j < univ.town->max_monst(); j++)
if ((univ.town.monst[j].active == 2)
@@ -899,7 +897,7 @@ void monst_inflict_fields(short which_monst)
curse_monst(which_m,r1);
break;
}
if ((univ.town.is_web(where_check.x,where_check.y)) && (which_m->m_type != 12)) {
if(univ.town.is_web(where_check.x,where_check.y) && which_m->m_type != eRace::BUG) {
monst_spell_note(which_m->number,19);
r1 = get_ran(1,2,3);
web_monst(which_m,r1);
@@ -1008,7 +1006,7 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon
if (univ.town.is_scloud(where_check.x,where_check.y)) {
if (guts < 4) return false;
}
if ((univ.town.is_web(where_check.x,where_check.y)) && (which_m->m_type != 12)) {
if(univ.town.is_web(where_check.x,where_check.y) && which_m->m_type != eRace::BUG) {
if (guts < 3) return false;
}
if (univ.town.is_fire_barr(where_check.x,where_check.y)) {
@@ -1217,7 +1215,8 @@ void charm_monst(cCreature *which_m,short penalty,short which_status,short amoun
if ((which_status == 11) &&
((which_m->m_type == 8) || (which_m->m_type == 10) || (which_m->m_type == 11)))
(which_m->m_type == eRace::UNDEAD || which_m->m_type == eRace::SLIME ||
which_m->m_type == eRace::STONE || which_m->m_type == eRace::PLANT))
return;
r1 = get_ran(1,1,100);
if (which_m->immunities & 1)
@@ -1263,7 +1262,7 @@ void record_monst(cCreature *which_m)
ASB("Capture Soul: Monster is too big.");
}
else if ((r1 > charm_odds[which_m->level / 2]) || (which_m->spec_skill == 12)
|| (which_m->m_type == 3)) {
|| which_m->m_type == eRace::IMPORTANT) {
monst_spell_note(which_m->number,10);
play_sound(68);
}

View File

@@ -567,15 +567,17 @@ bool create_pc(short spot,cDialog* parent)
univ.party[spot].main_status = eMainStatus::ALIVE;
if(overall_mode != MODE_STARTUP) {
univ.party[spot].items[0] = start_items[univ.party[spot].race * 2];
// 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[univ.party[spot].race * 2 + 1];
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 == 1)
if (univ.party[spot].race == eRace::NEPHIL)
univ.party[spot].skills[1] += 2;
if (univ.party[spot].race == 2) {
if (univ.party[spot].race == eRace::SLITH) {
univ.party[spot].skills[0] += 2;
univ.party[spot].skills[2] += 1;
}
@@ -2834,7 +2836,7 @@ void hit_party(short how_much,eDamageType damage_type)
for (i = 0; i < 6; i++)
if (univ.party[i].main_status == eMainStatus::ALIVE)
dummy = damage_pc(i,how_much,damage_type,RACE_UNKNOWN,0);
dummy = damage_pc(i,how_much,damage_type,eRace::UNKNOWN,0);
// dummy = damage_pc(i,how_much,damage_type + 30);
put_pc_screen();
}
@@ -2937,11 +2939,11 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_
how_much = how_much / ((level >= 7) ? 4 : 2);
if ((damage_type == DAMAGE_DEMON) && ((level = get_prot_level(which_pc,58)) > 0))
how_much = how_much / ((level >= 7) ? 4 : 2);
if ((type_of_attacker == RACE_HUMANOID) && ((level = get_prot_level(which_pc,59)) > 0))
if ((type_of_attacker == eRace::HUMANOID) && ((level = get_prot_level(which_pc,59)) > 0))
how_much = how_much / ((level >= 7) ? 4 : 2);
if ((type_of_attacker == RACE_REPTILE) && ((level = get_prot_level(which_pc,60)) > 0))
if ((type_of_attacker == eRace::REPTILE) && ((level = get_prot_level(which_pc,60)) > 0))
how_much = how_much / ((level >= 7) ? 4 : 2);
if ((type_of_attacker == RACE_GIANT) && ((level = get_prot_level(which_pc,61)) > 0))
if ((type_of_attacker == eRace::GIANT) && ((level = get_prot_level(which_pc,61)) > 0))
how_much = how_much / ((level >= 7) ? 4 : 2);

View File

@@ -344,7 +344,7 @@ bool check_special_terrain(location where_check,short mode,short which_pc,short
hit_party(r1,dam_type);
fast_bang = 1;
if (mode == 2)
damage_pc(which_pc,r1,dam_type,RACE_UNKNOWN,0);
damage_pc(which_pc,r1,dam_type,eRace::UNKNOWN,0);
if (overall_mode < MODE_COMBAT)
boom_space(univ.party.p_loc,overall_mode,pic_type,r1,12);
fast_bang = 0;
@@ -484,7 +484,7 @@ void check_fields(location where_check,short mode,short which_pc)
// if (mode < 2)
// hit_party(r1,1);
if (mode == 2)
damage_pc(which_pc,r1,DAMAGE_FIRE,RACE_UNKNOWN,0);
damage_pc(which_pc,r1,DAMAGE_FIRE,eRace::UNKNOWN,0);
if (overall_mode < MODE_COMBAT)
boom_space(univ.party.p_loc,overall_mode,0,r1,5);
}
@@ -494,7 +494,7 @@ void check_fields(location where_check,short mode,short which_pc)
// if (mode < 2)
// hit_party(r1,3);
if (mode == 2)
damage_pc(which_pc,r1,DAMAGE_MAGIC,RACE_UNKNOWN,0);
damage_pc(which_pc,r1,DAMAGE_MAGIC,eRace::UNKNOWN,0);
if (overall_mode < MODE_COMBAT)
boom_space(univ.party.p_loc,overall_mode,1,r1,12);
}
@@ -504,7 +504,7 @@ void check_fields(location where_check,short mode,short which_pc)
// if (mode < 2)
// hit_party(r1,5);
if (mode == 2)
damage_pc(which_pc,r1,DAMAGE_COLD,RACE_UNKNOWN,0);
damage_pc(which_pc,r1,DAMAGE_COLD,eRace::UNKNOWN,0);
if (overall_mode < MODE_COMBAT)
boom_space(univ.party.p_loc,overall_mode,4,r1,7);
}
@@ -514,7 +514,7 @@ void check_fields(location where_check,short mode,short which_pc)
// if (mode < 2)
// hit_party(r1,0);
if (mode == 2)
damage_pc(which_pc,r1,DAMAGE_WEAPON,RACE_UNKNOWN,0);
damage_pc(which_pc,r1,DAMAGE_WEAPON,eRace::UNKNOWN,0);
if (overall_mode < MODE_COMBAT)
boom_space(univ.party.p_loc,overall_mode,3,r1,2);
}
@@ -524,7 +524,7 @@ void check_fields(location where_check,short mode,short which_pc)
// if (mode < 2)
// hit_party(r1,1);
if (mode == 2)
damage_pc(which_pc,r1,DAMAGE_FIRE,RACE_UNKNOWN,0);
damage_pc(which_pc,r1,DAMAGE_FIRE,eRace::UNKNOWN,0);
if (overall_mode < MODE_COMBAT)
boom_space(univ.party.p_loc,overall_mode,0,r1,5);
}
@@ -559,7 +559,7 @@ void check_fields(location where_check,short mode,short which_pc)
if (mode < 2)
hit_party(r1,DAMAGE_MAGIC);
if (mode == 2)
damage_pc(which_pc,r1,DAMAGE_MAGIC,RACE_UNKNOWN,0);
damage_pc(which_pc,r1,DAMAGE_MAGIC,eRace::UNKNOWN,0);
if (overall_mode < MODE_COMBAT)
boom_space(univ.party.p_loc,overall_mode,1,r1,12);
}
@@ -928,7 +928,7 @@ void use_item(short pc,short item)
break;
case 1:
ASB(" You feel sick.");
damage_pc(pc,20 * str,DAMAGE_UNBLOCKABLE,RACE_HUMAN,0);
damage_pc(pc,20 * str,DAMAGE_UNBLOCKABLE,eRace::HUMAN,0);
break;
case 2:
ASB(" You all feel better.");
@@ -966,7 +966,7 @@ void use_item(short pc,short item)
case 0: case 1:
ASB(" You feel terrible.");
drain_pc(pc,str * 5);
damage_pc(pc,20 * str,DAMAGE_UNBLOCKABLE,RACE_HUMAN,0);
damage_pc(pc,20 * str,DAMAGE_UNBLOCKABLE,eRace::HUMAN,0);
disease_pc(pc,2 * str);
dumbfound_pc(pc,2 * str);
break;
@@ -974,7 +974,7 @@ void use_item(short pc,short item)
ASB(" You all feel terrible.");
for (i = 0; i < 6; i++) {
drain_pc(i,str * 5);
damage_pc(i,20 * str,DAMAGE_UNBLOCKABLE,RACE_HUMAN,0);
damage_pc(i,20 * str,DAMAGE_UNBLOCKABLE,eRace::HUMAN,0);
disease_pc(i,2 * str);
dumbfound_pc(i,2 * str);
}
@@ -1627,17 +1627,19 @@ void kill_monst(cCreature *which_m,short who_killed)
short xp,i,j,s1,s2,s3;
location l;
switch (which_m->m_type) {
case 0: case 3: case 4: case 5: case 6:
if(isHumanoid(which_m->m_type)) {
if (( which_m->number == 38) ||
( which_m->number == 39))
i = 4;
else if ( which_m->number == 45)
i = 0;
else i = get_ran(1,0,1);
play_sound(29 + i); break;
case 9: play_sound(29); break;
case 1: case 2: case 7: case 8: case 11:
play_sound(29 + i);
} else switch(which_m->m_type) {
case eRace::GIANT: play_sound(29); break;
// TODO: Should sliths be considered reptiles too? Check original bladbase.
// TODO: Should birds be considered beasts? If there are iny birds in the bladbase, probably; otherwise, better to have new sound
case eRace::REPTILE: case eRace::BEAST: case eRace::DEMON: case eRace::UNDEAD: case eRace::STONE:
i = get_ran(1,0,1); play_sound(31 + i); break;
default: play_sound(33); break;
}
@@ -1671,11 +1673,22 @@ void kill_monst(cCreature *which_m,short who_killed)
i = which_m->cur_loc.x;
j = which_m->cur_loc.y;
switch (which_m->m_type) {
case 7: make_sfx(i,j,6); break;
case 8: if (which_m->number <= 59) make_sfx(i,j,7); break;
case 10: case 12: make_sfx(i,j,4); break;
case 11: make_sfx(i,j,8); break;
default: make_sfx(i,j,1); break;
case eRace::DEMON:
make_sfx(i,j,6);
break;
// TODO: Don't check which_m->number here; find another way to indicate it
case eRace::UNDEAD:
if(which_m->number <= 59) make_sfx(i,j,7);
break;
case eRace::SLIME: case eRace::PLANT: case eRace::BUG:
make_sfx(i,j,4);
break;
case eRace::STONE:
make_sfx(i,j,8);
break;
default:
make_sfx(i,j,1);
break;
}
@@ -1806,7 +1819,7 @@ void push_things()////
}
if (univ.town.is_block(univ.town.p_loc.x,univ.town.p_loc.y)) {
ASB("You crash into the block.");
damage_pc(i,get_ran(1, 1, 6), DAMAGE_UNBLOCKABLE,RACE_UNKNOWN,0);
damage_pc(i,get_ran(1, 1, 6), DAMAGE_UNBLOCKABLE,eRace::UNKNOWN,0);
}
for (k = 0; k < NUM_TOWN_ITEMS; k++)
if(univ.town.items[k].variety != eItemType::NO_ITEM && univ.town.items[k].contained
@@ -2393,10 +2406,10 @@ void affect_spec(short which_mode,cSpecial cur_node,short cur_spec_type,
eDamageType dam_type = (eDamageType) spec.ex2b;
if (pc < 0) {
if(spec.pic == 1 && overall_mode == MODE_COMBAT)
damage_pc(current_pc,r1,dam_type,RACE_UNKNOWN,0); // was HUMAN
damage_pc(current_pc,r1,dam_type,eRace::UNKNOWN,0); // was HUMAN
else hit_party(r1,dam_type);
}
else damage_pc(pc,r1,dam_type,RACE_UNKNOWN,0);
else damage_pc(pc,r1,dam_type,eRace::UNKNOWN,0);
break;
}
case SPEC_AFFECT_HP:

View File

@@ -1213,7 +1213,7 @@ void bash_door(location where,short pc_num) ////
unlock_adjust = scenario.ter_types[terrain].flag2.u;
if ((unlock_adjust >= 5) || (r1 > (unlock_adjust * 15 + 40)) || (scenario.ter_types[terrain].flag3.u != 1)) {
add_string_to_buf(" Didn't work. ");
damage_pc(pc_num,get_ran(1,1,4),DAMAGE_UNBLOCKABLE,RACE_UNKNOWN,0);
damage_pc(pc_num,get_ran(1,1,4),DAMAGE_UNBLOCKABLE,eRace::UNKNOWN,0);
}
else {
add_string_to_buf(" Lock breaks. ");

View File

@@ -126,7 +126,7 @@ bool run_trap(short pc_num,eTrapType trap_type,short trap_level,short diff)
for (i = 0; i < num_hits; i++) {
add_string_to_buf(" A knife flies out! ");
r1 = get_ran(2 + univ.town.difficulty / 14,1,10);
damage_pc(pc_num,r1,DAMAGE_WEAPON,RACE_UNKNOWN,0);
damage_pc(pc_num,r1,DAMAGE_WEAPON,eRace::UNKNOWN,0);
}
break;

View File

@@ -26,7 +26,7 @@ cMonster& cMonster::operator = (legacy::monster_record_type& old){
// Unless human, add 3 to the monster's type to get its race
// This is because nephil, slith, and vahnatai were inserted
if(old.m_type) m_type = eRace(old.m_type + 3);
else m_type = RACE_HUMAN;
else m_type = eRace::HUMAN;
speed = old.speed;
mu = old.mu;
cl = old.cl;
@@ -166,7 +166,7 @@ std::istream& operator >> (std::istream& in, eRace& e){
in >> i;
if(i > 0 && i < 20)
e = (eRace) i;
else e = RACE_HUMAN;
else e = eRace::HUMAN;
return in;
}
@@ -380,56 +380,56 @@ cMonster::cAbility::operator std::string(){
break;
case MONST_SUMMON_SPECIES:
sout << "Summons ";
switch(extra1){
case RACE_HUMAN:
switch((eRace)extra1){
case eRace::HUMAN:
sout << "Humans";
break;
case RACE_NEPHIL:
case eRace::NEPHIL:
sout << "Nephilim";
break;
case RACE_SLITH:
case eRace::SLITH:
sout << "Slithzerikai";
break;
case RACE_VAHNATAI:
case eRace::VAHNATAI:
sout << "Vahnatai";
break;
case RACE_REPTILE:
case eRace::REPTILE:
sout << "reptiles";
break;
case RACE_BEAST:
case eRace::BEAST:
sout << "beasts";
break;
case RACE_HUMANOID:
case eRace::HUMANOID:
sout << "humanoids";
break;
case RACE_DEMON:
case eRace::DEMON:
sout << "demons";
break;
case RACE_UNDEAD:
case eRace::UNDEAD:
sout << "undead";
break;
case RACE_GIANT:
case eRace::GIANT:
sout << "giants";
break;
case RACE_SLIME:
case eRace::SLIME:
sout << "slimes";
break;
case RACE_STONE:
case eRace::STONE:
sout << "golems";
break;
case RACE_BUG:
case eRace::BUG:
sout << "bugs";
break;
case RACE_DRAGON:
case eRace::DRAGON:
sout << "Dragons";
break;
case RACE_MAGICAL:
case eRace::MAGICAL:
sout << "magical creatures";
break;
case RACE_PLANT:
case eRace::PLANT:
sout << "plants";
break;
case RACE_BIRD:
case eRace::BIRD:
sout << "birds";
break;
default: // Important, Mage, Priest, or invalid

View File

@@ -50,7 +50,9 @@ cPlayer& cPlayer::operator = (legacy::pc_record_type old){
short cPlayer::get_tnl(){
short tnl = 100,i,store_per = 100;
static const short rp[3] = {0,12,20};
// Omitting a race from this list gives it a value of 0, thanks to the defaulting implementation of operator[]
// TODO: Vahnatai
static std::map<const eRace, const int> rp = {{eRace::NEPHIL,12},{eRace::SLITH,20}};
static const short ap[15] = {10,20,8,10,4, 6,10,7,12,15, -10,-8,-8,-20,-8};
tnl = (tnl * (100 + rp[race])) / 100;
@@ -95,7 +97,7 @@ cPlayer::cPlayer(){
//advan[i] = false;
traits[i] = false;
}
race = RACE_HUMAN;
race = eRace::HUMAN;
//exp_adj = 100;
direction = 0;
}
@@ -153,7 +155,7 @@ cPlayer::cPlayer(long key,short slot){
traits[i] = false;
}
race = RACE_HUMAN;
race = eRace::HUMAN;
//exp_adj = 100;
direction = 0;
}else if(key == 'dflt'){

View File

@@ -55,30 +55,37 @@ inline bool isDead(eMainStatus stat) {
}
/* adven[i].race */ //complete
enum eRace {
RACE_UNKNOWN = -1, // for parameters to some functions; not valid in the class
RACE_HUMAN = 0,
RACE_NEPHIL = 1,
RACE_SLITH = 2,
RACE_VAHNATAI = 3,
RACE_REPTILE = 4,
RACE_BEAST = 5,
RACE_IMPORTANT = 6,
RACE_MAGE = 7,
RACE_PRIEST = 8,
RACE_HUMANOID = 9,
RACE_DEMON = 10,
RACE_UNDEAD = 11,
RACE_GIANT = 12,
RACE_SLIME = 13,
RACE_STONE = 14,
RACE_BUG = 15,
RACE_DRAGON = 16,
RACE_MAGICAL = 17,
RACE_PLANT = 18,
RACE_BIRD = 19,
enum class eRace {
UNKNOWN = -1, // for parameters to some functions; not valid in the class
HUMAN = 0,
NEPHIL = 1,
SLITH = 2,
VAHNATAI = 3, // Former value from eMonsterType
REPTILE = 4, // 1
BEAST = 5, // 2
IMPORTANT = 6, // 3
MAGE = 7, // 4
PRIEST = 8, // 5
HUMANOID = 9, // 6
DEMON = 10, // 7
UNDEAD = 11, // 8
GIANT = 12, // 9
SLIME = 13, // 10
STONE = 14, // 11
BUG = 15, // 12
DRAGON = 16, // 13
MAGICAL = 17, // 14
PLANT = 18,
BIRD = 19,
};
// Types IMPORTANT, MAGE, and PRIEST are implicitly human
// Types NEPHIL, SLITH, and VAHNATAI are implicitly humanoid
inline bool isHumanoid(eRace race) {
int code = (int) race;
return (code >= 0 && code <= 3) || (code >= 6 && code <= 9);
}
/* adven[i].status*/ //complete - assign a positive value for a help pc effect, a negative for harm pc
enum eStatus {
STATUS_POISONED_WEAPON = 0,

View File

@@ -201,7 +201,7 @@ static void display_traits_graphics(cDialog& me)
{
short i,store;
std::string race = "race" + boost::lexical_cast<std::string>(store_pc->race + 1);
std::string race = "race" + boost::lexical_cast<std::string>(int(store_pc->race) + 1);
dynamic_cast<cLedGroup&>(me["race"]).setSelected(race);
for (i = 0; i < 10; i++) {
std::string id = "good" + boost::lexical_cast<std::string>(i + 1);
@@ -230,15 +230,15 @@ static bool pick_race_select_led(cDialog& me, std::string item_hit, bool losing)
if(item_hit == "race") {
eRace race;
switch(item_hit[4] - '1') {
case 0: race = RACE_HUMAN; break;
case 1: race = RACE_NEPHIL; break;
case 2: race = RACE_SLITH; break;
case 3: race = RACE_VAHNATAI; break;
case 0: race = eRace::HUMAN; break;
case 1: race = eRace::NEPHIL; break;
case 2: race = eRace::SLITH; break;
case 3: race = eRace::VAHNATAI; break;
}
if(store_trait_mode == 0)
pc->race = race;
display_traits_graphics(me);
abil_str = get_str("traits",16 + race);
abil_str = get_str("traits",16 + int(race));
me["info"].setText(abil_str);
} else if(item_hit.substr(0,3) == "bad") {
int hit = item_hit[3] - '1';

View File

@@ -470,12 +470,13 @@ void display_party()
case eMainStatus::ALIVE:
if (i == current_active_pc) {
//Draw in race
if (univ.party[i].race == 0)
if(univ.party[i].race == eRace::HUMAN)
win_draw_string(mainPtr,pc_race_rect,"Human ",eTextMode::CENTRE,style);
if (univ.party[i].race == 1)
if(univ.party[i].race == eRace::NEPHIL)
win_draw_string(mainPtr,pc_race_rect,"Nephilim ",eTextMode::CENTRE,style);
if (univ.party[i].race == 2)
if(univ.party[i].race == eRace::SLITH)
win_draw_string(mainPtr,pc_race_rect,"Slithzerikai ",eTextMode::CENTRE,style);
// TODO: Vahnatai
// Draw in skills
sprintf((char *) to_draw, "Skills:");

View File

@@ -502,7 +502,7 @@ void put_monst_info_in_dlog(cDialog& me, m_num_t which_monst) {
break;
}
me["type"].setText(get_str("monster-abilities",150 + store_monst.m_type));
me["type"].setText(get_str("monster-abilities",150 + int(store_monst.m_type)));
me["type1"].setText(get_str("monster-abilities",130 + store_monst.a[0].type));
me["type2"].setText(get_str("monster-abilities",130 + store_monst.a[1].type));
// TODO: Attack 3 type
@@ -605,7 +605,7 @@ static bool edit_monst_type_event_filter(cDialog& me,std::string item_hit,cMonst
put_monst_info_in_dlog(me,which_monst);
} else if(item_hit == "picktype") {
if(!save_monst_info(me,store_monst)) return false;
i = choose_text_res("monster-abilities",150,167,store_monst.m_type + 150,&me,"Choose Monster Type:");
i = choose_text_res("monster-abilities",150,167,int(store_monst.m_type) + 150,&me,"Choose Monster Type:");
if (i >= 0) {
i -= 150;
store_monst.m_type = (eRace) i;