make damage type -> sound type DRY
And while I'm at it, resolve a TODO note and remove a bunch of unnecessary 0s
This commit is contained in:
@@ -2005,7 +2005,7 @@ void debug_kill() {
|
||||
|
||||
if(univ.town.monst[i].is_alive() && !univ.town.monst[i].is_friendly()
|
||||
&& (dist(univ.town.monst[i].cur_loc,univ.party.town_loc) <= 10) )
|
||||
damage_monst(univ.town.monst[i], 7,1000,eDamageType::SPECIAL,0);
|
||||
damage_monst(univ.town.monst[i], 7,1000,eDamageType::SPECIAL);
|
||||
}
|
||||
// kill_monst(&univ.town.monst[i],6);
|
||||
draw_terrain();
|
||||
|
@@ -610,7 +610,7 @@ void pc_attack(short who_att,iLiving* target) {
|
||||
if(target->is_shielded()) {
|
||||
int how_much = target->get_shared_dmg(store_hp - target->get_health());
|
||||
add_string_to_buf(" Shares damage!");
|
||||
damage_pc(attacker, how_much, eDamageType::MAGIC,eRace::UNKNOWN,0);
|
||||
damage_pc(attacker, how_much, eDamageType::MAGIC,eRace::UNKNOWN);
|
||||
}
|
||||
}
|
||||
combat_posing_monster = current_working_monster = -1;
|
||||
@@ -1377,7 +1377,7 @@ void do_combat_cast(location target) {
|
||||
store_sound = 53;
|
||||
r1 = get_ran(4,1,8);
|
||||
r2 = get_ran(1,0,2);
|
||||
damage_monst(*cur_monst, 7, r1, eDamageType::MAGIC,0);
|
||||
damage_monst(*cur_monst, 7, r1, eDamageType::MAGIC);
|
||||
victim->slow(4 + r2);
|
||||
victim->poison(5 + r2);
|
||||
break;
|
||||
@@ -1606,12 +1606,12 @@ void do_combat_cast(location target) {
|
||||
void handle_marked_damage() {
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.marked_damage > 0) {
|
||||
damage_pc(pc,pc.marked_damage,eDamageType::MARKED,eRace::UNKNOWN,0);
|
||||
damage_pc(pc,pc.marked_damage,eDamageType::MARKED,eRace::UNKNOWN);
|
||||
pc.marked_damage = 0;
|
||||
}
|
||||
for(short i = 0; i < univ.town.monst.size(); i++)
|
||||
if(univ.town.monst[i].marked_damage > 0) {
|
||||
damage_monst(univ.town.monst[i], univ.cur_pc, univ.town.monst[i].marked_damage, eDamageType::MARKED,0);
|
||||
damage_monst(univ.town.monst[i], univ.cur_pc, univ.town.monst[i].marked_damage, eDamageType::MARKED);
|
||||
|
||||
univ.town.monst[i].marked_damage = 0;
|
||||
}
|
||||
@@ -2692,7 +2692,7 @@ void do_monster_turn() {
|
||||
printed_acid = true;
|
||||
}
|
||||
r1 = get_ran(cur_monst->status[eStatus::ACID],1,6);
|
||||
damage_monst(*cur_monst, 6,r1, eDamageType::MAGIC,0);
|
||||
damage_monst(*cur_monst, 6,r1, eDamageType::MAGIC);
|
||||
cur_monst->status[eStatus::ACID]--;
|
||||
}
|
||||
|
||||
@@ -2716,7 +2716,7 @@ void do_monster_turn() {
|
||||
printed_poison = true;
|
||||
}
|
||||
r1 = get_ran(cur_monst->status[eStatus::POISON],1,6);
|
||||
damage_monst(*cur_monst, 6, r1, eDamageType::POISON,0);
|
||||
damage_monst(*cur_monst, 6, r1, eDamageType::POISON);
|
||||
cur_monst->status[eStatus::POISON]--;
|
||||
}
|
||||
if(cur_monst->status[eStatus::DISEASE] > 0) { // Disease
|
||||
@@ -2864,7 +2864,7 @@ void monster_attack(short who_att,iLiving* target) {
|
||||
int dmg = attacker->get_shared_dmg(store_hp - target->get_health());
|
||||
add_string_to_buf(" Shares damage!");
|
||||
int who_hit = pc_target != nullptr ? 6 : 7;
|
||||
damage_monst(*attacker, who_hit, dmg, eDamageType::MAGIC,0);
|
||||
damage_monst(*attacker, who_hit, dmg, eDamageType::MAGIC);
|
||||
}
|
||||
|
||||
if(i == 0 && attacker->status[eStatus::POISONED_WEAPON] > 0) {
|
||||
@@ -4264,28 +4264,28 @@ static void place_spell_pattern(effect_pat_type pat,location center,unsigned sho
|
||||
}
|
||||
if(type != eDamageType::MARKED) {
|
||||
r1 = get_ran(dice,1,6);
|
||||
damage_pc(pc,r1,type,eRace::UNKNOWN,0);
|
||||
damage_pc(pc,r1,type,eRace::UNKNOWN);
|
||||
}
|
||||
} else switch(eFieldType(effect)) {
|
||||
case WALL_FORCE:
|
||||
r1 = get_ran(2,1,6);
|
||||
damage_pc(pc,r1,eDamageType::MAGIC,eRace::UNKNOWN,0);
|
||||
damage_pc(pc,r1,eDamageType::MAGIC,eRace::UNKNOWN);
|
||||
break;
|
||||
case WALL_FIRE:
|
||||
r1 = get_ran(1,1,6) + 1;
|
||||
damage_pc(pc,r1,eDamageType::FIRE,eRace::UNKNOWN,0);
|
||||
damage_pc(pc,r1,eDamageType::FIRE,eRace::UNKNOWN);
|
||||
break;
|
||||
case WALL_ICE:
|
||||
r1 = get_ran(2,1,6);
|
||||
damage_pc(pc,r1,eDamageType::COLD,eRace::UNKNOWN,0);
|
||||
damage_pc(pc,r1,eDamageType::COLD,eRace::UNKNOWN);
|
||||
break;
|
||||
case WALL_BLADES:
|
||||
r1 = get_ran(4,1,8);
|
||||
damage_pc(pc,r1,eDamageType::WEAPON,eRace::UNKNOWN,0);
|
||||
damage_pc(pc,r1,eDamageType::WEAPON,eRace::UNKNOWN);
|
||||
break;
|
||||
case OBJECT_BLOCK:
|
||||
r1 = get_ran(6,1,8);
|
||||
damage_pc(pc,r1,eDamageType::WEAPON,eRace::UNKNOWN,0);
|
||||
damage_pc(pc,r1,eDamageType::WEAPON,eRace::UNKNOWN);
|
||||
break;
|
||||
case SPECIAL_EXPLORED: case SPECIAL_SPOT: case SPECIAL_ROAD:
|
||||
case BARRIER_FIRE: case BARRIER_FORCE: case BARRIER_CAGE:
|
||||
@@ -4356,7 +4356,7 @@ static void place_spell_pattern(effect_pat_type pat,location center,unsigned sho
|
||||
}
|
||||
if(type != eDamageType::MARKED) {
|
||||
r1 = get_ran(dice,1,6);
|
||||
damage_monst(univ.town.monst[k],who_hit,r1,type,0);
|
||||
damage_monst(univ.town.monst[k],who_hit,r1,type);
|
||||
}
|
||||
} else switch(eFieldType(effect)) {
|
||||
case FIELD_WEB:
|
||||
@@ -4364,29 +4364,29 @@ 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(univ.town.monst[k], who_hit, r1, eDamageType::MAGIC,0);
|
||||
damage_monst(univ.town.monst[k], who_hit, r1, eDamageType::MAGIC);
|
||||
break;
|
||||
case WALL_FIRE:
|
||||
r1 = get_ran(2,1,6);
|
||||
damage_monst(univ.town.monst[k], who_hit, r1, eDamageType::FIRE,0);
|
||||
damage_monst(univ.town.monst[k], who_hit, r1, eDamageType::FIRE);
|
||||
break;
|
||||
case CLOUD_STINK:
|
||||
which_m->curse(get_ran(1,1,2));
|
||||
break;
|
||||
case WALL_ICE:
|
||||
r1 = get_ran(3,1,6);
|
||||
damage_monst(univ.town.monst[k], who_hit, r1, eDamageType::COLD,0);
|
||||
damage_monst(univ.town.monst[k], who_hit, r1, eDamageType::COLD);
|
||||
break;
|
||||
case WALL_BLADES:
|
||||
r1 = get_ran(6,1,8);
|
||||
damage_monst(univ.town.monst[k], who_hit, r1, eDamageType::WEAPON,0);
|
||||
damage_monst(univ.town.monst[k], who_hit, r1, eDamageType::WEAPON);
|
||||
break;
|
||||
case CLOUD_SLEEP:
|
||||
which_m->sleep(eStatus::ASLEEP,3,0);
|
||||
break;
|
||||
case OBJECT_BLOCK:
|
||||
r1 = get_ran(6,1,8);
|
||||
damage_monst(univ.town.monst[k],who_hit,r1,eDamageType::WEAPON,0);
|
||||
damage_monst(univ.town.monst[k],who_hit,r1,eDamageType::WEAPON);
|
||||
break;
|
||||
case BARRIER_CAGE:
|
||||
univ.town.monst[k].status[eStatus::FORCECAGE] = max(8, univ.town.monst[k].status[eStatus::FORCECAGE]);
|
||||
@@ -4449,12 +4449,12 @@ void do_shockwave(location target) {
|
||||
for(cPlayer& pc : univ.party)
|
||||
if((dist(target,pc.combat_pos) > 0) && (dist(target,pc.combat_pos) < 11)
|
||||
&& pc.main_status == eMainStatus::ALIVE)
|
||||
damage_pc(pc, get_ran(2 + dist(target,pc.combat_pos) / 2, 1, 6), eDamageType::UNBLOCKABLE,eRace::UNKNOWN,0);
|
||||
damage_pc(pc, get_ran(2 + dist(target,pc.combat_pos) / 2, 1, 6), eDamageType::UNBLOCKABLE,eRace::UNKNOWN);
|
||||
for(short i = 0; i < univ.town.monst.size(); i++)
|
||||
if((univ.town.monst[i].is_alive()) && (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(univ.town.monst[i],univ.cur_pc,get_ran(2 + dist(target,univ.town.monst[i].cur_loc) / 2,1,6),eDamageType::UNBLOCKABLE,0);
|
||||
damage_monst(univ.town.monst[i],univ.cur_pc,get_ran(2 + dist(target,univ.town.monst[i].cur_loc) / 2,1,6),eDamageType::UNBLOCKABLE);
|
||||
do_explosion_anim(5,0);
|
||||
end_missile_anim();
|
||||
handle_marked_damage();
|
||||
@@ -4466,12 +4466,12 @@ void radius_damage(location target,short radius, short dam, eDamageType type) {
|
||||
for(cPlayer& pc : univ.party)
|
||||
if((dist(target,univ.party.town_loc) > 0) && (dist(target,univ.party.town_loc) <= radius)
|
||||
&& pc.main_status == eMainStatus::ALIVE)
|
||||
damage_pc(pc, dam, type,eRace::UNKNOWN,0);
|
||||
damage_pc(pc, dam, type,eRace::UNKNOWN);
|
||||
for(short i = 0; i < univ.town.monst.size(); i++)
|
||||
if((univ.town.monst[i].is_alive()) && (dist(target,univ.town.monst[i].cur_loc) > 0)
|
||||
&& (dist(target,univ.town.monst[i].cur_loc) <= radius)
|
||||
&& (can_see_light(target,univ.town.monst[i].cur_loc,sight_obscurity) < 5))
|
||||
damage_monst(univ.town.monst[i], univ.cur_pc, dam, type,0);
|
||||
damage_monst(univ.town.monst[i], univ.cur_pc, dam, type);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4479,12 +4479,12 @@ void radius_damage(location target,short radius, short dam, eDamageType type) {
|
||||
for(cPlayer& pc : univ.party)
|
||||
if((dist(target,pc.combat_pos) > 0) && (dist(target,pc.combat_pos) <= radius)
|
||||
&& pc.main_status == eMainStatus::ALIVE)
|
||||
damage_pc(pc, dam, type,eRace::UNKNOWN,0);
|
||||
damage_pc(pc, dam, type,eRace::UNKNOWN);
|
||||
for(short i = 0; i < univ.town.monst.size(); i++)
|
||||
if((univ.town.monst[i].is_alive()) && (dist(target,univ.town.monst[i].cur_loc) > 0)
|
||||
&& (dist(target,univ.town.monst[i].cur_loc) <= radius)
|
||||
&& (can_see_light(target,univ.town.monst[i].cur_loc,sight_obscurity) < 5))
|
||||
damage_monst(univ.town.monst[i], univ.cur_pc, dam, type,0);
|
||||
damage_monst(univ.town.monst[i], univ.cur_pc, dam, type);
|
||||
do_explosion_anim(5,0);
|
||||
end_missile_anim();
|
||||
handle_marked_damage();
|
||||
@@ -4522,8 +4522,8 @@ void hit_space(location target,short dam,eDamageType type,short report,short hit
|
||||
if((hit_monsters) && (univ.town.monst[i].is_alive()) && !stop_hitting)
|
||||
if(univ.town.monst[i].on_space(target)) {
|
||||
if(processing_fields)
|
||||
damage_monst(univ.town.monst[i], 6, dam, type,0);
|
||||
else damage_monst(univ.town.monst[i], (monsters_going) ? 7 : univ.cur_pc, dam, type,0);
|
||||
damage_monst(univ.town.monst[i], 6, dam, type);
|
||||
else damage_monst(univ.town.monst[i], (monsters_going) ? 7 : univ.cur_pc, dam, type);
|
||||
stop_hitting = (hit_all == 1) ? false : true;
|
||||
}
|
||||
|
||||
@@ -4531,7 +4531,7 @@ void hit_space(location target,short dam,eDamageType type,short report,short hit
|
||||
for(cPlayer& pc : univ.party)
|
||||
if(pc.main_status == eMainStatus::ALIVE && !stop_hitting)
|
||||
if(pc.combat_pos == target) {
|
||||
damage_pc(pc,dam,type,eRace::UNKNOWN,0);
|
||||
damage_pc(pc,dam,type,eRace::UNKNOWN);
|
||||
stop_hitting = (hit_all == 1) ? false : true;
|
||||
}
|
||||
} else if(target == univ.party.town_loc) {
|
||||
@@ -4562,7 +4562,7 @@ void do_poison() {
|
||||
if(pc.main_status == eMainStatus::ALIVE)
|
||||
if(pc.status[eStatus::POISON] > 0) {
|
||||
r1 = get_ran(pc.status[eStatus::POISON],1,6);
|
||||
damage_pc(pc,r1,eDamageType::POISON,eRace::UNKNOWN,0);
|
||||
damage_pc(pc,r1,eDamageType::POISON,eRace::UNKNOWN);
|
||||
if(get_ran(1,0,8) < 6)
|
||||
move_to_zero(pc.status[eStatus::POISON]);
|
||||
if(get_ran(1,0,8) < 6)
|
||||
@@ -4635,7 +4635,7 @@ void handle_acid() {
|
||||
if(pc.main_status == eMainStatus::ALIVE)
|
||||
if(pc.status[eStatus::ACID] > 0) {
|
||||
r1 = get_ran(pc.status[eStatus::ACID],1,6);
|
||||
damage_pc(pc,r1,eDamageType::MAGIC,eRace::UNKNOWN,0);
|
||||
damage_pc(pc,r1,eDamageType::MAGIC,eRace::UNKNOWN);
|
||||
move_to_zero(pc.status[eStatus::ACID]);
|
||||
}
|
||||
if(!is_combat())
|
||||
|
@@ -803,19 +803,19 @@ void monst_inflict_fields(short which_monst) {
|
||||
// TODO: If the goal is to damage the monster by any fields it's on, why all the break statements?
|
||||
if(univ.town.is_quickfire(where_check.x,where_check.y)) {
|
||||
r1 = get_ran(2,1,8);
|
||||
damage_monst(*which_m,7,r1,eDamageType::FIRE,0);
|
||||
damage_monst(*which_m,7,r1,eDamageType::FIRE);
|
||||
break;
|
||||
}
|
||||
if(univ.town.is_blade_wall(where_check.x,where_check.y)) {
|
||||
r1 = get_ran(6,1,8);
|
||||
if(have_radiate && which_radiate != eFieldType::WALL_BLADES)
|
||||
damage_monst(*which_m,7,r1,eDamageType::WEAPON,0);
|
||||
damage_monst(*which_m,7,r1,eDamageType::WEAPON);
|
||||
break;
|
||||
}
|
||||
if(univ.town.is_force_wall(where_check.x,where_check.y)) {
|
||||
r1 = get_ran(3,1,6);
|
||||
if(have_radiate && which_radiate != eFieldType::WALL_FORCE)
|
||||
damage_monst(*which_m,7,r1,eDamageType::MAGIC,0);
|
||||
damage_monst(*which_m,7,r1,eDamageType::MAGIC);
|
||||
break;
|
||||
}
|
||||
if(univ.town.is_sleep_cloud(where_check.x,where_check.y)) {
|
||||
@@ -826,7 +826,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(have_radiate && which_radiate != eFieldType::WALL_ICE)
|
||||
damage_monst(*which_m,7,r1,eDamageType::COLD,0);
|
||||
damage_monst(*which_m,7,r1,eDamageType::COLD);
|
||||
break;
|
||||
}
|
||||
if(univ.town.is_scloud(where_check.x,where_check.y)) {
|
||||
@@ -845,7 +845,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(have_radiate && which_radiate != eFieldType::WALL_FIRE)
|
||||
damage_monst(*which_m,7,r1,eDamageType::FIRE,0);
|
||||
damage_monst(*which_m,7,r1,eDamageType::FIRE);
|
||||
break;
|
||||
}
|
||||
if(univ.town.is_force_cage(where_check.x,where_check.y))
|
||||
@@ -866,7 +866,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_m,7,r1,eDamageType::FIRE,0);
|
||||
damage_monst(*which_m,7,r1,eDamageType::FIRE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -2277,18 +2277,10 @@ short damage_pc(cPlayer& which_pc,short how_much,eDamageType damage_type,eRace t
|
||||
if(which_pc.main_status != eMainStatus::ALIVE)
|
||||
return false;
|
||||
|
||||
// TODO: I think there should be a way to force sound_type = 0 for UNBLOCKABLE
|
||||
if(sound_type == 0) {
|
||||
if(damage_type == eDamageType::FIRE || damage_type == eDamageType::UNBLOCKABLE)
|
||||
sound_type = 5;
|
||||
if(damage_type == eDamageType::MAGIC)
|
||||
sound_type = 12;
|
||||
if(damage_type == eDamageType::COLD)
|
||||
sound_type = 7;
|
||||
if(damage_type == eDamageType::POISON)
|
||||
sound_type = 11;
|
||||
}
|
||||
|
||||
// Note: sound type 0 can now be forced for UNBLOCKABLE by passing sound_type 0,
|
||||
// but -1 is the new value for "use default"
|
||||
set_sound_type(damage_type, sound_type);
|
||||
|
||||
// armor
|
||||
if(damage_type == eDamageType::WEAPON || damage_type == eDamageType::UNDEAD || damage_type == eDamageType::DEMON) {
|
||||
how_much -= minmax(-5,5,which_pc.status[eStatus::BLESS_CURSE]);
|
||||
|
@@ -37,7 +37,7 @@ mon_num_t pick_trapped_monst();
|
||||
bool flying() ;
|
||||
void hit_party(short how_much,eDamageType damage_type,short snd_type = 0);
|
||||
void slay_party(eMainStatus mode);
|
||||
short damage_pc(cPlayer& which_pc,short how_much,eDamageType damage_type,eRace type_of_attacker, short sound_type,bool do_print = true);
|
||||
short damage_pc(cPlayer& which_pc,short how_much,eDamageType damage_type,eRace type_of_attacker, short sound_type = -1,bool do_print = true);
|
||||
void petrify_pc(cPlayer& which_pc,int strength);
|
||||
void kill_pc(cPlayer& which_pc,eMainStatus type);
|
||||
void set_pc_moves();
|
||||
|
@@ -381,7 +381,7 @@ bool check_special_terrain(location where_check,eSpecCtx mode,cPlayer& which_pc,
|
||||
hit_party(r1,dam_type);
|
||||
fast_bang = 1;
|
||||
if(mode == eSpecCtx::COMBAT_MOVE)
|
||||
damage_pc(which_pc,r1,dam_type,eRace::UNKNOWN,0);
|
||||
damage_pc(which_pc,r1,dam_type,eRace::UNKNOWN);
|
||||
else
|
||||
boom_space(univ.party.out_loc,overall_mode,pic_type,r1,12);
|
||||
fast_bang = 0;
|
||||
@@ -522,19 +522,19 @@ void check_fields(location where_check,eSpecCtx mode,cPlayer& which_pc) {
|
||||
add_string_to_buf(" Fire wall!");
|
||||
r1 = get_ran(1,1,6) + 1;
|
||||
if(mode == eSpecCtx::COMBAT_MOVE)
|
||||
damage_pc(which_pc,r1,eDamageType::FIRE,eRace::UNKNOWN,0);
|
||||
damage_pc(which_pc,r1,eDamageType::FIRE,eRace::UNKNOWN);
|
||||
}
|
||||
if(univ.town.is_force_wall(where_check.x,where_check.y)) {
|
||||
add_string_to_buf(" Force wall!");
|
||||
r1 = get_ran(2,1,6);
|
||||
if(mode == eSpecCtx::COMBAT_MOVE)
|
||||
damage_pc(which_pc,r1,eDamageType::MAGIC,eRace::UNKNOWN,0);
|
||||
damage_pc(which_pc,r1,eDamageType::MAGIC,eRace::UNKNOWN);
|
||||
}
|
||||
if(univ.town.is_ice_wall(where_check.x,where_check.y)) {
|
||||
add_string_to_buf(" Ice wall!");
|
||||
r1 = get_ran(2,1,6);
|
||||
if(mode == eSpecCtx::COMBAT_MOVE)
|
||||
damage_pc(which_pc,r1,eDamageType::COLD,eRace::UNKNOWN,0);
|
||||
damage_pc(which_pc,r1,eDamageType::COLD,eRace::UNKNOWN);
|
||||
if(!is_combat())
|
||||
boom_space(univ.party.town_loc,overall_mode,4,r1,7);
|
||||
}
|
||||
@@ -542,13 +542,13 @@ void check_fields(location where_check,eSpecCtx mode,cPlayer& which_pc) {
|
||||
add_string_to_buf(" Blade wall!");
|
||||
r1 = get_ran(4,1,8);
|
||||
if(mode == eSpecCtx::COMBAT_MOVE)
|
||||
damage_pc(which_pc,r1,eDamageType::WEAPON,eRace::UNKNOWN,0);
|
||||
damage_pc(which_pc,r1,eDamageType::WEAPON,eRace::UNKNOWN);
|
||||
}
|
||||
if(univ.town.is_quickfire(where_check.x,where_check.y)) {
|
||||
add_string_to_buf(" Quickfire!");
|
||||
r1 = get_ran(2,1,8);
|
||||
if(mode == eSpecCtx::COMBAT_MOVE)
|
||||
damage_pc(which_pc,r1,eDamageType::FIRE,eRace::UNKNOWN,0);
|
||||
damage_pc(which_pc,r1,eDamageType::FIRE,eRace::UNKNOWN);
|
||||
}
|
||||
if(univ.town.is_scloud(where_check.x,where_check.y)) {
|
||||
add_string_to_buf(" Stinking cloud!");
|
||||
@@ -563,7 +563,7 @@ void check_fields(location where_check,eSpecCtx mode,cPlayer& which_pc) {
|
||||
r1 = get_ran(2,1,10);
|
||||
if(is_town()) fast_bang = 1;
|
||||
if(mode == eSpecCtx::COMBAT_MOVE)
|
||||
damage_pc(which_pc,r1,eDamageType::MAGIC,eRace::UNKNOWN,0);
|
||||
damage_pc(which_pc,r1,eDamageType::MAGIC,eRace::UNKNOWN);
|
||||
else hit_party(r1,eDamageType::MAGIC,0);
|
||||
fast_bang = 0;
|
||||
}
|
||||
@@ -894,7 +894,7 @@ void use_item(short pc,short item) {
|
||||
case eItemUse::HARM_ONE:
|
||||
ASB(" You feel terrible.");
|
||||
drain_pc(univ.party[pc],str * 5);
|
||||
damage_pc(univ.party[pc],20 * str,eDamageType::UNBLOCKABLE,eRace::HUMAN,0);
|
||||
damage_pc(univ.party[pc],20 * str,eDamageType::UNBLOCKABLE,eRace::HUMAN);
|
||||
univ.party[pc].disease(2 * str);
|
||||
univ.party[pc].dumbfound(2 * str);
|
||||
break;
|
||||
@@ -907,7 +907,7 @@ void use_item(short pc,short item) {
|
||||
ASB(" You all feel terrible.");
|
||||
for(short i = 0; i < 6; i++) {
|
||||
drain_pc(univ.party[i],str * 5);
|
||||
damage_pc(univ.party[i],20 * str,eDamageType::UNBLOCKABLE,eRace::HUMAN,0);
|
||||
damage_pc(univ.party[i],20 * str,eDamageType::UNBLOCKABLE,eRace::HUMAN);
|
||||
univ.party[i].disease(2 * str);
|
||||
univ.party[i].dumbfound(2 * str);
|
||||
}
|
||||
@@ -969,7 +969,7 @@ void use_item(short pc,short item) {
|
||||
break;
|
||||
case eItemUse::HARM_ONE:
|
||||
ASB(" You feel sick.");
|
||||
damage_pc(univ.party[pc],20 * str,eDamageType::UNBLOCKABLE,eRace::HUMAN,0);
|
||||
damage_pc(univ.party[pc],20 * str,eDamageType::UNBLOCKABLE,eRace::HUMAN);
|
||||
break;
|
||||
case eItemUse::HELP_ALL:
|
||||
ASB(" You all feel better.");
|
||||
@@ -1063,7 +1063,7 @@ void use_item(short pc,short item) {
|
||||
break;
|
||||
case eItemUse::HARM_ONE:
|
||||
ASB(" You feel terrible.");
|
||||
damage_pc(univ.party[pc], str*25, eDamageType::UNBLOCKABLE, eRace::UNKNOWN, 0);
|
||||
damage_pc(univ.party[pc], str*25, eDamageType::UNBLOCKABLE, eRace::UNKNOWN);
|
||||
univ.party[pc].poison(str);
|
||||
break;
|
||||
case eItemUse::HELP_ALL:
|
||||
@@ -1419,6 +1419,19 @@ void change_level(short town_num,short x,short y) {
|
||||
start_town_mode(town_num,9);
|
||||
}
|
||||
|
||||
void set_sound_type(eDamageType dam_type, short& sound_type) {
|
||||
if(sound_type == -1){
|
||||
sound_type = 0;
|
||||
if(dam_type == eDamageType::FIRE || dam_type == eDamageType::UNBLOCKABLE)
|
||||
sound_type = 5;
|
||||
else if(dam_type == eDamageType::COLD)
|
||||
sound_type = 7;
|
||||
else if(dam_type == eDamageType::MAGIC)
|
||||
sound_type = 12;
|
||||
else if(dam_type == eDamageType::POISON)
|
||||
sound_type = 11;
|
||||
}
|
||||
}
|
||||
|
||||
// Damaging and killing monsters needs to be here because several have specials attached to them.
|
||||
short damage_monst(cCreature& victim, short who_hit, short how_much, eDamageType dam_type, short sound_type, bool do_print) {
|
||||
@@ -1429,16 +1442,9 @@ short damage_monst(cCreature& victim, short who_hit, short how_much, eDamageType
|
||||
|
||||
if(victim.active == eCreatureStatus::DEAD) return false;
|
||||
|
||||
if(sound_type == 0) {
|
||||
if(dam_type == eDamageType::FIRE || dam_type == eDamageType::UNBLOCKABLE)
|
||||
sound_type = 5;
|
||||
if(dam_type == eDamageType::COLD)
|
||||
sound_type = 7;
|
||||
if(dam_type == eDamageType::MAGIC)
|
||||
sound_type = 12;
|
||||
if(dam_type == eDamageType::POISON)
|
||||
sound_type = 11;
|
||||
}
|
||||
// Note: sound type 0 can now be forced for UNBLOCKABLE by passing sound_type 0,
|
||||
// but -1 is the new value for "use default"
|
||||
set_sound_type(dam_type, sound_type);
|
||||
|
||||
if(dam_type < eDamageType::SPECIAL) {
|
||||
how_much = percent(how_much, victim.resist[dam_type]);
|
||||
@@ -1788,7 +1794,7 @@ void push_things() {
|
||||
}
|
||||
if(univ.town.is_block(univ.party[i].combat_pos.x,univ.party[i].combat_pos.y)) {
|
||||
ASB("You crash into the block.");
|
||||
damage_pc(univ.party[i],get_ran(1, 1, 6), eDamageType::WEAPON,eRace::UNKNOWN,0);
|
||||
damage_pc(univ.party[i],get_ran(1, 1, 6), eDamageType::WEAPON,eRace::UNKNOWN);
|
||||
}
|
||||
for(short k = 0; k < univ.town.items.size(); k++)
|
||||
if(univ.town.items[k].variety != eItemType::NO_ITEM && univ.town.items[k].held
|
||||
|
@@ -8,7 +8,8 @@ void use_spec_item(short item, bool& need_redraw);
|
||||
void use_item(short pc,short item);
|
||||
bool use_space(location where);
|
||||
bool adj_town_look(location where);
|
||||
short damage_monst(cCreature& which_m, short who_hit, short how_much, eDamageType dam_type, short sound_type, bool do_print = true);
|
||||
void set_sound_type(eDamageType dam_type, short& sound_type);
|
||||
short damage_monst(cCreature& which_m, short who_hit, short how_much, eDamageType dam_type, short sound_type = -1, bool do_print = true);
|
||||
void petrify_monst(cCreature& which_m,int strength);
|
||||
void kill_monst(cCreature& which_m,short who_killed,eMainStatus type = eMainStatus::DEAD);
|
||||
void special_increase_age(long length = 1, bool queue = false);
|
||||
|
@@ -1190,7 +1190,7 @@ void bash_door(location where,short pc_num) {
|
||||
unlock_adjust = univ.scenario.ter_types[terrain].flag2;
|
||||
if(unlock_adjust >= 5 || r1 > (unlock_adjust * 15 + 40) || univ.scenario.ter_types[terrain].flag3 != 1) {
|
||||
add_string_to_buf(" Didn't work.");
|
||||
damage_pc(univ.party[pc_num],get_ran(1,1,4),eDamageType::SPECIAL,eRace::UNKNOWN,0);
|
||||
damage_pc(univ.party[pc_num],get_ran(1,1,4),eDamageType::SPECIAL,eRace::UNKNOWN);
|
||||
}
|
||||
else {
|
||||
add_string_to_buf(" Lock breaks.");
|
||||
|
@@ -77,7 +77,7 @@ bool run_trap(short pc_num,eTrapType trap_type,short trap_level,short diff) {
|
||||
for(short 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(disarmer,r1,eDamageType::WEAPON,eRace::UNKNOWN,0);
|
||||
damage_pc(disarmer,r1,eDamageType::WEAPON,eRace::UNKNOWN);
|
||||
}
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user