mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
Implemented Clackbridge Troll
This commit is contained in:
parent
d9487e5cb8
commit
09895e55f6
2 changed files with 124 additions and 0 deletions
123
Mage.Sets/src/mage/cards/c/ClackbridgeTroll.java
Normal file
123
Mage.Sets/src/mage/cards/c/ClackbridgeTroll.java
Normal file
|
@ -0,0 +1,123 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenTargetEffect;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.GoatToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class ClackbridgeTroll extends CardImpl {
|
||||
|
||||
public ClackbridgeTroll(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
|
||||
|
||||
this.subtype.add(SubType.TROLL);
|
||||
this.power = new MageInt(8);
|
||||
this.toughness = new MageInt(8);
|
||||
|
||||
// Trample
|
||||
this.addAbility(TrampleAbility.getInstance());
|
||||
|
||||
// Haste
|
||||
this.addAbility(HasteAbility.getInstance());
|
||||
|
||||
// When Clackbridge Troll enters the battlefield, target opponent creates three 0/1 white Goat creature tokens.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new CreateTokenTargetEffect(new GoatToken(), 3));
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
|
||||
// At the beginning of combat on your turn, any opponent may sacrifice a creature. If a player does, tap Clackbridge Troll, you gain 3 life, and you draw a card.
|
||||
this.addAbility(new BeginningOfCombatTriggeredAbility(
|
||||
new ClackbridgeTrollEffect(), TargetController.YOU, false)
|
||||
);
|
||||
}
|
||||
|
||||
private ClackbridgeTroll(final ClackbridgeTroll card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClackbridgeTroll copy() {
|
||||
return new ClackbridgeTroll(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ClackbridgeTrollEffect extends OneShotEffect {
|
||||
|
||||
ClackbridgeTrollEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "any opponent may sacrifice a creature. If a player does, " +
|
||||
"tap {this}, you gain 3 life, and you draw a card.";
|
||||
}
|
||||
|
||||
private ClackbridgeTrollEffect(final ClackbridgeTrollEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClackbridgeTrollEffect copy() {
|
||||
return new ClackbridgeTrollEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePerm = game.getPermanent(source.getSourceId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
boolean flag = false;
|
||||
for (UUID opponentId : game.getOpponents(controller.getId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
if (opponent == null) {
|
||||
continue;
|
||||
}
|
||||
FilterControlledPermanent filter = new FilterControlledPermanent("creature to sacrifice");
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
TargetControlledPermanent target = new TargetControlledPermanent(filter);
|
||||
target.setNotTarget(true);
|
||||
if (!target.canChoose(opponent.getId(), game)
|
||||
|| !opponent.chooseUse(Outcome.AIDontUseIt, "Sacrifice a creature?", source, game)
|
||||
|| !opponent.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) {
|
||||
continue;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent == null || !permanent.sacrifice(source.getSourceId(), game)) {
|
||||
continue;
|
||||
}
|
||||
flag = true;
|
||||
}
|
||||
if (flag) {
|
||||
if (sourcePerm != null) {
|
||||
sourcePerm.tap(game);
|
||||
}
|
||||
controller.gainLife(3, game, source);
|
||||
controller.drawCards(1, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -43,6 +43,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Burning-Yard Trainer", 117, Rarity.UNCOMMON, mage.cards.b.BurningYardTrainer.class));
|
||||
cards.add(new SetCardInfo("Chittering Witch", 319, Rarity.RARE, mage.cards.c.ChitteringWitch.class));
|
||||
cards.add(new SetCardInfo("Chulane, Teller of Tales", 326, Rarity.MYTHIC, mage.cards.c.ChulaneTellerOfTales.class));
|
||||
cards.add(new SetCardInfo("Clackbridge Troll", 84, Rarity.RARE, mage.cards.c.ClackbridgeTroll.class));
|
||||
cards.add(new SetCardInfo("Claim the Firstborn", 118, Rarity.UNCOMMON, mage.cards.c.ClaimTheFirstborn.class));
|
||||
cards.add(new SetCardInfo("Command Tower", 333, Rarity.COMMON, mage.cards.c.CommandTower.class));
|
||||
cards.add(new SetCardInfo("Corridor Monitor", 41, Rarity.COMMON, mage.cards.c.CorridorMonitor.class));
|
||||
|
|
Loading…
Reference in a new issue