AzeorthCore 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
 

Additional Inherited Members

- Protected Member Functions inherited from ItemScript
 ItemScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name)
 
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
253: ItemScript("item_generic_limit_chance_above_60") { }
Definition: ScriptMgr.h:382

Member Function Documentation

◆ OnCastItemCombatSpell()

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

Reimplemented from ItemScript.

256 {
257 // spell proc chance gets severely reduced on victims > 60 (formula unknown)
258 if (victim->getLevel() > 60)
259 {
260 // gives ~0.1% proc chance at lvl 70
261 float const lvlPenaltyFactor = 9.93f;
262 float const failureChance = (victim->getLevel() - 60) * lvlPenaltyFactor;
263
264 // base ppm chance was already rolled, only roll success chance
265 return !roll_chance_f(failureChance);
266 }
267
268 return true;
269 }
bool roll_chance_f(float chance)
Definition: Random.h:53
uint8 getLevel() const
Definition: Unit.h:1418

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