mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Fix Booby Trap
This commit is contained in:
parent
ad0b4659bb
commit
a7cbd54f6e
1 changed files with 18 additions and 18 deletions
|
@ -1,15 +1,12 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.*;
|
||||
import mage.abilities.effects.common.ChooseACardNameEffect;
|
||||
import mage.abilities.effects.common.ChooseOpponentEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -20,20 +17,17 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetImpl;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author noahg
|
||||
*/
|
||||
public final class BoobyTrap extends CardImpl {
|
||||
|
||||
public BoobyTrap(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{6}");
|
||||
|
||||
|
||||
// As Booby Trap enters the battlefield, name a card other than a basic land card and choose an opponent.
|
||||
AsEntersBattlefieldAbility etbAbility = new AsEntersBattlefieldAbility(new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.NOT_BASIC_LAND_NAME));
|
||||
|
@ -58,7 +52,7 @@ public final class BoobyTrap extends CardImpl {
|
|||
class BoobyTrapTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public BoobyTrapTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DoIfCostPaid(new DamageTargetEffect(10), new SacrificeSourceCost()), false);
|
||||
super(Zone.BATTLEFIELD, new DoIfCostPaid(new DamageTargetEffect(10, true, "that player"), new SacrificeSourceCost(), "", false), false);
|
||||
}
|
||||
|
||||
public BoobyTrapTriggeredAbility(BoobyTrapTriggeredAbility ability) {
|
||||
|
@ -72,15 +66,15 @@ class BoobyTrapTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Player controller = game.getPlayer(sourceId);
|
||||
if (event.getPlayerId() == null || game.getState() == null || controller == null){
|
||||
Player controller = game.getPlayer(getControllerId());
|
||||
if (event.getPlayerId() == null || game.getState() == null || controller == null) {
|
||||
return false;
|
||||
}
|
||||
if (event.getPlayerId().equals(game.getState().getValue(getSourceId()+ChooseOpponentEffect.VALUE_KEY))){
|
||||
if (event.getPlayerId().equals(game.getState().getValue(getSourceId().toString() + ChooseOpponentEffect.VALUE_KEY))) {
|
||||
Card drawn = game.getCard(event.getTargetId());
|
||||
if (drawn != null){
|
||||
if (drawn != null) {
|
||||
controller.revealCards(this, new CardsImpl(drawn), game);
|
||||
if(drawn.getName().equals(game.getState().getValue(getSourceId() + ChooseACardNameEffect.INFO_KEY))){
|
||||
if (drawn.getName().equals(game.getState().getValue(getSourceId().toString() + ChooseACardNameEffect.INFO_KEY))) {
|
||||
//Set target
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
return true;
|
||||
|
@ -94,4 +88,10 @@ class BoobyTrapTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public BoobyTrapTriggeredAbility copy() {
|
||||
return new BoobyTrapTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "The chosen player reveals each card he or she draws.\n" +
|
||||
"When the chosen player draws the named card, sacrifice {this}. If you do, {this} deals 10 damage to that player.";
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue