@ -377,24 +377,33 @@ public class WpakPowerManager {
@@ -377,24 +377,33 @@ public class WpakPowerManager {
}
public static int getRecycleTime ( Power power , int trains ) { // returns cast time in ms
if ( power . curves . get ( "RECYCLETIME" ) ! = null )
return ( int ) ( ( ( power . recycle_time + ( power . curves . get ( "RECYCLETIME" ) . getValue ( ) * trains ) ) * 1000 ) + getCastTime ( power , trains ) ) ;
else
return ( int ) ( ( ( power . recycle_time * ( 1 + ( power . curves . get ( "RECYCLETIME" ) . getValue ( ) * trains ) ) ) * 1000 ) + getCastTime ( power , trains ) ) ;
if ( power . curves . get ( "RECYCLETIME" ) ! = null ) {
mbEnums . CompoundCurveType compoundCurveType = power . curves . get ( "RECYCLETIME" ) ;
return ( int ) ( ( ( power . recycle_time + ( compoundCurveType . value * trains ) ) * 1000 ) + getCastTime ( power , trains ) ) ;
} else {
mbEnums . CompoundCurveType compoundCurveType = power . curves . get ( "RECYCLETIME" ) ;
return ( int ) ( ( ( power . recycle_time * ( 1 + ( compoundCurveType . value * trains ) ) ) * 1000 ) + getCastTime ( power , trains ) ) ;
}
}
public static int getCastTime ( Power power , int trains ) { // returns cast time in ms
if ( power . curves . get ( "INITTIME" ) ! = null )
return ( int ) ( ( power . init_time + ( power . curves . get ( "INITTIME" ) . getValue ( ) * trains ) ) * 1000 ) ;
else
return ( int ) ( ( power . init_time * ( 1 + ( power . curves . get ( "INITTIME" ) . getValue ( ) * trains ) ) ) * 1000 ) ;
if ( power . curves . get ( "INITTIME" ) ! = null ) {
mbEnums . CompoundCurveType compoundCurveType = power . curves . get ( "INITTIME" ) ;
return ( int ) ( ( power . init_time + ( compoundCurveType . value * trains ) ) * 1000 ) ;
} else {
mbEnums . CompoundCurveType compoundCurveType = power . curves . get ( "INITTIME" ) ;
return ( int ) ( ( power . init_time * ( 1 + ( compoundCurveType . value * trains ) ) ) * 1000 ) ;
}
}
public static float getCost ( Power power , int trains ) {
if ( power . curves . get ( "COSTAMT" ) ! = null )
return power . cost + ( power . curves . get ( "COSTAMT" ) . getValue ( ) * trains ) ;
else
return power . cost * ( 1 + ( power . curves . get ( "COSTAMT" ) . getValue ( ) * trains ) ) ;
if ( power . curves . get ( "COSTAMT" ) ! = null ) {
mbEnums . CompoundCurveType compoundCurveType = power . curves . get ( "COSTAMT" ) ;
return power . cost + ( compoundCurveType . value * trains ) ;
} else {
mbEnums . CompoundCurveType compoundCurveType = power . curves . get ( "COSTAMT" ) ;
return power . cost * ( 1 + ( compoundCurveType . value * trains ) ) ;
}
}
@ -413,7 +422,7 @@ public class WpakPowerManager {
@@ -413,7 +422,7 @@ public class WpakPowerManager {
Pair < Float , Float > outData = new Pair < > ( 0f , 0f ) ;
if ( modifierEntry . percentage ! = 0f ) {
outData . first = modifierEntry . percentage + ( modifierEntry . compoundCurveType . getValue ( ) * rank ) ;
outData . first = modifierEntry . percentage + ( modifierEntry . compoundCurveType . value * rank ) ;
outData . first = outData . first * 0 . 01f ;
return outData ;
}
@ -426,14 +435,19 @@ public class WpakPowerManager {
@@ -426,14 +435,19 @@ public class WpakPowerManager {
// These all have "SIVL" in the curve name suggesting
// interpolation between min max. Not something currently done.
outData . first = modifierEntry . compoundCurveType . type . equals ( mbEnums . ModificationType . MULTIPLY ) ?
modifierEntry . min * ( 1 + ( modifierEntry . compoundCurveType . getValue ( ) * rank ) ) :
modifierEntry . min + ( modifierEntry . compoundCurveType . getValue ( ) * rank ) ;
if ( modifierEntry . compoundCurveType . type . equals ( mbEnums . ModificationType . MULTIPLY ) ) {
outData . first = modifierEntry . min * ( 1 + ( modifierEntry . compoundCurveType . value * rank ) ) ;
} else {
outData . first = modifierEntry . min + ( modifierEntry . compoundCurveType . value * rank ) ;
}
if ( modifierEntry . max ! = 0 )
outData . second = modifierEntry . compoundCurveType . type . equals ( mbEnums . ModificationType . MULTIPLY ) ?
modifierEntry . max * ( 1 + ( modifierEntry . compoundCurveType . getValue ( ) * rank ) ) :
modifierEntry . max + ( modifierEntry . compoundCurveType . getValue ( ) * rank ) ;
if ( modifierEntry . max ! = 0 ) {
if ( modifierEntry . compoundCurveType . type . equals ( mbEnums . ModificationType . MULTIPLY ) ) {
outData . second = modifierEntry . max * ( 1 + ( modifierEntry . compoundCurveType . value * rank ) ) ;
} else {
outData . second = modifierEntry . max + ( modifierEntry . compoundCurveType . value * rank ) ;
}
}
return outData ;
}