AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
item_generic_limit_chance_above_60 Class Reference
Inheritance diagram for item_generic_limit_chance_above_60:
ItemScript ScriptObject

Public Member Functions

 item_generic_limit_chance_above_60 ()
 
bool OnCastItemCombatSpell (Player *, Unit *victim, SpellInfo const *, Item *) override
 
- Public Member Functions inherited from ItemScript
bool IsDatabaseBound () const override
 
virtual bool OnQuestAccept (Player *, Item *, Quest const *)
 
virtual bool OnUse (Player *, Item *, SpellCastTargets const &)
 
virtual bool OnRemove (Player *, Item *)
 
virtual bool OnCastItemCombatSpell (Player *, Unit *, SpellInfo const *, Item *)
 
virtual bool OnExpire (Player *, ItemTemplate const *)
 
virtual void OnGossipSelect (Player *, Item *, uint32, uint32)
 
virtual void OnGossipSelectCode (Player *, Item *, uint32, uint32, const char *)
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
uint16 GetTotalAvailableHooks ()
 

Additional Inherited Members

- Protected Member Functions inherited from ItemScript
 ItemScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ item_generic_limit_chance_above_60()

item_generic_limit_chance_above_60::item_generic_limit_chance_above_60 ( )
inline
197: ItemScript("item_generic_limit_chance_above_60") { }
Definition: ItemScript.h:24

Member Function Documentation

◆ OnCastItemCombatSpell()

bool item_generic_limit_chance_above_60::OnCastItemCombatSpell ( Player ,
Unit victim,
SpellInfo const *  ,
Item  
)
inlineoverridevirtual

Reimplemented from ItemScript.

200 {
201 // spell proc chance gets severely reduced on victims > 60 (formula unknown)
202 if (victim->GetLevel() > 60)
203 {
204 // gives ~0.1% proc chance at lvl 70
205 float const lvlPenaltyFactor = 9.93f;
206 float const failureChance = (victim->GetLevel() - 60) * lvlPenaltyFactor;
207
208 // base ppm chance was already rolled, only roll success chance
209 return !roll_chance_f(failureChance);
210 }
211
212 return true;
213 }
bool roll_chance_f(float chance)
Definition: Random.h:53
uint8 GetLevel() const
Definition: Unit.h:855

References Unit::GetLevel(), and roll_chance_f().