Make more usage of CancelSneakHide

This commit is contained in:
Michael Cook (mackal) 2016-06-30 21:49:00 -04:00
parent 54de212214
commit 37b46d1289
2 changed files with 12 additions and 43 deletions

View File

@ -4438,17 +4438,7 @@ void Mob::CommonBreakInvisibleFromCombat()
invisible_animals = false;
}
if(hidden || improved_hidden){
hidden = false;
improved_hidden = false;
auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct));
SpawnAppearance_Struct* sa_out = (SpawnAppearance_Struct*)outapp->pBuffer;
sa_out->spawn_id = GetID();
sa_out->type = 0x03;
sa_out->parameter = 0;
entity_list.QueueClients(this, outapp, true);
safe_delete(outapp);
}
CancelSneakHide();
if (spellbonuses.NegateIfCombat)
BuffFadeByEffect(SE_NegateIfCombat);

View File

@ -6759,49 +6759,28 @@ void Mob::BreakInvisibleSpells()
}
}
void Client::BreakSneakWhenCastOn(Mob* caster, bool IsResisted)
void Client::BreakSneakWhenCastOn(Mob *caster, bool IsResisted)
{
bool IsCastersTarget = false; //Chance to avoid only applies to AOE spells when not targeted.
if(hidden || improved_hidden){
if (caster){
Mob* target = nullptr;
bool IsCastersTarget = false; // Chance to avoid only applies to AOE spells when not targeted.
if (hidden || improved_hidden) {
if (caster) {
Mob *target = nullptr;
target = caster->GetTarget();
if (target && target == this){
IsCastersTarget = true;
}
IsCastersTarget = target && target == this;
}
if (!IsCastersTarget){
int chance = spellbonuses.NoBreakAESneak + itembonuses.NoBreakAESneak + aabonuses.NoBreakAESneak;
if (!IsCastersTarget) {
int chance =
spellbonuses.NoBreakAESneak + itembonuses.NoBreakAESneak + aabonuses.NoBreakAESneak;
if (IsResisted)
chance *= 2;
if(chance && (zone->random.Roll(chance)))
if (chance && zone->random.Roll(chance))
return; // Do not drop Sneak/Hide
}
//TODO: The skill buttons should reset when this occurs. Not sure how to force that yet. - Kayen
hidden = false;
improved_hidden = false;
auto outapp = new EQApplicationPacket(OP_SpawnAppearance, sizeof(SpawnAppearance_Struct));
SpawnAppearance_Struct* sa_out = (SpawnAppearance_Struct*)outapp->pBuffer;
sa_out->spawn_id = GetID();
sa_out->type = 0x03;
sa_out->parameter = 0;
entity_list.QueueClients(this, outapp, false);
safe_delete(outapp);
Message_StringID(MT_Skills,NO_LONGER_HIDDEN);
//Sneaking alone will not be disabled from spells, only hide+sneak.
if (sneaking){
sneaking = false;
SendAppearancePacket(AT_Sneak, 0);
Message_StringID(MT_Skills,STOP_SNEAKING);
}
CancelSneakHide();
}
}