diff --git a/src/boe.actions.cpp b/src/boe.actions.cpp index 0416531b..808c989a 100644 --- a/src/boe.actions.cpp +++ b/src/boe.actions.cpp @@ -1838,7 +1838,7 @@ bool handle_keystroke(sf::Event& event){ if((univ.town.monst[i].active > 0) && (univ.town.monst[i].attitude % 2 == 1) && (dist(univ.town.monst[i].cur_loc,univ.town.p_loc) <= 10) ) - damage_monst(i, 7,1000,0, DAMAGE_UNBLOCKABLE,0); + damage_monst(i, 7,1000,0, eDamageType::UNBLOCKABLE,0); } // kill_monst(&univ.town.monst[i],6); draw_terrain(); @@ -2339,7 +2339,7 @@ void increase_age() { add_string_to_buf("Starving! "); play_sound(66); r1 = get_ran(3,1,6); - hit_party(r1,DAMAGE_UNBLOCKABLE); + hit_party(r1,eDamageType::UNBLOCKABLE); update_stat = true; if(overall_mode < MODE_COMBAT) boom_space(univ.party.p_loc,overall_mode,0,r1,0); diff --git a/src/boe.combat.cpp b/src/boe.combat.cpp index 9b5a1e13..1d3dd4c6 100644 --- a/src/boe.combat.cpp +++ b/src/boe.combat.cpp @@ -573,7 +573,7 @@ void pc_attack(short who_att,short target) { r2 = get_ran(1,1,4) + dam_adj; if(r1 <= hit_chance[univ.party[who_att].skills[what_skill1]]) { - damage_monst(target, who_att, r2, 0,DAMAGE_WEAPON,4); + damage_monst(target, who_att, r2, 0,eDamageType::WEAPON,4); } else { draw_terrain(2); @@ -595,7 +595,7 @@ void pc_attack(short who_att,short target) { if((univ.town.monst[target].status[eStatus::MARTYRS_SHIELD] > 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,eRace::UNKNOWN,0); + damage_pc(who_att, store_hp - univ.town.monst[target].health, eDamageType::MAGIC,eRace::UNKNOWN,0); } combat_posing_monster = current_working_monster = -1; } @@ -647,17 +647,17 @@ void pc_attack_weapon(short who_att,short target,short hit_adj,short dam_adj,cIt switch(what_skill) { case eSkill::EDGED_WEAPONS: if(weap.item_level < 8) - damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON,1); - else damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON,2); + damage_monst(target, who_att, r2, spec_dam, eDamageType::WEAPON,1); + else damage_monst(target, who_att, r2, spec_dam, eDamageType::WEAPON,2); break; case eSkill::BASHING_WEAPONS: - damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON,4); + damage_monst(target, who_att, r2, spec_dam, eDamageType::WEAPON,4); break; case eSkill::POLE_WEAPONS: - damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON,3); + damage_monst(target, who_att, r2, spec_dam, eDamageType::WEAPON,3); break; default: // TODO: Not sure what sound to play for unconventional weapons, but let's just go with the generic "ouch" for now - damage_monst(target, who_att, r2, spec_dam, DAMAGE_WEAPON, 0); + damage_monst(target, who_att, r2, spec_dam, eDamageType::WEAPON, 0); break; } if(do_poison) { @@ -981,7 +981,7 @@ void do_combat_cast(location target) { case eSpell::BARRIER_FIRE: play_sound(68); r1 = get_ran(3,2,7); - hit_space(target,r1,DAMAGE_FIRE,true,true); + hit_space(target,r1,eDamageType::FIRE,true,true); univ.town.set_fire_barr(target.x,target.y,true); if(univ.town.is_fire_barr(target.x,target.y)) add_string_to_buf(" You create the barrier. "); @@ -990,7 +990,7 @@ void do_combat_cast(location target) { case eSpell::BARRIER_FORCE: play_sound(68); r1 = get_ran(7,2,7); - hit_space(target,r1,DAMAGE_FIRE,true,true); + hit_space(target,r1,eDamageType::FIRE,true,true); univ.town.set_force_barr(target.x,target.y,true); if(univ.town.is_force_barr(target.x,target.y)) add_string_to_buf(" You create the barrier. "); @@ -1005,7 +1005,7 @@ void do_combat_cast(location target) { add_missile(target,9,1,0,0); store_sound = 11; r1 = min(18,(level * 7) / 10 + 2 * bonus); - place_spell_pattern(radius2,target,DAMAGE_MAGIC,r1,current_pc); + place_spell_pattern(radius2,target,eDamageType::MAGIC,r1,current_pc); ashes_loc = target; break; @@ -1013,19 +1013,19 @@ void do_combat_cast(location target) { r1 = (spell_being_cast == eSpell::SPARK) ? get_ran(2,1,4) : get_ran(min(20,level + bonus),1,4); add_missile(target,6,1,0,0); do_missile_anim(100,univ.party[current_pc].combat_pos,11); - hit_space(target,r1,(spell_being_cast == eSpell::SPARK) ? DAMAGE_MAGIC : DAMAGE_COLD,1,0); + hit_space(target,r1,(spell_being_cast == eSpell::SPARK) ? eDamageType::MAGIC : eDamageType::COLD,1,0); break; case eSpell::ARROWS_FLAME: add_missile(target,4,1,0,0); r1 = get_ran(2,1,4); - boom_type[i] = DAMAGE_FIRE; + boom_type[i] = eDamageType::FIRE; boom_dam[i] = r1; //hit_space(target,r1,1,1,0); break; case eSpell::SMITE: add_missile(target,6,1,0,0); r1 = get_ran(2,1,5); - boom_type[i] = DAMAGE_COLD; + boom_type[i] = eDamageType::COLD; boom_dam[i] = r1; //hit_space(target,r1,5,1,0); break; @@ -1036,13 +1036,13 @@ void do_combat_cast(location target) { else r1 = get_ran(min(7,2 + bonus + level / 2),1,4); add_missile(target,14,1,0,0); do_missile_anim(100,univ.party[current_pc].combat_pos,24); - hit_space(target,r1,DAMAGE_UNBLOCKABLE,1,0); + hit_space(target,r1,eDamageType::UNBLOCKABLE,1,0); break; case eSpell::FLAME: r1 = get_ran(min(10,1 + level / 3 + bonus),1,6); add_missile(target,2,1,0,0); do_missile_anim(100,univ.party[current_pc].combat_pos,11); - hit_space(target,r1,DAMAGE_FIRE,1,0); + hit_space(target,r1,eDamageType::FIRE,1,0); break; case eSpell::FIREBALL: case eSpell::FLAMESTRIKE: r1 = min(9,1 + (level * 2) / 3 + bonus) + 1; @@ -1053,7 +1053,7 @@ void do_combat_cast(location target) { r1 = (r1 * 14) / 10; else if(r1 > 10) r1 = (r1 * 8) / 10; if(r1 <= 0) r1 = 1; - place_spell_pattern(square,target,DAMAGE_FIRE,r1,current_pc); + place_spell_pattern(square,target,eDamageType::FIRE,r1,current_pc); ashes_loc = target; break; case eSpell::FIRESTORM: @@ -1063,20 +1063,20 @@ void do_combat_cast(location target) { r1 = min(12,1 + (level * 2) / 3 + bonus) + 2; if(r1 > 20) r1 = (r1 * 8) / 10; - place_spell_pattern(radius2,target,DAMAGE_FIRE,r1,current_pc); + place_spell_pattern(radius2,target,eDamageType::FIRE,r1,current_pc); ashes_loc = target; break; case eSpell::KILL: add_missile(target,9,1,0,0); do_missile_anim(100,univ.party[current_pc].combat_pos,11); r1 = get_ran(3,0,10) + univ.party[current_pc].level * 2; - hit_space(target,40 + r1,DAMAGE_MAGIC,1,0); + hit_space(target,40 + r1,eDamageType::MAGIC,1,0); break; case eSpell::ARROWS_DEATH: add_missile(target,9,1,0,0); store_sound = 11; r1 = get_ran(3,0,10) + univ.party[current_pc].level + 3 * bonus; - boom_type[i] = DAMAGE_MAGIC; + boom_type[i] = eDamageType::MAGIC; boom_dam[i] = r1; //hit_space(target,40 + r1,3,1,0); break; @@ -1174,7 +1174,7 @@ void do_combat_cast(location target) { store_sound = 53; r1 = get_ran(4,1,8); r2 = get_ran(1,0,2); - damage_monst(targ_num, 7, r1, 0, DAMAGE_MAGIC,0); + damage_monst(targ_num, 7, r1, 0, eDamageType::MAGIC,0); slow_monst(cur_monst, 4 + r2); poison_monst(cur_monst, 5 + r2); break; @@ -1304,7 +1304,7 @@ void do_combat_cast(location target) { else { r1 = get_ran((spell_being_cast == eSpell::TURN_UNDEAD) ? 2 : 6, 1, 14); - hit_space(cur_monst->cur_loc,r1,DAMAGE_UNBLOCKABLE,0,current_pc); + hit_space(cur_monst->cur_loc,r1,eDamageType::UNBLOCKABLE,0,current_pc); } store_sound = 24; break; @@ -1323,7 +1323,7 @@ void do_combat_cast(location target) { //if(PSD[4][0] == 3) // anama // r1 += 25; //play_sound(53); - hit_space(cur_monst->cur_loc,r1,DAMAGE_UNBLOCKABLE,0,current_pc); + hit_space(cur_monst->cur_loc,r1,eDamageType::UNBLOCKABLE,0,current_pc); } store_sound = 24; break; @@ -1365,12 +1365,12 @@ void handle_marked_damage() { for(i = 0; i < 6; i++) if(univ.party[i].marked_damage > 0) { // TODO: Perhaps there should be a way of determining the correct race here? - damage_pc(i,univ.party[i].marked_damage,DAMAGE_MARKED,eRace::UNKNOWN,0); + damage_pc(i,univ.party[i].marked_damage,eDamageType::MARKED,eRace::UNKNOWN,0); univ.party[i].marked_damage = 0; } for(i = 0; i < univ.town->max_monst(); i++) if(monst_marked_damage[i] > 0) { - damage_monst(i, current_pc, monst_marked_damage[i], 0, DAMAGE_MARKED,0); // was 9 rather than 10; probably a mistake + damage_monst(i, current_pc, monst_marked_damage[i], 0, eDamageType::MARKED,0); // was 9 rather than 10; probably a mistake monst_marked_damage[i] = 0; } @@ -1494,7 +1494,7 @@ void fire_missile(location target) { pause(dist(univ.party[current_pc].combat_pos,target)*5); run_a_missile(univ.party[missile_firer].combat_pos,target,2,1,5,0,0,100); start_missile_anim(); - place_spell_pattern(radius2,target, DAMAGE_FIRE,univ.party[missile_firer].items[ammo_inv_slot].abil_data[0] * 2,missile_firer); + place_spell_pattern(radius2,target, eDamageType::FIRE,univ.party[missile_firer].items[ammo_inv_slot].abil_data[0] * 2,missile_firer); do_explosion_anim(5,0); end_missile_anim(); handle_marked_damage(); @@ -1545,7 +1545,7 @@ void fire_missile(location target) { ASB(" There is a flash of light."); cur_monst->health += r2; } - else damage_monst(targ_monst, missile_firer, r2, spec_dam, DAMAGE_WEAPON,13); + else damage_monst(targ_monst, missile_firer, r2, spec_dam, eDamageType::WEAPON,13); //if(univ.party[missile_firer].items[ammo_inv_slot].ability == 33) // hit_space(cur_monst->m_loc,get_ran(3,1,6),1,1,1); @@ -1562,7 +1562,7 @@ void fire_missile(location target) { ASB(" There is a flash of light."); heal_pc(targ_monst,r2); } - else hit_space(target,r2,DAMAGE_WEAPON,1,0); + else hit_space(target,r2,eDamageType::WEAPON,1,0); } @@ -2192,7 +2192,7 @@ void do_monster_turn() { printed_acid = true; } r1 = get_ran(cur_monst->status[eStatus::ACID],1,6); - damage_monst(i, 6,r1, 0, DAMAGE_MAGIC,0); + damage_monst(i, 6,r1, 0, eDamageType::MAGIC,0); cur_monst->status[eStatus::ACID]--; } @@ -2212,7 +2212,7 @@ void do_monster_turn() { printed_poison = true; } r1 = get_ran(cur_monst->status[eStatus::POISON],1,6); - damage_monst(i, 6, r1, 0, DAMAGE_POISON,0); + damage_monst(i, 6, r1, 0, eDamageType::POISON,0); cur_monst->status[eStatus::POISON]--; } if(cur_monst->status[eStatus::DISEASE] > 0) { // Disease @@ -2255,7 +2255,7 @@ void do_monster_turn() { void monster_attack_pc(short who_att,short target) { cCreature *attacker; short r1,r2,i,store_hp,sound_type = 0; - eDamageType dam_type = DAMAGE_WEAPON; + eDamageType dam_type = eDamageType::WEAPON; attacker = &univ.town.monst[who_att]; @@ -2315,13 +2315,12 @@ void monster_attack_pc(short who_att,short target) { // Check if hit, and do effects if(r1 <= hit_chance[(attacker->skill + 4) / 2]) { if(attacker->m_type == eRace::UNDEAD) - dam_type = DAMAGE_UNDEAD; + dam_type = eDamageType::UNDEAD; if(attacker->m_type == eRace::DEMON) - dam_type = DAMAGE_DEMON; + dam_type = eDamageType::DEMON; store_hp = univ.party[target].cur_health; sound_type = get_monst_sound(attacker,i); - dam_type += DAMAGE_MARKED; if(damage_pc(target,r2,dam_type, attacker->m_type,sound_type) && (store_hp - univ.party[target].cur_health > 0)) { @@ -2330,7 +2329,7 @@ void monster_attack_pc(short who_att,short target) { if(univ.party[target].status[eStatus::MARTYRS_SHIELD] > 0) { add_string_to_buf(" Shares damage! "); - damage_monst(who_att, 6, store_hp - univ.party[target].cur_health, 0, DAMAGE_MAGIC,0); + damage_monst(who_att, 6, store_hp - univ.party[target].cur_health, 0, eDamageType::MAGIC,0); } if((attacker->poison > 0) && (i == 0)) { @@ -2412,13 +2411,13 @@ void monster_attack_pc(short who_att,short target) { && (get_ran(1,0,8) < 6) && (pc_has_abil_equip(target,eItemAbil::LIFE_SAVING) == 24)) { add_string_to_buf(" Freezing touch!"); r1 = get_ran(3,1,10); - damage_pc(target,r1,DAMAGE_COLD,eRace::UNKNOWN,0); + damage_pc(target,r1,eDamageType::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,eRace::UNKNOWN,0); + damage_pc(target,r1,eDamageType::UNBLOCKABLE,eRace::UNKNOWN,0); } } } @@ -2443,7 +2442,7 @@ void monster_attack_pc(short who_att,short target) { void monster_attack_monster(short who_att,short attackee) { cCreature *attacker,*target; short r1,r2,i,store_hp,sound_type = 0; - eDamageType dam_type = DAMAGE_WEAPON; + eDamageType dam_type = eDamageType::WEAPON; attacker = &univ.town.monst[who_att]; target = &univ.town.monst[attackee]; @@ -2486,14 +2485,13 @@ void monster_attack_monster(short who_att,short attackee) { // Check if hit, and do effects if(r1 <= hit_chance[(attacker->skill + 4) / 2]) { if(attacker->m_type == eRace::DEMON) - dam_type = DAMAGE_DEMON; + dam_type = eDamageType::DEMON; if(attacker->m_type == eRace::UNDEAD) - dam_type = DAMAGE_UNDEAD; + dam_type = eDamageType::UNDEAD; store_hp = target->health; sound_type = get_monst_sound(attacker,i); - dam_type += DAMAGE_MARKED; - if(damage_monst(attackee,7,r2,0,dam_type,sound_type)) { + if(damage_monst(attackee,7,r2,0,dam_type,sound_type,false)) { damaged_message(store_hp - target->health, attacker->a[i].type); @@ -2551,7 +2549,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,DAMAGE_COLD,0); + damage_monst(attackee,7,r1,0,eDamageType::COLD,0); } // Death touch @@ -2559,7 +2557,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,DAMAGE_UNBLOCKABLE,0); + damage_monst(attackee,7,r1,0,eDamageType::UNBLOCKABLE,0); } } } @@ -2707,11 +2705,11 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor if(target < 100) { // pc std::string create_line = " Hits " + univ.party[target].name + " with heat ray."; add_string_to_buf(create_line); - damage_pc(target,r1,DAMAGE_FIRE,eRace::UNKNOWN,0); + damage_pc(target,r1,eDamageType::FIRE,eRace::UNKNOWN,0); } else { // on monst add_string_to_buf(" Fires heat ray."); - damage_monst(target - 100,7,r1,0,DAMAGE_FIRE,0); + damage_monst(target - 100,7,r1,0,eDamageType::FIRE,0); } do_explosion_anim(5,0); end_missile_anim(); @@ -2777,7 +2775,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,eRace::UNKNOWN,13)) { + if(damage_pc(target,r2,eDamageType::WEAPON,eRace::UNKNOWN,13)) { // TODO: Uh, is something supposed to happen here!? } } @@ -2817,7 +2815,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor if(r1 <= hit_chance[dam[level] * 2]) { // monst_spell_note(m_target->number,16); - damage_monst(target - 100,7,r2,0,DAMAGE_WEAPON,13); + damage_monst(target - 100,7,r2,0,eDamageType::WEAPON,13); } else { monst_spell_note(m_target->number,18); @@ -2829,7 +2827,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor //dam_type; // 0 - fire 1 - cold 2 - magic bool monst_breathe(cCreature *caster,location targ_space,short dam_type) { short level,missile_t[4] = {13,6,8,8}; - eDamageType type[4] = {DAMAGE_FIRE, DAMAGE_COLD, DAMAGE_MAGIC, DAMAGE_UNBLOCKABLE}; + eDamageType type[4] = {eDamageType::FIRE, eDamageType::COLD, eDamageType::MAGIC, eDamageType::UNBLOCKABLE}; location l; draw_terrain(2); @@ -3014,7 +3012,7 @@ bool monst_cast_mage(cCreature *caster,short targ) { case eSpell::SPARK: run_a_missile(l,vict_loc,6,1,11,0,0,80); r1 = get_ran(2,1,4); - damage_target(targ,r1,DAMAGE_MAGIC); + damage_target(targ,r1,eDamageType::MAGIC); break; case eSpell::HASTE_MINOR: play_sound(25); @@ -3032,7 +3030,7 @@ bool monst_cast_mage(cCreature *caster,short targ) { run_a_missile(l,vict_loc,2,1,11,0,0,80); start_missile_anim(); r1 = get_ran(min(15,caster->level),1,4); - damage_target(targ,r1,DAMAGE_FIRE); + damage_target(targ,r1,eDamageType::FIRE); break; case eSpell::POISON_MINOR: run_a_missile(l,vict_loc,11,0,25,0,0,80); @@ -3075,7 +3073,7 @@ bool monst_cast_mage(cCreature *caster,short targ) { if(r1 > 29) r1 = 29; run_a_missile(l,target,2,1,11,0,0,80); start_missile_anim(); - place_spell_pattern(square,target,DAMAGE_FIRE,r1,7); + place_spell_pattern(square,target,eDamageType::FIRE,r1,7); ashes_loc = target; break; case eSpell::SUMMON_WEAK: case eSpell::SUMMON: case eSpell::SUMMON_MAJOR: @@ -3123,7 +3121,7 @@ bool monst_cast_mage(cCreature *caster,short targ) { run_a_missile(l,vict_loc,6,1,11,0,0,80); r1 = get_ran(5 + (caster->level / 5),1,8); start_missile_anim(); - damage_target(targ,r1,DAMAGE_COLD); + damage_target(targ,r1,eDamageType::COLD); break; case eSpell::SLOW_GROUP: play_sound(25); @@ -3155,7 +3153,7 @@ bool monst_cast_mage(cCreature *caster,short targ) { r1 = 1 + (caster->level * 3) / 4 + 3; if(r1 > 29) r1 = 29; start_missile_anim(); - place_spell_pattern(radius2,target,DAMAGE_FIRE,r1,7); + place_spell_pattern(radius2,target,eDamageType::FIRE,r1,7); ashes_loc = target; break; case eSpell::SHOCKSTORM: @@ -3173,7 +3171,7 @@ bool monst_cast_mage(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,DAMAGE_MAGIC); + damage_target(targ,r1,eDamageType::MAGIC); break; case eSpell::DEMON: x = get_ran(3,1,4); @@ -3338,7 +3336,7 @@ bool monst_cast_priest(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,DAMAGE_UNBLOCKABLE); + damage_target(targ,r1,eDamageType::UNBLOCKABLE); break; case eSpell::GOO: play_sound(24); @@ -3360,7 +3358,7 @@ bool monst_cast_priest(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,DAMAGE_UNBLOCKABLE); + damage_target(targ,r1,eDamageType::UNBLOCKABLE); break; case eSpell::SUMMON_SPIRIT: case eSpell::SUMMON_GUARDIAN: play_sound(24); @@ -3396,7 +3394,7 @@ bool monst_cast_priest(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,DAMAGE_COLD); + damage_target(targ,r1,eDamageType::COLD); break; case eSpell::STICKS_TO_SNAKES: // sticks to snakes play_sound(24); @@ -3481,14 +3479,14 @@ bool monst_cast_priest(cCreature *caster,short targ) { run_a_missile(l,target,2,0,11,0,0,80); r1 = 2 + caster->level / 2 + 2; start_missile_anim(); - place_spell_pattern(square,target,DAMAGE_FIRE,r1,7); + place_spell_pattern(square,target,eDamageType::FIRE,r1,7); ashes_loc = target; break; case eSpell::UNHOLY_RAVAGING: 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,DAMAGE_MAGIC); + damage_target(targ,r1,eDamageType::MAGIC); if(targ < 6) { slow_pc(targ,6); poison_pc(targ,5 + r2); @@ -3515,7 +3513,7 @@ bool monst_cast_priest(cCreature *caster,short targ) { r1 = (caster->level * 3) / 4 + 5; if(r1 > 29) r1 = 29; start_missile_anim(); - place_spell_pattern(radius2,target,DAMAGE_MAGIC,r1,7 ); + place_spell_pattern(radius2,target,eDamageType::MAGIC,r1,7 ); ashes_loc = target; break; } @@ -3617,7 +3615,7 @@ bool monst_near(short m_num,location where,short radius,short active) { } void fireball_space(location loc,short dam) { - place_spell_pattern(square,loc,DAMAGE_FIRE,dam,7); + place_spell_pattern(square,loc,eDamageType::FIRE,dam,7); } //type; // 0 - take codes in pattern, OW make all nonzero this type @@ -3753,57 +3751,57 @@ static void place_spell_pattern(effect_pat_type pat,location center,unsigned sho switch(effect) { case WALL_FORCE: r1 = get_ran(2,1,6); - damage_pc(k,r1,DAMAGE_MAGIC,eRace::UNKNOWN,0); + damage_pc(k,r1,eDamageType::MAGIC,eRace::UNKNOWN,0); break; case WALL_FIRE: r1 = get_ran(1,1,6) + 1; - damage_pc(k,r1,DAMAGE_FIRE,eRace::UNKNOWN,0); + damage_pc(k,r1,eDamageType::FIRE,eRace::UNKNOWN,0); break; case WALL_ICE: r1 = get_ran(2,1,6); - damage_pc(k,r1,DAMAGE_COLD,eRace::UNKNOWN,0); + damage_pc(k,r1,eDamageType::COLD,eRace::UNKNOWN,0); break; case WALL_BLADES: r1 = get_ran(4,1,8); - damage_pc(k,r1,DAMAGE_WEAPON,eRace::UNKNOWN,0); + damage_pc(k,r1,eDamageType::WEAPON,eRace::UNKNOWN,0); break; case OBJECT_BLOCK: r1 = get_ran(6,1,8); - damage_pc(k,r1,DAMAGE_WEAPON,eRace::UNKNOWN,0); + damage_pc(k,r1,eDamageType::WEAPON,eRace::UNKNOWN,0); break; case BARRIER_CAGE: univ.party[k].status[eStatus::FORCECAGE] = 8; break; default: - eDamageType type = DAMAGE_MARKED; + eDamageType type = eDamageType::MARKED; unsigned short dice; if(effect > 50 && effect <= 80) { - type = DAMAGE_FIRE; + type = eDamageType::FIRE; dice = effect - 50; } else if(effect > 90 && effect <= 120) { - type = DAMAGE_COLD; + type = eDamageType::COLD; dice = effect - 90; } else if(effect > 130 && effect <= 160) { - type = DAMAGE_MAGIC; + type = eDamageType::MAGIC; dice = effect - 130; // The rest of these are new, currently unused. } else if(effect > 170 && effect <= 200) { - type = DAMAGE_WEAPON; + type = eDamageType::WEAPON; dice = effect - 170; } else if(effect > 210 && effect <= 240) { - type = DAMAGE_POISON; + type = eDamageType::POISON; dice = effect - 210; } else if(effect > 250 && effect <= 280) { - type = DAMAGE_UNBLOCKABLE; + type = eDamageType::UNBLOCKABLE; dice = effect - 250; } else if(effect > 290 && effect <= 320) { - type = DAMAGE_UNDEAD; + type = eDamageType::UNDEAD; dice = effect - 290; } else if(effect > 330 && effect <= 360) { - type = DAMAGE_DEMON; + type = eDamageType::DEMON; dice = effect - 330; } - if(type == DAMAGE_MARKED) break; + if(type == eDamageType::MARKED) break; r1 = get_ran(dice,1,6); damage_pc(k,r1,type,eRace::UNKNOWN,0); break; @@ -3835,14 +3833,14 @@ static void place_spell_pattern(effect_pat_type pat,location center,unsigned sho break; case WALL_FORCE: r1 = get_ran(3,1,6); - damage_monst(k, who_hit, r1,0, DAMAGE_MAGIC,0); + damage_monst(k, who_hit, r1,0, eDamageType::MAGIC,0); break; case WALL_FIRE: r1 = get_ran(2,1,6); which_m = &univ.town.monst[k]; if(which_m->spec_skill == 22) break; - damage_monst(k, who_hit, r1,0, DAMAGE_FIRE,0); + damage_monst(k, who_hit, r1,0, eDamageType::FIRE,0); break; case CLOUD_STINK: which_m = &univ.town.monst[k]; @@ -3853,11 +3851,11 @@ static void place_spell_pattern(effect_pat_type pat,location center,unsigned sho r1 = get_ran(3,1,6); if(which_m->spec_skill == 23) break; - damage_monst(k, who_hit, r1,0, DAMAGE_COLD,0); + damage_monst(k, who_hit, r1,0, eDamageType::COLD,0); break; case WALL_BLADES: r1 = get_ran(6,1,8); - damage_monst(k, who_hit, r1,0, DAMAGE_WEAPON,0); + damage_monst(k, who_hit, r1,0, eDamageType::WEAPON,0); break; case CLOUD_SLEEP: which_m = &univ.town.monst[k]; @@ -3865,41 +3863,41 @@ static void place_spell_pattern(effect_pat_type pat,location center,unsigned sho break; case OBJECT_BLOCK: r1 = get_ran(6,1,8); - damage_monst(k,who_hit,r1,0,DAMAGE_WEAPON,0); + damage_monst(k,who_hit,r1,0,eDamageType::WEAPON,0); break; case BARRIER_CAGE: univ.town.monst[k].status[eStatus::FORCECAGE] = 8; break; default: - eDamageType type = DAMAGE_MARKED; + eDamageType type = eDamageType::MARKED; unsigned short dice; if(effect > 50 && effect <= 80) { - type = DAMAGE_FIRE; + type = eDamageType::FIRE; dice = effect - 50; } else if(effect > 90 && effect <= 120) { - type = DAMAGE_COLD; + type = eDamageType::COLD; dice = effect - 90; } else if(effect > 130 && effect <= 160) { - type = DAMAGE_MAGIC; + type = eDamageType::MAGIC; dice = effect - 130; // The rest of these are new, currently unused. } else if(effect > 170 && effect <= 200) { - type = DAMAGE_WEAPON; + type = eDamageType::WEAPON; dice = effect - 170; } else if(effect > 210 && effect <= 240) { - type = DAMAGE_POISON; + type = eDamageType::POISON; dice = effect - 210; } else if(effect > 250 && effect <= 280) { - type = DAMAGE_UNBLOCKABLE; + type = eDamageType::UNBLOCKABLE; dice = effect - 250; } else if(effect > 290 && effect <= 320) { - type = DAMAGE_UNDEAD; + type = eDamageType::UNDEAD; dice = effect - 290; } else if(effect > 330 && effect <= 360) { - type = DAMAGE_DEMON; + type = eDamageType::DEMON; dice = effect - 330; } - if(type == DAMAGE_MARKED) break; + if(type == eDamageType::MARKED) break; r1 = get_ran(dice,1,6); damage_monst(k,who_hit,r1,0,type,0); break; @@ -3924,15 +3922,15 @@ void place_spell_pattern(effect_pat_type pat,location center,eDamageType type,sh unsigned short code; dice = minmax(1, 30, dice); switch(type) { - case DAMAGE_FIRE: code = 50; break; - case DAMAGE_COLD: code = 90; break; - case DAMAGE_MAGIC: code = 130; break; + case eDamageType::FIRE: code = 50; break; + case eDamageType::COLD: code = 90; break; + case eDamageType::MAGIC: code = 130; break; // TODO: These are new; nothing actually uses them, but maybe eventually! - case DAMAGE_WEAPON: code = 170; break; - case DAMAGE_POISON: code = 210; break; - case DAMAGE_UNBLOCKABLE: code = 250; break; - case DAMAGE_UNDEAD: code = 290; break; - case DAMAGE_DEMON: code = 330; break; + case eDamageType::WEAPON: code = 170; break; + case eDamageType::POISON: code = 210; break; + case eDamageType::UNBLOCKABLE: code = 250; break; + case eDamageType::UNDEAD: code = 290; break; + case eDamageType::DEMON: code = 330; break; } place_spell_pattern(pat, center, code + dice, who_hit); } @@ -3953,12 +3951,12 @@ void do_shockwave(location target) { for(i = 0; i < 6; i++) if((dist(target,univ.party[i].combat_pos) > 0) && (dist(target,univ.party[i].combat_pos) < 11) && univ.party[i].main_status == eMainStatus::ALIVE) - damage_pc(i, get_ran(2 + dist(target,univ.party[i].combat_pos) / 2, 1, 6), DAMAGE_UNBLOCKABLE,eRace::UNKNOWN,0); + damage_pc(i, get_ran(2 + dist(target,univ.party[i].combat_pos) / 2, 1, 6), eDamageType::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) && (can_see_light(target,univ.town.monst[i].cur_loc,sight_obscurity) < 5)) - damage_monst(i, current_pc, get_ran(2 + dist(target,univ.town.monst[i].cur_loc) / 2 , 1, 6), 0, DAMAGE_UNBLOCKABLE,0); + damage_monst(i, current_pc, get_ran(2 + dist(target,univ.town.monst[i].cur_loc) / 2 , 1, 6), 0, eDamageType::UNBLOCKABLE,0); do_explosion_anim(5,0); end_missile_anim(); handle_marked_damage(); @@ -4024,7 +4022,7 @@ void hit_space(location target,short dam,eDamageType type,short report,short hit hit_all -= 10; } - if((univ.town.is_antimagic(target.x,target.y)) && ((type == 1) || (type == 3) || (type == 5))) { + if(univ.town.is_antimagic(target.x,target.y) && (type == eDamageType::FIRE || type == eDamageType::MAGIC || type == eDamageType::COLD)) { return; } @@ -4078,7 +4076,7 @@ void do_poison() { if(univ.party[i].main_status == eMainStatus::ALIVE) if(univ.party[i].status[eStatus::POISON] > 0) { r1 = get_ran(univ.party[i].status[eStatus::POISON],1,6); - damage_pc(i,r1,DAMAGE_POISON,eRace::UNKNOWN,0); + damage_pc(i,r1,eDamageType::POISON,eRace::UNKNOWN,0); if(get_ran(1,0,8) < 6) move_to_zero(univ.party[i].status[eStatus::POISON]); if(get_ran(1,0,8) < 6) @@ -4153,7 +4151,7 @@ void handle_acid() { if(univ.party[i].main_status == eMainStatus::ALIVE) if(univ.party[i].status[eStatus::ACID] > 0) { r1 = get_ran(univ.party[i].status[eStatus::ACID],1,6); - damage_pc(i,r1,DAMAGE_MAGIC,eRace::UNKNOWN,0); + damage_pc(i,r1,eDamageType::MAGIC,eRace::UNKNOWN,0); move_to_zero(univ.party[i].status[eStatus::ACID]); } if(overall_mode < MODE_COMBAT) @@ -4766,7 +4764,7 @@ void process_fields() { if(univ.town.is_force_wall(i,j)) { r1 = get_ran(3,1,6); loc.x = i; loc.y = j; - hit_pcs_in_space(loc,r1,DAMAGE_MAGIC,1,1); + hit_pcs_in_space(loc,r1,eDamageType::MAGIC,1,1); r1 = get_ran(1,1,6); if(r1 == 2) univ.town.set_force_wall(i,j,false); @@ -4774,7 +4772,7 @@ void process_fields() { if(univ.town.is_fire_wall(i,j)) { loc.x = i; loc.y = j; r1 = get_ran(2,1,6) + 1; - hit_pcs_in_space(loc,r1,DAMAGE_FIRE,1,1); + hit_pcs_in_space(loc,r1,eDamageType::FIRE,1,1); r1 = get_ran(1,1,4); if(r1 == 2) univ.town.set_fire_wall(i,j,false); @@ -4803,7 +4801,7 @@ void process_fields() { if(univ.town.is_ice_wall(i,j)) { loc.x = i; loc.y = j; r1 = get_ran(3,1,6); - hit_pcs_in_space(loc,r1,DAMAGE_COLD,1,1); + hit_pcs_in_space(loc,r1,eDamageType::COLD,1,1); r1 = get_ran(1,1,6); if(r1 == 1) univ.town.set_ice_wall(i,j,false); @@ -4811,7 +4809,7 @@ void process_fields() { if(univ.town.is_blade_wall(i,j)) { loc.x = i; loc.y = j; r1 = get_ran(6,1,8); - hit_pcs_in_space(loc,r1,DAMAGE_WEAPON,1,1); + hit_pcs_in_space(loc,r1,eDamageType::WEAPON,1,1); r1 = get_ran(1,1,5); if(r1 == 1) univ.town.set_blade_wall(i,j,false); @@ -4836,7 +4834,7 @@ void process_fields() { if(univ.town.is_quickfire(i,j)) { loc.x = i; loc.y = j; r1 = get_ran(2,1,8); - hit_pcs_in_space(loc,r1,DAMAGE_FIRE,1,1); + hit_pcs_in_space(loc,r1,eDamageType::FIRE,1,1); } } diff --git a/src/boe.monster.cpp b/src/boe.monster.cpp index 23bf9475..a132473f 100644 --- a/src/boe.monster.cpp +++ b/src/boe.monster.cpp @@ -786,17 +786,17 @@ void monst_inflict_fields(short which_monst) { where_check.y = univ.town.monst[which_monst].cur_loc.y + j; if(univ.town.is_quickfire(where_check.x,where_check.y)) { r1 = get_ran(2,1,8); - damage_monst(which_monst,7,r1,0,DAMAGE_FIRE,0); + damage_monst(which_monst,7,r1,0,eDamageType::FIRE,0); break; } if(univ.town.is_blade_wall(where_check.x,where_check.y)) { r1 = get_ran(6,1,8); - damage_monst(which_monst,7,r1,0,DAMAGE_WEAPON,0); + damage_monst(which_monst,7,r1,0,eDamageType::WEAPON,0); break; } if(univ.town.is_force_wall(where_check.x,where_check.y)) { r1 = get_ran(3,1,6); - damage_monst(which_monst,7,r1,0,DAMAGE_MAGIC,0); + damage_monst(which_monst,7,r1,0,eDamageType::MAGIC,0); break; } if(univ.town.is_sleep_cloud(where_check.x,where_check.y)) { @@ -806,7 +806,7 @@ void monst_inflict_fields(short which_monst) { if(univ.town.is_ice_wall(where_check.x,where_check.y)) { r1 = get_ran(3,1,6); if(univ.town.monst[which_monst].spec_skill != 23) - damage_monst(which_monst,7,r1,0,DAMAGE_COLD,0); + damage_monst(which_monst,7,r1,0,eDamageType::COLD,0); break; } if(univ.town.is_scloud(where_check.x,where_check.y)) { @@ -824,7 +824,7 @@ void monst_inflict_fields(short which_monst) { if(univ.town.is_fire_wall(where_check.x,where_check.y)) { r1 = get_ran(2,1,6); if(univ.town.monst[which_monst].spec_skill != 22) - damage_monst(which_monst,7,r1,0,DAMAGE_FIRE,0); + damage_monst(which_monst,7,r1,0,eDamageType::FIRE,0); break; } if(univ.town.is_force_cage(where_check.x,where_check.y)) @@ -846,7 +846,7 @@ void monst_inflict_fields(short which_monst) { univ.town.set_barrel(where_check.x,where_check.y,false); if(univ.town.is_fire_barr(where_check.x,where_check.y)) { r1 = get_ran(2,1,10); - damage_monst(which_monst,7,r1,0,DAMAGE_FIRE,0); + damage_monst(which_monst,7,r1,0,eDamageType::FIRE,0); } } @@ -1006,7 +1006,7 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon break; case eTerSpec::DAMAGING: // TODO: Update this to check other cases - if(ter_flag == DAMAGE_FIRE && univ.town.monst[which_monst].immunities & 8) + if(eDamageType(ter_flag) == eDamageType::FIRE && univ.town.monst[which_monst].immunities & 8) return true; else return false; break; diff --git a/src/boe.party.cpp b/src/boe.party.cpp index f1e3d06b..a1fd8c6b 100644 --- a/src/boe.party.cpp +++ b/src/boe.party.cpp @@ -4,6 +4,7 @@ #include "boe.global.h" #include +#include #include "classes.h" @@ -31,7 +32,6 @@ #include "fileio.hpp" #include "boe.menus.h" #include "restypes.hpp" -#include #include #include "button.hpp" #include "spell.hpp" @@ -64,7 +64,8 @@ extern short store_spell_target,pc_casting,stat_screen_mode; extern effect_pat_type null_pat,single,t,square,radius2,radius3; extern effect_pat_type current_pat; extern short current_spell_range; -extern short hit_chance[21],combat_active_pc;extern short boom_gr[8]; +extern short hit_chance[21],combat_active_pc; +extern std::map boom_gr; extern short current_ground; extern short monst_marked_damage[60]; extern location golem_m_locs[16]; @@ -2617,36 +2618,25 @@ void slay_party(eMainStatus mode) { put_pc_screen(); } -//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 -bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_of_attacker, short sound_type) { +bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_of_attacker, short sound_type,bool do_print) { short i, r1,level; - bool do_print = true; if(univ.party[which_pc].main_status != eMainStatus::ALIVE) return false; - if(damage_type >= DAMAGE_NO_PRINT) { - do_print = false; - damage_type -= DAMAGE_NO_PRINT; - } - if(sound_type == 0) { - if((damage_type == 1) || (damage_type == 4) ) + if(damage_type == eDamageType::FIRE || damage_type == eDamageType::UNBLOCKABLE) sound_type = 5; - if (damage_type == 3) + if(damage_type == eDamageType::MAGIC) sound_type = 12; - if (damage_type == 5) + if(damage_type == eDamageType::COLD) sound_type = 7; - if (damage_type == 2) + if(damage_type == eDamageType::POISON) sound_type = 11; } // armor - if((damage_type == 0) || (damage_type == 6) ||(damage_type == 7)) { + if(damage_type == eDamageType::WEAPON || damage_type == eDamageType::UNDEAD || damage_type == eDamageType::DEMON) { how_much -= minmax(-5,5,univ.party[which_pc].status[eStatus::BLESS_CURSE]); for(i = 0; i < 24; i++) if((univ.party[which_pc].items[i].variety != eItemType::NO_ITEM) && (univ.party[which_pc].equip[i])) { @@ -2679,11 +2669,12 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_ } // parry - if((damage_type < 2) && (univ.party[which_pc].parry < 100)) + // TODO: Used to also apply this to fire damage; is that correct? + if(damage_type == eDamageType::WEAPON && univ.party[which_pc].parry < 100) how_much -= univ.party[which_pc].parry / 4; - if(damage_type != 10) { + if(damage_type != eDamageType::MARKED) { if(PSD[SDF_EASY_MODE] > 0) how_much -= 3; // toughness @@ -2694,11 +2685,11 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_ how_much -= 1; } - if((damage_type == DAMAGE_WEAPON) && ((level = get_prot_level(which_pc,eItemAbil::PROTECTION)) > 0)) + if(damage_type == eDamageType::WEAPON && ((level = get_prot_level(which_pc,eItemAbil::PROTECTION)) > 0)) how_much = how_much - level; - if((damage_type == DAMAGE_UNDEAD) && ((level = get_prot_level(which_pc,eItemAbil::PROTECT_FROM_UNDEAD)) > 0)) + if(damage_type == eDamageType::UNDEAD && ((level = get_prot_level(which_pc,eItemAbil::PROTECT_FROM_UNDEAD)) > 0)) how_much = how_much / ((level >= 7) ? 4 : 2); - if((damage_type == DAMAGE_DEMON) && ((level = get_prot_level(which_pc,eItemAbil::PROTECT_FROM_DEMONS)) > 0)) + if(damage_type == eDamageType::DEMON && ((level = get_prot_level(which_pc,eItemAbil::PROTECT_FROM_DEMONS)) > 0)) how_much = how_much / ((level >= 7) ? 4 : 2); if((type_of_attacker == eRace::HUMANOID) && ((level = get_prot_level(which_pc,eItemAbil::PROTECT_FROM_HUMANOIDS)) > 0)) how_much = how_much / ((level >= 7) ? 4 : 2); @@ -2714,24 +2705,24 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_ how_much = 0; // magic resistance - if(damage_type == DAMAGE_MAGIC && ((level = get_prot_level(which_pc,eItemAbil::MAGIC_PROTECTION)) > 0)) + if(damage_type == eDamageType::MAGIC && ((level = get_prot_level(which_pc,eItemAbil::MAGIC_PROTECTION)) > 0)) how_much = how_much / ((level >= 7) ? 4 : 2); // Mag. res helps w. fire and cold - if(((damage_type == 1) || (damage_type == 5)) && + if((damage_type == eDamageType::FIRE || damage_type == eDamageType::COLD) && univ.party[which_pc].status[eStatus::MAGIC_RESISTANCE] > 0) how_much = how_much / 2; // fire res. - if(damage_type == DAMAGE_FIRE && ((level = get_prot_level(which_pc,eItemAbil::FIRE_PROTECTION)) > 0)) + if(damage_type == eDamageType::FIRE && ((level = get_prot_level(which_pc,eItemAbil::FIRE_PROTECTION)) > 0)) how_much = how_much / ((level >= 7) ? 4 : 2); // cold res. - if(damage_type == DAMAGE_COLD && ((level = get_prot_level(which_pc,eItemAbil::COLD_PROTECTION)) > 0)) + if(damage_type == eDamageType::COLD && ((level = get_prot_level(which_pc,eItemAbil::COLD_PROTECTION)) > 0)) how_much = how_much / ((level >= 7) ? 4 : 2); // major resistance - if((damage_type == DAMAGE_FIRE || damage_type == DAMAGE_POISON || damage_type == DAMAGE_MAGIC || damage_type == DAMAGE_COLD) + if((damage_type == eDamageType::FIRE || damage_type == eDamageType::POISON || damage_type == eDamageType::MAGIC || damage_type == eDamageType::COLD) && ((level = get_prot_level(which_pc,eItemAbil::FULL_PROTECTION)) > 0)) how_much = how_much / ((level >= 7) ? 4 : 2); @@ -2739,16 +2730,21 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_ if(how_much < 0) how_much = 0; univ.party[which_pc].marked_damage += how_much; + // TODO: Also, if it's magic, use boom type 3 (must implement in the animation engine first) + // It would also be nice to have a special boom type for cold. + short boom_type = 2; + if(damage_type == eDamageType::FIRE) + boom_type = 0; if(is_town()) - add_explosion(univ.town.p_loc,how_much,0,(damage_type > 2) ? 2 : 0,0,0); - else add_explosion(univ.party[which_pc].combat_pos,how_much,0,(damage_type > 2) ? 2 : 0,0,0); + add_explosion(univ.town.p_loc,how_much,0,boom_type,0,0); + else add_explosion(univ.party[which_pc].combat_pos,how_much,0,boom_type,0,0); if(how_much == 0) return false; else return true; } if(how_much <= 0) { - if((damage_type == 0) || (damage_type == 6) || (damage_type == 7)) + if(damage_type == eDamageType::WEAPON || damage_type == eDamageType::UNDEAD || damage_type == eDamageType::DEMON) play_sound(2); add_string_to_buf (" No damage."); return false; @@ -2760,7 +2756,7 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_ if(do_print) add_string_to_buf(" " + univ.party[which_pc].name + " takes " + std::to_string(how_much) + '.'); - if(damage_type != 10) { + if(damage_type != eDamageType::MARKED) { if(is_combat()) boom_space(univ.party[which_pc].combat_pos,overall_mode,boom_gr[damage_type],how_much,sound_type); else if(is_town()) diff --git a/src/boe.party.h b/src/boe.party.h index 89f79c37..ed4f450b 100644 --- a/src/boe.party.h +++ b/src/boe.party.h @@ -54,7 +54,7 @@ void affect_party(eStatus type,short how_much); void void_sanctuary(short pc_num); void hit_party(short how_much,eDamageType damage_type); void slay_party(eMainStatus mode); -bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_of_attacker, short sound_type); +bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_of_attacker, short sound_type,bool do_print = true); void kill_pc(short which_pc,eMainStatus type); void petrify_pc(short which_pc, short strength); void set_pc_moves(); diff --git a/src/boe.specials.cpp b/src/boe.specials.cpp index e92d1588..1ab61c3e 100644 --- a/src/boe.specials.cpp +++ b/src/boe.specials.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include "boe.global.h" @@ -47,7 +48,16 @@ extern std::queue special_queue; bool can_draw_pcs = true; -short boom_gr[8] = {3,0,2,1,1,4,3,3}; +std::map boom_gr = { + {eDamageType::WEAPON, 3}, + {eDamageType::FIRE, 0}, + {eDamageType::POISON, 2}, + {eDamageType::MAGIC, 1}, + {eDamageType::UNBLOCKABLE, 1}, + {eDamageType::COLD, 4}, + {eDamageType::UNDEAD, 3}, + {eDamageType::DEMON, 3}, +}; short store_item_spell_level = 10; // global values for when processing special encounters @@ -120,7 +130,7 @@ bool check_special_terrain(location where_check,eSpecCtx mode,short which_pc,sho eTerSpec ter_special; std::string choice; ter_flag_t ter_flag1,ter_flag2,ter_flag3; - eDamageType dam_type = DAMAGE_WEAPON; + eDamageType dam_type = eDamageType::WEAPON; bool can_enter = true; location out_where,from_loc,to_loc; short s1 = 0,s2 = 0,s3 = 0; @@ -308,10 +318,10 @@ bool check_special_terrain(location where_check,eSpecCtx mode,short which_pc,sho break; if(ter_flag3.u > 0 && ter_flag3.u < 8) dam_type = (eDamageType) ter_flag3.u; - else dam_type = DAMAGE_WEAPON; - r1 = get_ran(ter_flag2.u,dam_type,ter_flag1.u); + else dam_type = eDamageType::WEAPON; + r1 = get_ran(ter_flag2.u,1,ter_flag1.u); switch(dam_type){ - case DAMAGE_FIRE: + case eDamageType::FIRE: add_string_to_buf(" It's hot!"); pic_type = 0; if(PSD[SDF_PARTY_FIREWALK] > 0) { @@ -319,25 +329,25 @@ bool check_special_terrain(location where_check,eSpecCtx mode,short which_pc,sho r1 = -1; } break; - case DAMAGE_COLD: + case eDamageType::COLD: add_string_to_buf(" You feel cold!"); pic_type = 4; break; - case DAMAGE_MAGIC: - case DAMAGE_UNBLOCKABLE: + case eDamageType::MAGIC: + case eDamageType::UNBLOCKABLE: add_string_to_buf(" Something shocks you!"); pic_type = 1; break; - case DAMAGE_WEAPON: + case eDamageType::WEAPON: add_string_to_buf(" You feel pain!"); pic_type = 3; break; - case DAMAGE_POISON: + case eDamageType::POISON: add_string_to_buf(" You suddenly feel very ill for a moment..."); pic_type = 2; break; - case DAMAGE_UNDEAD: - case DAMAGE_DEMON: + case eDamageType::UNDEAD: + case eDamageType::DEMON: add_string_to_buf(" A dark wind blows through you!"); pic_type = 1; // TODO: Verify that this is correct break; @@ -485,7 +495,7 @@ void check_fields(location where_check,eSpecCtx mode,short which_pc) { // if(mode < 2) // hit_party(r1,1); if(mode == eSpecCtx::COMBAT_MOVE) - damage_pc(which_pc,r1,DAMAGE_FIRE,eRace::UNKNOWN,0); + damage_pc(which_pc,r1,eDamageType::FIRE,eRace::UNKNOWN,0); if(overall_mode < MODE_COMBAT) boom_space(univ.party.p_loc,overall_mode,0,r1,5); } @@ -495,7 +505,7 @@ void check_fields(location where_check,eSpecCtx mode,short which_pc) { // if(mode < 2) // hit_party(r1,3); if(mode == eSpecCtx::COMBAT_MOVE) - damage_pc(which_pc,r1,DAMAGE_MAGIC,eRace::UNKNOWN,0); + damage_pc(which_pc,r1,eDamageType::MAGIC,eRace::UNKNOWN,0); if(overall_mode < MODE_COMBAT) boom_space(univ.party.p_loc,overall_mode,1,r1,12); } @@ -505,7 +515,7 @@ void check_fields(location where_check,eSpecCtx mode,short which_pc) { // if(mode < 2) // hit_party(r1,5); if(mode == eSpecCtx::COMBAT_MOVE) - damage_pc(which_pc,r1,DAMAGE_COLD,eRace::UNKNOWN,0); + damage_pc(which_pc,r1,eDamageType::COLD,eRace::UNKNOWN,0); if(overall_mode < MODE_COMBAT) boom_space(univ.party.p_loc,overall_mode,4,r1,7); } @@ -515,7 +525,7 @@ void check_fields(location where_check,eSpecCtx mode,short which_pc) { // if(mode < 2) // hit_party(r1,0); if(mode == eSpecCtx::COMBAT_MOVE) - damage_pc(which_pc,r1,DAMAGE_WEAPON,eRace::UNKNOWN,0); + damage_pc(which_pc,r1,eDamageType::WEAPON,eRace::UNKNOWN,0); if(overall_mode < MODE_COMBAT) boom_space(univ.party.p_loc,overall_mode,3,r1,2); } @@ -525,7 +535,7 @@ void check_fields(location where_check,eSpecCtx mode,short which_pc) { // if(mode < 2) // hit_party(r1,1); if(mode == eSpecCtx::COMBAT_MOVE) - damage_pc(which_pc,r1,DAMAGE_FIRE,eRace::UNKNOWN,0); + damage_pc(which_pc,r1,eDamageType::FIRE,eRace::UNKNOWN,0); if(overall_mode < MODE_COMBAT) boom_space(univ.party.p_loc,overall_mode,0,r1,5); } @@ -558,9 +568,9 @@ void check_fields(location where_check,eSpecCtx mode,short which_pc) { add_string_to_buf(" Magic barrier! "); r1 = get_ran(2,1,10); if(mode != eSpecCtx::COMBAT_MOVE) - hit_party(r1,DAMAGE_MAGIC); + hit_party(r1,eDamageType::MAGIC); if(mode == eSpecCtx::COMBAT_MOVE) - damage_pc(which_pc,r1,DAMAGE_MAGIC,eRace::UNKNOWN,0); + damage_pc(which_pc,r1,eDamageType::MAGIC,eRace::UNKNOWN,0); if(overall_mode < MODE_COMBAT) boom_space(univ.party.p_loc,overall_mode,1,r1,12); } @@ -949,7 +959,7 @@ void use_item(short pc,short item) { break; case 1: ASB(" You feel sick."); - damage_pc(pc,20 * str,DAMAGE_UNBLOCKABLE,eRace::HUMAN,0); + damage_pc(pc,20 * str,eDamageType::UNBLOCKABLE,eRace::HUMAN,0); break; case 2: ASB(" You all feel better."); @@ -957,7 +967,7 @@ void use_item(short pc,short item) { break; case 3: ASB(" You all feel sick."); - hit_party(20 * str,DAMAGE_UNBLOCKABLE); + hit_party(20 * str,eDamageType::UNBLOCKABLE); break; } break; @@ -987,7 +997,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,eRace::HUMAN,0); + damage_pc(pc,20 * str,eDamageType::UNBLOCKABLE,eRace::HUMAN,0); disease_pc(pc,2 * str); dumbfound_pc(pc,2 * str); break; @@ -995,7 +1005,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,eRace::HUMAN,0); + damage_pc(i,20 * str,eDamageType::UNBLOCKABLE,eRace::HUMAN,0); disease_pc(i,2 * str); dumbfound_pc(i,2 * str); } @@ -1378,37 +1388,25 @@ 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. -//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 -// 9 - marked damage, from during anim mode -//+10 = no_print -// 100s digit - damage sound for boom space -bool damage_monst(short which_m, short who_hit, short how_much, short how_much_spec, eDamageType dam_type, short sound_type) { +bool damage_monst(short which_m, short who_hit, short how_much, short how_much_spec, eDamageType dam_type, short sound_type, bool do_print) { cCreature *victim; short r1,which_spot; location where_put; - bool do_print = true; char resist; //print_num(which_m,(short)univ.town.monst[which_m].m_loc.x,(short)univ.town.monst[which_m].m_loc.y); if(univ.town.monst[which_m].active == 0) return false; - if(dam_type >= DAMAGE_MARKED) { // note: MARKED here actually means NO_PRINT - do_print = false; - dam_type -= DAMAGE_MARKED; - } - if(sound_type == 0) { - if((dam_type == 1) || (dam_type == 4) ) + if(dam_type == eDamageType::FIRE || dam_type == eDamageType::UNBLOCKABLE) sound_type = 5; - if (dam_type == 5) + if(dam_type == eDamageType::COLD) sound_type = 7; - if (dam_type == 3) + if(dam_type == eDamageType::MAGIC) sound_type = 12; - if (dam_type == 2) + if(dam_type == eDamageType::POISON) sound_type = 11; } @@ -1416,25 +1414,25 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s victim = &univ.town.monst[which_m]; resist = victim->immunities; - if(dam_type == 3) { + if(dam_type == eDamageType::MAGIC) { if(resist & 1) how_much = how_much / 2; if(resist & 2) how_much = 0; } - if(dam_type == 1) { + if(dam_type == eDamageType::FIRE) { if(resist & 4) how_much = how_much / 2; if(resist & 8) how_much = 0; } - if(dam_type == 5) { + if(dam_type == eDamageType::COLD) { if(resist & 16) how_much = how_much / 2; if(resist & 32) how_much = 0; } - if(dam_type == 2) { + if(dam_type == eDamageType::POISON) { if(resist & 64) how_much = how_much / 2; if(resist & 128) @@ -1442,7 +1440,7 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s } // Absorb damage? - if(((dam_type == 1) || (dam_type == 3) || (dam_type == 5)) + if((dam_type == eDamageType::FIRE || dam_type == eDamageType::MAGIC || dam_type == eDamageType::COLD) && (victim->spec_skill == 26)) { if(32767 - victim->health > how_much) victim->health = 32767; @@ -1452,9 +1450,9 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s } // Saving throw - if(((dam_type == 1) || (dam_type == 5)) && (get_ran(1,0,20) <= victim->level)) + if((dam_type == eDamageType::FIRE || dam_type == eDamageType::COLD) && get_ran(1,0,20) <= victim->level) how_much /= 2; - if((dam_type == 3) && (get_ran(1,0,24) <= victim->level)) + if(dam_type == eDamageType::MAGIC && (get_ran(1,0,24) <= victim->level)) how_much /= 2; // Invulnerable? @@ -1464,14 +1462,19 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s r1 = get_ran(1,0,(victim->armor * 5) / 4); r1 += victim->level / 4; - if(dam_type == 0) + if(dam_type == eDamageType::WEAPON) how_much -= r1; if(boom_anim_active) { if(how_much < 0) how_much = 0; + // TODO: Also, if it's magic, use boom type 3 (must implement in the animation engine first) + // It would also be nice to have a special boom type for cold. + short boom_type = 2; + if(dam_type == eDamageType::FIRE) + boom_type = 0; monst_marked_damage[which_m] += how_much; - add_explosion(victim->cur_loc,how_much,0,(dam_type > 2) ? 2 : 0,14 * (victim->x_width - 1),18 * (victim->y_width - 1)); + add_explosion(victim->cur_loc,how_much,0,boom_type,14 * (victim->x_width - 1),18 * (victim->y_width - 1)); // Note: Windows version printed an "undamaged" message here if applicable, but I don't think that's right. if(how_much == 0) return false; @@ -1481,7 +1484,7 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s if(how_much <= 0) { if(is_combat()) monst_spell_note(victim->number,7); - if((how_much <= 0) && ((dam_type == DAMAGE_WEAPON) || (dam_type == DAMAGE_UNDEAD) || (dam_type == DAMAGE_DEMON))) { + if(how_much <= 0 && (dam_type == eDamageType::WEAPON || dam_type == eDamageType::UNDEAD || dam_type == eDamageType::DEMON)) { draw_terrain(2); play_sound(2); } @@ -1530,7 +1533,7 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s // TODO: This looks like the reason Windows split the boom_space function in two. // It doesn't exactly make sense though, since in its version, boom_space is only called for how_much_spec. - if(dam_type != 9) { // note special damage only gamed in hand-to-hand, not during animation + if(dam_type != eDamageType::MARKED) { // note special damage only gamed in hand-to-hand, not during animation if(party_can_see_monst(which_m)) { boom_space(victim->cur_loc,100,boom_gr[dam_type],how_much,sound_type); if(how_much_spec > 0) @@ -1745,7 +1748,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."); - hit_party(get_ran(1, 1, 6), DAMAGE_WEAPON); + hit_party(get_ran(1, 1, 6), eDamageType::WEAPON); } for(k = 0; k < NUM_TOWN_ITEMS; k++) if(univ.town.items[k].variety != eItemType::NO_ITEM && univ.town.items[k].contained @@ -1783,7 +1786,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_WEAPON,eRace::UNKNOWN,0); + damage_pc(i,get_ran(1, 1, 6), eDamageType::WEAPON,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 diff --git a/src/boe.specials.h b/src/boe.specials.h index 76204720..d54ea478 100644 --- a/src/boe.specials.h +++ b/src/boe.specials.h @@ -8,7 +8,7 @@ void use_item(short pc,short item); bool use_space(location where); bool adj_town_look(location where); void PSOE(short which_special,unsigned char *stuff_done_val,short where_put); -bool damage_monst(short which_m, short who_hit, short how_much, short how_much_spec, eDamageType dam_type, short sound_type); +bool damage_monst(short which_m, short who_hit, short how_much, short how_much_spec, eDamageType dam_type, short sound_type, bool do_print = true); void kill_monst(cCreature *which_m,short who_killed,eMainStatus type = eMainStatus::DEAD); void petrify_monst(cCreature* m_target, short strength); void special_increase_age(long length = 1, bool queue = false); diff --git a/src/boe.town.cpp b/src/boe.town.cpp index 5caf58a4..5d10ae4a 100644 --- a/src/boe.town.cpp +++ b/src/boe.town.cpp @@ -1114,7 +1114,7 @@ void bash_door(location where,short pc_num) { unlock_adjust = univ.scenario.ter_types[terrain].flag2.u; if(unlock_adjust >= 5 || r1 > (unlock_adjust * 15 + 40) || univ.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,eRace::UNKNOWN,0); + damage_pc(pc_num,get_ran(1,1,4),eDamageType::UNBLOCKABLE,eRace::UNKNOWN,0); } else { add_string_to_buf(" Lock breaks. "); diff --git a/src/boe.townspec.cpp b/src/boe.townspec.cpp index d9574116..a05a8134 100644 --- a/src/boe.townspec.cpp +++ b/src/boe.townspec.cpp @@ -88,7 +88,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,eRace::UNKNOWN,0); + damage_pc(pc_num,r1,eDamageType::WEAPON,eRace::UNKNOWN,0); } break; @@ -111,7 +111,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(" There is an explosion. "); r1 = get_ran(3 + univ.town.difficulty / 13,1,8); - hit_party(r1,DAMAGE_FIRE); + hit_party(r1,eDamageType::FIRE); } break; @@ -136,7 +136,7 @@ bool run_trap(short pc_num,eTrapType 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,DAMAGE_FIRE); + hit_party(r1,eDamageType::FIRE); break; case TRAP_DUMBFOUND: add_string_to_buf(" You feel disoriented. "); diff --git a/src/classes/monster.cpp b/src/classes/monster.cpp index b58444bb..cfc62637 100644 --- a/src/classes/monster.cpp +++ b/src/classes/monster.cpp @@ -217,27 +217,27 @@ cMonster::cAbility::operator std::string(){ case MONST_DRAIN_XP_DAMAGE_RAY: case MONST_DAMAGE_TOUCH: case MONST_DRAIN_XP_DAMAGE_TOUCH: - switch(extra1){ - case DAMAGE_WEAPON: + switch(eDamageType(extra1)) { + case eDamageType::WEAPON: sout << "Health drain"; break; - case DAMAGE_FIRE: + case eDamageType::FIRE: sout << "Heat"; break; - case DAMAGE_POISON: + case eDamageType::POISON: sout << "Pain"; break; - case DAMAGE_MAGIC: + case eDamageType::MAGIC: sout << "Shock"; break; - case DAMAGE_UNBLOCKABLE: + case eDamageType::UNBLOCKABLE: sout << "Wounding"; break; - case DAMAGE_COLD: + case eDamageType::COLD: sout << "Icy"; break; - case DAMAGE_UNDEAD: - case DAMAGE_DEMON: + case eDamageType::UNDEAD: + case eDamageType::DEMON: sout << "Unholy"; break; default: diff --git a/src/classes/simpletypes.h b/src/classes/simpletypes.h index 147e9984..19735814 100644 --- a/src/classes/simpletypes.h +++ b/src/classes/simpletypes.h @@ -458,48 +458,18 @@ enum class eTrait { /* damage type*/ /* used as parameter to some functions */ -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 ? - 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? +enum class eDamageType { + WEAPON = 0, + FIRE = 1, + POISON = 2, + MAGIC = 3, + UNBLOCKABLE = 4, + COLD = 5, + UNDEAD = 6, + DEMON = 7, + MARKED = 10, }; -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); -} - enum class eSpecCtx { OUT_MOVE = 0, TOWN_MOVE = 1, diff --git a/src/classes/terrain.cpp b/src/classes/terrain.cpp index 212c5c17..218f6a9e 100644 --- a/src/classes/terrain.cpp +++ b/src/classes/terrain.cpp @@ -152,15 +152,15 @@ void cTerrain::append(legacy::terrain_type_type& old){ break; case 2: special = eTerSpec::DAMAGING; - flag3.u = DAMAGE_FIRE; + flag3.u = int(eDamageType::FIRE); break; case 3: special = eTerSpec::DAMAGING; - flag3.u = DAMAGE_COLD; + flag3.u = int(eDamageType::COLD); break; case 4: special = eTerSpec::DAMAGING; - flag3.u = DAMAGE_MAGIC; + flag3.u = int(eDamageType::MAGIC); break; case 5: special = eTerSpec::DANGEROUS; diff --git a/src/scenedit/scen.graphics.cpp b/src/scenedit/scen.graphics.cpp index e41f3c34..5c1d5cc1 100644 --- a/src/scenedit/scen.graphics.cpp +++ b/src/scenedit/scen.graphics.cpp @@ -139,29 +139,29 @@ static short get_small_icon(ter_num_t ter){ icon = 23; break; case eTerSpec::DAMAGING: - switch(scenario.ter_types[ter].flag3.u){ - case DAMAGE_WEAPON: + switch(eDamageType(scenario.ter_types[ter].flag3.u)) { + case eDamageType::WEAPON: icon = 40; break; - case DAMAGE_FIRE: + case eDamageType::FIRE: icon = 37; break; - case DAMAGE_POISON: + case eDamageType::POISON: icon = 43; break; - case DAMAGE_MAGIC: + case eDamageType::MAGIC: icon = 39; break; - case DAMAGE_UNBLOCKABLE: + case eDamageType::UNBLOCKABLE: icon = 39; break; - case DAMAGE_COLD: + case eDamageType::COLD: icon = 38; break; - case DAMAGE_UNDEAD: + case eDamageType::UNDEAD: icon = 18; break; - case DAMAGE_DEMON: + case eDamageType::DEMON: icon = 19; break; }