From: Erik V. <ev...@us...> - 2012-06-05 20:07:08
|
rails/game/PublicCompany.java | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) New commits: commit ba0b55b7bf6e01dc671a578d9440bc17706481ba Author: John David Galt <jd...@di...> Date: Tue Jun 5 22:06:07 2012 +0200 Distance-dependent token lay costs can now have different base costs per laid token. Applies to 1837. diff --git a/rails/game/PublicCompany.java b/rails/game/PublicCompany.java index 7b38879..ba876c0 100644 --- a/rails/game/PublicCompany.java +++ b/rails/game/PublicCompany.java @@ -1761,21 +1761,25 @@ public class PublicCompany extends Company implements PublicCompanyI { if (baseTokenLayCost == null) return 0; - if (baseTokenLayCostMethod.equals(BASE_COST_SEQUENCE)) { - int index = getNumberOfLaidBaseTokens(); + /* Changed by JDG/EV: allow cost array for both calculation methods. + * In 1837, token lay cost per hex distance depends on + * the number of tokens laid before. */ + int index = getNumberOfLaidBaseTokens(); - if (index >= baseTokenLayCost.length) { - index = baseTokenLayCost.length - 1; - } else if (index < 0) { - index = 0; - } + if (index >= baseTokenLayCost.length) { + index = baseTokenLayCost.length - 1; + } else if (index < 0) { + index = 0; + } + + if (baseTokenLayCostMethod.equals(BASE_COST_SEQUENCE)) { return baseTokenLayCost[index]; } else if (baseTokenLayCostMethod.equals(BASE_COST_DISTANCE)) { if (hex == null) { - return baseTokenLayCost[0]; + return baseTokenLayCost[index]; } else { // WARNING: no provision yet for multiple home hexes. - return mapManager.getHexDistance(homeHexes.get(0), hex) * baseTokenLayCost[0]; + return mapManager.getHexDistance(homeHexes.get(0), hex) * baseTokenLayCost[index]; } } else { return 0; |