Implemented Bruvac the Grandiloquent (still needs refactoring

This commit is contained in:
Evan Kranzler 2020-06-23 17:29:14 -04:00
parent 4a6a0e4d42
commit ba0e9af5fd
3 changed files with 82 additions and 0 deletions

View file

@ -0,0 +1,80 @@
package mage.cards.b;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class BruvacTheGrandiloquent extends CardImpl {
public BruvacTheGrandiloquent(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.ADVISOR);
this.power = new MageInt(1);
this.toughness = new MageInt(4);
// If an opponent would mill one or more cards, they mill twice that many cards instead.
this.addAbility(new SimpleStaticAbility(new BruvacTheGrandiloquentReplacementEffect()));
}
private BruvacTheGrandiloquent(final BruvacTheGrandiloquent card) {
super(card);
}
@Override
public BruvacTheGrandiloquent copy() {
return new BruvacTheGrandiloquent(this);
}
}
class BruvacTheGrandiloquentReplacementEffect extends ReplacementEffectImpl {
BruvacTheGrandiloquentReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.Neutral);
staticText = "If an opponent would mill one or more cards, they mill twice that many cards instead";
}
private BruvacTheGrandiloquentReplacementEffect(final BruvacTheGrandiloquentReplacementEffect effect) {
super(effect);
}
@Override
public BruvacTheGrandiloquentReplacementEffect copy() {
return new BruvacTheGrandiloquentReplacementEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.MILL_CARDS;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return game.getOpponents(source.getControllerId()).contains(event.getPlayerId());
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
event.setAmount(CardUtil.addWithOverflowCheck(event.getAmount(), event.getAmount()));
return false;
}
}

View file

@ -83,6 +83,7 @@ public final class Jumpstart extends ExpansionSet {
cards.add(new SetCardInfo("Brightmare", 2, Rarity.UNCOMMON, mage.cards.b.Brightmare.class));
cards.add(new SetCardInfo("Brindle Shoat", 380, Rarity.UNCOMMON, mage.cards.b.BrindleShoat.class));
cards.add(new SetCardInfo("Brushstrider", 381, Rarity.UNCOMMON, mage.cards.b.Brushstrider.class));
cards.add(new SetCardInfo("Bruvac the Grandiloquent", 10, Rarity.MYTHIC, mage.cards.b.BruvacTheGrandiloquent.class));
cards.add(new SetCardInfo("Bubbling Cauldron", 460, Rarity.UNCOMMON, mage.cards.b.BubblingCauldron.class));
cards.add(new SetCardInfo("Bulwark Giant", 93, Rarity.COMMON, mage.cards.b.BulwarkGiant.class));
cards.add(new SetCardInfo("Burglar Rat", 214, Rarity.COMMON, mage.cards.b.BurglarRat.class));

View file

@ -88,6 +88,7 @@ public class GameEvent implements Serializable {
CYCLE_CARD, CYCLED_CARD, CYCLE_DRAW,
CLASH, CLASHED,
DAMAGE_PLAYER,
MILL_CARDS,
/* DAMAGED_PLAYER
targetId the id of the damaged player
sourceId sourceId of the ability which caused the damage