mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-28 15:57:58 +00:00
[Feature] Add Water Line of Sight Checks (#3408)
* [Feature] Add Water Line of Sight Checks This adds rules to enable or disable checks for spells and autofire to prevent casting or autofire from landing if the player or bot do not match their targets plane in regards to water. Currently players and bots can cast or autofire if they are not in the water but their target is and vice versa, this should not be possible. RuleB(Combat, WaterMatchRequiredForAutoFireLoS) set to True (default) checks that both parties are in or out of the water for AutoFire to work. RuleB(Spells, WaterMatchRequiredForLoS) set to True (default) checks that both parties are in or out of the water for spells to land. * Cleanup. * Cleanup. * Cleanup. --------- Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
This commit is contained in:
+17
-2
@@ -101,7 +101,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
#include "mob_movement_manager.h"
|
||||
#include "client.h"
|
||||
#include "mob.h"
|
||||
|
||||
#include "water_map.h"
|
||||
|
||||
extern Zone* zone;
|
||||
extern volatile bool is_zone_loaded;
|
||||
@@ -2356,7 +2356,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, in
|
||||
}
|
||||
|
||||
// check line of sight to target if it's a detrimental spell
|
||||
if(!spells[spell_id].npc_no_los && spell_target && IsDetrimentalSpell(spell_id) && !CheckLosFN(spell_target) && !IsHarmonySpell(spell_id) && spells[spell_id].target_type != ST_TargetOptional)
|
||||
if (!spells[spell_id].npc_no_los && spell_target && IsDetrimentalSpell(spell_id) && (!CheckLosFN(spell_target) || !CheckWaterLoS(spell_target)) && !IsHarmonySpell(spell_id) && spells[spell_id].target_type != ST_TargetOptional)
|
||||
{
|
||||
LogSpells("Spell [{}]: cannot see target [{}]", spell_id, spell_target->GetName());
|
||||
MessageString(Chat::Red,CANT_SEE_TARGET);
|
||||
@@ -7100,3 +7100,18 @@ const CombatRecord &Mob::GetCombatRecord() const
|
||||
{
|
||||
return m_combat_record;
|
||||
}
|
||||
|
||||
bool Mob::CheckWaterLoS(Mob* m)
|
||||
{
|
||||
if (
|
||||
!RuleB(Spells, WaterMatchRequiredForLoS) ||
|
||||
!zone->watermap
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
zone->watermap->InLiquid(GetPosition()) &&
|
||||
zone->watermap->InLiquid(m->GetPosition())
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user