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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user