forked from External/mage
parent
39bf4bf0bc
commit
41fb3d14cb
3 changed files with 28 additions and 31 deletions
|
|
@ -947,22 +947,12 @@ public abstract class AbilityImpl implements Ability {
|
|||
|
||||
@Override
|
||||
public boolean canChooseTarget(Game game, UUID playerId) {
|
||||
if (this instanceof SpellAbility) {
|
||||
if (SpellAbilityType.SPLIT_FUSED.equals(((SpellAbility) this).getSpellAbilityType())) {
|
||||
Card card = game.getCard(getSourceId());
|
||||
if (card != null) {
|
||||
return canChooseTargetAbility(((SplitCard) card).getLeftHalfCard().getSpellAbility(), game, playerId)
|
||||
&& canChooseTargetAbility(((SplitCard) card).getRightHalfCard().getSpellAbility(), game, playerId);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return canChooseTargetAbility(this, game, playerId);
|
||||
return canChooseTargetAbility(this, getModes(), game, playerId);
|
||||
}
|
||||
|
||||
private static boolean canChooseTargetAbility(Ability ability, Game game, UUID controllerId) {
|
||||
protected static boolean canChooseTargetAbility(Ability ability, Modes modes, Game game, UUID controllerId) {
|
||||
int found = 0;
|
||||
for (Mode mode : ability.getModes().values()) {
|
||||
for (Mode mode : modes.values()) {
|
||||
boolean validTargets = true;
|
||||
for (Target target : mode.getTargets()) {
|
||||
UUID abilityControllerId = controllerId;
|
||||
|
|
@ -977,10 +967,10 @@ public abstract class AbilityImpl implements Ability {
|
|||
|
||||
if (validTargets) {
|
||||
found++;
|
||||
if (ability.getModes().isEachModeMoreThanOnce()) {
|
||||
if (modes.isEachModeMoreThanOnce()) {
|
||||
return true;
|
||||
}
|
||||
if (found >= ability.getModes().getMinModes()) {
|
||||
if (found >= modes.getMinModes()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue