Skip to content

Commit

Permalink
Explain in code how sanctuary works
Browse files Browse the repository at this point in the history
  • Loading branch information
NQNStudios committed Feb 9, 2025
1 parent a56dac5 commit 32d97a0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/game/boe.combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2801,9 +2801,11 @@ void monster_attack(short who_att,iLiving* target) {
cCreature* m_target = dynamic_cast<cCreature*>(target);
cPlayer* pc_target = dynamic_cast<cPlayer*>(target);

// Check sanctuary
// Check sanctuary for melee
if(target->status[eStatus::INVISIBLE] > 0 || (m_target != nullptr && m_target->invisible)) {
r1 = get_ran(1,1,100);
// Usually hit_chance would be indexed by the weapon skill, not monster level.
// Indexing by monster level is usually a debuff, and half-level moreso.
if(r1 > hit_chance[attacker->level / 2]) {
add_string_to_buf(" Can't find target!");
return;
Expand Down Expand Up @@ -3077,7 +3079,10 @@ void monst_fire_missile(short m_num,short bless,std::pair<eMonstAbil,uAbility> a
snd = 12;
if(abil.second.missile.pic < 0) play_sound(snd);
else run_a_missile(source, targ_space, abil.second.missile.pic, 1, snd, 0, 0, 100);
// Check sanctuary for missile attack
if(target->status[eStatus::INVISIBLE] > 0 || (m_target != nullptr && m_target->invisible)) {
// Usually hit_chance would be indexed by the weapon skill, not monster level.
// Indexing by monster level is usually a debuff.
if(get_ran(1,1,100) > hit_chance[univ.town.monst[m_num].level]) {
add_string_to_buf(" Can't find target!");
return;
Expand Down

0 comments on commit 32d97a0

Please sign in to comment.