* Watchdof + Briar Patch - Fixed abug that an ability could have no controller.

This commit is contained in:
LevelX2 2017-08-30 16:56:39 +02:00
parent 6857b7db29
commit 1c8f11e849
2 changed files with 10 additions and 12 deletions

View file

@ -52,7 +52,7 @@ public class BriarPatch extends CardImpl {
Effect effect = new BoostTargetEffect(-1, 0, Duration.EndOfTurn);
effect.setText("it gets -1/-0");
Ability ability = new AttackedByCreatureTriggeredAbility(Zone.BATTLEFIELD, effect, false, SetTargetPointer.PERMANENT);
this.getAbilities().add(ability);
addAbility(ability);
}
public BriarPatch(final BriarPatch card) {

View file

@ -52,16 +52,16 @@ import mage.game.permanent.Permanent;
public class Watchdog extends CardImpl {
public Watchdog(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{3}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
this.subtype.add("Hound");
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// Watchdog blocks each turn if able.
this.getAbilities().add(new SimpleStaticAbility(Zone.BATTLEFIELD, new BlocksIfAbleSourceEffect(Duration.WhileOnBattlefield)));
addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BlocksIfAbleSourceEffect(Duration.WhileOnBattlefield)));
// As long as Watchdog is untapped, all creatures attacking you get -1/-0.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new BoostAllEffect(-1, 0, Duration.WhileOnBattlefield, new WatchdogFilter(), false), new InvertCondition(SourceTappedCondition.instance),"As long as {this} is untapped, all creatures attacking you get -1/-0")));
addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new BoostAllEffect(-1, 0, Duration.WhileOnBattlefield, new WatchdogFilter(), false), new InvertCondition(SourceTappedCondition.instance), "As long as {this} is untapped, all creatures attacking you get -1/-0")));
}
public Watchdog(final Watchdog card) {
@ -74,14 +74,12 @@ public class Watchdog extends CardImpl {
}
}
class WatchdogFilter extends FilterAttackingCreature {
public WatchdogFilter() {
super("creatures attacking you");
}
public WatchdogFilter(final WatchdogFilter filter) {
super(filter);
}
@ -93,15 +91,15 @@ class WatchdogFilter extends FilterAttackingCreature {
@Override
public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) {
if(!super.match(permanent, sourceId, playerId, game)) {
if (!super.match(permanent, sourceId, playerId, game)) {
return false;
}
for(CombatGroup group : game.getCombat().getGroups()) {
for(UUID attacker : group.getAttackers()) {
if(attacker.equals(permanent.getId())) {
for (CombatGroup group : game.getCombat().getGroups()) {
for (UUID attacker : group.getAttackers()) {
if (attacker.equals(permanent.getId())) {
UUID defenderId = group.getDefenderId();
if(defenderId.equals(playerId)) {
if (defenderId.equals(playerId)) {
return true;
}
}