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

Blinzer

New member
Messages
131
Points
0
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?

 
Last edited by a moderator:
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:

Code:
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;
			}
		}
	}
 
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


 
I guess you are looking for:

Code:
bstatus->batk
 
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?

 
Last edited by a moderator:
Back
Top