mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-14 20:12:26 +00:00
min_range field
This commit is contained in:
parent
ef982b9ce2
commit
f3710856ad
@ -740,6 +740,7 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_
|
|||||||
|
|
||||||
float dist = caster->GetAOERange(spell_id);
|
float dist = caster->GetAOERange(spell_id);
|
||||||
float dist2 = dist * dist;
|
float dist2 = dist * dist;
|
||||||
|
float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range;
|
||||||
float dist_targ = 0;
|
float dist_targ = 0;
|
||||||
|
|
||||||
bool bad = IsDetrimentalSpell(spell_id);
|
bool bad = IsDetrimentalSpell(spell_id);
|
||||||
@ -760,6 +761,8 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_
|
|||||||
dist_targ = center->DistNoRoot(*curmob);
|
dist_targ = center->DistNoRoot(*curmob);
|
||||||
if (dist_targ > dist2) //make sure they are in range
|
if (dist_targ > dist2) //make sure they are in range
|
||||||
continue;
|
continue;
|
||||||
|
if (dist_targ < min_range2) //make sure they are in range
|
||||||
|
continue;
|
||||||
if (isnpc && curmob->IsNPC()) { //check npc->npc casting
|
if (isnpc && curmob->IsNPC()) { //check npc->npc casting
|
||||||
FACTION_VALUE f = curmob->GetReverseFactionCon(caster);
|
FACTION_VALUE f = curmob->GetReverseFactionCon(caster);
|
||||||
if (bad) {
|
if (bad) {
|
||||||
|
|||||||
@ -4538,7 +4538,7 @@ Mob *EntityList::GetClosestMobByBodyType(Mob *sender, bodyType BodyType)
|
|||||||
return ClosestMob;
|
return ClosestMob;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityList::GetTargetsForConeArea(Mob *start, uint32 radius, uint32 height, std::list<Mob*> &m_list)
|
void EntityList::GetTargetsForConeArea(Mob *start, float min_radius, float radius, float height, std::list<Mob*> &m_list)
|
||||||
{
|
{
|
||||||
auto it = mob_list.begin();
|
auto it = mob_list.begin();
|
||||||
while (it != mob_list.end()) {
|
while (it != mob_list.end()) {
|
||||||
@ -4547,15 +4547,15 @@ void EntityList::GetTargetsForConeArea(Mob *start, uint32 radius, uint32 height,
|
|||||||
++it;
|
++it;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int32 x_diff = ptr->GetX() - start->GetX();
|
float x_diff = ptr->GetX() - start->GetX();
|
||||||
int32 y_diff = ptr->GetY() - start->GetY();
|
float y_diff = ptr->GetY() - start->GetY();
|
||||||
int32 z_diff = ptr->GetZ() - start->GetZ();
|
float z_diff = ptr->GetZ() - start->GetZ();
|
||||||
|
|
||||||
x_diff *= x_diff;
|
x_diff *= x_diff;
|
||||||
y_diff *= y_diff;
|
y_diff *= y_diff;
|
||||||
z_diff *= z_diff;
|
z_diff *= z_diff;
|
||||||
|
|
||||||
if ((x_diff + y_diff) <= (radius * radius))
|
if ((x_diff + y_diff) <= (radius * radius) && (x_diff + y_diff) >= (min_radius * min_radius))
|
||||||
if(z_diff <= (height * height))
|
if(z_diff <= (height * height))
|
||||||
m_list.push_back(ptr);
|
m_list.push_back(ptr);
|
||||||
|
|
||||||
|
|||||||
@ -406,7 +406,7 @@ public:
|
|||||||
void GetObjectList(std::list<Object*> &o_list);
|
void GetObjectList(std::list<Object*> &o_list);
|
||||||
void GetDoorsList(std::list<Doors*> &d_list);
|
void GetDoorsList(std::list<Doors*> &d_list);
|
||||||
void GetSpawnList(std::list<Spawn2*> &d_list);
|
void GetSpawnList(std::list<Spawn2*> &d_list);
|
||||||
void GetTargetsForConeArea(Mob *start, uint32 radius, uint32 height, std::list<Mob*> &m_list);
|
void GetTargetsForConeArea(Mob *start, float min_radius, float radius, float height, std::list<Mob*> &m_list);
|
||||||
|
|
||||||
void DepopAll(int NPCTypeID, bool StartSpawnTimer = true);
|
void DepopAll(int NPCTypeID, bool StartSpawnTimer = true);
|
||||||
|
|
||||||
|
|||||||
@ -658,6 +658,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) {
|
|||||||
range = caster->GetAOERange(spell_id);
|
range = caster->GetAOERange(spell_id);
|
||||||
|
|
||||||
float range2 = range*range;
|
float range2 = range*range;
|
||||||
|
float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range;
|
||||||
|
|
||||||
// caster->SpellOnTarget(spell_id, caster);
|
// caster->SpellOnTarget(spell_id, caster);
|
||||||
|
|
||||||
@ -673,7 +674,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) {
|
|||||||
else if(members[z] != nullptr)
|
else if(members[z] != nullptr)
|
||||||
{
|
{
|
||||||
distance = caster->DistNoRoot(*members[z]);
|
distance = caster->DistNoRoot(*members[z]);
|
||||||
if(distance <= range2) {
|
if(distance <= range2 && distance >= min_range2) {
|
||||||
members[z]->CalcSpellPowerDistanceMod(spell_id, distance);
|
members[z]->CalcSpellPowerDistanceMod(spell_id, distance);
|
||||||
caster->SpellOnTarget(spell_id, members[z]);
|
caster->SpellOnTarget(spell_id, members[z]);
|
||||||
#ifdef GROUP_BUFF_PETS
|
#ifdef GROUP_BUFF_PETS
|
||||||
|
|||||||
@ -567,6 +567,7 @@ void HateList::SpellCast(Mob *caster, uint32 spell_id, float range)
|
|||||||
//So keep a list of entity ids and look up after
|
//So keep a list of entity ids and look up after
|
||||||
std::list<uint32> id_list;
|
std::list<uint32> id_list;
|
||||||
range = range * range;
|
range = range * range;
|
||||||
|
float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range;
|
||||||
float dist_targ = 0;
|
float dist_targ = 0;
|
||||||
auto iterator = list.begin();
|
auto iterator = list.begin();
|
||||||
while (iterator != list.end())
|
while (iterator != list.end())
|
||||||
@ -575,7 +576,7 @@ void HateList::SpellCast(Mob *caster, uint32 spell_id, float range)
|
|||||||
if(range > 0)
|
if(range > 0)
|
||||||
{
|
{
|
||||||
dist_targ = caster->DistNoRoot(*h->ent);
|
dist_targ = caster->DistNoRoot(*h->ent);
|
||||||
if(dist_targ <= range)
|
if(dist_targ <= range && dist_targ >= min_range2)
|
||||||
{
|
{
|
||||||
id_list.push_back(h->ent->GetID());
|
id_list.push_back(h->ent->GetID());
|
||||||
h->ent->CalcSpellPowerDistanceMod(spell_id, dist_targ);
|
h->ent->CalcSpellPowerDistanceMod(spell_id, dist_targ);
|
||||||
|
|||||||
@ -205,7 +205,7 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial)
|
|||||||
effect_value = GetMaxHP();
|
effect_value = GetMaxHP();
|
||||||
|
|
||||||
if (_IsPowerDistModSpell)
|
if (_IsPowerDistModSpell)
|
||||||
effect_value += (effect_value*(GetSpellPowerDistanceMod()/100)/100);
|
effect_value = effect_value*(GetSpellPowerDistanceMod()/100);
|
||||||
|
|
||||||
#ifdef SPELL_EFFECT_SPAM
|
#ifdef SPELL_EFFECT_SPAM
|
||||||
effect_desc[0] = 0;
|
effect_desc[0] = 0;
|
||||||
@ -6471,6 +6471,6 @@ void Mob::CalcSpellPowerDistanceMod(uint16 spell_id, float range, Mob* caster)
|
|||||||
float mod = spells[spell_id].min_dist_mod + (dist_from_min * (dm_mod_interval/dm_range));
|
float mod = spells[spell_id].min_dist_mod + (dist_from_min * (dm_mod_interval/dm_range));
|
||||||
mod *= 100.0f;
|
mod *= 100.0f;
|
||||||
|
|
||||||
SetSpellPowerDistanceMod(static_cast<int>(mod));
|
SetSpellPSetSpellPowerDistanceMod(static_cast<int>(mod));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1909,12 +1909,19 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
|
|||||||
//casting a spell on somebody but ourself, make sure they are in range
|
//casting a spell on somebody but ourself, make sure they are in range
|
||||||
float dist2 = DistNoRoot(*spell_target);
|
float dist2 = DistNoRoot(*spell_target);
|
||||||
float range2 = range * range;
|
float range2 = range * range;
|
||||||
|
float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range;
|
||||||
if(dist2 > range2) {
|
if(dist2 > range2) {
|
||||||
//target is out of range.
|
//target is out of range.
|
||||||
mlog(SPELLS__CASTING, "Spell %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2);
|
mlog(SPELLS__CASTING, "Spell %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2);
|
||||||
Message_StringID(13, TARGET_OUT_OF_RANGE);
|
Message_StringID(13, TARGET_OUT_OF_RANGE);
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
else if (dist2 < min_range2){
|
||||||
|
//target is too close range.
|
||||||
|
mlog(SPELLS__CASTING, "Spell %d: Spell target is too close (squared: %f < %f)", spell_id, dist2, min_range2);
|
||||||
|
Message_StringID(13, TARGET_TOO_CLOSE);
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
spell_target->CalcSpellPowerDistanceMod(spell_id, dist2);
|
spell_target->CalcSpellPowerDistanceMod(spell_id, dist2);
|
||||||
}
|
}
|
||||||
@ -2100,7 +2107,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
|
|||||||
std::list<Mob*> targets_in_range;
|
std::list<Mob*> targets_in_range;
|
||||||
std::list<Mob*>::iterator iter;
|
std::list<Mob*>::iterator iter;
|
||||||
|
|
||||||
entity_list.GetTargetsForConeArea(this, spells[spell_id].aoerange, spells[spell_id].aoerange / 2, targets_in_range);
|
entity_list.GetTargetsForConeArea(this, spells[spell_id].min_range, spells[spell_id].aoerange, spells[spell_id].aoerange / 2, targets_in_range);
|
||||||
iter = targets_in_range.begin();
|
iter = targets_in_range.begin();
|
||||||
while(iter != targets_in_range.end())
|
while(iter != targets_in_range.end())
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user