Guest User

Untitled

a guest
Mar 30th, 2016
106
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void NounPlanet::updateAllegiance( dword nTick )
  2. {
  3.     // other factors can affect allegiance levels, so we calculate the XP required here
  4.     m_nAllegianceXPRequired = 1 << ( allegiance() + 2 );
  5.     m_nAllegianceXPRequired *= ALLEGIANCE_XP_MOD;
  6.  
  7.     if ( nTick < m_nAllegianceTick )
  8.         return;
  9.            
  10.     m_nAllegianceTick = nTick + ALLEGIANCE_UPDATE;
  11.    
  12.     // only increase allegiance if we're at 90% control or more
  13.     // and if we're not already at max allegiance
  14.     if ( ( ( control() * 1.1 ) > maxControl() ) && maxAllegiance() > allegiance() )
  15.     {
  16.         m_nAllegianceXP += ALLEGIANCE_UPDATE;      
  17.         if ( m_nAllegianceXP >= m_nAllegianceXPRequired )
  18.         {
  19.             // we may have more than the required XP to level the planet, put that back into the pool
  20.             m_nAllegianceXP = m_nAllegianceXP - m_nAllegianceXPRequired;
  21.             m_nAllegiance++;
  22.         }
  23.     }
  24. }
RAW Paste Data