fixed goad effect

This commit is contained in:
Evan Kranzler 2017-08-27 16:14:48 -04:00
parent e52e7f23e9
commit 6cd18246de
2 changed files with 10 additions and 6 deletions

View file

@ -28,8 +28,9 @@
package mage.abilities.effects.common.combat; package mage.abilities.effects.common.combat;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.Effect; import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.game.Game; import mage.game.Game;
@ -60,9 +61,12 @@ public class GoadAllEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) { for (Permanent creature : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) {
if (!creature.getControllerId().equals(source.getControllerId())) { if (!creature.getControllerId().equals(source.getControllerId())) {
Effect effect = new GoadTargetEffect(); ContinuousEffect effect = new AttacksIfAbleTargetEffect(Duration.UntilYourNextTurn);
effect.setTargetPointer(new FixedTarget(creature, game)); effect.setTargetPointer(new FixedTarget(creature.getId()));
effect.apply(game, source); game.addEffect(effect, source);
effect = new CantAttackYouEffect(Duration.UntilYourNextTurn, true);
effect.setTargetPointer(new FixedTarget(creature.getId()));
game.addEffect(effect, source);
} }
} }
return true; return true;

View file

@ -59,9 +59,9 @@ public class GoadTargetEffect extends OneShotEffect {
ContinuousEffect effect = new AttacksIfAbleTargetEffect(Duration.UntilYourNextTurn); ContinuousEffect effect = new AttacksIfAbleTargetEffect(Duration.UntilYourNextTurn);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget())); effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
game.addEffect(effect, source); game.addEffect(effect, source);
effect = new CantAttackYouEffect(Duration.EndOfTurn, true); effect = new CantAttackYouEffect(Duration.UntilYourNextTurn, true);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget())); effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
game.addEffect(effect, source); game.addEffect(effect, source);
return true; return true;
} }
} }