forked from External/mage
(WIP) Replacing blocking/blocked by predicates (#8729)
* replaced blocking/blocked by predicates * added test for knight of dusk (currently fails) * added source parameter to filters and everything else that needs it * some changes to various predicates * test fix * small changes to filter code * merge fix * fixed a test failure * small change to Karn, Scion of Urza * removed sourceId from filter methods and other similar places * added new getobject method to fix some test failures * a few more fixes * fixed merge conflicts * merge fix
This commit is contained in:
parent
53877424a0
commit
80e11b2052
1719 changed files with 3384 additions and 3325 deletions
|
|
@ -441,6 +441,11 @@ public abstract class GameImpl implements Game {
|
|||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MageObject getObject(Ability source) {
|
||||
return source != null ? getObject(source.getSourceId()) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get permanent, card or command object (not spell or ability on the stack)
|
||||
*
|
||||
|
|
@ -1293,6 +1298,7 @@ public abstract class GameImpl implements Game {
|
|||
newWatchers.add(new CardsDrawnThisTurnWatcher());
|
||||
newWatchers.add(new ManaSpentToCastWatcher());
|
||||
newWatchers.add(new ManaPaidSourceWatcher());
|
||||
newWatchers.add(new BlockingOrBlockedWatcher());
|
||||
newWatchers.add(new CommanderPlaysCountWatcher()); // commander plays count uses in non commander games by some cards
|
||||
|
||||
// runtime check - allows only GAME scope (one watcher per game)
|
||||
|
|
@ -2387,7 +2393,7 @@ public abstract class GameImpl implements Game {
|
|||
} else {
|
||||
Filter auraFilter = spellAbility.getTargets().get(0).getFilter();
|
||||
if (auraFilter instanceof FilterPermanent) {
|
||||
if (!((FilterPermanent) auraFilter).match(attachedTo, perm.getId(), perm.getControllerId(), this)
|
||||
if (!((FilterPermanent) auraFilter).match(attachedTo, perm.getControllerId(), perm.getSpellAbility(), this)
|
||||
|| attachedTo.cantBeAttachedBy(perm, null, this, true)) {
|
||||
Card card = this.getCard(perm.getId());
|
||||
if (card != null && card.isCreature(this)) {
|
||||
|
|
@ -2567,7 +2573,7 @@ public abstract class GameImpl implements Game {
|
|||
filterLegendName.add(SuperType.LEGENDARY.getPredicate());
|
||||
filterLegendName.add(new NamePredicate(legend.getName()));
|
||||
filterLegendName.add(new ControllerIdPredicate(legend.getControllerId()));
|
||||
if (getBattlefield().contains(filterLegendName, null, legend.getControllerId(), this, 2)) {
|
||||
if (getBattlefield().contains(filterLegendName, null, legend.getControllerId(), null, this, 2)) {
|
||||
if (!replaceEvent(GameEvent.getEvent(GameEvent.EventType.DESTROY_PERMANENT_BY_LEGENDARY_RULE, legend.getId(), legend.getControllerId()))) {
|
||||
Player controller = this.getPlayer(legend.getControllerId());
|
||||
if (controller != null) {
|
||||
|
|
@ -3146,7 +3152,7 @@ public abstract class GameImpl implements Game {
|
|||
result.setRemainingAmount(amountToPrevent - result.getPreventedDamage());
|
||||
}
|
||||
MageObject damageSource = game.getObject(damageEvent.getSourceId());
|
||||
MageObject preventionSource = game.getObject(source.getSourceId());
|
||||
MageObject preventionSource = game.getObject(source);
|
||||
|
||||
if (damageSource != null && preventionSource != null) {
|
||||
MageObject targetObject = game.getObject(event.getTargetId());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue