[NCC] Implemented Dogged Detective

This commit is contained in:
Daniel Bomar 2022-06-29 11:55:30 -05:00
parent 5413389c7d
commit c6cc9bd83f
No known key found for this signature in database
GPG key ID: C86C8658F4023918
3 changed files with 60 additions and 1 deletions

View file

@ -10,6 +10,7 @@ import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import mage.watchers.Watcher;
import java.util.*;
@ -29,7 +30,11 @@ public class DrawSecondCardTriggeredAbility extends TriggeredAbilityImpl {
}
public DrawSecondCardTriggeredAbility(Effect effect, boolean optional, TargetController targetController) {
super(Zone.BATTLEFIELD, effect, optional);
this(Zone.BATTLEFIELD, effect, optional, targetController);
}
public DrawSecondCardTriggeredAbility(Zone zone, Effect effect, boolean optional, TargetController targetController) {
super(zone, effect, optional);
this.addWatcher(new DrawSecondCardWatcher());
this.targetController = targetController;
this.addHint(hint);
@ -58,6 +63,12 @@ public class DrawSecondCardTriggeredAbility extends TriggeredAbilityImpl {
return false;
}
break;
case OPPONENT:
Player controller = game.getPlayer(controllerId);
if (controller == null || !controller.hasOpponent(event.getPlayerId(), game)) {
return false;
}
break;
default:
throw new IllegalArgumentException("TargetController " + targetController + " not supported");
}
@ -71,6 +82,8 @@ public class DrawSecondCardTriggeredAbility extends TriggeredAbilityImpl {
return "Whenever you draw your second card each turn, ";
case ACTIVE:
return "Whenever a player draws their second card during their turn, ";
case OPPONENT:
return "Whenever an opponent draws their second card each turn, ";
default:
throw new IllegalArgumentException("TargetController " + targetController + " not supported");
}