Jump to content
  • 0

I need help chaning the MATK formula (Pre-RE)


kyenard

Question


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.01
  • Content Count:  18
  • Reputation:   1
  • Joined:  08/19/19
  • Last Seen:  

I'm trying to change the original formula that gives you Magic Attack based on INT.

So far I'm having trouble on this one and would like to use my formula:

Quote

 

Min Magic Attack = INT + ((INT/6) * (INT/6)) + (DEX*3/5)

Max Magic Attack = INT + ((INT/5) * (INT/5)) + (LUK*3/5)

 

Reading Status.c, I found the following original code line:

* Calculates minimum magic attack
*/
unsigned short status_base_matk_min(struct block_list *bl, const struct status_data* status, int level)
{
	switch (bl->type) {
		case BL_PET:
		case BL_MOB:
		case BL_MER:
		case BL_ELEM:
			return status->int_ + level + status->rhw.matk * 70 / 100;
		case BL_HOM:
			return status_get_homint(bl) + level + (status_get_homint(bl) + status_get_homdex(bl)) / 5;
		case BL_PC:
		default:
			return status->int_ + (status->int_ / 2) + (status->dex / 5) + (status->luk / 3) + (level / 4);
	}
}

/*
* Calculates maximum magic attack
*/
unsigned short status_base_matk_max(struct block_list *bl, const struct status_data* status, int level)
{
	switch (bl->type) {
		case BL_PET:
		case BL_MOB:
		case BL_MER:
		case BL_ELEM:
			return status->int_ + level + status->rhw.matk * 130 / 100;
		case BL_HOM:
			return status_get_homint(bl) + level + (status_get_homluk(bl) + status_get_homint(bl) + status_get_homdex(bl)) / 3;
		case BL_PC:
		default:
			return status->int_ + (status->int_ / 2) + (status->dex / 5) + (status->luk / 3) + (level / 4);
	}
}
#endif

I tried many different ways to tweak the code, but so far I got no lucky understanding how Am I suppose to modify it to get Magic Attack from 3 different sources.

My final attempt was to give up using the Pre-RE structure and replacing for the Renewal. Then I modified like this:

#ifndef RENEWAL
unsigned short status_base_matk_min(const struct status_data* status) { return status->int_ + (status->int_ / 7) * (status->int_ / 7); }
unsigned short status_base_matk_max(const struct status_data* status) { return status->int_ + (status->int_ / 5) * (status->int_ / 5); }
#else
unsigned short status_base_matk_min(const struct status_data* status) { return (status->int_) + ((status->int_ / 6) * (status->int_ / 6)) + (status->dex*6/5); }
unsigned short status_base_matk_max(const struct status_data* status) { return (status->int_) + ((status->int_ / 6) * (status->int_ * 25/96)) + (status->luk*6/5); }

By doing so, the game reads as If I haven't changed anything. When I copy/paste the RENEWAL formula right after the #else, the game loads using RENWAL formulas, and they work.

I need some light and I really appreciate any help ❤️

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.01
  • Content Count:  18
  • Reputation:   1
  • Joined:  08/19/19
  • Last Seen:  

I tried changing the same way you suggested and nothing happened.

I found out my mistake. Thanks to your help, I opened my eyes to see closer. I investigated my Renewal.h

My #ifndef RENEWAL was activated, which means, I should work on the ifndef code lines

Final result is:

#ifndef RENEWAL
unsigned short status_base_matk_min(const struct status_data* status) { return status->int_ + ((status->int_ / 6) * (status->int_ / 5)) + (status->dex * 3/5); }
unsigned short status_base_matk_max(const struct status_data* status) { return status->int_ + ((status->int_ / 5) * (status->int_ / 5)) + (status->luk * 3/5); }
#else

Thanks for the help. Case closed. ❤️

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  45
  • Topics Per Day:  0.01
  • Content Count:  96
  • Reputation:   7
  • Joined:  05/25/12
  • Last Seen:  

For the status.c, 1st part: Case BL_Pet, BL_Mob, BL_Mer and BL_Elem is for Pets, Monsters, Mercenaries and Elementals. 2nd part: BL_Hom is for Homunculi and BL_PC is for players. Change the:

return status->int_ + (status->int_ / 2) + (status->dex / 5) + (status->luk / 3) + (level / 4);

 to:

return status->int_ + (status->int_ / 6) * (status->int_ / 6) + (status->dex * 3 / 5)

 

Then for the max magic part change the same portion, the part under BL_PC from:
 

return status->int_ + (status->int_ / 2) + (status->dex / 5) + (status->luk / 3) + (level / 4);

to:
 

return status->int_ + (status->int_ / 5) * (status->int_ / 5) + (status->luk * 3 / 5)

 

  • Love 1
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...