mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
- Fixed the controller aspect of Martial Impetus
This commit is contained in:
parent
bcf7966055
commit
d8059b6e74
1 changed files with 14 additions and 7 deletions
|
|
@ -69,12 +69,19 @@ enum MartialImpetusPredicate implements ObjectSourcePlayerPredicate<ObjectSource
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||||
Permanent attachedTo = game.getPermanentOrLKIBattlefield(game.getPermanent(input.getSourceId()).getAttachedTo());
|
Permanent martialImpetus = game.getPermanentOrLKIBattlefield(input.getSourceId());
|
||||||
return attachedTo != null // check the creature that the aura is attached to, not the aura itself
|
if (martialImpetus != null) {
|
||||||
|
Permanent attachedTo = game.getPermanentOrLKIBattlefield(martialImpetus.getAttachedTo());
|
||||||
|
UUID auraControllerId = martialImpetus.getControllerId();
|
||||||
|
if (attachedTo != null // check the creature that the aura is attached to, not the aura itself
|
||||||
&& input.getObject() != null // creature being checked for predicate
|
&& input.getObject() != null // creature being checked for predicate
|
||||||
&& input.getObject() != attachedTo // must be other creature
|
&& input.getObject() != attachedTo // must be other creature
|
||||||
&& input.getObject().isAttacking() // attacking
|
&& input.getObject().isAttacking() // attacking
|
||||||
&& game.getOpponents(attachedTo.getControllerId()) // must be attacking an opponent
|
&& game.getOpponents(auraControllerId) // check for opponents of aura's controller
|
||||||
.contains(game.getCombat().getDefendingPlayerId(input.getObject().getId(), game));
|
.contains(game.getCombat().getDefendingPlayerId(input.getObject().getId(), game))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue