SeeInvis % - Random

Added Function for GetSeeInvisible to pull the % chance from the database to spawn the npc as a SI mob.

If see_invis = 0/1 it will still function as normal, but if it is over 1, it will act as a % chance for the mob to SI.
This commit is contained in:
Trust 2018-07-22 15:02:18 -04:00
parent 58883c2ed4
commit 79c7d9d8f2
2 changed files with 21 additions and 4 deletions

View File

@ -404,10 +404,11 @@ Mob::Mob(const char* in_name,
pStandingPetOrder = SPO_Follow;
pseudo_rooted = false;
see_invis = in_see_invis;
see_invis_undead = in_see_invis_undead != 0;
see_hide = in_see_hide != 0;
see_improved_hide = in_see_improved_hide != 0;
see_invis = GetSeeInvisible(in_see_invis);
see_invis_undead = GetSeeInvisible(in_see_invis_undead);
see_hide = GetSeeInvisible(in_see_hide);
see_improved_hide = GetSeeInvisible(in_see_improved_hide);
qglobal = in_qglobal != 0;
// Bind wound
@ -5679,6 +5680,21 @@ float Mob::HeadingAngleToMob(float other_x, float other_y)
return (90.0f - angle + 270.0f) * 511.5f * 0.0027777778f;
}
bool Mob::GetSeeInvisible(uint8 see_invis)
{
if(see_invis > 0)
{
if(see_invis == 1)
return true;
else
{
if (zone->random.Int(0, 99) < see_invis)
return true;
}
}
return false;
}
int32 Mob::GetSpellStat(uint32 spell_id, const char *identifier, uint8 slot)
{
if (!IsValidSpell(spell_id))

View File

@ -256,6 +256,7 @@ public:
inline bool SeeInvisibleUndead() const { return see_invis_undead; }
inline bool SeeHide() const { return see_hide; }
inline bool SeeImprovedHide() const { return see_improved_hide; }
inline bool GetSeeInvisible(uint8 see_invis);
bool IsInvisible(Mob* other = 0) const;
void SetInvisible(uint8 state);
EQEmu::skills::SkillType AttackAnimation(int Hand, const EQEmu::ItemInstance* weapon, EQEmu::skills::SkillType skillinuse = EQEmu::skills::Skill1HBlunt);