mirror of
https://github.com/correl/mage.git
synced 2024-12-28 03:00:10 +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
|
@Override
|
||||||
public void adjustTargets(Ability ability, Game game) {
|
public void adjustTargets(Ability ability, Game game) {
|
||||||
|
ability.adjustTargets(game);
|
||||||
int xValue;
|
int xValue;
|
||||||
TargetPermanent oldTargetPermanent;
|
TargetPermanent oldTargetPermanent;
|
||||||
FilterPermanent permanentFilter;
|
FilterPermanent permanentFilter;
|
||||||
|
@ -361,14 +362,14 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
||||||
case NONE:
|
case NONE:
|
||||||
break;
|
break;
|
||||||
case X_CMC_EQUAL_PERM:
|
case X_CMC_EQUAL_PERM:
|
||||||
xValue = ability.getManaCostsToPay().getX();
|
// xValue = ability.getManaCostsToPay().getX();
|
||||||
oldTargetPermanent = (TargetPermanent) ability.getTargets().get(0);
|
// oldTargetPermanent = (TargetPermanent) ability.getTargets().get(0);
|
||||||
minTargets = oldTargetPermanent.getMinNumberOfTargets();
|
// minTargets = oldTargetPermanent.getMinNumberOfTargets();
|
||||||
maxTargets = oldTargetPermanent.getMaxNumberOfTargets();
|
// maxTargets = oldTargetPermanent.getMaxNumberOfTargets();
|
||||||
permanentFilter = oldTargetPermanent.getFilter().copy();
|
// permanentFilter = oldTargetPermanent.getFilter().copy();
|
||||||
permanentFilter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
// permanentFilter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
|
||||||
ability.getTargets().clear();
|
// ability.getTargets().clear();
|
||||||
ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false));
|
// ability.getTargets().add(new TargetPermanent(minTargets, maxTargets, permanentFilter, false));
|
||||||
break;
|
break;
|
||||||
case X_TARGETS:
|
case X_TARGETS:
|
||||||
xValue = ability.getManaCostsToPay().getX();
|
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