Jump to content
  • 0

How to modify the damage of assasin class when its get critical?


soroz

Question


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  3
  • Reputation:   0
  • Joined:  03/21/13
  • Last Seen:  

I found something in battle_calc_base_damage funciton in file battle.c

static int battle_calc_base_damage(struct status_data *status, struct weapon_atk *wa, struct status_change *sc, unsigned short t_size, struct map_session_data *sd, int flag)
 

and this snippet

 

//Weapon Damage calculation
if (!(flag&1))
damage = (atkmax>atkmin? rand()%(atkmax-atkmin):0)+atkmin;
else 
damage = atkmax;
 
This snippet is seperate a critical hit and non-critical hit damage and i want to modify it, when assasin class (assasin, assasin cross, baby assasin) make critical damage. It will be multiple with 1.5 or 2.
 
 
But i didn't know how to get the character class to check if condition is met. Im not sure that map_session_data contains any properties that refer to the class of damage dealer (Maybe sd->class_  ??) and if what i think is correct how do i compare to the 3 class that i mention above.
 
Please help, and sorry for my english mistake i am not a native speaker.
 
Thaks :)
Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  3
  • Reputation:   0
  • Joined:  03/21/13
  • Last Seen:  

In additional, this snippet

 

if((sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN)

 

will cause a fatal error an.d bring the map server down because when critical event cause by a monster a sd pointer will given a null and server will be crashed with pagefault

 

to prevent this we have to check that if sd is null or not first

 

if(sd && (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN)

 

and this line should works well

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  143
  • Reputation:   30
  • Joined:  12/23/11
  • Last Seen:  


if((sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  3
  • Reputation:   0
  • Joined:  03/21/13
  • Last Seen:  

Thank you poporing. It works

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...