Skip to content

Commit

Permalink
Merge pull request #595 from NQNStudios:fix-invis
Browse files Browse the repository at this point in the history
Fix invis
Fix #110
  • Loading branch information
CelticMinstrel authored Feb 9, 2025
2 parents e81cde1 + c4f67de commit 7fba824
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/game/Priest.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h2 id='L1'>Level 1</h2>
amount of damage to it. It has no effect on non-undead.</li>
<li>Location: (C 1) Returns the party's x-y location in the town or outdoors.</li>
<li>Sanctuary: (C 1) The target of this spell becomes magically shielded.</li>
<li>For a time, monsters probably won't be able to attack them. The effects disappears
<li>For a time, monsters probably won't be able to attack them. The effects disappear
when the PC attacks someone.</li>
<li>Symbiosis: (C 3) This spell has the caster absorb the damage taken by another
character. The higher the caster's level, the less damage the caster takes per health
Expand Down
9 changes: 7 additions & 2 deletions src/game/boe.combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2801,13 +2801,15 @@ 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;
}
return;
}

for(short i = 0; i < attacker->a.size(); i++) {
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 7fba824

Please sign in to comment.