mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
* Grand Abolisher - Fixed that it also prevented wrongly abilities of cards not on the battlefield (e.g. Cycling).
This commit is contained in:
parent
568f62c66f
commit
87bf3408b3
1 changed files with 18 additions and 24 deletions
|
@ -106,30 +106,24 @@ class GrandAbolisherEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
boolean spell = event.getType() == GameEvent.EventType.CAST_SPELL;
|
return event.getType() == GameEvent.EventType.CAST_SPELL || event.getType() == GameEvent.EventType.ACTIVATE_ABILITY;
|
||||||
boolean activated = event.getType() == GameEvent.EventType.ACTIVATE_ABILITY;
|
|
||||||
if ((spell || activated) && game.getActivePlayerId().equals(source.getControllerId()) && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
|
||||||
|
|
||||||
if (spell) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check source of activated ability
|
|
||||||
Permanent permanent = game.getPermanent(event.getSourceId());
|
|
||||||
if (permanent != null) {
|
|
||||||
return permanent.getCardType().contains(CardType.ARTIFACT) || permanent.getCardType().contains(CardType.CREATURE)
|
|
||||||
|| permanent.getCardType().contains(CardType.ENCHANTMENT);
|
|
||||||
} else {
|
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
|
||||||
if (object != null) {
|
|
||||||
return object.getCardType().contains(CardType.ARTIFACT) || object.getCardType().contains(CardType.CREATURE)
|
|
||||||
|| object.getCardType().contains(CardType.ENCHANTMENT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
if (game.getActivePlayerId().equals(source.getControllerId()) && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||||
|
switch(event.getType()) {
|
||||||
|
case CAST_SPELL:
|
||||||
|
return true;
|
||||||
|
case ACTIVATE_ABILITY:
|
||||||
|
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||||
|
if (permanent != null) {
|
||||||
|
return permanent.getCardType().contains(CardType.ARTIFACT) || permanent.getCardType().contains(CardType.CREATURE)
|
||||||
|
|| permanent.getCardType().contains(CardType.ENCHANTMENT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue