Breath of Fire 2

Normal Physical Attack Damage Algorithm
(Using the function outlined in Ben Siron's BoF2 handbook)
(NOTE: This JavaScript does not run properly with Netscape 2.0)

Number of Party Members

1

2

3

4

Formation

Normal

Scramble

Defense

Parallel

Other Effects

Special Hit
Defender is defending
Attacker has Pwr.Dn
CtrAttck

Attacker:

OFF stat

Combat Order Position

Lead

2nd

3rd

4th

Elemental
None
Fire
Ice
Thunder
Holy

Defender:

Target type Enemy type (ignore for ally) Ally Resist Level (ignore for enemy)
Ally
Enemy
Nothin' Special
Fiery
Icy
Aquatic
Flying
Undead
Spirit
No resistance
+1
+2
+3
Combat Order Position (ignore for enemy)

Lead

2nd

3rd

4th

DEF stat

" ) var apos = whichRadio( 4, document.attacker.order ) var dpos = whichRadio( 4, document.defender.order ) var members = whichRadio( 4, document.general.partysize ) var formation = whichRadio( 4, document.general.formation ) if( ( apos > members ) || ( dpos > members ) ) { calcWin.document.write( "You entered combat positions that were invalid considering
" ) calcWin.document.write( "the number of members supposedly in your party. Please fix this" ) calcWin.document.close( ) return } if(( formation > members ) || ((formation == 2) && (members == 2))) { calcWin.document.write( "You entered an invalid formation type, considering the the number of
" ) calcWin.document.write( "members supposedly in your party. Please fix this" ) calcWin.document.close( ) return } var elm = whichRadio( 5, document.attacker.elment ) if( document.general.ctr.checked ) { calcWin.document.write( "Step 0:
This is a counterattack, so it is non-elemental

") elm = 0 } calcWin.document.write( "Step 1:
Power of this attack is ATT - DEF = ", pwr, "

") if( pwr < 0 ) { calcWin.document.write( "since pwr < 0, pwr = 0" ) pwr = 0 }; calcWin.document.write( "Step 2:
" ) if(pwr < 63 ) { calcWin.document.write( "Power is in the low regime, so look up the
" ) calcWin.document.write( "possible damages from the table given:
" ) for( i = 0; i < 4; i++ ) damage[i] = lowtable[ pwr*4 + i + 1] } if( (pwr > 62) && ( pwr < 99 ) ) { calcWin.document.write( "Power is in the mid regime, so multiply by one of 85%, 90%, 97% or 103%.
" ) calcWin.document.write( "These translate to the fractions 217/256, 230/256, 248/256, 263/256:
" ) damage[0] = parseInt( 217*pwr/256 ) damage[1] = parseInt( 230*pwr/256 ) damage[2] = parseInt( 248*pwr/256 ) damage[3] = parseInt( 263*pwr/256 ) } if(pwr > 98) { calcWin.document.write( "Power is in the high regime, so multiply by one of 58%, 64%, 70%, or 76%.
" ) calcWin.document.write( "These translate to the fractions 148/256, 163/256, 179/256, 194/256:
" ) damage[0] = parseInt( 148*pwr/256 ) damage[1] = parseInt( 163*pwr/256 ) damage[2] = parseInt( 179*pwr/256 ) damage[3] = parseInt( 194*pwr/256 ) } listDamages( ) if( document.general.special.checked ) { calcWin.document.write( "Step 3:
This was a special hit, so multiply damage done by 2:
" ) scaleDamages( 512, 0, damages ) listDamages( ) } if( document.general.defending.checked ) { calcWin.document.write( "Step 4:
The target was defending. Therefore, damage is reduced to one of
" ) calcWin.document.write( "85%, <75%, 65%, or <50%. These correspond to the fractions 217/256,
" ) calcWin.document.write( "191/256, 166/256, 127/256:
" ); for( var i = 0; i < 4; i++ ) for( var j = 0; j < 4; j++ ) damage[ i*4 + j ] = damage[ j ] damages = 16 scaleDamages( 127, 0, 4 ) scaleDamages( 166, 4, 8 ) scaleDamages( 191, 8, 12 ) scaleDamages( 217, 12,16 ) listDamages( ) } calcWin.document.write( "Step 5:
The attacker attacks from position ", apos+1, " out of ", members+1, " in the ", document.general.formation[formation].value, " formation.
" ) var arisk = risktable[ members*16 + formation*4 + apos + 1 ] calcWin.document.write( "This is a risk factor of ",arisk,", which multiplies damage by ", ariskpercent[arisk+5], " or ", ariskfactor[arisk+5], "/256:
" ) scaleDamages( ariskfactor[arisk+5], 0, damages ) listDamages( ) var target = whichRadio( 2, document.defender.what ) if( target == 0 ) { var drisk = risktable[ members*16 + formation*4 + dpos + 1 ] calcWin.document.write( "Step 6:
The defender is an ally in position ", dpos+1, "." ) calcWin.document.write( " This puts the defender
at risk level ", drisk, " which multiples damage by ", driskpercent[drisk+5], ", or ", driskfactor[drisk+5], "/256:
" ) scaleDamages( driskfactor[drisk+5], 0, damages ) listDamages( ) var resist = whichRadio( 4, document.defender.resist ) if( resist && elm ) { calcWin.document.write( "Step 7:
The ally resists the ", document.attacker.elment[elm].value, " attack at resist level ", resist, ".
" ) var j = (15 - 2*resist) calcWin.document.write( "As such, the ally takes only ",j,"/16ths of the damage:
" ) scaleDamages( j*16, 0, damages ) listDamages( ) } } else { var w = whichRadio( 7,document.defender.weak ) if( (( w == 1 ) && ( elm == 2 )) || (( w == 2 ) && (elm == 1)) || (( w == 3 ) && ( elm == 3 )) || (( w == 5 ) && (( elm == 1 ) || ( elm == 4 )) ) || (( w == 6 ) && (elm == 4 )) ) { calcWin.document.write( "Step 6:
The defender is a ", document.defender.weak[w].value, " creature, and as such is weak vs.
" ) calcWin.document.write( "the ", document.attacker.elment[elm].value, " attack, taking double damage from it:
" ) scaleDamages( 512, 0, damages ) listDamages( ) } if( (( w == 1 ) && ( elm == 1 )) || (( w == 2 ) && (elm == 2 )) || (( w == 3 ) && ( elm == 1 )) || (( w == 6 ) && (elm != 4 )) ) { calcWin.document.write( "Step 6:
The defender is a ", document.defender.weak[w].value, " creature, and as such is strong vs.
" ) if( w == 6 ) calcWin.document.write( "non-Holy" ) else calcWin.document.write( document.attacker.elment[elm].value ) calcWin.document.write( " attacks, and so takes only half damage:
" ) scaleDamages( 128, 0, damages ) listDamages( ) } } if( document.general.pwr_dn.checked ) { calcWin.document.write( "Step 8:
The attacker had the pwr.dn condition, so multiply all
damages by 7/8:
" ) scaleDamages( 224, 0, damages ) listDamages( ) } for( var i = 0; i 999 ) damage[i] = 999 } calcWin.document.write( "Finally, bound all damages between 1 and 999. Results:
" ) listDamages( ) var j = 0 for( var i = 0; i" ) calcWin.document.close() }

Hosted by www.Geocities.ws

1