From 865419d1229e96b25806d6fa11270c63b51c4274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo?= Date: Mon, 30 Dec 2024 14:07:10 -0300 Subject: [PATCH] * Fixed chain targets Thanks to @Mortera-world --- markdowns/CHANGELOG.md | 2 ++ src/creatures/combat/combat.cpp | 46 +++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/markdowns/CHANGELOG.md b/markdowns/CHANGELOG.md index 32532dbc..f76eb729 100644 --- a/markdowns/CHANGELOG.md +++ b/markdowns/CHANGELOG.md @@ -47,6 +47,8 @@ ### Bug Fixes - Fixed influenced creatures not spawning. ([Tryller](https://github.com/jprzimba)) +- Fixed sending damage higher then monster health. ([Tryller](https://github.com/jprzimba)) +- Fixed chain targets. ([Mortera-world](https://github.com/Mortera-world)) - Fixed houses with pool bug. ([Tryller](https://github.com/jprzimba)) - Fixed some V.I.P list issues. ([Tryller](https://github.com/jprzimba)) - Fixed gotoHouse talkaction. ([Tryller](https://github.com/jprzimba)) diff --git a/src/creatures/combat/combat.cpp b/src/creatures/combat/combat.cpp index 7de847f7..0d77fcdf 100644 --- a/src/creatures/combat/combat.cpp +++ b/src/creatures/combat/combat.cpp @@ -1516,6 +1516,52 @@ std::vector>> Combat::pickChainTargets if (!spectator || visited.contains(spectator->getID())) { continue; } + + if (spectator->getZoneType() == ZONE_PROTECTION) { + visited.insert(spectator->getID()); + continue; + } + + if (spectator->getNpc()) { + visited.insert(spectator->getID()); + continue; + } + + if (spectator == caster) { + visited.insert(spectator->getID()); + continue; + } + + const auto& casterPlayer = caster->getPlayer(); + const auto& casterMonster = caster->getMonster(); + const auto& spectatorPlayer = spectator->getPlayer(); + const auto& spectatorSummon = spectator->isSummon(); + + if (casterPlayer) { + if (casterPlayer->hasSecureMode()) { + if (spectatorPlayer) { + visited.insert(spectator->getID()); + continue; + } + + if (spectatorSummon && spectator->getMaster() && spectator->getMaster()->getPlayer()) { + visited.insert(spectator->getID()); + continue; + } + } + } else if (casterMonster) { + if (spectatorSummon) { + const auto& master = spectator->getMaster(); + if (!master || !master->getPlayer()) { + visited.insert(spectator->getID()); + continue; + } + } else if (!spectator->getPlayer()) { + visited.insert(spectator->getID()); + continue; + } + } + if (!isValidChainTarget(caster, currentTarget, spectator, params, aggressive)) { visited.insert(spectator->getID()); continue;