- CheckStyle.

This commit is contained in:
Chris
2012-01-29 18:26:17 +00:00
parent 3eb8266c6f
commit e1869147c1

View File

@@ -16,21 +16,34 @@ public class SellRules {
private int maxDifficulty = 5; private int maxDifficulty = 5;
public SellRules(List<String> questShop) { public SellRules(List<String> questShop) {
if( null == questShop || questShop.isEmpty() ) return; if (null == questShop || questShop.isEmpty()) {
return;
}
for (String s : questShop) { for (String s : questShop) {
String[] kv = s.split("="); String[] kv = s.split("=");
if( "WinsToUnlock".equalsIgnoreCase(kv[0]) ) minWins = Integer.parseInt(kv[1]); if ("WinsToUnlock".equalsIgnoreCase(kv[0])) {
else if ("Credits".equalsIgnoreCase(kv[0])) cost = Integer.parseInt(kv[1]); minWins = Integer.parseInt(kv[1]);
else if ("MaxDifficulty".equalsIgnoreCase(kv[0])) maxDifficulty = Integer.parseInt(kv[1]); }
else if ("MinDifficulty".equalsIgnoreCase(kv[0])) minDifficulty = Integer.parseInt(kv[1]); else if ("Credits".equalsIgnoreCase(kv[0])) {
cost = Integer.parseInt(kv[1]);
}
else if ("MaxDifficulty".equalsIgnoreCase(kv[0])) {
maxDifficulty = Integer.parseInt(kv[1]);
}
else if ("MinDifficulty".equalsIgnoreCase(kv[0])) {
minDifficulty = Integer.parseInt(kv[1]);
}
} }
} }
public boolean meetsRequiremnts(QuestData quest) public boolean meetsRequiremnts(QuestData quest) {
{ if (quest.getWin() < minWins) {
if( quest.getWin() < minWins ) return false; return false;
if( quest.getDifficultyIndex() < minDifficulty || quest.getDifficultyIndex() > maxDifficulty ) return false; }
if (quest.getDifficultyIndex() < minDifficulty || quest.getDifficultyIndex() > maxDifficulty) {
return false;
}
return true; return true;
} }