Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Scale creature armor based on player level
- uint32 max_armor = (float)creature->GetArmor();
- if (max_armor <= 1)
- return armor;
- float scaled_armor = 1.0f;
- float default_armor = 1.0f;
- float ratio_armor = 1.0f;
- // default : obsolete
- scaled_armor = armor * scaled_level / creature_level;
- // Check creatures flags_extra for disable block
- if (creature->GetTypeId() == TYPEID_UNIT)
- {
- CreatureInfo const* cinfo = creature->GetCreatureInfo();
- if (cinfo && cinfo->UnitClass != 0)
- {
- if (CreatureClassLvlStats const* cCLSS = sObjectMgr.GetCreatureClassLvlStats(creature_level, cinfo->UnitClass, cinfo->Expansion))
- {
- default_armor = cCLSS->BaseArmor * cinfo->ArmorMultiplier;
- ratio_armor = armor / default_armor;
- }
- if (CreatureClassLvlStats const* cCLSS = sObjectMgr.GetCreatureClassLvlStats(scaled_level, cinfo->UnitClass, cinfo->Expansion))
- scaled_armor = cCLSS->BaseArmor * cinfo->ArmorMultiplier * ratio_armor;
- }
- }
- armor = scaled_armor;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement