- //Skill power calculations LMA/Tomiz : New Way
- long int skillpower = (skill->atkpower*0.5) + (Stats->Attack_Power*0.5); // 60% skillpower, 20% attackpower
- //if(GServer->ServerDebug)
- // Log( MSG_INFO, "Skillpower = %i (%i + %i)",skillpower,skill->atkpower,Stats->Attack_Power);
- float levelmult = (float) Stats->Level / Enemy->Stats->Level;
- if(levelmult > 2)levelmult = 2; //cap level multiplier at 2
- float atkdefmult = 0;
- float attack = 0;
- float constant = 9;
- unsigned int skill_hitvalue = (unsigned int)floor(Stats->Accuracy * 50 / Enemy->Stats->Dodge);
- if(IsMonster( ) && !IsSummon())
- skill_hitvalue = (unsigned int)floor (Stats->Accuracy) * 55/ (Enemy->Stats->Dodge*1.5);
- if(skill_hitvalue>100) skill_hitvalue = 99;
- switch(skill->formula)//Magical Or Weapon Type Skill?
- {
- case 0://Skill Mental Storm
- {
- atkdefmult = 0;
- }
- break;
- case 1://Weapon type dmg
- {
- atkdefmult = (float) Stats->Attack_Power / (Enemy->Stats->Magic_Defense+(Enemy->Stats->Defense));
- skillpower += GetSen();
- if(GServer->RandNumber( 30, 100 )>skill_hitvalue) atkdefmult /= 2; // Miss results in damage cut in half.
- }
- break;
- case 2://Magical type dmg
- {
- atkdefmult = (float) (Stats->Attack_Power * 0.90) / (Enemy->Stats->Magic_Defense+Enemy->Stats->Defense); // -10% damage for OP clerics
- skillpower += GetInt();
- if(GServer->RandNumber( 30, 100 )>skill_hitvalue) atkdefmult /= 2; // Miss results in damage cut in half.
- }
- break;
- case 3://Weapon type dmg
- {
- atkdefmult = (float) Stats->Attack_Power / (Enemy->Stats->Magic_Defense+Enemy->Stats->Defense);
- skillpower += GetSen();
- if(GServer->RandNumber( 30, 100 )>skill_hitvalue) atkdefmult = 0; // Complete Miss.
- }
- break;
- case 4://Magical type dmg
- {
- atkdefmult = (float) Stats->Attack_Power / (Enemy->Stats->Magic_Defense+Enemy->Stats->Defense);
- skillpower += GetInt();
- if(GServer->RandNumber( 30, 100 )>skill_hitvalue) atkdefmult = 0; // Complete Miss.
- }
- break;
- case 6://Dual Scratch
- {
- atkdefmult = 1;
- }
- break;
- default:
- {
- atkdefmult = 1;
- }
- break;
- }
Important note: Especially the merged cases in the reworked formula might not work for a server that is NOT REV2 or higher (ie. Ktrose/OspRose/OsIrose) because the list_skill.stb values vary from our current client)
This is basically a summary post that is going to show you how to make fights in your server more balanced by adjusting the way skills work. The current code is quite a mess and there is a lot of stuff that has just been carelessly copied from the normal attack formula. I only cleaned this up with the help of PY and added a few tweaks so that:
- -Skillpower is actually split between magical damage and normal damage
-Skillpower actually takes defense and magical defense into account
-Skills can actually miss, which wasn't the case with the current system
-By using tiny tweaks, battles get a lot more balanced PvP-wise
All this is handled in your battle.cpp, so open that up and find
Please note that your values for ie skillpower formula may vary a little, I'm not using a clean source code for the example
snippet from below CCharacter::UseAtkSkill
and go ahead and replace that with
- //Skill power calculations LMA/Tomiz : New Way
- long int skillpower = (skill->atkpower*0.5) + (Stats->Attack_Power*0.5) / 2 ;
- float skilldefense = 0 ;
- switch(skill->formula)//Magical Or Weapon Type Skill?
- {
- case 0://Skill Mental Storm
- {
- skilldefense = (float) Stats->Attack_Power / (Enemy->Stats->Magic_Defense * 2.5) ;
- }
- break;
- case 1: case 3: //Weapon type dmg
- {
- skilldefense = (float) Stats->Attack_Power / (Enemy->Stats->Defense * 1.5) ;
- }
- break;
- case 2: case 4: //Magical type dmg
- {
- skillpower += GetInt();
- skilldefense = (float) Stats->Attack_Power / (Enemy->Stats->Magic_Defense * 2.5) ;
- }
- break;
- case 6://Dual Scratch
- {
- skilldefense = (float) Stats->Attack_Power / (Enemy->Stats->Defense * 1.5) ;
- }
- break;
- default:
- {
- skilldefense = 1 ;
- }
- break;
- }
- if (skilldefense > 1) skilldefense = 1 ;
- skillpower*= skilldefense ;
Then, in order to implement the new hit/miss system for skills, find
- Enemy->Stats->HP -= (long long) skillpower;
and right above it, add
- //new skilldodge system
- float hitormis = (float)floor(Stats->Accury * 85 / Enemy->Stats->Dodge);
- if(hitormis >100) hitormis = 100;
- if(GServer->RandNumber( 0, 100 )>hitormis) skillpower = 0;
It is quite a basic dodge system as you can see, but it works just fine. The only thing to note is that reliable skills are not yet supported by this code (shouldn't be too hard to code though). I might add this in a later update. the * 85 behind accury is the sweetspot for me but feel free to change this to whatever value you desire (higher is less misses, lower is more misses)
So the big changes here are:
- I merged 4 cases into 2 cases, for normal skills we either do a weapon attack or a magic attack (this is declared in LIST_SKILL.STB).
When a player uses a weapon attack:
- skilldefense = (float) Stats->Attack_Power / (Enemy->Stats->Defense * 1.5) ;
When a player uses a magical attack:
- skilldefense = (float) Stats->Attack_Power / (Enemy->Stats->Magic_Defense * 2.5) ;
-I removed a bonus based on SEN stat for weapon attacks
-I removed increased damage for when players are levels apart
-I adjusted the base skillpower formula so that it scales 50/50 on respectively skilldamage & attackpower
-Added a new dodge system
-Scrapped at least three variables that came from normal attacks but had zero use in the code beside from just being declared
-I made sure that defense and magical defense were taken into account as seperate things. Note that magical defense is multiplied by 2.5 rather than 1.5 out of balancing motives, feel free to play around with the values.
-I left the int bonus in place for magical skills because it made sense to me.
So thats it, huge thanks to PurpleYouko who helped me understand everything and pointed out to me that the system needed some work. Would love to hear your feedback and tweaks so that we can continue working on this or other things.
Have fun
All the work originated from the post right here, take a look if you're interested in detailed changes.
viewtopic.php?f=18&t=5835