mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- CheckStyle.
This commit is contained in:
@@ -9,37 +9,50 @@ import forge.quest.data.QuestData;
|
||||
*
|
||||
*/
|
||||
public class SellRules {
|
||||
|
||||
|
||||
private int minWins = 0;
|
||||
private int cost = 250;
|
||||
private int minDifficulty = 0;
|
||||
private int maxDifficulty = 5;
|
||||
|
||||
public SellRules(List<String> questShop) {
|
||||
if( null == questShop || questShop.isEmpty() ) return;
|
||||
|
||||
for( String s : questShop ) {
|
||||
if (null == questShop || questShop.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (String s : questShop) {
|
||||
String[] kv = s.split("=");
|
||||
if( "WinsToUnlock".equalsIgnoreCase(kv[0]) ) minWins = 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]);
|
||||
if ("WinsToUnlock".equalsIgnoreCase(kv[0])) {
|
||||
minWins = 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)
|
||||
{
|
||||
if( quest.getWin() < minWins ) return false;
|
||||
if( quest.getDifficultyIndex() < minDifficulty || quest.getDifficultyIndex() > maxDifficulty ) return false;
|
||||
|
||||
public boolean meetsRequiremnts(QuestData quest) {
|
||||
if (quest.getWin() < minWins) {
|
||||
return false;
|
||||
}
|
||||
if (quest.getDifficultyIndex() < minDifficulty || quest.getDifficultyIndex() > maxDifficulty) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public final int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user