mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 11:02:00 -08:00
Tests: improved addCard command, now it can add card from specific set (use 40K:Plains as card name param, #10139)
This commit is contained in:
parent
92706d23cb
commit
d019acbd55
8 changed files with 125 additions and 24 deletions
|
|
@ -77,6 +77,8 @@ public final class CardUtil {
|
|||
"put", "return", "exile", "discard", "sacrifice", "remove", "tap", "reveal", "pay"
|
||||
);
|
||||
|
||||
public static final int TESTS_SET_CODE_LOOKUP_LENGTH = 10; // search set code in commands like "set:card_name"
|
||||
|
||||
/**
|
||||
* Increase spell or ability cost to be paid.
|
||||
*
|
||||
|
|
@ -1741,4 +1743,18 @@ public final class CardUtil {
|
|||
throw new IllegalArgumentException("Can't use KeySet as param, use new LinkedHashSet<>(data.keySet()) instead");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't raise exception, so must be used instead standard substring calls all the time
|
||||
*
|
||||
* @param str
|
||||
* @param maxLength
|
||||
* @return
|
||||
*/
|
||||
public static String substring(String str, int maxLength) {
|
||||
if (str == null || str.isEmpty()) {
|
||||
return str;
|
||||
}
|
||||
return str.substring(0, Math.min(str.length(), maxLength));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue