Making mobs stronger at certain player level

09/10/2013 16:17 Sedrika#16
Go to AttackArbiter.cpp and search for
Code:
int CAttackArbiter::OnDamageMsgW()
and add this
Code:
#ifdef __MONSTER_STAT_PUSH
	if( m_pAttacker->IsPlayer() && !m_pDefender->IsPlayer() )
	{
		MoverProp* pMoverProp = m_pDefender->GetProp();
		if( pMoverProp )
		{
			int nAddStat = 0;
			if( m_pAttacker->GetLevel() >= 150 )
				nAddStat = 10;
			else if( m_pAttacker->GetLevel() >= 140 )
				nAddStat = 8;
			//....

			pMoverProp->dwStr += nAddStat;
			pMoverProp->dwSta += nAddStat;
			pMoverProp->dwDex += nAddStat;
			pMoverProp->dwInt += nAddStat;
		}
	}
#endif // __MONSTER_STAT_PUSH
below this
Code:
	ATTACK_INFO info;
	info.dwAtkFlags = m_dwAtkFlags;
	info.pAttacker  = m_pAttacker;
	info.pDefender  = m_pDefender;
	info.nParam     = m_nParam;
	info.nParts     = PARTS_RWEAPON;
and define this
Code:
__MONSTER_STAT_PUSH
only in WorldServer.

That's all.
09/10/2013 17:02 raventh1984#17
Thank you verry much Sedrika.

Will this also have an effect on the Min atk and Max atk and the HP of the mob?

So if i will do this

Code:
#ifdef __MONSTER_STAT_PUSH
	if( m_pAttacker->IsPlayer() && !m_pDefender->IsPlayer() )
	{
		MoverProp* pMoverProp = m_pDefender->GetProp();
		if( pMoverProp )
		{
			int nAddStat = 0;
			if( m_pAttacker->GetLevel() >= 150 )
				nAddStat = 10;
				nAddAtkMin = 100;
				nAddAtkMax = 100;
				nAddMaxHP = 250;
			else if( m_pAttacker->GetLevel() >= 140 )
				nAddStat = 8;
			//....

			pMoverProp->dwStr += nAddStat;
			pMoverProp->dwSta += nAddStat;
			pMoverProp->dwDex += nAddStat;
			pMoverProp->dwInt += nAddStat;
			pMoverProp->dwAtkMax += nAddAtkMax;
			pMoverProp->dwAtkMin += nAddAtkMin;
			pMoverProp->dwAddHp += nAddMaxHP;
		}
	}
#endif // __MONSTER_STAT_PUSH
09/10/2013 17:09 Sedrika#18
I'd do it this way.

Code:
#ifdef __MONSTER_STAT_PUSH
	if( m_pAttacker->IsPlayer() && !m_pDefender->IsPlayer() )
	{
		MoverProp* pMoverProp = m_pDefender->GetProp();
		if( pMoverProp )
		{
			int nAddStat = 0;
			int nAddAtkMin = 0;
			int nAddAtkMax = 0;
			float nAddMaxHP = 1.0f; // Has to be 1.0f
			if( m_pAttacker->GetLevel() >= 150 )
			{
				nAddStat = 10;
				nAddAtkMin = 100;
				nAddAtkMax = 100;
				nAddMaxHP = 2.5f; // 250%
			}
			else if( m_pAttacker->GetLevel() >= 140 )
			{
				nAddStat = 8;
				nAddAtkMin = 80;
				nAddAtkMax = 80;
				nAddMaxHP = 2.0f; // 200%
			}
			//....

			pMoverProp->dwStr += nAddStat;
			pMoverProp->dwSta += nAddStat;
			pMoverProp->dwDex += nAddStat;
			pMoverProp->dwInt += nAddStat;
			pMoverProp->dwAtkMax += nAddAtkMax;
			pMoverProp->dwAtkMin += nAddAtkMin;
			pMoverProp->dwAddHp *= nAddMaxHP;
		}
	}
#endif // __MONSTER_STAT_PUSH
and you'd have a logicial error in the if/else statements for missing { and }.
And you shouldn't use an integer for changing the HP max value. Float values would be better and it is more comfortable.
09/10/2013 17:48 raventh1984#19
Yes i was aware of that error. What i did was an example.

and i really must say thank you for an excellent explanation on how to do this.
09/10/2013 17:54 Mognakor#20
Whats the sense with Modifying the prop? This function is getting called on each attack, so each time the monster attacks it gets stronger and this will not only affect the current boss but any boss until the you restart the worldserver....


Just open AttackArbiter.cpp and chose one of the various functions add the checks and increase the damage by a factor before returning it to the next function. Finding the right one takes less than 5 minutes and if you spend one hour you can completly adjust Critrate/Dmg,Block,Evasion etc. further you can check what kind of monster it is (Behemoth, Kalgas Worm etc.) so you can put different levels at which these grow stronger.