mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 04:42:07 -08:00
[LTC] Implement Erestor of the Council
This commit is contained in:
parent
456021df94
commit
87fc0ec9e9
4 changed files with 136 additions and 49 deletions
84
Mage.Sets/src/mage/cards/e/ErestorOfTheCouncil.java
Normal file
84
Mage.Sets/src/mage/cards/e/ErestorOfTheCouncil.java
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
package mage.cards.e;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.FinishVotingTriggeredAbility;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.constants.SuperType;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.token.TreasureToken;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class ErestorOfTheCouncil extends CardImpl {
|
||||||
|
|
||||||
|
public ErestorOfTheCouncil(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{U}");
|
||||||
|
|
||||||
|
this.supertype.add(SuperType.LEGENDARY);
|
||||||
|
this.subtype.add(SubType.ELF);
|
||||||
|
this.subtype.add(SubType.NOBLE);
|
||||||
|
this.power = new MageInt(2);
|
||||||
|
this.toughness = new MageInt(4);
|
||||||
|
|
||||||
|
// Whenever players finish voting, each opponent who voted for a choice you voted for creates a Treasure token. You scry X, where X is the number of opponents who voted for a choice you didn't vote for. Draw a card.
|
||||||
|
this.addAbility(new FinishVotingTriggeredAbility(new ErestorOfTheCouncilEffect()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private ErestorOfTheCouncil(final ErestorOfTheCouncil card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ErestorOfTheCouncil copy() {
|
||||||
|
return new ErestorOfTheCouncil(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ErestorOfTheCouncilEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
ErestorOfTheCouncilEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "each opponent who voted for a choice you voted for creates a Treasure token. You scry X, " +
|
||||||
|
"where X is the number of opponents who voted for a choice you didn't vote for. Draw a card";
|
||||||
|
}
|
||||||
|
|
||||||
|
private ErestorOfTheCouncilEffect(final ErestorOfTheCouncilEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ErestorOfTheCouncilEffect copy() {
|
||||||
|
return new ErestorOfTheCouncilEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Set<UUID> playerIds = (Set<UUID>) getValue("votedAgainst");
|
||||||
|
int count = 0;
|
||||||
|
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||||
|
if (playerIds.contains(opponentId)) {
|
||||||
|
count++;
|
||||||
|
} else {
|
||||||
|
new TreasureToken().putOntoBattlefield(1, game, source, opponentId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count > 0) {
|
||||||
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
if (player != null) {
|
||||||
|
player.scry(count, source, game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,20 +2,16 @@ package mage.cards.g;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.common.FinishVotingTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.SubType;
|
import mage.constants.SubType;
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
|
||||||
import mage.game.events.VotedEvent;
|
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
@ -33,7 +29,7 @@ public final class GrudgeKeeper extends CardImpl {
|
||||||
this.toughness = new MageInt(1);
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
// Whenever players finish voting, each opponent who voted for a choice you didn't vote for loses 2 life.
|
// Whenever players finish voting, each opponent who voted for a choice you didn't vote for loses 2 life.
|
||||||
this.addAbility(new GrudgeKeeperTriggeredAbility());
|
this.addAbility(new FinishVotingTriggeredAbility(new GrudgeKeeperEffect()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private GrudgeKeeper(final GrudgeKeeper card) {
|
private GrudgeKeeper(final GrudgeKeeper card) {
|
||||||
|
|
@ -46,52 +42,14 @@ public final class GrudgeKeeper extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GrudgeKeeperTriggeredAbility extends TriggeredAbilityImpl {
|
|
||||||
|
|
||||||
GrudgeKeeperTriggeredAbility() {
|
|
||||||
super(Zone.BATTLEFIELD, null, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private GrudgeKeeperTriggeredAbility(final GrudgeKeeperTriggeredAbility ability) {
|
|
||||||
super(ability);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkEventType(GameEvent event, Game game) {
|
|
||||||
return event.getType() == GameEvent.EventType.VOTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
|
||||||
VotedEvent votedEvent = (VotedEvent) event;
|
|
||||||
this.getEffects().clear();
|
|
||||||
this.addEffect(new GrudgeKeeperEffect(votedEvent.getDidntVote(getControllerId())));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public GrudgeKeeperTriggeredAbility copy() {
|
|
||||||
return new GrudgeKeeperTriggeredAbility(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRule() {
|
|
||||||
return "Whenever players finish voting, each opponent who voted for a choice you didn't vote for loses 2 life.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class GrudgeKeeperEffect extends OneShotEffect {
|
class GrudgeKeeperEffect extends OneShotEffect {
|
||||||
|
|
||||||
private final Set<UUID> playerIds = new HashSet<>();
|
GrudgeKeeperEffect() {
|
||||||
|
|
||||||
GrudgeKeeperEffect(Set<UUID> playerIds) {
|
|
||||||
super(Outcome.Benefit);
|
super(Outcome.Benefit);
|
||||||
this.playerIds.addAll(playerIds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private GrudgeKeeperEffect(final GrudgeKeeperEffect effect) {
|
private GrudgeKeeperEffect(final GrudgeKeeperEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.playerIds.addAll(effect.playerIds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -101,11 +59,16 @@ class GrudgeKeeperEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (UUID playerId : playerIds) {
|
Set<UUID> playerIds = (Set<UUID>) getValue("votedAgainst");
|
||||||
Player player = game.getPlayer(playerId);
|
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
|
||||||
if (player != null && player.hasOpponent(source.getControllerId(), game)) {
|
if (!playerIds.contains(opponentId)) {
|
||||||
player.loseLife(2, game, source, false);
|
continue;
|
||||||
}
|
}
|
||||||
|
Player player = game.getPlayer(opponentId);
|
||||||
|
if (player == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
player.loseLife(2, game, source, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ public final class TalesOfMiddleEarthCommander extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Elvish Visionary", 240, Rarity.COMMON, mage.cards.e.ElvishVisionary.class));
|
cards.add(new SetCardInfo("Elvish Visionary", 240, Rarity.COMMON, mage.cards.e.ElvishVisionary.class));
|
||||||
cards.add(new SetCardInfo("Elvish Warmaster", 241, Rarity.RARE, mage.cards.e.ElvishWarmaster.class));
|
cards.add(new SetCardInfo("Elvish Warmaster", 241, Rarity.RARE, mage.cards.e.ElvishWarmaster.class));
|
||||||
cards.add(new SetCardInfo("Ensnaring Bridge", 350, Rarity.MYTHIC, mage.cards.e.EnsnaringBridge.class));
|
cards.add(new SetCardInfo("Ensnaring Bridge", 350, Rarity.MYTHIC, mage.cards.e.EnsnaringBridge.class));
|
||||||
|
cards.add(new SetCardInfo("Erestor of the Council", 53, Rarity.RARE, mage.cards.e.ErestorOfTheCouncil.class));
|
||||||
cards.add(new SetCardInfo("Essence Warden", 242, Rarity.COMMON, mage.cards.e.EssenceWarden.class));
|
cards.add(new SetCardInfo("Essence Warden", 242, Rarity.COMMON, mage.cards.e.EssenceWarden.class));
|
||||||
cards.add(new SetCardInfo("Everflowing Chalice", 278, Rarity.UNCOMMON, mage.cards.e.EverflowingChalice.class));
|
cards.add(new SetCardInfo("Everflowing Chalice", 278, Rarity.UNCOMMON, mage.cards.e.EverflowingChalice.class));
|
||||||
cards.add(new SetCardInfo("Evolving Wilds", 306, Rarity.COMMON, mage.cards.e.EvolvingWilds.class));
|
cards.add(new SetCardInfo("Evolving Wilds", 306, Rarity.COMMON, mage.cards.e.EvolvingWilds.class));
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
package mage.abilities.common;
|
||||||
|
|
||||||
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.VotedEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public class FinishVotingTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
|
public FinishVotingTriggeredAbility(Effect effect) {
|
||||||
|
super(Zone.BATTLEFIELD, effect);
|
||||||
|
this.setTriggerPhrase("Whenever players finish voting, ");
|
||||||
|
}
|
||||||
|
|
||||||
|
private FinishVotingTriggeredAbility(final FinishVotingTriggeredAbility ability) {
|
||||||
|
super(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FinishVotingTriggeredAbility copy() {
|
||||||
|
return new FinishVotingTriggeredAbility(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.VOTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
|
this.getEffects().setValue("votedAgainst", ((VotedEvent) event).getDidntVote(getControllerId()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue