From 068f5db976440f3b2da29fd01925113b9e21ed56 Mon Sep 17 00:00:00 2001 From: jimga150 Date: Sat, 6 Jan 2024 15:09:14 -0500 Subject: [PATCH] [PIP] Implement Mr. House, President and CEO (#11610) * move Cybernetic Datasmith's robot token to RobotCantBlockToken since Mr. House has a more generic version * Update tokens database --- .../mage/cards/c/CyberneticaDatasmith.java | 4 +- .../mage/cards/m/MrHousePresidentAndCEO.java | 158 ++++++++++++++++++ Mage.Sets/src/mage/sets/Fallout.java | 1 + .../OneOrMoreDiceRolledTriggeredAbility.java | 4 +- .../permanent/token/RobotCantBlockToken.java | 35 ++++ .../mage/game/permanent/token/RobotToken.java | 13 +- Mage/src/main/resources/tokens-database.txt | 7 +- 7 files changed, 206 insertions(+), 16 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/m/MrHousePresidentAndCEO.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/RobotCantBlockToken.java diff --git a/Mage.Sets/src/mage/cards/c/CyberneticaDatasmith.java b/Mage.Sets/src/mage/cards/c/CyberneticaDatasmith.java index 77509b674c1..d82990170b1 100644 --- a/Mage.Sets/src/mage/cards/c/CyberneticaDatasmith.java +++ b/Mage.Sets/src/mage/cards/c/CyberneticaDatasmith.java @@ -15,7 +15,7 @@ import mage.constants.SubType; import mage.filter.FilterCard; import mage.filter.FilterPlayer; import mage.filter.predicate.other.AnotherTargetPredicate; -import mage.game.permanent.token.RobotToken; +import mage.game.permanent.token.RobotCantBlockToken; import mage.target.TargetPlayer; import mage.target.targetpointer.SecondTargetPointer; @@ -48,7 +48,7 @@ public final class CyberneticaDatasmith extends CardImpl { // Field Reprogramming -- {U}, {T}: Target player draws a card. Another target player creates a 4/4 colorless Robot artifact creature token with "This creature can't block." Ability ability = new SimpleActivatedAbility(new DrawCardTargetEffect(1), new ManaCostsImpl<>("{U}")); ability.addCost(new TapSourceCost()); - ability.addEffect(new CreateTokenTargetEffect(new RobotToken()) + ability.addEffect(new CreateTokenTargetEffect(new RobotCantBlockToken()) .setTargetPointer(new SecondTargetPointer()) .concatBy("another")); ability.addTarget(new TargetPlayer() diff --git a/Mage.Sets/src/mage/cards/m/MrHousePresidentAndCEO.java b/Mage.Sets/src/mage/cards/m/MrHousePresidentAndCEO.java new file mode 100644 index 00000000000..6a36fc482a9 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MrHousePresidentAndCEO.java @@ -0,0 +1,158 @@ +package mage.cards.m; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.constants.*; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.game.Game; +import mage.game.events.DieRolledEvent; +import mage.game.events.GameEvent; +import mage.game.permanent.token.RobotToken; +import mage.game.permanent.token.Token; +import mage.game.permanent.token.TreasureToken; +import mage.players.Player; +import mage.watchers.common.ManaPaidSourceWatcher; + +/** + * + * @author jimga150 + */ +public final class MrHousePresidentAndCEO extends CardImpl { + + public MrHousePresidentAndCEO(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{R}{W}{B}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.power = new MageInt(0); + this.toughness = new MageInt(4); + + // Whenever you roll a 4 or higher, create a 3/3 colorless Robot artifact creature token. If you rolled 6 or higher, instead create that token and a Treasure token. + this.addAbility(new MrHousePresidentAndCEOTriggeredAbility()); + + // {4}, {T}: Roll a six-sided die plus an additional six-sided die for each mana from Treasures spent to activate this ability. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MrHousePresidentAndCEODieRollEffect(), new ManaCostsImpl<>("{4}")); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + } + + private MrHousePresidentAndCEO(final MrHousePresidentAndCEO card) { + super(card); + } + + @Override + public MrHousePresidentAndCEO copy() { + return new MrHousePresidentAndCEO(this); + } +} + +// Based on As Luck Would Have It +class MrHousePresidentAndCEOTriggeredAbility extends TriggeredAbilityImpl { + + public MrHousePresidentAndCEOTriggeredAbility() { + super(Zone.BATTLEFIELD, new MrHousePresidentAndCEOTokenEffect(), false); + } + + private MrHousePresidentAndCEOTriggeredAbility(final MrHousePresidentAndCEOTriggeredAbility ability) { + super(ability); + } + + @Override + public MrHousePresidentAndCEOTriggeredAbility copy() { + return new MrHousePresidentAndCEOTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DIE_ROLLED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + DieRolledEvent drEvent = (DieRolledEvent) event; + if (this.isControlledBy(event.getPlayerId()) && drEvent.getRollDieType() == RollDieType.NUMERICAL) { + // looks for "result" instead "natural result" + int result = drEvent.getResult(); + this.getEffects().setValue("rolled", result); + return result >= 4; + } + return false; + } + + @Override + public String getRule(){ + return "Whenever you roll a 4 or higher, create a 3/3 colorless Robot artifact creature token. " + + "If you rolled 6 or higher, instead create that token and a Treasure token."; + } +} + +class MrHousePresidentAndCEOTokenEffect extends OneShotEffect { + + public MrHousePresidentAndCEOTokenEffect() { + super(Outcome.Benefit); + } + + private MrHousePresidentAndCEOTokenEffect(final MrHousePresidentAndCEOTokenEffect effect) { + super(effect); + } + + @Override + public MrHousePresidentAndCEOTokenEffect copy() { + return new MrHousePresidentAndCEOTokenEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + if (getValue("rolled") == null) { + return false; + } + int amount = (Integer) getValue("rolled"); + + if (amount >= 4) { + Token robotToken = new RobotToken(); + robotToken.putOntoBattlefield(1, game, source); + } + if (amount >= 6) { + Token treasureToken = new TreasureToken(); + treasureToken.putOntoBattlefield(1, game, source); + } + return amount >= 4; + } +} + +// Based on Berg Strider and Ancient Brass Dragon +class MrHousePresidentAndCEODieRollEffect extends OneShotEffect { + + public MrHousePresidentAndCEODieRollEffect() { + super(Outcome.PutCreatureInPlay); + this.staticText = "Roll a six-sided die plus an additional six-sided die for each mana from Treasures spent " + + "to activate this ability."; + } + + private MrHousePresidentAndCEODieRollEffect(final MrHousePresidentAndCEODieRollEffect effect) { + super(effect); + } + + @Override + public MrHousePresidentAndCEODieRollEffect copy() { + return new MrHousePresidentAndCEODieRollEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + controller.rollDice(outcome, source, game, 6, + 1 + ManaPaidSourceWatcher.getTreasurePaid(source.getSourceId(), game), 0); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/Fallout.java b/Mage.Sets/src/mage/sets/Fallout.java index 6983caa43b2..7e27bfb47d9 100644 --- a/Mage.Sets/src/mage/sets/Fallout.java +++ b/Mage.Sets/src/mage/sets/Fallout.java @@ -28,6 +28,7 @@ public final class Fallout extends ExpansionSet { cards.add(new SetCardInfo("Intelligence Bobblehead", 134, Rarity.UNCOMMON, mage.cards.i.IntelligenceBobblehead.class)); cards.add(new SetCardInfo("Island", 319, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Mountain", 323, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Mr. House, President and CEO", 7, Rarity.MYTHIC, mage.cards.m.MrHousePresidentAndCEO.class)); cards.add(new SetCardInfo("Nuka-Cola Vending Machine", 137, Rarity.UNCOMMON, mage.cards.n.NukaColaVendingMachine.class)); cards.add(new SetCardInfo("Plains", 317, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Radstorm", 37, Rarity.RARE, mage.cards.r.Radstorm.class)); diff --git a/Mage/src/main/java/mage/abilities/common/OneOrMoreDiceRolledTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/OneOrMoreDiceRolledTriggeredAbility.java index 5c119a35695..f15d8210acc 100644 --- a/Mage/src/main/java/mage/abilities/common/OneOrMoreDiceRolledTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/OneOrMoreDiceRolledTriggeredAbility.java @@ -45,7 +45,7 @@ public class OneOrMoreDiceRolledTriggeredAbility extends TriggeredAbilityImpl { int maxRoll = ((DiceRolledEvent) event) .getResults() .stream() - .filter(Integer.class::isInstance) // only numerical die result can be masured + .filter(Integer.class::isInstance) // only numerical die result can be measured .map(Integer.class::cast) .mapToInt(Integer::intValue) .max() @@ -53,7 +53,7 @@ public class OneOrMoreDiceRolledTriggeredAbility extends TriggeredAbilityImpl { int totalRoll = ((DiceRolledEvent) event) .getResults() .stream() - .filter(Integer.class::isInstance) // only numerical die result can be masured + .filter(Integer.class::isInstance) // only numerical die result can be measured .map(Integer.class::cast) .mapToInt(Integer::intValue) .sum(); diff --git a/Mage/src/main/java/mage/game/permanent/token/RobotCantBlockToken.java b/Mage/src/main/java/mage/game/permanent/token/RobotCantBlockToken.java new file mode 100644 index 00000000000..383b50e7b4f --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/RobotCantBlockToken.java @@ -0,0 +1,35 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.combat.CantBlockSourceEffect; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public final class RobotCantBlockToken extends TokenImpl { + + public RobotCantBlockToken() { + super("Robot Token", "4/4 colorless Robot artifact creature token with \"This creature can't block.\""); + cardType.add(CardType.ARTIFACT); + cardType.add(CardType.CREATURE); + subtype.add(SubType.ROBOT); + power = new MageInt(4); + toughness = new MageInt(4); + this.addAbility(new SimpleStaticAbility( + new CantBlockSourceEffect(Duration.WhileOnBattlefield) + .setText("this creature can't block") + )); + } + + protected RobotCantBlockToken(final RobotCantBlockToken token) { + super(token); + } + + public RobotCantBlockToken copy() { + return new RobotCantBlockToken(this); + } +} diff --git a/Mage/src/main/java/mage/game/permanent/token/RobotToken.java b/Mage/src/main/java/mage/game/permanent/token/RobotToken.java index 0f9ea2161a7..56e531a6a95 100644 --- a/Mage/src/main/java/mage/game/permanent/token/RobotToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/RobotToken.java @@ -1,10 +1,7 @@ package mage.game.permanent.token; import mage.MageInt; -import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.common.combat.CantBlockSourceEffect; import mage.constants.CardType; -import mage.constants.Duration; import mage.constants.SubType; /** @@ -13,16 +10,12 @@ import mage.constants.SubType; public final class RobotToken extends TokenImpl { public RobotToken() { - super("Robot Token", "4/4 colorless Robot artifact creature token with \"This creature can't block.\""); + super("Robot Token", "3/3 colorless Robot artifact creature token"); cardType.add(CardType.ARTIFACT); cardType.add(CardType.CREATURE); subtype.add(SubType.ROBOT); - power = new MageInt(4); - toughness = new MageInt(4); - this.addAbility(new SimpleStaticAbility( - new CantBlockSourceEffect(Duration.WhileOnBattlefield) - .setText("this creature can't block") - )); + power = new MageInt(3); + toughness = new MageInt(3); } protected RobotToken(final RobotToken token) { diff --git a/Mage/src/main/resources/tokens-database.txt b/Mage/src/main/resources/tokens-database.txt index 0eb5c902dbd..41cddfc8ad9 100644 --- a/Mage/src/main/resources/tokens-database.txt +++ b/Mage/src/main/resources/tokens-database.txt @@ -1778,7 +1778,7 @@ |Generate|TOK:40K|Insect|||InsectColorlessArtifactToken| |Generate|TOK:40K|Necron Warrior|||NecronWarriorToken| |Generate|TOK:40K|Plaguebearer of Nurgle|||PlaguebearerOfNurgleToken| -|Generate|TOK:40K|Robot|||RobotToken| +|Generate|TOK:40K|Robot|||RobotCantBlockToken| |Generate|TOK:40K|Soldier|1||SoldierToken| |Generate|TOK:40K|Soldier|2||SoldierToken| |Generate|TOK:40K|Soldier|3||SoldierToken| @@ -2098,4 +2098,7 @@ |Generate|TOK:WOC|Saproling|||SaprolingToken| |Generate|TOK:WOC|Sorcerer|||SorcererRoleToken| |Generate|TOK:WOC|Spirit|||WhiteBlackSpiritToken| -|Generate|TOK:WOC|Virtuous|||VirtuousRoleToken| \ No newline at end of file +|Generate|TOK:WOC|Virtuous|||VirtuousRoleToken| + +# PIP +|Generate|TOK:PIP|Robot|||RobotToken| \ No newline at end of file