mirror of
https://github.com/correl/mage.git
synced 2024-12-26 19:16:54 +00:00
begin modifying target adjustment implementations
This commit is contained in:
parent
8bcf95d996
commit
9b94b618cd
2 changed files with 36 additions and 8 deletions
|
@ -352,6 +352,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
// }
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
ability.adjustTargets(game);
|
||||
int xValue;
|
||||
TargetPermanent oldTargetPermanent;
|
||||
FilterPermanent permanentFilter;
|
||||
|
@ -361,14 +362,14 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
case NONE:
|
||||
break;
|
||||
case X_CMC_EQUAL_PERM:
|
||||
xValue = ability.getManaCostsToPay().getX();
|
||||
oldTargetPermanent = (TargetPermanent) ability.getTargets().get(0);
|
||||
minTargets = oldTargetPermanent.getMinNumberOfTargets();
|
||||
maxTargets = oldTargetPermanent.getMaxNumberOfTargets();
|
||||
permanentFilter = oldTargetPermanent.getFilter().copy();
|
||||
permanentFilter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.getTargets().clear();
|
||||
ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false));
|
||||
// xValue = ability.getManaCostsToPay().getX();
|
||||
// oldTargetPermanent = (TargetPermanent) ability.getTargets().get(0);
|
||||
// minTargets = oldTargetPermanent.getMinNumberOfTargets();
|
||||
// maxTargets = oldTargetPermanent.getMaxNumberOfTargets();
|
||||
// permanentFilter = oldTargetPermanent.getFilter().copy();
|
||||
// permanentFilter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
// ability.getTargets().clear();
|
||||
// ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false));
|
||||
break;
|
||||
case X_TARGETS:
|
||||
xValue = ability.getManaCostsToPay().getX();
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package mage.target.targetadjustment;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class XCMCPermanentAdjuster implements TargetAdjuster {
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
int xValue = ability.getManaCostsToPay().getX();
|
||||
TargetPermanent oldTargetPermanent = (TargetPermanent) ability.getTargets().get(0);
|
||||
int minTargets = oldTargetPermanent.getMinNumberOfTargets();
|
||||
int maxTargets = oldTargetPermanent.getMaxNumberOfTargets();
|
||||
FilterPermanent permanentFilter = oldTargetPermanent.getFilter().copy();
|
||||
permanentFilter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||
ability.getTargets().clear();
|
||||
ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue