forked from External/mage
implement [MH3] Volatile Stormdrake ; provide source Ability to canBeTargetedBy and HexproofBaseAbility::checkObject
This commit is contained in:
parent
8ec4ffd9de
commit
2d625f0364
49 changed files with 399 additions and 171 deletions
|
|
@ -1302,8 +1302,8 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeTargetedBy(MageObject source, UUID sourceControllerId, Game game) {
|
||||
if (source != null) {
|
||||
public boolean canBeTargetedBy(MageObject sourceObject, UUID sourceControllerId, Ability source, Game game) {
|
||||
if (sourceObject != null) {
|
||||
if (abilities.containsKey(ShroudAbility.getInstance().getId())) {
|
||||
if (game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.SHROUD, null, sourceControllerId, game).isEmpty()) {
|
||||
return false;
|
||||
|
|
@ -1315,17 +1315,17 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
|
|||
&& abilities.stream()
|
||||
.filter(HexproofBaseAbility.class::isInstance)
|
||||
.map(HexproofBaseAbility.class::cast)
|
||||
.anyMatch(ability -> ability.checkObject(source, game))) {
|
||||
.anyMatch(ability -> ability.checkObject(sourceObject, source, game))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (hasProtectionFrom(source, game)) {
|
||||
if (hasProtectionFrom(sourceObject, game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// example: Fiendslayer Paladin tried to target with Ultimate Price
|
||||
return !game.getContinuousEffects().preventedByRuleModification(
|
||||
new TargetEvent(this, source.getId(), sourceControllerId),
|
||||
new TargetEvent(this, sourceObject.getId(), sourceControllerId),
|
||||
null,
|
||||
game,
|
||||
true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue