diff --git a/osx/boe.actions.cpp b/osx/boe.actions.cpp index 26d7f1fe..33839762 100644 --- a/osx/boe.actions.cpp +++ b/osx/boe.actions.cpp @@ -1780,7 +1780,7 @@ Boolean handle_keystroke(char chr,char chr2,EventRecord event) if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].attitude % 2 == 1) && (dist(univ.town.monst.dudes[i].m_loc,univ.town.p_loc) <= 10) ) - damage_monst(i, 7,1000,0, 4); + damage_monst(i, 7,1000,0, DAMAGE_UNBLOCKABLE,0); } // kill_monst(&c_town.monst.dudes[i],6); initiate_redraw(); @@ -2176,7 +2176,7 @@ void increase_age()//// add_string_to_buf("Starving! "); play_sound(66); r1 = get_ran(3,1,6); - hit_party(r1,4); + hit_party(r1,DAMAGE_UNBLOCKABLE); update_stat = TRUE; if (overall_mode < MODE_COMBAT) boom_space(univ.party.p_loc,overall_mode,0,r1,0); diff --git a/osx/boe.combat.cpp b/osx/boe.combat.cpp index bf4ac55e..4fc61983 100644 --- a/osx/boe.combat.cpp +++ b/osx/boe.combat.cpp @@ -593,7 +593,7 @@ void pc_attack(short who_att,short target)//// r2 = get_ran(1,1,4) + dam_adj; if (r1 <= hit_chance[ADVEN[who_att].skills[what_skill1]]) { - damage_monst(target, who_att, r2, 0,400); + damage_monst(target, who_att, r2, 0,DAMAGE_WEAPON,4); } else { draw_terrain(2); @@ -646,14 +646,14 @@ void pc_attack(short who_att,short target)//// switch (what_skill1) { case 3: if (ADVEN[who_att].items[weap1].item_level < 8) - damage_monst(target, who_att, r2, spec_dam, 100); - else damage_monst(target, who_att, r2, spec_dam, 200); + damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON,1); + else damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON,2); break; case 4: - damage_monst(target, who_att, r2, spec_dam, 400); + damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON,4); break; case 5: - damage_monst(target, who_att, r2, spec_dam, 300); + damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON,3); break; } // poison @@ -713,14 +713,14 @@ void pc_attack(short who_att,short target)//// switch (what_skill2) { case 3: if (ADVEN[who_att].items[weap1].item_level < 8) - damage_monst(target, who_att, r2, spec_dam, 100); - else damage_monst(target, who_att, r2, spec_dam, 200); + damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON,1); + else damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON,2); break; case 4: - damage_monst(target, who_att, r2, spec_dam, 400); + damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON,4); break; case 5: - damage_monst(target, who_att, r2, spec_dam, 300); + damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON,3); break; } @@ -753,7 +753,7 @@ void pc_attack(short who_att,short target)//// if (((univ.town.monst.dudes[target].m_d.status[10] > 0) || (univ.town.monst.dudes[target].m_d.spec_skill == 22)) && (store_hp - univ.town.monst.dudes[target].m_d.health > 0)) { add_string_to_buf(" Shares damage! "); - damage_pc(who_att, store_hp - univ.town.monst.dudes[target].m_d.health, 3,-1); + damage_pc(who_att, store_hp - univ.town.monst.dudes[target].m_d.health, DAMAGE_MAGIC,MONSTER_TYPE_UNKNOWN,0); } combat_posing_monster = current_working_monster = -1; @@ -887,7 +887,7 @@ void do_combat_cast(location target)//// // to wedge in animations, have to kludge like crazy short boom_dam[8] = {0,0,0,0,0,0,0,0}; - short boom_type[8] = {0,0,0,0,0,0,0,0}; + eDamageType boom_type[8]; location boom_targ[8]; if (spell_being_cast >= 1000) { @@ -1002,7 +1002,7 @@ void do_combat_cast(location target)//// case 42: // Fire barrier play_sound(68); r1 = get_ran(3,2,7); - hit_space(target,r1,1,TRUE,TRUE); + hit_space(target,r1,DAMAGE_FIRE,TRUE,TRUE); make_fire_barrier(target.x,target.y); if (is_fire_barrier(target.x,target.y)) add_string_to_buf(" You create the barrier. "); @@ -1011,7 +1011,7 @@ void do_combat_cast(location target)//// case 59: // Force barrier play_sound(68); r1 = get_ran(7,2,7); - hit_space(target,r1,1,TRUE,TRUE); + hit_space(target,r1,DAMAGE_FIRE,TRUE,TRUE); make_force_barrier(target.x,target.y); if (is_force_barrier(target.x,target.y)) add_string_to_buf(" You create the barrier. "); @@ -1034,19 +1034,19 @@ void do_combat_cast(location target)//// r1 = (spell_being_cast == 1) ? get_ran(2,1,4) : get_ran(min(20,level + bonus),1,4); add_missile(target,6,1,0,0); do_missile_anim(100,pc_pos[current_pc],11); - hit_space(target,r1,(spell_being_cast == 1) ? 3 : 5,1,0); + hit_space(target,r1,(spell_being_cast == 1) ? DAMAGE_MAGIC : DAMAGE_COLD,1,0); break; case 27: // flame arrows add_missile(target,4,1,0,0); r1 = get_ran(2,1,4); - boom_type[i] = 1; + boom_type[i] = DAMAGE_FIRE; boom_dam[i] = r1; //hit_space(target,r1,1,1,0); break; case 129: // smite add_missile(target,6,1,0,0); r1 = get_ran(2,1,5); - boom_type[i] = 5; + boom_type[i] = DAMAGE_COLD; boom_dam[i] = r1; //hit_space(target,r1,5,1,0); break; @@ -1054,13 +1054,13 @@ void do_combat_cast(location target)//// r1 = get_ran(min(7,2 + bonus + level / 2),1,4); add_missile(target,14,1,0,0); do_missile_anim(100,pc_pos[current_pc],24); - hit_space(target,r1,4,1,0); + hit_space(target,r1,DAMAGE_UNBLOCKABLE,1,0); break; case 11: r1 = get_ran(min(10,1 + level / 3 + bonus),1,6); add_missile(target,2,1,0,0); do_missile_anim(100,pc_pos[current_pc],11); - hit_space(target,r1,1,1,0); + hit_space(target,r1,DAMAGE_FIRE,1,0); break; case 22: case 141: r1 = min(9,1 + (level * 2) / 3 + bonus) + 1; @@ -1088,13 +1088,13 @@ void do_combat_cast(location target)//// add_missile(target,9,1,0,0); do_missile_anim(100,pc_pos[current_pc],11); r1 = get_ran(3,0,10) + ADVEN[current_pc].level * 2; - hit_space(target,40 + r1,3,1,0); + hit_space(target,40 + r1,DAMAGE_MAGIC,1,0); break; case 61: // death arrows add_missile(target,9,1,0,0); store_sound = 11; r1 = get_ran(3,0,10) + ADVEN[current_pc].level + 3 * bonus; - boom_type[i] = 3; + boom_type[i] = DAMAGE_MAGIC; boom_dam[i] = r1; //hit_space(target,40 + r1,3,1,0); break; @@ -1301,7 +1301,7 @@ void do_combat_cast(location target)//// else { r1 = get_ran((spell_being_cast == 103) ? 2 : 6, 1, 14); - hit_space(cur_monst->m_loc,r1,4,0,current_pc); + hit_space(cur_monst->m_loc,r1,DAMAGE_UNBLOCKABLE,0,current_pc); } break; @@ -1319,7 +1319,7 @@ void do_combat_cast(location target)//// //if (PSD[4][0] == 3) // anama // r1 += 25; //play_sound(53); - hit_space(cur_monst->m_loc,r1,4,0,current_pc); + hit_space(cur_monst->m_loc,r1,DAMAGE_UNBLOCKABLE,0,current_pc); } break; } @@ -1361,13 +1361,13 @@ void handle_marked_damage() for (i = 0; i < 6; i++) if (pc_marked_damage[i] > 0) { - damage_pc(i,pc_marked_damage[i],10,-1); + damage_pc(i,pc_marked_damage[i],DAMAGE_MARKED,MONSTER_TYPE_UNKNOWN,0); pc_marked_damage[i] = 0; } for (i = 0; i < T_M; i++) if (monst_marked_damage[i] > 0) { - damage_monst(i, current_pc, monst_marked_damage[i], 0, 9); + damage_monst(i, current_pc, monst_marked_damage[i], 0, DAMAGE_MARKED,0); // was 9 rather than 10; probably a mistake monst_marked_damage[i] = 0; } @@ -1526,7 +1526,7 @@ void fire_missile(location target) { ASB(" There is a flash of light."); cur_monst->m_d.health += r2; } - else damage_monst(targ_monst, current_pc, r2, spec_dam, 1300); + else damage_monst(targ_monst, current_pc, r2, spec_dam, DAMAGE_WEAPON,13); //if (ADVEN[current_pc].items[ammo_inv_slot].ability == 33) // hit_space(cur_monst->m_loc,get_ran(3,1,6),1,1,1); @@ -1540,7 +1540,7 @@ void fire_missile(location target) { } } - else hit_space(target,r2,0,1,0); + else hit_space(target,r2,DAMAGE_WEAPON,1,0); } @@ -2151,7 +2151,7 @@ void do_monster_turn() printed_acid = TRUE; } r1 = get_ran(cur_monst->m_d.status[13],1,6); - damage_monst(i, 6,r1, 0, 3); + damage_monst(i, 6,r1, 0, DAMAGE_MAGIC,0); cur_monst->m_d.status[13]--; } @@ -2171,7 +2171,7 @@ void do_monster_turn() printed_poison = TRUE; } r1 = get_ran(cur_monst->m_d.status[2],1,6); - damage_monst(i, 6, r1, 0, 2); + damage_monst(i, 6, r1, 0, DAMAGE_POISON,0); cur_monst->m_d.status[2]--; } if (cur_monst->m_d.status[7] > 0) { // Disease @@ -2214,7 +2214,8 @@ void do_monster_turn() void monster_attack_pc(short who_att,short target) { cPopulation::cCreature *attacker; - short r1,r2,i,dam_type = 0,store_hp,sound_type = 0; + short r1,r2,i,store_hp,sound_type = 0; + eDamageType dam_type = DAMAGE_WEAPON; attacker = &univ.town.monst.dudes[who_att]; @@ -2274,22 +2275,22 @@ void monster_attack_pc(short who_att,short target) // Check if hit, and do effects if (r1 <= hit_chance[(attacker->m_d.skill + 4) / 2]) { if (attacker->m_d.m_type == 7) - dam_type = 6; + dam_type = DAMAGE_UNDEAD; if (attacker->m_d.m_type == 8) - dam_type = 7; + dam_type = DAMAGE_DEMON; store_hp = ADVEN[target].cur_health; sound_type = get_monst_sound(attacker,i); - - if ((damage_pc(target,r2,sound_type * 100 + 30 + dam_type, - attacker->m_d.m_type) == TRUE) && + dam_type += DAMAGE_MARKED; + if (damage_pc(target,r2,dam_type, + attacker->m_d.m_type,sound_type) && (store_hp - ADVEN[target].cur_health > 0)) { damaged_message(store_hp - ADVEN[target].cur_health, (i > 0) ? attacker->m_d.a23_type : attacker->m_d.a1_type); if (ADVEN[target].status[10] > 0) { add_string_to_buf(" Shares damage! "); - damage_monst(who_att, 6, store_hp - ADVEN[target].cur_health, 0, 3); + damage_monst(who_att, 6, store_hp - ADVEN[target].cur_health, 0, DAMAGE_MAGIC,0); } if ((attacker->m_d.poison > 0) && (i == 0)) { @@ -2373,14 +2374,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,5,-1); + damage_pc(target,r1,DAMAGE_COLD,MONSTER_TYPE_UNKNOWN,0); } // Killing touch if (attacker->m_d.spec_skill == 35) { add_string_to_buf(" Killing touch!"); r1 = get_ran(20,1,10); - damage_pc(target,r1,4,-1); + damage_pc(target,r1,DAMAGE_UNBLOCKABLE,MONSTER_TYPE_UNKNOWN,0); } } } @@ -2404,7 +2405,8 @@ void monster_attack_pc(short who_att,short target) void monster_attack_monster(short who_att,short attackee) { cPopulation::cCreature *attacker,*target; - short r1,r2,i,dam_type = 0,store_hp,sound_type = 0; + short r1,r2,i,store_hp,sound_type = 0; + eDamageType dam_type = DAMAGE_WEAPON; attacker = &univ.town.monst.dudes[who_att]; target = &univ.town.monst.dudes[attackee]; @@ -2446,15 +2448,15 @@ void monster_attack_monster(short who_att,short attackee) draw_terrain(2); // Check if hit, and do effects if (r1 <= hit_chance[(attacker->m_d.skill + 4) / 2]) { - if (attacker->m_d.m_type == 7) - dam_type = 6; - if (attacker->m_d.m_type == 8) - dam_type = 7; + if (attacker->m_d.m_type == MONSTER_TYPE_DEMON) + dam_type = DAMAGE_DEMON; + if (attacker->m_d.m_type == MONSTER_TYPE_UNDEAD) + dam_type = DAMAGE_UNDEAD; store_hp = target->m_d.health; sound_type = get_monst_sound(attacker,i); - - if (damage_monst(attackee,7,r2,0,sound_type * 100 + 10 + dam_type) == TRUE) { + dam_type += DAMAGE_MARKED; + if (damage_monst(attackee,7,r2,0,dam_type,sound_type) == TRUE) { damaged_message(store_hp - target->m_d.health, (i > 0) ? attacker->m_d.a23_type : attacker->m_d.a1_type); @@ -2499,7 +2501,7 @@ void monster_attack_monster(short who_att,short attackee) && (get_ran(1,0,8) < 6)) { add_string_to_buf(" Freezing touch!"); r1 = get_ran(3,1,10); - damage_monst(attackee,7,r1,0,5); + damage_monst(attackee,7,r1,0,DAMAGE_COLD,0); } // Death touch @@ -2507,7 +2509,7 @@ void monster_attack_monster(short who_att,short attackee) && (get_ran(1,0,8) < 6)) { add_string_to_buf(" Killing touch!"); r1 = get_ran(20,1,10); - damage_monst(attackee,7,r1,0,4); + damage_monst(attackee,7,r1,0,DAMAGE_UNBLOCKABLE,0); } } } @@ -2671,11 +2673,11 @@ void monst_fire_missile(short m_num,short skill,short bless,short level,location if (target < 100) { // pc sprintf ((char *) create_line, " Hits %s with heat ray.",(char *) ADVEN[target].name); add_string_to_buf((char *) create_line); - damage_pc(target,r1,1,-1); + damage_pc(target,r1,DAMAGE_FIRE,MONSTER_TYPE_UNKNOWN,0); } else { // on monst add_string_to_buf(" Fires heat ray."); - damage_monst(target - 100,7,r1,0,1); + damage_monst(target - 100,7,r1,0,DAMAGE_FIRE,0); } do_explosion_anim(5,0); end_missile_anim(); @@ -2741,7 +2743,7 @@ void monst_fire_missile(short m_num,short skill,short bless,short level,location // sprintf ((char *) create_line, " Hits %s.",(char *) ADVEN[target].name); // add_string_to_buf((char *) create_line); - if (damage_pc(target,r2,1300,-1) == TRUE) { + if (damage_pc(target,r2,DAMAGE_WEAPON,MONSTER_TYPE_UNKNOWN,13) == TRUE) { } } else { @@ -2780,7 +2782,7 @@ void monst_fire_missile(short m_num,short skill,short bless,short level,location if (r1 <= hit_chance[dam[level] * 2]) { // monst_spell_note(m_target->number,16); - damage_monst(target - 100,7,r2,0,1300); + damage_monst(target - 100,7,r2,0,DAMAGE_WEAPON,13); } else { monst_spell_note(m_target->number,18); @@ -2792,7 +2794,8 @@ void monst_fire_missile(short m_num,short skill,short bless,short level,location Boolean monst_breathe(cPopulation::cCreature *caster,location targ_space,short dam_type)//// //dam_type; // 0 - fire 1 - cold 2 - magic { - short level,type[4] = {1,5,3,4},missile_t[4] = {13,6,8,8}; + short level,missile_t[4] = {13,6,8,8}; + eDamageType type[4] = {DAMAGE_FIRE, DAMAGE_COLD, DAMAGE_MAGIC, DAMAGE_UNBLOCKABLE}; location l; draw_terrain(2); @@ -2938,7 +2941,7 @@ Boolean monst_cast_mage(cPopulation::cCreature *caster,short targ)//// case 1: // spark run_a_missile(l,vict_loc,6,1,11,0,0,80); r1 = get_ran(2,1,4); - damage_target(targ,r1,1); + damage_target(targ,r1,DAMAGE_FIRE); break; case 2: // minor haste play_sound(25); @@ -2956,7 +2959,7 @@ Boolean monst_cast_mage(cPopulation::cCreature *caster,short targ)//// run_a_missile(l,vict_loc,2,1,11,0,0,80); start_missile_anim(); r1 = get_ran(caster->m_d.level,1,4); - damage_target(targ,r1,1); + damage_target(targ,r1,DAMAGE_FIRE); break; case 6: // minor poison run_a_missile(l,vict_loc,11,0,25,0,0,80); @@ -3047,7 +3050,7 @@ Boolean monst_cast_mage(cPopulation::cCreature *caster,short targ)//// run_a_missile(l,vict_loc,6,1,11,0,0,80); r1 = get_ran(5 + (caster->m_d.level / 5),1,8); start_missile_anim(); - damage_target(targ,r1,5); + damage_target(targ,r1,DAMAGE_COLD); break; case 17: // slow gp play_sound(25); @@ -3101,7 +3104,7 @@ Boolean monst_cast_mage(cPopulation::cCreature *caster,short targ)//// run_a_missile(l,vict_loc,9,1,11,0,0,80); r1 = 35 + get_ran(3,1,10); start_missile_anim(); - damage_target(targ,r1,3); + damage_target(targ,r1,DAMAGE_MAGIC); break; case 24: // daemon x = get_ran(3,1,4); @@ -3238,7 +3241,7 @@ Boolean monst_cast_priest(cPopulation::cCreature *caster,short targ) run_a_missile(l,vict_loc,8,0,24,0,0,80); r1 = get_ran(2,1,4); start_missile_anim(); - damage_target(targ,r1,4); + damage_target(targ,r1,DAMAGE_UNBLOCKABLE); break; case 4: // stumble play_sound(24); @@ -3260,7 +3263,7 @@ Boolean monst_cast_priest(cPopulation::cCreature *caster,short targ) run_a_missile(l,vict_loc,8,0,24,0,0,80); r1 = get_ran(2,1,6) + 2; start_missile_anim(); - damage_target(targ,r1,3); + damage_target(targ,r1,DAMAGE_MAGIC); break; case 8: case 22: // summon spirit,summon guardian play_sound(24); @@ -3296,7 +3299,7 @@ Boolean monst_cast_priest(cPopulation::cCreature *caster,short targ) run_a_missile(l,vict_loc,6,0,24,0,0,80); r1 = get_ran(4,1,6) + 2; start_missile_anim(); - damage_target(targ,r1,5); + damage_target(targ,r1,DAMAGE_COLD); break; case 14: // sticks to snakes play_sound(24); @@ -3390,7 +3393,7 @@ Boolean monst_cast_priest(cPopulation::cCreature *caster,short targ) run_a_missile(l,vict_loc,14,0,53,0,0,80); r1 = get_ran(4,1,8); r2 = get_ran(1,0,2); - damage_target(targ,r1,3); + damage_target(targ,r1,DAMAGE_MAGIC); if (targ < 6) { slow_pc(targ,6); poison_pc(targ,5 + r2); @@ -3434,12 +3437,12 @@ Boolean monst_cast_priest(cPopulation::cCreature *caster,short targ) return acted; } -void damage_target(short target,short dam,short type) +void damage_target(short target,short dam,eDamageType type) { if (target == 6) return; if (target < 6) - damage_pc(target,dam,type,-1); - else damage_monst(target - 100, 7, dam, 0, type); + damage_pc(target,dam,type,MONSTER_TYPE_UNKNOWN,0); + else damage_monst(target - 100, 7, dam, 0, type,0); } @@ -3618,32 +3621,32 @@ void place_spell_pattern(effect_pat_type pat,location center,short type,Boolean switch (effect) { case 4: r1 = get_ran(2,1,6); - damage_pc(k,r1,3,-1); + damage_pc(k,r1,DAMAGE_MAGIC,MONSTER_TYPE_UNKNOWN,0); break; case 5: r1 = get_ran(1,1,6) + 1; - damage_pc(k,r1,1,-1); + damage_pc(k,r1,DAMAGE_FIRE,MONSTER_TYPE_UNKNOWN,0); break; case 8: r1 = get_ran(2,1,6); - damage_pc(k,r1,5,-1); + damage_pc(k,r1,DAMAGE_COLD,MONSTER_TYPE_UNKNOWN,0); break; case 9: r1 = get_ran(4,1,8); - damage_pc(k,r1,0,-1); + damage_pc(k,r1,DAMAGE_WEAPON,MONSTER_TYPE_UNKNOWN,0); break; default: if ((effect >= 50) && (effect < 80)) { r1 = get_ran(effect - 50,1,6); - damage_pc(k,r1,1,-1); + damage_pc(k,r1,DAMAGE_FIRE,MONSTER_TYPE_UNKNOWN,0); } if ((effect >= 90) && (effect < 120)) { r1 = get_ran(effect - 90,1,6); - damage_pc(k,r1,5,-1); + damage_pc(k,r1,DAMAGE_COLD,MONSTER_TYPE_UNKNOWN,0); } if ((effect >= 130) && (effect < 160)) { r1 = get_ran(effect - 130,1,6); - damage_pc(k,r1,3,-1); + damage_pc(k,r1,DAMAGE_MAGIC,MONSTER_TYPE_UNKNOWN,0); } break; } @@ -3674,14 +3677,14 @@ void place_spell_pattern(effect_pat_type pat,location center,short type,Boolean break; case 4: r1 = get_ran(3,1,6); - damage_monst(k, who_hit, r1,0, 3); + damage_monst(k, who_hit, r1,0, DAMAGE_MAGIC,0); break; case 5: r1 = get_ran(2,1,6); which_m = &univ.town.monst.dudes[k]; if (which_m->m_d.spec_skill == 22) break; - damage_monst(k, who_hit, r1,0, 1); + damage_monst(k, who_hit, r1,0, DAMAGE_FIRE,0); break; case 7: which_m = &univ.town.monst.dudes[k]; @@ -3692,11 +3695,11 @@ void place_spell_pattern(effect_pat_type pat,location center,short type,Boolean r1 = get_ran(3,1,6); if (which_m->m_d.spec_skill == 23) break; - damage_monst(k, who_hit, r1,0, 5); + damage_monst(k, who_hit, r1,0, DAMAGE_COLD,0); break; case 9: r1 = get_ran(6,1,8); - damage_monst(k, who_hit, r1,0, 0); + damage_monst(k, who_hit, r1,0, DAMAGE_WEAPON,0); break; case 12: which_m = &univ.town.monst.dudes[k]; @@ -3705,15 +3708,15 @@ void place_spell_pattern(effect_pat_type pat,location center,short type,Boolean default: if ((effect >= 50) && (effect < 80)) { r1 = get_ran(effect - 50,1,6); - damage_monst(k,who_hit, r1,0,1); + damage_monst(k,who_hit, r1,0,DAMAGE_FIRE,0); } if ((effect >= 90) && (effect < 120)) { r1 = get_ran(effect - 90,1,6); - damage_monst(k,who_hit, r1,0, 5); + damage_monst(k,who_hit, r1,0, DAMAGE_COLD,0); } if ((effect >= 130) && (effect < 160)) { r1 = get_ran(effect - 130,1,6); - damage_monst(k,who_hit, r1,0, 3 ); + damage_monst(k,who_hit, r1,0, DAMAGE_MAGIC ,0); } } } @@ -3748,18 +3751,18 @@ void do_shockwave(location target) for (i = 0; i < 6; i++) if ((dist(target,pc_pos[i]) > 0) && (dist(target,pc_pos[i]) < 11) && (ADVEN[i].main_status == 1)) - damage_pc(i, get_ran(2 + dist(target,pc_pos[i]) / 2, 1, 6), 4,-1); + damage_pc(i, get_ran(2 + dist(target,pc_pos[i]) / 2, 1, 6), DAMAGE_UNBLOCKABLE,MONSTER_TYPE_UNKNOWN,0); for (i = 0; i < T_M; i++) if ((univ.town.monst.dudes[i].active != 0) && (dist(target,univ.town.monst.dudes[i].m_loc) > 0) && (dist(target,univ.town.monst.dudes[i].m_loc) < 11) && (can_see(target,univ.town.monst.dudes[i].m_loc,0) < 5)) - damage_monst(i, current_pc, get_ran(2 + dist(target,univ.town.monst.dudes[i].m_loc) / 2 , 1, 6), 0, 4); + damage_monst(i, current_pc, get_ran(2 + dist(target,univ.town.monst.dudes[i].m_loc) / 2 , 1, 6), 0, DAMAGE_UNBLOCKABLE,0); do_explosion_anim(5,0); end_missile_anim(); handle_marked_damage(); } -void radius_damage(location target,short radius, short dam, short type)//// +void radius_damage(location target,short radius, short dam, eDamageType type)//// { short i; @@ -3767,12 +3770,12 @@ void radius_damage(location target,short radius, short dam, short type)//// for (i = 0; i < 6; i++) if ((dist(target,univ.town.p_loc) > 0) && (dist(target,univ.town.p_loc) <= radius) && (ADVEN[i].main_status == 1)) - damage_pc(i, dam, type,-1); + damage_pc(i, dam, type,MONSTER_TYPE_UNKNOWN,0); for (i = 0; i < T_M; i++) if ((univ.town.monst.dudes[i].active != 0) && (dist(target,univ.town.monst.dudes[i].m_loc) > 0) && (dist(target,univ.town.monst.dudes[i].m_loc) <= radius) && (can_see(target,univ.town.monst.dudes[i].m_loc,0) < 5)) - damage_monst(i, current_pc, dam, 0, type); + damage_monst(i, current_pc, dam, 0, type,0); return; } @@ -3780,18 +3783,18 @@ void radius_damage(location target,short radius, short dam, short type)//// for (i = 0; i < 6; i++) if ((dist(target,pc_pos[i]) > 0) && (dist(target,pc_pos[i]) <= radius) && (ADVEN[i].main_status == 1)) - damage_pc(i, dam, type,-1); + damage_pc(i, dam, type,MONSTER_TYPE_UNKNOWN,0); for (i = 0; i < T_M; i++) if ((univ.town.monst.dudes[i].active != 0) && (dist(target,univ.town.monst.dudes[i].m_loc) > 0) && (dist(target,univ.town.monst.dudes[i].m_loc) <= radius) && (can_see(target,univ.town.monst.dudes[i].m_loc,0) < 5)) - damage_monst(i, current_pc, dam, 0, type); + damage_monst(i, current_pc, dam, 0, type,0); do_explosion_anim(5,0); end_missile_anim(); handle_marked_damage(); } // Slightly kludgy way to only damage PCs in space) -void hit_pcs_in_space(location target,short dam,short type,short report,short hit_all) +void hit_pcs_in_space(location target,short dam,eDamageType type,short report,short hit_all) { //short store_active[T_M],i; @@ -3804,7 +3807,7 @@ void hit_pcs_in_space(location target,short dam,short type,short report,short hi // univ.town.monst.dudes[i].active = store_active[i]; } -void hit_space(location target,short dam,short type,short report,short hit_all) +void hit_space(location target,short dam,eDamageType type,short report,short hit_all) //type; // 0 - weapon 1 - fire 2 - poison 3 - general magic 4 - unblockable 5 - cold // 6 - demon 7 - undead //short report; // 0 - no 1 - print result @@ -3836,8 +3839,8 @@ void hit_space(location target,short dam,short type,short report,short hit_all) if ((hit_monsters == TRUE) && (univ.town.monst.dudes[i].active != 0) && (stop_hitting == FALSE)) if (monst_on_space(target,i)) { if (processing_fields == TRUE) - damage_monst(i, 6, dam, 0, type); - else damage_monst(i, (monsters_going == TRUE) ? 7 : current_pc, dam, 0, type); + damage_monst(i, 6, dam, 0, type,0); + else damage_monst(i, (monsters_going == TRUE) ? 7 : current_pc, dam, 0, type,0); stop_hitting = (hit_all == 1) ? FALSE : TRUE; } @@ -3845,7 +3848,7 @@ void hit_space(location target,short dam,short type,short report,short hit_all) for (i = 0; i < 6; i++) if ((ADVEN[i].main_status == 1) && (stop_hitting == FALSE)) if (pc_pos[i] == target) { - damage_pc(i,dam,type,-1); + damage_pc(i,dam,type,MONSTER_TYPE_UNKNOWN,0); stop_hitting = (hit_all == 1) ? FALSE : TRUE; } if (overall_mode < MODE_COMBAT) @@ -3878,7 +3881,7 @@ void do_poison() if (ADVEN[i].main_status == 1) if (ADVEN[i].status[2] > 0) { r1 = get_ran(ADVEN[i].status[2],1,6); - damage_pc(i,r1,2,-1); + damage_pc(i,r1,DAMAGE_POISON,MONSTER_TYPE_UNKNOWN,0); if (get_ran(1,0,8) < 6) ADVEN[i].status[2] = move_to_zero(ADVEN[i].status[2]); if (get_ran(1,0,8) < 6) @@ -3956,7 +3959,7 @@ void handle_acid() if (ADVEN[i].main_status == 1) if (ADVEN[i].status[13] > 0) { r1 = get_ran(ADVEN[i].status[13],1,6); - damage_pc(i,r1,3,-1); + damage_pc(i,r1,DAMAGE_MAGIC,MONSTER_TYPE_UNKNOWN,0); ADVEN[i].status[13] = move_to_zero(ADVEN[i].status[13]); } if (overall_mode < MODE_COMBAT) @@ -4538,7 +4541,7 @@ void process_fields() if (is_force_wall(i,j)) { r1 = get_ran(3,1,6); loc.x = i; loc.y = j; - hit_pcs_in_space(loc,r1,3,1,1); + hit_pcs_in_space(loc,r1,DAMAGE_MAGIC,1,1); r1 = get_ran(1,1,6); if (r1 == 2) take_force_wall(i,j); @@ -4554,7 +4557,7 @@ void process_fields() if (is_fire_wall(i,j)) { loc.x = i; loc.y = j; r1 = get_ran(2,1,6) + 1; - hit_pcs_in_space(loc,r1,1,1,1); + hit_pcs_in_space(loc,r1,DAMAGE_FIRE,1,1); r1 = get_ran(1,1,4); if (r1 == 2) take_fire_wall(i,j); @@ -4609,7 +4612,7 @@ void process_fields() if (is_ice_wall(i,j)) { loc.x = i; loc.y = j; r1 = get_ran(3,1,6); - hit_pcs_in_space(loc,r1,5,1,1); + hit_pcs_in_space(loc,r1,DAMAGE_COLD,1,1); r1 = get_ran(1,1,6); if (r1 == 1) take_ice_wall(i,j); @@ -4625,7 +4628,7 @@ void process_fields() if (is_blade_wall(i,j)) { loc.x = i; loc.y = j; r1 = get_ran(6,1,8); - hit_pcs_in_space(loc,r1,0,1,1); + hit_pcs_in_space(loc,r1,DAMAGE_WEAPON,1,1); r1 = get_ran(1,1,5); if (r1 == 1) take_blade_wall(i,j); @@ -4645,7 +4648,7 @@ void process_fields() if (is_quickfire(i,j)) { loc.x = i; loc.y = j; r1 = get_ran(2,1,8); - hit_pcs_in_space(loc,r1,1,1,1); + hit_pcs_in_space(loc,r1,DAMAGE_FIRE,1,1); } } diff --git a/osx/boe.combat.h b/osx/boe.combat.h index 612827fb..36d693c1 100644 --- a/osx/boe.combat.h +++ b/osx/boe.combat.h @@ -19,7 +19,7 @@ void monst_fire_missile(short m_num,short skill,short bless,short level,location Boolean monst_breathe(cPopulation::cCreature *caster,location targ_space,short dam_type); Boolean monst_cast_mage(cPopulation::cCreature *caster,short targ); Boolean monst_cast_priest(cPopulation::cCreature *caster,short targ); -void damage_target(short target,short dam,short type); +void damage_target(short target,short dam,eDamageType type); location find_fireball_loc(location where,short radius,short mode,short *m); location closest_pc_loc(location where); short count_levels(location where,short radius); @@ -30,9 +30,9 @@ void place_spell_pattern(effect_pat_type pat,location center,short type,Boolean void handle_item_spell(location loc,short num); void modify_pattern(effect_pat_type *pat,short type); void do_shockwave(location target); -void radius_damage(location target,short radius, short dam, short type); -void hit_pcs_in_space(location target,short dam,short type,short report,short hit_all); -void hit_space(location target,short dam,short type,short report,short hit_all); +void radius_damage(location target,short radius, short dam, eDamageType type); +void hit_pcs_in_space(location target,short dam,eDamageType type,short report,short hit_all); +void hit_space(location target,short dam,eDamageType type,short report,short hit_all); void do_poison(); void handle_disease(); void handle_acid(); diff --git a/osx/boe.consts.h b/osx/boe.consts.h index 0ace3e5a..86cbef99 100644 --- a/osx/boe.consts.h +++ b/osx/boe.consts.h @@ -208,33 +208,109 @@ enum eGameMode { /* damage type*/ /* used as parameter to some functions */ -#define DAMAGE_WEAPON 0 -#define DAMAGE_FIRE 1 -#define DAMAGE_POISON 2 -#define DAMAGE_MAGIC 3 -#define DAMAGE_UNBLOCKABLE 4 //from the source files - the display is the same as the magic one (damage_monst in SPECIALS.cpp) -#define DAMAGE_COLD 5 -#define DAMAGE_UNDEAD 6 //from the source files - the display is the same as the weapon one -#define DAMAGE_DEMON 7 //from the source files - the display is the same as the weapon one +enum eDamageType { + DAMAGE_WEAPON = 0, + DAMAGE_FIRE = 1, + DAMAGE_POISON = 2, + DAMAGE_MAGIC = 3, + DAMAGE_UNBLOCKABLE = 4, //from the source files - the display is the same as the magic one (damage_monst in SPECIALS.cpp) + DAMAGE_COLD = 5, + DAMAGE_UNDEAD = 6, //from the source files - the display is the same as the weapon one + DAMAGE_DEMON = 7, //from the source files - the display is the same as the weapon one // 8 and 9 aren't defined : doesn't print any damage. According to the source files the 9 is DAMAGE_MARKED though. Wrong ? -#define DAMAGE_MARKED 10 // usage: DAMAGE_MARKED + damage_type -#define DAMAGE_NO_PRINT 30 // usage: DAMAGE_NO_PRINT + damage_type + DAMAGE_MARKED = 10, // usage: DAMAGE_MARKED + damage_type + DAMAGE_WEAPON_MARKED = 10, + DAMAGE_FIRE_MARKED = 11, + DAMAGE_POISON_MARKED = 12, + DAMAGE_MAGIC_MARKED = 13, + DAMAGE_UNBLOCKABLE_MARKED = 14, + DAMAGE_COLD_MARKED = 15, + DAMAGE_UNDEAD_MARKED = 16, + DAMAGE_DEMON_MARKED = 17, + DAMAGE_NO_PRINT = 30, // usage: DAMAGE_NO_PRINT + damage_type + DAMAGE_WEAPON_NO_PRINT = 30, + DAMAGE_FIRE_NO_PRINT = 31, + DAMAGE_POISON_NO_PRINT = 32, + DAMAGE_MAGIC_NO_PRINT = 33, + DAMAGE_UNBLOCKABLE_NO_PRINT = 34, + DAMAGE_COLD_NO_PRINT = 35, + DAMAGE_UNDEAD_NO_PRINT = 36, + DAMAGE_DEMON_NO_PRINT = 37, + // What about both NO_PRINT and MARKED? +}; + +inline void operator -= (eDamageType& cur, eDamageType othr){ + if((othr == DAMAGE_MARKED && cur >= DAMAGE_MARKED && cur < DAMAGE_NO_PRINT) || + (othr == DAMAGE_NO_PRINT && cur >= DAMAGE_NO_PRINT)) + cur = (eDamageType) ((int)cur - (int)othr); +} + +inline void operator += (eDamageType& cur, eDamageType othr){ + if((othr == DAMAGE_MARKED || othr == DAMAGE_NO_PRINT) && cur < DAMAGE_MARKED) + cur = (eDamageType) ((int)cur + (int)othr); +} +//inline eDamageType operator + (eDamageType lhs, eDamageType rhs){ +// if(lhs == DAMAGE_MARKED || lhs == DAMAGE_NO_PRINT){ +// if(rhs != DAMAGE_MARKED && rhs != DAMAGE_NO_PRINT) +// return (eDamageType) ((int)lhs + (int)rhs); +// }else if(rhs == DAMAGE_MARKED || rhs == DAMAGE_NO_PRINT) +// return (eDamageType) ((int)lhs + (int)rhs); +// else{ +// int a = lhs, b = rhs, c = 0; +// if(a > 30){ +// c += 30; +// a -= 30; +// if(b > 30) b -= 30; +// else if(b > 10) b -= 10; +// if(a == b) c += a; +// else c += 4; +// }else if(b > 30){ +// c += 30; +// b -= 30; +// if(a > 30) a -= 30; +// else if(a > 10) a -= 10; +// if(a == b) c += a; +// else c += 4; +// }else if(a > 10){ +// c += 10; +// a -= 10; +// if(b > 30){ +// b -= 30; +// c += 20; +// }else if(b > 10) b -= 10; +// if(a == b) c += a; +// else c += 4; +// }else if(b > 10){ +// c += 10; +// b -= 10; +// if(a > 30){ +// a -= 30; +// c += 20; +// }else if(a > 10) a -= 10; +// if(a == b) c += a; +// else c += 4; +// } +// return (eDamageType) c; // this SHOULD guarantee a valid result... +// } +//} /* trap type */ /* used in pc_record_type::runTrap(...) */ -#define TRAP_RANDOM 0 -#define TRAP_BLADE 1 -#define TRAP_DART 2 -#define TRAP_GAS 3 // poisons all -#define TRAP_EXPLOSION 4 // damages all => uses c_town.difficulty rather than trap_level to calculates damages (and even c_town.difficulty /13). -#define TRAP_SLEEP_RAY 5 -#define TRAP_FALSE_ALARM 6 -#define TRAP_DRAIN_XP 7 -#define TRAP_ALERT 8 // makes town hostile -#define TRAP_FLAMES 9 // damages all => uses trap_level (*5) to calculates damages. -#define TRAP_DUMBFOUND 10 //dumbfound all -#define TRAP_DISEASE 11 -#define TRAP_DISEASE_ALL 12 +enum eTrapType { + TRAP_RANDOM = 0, + TRAP_BLADE = 1, + TRAP_DART = 2, + TRAP_GAS = 3, // poisons all + TRAP_EXPLOSION = 4, // damages all => uses c_town.difficulty rather than trap_level to calculates damages (and even c_town.difficulty /13). + TRAP_SLEEP_RAY = 5, + TRAP_FALSE_ALARM = 6, + TRAP_DRAIN_XP = 7, + TRAP_ALERT = 8, // makes town hostile + TRAP_FLAMES = 9, // damages all => uses trap_level (*5) to calculates damages. + TRAP_DUMBFOUND = 10, //dumbfound all + TRAP_DISEASE = 11, + TRAP_DISEASE_ALL = 12, +}; /* items[i].type a.k.a type of weapon */ #define ITEM_EDGED 1 @@ -407,98 +483,6 @@ enum eGameMode { #define ITEM_MISSILE_SLAY_DEMON 175 #define ITEM_MISSILE_HEAL_TARGET 176 -/* Monsters Stuff */ - -/* Skills Same as PC */ - -/* Monster Type */ - -#define MONSTER_TYPE_HUMAN 0 -#define MONSTER_TYPE_REPTILE 1 -#define MONSTER_TYPE_BEAST 2 -#define MONSTER_TYPE_IMPORTANT 3 -#define MONSTER_TYPE_MAGE 4 -#define MONSTER_TYPE_PRIEST 5 -#define MONSTER_TYPE_HUMANOID 6 -#define MONSTER_TYPE_DEMON 7 -#define MONSTER_TYPE_UNDEAD 8 -#define MONSTER_TYPE_GIANT 9 -#define MONSTER_TYPE_SLIME 10 -#define MONSTER_TYPE_STONE 11 -#define MONSTER_TYPE_BUG 12 -#define MONSTER_TYPE_DRAGON 13 -#define MONSTER_TYPE_MAGICAL 14 - -/* Attack Types */ - -#define MONSTER_ATTACK_SWINGS 0 -#define MONSTER_ATTACK_CLAWS 1 -#define MONSTER_ATTACK_BITES 2 -#define MONSTER_ATTACK_SLIMES 3 -#define MONSTER_ATTACK_PUNCHES 4 -#define MONSTER_ATTACK_STINGS 5 -#define MONSTER_ATTACK_CLUBS 6 -#define MONSTER_ATTACK_BURNS 7 -#define MONSTER_ATTACK_HARMS 8 -#define MONSTER_ATTACK_STABS 9 - -/* Special Ability a.k.a spec_skill */ - -#define MONSTER_NO_SPECIAL_ABILITY 0 -#define MONSTER_THROWS_DARTS 1 -#define MONSTER_SHOOTS_ARROWS 2 -#define MONSTER_THROWS_SPEARS 3 -#define MONSTER_THROWS_ROCKS1 4 //4-24 damages -#define MONSTER_THROWS_ROCKS2 5 //5-30 damages -#define MONSTER_THROWS_ROCKS3 6 //6-36 damages -#define MONSTER_THROWS_RAZORDISKS 7 -#define MONSTER_PETRIFICATION_RAY 8 -#define MONSTER_SP_DRAIN_RAY 9 //spell points drain ray -#define MONSTER_HEAT_RAY 10 -#define MONSTER_INVISIBLE 11 -#define MONSTER_SPLITS 12 -#define MONSTER_MINDLESS 13 -#define MONSTER_BREATHES_STINKING_CLOUDS 14 -#define MONSTER_ICY_TOUCH 15 -#define MONSTER_XP_DRAINING_TOUCH 16 -#define MONSTER_ICY_AND_DRAINING_TOUCH 17 -#define MONSTER_SLOWING_TOUCH 18 -#define MONSTER_SHOOTS_WEB 19 -#define MONSTER_GOOD_ARCHER 20 -#define MONSTER_STEALS_FOOD 21 -#define MONSTER_PERMANENT_MARTYRS_SHIELD 22 -#define MONSTER_PARALYSIS_RAY 23 -#define MONSTER_DUMBFOUNDING_TOUCH 24 -#define MONSTER_DISEASE_TOUCH 25 -#define MONSTER_ABSORB_SPELLS 26 -#define MONSTER_WEB_TOUCH 27 -#define MONSTER_SLEEP_TOUCH 28 -#define MONSTER_PARALYSIS_TOUCH 29 -#define MONSTER_PETRIFICATION_TOUCH 30 -#define MONSTER_ACID_TOUCH 31 -#define MONSTER_BREATHES_SLEEP_CLOUDS 32 -#define MONSTER_ACID_SPIT 33 -#define MONSTER_SHOOTS_SPINES 34 -#define MONSTER_DEATH_TOUCH 35 -#define MONSTER_INVULNERABILITY 36 -#define MONSTER_GUARD 37 - -/* Create Monsters/Fields */ - -#define MONSTER_NO_RADIATE 0 -#define MONSTER_RADIATE_FIRE_FIELDS 1 -#define MONSTER_RADIATE_ICE_FIELDS 2 -#define MONSTER_RADIATE_SHOCK_FIELDS 3 -#define MONSTER_RADIATE_ANTIMAGIC_FIELDS 4 -#define MONSTER_RADIATE_SLEEP_FIELDS 5 -#define MONSTER_RADIATE_STINKING_CLOUDS 6 -//as said 7,8 and 9 are unused -#define MONSTER_SUMMON1 10 //5 percent chance -#define MONSTER_SUMMON2 11 //20 percent chance -#define MONSTER_SUMMON3 12 //50 percent chance -//as said 13 and 14 are unused -#define MONSTER_DEATH_TRIGGERS 15 //death triggers global special - /* Terrains Specials Properties : scenario.ter_types[i].special */ //complete #define TER_SPEC_NONE 0 diff --git a/osx/boe.monster.cpp b/osx/boe.monster.cpp index 26dc3589..062fdecf 100644 --- a/osx/boe.monster.cpp +++ b/osx/boe.monster.cpp @@ -928,17 +928,17 @@ void monst_inflict_fields(short which_monst) where_check.y = univ.town.monst.dudes[which_monst].m_loc.y + j; if (is_quickfire(where_check.x,where_check.y)) { r1 = get_ran(2,1,8); - damage_monst(which_monst,7,r1,0,1); + damage_monst(which_monst,7,r1,0,DAMAGE_FIRE,0); break; } if (is_blade_wall(where_check.x,where_check.y)) { r1 = get_ran(6,1,8); - damage_monst(which_monst,7,r1,0,0); + damage_monst(which_monst,7,r1,0,DAMAGE_WEAPON,0); break; } if (is_force_wall(where_check.x,where_check.y)) { r1 = get_ran(3,1,6); - damage_monst(which_monst,7,r1,0,3); + damage_monst(which_monst,7,r1,0,DAMAGE_MAGIC,0); break; } if (is_sleep_cloud(where_check.x,where_check.y)) { @@ -948,7 +948,7 @@ void monst_inflict_fields(short which_monst) if (is_ice_wall(where_check.x,where_check.y)) { r1 = get_ran(3,1,6); if (univ.town.monst.dudes[which_monst].m_d.spec_skill != 23) - damage_monst(which_monst,7,r1,0,5); + damage_monst(which_monst,7,r1,0,DAMAGE_COLD,0); break; } if (is_scloud(where_check.x,where_check.y)) { @@ -966,7 +966,7 @@ void monst_inflict_fields(short which_monst) if (is_fire_wall(where_check.x,where_check.y)) { r1 = get_ran(2,1,6); if (univ.town.monst.dudes[which_monst].m_d.spec_skill != 22) - damage_monst(which_monst,7,r1,0,1); + damage_monst(which_monst,7,r1,0,DAMAGE_FIRE,0); break; } } @@ -985,7 +985,7 @@ void monst_inflict_fields(short which_monst) take_barrel(where_check.x,where_check.y); if (is_fire_barrier(where_check.x,where_check.y)) { r1 = get_ran(2,1,10); - damage_monst(which_monst,7,r1,0,1); + damage_monst(which_monst,7,r1,0,DAMAGE_FIRE,0); } } diff --git a/osx/boe.party.cpp b/osx/boe.party.cpp index a08d42e6..708235b3 100644 --- a/osx/boe.party.cpp +++ b/osx/boe.party.cpp @@ -3174,14 +3174,14 @@ void void_sanctuary(short pc_num) } } -void hit_party(short how_much,short damage_type) +void hit_party(short how_much,eDamageType damage_type) { short i; Boolean dummy; for (i = 0; i < 6; i++) if (ADVEN[i].main_status == 1) - dummy = damage_pc(i,how_much,damage_type,-1); + dummy = damage_pc(i,how_much,damage_type,MONSTER_TYPE_UNKNOWN,0); // dummy = damage_pc(i,how_much,damage_type + 30); put_pc_screen(); } @@ -3197,25 +3197,25 @@ void slay_party(eMainStatus mode) put_pc_screen(); } -Boolean damage_pc(short which_pc,short how_much,short damage_type,short type_of_attacker) +Boolean damage_pc(short which_pc,short how_much,eDamageType damage_type,eMonsterType type_of_attacker, short sound_type) //short damage_type; // 0 - weapon 1 - fire 2 - poison 3 - general magic 4 - unblockable // 5 - cold 6 - undead attack 7 - demon attack // 10 - marked damage, from during anim mode ... no boom, and totally unblockable // 30 + * same as *, but no print // 100s digit - sound data { - short i, r1,sound_type,level; + short i, r1,level; Boolean do_print = TRUE; if (ADVEN[which_pc].main_status != 1) return FALSE; - sound_type = damage_type / 100; - damage_type = damage_type % 100; + //sound_type = damage_type / 100; + //damage_type = damage_type % 100; - if (damage_type >= 30) { + if (damage_type >= DAMAGE_NO_PRINT) { do_print = FALSE; - damage_type -= 30; + damage_type -= DAMAGE_NO_PRINT; } if (sound_type == 0) { @@ -3278,17 +3278,17 @@ Boolean damage_pc(short which_pc,short how_much,short damage_type,short type_of_ how_much -= 1; } - if ((damage_type == 0) && ((level = get_prot_level(which_pc,30)) > 0)) + if ((damage_type == DAMAGE_WEAPON) && ((level = get_prot_level(which_pc,30)) > 0)) how_much = how_much - level; - if ((damage_type == 6) && ((level = get_prot_level(which_pc,57)) > 0)) + if ((damage_type == DAMAGE_UNDEAD) && ((level = get_prot_level(which_pc,57)) > 0)) how_much = how_much / ((level >= 7) ? 4 : 2); - if ((damage_type == 7) && ((level = get_prot_level(which_pc,58)) > 0)) + 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 == 6) && ((level = get_prot_level(which_pc,59)) > 0)) + if ((type_of_attacker == MONSTER_TYPE_HUMANOID) && ((level = get_prot_level(which_pc,59)) > 0)) how_much = how_much / ((level >= 7) ? 4 : 2); - if ((type_of_attacker == 1) && ((level = get_prot_level(which_pc,60)) > 0)) + if ((type_of_attacker == MONSTER_TYPE_REPTILE) && ((level = get_prot_level(which_pc,60)) > 0)) how_much = how_much / ((level >= 7) ? 4 : 2); - if ((type_of_attacker == 9) && ((level = get_prot_level(which_pc,61)) > 0)) + if ((type_of_attacker == MONSTER_TYPE_GIANT) && ((level = get_prot_level(which_pc,61)) > 0)) how_much = how_much / ((level >= 7) ? 4 : 2); diff --git a/osx/boe.party.h b/osx/boe.party.h index 81f66913..ba404845 100644 --- a/osx/boe.party.h +++ b/osx/boe.party.h @@ -58,9 +58,9 @@ void poison_party(short how_much); void affect_pc(short which_pc,short type,short how_much); void affect_party(short type,short how_much); void void_sanctuary(short pc_num); -void hit_party(short how_much,short damage_type); +void hit_party(short how_much,eDamageType damage_type); void slay_party(eMainStatus mode); -Boolean damage_pc(short which_pc,short how_much,short damage_type,short type_of_attacker); +Boolean damage_pc(short which_pc,short how_much,eDamageType damage_type,eMonsterType type_of_attacker, short sound_type); void kill_pc(short which_pc,eMainStatus type); void set_pc_moves(); void take_ap(short num); diff --git a/osx/boe.specials.cpp b/osx/boe.specials.cpp index 8e296e4d..6bb2eaf6 100644 --- a/osx/boe.specials.cpp +++ b/osx/boe.specials.cpp @@ -145,7 +145,8 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho // sets forced to TRUE if definitely can enter { unsigned char ter; - short r1,i,choice,door_pc,ter_special,ter_flag1,ter_flag2,dam_type = 0,pic_type = 0,ter_pic = 0; + short r1,i,choice,door_pc,ter_special,ter_flag1,ter_flag2,pic_type = 0,ter_pic = 0; + eDamageType dam_type = DAMAGE_WEAPON; Boolean can_enter = TRUE; location out_where,from_loc,to_loc; short s1 = 0,s2 = 0,s3 = 0; @@ -297,7 +298,7 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho break; if (ter_special == 2) { add_string_to_buf(" It's hot!"); - dam_type = 1; pic_type = 0; + dam_type = DAMAGE_FIRE; pic_type = 0; if (PSD[SDF_PARTY_FIREWALK] > 0) { add_string_to_buf(" It doesn't affect you."); break; @@ -305,18 +306,18 @@ Boolean check_special_terrain(location where_check,short mode,short which_pc,sho } if (ter_special == 3) { add_string_to_buf(" You feel cold!"); - dam_type = 5; pic_type = 4; + dam_type = DAMAGE_COLD; pic_type = 4; } if (ter_special == 4) { add_string_to_buf(" Something shocks you!"); - dam_type = 3; pic_type = 1; + dam_type = DAMAGE_MAGIC; pic_type = 1; } r1 = get_ran(ter_flag2,dam_type,ter_flag1); if (mode < 2) - hit_party(r1,1); + hit_party(r1,DAMAGE_FIRE); fast_bang = 1; if (mode == 2) - damage_pc(which_pc,r1,dam_type,-1); + damage_pc(which_pc,r1,dam_type,MONSTER_TYPE_UNKNOWN,0); if (overall_mode < MODE_COMBAT) boom_space(univ.party.p_loc,overall_mode,pic_type,r1,12); fast_bang = 0; @@ -408,7 +409,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,1,-1); + damage_pc(which_pc,r1,DAMAGE_FIRE,MONSTER_TYPE_UNKNOWN,0); if (overall_mode < MODE_COMBAT) boom_space(univ.party.p_loc,overall_mode,0,r1,5); } @@ -418,7 +419,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,3,-1); + damage_pc(which_pc,r1,DAMAGE_MAGIC,MONSTER_TYPE_UNKNOWN,0); if (overall_mode < MODE_COMBAT) boom_space(univ.party.p_loc,overall_mode,1,r1,12); } @@ -428,7 +429,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,5,-1); + damage_pc(which_pc,r1,DAMAGE_COLD,MONSTER_TYPE_UNKNOWN,0); if (overall_mode < MODE_COMBAT) boom_space(univ.party.p_loc,overall_mode,4,r1,7); } @@ -438,7 +439,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,0,-1); + damage_pc(which_pc,r1,DAMAGE_WEAPON,MONSTER_TYPE_UNKNOWN,0); if (overall_mode < MODE_COMBAT) boom_space(univ.party.p_loc,overall_mode,3,r1,2); } @@ -448,7 +449,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,1,-1); + damage_pc(which_pc,r1,DAMAGE_FIRE,MONSTER_TYPE_UNKNOWN,0); if (overall_mode < MODE_COMBAT) boom_space(univ.party.p_loc,overall_mode,0,r1,5); } @@ -481,9 +482,9 @@ void check_fields(location where_check,short mode,short which_pc) add_string_to_buf(" Magic barrier! "); r1 = get_ran(2,1,10); if (mode < 2) - hit_party(r1,3); + hit_party(r1,DAMAGE_MAGIC); if (mode == 2) - damage_pc(which_pc,r1,3,-1); + damage_pc(which_pc,r1,DAMAGE_MAGIC,MONSTER_TYPE_UNKNOWN,0); if (overall_mode < MODE_COMBAT) boom_space(univ.party.p_loc,overall_mode,1,r1,12); } @@ -710,9 +711,9 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, case 87: switch (type) { case 0: ASB(" You feel better."); heal_pc(pc,str * 20); break; - case 1: ASB(" You feel sick."); damage_pc(pc,20 * str,4,0); break; + case 1: ASB(" You feel sick."); damage_pc(pc,20 * str,DAMAGE_UNBLOCKABLE,MONSTER_TYPE_HUMAN,0); break; case 2: ASB(" You all feel better."); heal_party(str * 20); break; - case 3: ASB(" You all feel sick."); hit_party(20 * str,4); break; + case 3: ASB(" You all feel sick."); hit_party(20 * str,DAMAGE_UNBLOCKABLE); break; } break; case 88: @@ -726,10 +727,10 @@ effect_pat_type s = {{{0,0,0,0,0,0,0,0,0}, case 89: switch (type) { case 0: - case 1: ASB(" You feel terrible."); drain_pc(pc,str * 5); damage_pc(pc,20 * str,4,0); disease_pc(pc,2 * str); dumbfound_pc(pc,2 * str); break; + case 1: ASB(" You feel terrible."); drain_pc(pc,str * 5); damage_pc(pc,20 * str,DAMAGE_UNBLOCKABLE,MONSTER_TYPE_HUMAN,0); disease_pc(pc,2 * str); dumbfound_pc(pc,2 * str); break; case 2: case 3: ASB(" You all feel terrible."); for (i = 0; i < 6; i++) { - drain_pc(i,str * 5); damage_pc(i,20 * str,4,0); disease_pc(i,2 * str); dumbfound_pc(i,2 * str);} break; + drain_pc(i,str * 5); damage_pc(i,20 * str,DAMAGE_UNBLOCKABLE,MONSTER_TYPE_HUMAN,0); disease_pc(i,2 * str); dumbfound_pc(i,2 * str);} break; } break; case 90: @@ -1159,7 +1160,7 @@ void change_level(short town_num,short x,short y) // Damaging and killing monsters needs to be here because several have specials attached to them. -Boolean damage_monst(short which_m, short who_hit, short how_much, short how_much_spec, short dam_type) +Boolean damage_monst(short which_m, short who_hit, short how_much, short how_much_spec, eDamageType dam_type, short sound_type) //short which_m, who_hit, how_much, how_much_spec; // 6 for who_hit means dist. xp evenly 7 for no xp //short dam_type; // 0 - weapon 1 - fire 2 - poison 3 - general magic 4 - unblockable 5 - cold // 6 - demon 7 - undead @@ -1168,7 +1169,7 @@ Boolean damage_monst(short which_m, short who_hit, short how_much, short how_muc // 100s digit - damage sound for boom space { cPopulation::cCreature *victim; - short r1,which_spot,sound_type; + short r1,which_spot; location where_put; Boolean do_print = TRUE; @@ -1178,12 +1179,12 @@ Boolean damage_monst(short which_m, short who_hit, short how_much, short how_muc if (univ.town.monst.dudes[which_m].active == 0) return FALSE; - sound_type = dam_type / 100; - dam_type = dam_type % 100; + //sound_type = dam_type / 100; + //dam_type = dam_type % 100; - if (dam_type >= 10) { + if (dam_type >= DAMAGE_MARKED) { // note: MARKED here actually means NO_PRINT do_print = FALSE; - dam_type -= 10; + dam_type -= DAMAGE_MARKED; } if (sound_type == 0) { @@ -2032,8 +2033,8 @@ void oneshot_spec(short which_mode,cSpecial cur_node,short cur_spec_type, if (i == 1) {set_sd = FALSE; *next_spec = -1; *a = 1;} else { if (is_combat() == TRUE) - j = run_trap(current_pc,spec.ex1a,spec.ex1b,spec.ex2a); - else j = run_trap(7,spec.ex1a,spec.ex1b,spec.ex2a); + j = run_trap(current_pc,(eTrapType)spec.ex1a,spec.ex1b,spec.ex2a); + else j = run_trap(7,(eTrapType)spec.ex1a,spec.ex1b,spec.ex2a); if (j == 0) { *a = 1; set_sd = FALSE; } @@ -2082,15 +2083,16 @@ void affect_spec(short which_mode,cSpecial cur_node,short cur_spec_type, if (i == 6)// && (spec.ex1b >= 0)) *next_spec = spec.ex1b; break; - case 81: + case 81:{ r1 = get_ran(spec.ex1a,1,spec.ex1b) + spec.ex2a; + eDamageType dam_type = (eDamageType) spec.ex2b; if (pc < 0) { if(spec.pic == 1 && overall_mode == MODE_COMBAT) - damage_pc(current_pc,r1,spec.ex2b,0); - else hit_party(r1,spec.ex2b); + damage_pc(current_pc,r1,dam_type,MONSTER_TYPE_HUMAN,0); + else hit_party(r1,dam_type); } - else damage_pc(pc,r1,spec.ex2b,0); - break; + else damage_pc(pc,r1,dam_type,MONSTER_TYPE_HUMAN,0); + break;} case 82: for (i = 0; i < 6; i++) if ((pc < 0) || (pc == i)) @@ -2532,13 +2534,13 @@ void townmode_spec(short which_mode,cSpecial cur_node,short cur_spec_type, case 175: if (which_mode == 7) break; - hit_space(l,spec.ex2a,spec.ex2b,1,1); + hit_space(l,spec.ex2a,(eDamageType) spec.ex2b,1,1); *redraw = 1; break; case 176: if (which_mode == 7) break; - radius_damage(l,spec.pic, spec.ex2a, spec.ex2b); + radius_damage(l,spec.pic, spec.ex2a, (eDamageType) spec.ex2b); *redraw = 1; break; case 177: diff --git a/osx/boe.specials.h b/osx/boe.specials.h index 3a5979ba..ba8947cc 100644 --- a/osx/boe.specials.h +++ b/osx/boe.specials.h @@ -9,7 +9,7 @@ Boolean use_space(location where); Boolean adj_town_look(location where); void PSOE(short str1a,short str1b,short str2a,short str2b, short which_special,unsigned char *stuff_done_val,short where_put); -Boolean damage_monst(short which_m, short who_hit, short how_much, short how_much_spec, short dam_type); +Boolean damage_monst(short which_m, short who_hit, short how_much, short how_much_spec, eDamageType dam_type, short sound_type); void kill_monst(cPopulation::cCreature *which_m,short who_killed); void special_increase_age(); void out_move_party(char x,char y) ; diff --git a/osx/boe.town.cpp b/osx/boe.town.cpp index edab00fa..b86b01e2 100644 --- a/osx/boe.town.cpp +++ b/osx/boe.town.cpp @@ -1216,7 +1216,7 @@ void bash_door(location where,short pc_num) //// unlock_adjust = scenario.ter_types[terrain].flag2; if ((unlock_adjust >= 5) || (r1 > (unlock_adjust * 15 + 40)) || (scenario.ter_types[terrain].special != 10)) { add_string_to_buf(" Didn't work. "); - damage_pc(pc_num,get_ran(1,1,4),4,-1); + damage_pc(pc_num,get_ran(1,1,4),DAMAGE_UNBLOCKABLE,MONSTER_TYPE_UNKNOWN,0); } else { add_string_to_buf(" Lock breaks. "); diff --git a/osx/boe.townspec.cpp b/osx/boe.townspec.cpp index a9079219..04e6d5e7 100644 --- a/osx/boe.townspec.cpp +++ b/osx/boe.townspec.cpp @@ -127,7 +127,7 @@ void DSG(short item_num,unsigned char *flip_bit,short dialog_num,short what_spec } -Boolean run_trap(short pc_num,short trap_type,short trap_level,short diff) +Boolean run_trap(short pc_num,eTrapType trap_type,short trap_level,short diff) //short pc_num; // 6 - BOOM! 7 - pick here //short trap_type; // 0 - random 1 - blade 2 - dart 3 - gas 4 - boom 5 - paralyze 6 - no // 7 - level drain 8 - alert 9 - big flames 10 - dumbfound 11 - disease 1 @@ -153,7 +153,7 @@ Boolean run_trap(short pc_num,short trap_type,short trap_level,short diff) num_hits += trap_level; if (trap_type == TRAP_RANDOM) - trap_type = get_ran(1,1,4); + trap_type = (eTrapType) get_ran(1,1,4); if (trap_type == TRAP_FALSE_ALARM) return TRUE; @@ -182,7 +182,7 @@ Boolean run_trap(short pc_num,short 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,0,-1); + damage_pc(pc_num,r1,DAMAGE_WEAPON,MONSTER_TYPE_UNKNOWN,0); } break; @@ -205,7 +205,7 @@ Boolean run_trap(short pc_num,short trap_type,short trap_level,short diff) for (i = 0; i < num_hits; i++) { add_string_to_buf(" There is an explosion. "); r1 = get_ran(3 + univ.town.difficulty / 13,1,8); - hit_party(r1,1); + hit_party(r1,DAMAGE_FIRE); } break; @@ -230,7 +230,7 @@ Boolean run_trap(short pc_num,short trap_type,short trap_level,short diff) case TRAP_FLAMES: add_string_to_buf(" Flames shoot from the walls. "); r1 = get_ran(10 + trap_level * 5,1,8); - hit_party(r1,1); + hit_party(r1,DAMAGE_FIRE); break; case TRAP_DUMBFOUND: add_string_to_buf(" You feel disoriented. "); diff --git a/osx/boe.townspec.h b/osx/boe.townspec.h index a03cedc7..fb73072e 100644 --- a/osx/boe.townspec.h +++ b/osx/boe.townspec.h @@ -3,7 +3,7 @@ Boolean special_trap(short trap_type,short dialog_num,short *flip_bit); void OTS(short str1b,short str2b,short str12a,short sound,unsigned char *flip_bit); void DSG(short item_num,unsigned char *flip_bit,short dialog_num,short what_spec,short amt_gold,short amt_food); Boolean GFI(short dialog_num); -Boolean run_trap(short pc_num,short trap_type,short trap_level,short diff); +Boolean run_trap(short pc_num,eTrapType trap_type,short trap_level,short diff); location get_spec_loc(short which); void start_split(short a,short b,short noise) ; diff --git a/osx/monster.cpp b/osx/monster.cpp index 0e9d647b..202e82c4 100644 --- a/osx/monster.cpp +++ b/osx/monster.cpp @@ -24,7 +24,7 @@ cMonster& cMonster::operator = (legacy::monster_record_type& old){ for(i = 0; i < 3; i++) a[i] = old.a[i]; a1_type = old.a1_type; a23_type = old.a23_type; - m_type = old.m_type; + m_type = (eMonsterType) old.m_type; speed = old.speed; ap = old.ap; mu = old.mu; diff --git a/osx/monster.h b/osx/monster.h index 2a458526..073743f8 100644 --- a/osx/monster.h +++ b/osx/monster.h @@ -7,6 +7,99 @@ */ namespace legacy { struct monster_record_type; }; +/* Monsters Stuff */ + +/* Skills Same as PC */ + +/* Monster Type */ +enum eMonsterType { + MONSTER_TYPE_UNKNOWN = -1, // for parameters to some functions; not valid in the class + MONSTER_TYPE_HUMAN = 0, + MONSTER_TYPE_REPTILE = 1, + MONSTER_TYPE_BEAST = 2, + MONSTER_TYPE_IMPORTANT = 3, + MONSTER_TYPE_MAGE = 4, + MONSTER_TYPE_PRIEST = 5, + MONSTER_TYPE_HUMANOID = 6, + MONSTER_TYPE_DEMON = 7, + MONSTER_TYPE_UNDEAD = 8, + MONSTER_TYPE_GIANT = 9, + MONSTER_TYPE_SLIME = 10, + MONSTER_TYPE_STONE = 11, + MONSTER_TYPE_BUG = 12, + MONSTER_TYPE_DRAGON = 13, + MONSTER_TYPE_MAGICAL = 14, +}; + +/* Attack Types */ + +#define MONSTER_ATTACK_SWINGS 0 +#define MONSTER_ATTACK_CLAWS 1 +#define MONSTER_ATTACK_BITES 2 +#define MONSTER_ATTACK_SLIMES 3 +#define MONSTER_ATTACK_PUNCHES 4 +#define MONSTER_ATTACK_STINGS 5 +#define MONSTER_ATTACK_CLUBS 6 +#define MONSTER_ATTACK_BURNS 7 +#define MONSTER_ATTACK_HARMS 8 +#define MONSTER_ATTACK_STABS 9 + +/* Special Ability a.k.a spec_skill */ + +#define MONSTER_NO_SPECIAL_ABILITY 0 +#define MONSTER_THROWS_DARTS 1 +#define MONSTER_SHOOTS_ARROWS 2 +#define MONSTER_THROWS_SPEARS 3 +#define MONSTER_THROWS_ROCKS1 4 //4-24 damages +#define MONSTER_THROWS_ROCKS2 5 //5-30 damages +#define MONSTER_THROWS_ROCKS3 6 //6-36 damages +#define MONSTER_THROWS_RAZORDISKS 7 +#define MONSTER_PETRIFICATION_RAY 8 +#define MONSTER_SP_DRAIN_RAY 9 //spell points drain ray +#define MONSTER_HEAT_RAY 10 +#define MONSTER_INVISIBLE 11 +#define MONSTER_SPLITS 12 +#define MONSTER_MINDLESS 13 +#define MONSTER_BREATHES_STINKING_CLOUDS 14 +#define MONSTER_ICY_TOUCH 15 +#define MONSTER_XP_DRAINING_TOUCH 16 +#define MONSTER_ICY_AND_DRAINING_TOUCH 17 +#define MONSTER_SLOWING_TOUCH 18 +#define MONSTER_SHOOTS_WEB 19 +#define MONSTER_GOOD_ARCHER 20 +#define MONSTER_STEALS_FOOD 21 +#define MONSTER_PERMANENT_MARTYRS_SHIELD 22 +#define MONSTER_PARALYSIS_RAY 23 +#define MONSTER_DUMBFOUNDING_TOUCH 24 +#define MONSTER_DISEASE_TOUCH 25 +#define MONSTER_ABSORB_SPELLS 26 +#define MONSTER_WEB_TOUCH 27 +#define MONSTER_SLEEP_TOUCH 28 +#define MONSTER_PARALYSIS_TOUCH 29 +#define MONSTER_PETRIFICATION_TOUCH 30 +#define MONSTER_ACID_TOUCH 31 +#define MONSTER_BREATHES_SLEEP_CLOUDS 32 +#define MONSTER_ACID_SPIT 33 +#define MONSTER_SHOOTS_SPINES 34 +#define MONSTER_DEATH_TOUCH 35 +#define MONSTER_INVULNERABILITY 36 +#define MONSTER_GUARD 37 + +/* Create Monsters/Fields */ + +#define MONSTER_NO_RADIATE 0 +#define MONSTER_RADIATE_FIRE_FIELDS 1 +#define MONSTER_RADIATE_ICE_FIELDS 2 +#define MONSTER_RADIATE_SHOCK_FIELDS 3 +#define MONSTER_RADIATE_ANTIMAGIC_FIELDS 4 +#define MONSTER_RADIATE_SLEEP_FIELDS 5 +#define MONSTER_RADIATE_STINKING_CLOUDS 6 +//as said 7,8 and 9 are unused +#define MONSTER_SUMMON1 10 //5 percent chance +#define MONSTER_SUMMON2 11 //20 percent chance +#define MONSTER_SUMMON3 12 //50 percent chance +//as said 13 and 14 are unused +#define MONSTER_DEATH_TRIGGERS 15 //death triggers global special class cMonster { public: @@ -14,7 +107,9 @@ public: short health,m_health,mp,max_mp; unsigned char armor,skill; short a[3]; - unsigned char a1_type,a23_type,m_type,speed,ap,mu,cl,breath,breath_type,treasure,spec_skill,poison; + unsigned char a1_type,a23_type; + eMonsterType m_type; + unsigned char speed,ap,mu,cl,breath,breath_type,treasure,spec_skill,poison; short morale,m_morale; short corpse_item,corpse_item_chance; short status[15];