Implemented Bonus Round

This commit is contained in:
Evan Kranzler 2018-05-27 11:27:43 -04:00
parent 9eb3da5c46
commit b5036e519c
4 changed files with 113 additions and 4 deletions

View file

@ -0,0 +1,101 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.b;
import java.util.UUID;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.effects.common.CopyTargetSpellEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author TheElk801
*/
public class BonusRound extends CardImpl {
public BonusRound(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{R}{R}");
// Until end of turn, whenever a player casts an instant or sorcery spell, that player copies it and may choose new targets for the copy.
this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new BonusRoundDelayedTriggeredAbility()));
}
public BonusRound(final BonusRound card) {
super(card);
}
@Override
public BonusRound copy() {
return new BonusRound(this);
}
}
class BonusRoundDelayedTriggeredAbility extends DelayedTriggeredAbility {
public BonusRoundDelayedTriggeredAbility() {
super(new CopyTargetSpellEffect(true, true), Duration.EndOfTurn, false);
}
public BonusRoundDelayedTriggeredAbility(final BonusRoundDelayedTriggeredAbility ability) {
super(ability);
}
@Override
public BonusRoundDelayedTriggeredAbility copy() {
return new BonusRoundDelayedTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && (spell.isInstant() || spell.isSorcery())) {
this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId()));
return true;
}
return false;
}
@Override
public String getRule() {
return "Until end of turn, whenever a player casts an instant or sorcery spell, "
+ "that player copies it and may choose new targets for the copy";
}
}

View file

@ -102,7 +102,7 @@ public class TheMirariConjecture extends CardImpl {
class TheMirariConjectureDelayedTriggeredAbility extends DelayedTriggeredAbility { class TheMirariConjectureDelayedTriggeredAbility extends DelayedTriggeredAbility {
public TheMirariConjectureDelayedTriggeredAbility() { public TheMirariConjectureDelayedTriggeredAbility() {
super(new CopyTargetSpellEffect(), Duration.EndOfTurn, false); super(new CopyTargetSpellEffect(true), Duration.EndOfTurn, false);
} }
public TheMirariConjectureDelayedTriggeredAbility(final TheMirariConjectureDelayedTriggeredAbility ability) { public TheMirariConjectureDelayedTriggeredAbility(final TheMirariConjectureDelayedTriggeredAbility ability) {

View file

@ -79,6 +79,7 @@ public class Battlebond extends ExpansionSet {
cards.add(new SetCardInfo("Blood Feud", 168, Rarity.UNCOMMON, mage.cards.b.BloodFeud.class)); cards.add(new SetCardInfo("Blood Feud", 168, Rarity.UNCOMMON, mage.cards.b.BloodFeud.class));
cards.add(new SetCardInfo("Bloodborn Scoundrels", 45, Rarity.COMMON, mage.cards.b.BloodbornScoundrels.class)); cards.add(new SetCardInfo("Bloodborn Scoundrels", 45, Rarity.COMMON, mage.cards.b.BloodbornScoundrels.class));
cards.add(new SetCardInfo("Boldwyr Intimidator", 169, Rarity.UNCOMMON, mage.cards.b.BoldwyrIntimidator.class)); cards.add(new SetCardInfo("Boldwyr Intimidator", 169, Rarity.UNCOMMON, mage.cards.b.BoldwyrIntimidator.class));
cards.add(new SetCardInfo("Bonus Round", 56, Rarity.RARE, mage.cards.b.BonusRound.class));
cards.add(new SetCardInfo("Borderland Marauder", 170, Rarity.COMMON, mage.cards.b.BorderlandMarauder.class)); cards.add(new SetCardInfo("Borderland Marauder", 170, Rarity.COMMON, mage.cards.b.BorderlandMarauder.class));
cards.add(new SetCardInfo("Bountiful Promenade", 81, Rarity.RARE, mage.cards.b.BountifulPromenade.class)); cards.add(new SetCardInfo("Bountiful Promenade", 81, Rarity.RARE, mage.cards.b.BountifulPromenade.class));
cards.add(new SetCardInfo("Bramble Sovereign", 65, Rarity.MYTHIC, mage.cards.b.BrambleSovereign.class)); cards.add(new SetCardInfo("Bramble Sovereign", 65, Rarity.MYTHIC, mage.cards.b.BrambleSovereign.class));

View file

@ -43,20 +43,27 @@ import mage.players.Player;
*/ */
public class CopyTargetSpellEffect extends OneShotEffect { public class CopyTargetSpellEffect extends OneShotEffect {
private boolean useLKI = false; private final boolean useController;
private final boolean useLKI;
public CopyTargetSpellEffect() { public CopyTargetSpellEffect() {
super(Outcome.Copy); this(false);
} }
public CopyTargetSpellEffect(boolean useLKI) { public CopyTargetSpellEffect(boolean useLKI) {
this(false, useLKI);
}
public CopyTargetSpellEffect(boolean useController, boolean useLKI) {
super(Outcome.Copy); super(Outcome.Copy);
this.useController = useController;
this.useLKI = useLKI; this.useLKI = useLKI;
} }
public CopyTargetSpellEffect(final CopyTargetSpellEffect effect) { public CopyTargetSpellEffect(final CopyTargetSpellEffect effect) {
super(effect); super(effect);
this.useLKI = effect.useLKI; this.useLKI = effect.useLKI;
this.useController = effect.useController;
} }
@Override @Override
@ -71,7 +78,7 @@ public class CopyTargetSpellEffect extends OneShotEffect {
spell = (Spell) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK); spell = (Spell) game.getLastKnownInformation(targetPointer.getFirst(game, source), Zone.STACK);
} }
if (spell != null) { if (spell != null) {
StackObject newStackObject = spell.createCopyOnStack(game, source, source.getControllerId(), true); StackObject newStackObject = spell.createCopyOnStack(game, source, useController ? spell.getControllerId() : source.getControllerId(), true);
Player player = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getControllerId());
if (player != null && newStackObject != null && newStackObject instanceof Spell) { if (player != null && newStackObject != null && newStackObject instanceof Spell) {
String activateMessage = ((Spell) newStackObject).getActivatedMessage(game); String activateMessage = ((Spell) newStackObject).getActivatedMessage(game);