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
 

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
229: 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.

232 {
233 // spell proc chance gets severely reduced on victims > 60 (formula unknown)
234 if (victim->GetLevel() > 60)
235 {
236 // gives ~0.1% proc chance at lvl 70
237 float const lvlPenaltyFactor = 9.93f;
238 float const failureChance = (victim->GetLevel() - 60) * lvlPenaltyFactor;
239
240 // base ppm chance was already rolled, only roll success chance
241 return !roll_chance_f(failureChance);
242 }
243
244 return true;
245 }
bool roll_chance_f(float chance)
Definition: Random.h:53
uint8 GetLevel() const
Definition: Unit.h:1432

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