@Override public boolean apply(MageObject input, Game game) { return color != null && input.getColor(game).shares(color); }
@Override public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) { boolean result = false; if (blocker.isArtifact() && (blocker.isCreature())) { result = true; } if (attacker.getColor(game).shares(blocker.getColor(game))) { result = true; } return result; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (super.applies(event, source, game)) { if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER || event.getType() == GameEvent.EventType.DAMAGE_CREATURE || event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER) { MageObject sourceObject = game.getObject(event.getSourceId()); if (sourceObject != null && (sourceObject.getColor(game).shares(ObjectColor.BLACK) || sourceObject.getColor(game).shares(ObjectColor.RED))) { return true; } } } return false; }
@Override public boolean apply(ObjectSourcePlayer<MageObject> input, Game game) { MageObject sourceObject = game.getObject(input.getSourceId()); if (sourceObject != null) { return input.getObject().getColor(game).shares(sourceObject.getColor(game)); } return false; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (super.applies(event, source, game)) { if (event.getType() == GameEvent.EventType.DAMAGE_CREATURE && event.getTargetId().equals(getTargetPointer().getFirst(game, source))) { MageObject sourceObject = game.getObject(event.getSourceId()); if (sourceObject != null && sourceObject.getColor(game).shares(this.color)) { return true; } } } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getPlayerId().equals(this.getControllerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); ObjectColor color = (ObjectColor) game.getState().getValue(getSourceId() + "_color"); if (spell != null && color != null && spell.getColor(game).shares(color)) { return true; } } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { if (event.getPlayerId().equals(this.getControllerId())) { Spell spell = game.getStack().getSpell(event.getTargetId()); ObjectColor color = (ObjectColor) game.getState().getValue(getSourceId() + "_color"); if (spell != null && color != null && spell.getColor(game).shares(color)) { return true; } } return false; }
@Override public void init(Ability source, Game game) { super.init(source, game); Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source)); if (target != null) { affectedObjectList.add(new MageObjectReference(target, game)); ObjectColor color = target.getColor(game); for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) { if (!permanent.getId().equals(target.getId()) && permanent.getColor(game).shares(color)) { affectedObjectList.add(new MageObjectReference(permanent, game)); } } } }
@Override public void init(Ability source, Game game) { super.init(source, game); Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source)); if (target != null) { affectedObjectList.add(new MageObjectReference(target, game)); ObjectColor color = target.getColor(game); for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) { if (!permanent.getId().equals(target.getId()) && permanent.getColor(game).shares(color)) { affectedObjectList.add(new MageObjectReference(permanent, game)); } } } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (super.applies(event, source, game)) { if ((event.getType() == GameEvent.EventType.DAMAGE_PLAYER || event.getType() == GameEvent.EventType.DAMAGED_PLANESWALKER) && event.getTargetId().equals(getTargetPointer().getFirst(game, source))) { MageObject sourceObject = game.getObject(event.getSourceId()); if (sourceObject != null && sourceObject.getColor(game).shares(this.color)) { return true; } } } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent creature = game.getPermanentOrLKIBattlefield(targetPointer.getFirst(game, source)); if (creature != null) { ObjectColor color = creature.getColor(game); for (Permanent permanent : game.getBattlefield().getActivePermanents(FILTER, source.getControllerId(), game)) { if (permanent.getColor(game).shares(color) && !Objects.equals(permanent, creature)) { permanent.destroy(source.getSourceId(), game, true); } } return true; } return false; }
@Override public boolean apply(ObjectSourcePlayer<MageObject> input, Game game) { Permanent permanent = game.getPermanent(input.getSourceId()); if (permanent == null) { return false; } ObjectColor color = (ObjectColor) game.getState().getValue(permanent.getId() + "_color"); return color != null && input.getObject().getColor(game).shares(color); } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (super.applies(event, source, game)) { if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER || event.getType() == GameEvent.EventType.DAMAGE_CREATURE || event.getType() == GameEvent.EventType.DAMAGE_PLANESWALKER) { MageObject sourceObject = game.getObject(event.getSourceId()); if (sourceObject != null && sourceObject.getColor(game).shares(this.color)) { return true; } } } return false; }
@Override public boolean applies(Permanent permanent, Ability source, Game game) { ObjectColor chosenColor = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color"); return chosenColor != null && !permanent.getAbilities().contains(FlyingAbility.getInstance()) && permanent.getColor(game).shares(chosenColor) && permanent.isCreature(); }
@Override public boolean apply(Game game, Ability source) { Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source)); if (target != null) { ObjectColor targetColor = target.getColor(game); for (Permanent permanent : game.getBattlefield().getActivePermanents(FILTER, source.getControllerId(), game)) { if (target.getId().equals(permanent.getId()) || permanent.getColor(game).shares(targetColor)) { permanent.damage(1, source.getSourceId(), game, false, true); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent target = game.getPermanent(targetPointer.getFirst(game, source)); if (target != null) { ObjectColor color = target.getColor(game); target.damage(2, source.getSourceId(), game, false, true); for (Permanent p : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (!target.getId().equals(p.getId()) && p.getColor(game).shares(color)) { p.damage(2, source.getSourceId(), game, false, true); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { ObjectColor color = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color"); if (color != null) { for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { if (perm.getColor(game).shares(color)) { perm.addPower(1); perm.addToughness(1); } } return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source)); if (target != null) { ObjectColor color = target.getColor(game); target.untap(game); for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game)) { if (permanent.getColor(game).shares(color) && !permanent.getId().equals(target.getId())) { permanent.untap(game); } } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { Permanent target = game.getPermanent(targetPointer.getFirst(game, source)); if (target != null) { ObjectColor color = target.getColor(game); target.destroy(source.getSourceId(), game, false); for (Permanent p : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game)) { if (p.getColor(game).shares(color)) { p.destroy(source.getSourceId(), game, false); } } return true; } return false; }
@Override public boolean checkTrigger(GameEvent event, Game game) { Permanent curseOfWizardry = game.getPermanent(getSourceId()); if (curseOfWizardry != null) { ObjectColor chosenColor = (ObjectColor) game.getState().getValue(curseOfWizardry.getId() + "_color"); if (chosenColor != null) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && spell.getColor(game).shares(chosenColor)) { this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId())); return true; } } } return false; }