Attack code split adds magic attack

If you want to help us or give some corrections / codes, put it here ;)

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

Re: Attack code split adds magic attack

Postby Sethanye on Wed Nov 10, 2010 5:41 am

100*0.25 = 25%
100/4 = 25%

its just a reversed formula

and 25% was used cos it was the most fitting number i would guess lol
~ Learning Flash ~ Anyone Know Any Good Tutorial DVDs? ~
Image
"Come Into My Dream, Let Me Show You Where I've Been.
Its You And Me I've Seen, Let Me Tell You What I Mean."
User avatar
Sethanye
Neko Chan
Neko Chan
 
Posts: 2603
Joined: Fri Jan 18, 2008 11:23 am
Location: ~ Resident Graphics Artist ~

Re: Attack code split adds magic attack

Postby Sousie on Wed Nov 10, 2010 12:16 pm

Ok we tested this code, but now monsters seem to do super high damage. One of the testers reported that gray monsters kill him easy even though he has high defence.
Sousie
Smoulie
Smoulie
 
Posts: 42
Joined: Sun Oct 24, 2010 2:38 pm

Re: Attack code split adds magic attack

Postby PurpleYouko on Wed Nov 10, 2010 2:53 pm

Planetary_Myth wrote:Thanks PurpleYouko you are saving me time from writing code that already exists.
I will see if I can find the code in question and add it to dev rev 2.

Fixed a mistake in battle.cpp code that would not let it compile.

code before
  1. LvlDiff = ((Stats->Level - Enemy->Stats->Level) * .25);


code now (replaced in first post as well)
  1. LvlDiff = (Stats->Level - Enemy->Stats->Level) / 4;


I always try to write my code with multiplications wherever possible because division takes a lot longer (in processor time) than multiplication.
Also the code compiles perfectly for me as a multiplication. no idea why it's giving you problems.

You might get an error due to mixing variable types though. I typically convert variable types in the output from math like this.
  1. float levelmult = (float) Stats->Level / Enemy->Stats->Level;
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: Attack code split adds magic attack

Postby Sousie on Wed Nov 10, 2010 5:31 pm

Changing this code from:
  1. if(Stats->MagicAttack == 1)
  2.     {
  3.     attack = Stats->Attack_Power - (Enemy->Stats->Magic_Defense / 15);
  4.     Log(MSG_INFO,"MagicAtt %i,%i,%i",attack,Stats->Attack_Power,Enemy->Stats->Magic_Defense);
  5.     }
  6.     else
  7.     {
  8.     attack = Stats->Attack_Power - (Enemy->Stats->Defense / 15);
  9.     Log(MSG_INFO,"NormalAtt %i,%i,%i",attack,Stats->Attack_Power,Enemy->Stats->Defense);
  10.     }
  11.  


To
  1. if(Stats->MagicAttack == 1)
  2.     {
  3.     attack = Stats->Attack_Power - (Enemy->Stats->Magic_Defense / 2);
  4.     Log(MSG_INFO,"MagicAtt %i,%i,%i",attack,Stats->Attack_Power,Enemy->Stats->Magic_Defense);
  5.     }
  6.     else
  7.     {
  8.     attack = Stats->Attack_Power - (Enemy->Stats->Defense / 2);
  9.     Log(MSG_INFO,"NormalAtt %i,%i,%i",attack,Stats->Attack_Power,Enemy->Stats->Defense);
  10.     }
  11.  


Seem to have fixed the high damage rate of the monsters.
Sousie
Smoulie
Smoulie
 
Posts: 42
Joined: Sun Oct 24, 2010 2:38 pm

Re: Attack code split adds magic attack

Postby Planetary_Myth on Thu Nov 11, 2010 4:41 pm

@Sousie
attack = Stats->Attack_Power - (Enemy->Stats->Magic_Defense / 2);


The problem with this is that now your player is doing less damage as well so in the long run the problem is still the same.

Remember if a monsters attack is magical then it will use the magic formula and at the moment does do more damage.
One big factor I find as well is the critical formula which is called more than it should be and at higher lvl diffs it should do less damage.
e.g. on official around the monster lvl I was doing double damage and use a high lvl char and my crit bonus was like 2 extra hp off it.

@ PurpleYouko

It was giving me a converting to int from double error which would be the .25
I guess I could use double but just dont want to use float.
Tryin to keep the math simple for speed.
Planetary_Myth
Smoulie
Smoulie
 
Posts: 49
Joined: Sun Apr 18, 2010 2:50 pm

Re: Attack code split adds magic attack

Postby Sousie on Thu Nov 11, 2010 5:12 pm

Yes I know players do less damage now too, but its better than being killed by a gray monster while having 5500 def. Also i edited both magic and normal attack def. So far the damage with the / 2 instead of the / 15 is working much better. With the / 15 def meant nothing at all almost.
Sousie
Smoulie
Smoulie
 
Posts: 42
Joined: Sun Oct 24, 2010 2:38 pm

Re: Attack code split adds magic attack

Postby PurpleYouko on Thu Nov 11, 2010 6:11 pm

@ PurpleYouko

It was giving me a converting to int from double error which would be the .25
I guess I could use double but just dont want to use float.
Tryin to keep the math simple for speed.

Yeah i know floats are slower.
I think it evens out though by using multiplication which is a whole bunch faster than division.
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: Attack code split adds magic attack

Postby PurpleYouko on Thu Nov 11, 2010 6:14 pm

Sousie wrote:Yes I know players do less damage now too, but its better than being killed by a gray monster while having 5500 def. Also i edited both magic and normal attack def. So far the damage with the / 2 instead of the / 15 is working much better. With the / 15 def meant nothing at all almost.

Do you have the CONFIG values for player and monster damage set up in your server?
if you do then just edit the values in the database to give players a small boost.
Use something like 120 (X 1.2) instead of the default 100 (* 1.0)
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: Attack code split adds magic attack

Postby Sousie on Thu Nov 11, 2010 6:34 pm

PurpleYouko wrote:Do you have the CONFIG values for player and monster damage set up in your server?
if you do then just edit the values in the database to give players a small boost.
Use something like 120 (X 1.2) instead of the default 100 (* 1.0)


We could try that never realy thought of that, but at the moment players seem to do very reasonble amount of damage.
Sousie
Smoulie
Smoulie
 
Posts: 42
Joined: Sun Oct 24, 2010 2:38 pm

Re: Attack code split adds magic attack

Postby Planetary_Myth on Fri Nov 12, 2010 2:05 am

I need more info on lvl,def,m-def of char and what monster was attacking.

Note: Do not use the code below leaving for reference.
Tested and does not do what I intended it to do.
  1.    int LvlDiff = 0;
  2.     int Lvldiff = Stats->Level - Enemy->Stats->Level;
  3.    
  4.     if(Lvldiff < -1 && Lvldiff > -13)
  5.     {
  6.     Lvldiff = Lvldiff + 15 * -1;
  7.     }
  8.     else if(Lvldiff > 1 && Lvldiff < 13)
  9.     {
  10.     Lvldiff = Lvldiff - 15;
  11.     }
  12.     else if(Lvldiff < -13 || Lvldiff > 13)
  13.     {
  14.     Lvldiff = 15;
  15.     }
  16.     else if(Lvldiff >= -1 && Lvldiff <= 1)
  17.     {
  18.     Lvldiff = 15;
  19.     }
  20.    
  21.     if(Stats->MagicAttack == 1)
  22.     {
  23.     attack = Stats->Attack_Power - (Enemy->Stats->Magic_Defense / Lvldiff);
  24.     Log(MSG_INFO,"MagicAtt %i,%i,%i,%i",attack,Stats->Attack_Power,Enemy->Stats->Magic_Defense,Lvldiff);
  25.     }
  26.     else
  27.     {
  28.     attack = Stats->Attack_Power - (Enemy->Stats->Defense / Lvldiff);
  29.     Log(MSG_INFO,"NormalAtt %i,%i,%i,%i",attack,Stats->Attack_Power,Enemy->Stats->Defense,Lvldiff);
  30.     }    if(attack<0) attack = 5;
Planetary_Myth
Smoulie
Smoulie
 
Posts: 49
Joined: Sun Apr 18, 2010 2:50 pm

PreviousNext

Return to Submit Code

Who is online

Users browsing this forum: No registered users and 1 guest