[HELP]Monsters do more damage then player.

Welcome in the osRose emulator Project.

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

[HELP]Monsters do more damage then player.

Postby lucets on Wed Jul 15, 2015 4:25 am

I just set up a new client and somehow the mobs to more damage then players. For example i just created a new character and when i attack a mini-jellybean my character does 3-4 damage and the mini-jellybean does 10. Is there anyway to fix this? TYIA
lucets
Smoulie
Smoulie
 
Posts: 41
Joined: Sun Sep 27, 2009 6:57 pm

Re: [HELP]Monsters do more damage then player.

Postby PurpleYouko on Wed Jul 15, 2015 4:41 pm

You can change all the combat formulas in battle.cpp in function DoNormalAttack()
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm

Re: [HELP]Monsters do more damage then player.

Postby lucets on Thu Jul 16, 2015 1:27 pm

PurpleYouko wrote:You can change all the combat formulas in battle.cpp in function DoNormalAttack()


I don't really know what to change in battle.cpp. Do you mind giving me a clean file of the battle.cpp with all thats needed already fixed?
lucets
Smoulie
Smoulie
 
Posts: 41
Joined: Sun Sep 27, 2009 6:57 pm

Re: [HELP]Monsters do more damage then player.

Postby PurpleYouko on Thu Jul 16, 2015 2:52 pm

that isn't really possible.
Every server version has slightly different code and formulas. Some even have different variable names so we can't just take one file and put it into a different server and expect it to compile properly.

As i don't know what exact server version you are using but we are in the OsRose Emulator sub-forum, I will show you how it works in dev rev 3

This code will be found near the top of function void CCharacter::NormalAttack( CCharacter* Enemy )
  1.  
  2. float levelmult = (float) Stats->Level / Enemy->Stats->Level;
  3.     if(levelmult > 2)levelmult = 2;
  4.     float atkdefmult = 0;
  5.     float attack = 0;
  6.     float constant = 4;
  7.     if(Stats->MagicAttack == 1)
  8.     {
  9.         atkdefmult = (float) Stats->Attack_Power / (Enemy->Stats->Magic_Defense);
  10.     }
  11.     else
  12.     {
  13.         atkdefmult = (float) Stats->Attack_Power / (Enemy->Stats->Defense);
  14.     }
  15.     attack = Stats->Attack_Power * levelmult * atkdefmult / constant;
  16.  
  17.     if(attack < 5) attack = 5;
  18.     float d_attack = attack / 100;
  19.     float mod = GServer->RandNumber( 0, 10 ) * d_attack;
  20.     attack += mod;
  21.     long int hitpower = (long int)floor(attack);
  22.     if(IsPlayer( )) //temp fix to find balance btw monster and player
  23.         hitpower = (long int)floor(attack * (GServer->Config.PlayerDmg/100.00));
  24.     if(IsMonster( )) //temp fix to find balance btw monster and player
  25.         hitpower = (long int)floor(attack * (GServer->Config.MonsterDmg/100.00));
  26.  
  27.     if(IsPlayer())//Add Dmg
  28.     {
  29.         if( Stats->ExtraDamage_add !=0 )
  30.         {
  31.             long int hitsave=hitpower;
  32.             hitpower += ((hitpower * Stats->ExtraDamage_add) / 100);
  33.             if(GServer->ServerDebug)
  34.                 Log(MSG_INFO,"ExtraDmg Normal atk: before %i, after %i (ED: %i)",hitsave,hitpower,Stats->ExtraDamage_add);
  35.         }
  36.     }

It should be fairly easy to follow the math.
hitpower is the variable in which we store the damage that will be done to the enemy
As you may notice, this code works for both monsters attacking players and for players attacking monsters. Both players and Monsters are part of the CCharacter class so we can use it in either direction.
The simplest way (not necessarily the best way) of changing the amount of damage done by players and monsters is to adjust GServer->Config.PlayerDmg and GServer->Config.MonsterDmg. These can be set in the database table list_config
If that doesn't work then you will have to look through the math and change a few things then recompile it and test. Getting it just right is quite tricky.
Need to lookup information on NARose items, skills, quests?
Now featuring a newly completed skill tree for all classes
Formatting fixed for different resolutions
Image

"A Gazelle is nothing but a giraffe plotted logarithmicaly"
User avatar
PurpleYouko
Rose Guru
Rose Guru
 
Posts: 4733
Joined: Fri Aug 10, 2007 2:05 pm


Return to Support - OsRose Emulator

Who is online

Users browsing this forum: No registered users and 14 guests

cron