mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
StaticAbilityAttackRestrict.attackRestrictNum iterate
This commit is contained in:
@@ -30,18 +30,24 @@ public class StaticAbilityAttackRestrict {
|
|||||||
|
|
||||||
static public int attackRestrictNum(GameEntity defender) {
|
static public int attackRestrictNum(GameEntity defender) {
|
||||||
final Game game = defender.getGame();
|
final Game game = defender.getGame();
|
||||||
|
int num = Integer.MAX_VALUE;
|
||||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()
|
||||||
|
|| !stAb.hasParam("ValidDefender")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (attackRestrict(stAb, defender)) {
|
if (attackRestrict(stAb, defender)) {
|
||||||
return AbilityUtils.calculateAmount(stAb.getHostCard(),
|
int stNum = AbilityUtils.calculateAmount(stAb.getHostCard(),
|
||||||
stAb.getParamOrDefault("MaxAttackers", "1"), stAb);
|
stAb.getParamOrDefault("MaxAttackers", "1"), stAb);
|
||||||
|
if (stNum < num) {
|
||||||
|
num = stNum;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return num < Integer.MAX_VALUE ? num : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static public boolean attackRestrict(StaticAbility stAb, GameEntity defender) {
|
static public boolean attackRestrict(StaticAbility stAb, GameEntity defender) {
|
||||||
|
|||||||
Reference in New Issue
Block a user