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 {
|
public class SellRules {
|
||||||
|
|
||||||
private int minWins = 0;
|
private int minWins = 0;
|
||||||
private int cost = 250;
|
private int cost = 250;
|
||||||
private int minDifficulty = 0;
|
private int minDifficulty = 0;
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final int getCost() {
|
public final int getCost() {
|
||||||
return cost;
|
return cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user