diff --git a/Source/controls/plrctrls.cpp b/Source/controls/plrctrls.cpp index c4ec5092f..038cef4c4 100644 --- a/Source/controls/plrctrls.cpp +++ b/Source/controls/plrctrls.cpp @@ -385,7 +385,7 @@ void CheckPlayerNearby() const Player &myPlayer = *MyPlayer; const SpellID spl = myPlayer._pRSpell; - if (myPlayer.friendlyMode && spl != SpellID::Resurrect && spl != SpellID::HealOther) + if (myPlayer.friendlyMode && IsNoneOf(spl, SpellID::Resurrect, SpellID::HealOther)) return; for (const Player &player : Players) { @@ -393,12 +393,12 @@ void CheckPlayerNearby() continue; const int mx = player.position.future.x; const int my = player.position.future.y; - if (dPlayer[mx][my] == 0 + if ((dPlayer[mx][my] == 0 && spl != SpellID::Resurrect) || !IsTileLit(player.position.future) || (player.hasNoLife() && spl != SpellID::Resurrect)) continue; - if (myPlayer.UsesRangedWeapon() || HasRangedSpell() || spl == SpellID::HealOther) { + if (myPlayer.UsesRangedWeapon() || HasRangedSpell() || IsAnyOf(spl, SpellID::Resurrect, SpellID::HealOther)) { newDdistance = GetDistanceRanged(player.position.future); } else { newDdistance = GetDistance(player.position.future, distance); @@ -2133,7 +2133,7 @@ void PerformSpellAction() const Player &myPlayer = *MyPlayer; const SpellID spl = myPlayer._pRSpell; - if ((PlayerUnderCursor == nullptr && (spl == SpellID::Resurrect || spl == SpellID::HealOther)) + if ((PlayerUnderCursor == nullptr && IsAnyOf(spl, SpellID::Resurrect, SpellID::HealOther)) || (ObjectUnderCursor == nullptr && spl == SpellID::TrapDisarm)) { myPlayer.Say(HeroSpeech::ICantCastThatHere); return; diff --git a/Source/player.cpp b/Source/player.cpp index 1b6f14096..6a7039767 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -1117,7 +1117,7 @@ void CheckNewPath(Player &player, bool pmWillBeCalled) case ACTION_RATTACKPLR: case ACTION_SPELLPLR: target = &Players[targetId]; - if (target->hasNoLife()) { + if (target->hasNoLife() && player.queuedSpell.spellId != SpellID::Resurrect) { player.Stop(); return; } @@ -3208,7 +3208,9 @@ void CheckPlrSpell(bool isShiftHeld, SpellID spellID, SpellType spellType) } else if (pcursmonst != -1 && !isShiftHeld) { LastPlayerAction = PlayerActionType::SpellMonsterTarget; NetSendCmdParam4(true, CMD_SPELLID, pcursmonst, static_cast(spellID), static_cast(spellType), spellFrom); - } else if (PlayerUnderCursor != nullptr && !PlayerUnderCursor->hasNoLife() && !isShiftHeld && !myPlayer.friendlyMode) { + } else if (PlayerUnderCursor != nullptr && !isShiftHeld + && (!myPlayer.friendlyMode || IsAnyOf(spellID, SpellID::HealOther, SpellID::Resurrect)) + && (!PlayerUnderCursor->hasNoLife() || spellID == SpellID::Resurrect)) { LastPlayerAction = PlayerActionType::SpellPlayerTarget; NetSendCmdParam4(true, CMD_SPELLPID, PlayerUnderCursor->getId(), static_cast(spellID), static_cast(spellType), spellFrom); } else { diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 912eb495e..344e77f75 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Bug Fixes +#### Controls + +- Gamepad: Unable to cast Resurrect on players + #### Graphics / Audio - Music doesn't unmute when focus is lost on level transition with Auto Pause On Focus Lost disabled