Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.01 KB | None | 0 0
  1. // Scale creature armor based on player level
  2.         uint32 max_armor = (float)creature->GetArmor();
  3.  
  4.         if (max_armor <= 1)
  5.             return armor;
  6.  
  7.         float scaled_armor = 1.0f;
  8.         float default_armor = 1.0f;
  9.         float ratio_armor = 1.0f;
  10.  
  11.         // default : obsolete
  12.         scaled_armor = armor * scaled_level / creature_level;
  13.  
  14.         // Check creatures flags_extra for disable block
  15.         if (creature->GetTypeId() == TYPEID_UNIT)
  16.         {
  17.             CreatureInfo const* cinfo = creature->GetCreatureInfo();
  18.             if (cinfo && cinfo->UnitClass != 0)
  19.             {
  20.                 if (CreatureClassLvlStats const* cCLSS = sObjectMgr.GetCreatureClassLvlStats(creature_level, cinfo->UnitClass, cinfo->Expansion))
  21.                 {
  22.                     default_armor = cCLSS->BaseArmor * cinfo->ArmorMultiplier;
  23.                     ratio_armor = armor / default_armor;
  24.                 }
  25.  
  26.                 if (CreatureClassLvlStats const* cCLSS = sObjectMgr.GetCreatureClassLvlStats(scaled_level, cinfo->UnitClass, cinfo->Expansion))
  27.                     scaled_armor = cCLSS->BaseArmor * cinfo->ArmorMultiplier * ratio_armor;
  28.             }
  29.         }
  30.         armor = scaled_armor;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement