• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ health tick multiplier formula

rudger

Active Member
Joined
Oct 1, 2010
Messages
251
Solutions
1
Reaction score
32
Location
The Netherlands
I don't know how to read this formula:

config.lua

Code:
healthtickmul = 300
manatickmul = 500

promotionhealthtickmul = 350
promotionmanatickmul = 550

const int Player::promotedGainManaVector[5][2] = {{6,1},{2,1},{2,1},{3,1},{6,1}};
const int Player::promotedGainHealthVector[5][2] = {{6,1},{6,1},{6,1},{3,1},{2,1}};

const int Player::gainManaVector[5][2] = {{3,1},{1,1},{1,1},{2,1},{3,1}};
const int Player::gainHealthVector[5][2] = {{3,1},{3,1},{3,1},{2,1},{1,1}};

luascript.cpp

Code:
HEALTH_TICK_MUL = getGlobalNumber("healthtickmul",1);
MANA_TICK_MUL = getGlobalNumber("manatickmul",1);

PROMOTION_HEALTH_TICK_MUL = getGlobalNumber("promotionhealthtickmul",1);
PROMOTION_MANA_TICK_MUL = getGlobalNumber("promotionmanatickmul",1);

player.cpp

Code:
bool Player::gainHealthTick()
{
   int add;
   healthTick++;
   if(vocation >= 0 && vocation < 5)
   {
#ifdef YUR_PREMIUM_PROMOTION
       if(promoted && premmium){
           if(healthTick < promotedGainHealthVector[vocation][0])
               return false;
           healthTick = 0;
           add = promotedGainHealthVector[vocation][1];
       }
       else
#endif //YUR_PREMIUM_PROMOTION
       {
           if(healthTick < gainHealthVector[vocation][0])
               return false;
           healthTick = 0;
           add = gainHealthVector[vocation][1];
       }
   }
   else{
       add = 5;
   }

#ifdef YUR_MULTIPLIERS
Player* player = dynamic_cast<Player*>(this);
if(promoted && premmium){
   health += min(add * g_config.PROMOTION_HEALTH_TICK_MUL, healthmax - health);
}
else if(player->promoted == 0){
     health += min(add * g_config.HEALTH_TICK_MUL, healthmax - health);
}   
else if(player->promoted == 1 && !player->premmium){
     health += min(add * g_config.HEALTH_TICK_MUL, healthmax - health);
#else
   health += min(add, healthmax - health);
#endif //YUR_MULTIPLIERS

   return true;
}
}

Code:
bool Player::gainManaTick()
{
   int add;
   manaTick++;
   if(vocation >= 0 && vocation < 5)
   {
#ifdef YUR_PREMIUM_PROMOTION
       if(promoted && premmium){
           if(manaTick < promotedGainManaVector[vocation][0])
               return false;
           manaTick = 0;
           add = promotedGainManaVector[vocation][1];
       }
       else
#endif //YUR_PREMIUM_PROMOTION
       {
           if(manaTick < gainManaVector[vocation][0])
               return false;
           manaTick = 0;
           add = gainManaVector[vocation][1];
       }
   }
   else{
       add = 5;
   }

#ifdef YUR_MULTIPLIERS
Player* player = dynamic_cast<Player*>(this);
if(promoted && premmium){
   mana += min(add * g_config.PROMOTION_MANA_TICK_MUL, manamax - mana);
}
else if(player->promoted == 0){
     mana += min(add * g_config.MANA_TICK_MUL, manamax - mana);
}   
else if(player->promoted == 1 && !player->premmium){
     mana += min(add * g_config.MANA_TICK_MUL, manamax - mana);   
#else
   mana += min(add, manamax - mana);
#endif //YUR_MULTIPLIERS

   return true;
}
}

I want to know if I can apply this in vocations.xml or somewhere else.

Is it?:
Code:
const int Player::gainManaVector[5][2] = {{no vocation gainmanaticks 6,1},{sorcerer gainmanaticks 2,1},{druid gainmanaticks 2,1},{paladin gainmanaticks 3,1},{knight gainmanaticks 6,1}};
 
Last edited:
Back
Top