BalanceOfPower
view release on metacpan or search on metacpan
lib/BalanceOfPower/Role/Shopper.pm view on Meta::CPAN
4546474849505152535455565758596061626364
}
}
sub
calculate_price
{
my
$self
=
shift
;
my
$y
=
shift
;
my
$type
=
shift
;
my
$nation
=
shift
;
#Price formula is MaxPrice - (( MaxPrice - MinPrice) / MaxValue) * Value
#MaxPrice and MinPrice are constant
my
$min_price
= PRICE_RANGES->{
$type
}->[0];
my
$max_price
= PRICE_RANGES->{
$type
}->[1];
my
$max_value
=
$self
->get_stat_for_price(
$y
,
$type
);
return
SHOP_PRICE_FACTOR
if
(
$max_value
== 0);
my
$value
=
$self
->get_stat_for_price(
$y
,
$type
,
$nation
);
( run in 0.517 second using v1.01-cache-2.11-cpan-eab888a1d7d )