* Grenzo, Havoc Raiser - Fixed that blocked the game.

This commit is contained in:
LevelX2 2017-09-05 16:20:58 +02:00
parent b2496e3d7f
commit 0ce13bf676
4 changed files with 18 additions and 23 deletions

View file

@ -74,9 +74,9 @@ public class AttacksIfAbleTargetEffect extends RequirementEffect {
return staticText;
}
if (this.duration == Duration.EndOfTurn) {
return new StringBuilder("Target ").append(mode.getTargets().get(0).getTargetName()).append(" attacks this turn if able").toString();
return "Target " + mode.getTargets().get(0).getTargetName() + " attacks this turn if able";
} else {
return new StringBuilder("Target ").append(mode.getTargets().get(0).getTargetName()).append(" attacks each turn if able").toString();
return "Target " + mode.getTargets().get(0).getTargetName() + " attacks each turn if able";
}
}

View file

@ -40,15 +40,8 @@ import mage.game.permanent.Permanent;
*/
public class CantAttackYouEffect extends RestrictionEffect {
private boolean canAttackYouAnyway = false;
public CantAttackYouEffect(Duration duration) {
this(duration, false);
}
public CantAttackYouEffect(Duration duration, boolean canAttackYouAnyway) {
super(duration);
this.canAttackYouAnyway = canAttackYouAnyway;
}
public CantAttackYouEffect(final CantAttackYouEffect effect) {
@ -67,11 +60,6 @@ public class CantAttackYouEffect extends RestrictionEffect {
@Override
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game) {
for (UUID player : game.getOpponents(source.getId())) {
if (attacker.canAttack(player, game)) {
return false;
}
}
return !canAttackYouAnyway;
return !defenderId.equals(source.getControllerId());
}
}

View file

@ -33,6 +33,8 @@ import mage.abilities.effects.OneShotEffect;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
@ -63,12 +65,17 @@ public class GoadTargetEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
ContinuousEffect effect = new AttacksIfAbleTargetEffect(Duration.UntilYourNextTurn);
effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source)));
game.addEffect(effect, source);
effect = new CantAttackYouEffect(Duration.UntilYourNextTurn, true);
effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source)));
game.addEffect(effect, source);
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
Player controller = game.getPlayer(source.getControllerId());
if (targetCreature != null && controller != null) {
ContinuousEffect effect = new AttacksIfAbleTargetEffect(Duration.UntilYourNextTurn);
effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source)));
game.addEffect(effect, source);
effect = new CantAttackYouEffect(Duration.UntilYourNextTurn);
effect.setTargetPointer(new FixedTarget(getTargetPointer().getFirst(game, source)));
game.addEffect(effect, source);
game.informPlayers(controller.getLogName() + " is goating " + targetCreature.getLogName());
}
return true;
}
}