Jump to content
  • 0
Blinzer

Where does the game apply the bonus ATK from refine in pre-re?

Question

I'm trying to turn the ATK bonus refinement gives into a % increase in damage(pre-re), but can't find where the game does its formulas and such for refinement. I've already changed the values in refine_db accordingly, but can't find where it pulls those values in the source(though admittedly, I haven't checked battle calculations). Can someone help me out?

Edited by Blinzer

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Make sure you are editing correct refine_db.conf

 

According to source:

			if (r)
				wa->atk2 = status->dbs->refine_info[wlv].bonus[r-1] / 100;

Bonus/100 is the increase in attack.

 

 

You can find it in status.c

function: status_calc_pc_

These are the only lines responsible for refine bonus:

if(sd->inventory_data[index]->type == IT_WEAPON) {
			int r = sd->status.inventory[index].refine,wlv = sd->inventory_data[index]->wlv;
			struct weapon_data *wd;
			struct weapon_atk *wa;
			if (wlv >= REFINE_TYPE_MAX)
				wlv = REFINE_TYPE_MAX - 1;
			if(i == EQI_HAND_L && sd->status.inventory[index].equip == EQP_HAND_L) {
				wd = &sd->left_weapon; // Left-hand weapon
				wa = &bstatus->lhw;
			} else {
				wd = &sd->right_weapon;
				wa = &bstatus->rhw;
			}
			wa->atk += sd->inventory_data[index]->atk;
			if ( !battle_config.shadow_refine_atk && itemdb_is_shadowequip(sd->inventory_data[index]->equip) )
				r = 0;

			if (r)
				wa->atk2 = status->dbs->refine_info[wlv].bonus[r-1] / 100;

#ifdef RENEWAL
			wa->matk += sd->inventory_data[index]->matk;
			wa->wlv = wlv;
			if( r && sd->weapontype1 != W_BOW ) // renewal magic attack refine bonus
				wa->matk += status->dbs->refine_info[wlv].bonus[r-1] / 100;
#endif

			//Overrefined bonus.
			if (r)
				wd->overrefine = status->dbs->refine_info[wlv].randombonus_max[r-1] / 100;

			wa->range += sd->inventory_data[index]->range;
			if(sd->inventory_data[index]->script) {
				if (wd == &sd->left_weapon) {
					sd->state.lr_flag = 1;
					script->run_use_script(sd, sd->inventory_data[index], 0);
					sd->state.lr_flag = 0;
				} else
					script->run_use_script(sd, sd->inventory_data[index], 0);
				if (!calculating) //Abort, script->run retriggered this. [Skotlex]
					return 1;
			}

			if (sd->status.inventory[index].card[0]==CARD0_FORGE) {
				// Forged weapon
				wd->star += (sd->status.inventory[index].card[1]>>8);
				if (wd->star >= 15)
					wd->star = 40; // 3 Star Crumbs now give +40 dmg
				if (pc->fame_rank(MakeDWord(sd->status.inventory[index].card[2],sd->status.inventory[index].card[3]), RANKTYPE_BLACKSMITH) > 0)
					wd->star += 10;

				if (!wa->ele) //Do not overwrite element from previous bonuses.
					wa->ele = (sd->status.inventory[index].card[1]&0x0f);
			}
		}
		else if(sd->inventory_data[index]->type == IT_ARMOR) {
			int r = sd->status.inventory[index].refine;

			if ( (!battle_config.costume_refine_def && itemdb_is_costumeequip(sd->inventory_data[index]->equip)) ||
				 (!battle_config.shadow_refine_def && itemdb_is_shadowequip(sd->inventory_data[index]->equip))
				)
				r = 0;

			if (r)
				refinedef += status->dbs->refine_info[REFINE_TYPE_ARMOR].bonus[r-1];

			if(sd->inventory_data[index]->script) {
				if( i == EQI_HAND_L ) //Shield
					sd->state.lr_flag = 3;
				script->run_use_script(sd, sd->inventory_data[index], 0);
				if( i == EQI_HAND_L ) //Shield
					sd->state.lr_flag = 0;
				if (!calculating) //Abort, script->run retriggered this. [Skotlex]
					return 1;
			}
		}
	}

Share this post


Link to post
Share on other sites
  • 0

ah dammit, i skimmed by that but didn't think it was the one. lol

 

thx


actually before i go i'm just wondering, how would i call batk from here? or on the opposite side under the batk bonuses from different SCs, how would i call the refine bonus atk2?

 

attaching screenshot of the batk place below since you already know what the refinement thing looks like:

 

0yglNW8.png

Share this post


Link to post
Share on other sites
  • 0

Well, looks like I failed to figure this out myself after all. When I try to call ATK from the refinement place, it's just always 0. I tried a lot of other options to, all to no avail. I'm guessing I have to do something like recalculate the total baseATK it within the refinement formula if I plan to use it or, alternatively, make the refinement bonus be calculated and applied in another place by calling the refinement stuff there instead. Can anyone help me do that?

Edited by Blinzer

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.