[devRev4] MP drops to zero when casting AOE

Welcome in the osRose emulator Project.

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

Re: [devRev4] MP drops to zero when casting AOE

Postby WiseGuy on Thu May 09, 2013 5:42 am

this is mine: (come from svn)

dev rev 4:
  1. UseAtkSkill( CCharacter* Enemy, CSkills* skill, bool deBuff, bool aoe )


dev rev 2:
  1. UseAtkSkill( CCharacter* Enemy, CSkills* skill, bool deBuff )
It is nice to be important
but very very important to be nice
User avatar
WiseGuy
Pomic
Pomic
 
Posts: 112
Joined: Sat Nov 21, 2009 4:03 am
Location: Jakarta

Re: [devRev4] MP drops to zero when casting AOE

Postby kismetbecomes on Thu May 09, 2013 6:03 am

There has to be a place around here where the changes of the SVN is posted right?
RoseZa v437 - HueRose Test Project -- http://hueroseonline.no-ip.biz
kismetbecomes
Rackie
Rackie
 
Posts: 299
Joined: Mon Feb 06, 2012 12:41 am

Re: [devRev4] MP drops to zero when casting AOE

Postby PurpleYouko on Thu May 09, 2013 2:42 pm

what's the URL for the SVN that you are using? It clearly isn't the same as mine
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: [devRev4] MP drops to zero when casting AOE

Postby kismetbecomes on Thu May 09, 2013 5:20 pm

RoseZa v437 - HueRose Test Project -- http://hueroseonline.no-ip.biz
kismetbecomes
Rackie
Rackie
 
Posts: 299
Joined: Mon Feb 06, 2012 12:41 am

Re: [devRev4] MP drops to zero when casting AOE

Postby kismetbecomes on Wed May 15, 2013 7:35 am

Hello PY. I found this in line 1000 (osRose SVN - not roseZa Original..)


  1.  
  2. // do skill attack
  3. bool CCharacter::SkillAttack( CCharacter* Enemy, CSkills* skill )
  4. {
  5.     Position->destiny = Position->current;
  6.     if(Battle->castTime==0)
  7.     {
  8.         BEGINPACKET( pak, 0x7bb );
  9.         ADDWORD    ( pak, clientid );
  10.         GServer->SendToVisible( &pak, this );
  11.         Battle->castTime = clock();
  12.         return true;
  13.     }
  14.     else
  15.     {
  16.         clock_t etime = clock() - Battle->castTime;
  17.         if(etime<SKILL_DELAY)
  18.             return true;
  19.     }
  20.     Battle->castTime = 0;
  21.     UseAtkSkill( Enemy, skill );
  22.     if(skill->costtype[0] == 17)
  23.     Stats->MP -= (skill->mp - (skill->mp * Stats->MPReduction / 100));
  24.     //Some skills uses zulie
  25.     if(skill->costtype[0] == 40)
  26.     {
  27.         CPlayer* thisclient = GServer->GetClientByID(clientid,Position->Map);
  28.         thisclient->CharInfo->Zulies -= skill->costamount[0];
  29.         if(thisclient->CharInfo->Zulies < 0) thisclient->CharInfo->Zulies = 0;
  30.         BEGINPACKET( pak, 0x71d );
  31.         ADDQWORD( pak, thisclient->CharInfo->Zulies );
  32.         thisclient->client->SendPacket( &pak );
  33.     }
  34.     if(skill->costtype[1] == 40)
  35.     {
  36.         CPlayer* thisclient = GServer->GetClientByID(clientid,Position->Map);
  37.         thisclient->CharInfo->Zulies -= skill->costamount[1];
  38.         if(thisclient->CharInfo->Zulies < 0) thisclient->CharInfo->Zulies = 0;
  39.         BEGINPACKET( pak, 0x71d );
  40.         ADDQWORD( pak, thisclient->CharInfo->Zulies );
  41.         thisclient->client->SendPacket( &pak );
  42.  
  43.     }else if(skill->costtype[1] == 17)
  44.     {
  45.         Stats->MP -= (skill->costamount[1] - (skill->mp * Stats->MPReduction / 100));
  46.     }
  47.     if(Stats->MP<0) Stats->MP=0;
  48.     if(Battle->contatk)
  49.     {
  50.         //LMA: Resuming on NormalAttack?
  51.         ResumeNormalAttack(Enemy);
  52.     }
  53.     else
  54.     {
  55.         //osprose
  56.         //ClearBattle( Battle );
  57.         if(GServer->ServerDebug)
  58.             Log(MSG_INFO,"after skill, nothing special, not in contact / range?...");
  59.  
  60.         //he was already fighting the monster in normal_attack mode and did a skill, now he has to resume normal_attack.
  61.         if(Battle->skilltarget!=0&&(Battle->atktarget!=Battle->skilltarget))
  62.         {
  63.             //Stop...
  64.             if(GServer->ServerDebug)
  65.                 Log(MSG_INFO,"after skill, player is doing nothing (first attack).");
  66.             ClearBattle(Battle);
  67.         }
  68.  
  69.     }
  70.  
  71.     GServer->DoSkillScript( this, skill );       //So far only used for summons
  72.     Battle->lastAtkTime = clock( );
  73.     return true;
  74. }
  75.  
  76.  




This part bothers me:
  1.  UseAtkSkill( Enemy, skill );
  2.     if(skill->costtype[0] == 17)
  3.     Stats->MP -= (skill->mp - (skill->mp * Stats->MPReduction / 100));
RoseZa v437 - HueRose Test Project -- http://hueroseonline.no-ip.biz
kismetbecomes
Rackie
Rackie
 
Posts: 299
Joined: Mon Feb 06, 2012 12:41 am

Re: [devRev4] MP drops to zero when casting AOE

Postby PurpleYouko on Wed May 15, 2013 3:48 pm

well let's work it through.

Skill->CostType[0] is almost always equal to 17.
17 represents MP

so Stats->MP -= (skill->mp - (skill->mp * Stats->MPReduction / 100)); is just reducing your MP by an amount equal to the skill cost multiplied by MPReduction / 100
MPReduction / 100 is a percentage.
For example if MPReduction is 80 then MPReduction / 100 = 0.8
That means that the MP consumed is multiplied by 0.8 so you only use 80% of what you normally would

Soooo I do see a potential issue here.
The way that MPReduction is calculated means that the more items giving you reduced MP usage the bigger the number gets
That means that with MPReduction of 10 you pay 10% of the cost but with MPReduction of 200 you actually pay 200% of the base cost :lol:
That's obviously a bit on the WRONG side.

Is that what you meant?
That is some really horrible math on the part of whoever coded it. LOL
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: [devRev4] MP drops to zero when casting AOE

Postby kismetbecomes on Thu May 16, 2013 2:33 am

...because I've looked through all the code where all AOE is declared, nothing seems to be the problem. So I thought the calculations are incorrect.

can we just simply code it this way?
  1. Stats->MP -= (skill->mp * Stats->MPReduction / 100));


I want to ask tho - where is MPReduction coming from?
RoseZa v437 - HueRose Test Project -- http://hueroseonline.no-ip.biz
kismetbecomes
Rackie
Rackie
 
Posts: 299
Joined: Mon Feb 06, 2012 12:41 am

Re: [devRev4] MP drops to zero when casting AOE

Postby Exordium on Thu May 16, 2013 11:49 am

kismetbecomes wrote:...because I've looked through all the code where all AOE is declared, nothing seems to be the problem. So I thought the calculations are incorrect.

can we just simply code it this way?
  1. Stats->MP -= (skill->mp * Stats->MPReduction / 100));


I want to ask tho - where is MPReduction coming from?


it came from stats. something like When you buff. it requires 30. and mp reduction is 10%. so the MP that can be use is now 27. thats how i understand it
Exordium
Smoulie
Smoulie
 
Posts: 67
Joined: Tue Sep 25, 2012 11:10 am

Re: [devRev4] MP drops to zero when casting AOE

Postby PurpleYouko on Thu May 16, 2013 2:02 pm

Just about all staffs have a MP Cost Reduction component in their stats

the problem with the code you suggested
  1. Stats->MP -= (skill->mp * Stats->MPReduction / 100));

is that the cost gets HIGHER as we increase MPReduction.

For a spell with a cost of 100:
If MPReduction = 10 then the actual cost is 100 * 10 / 100 = 10
If MPReduction = 100 then the actual cost is 100 * 100 / 100 = 100
If MPReduction = 200 then the actual cost is 100 * 200 / 100 = 200

It works backwards
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: [devRev4] MP drops to zero when casting AOE

Postby kismetbecomes on Sat May 18, 2013 1:49 am

Hi PY, I reviewed the KTRose battle.cpp and the Original RoseZA devrev IV and the MP calculations are the same.

  1. UseAtkSkill( Enemy, skill );
  2.     Stats->MP -= (skill->mp - (skill->mp * Stats->MPReduction / 100));
RoseZa v437 - HueRose Test Project -- http://hueroseonline.no-ip.biz
kismetbecomes
Rackie
Rackie
 
Posts: 299
Joined: Mon Feb 06, 2012 12:41 am

PreviousNext

Return to Support - OsRose Emulator

Who is online

Users browsing this forum: No registered users and 9 guests

cron