mirror of
https://github.com/correl/mage.git
synced 2024-11-29 03:00:12 +00:00
[ONS] Implemented Thoughtbound Primoc
This commit is contained in:
parent
6d3968df17
commit
a66e455579
3 changed files with 159 additions and 50 deletions
|
@ -12,12 +12,7 @@ import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||||
import mage.abilities.keyword.BushidoAbility;
|
import mage.abilities.keyword.BushidoAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.*;
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.TargetController;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
@ -31,16 +26,16 @@ public final class SokenzanRenegade extends CardImpl {
|
||||||
|
|
||||||
public SokenzanRenegade(UUID ownerId, CardSetInfo setInfo) {
|
public SokenzanRenegade(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
|
||||||
this.subtype.add(SubType.OGRE);
|
this.subtype.add(SubType.OGRE, SubType.SAMURAI, SubType.MERCENARY);
|
||||||
this.subtype.add(SubType.SAMURAI);
|
|
||||||
this.subtype.add(SubType.MERCENARY);
|
|
||||||
|
|
||||||
this.power = new MageInt(3);
|
this.power = new MageInt(3);
|
||||||
this.toughness = new MageInt(3);
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
// Bushido 1
|
// Bushido 1
|
||||||
this.addAbility(new BushidoAbility(1));
|
this.addAbility(new BushidoAbility(1));
|
||||||
// At the beginning of your upkeep, if a player has more cards in hand than each other player, the player who has the most cards in hand gains control of Sokenzan Renegade.
|
|
||||||
|
// At the beginning of your upkeep, if a player has more cards in hand than each other player,
|
||||||
|
// the player who has the most cards in hand gains control of Sokenzan Renegade.
|
||||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||||
new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new SokenzanRenegadeEffect(), TargetController.YOU, false),
|
new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new SokenzanRenegadeEffect(), TargetController.YOU, false),
|
||||||
OnePlayerHasTheMostCards.instance,
|
OnePlayerHasTheMostCards.instance,
|
||||||
|
@ -77,32 +72,20 @@ class SokenzanRenegadeEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
|
||||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
if (sourcePermanent == null) {
|
||||||
if (controller != null
|
return false;
|
||||||
&& sourcePermanent != null) {
|
}
|
||||||
int max = Integer.MIN_VALUE;
|
Player newController = OnePlayerHasTheMostCards.getPlayerWithMostCards(game, source);
|
||||||
Player newController = null;
|
if (newController != null) {
|
||||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame, newController.getId());
|
||||||
Player player = game.getPlayer(playerId);
|
effect.setTargetPointer(new FixedTarget(sourcePermanent, game));
|
||||||
if (player != null) {
|
game.addEffect(effect, source);
|
||||||
if (player.getHand().size() > max) {
|
if (!source.isControlledBy(newController.getId())) {
|
||||||
max = player.getHand().size();
|
game.informPlayers(newController.getLogName() + " got control of " + sourcePermanent.getLogName());
|
||||||
newController = player;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (newController != null) {
|
|
||||||
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame, newController.getId());
|
|
||||||
effect.setTargetPointer(new FixedTarget(sourcePermanent.getId(), game));
|
|
||||||
game.addEffect(effect, source);
|
|
||||||
if (!source.isControlledBy(newController.getId())) {
|
|
||||||
game.informPlayers(newController.getLogName() + " got control of " + sourcePermanent.getLogName());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,29 +95,29 @@ enum OnePlayerHasTheMostCards implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
return getPlayerWithMostCards(game, source) != null;
|
||||||
if (controller != null) {
|
}
|
||||||
int max = Integer.MIN_VALUE;
|
|
||||||
boolean onlyOnePlayer = false;
|
public static Player getPlayerWithMostCards(Game game, Ability source) {
|
||||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
int max = Integer.MIN_VALUE;
|
||||||
Player player = game.getPlayer(playerId);
|
Player playerWithMost = null;
|
||||||
if (player != null) {
|
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||||
if (player.getHand().size() > max) {
|
Player player = game.getPlayer(playerId);
|
||||||
max = player.getHand().size();
|
if (player != null) {
|
||||||
onlyOnePlayer = true;
|
int cards = player.getHand().size();
|
||||||
} else if (player.getHand().size() == max) {
|
if (cards > max) {
|
||||||
onlyOnePlayer = false;
|
max = cards;
|
||||||
}
|
playerWithMost = player;
|
||||||
|
} else if (cards == max) {
|
||||||
|
playerWithMost = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return onlyOnePlayer;
|
|
||||||
}
|
}
|
||||||
return false;
|
return playerWithMost;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "a player has more cards in hand than each other player";
|
return "a player has more cards in hand than each other player";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
125
Mage.Sets/src/mage/cards/t/ThoughtboundPrimoc.java
Normal file
125
Mage.Sets/src/mage/cards/t/ThoughtboundPrimoc.java
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
package mage.cards.t;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||||
|
import mage.abilities.condition.Condition;
|
||||||
|
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||||
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
|
||||||
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.*;
|
||||||
|
import mage.filter.FilterPermanent;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author awjackson
|
||||||
|
*/
|
||||||
|
public final class ThoughtboundPrimoc extends CardImpl {
|
||||||
|
|
||||||
|
public ThoughtboundPrimoc(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
|
||||||
|
this.subtype.add(SubType.BIRD, SubType.BEAST);
|
||||||
|
|
||||||
|
this.power = new MageInt(2);
|
||||||
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
|
// Flying
|
||||||
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
|
// At the beginning of your upkeep, if a player controls more Wizards than each other player,
|
||||||
|
// the player who controls the most Wizards gains control of Thoughtbound Primoc.
|
||||||
|
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||||
|
new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new ThoughtboundPrimocEffect(), TargetController.YOU, false),
|
||||||
|
OnePlayerHasTheMostWizards.instance,
|
||||||
|
"At the beginning of your upkeep, if a player controls more Wizards than each other player, the player who controls the most Wizards gains control of {this}"
|
||||||
|
));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private ThoughtboundPrimoc(final ThoughtboundPrimoc card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThoughtboundPrimoc copy() {
|
||||||
|
return new ThoughtboundPrimoc(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ThoughtboundPrimocEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
public ThoughtboundPrimocEffect() {
|
||||||
|
super(Outcome.GainControl);
|
||||||
|
this.staticText = "the player who controls the most Wizards gains control of {this}";
|
||||||
|
}
|
||||||
|
|
||||||
|
public ThoughtboundPrimocEffect(final ThoughtboundPrimocEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ThoughtboundPrimocEffect copy() {
|
||||||
|
return new ThoughtboundPrimocEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
|
||||||
|
if (sourcePermanent == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Player newController = OnePlayerHasTheMostWizards.getPlayerWithMostWizards(game, source);
|
||||||
|
if (newController != null) {
|
||||||
|
ContinuousEffect effect = new GainControlTargetEffect(Duration.EndOfGame, newController.getId());
|
||||||
|
effect.setTargetPointer(new FixedTarget(sourcePermanent, game));
|
||||||
|
game.addEffect(effect, source);
|
||||||
|
if (!source.isControlledBy(newController.getId())) {
|
||||||
|
game.informPlayers(newController.getLogName() + " got control of " + sourcePermanent.getLogName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum OnePlayerHasTheMostWizards implements Condition {
|
||||||
|
instance;
|
||||||
|
|
||||||
|
private static final FilterPermanent filter = new FilterPermanent(SubType.WIZARD, "Wizards");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
return getPlayerWithMostWizards(game, source) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Player getPlayerWithMostWizards(Game game, Ability source) {
|
||||||
|
int max = Integer.MIN_VALUE;
|
||||||
|
Player playerWithMost = null;
|
||||||
|
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||||
|
Player player = game.getPlayer(playerId);
|
||||||
|
if (player != null) {
|
||||||
|
int wizards = game.getBattlefield().countAll(filter, playerId, game);
|
||||||
|
if (wizards > max) {
|
||||||
|
max = wizards;
|
||||||
|
playerWithMost = player;
|
||||||
|
} else if (wizards == max) {
|
||||||
|
playerWithMost = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return playerWithMost;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "a player controls more Wizards than each other player";
|
||||||
|
}
|
||||||
|
}
|
|
@ -328,6 +328,7 @@ public final class Onslaught extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Taunting Elf", 290, Rarity.COMMON, mage.cards.t.TauntingElf.class));
|
cards.add(new SetCardInfo("Taunting Elf", 290, Rarity.COMMON, mage.cards.t.TauntingElf.class));
|
||||||
cards.add(new SetCardInfo("Tempting Wurm", 291, Rarity.RARE, mage.cards.t.TemptingWurm.class));
|
cards.add(new SetCardInfo("Tempting Wurm", 291, Rarity.RARE, mage.cards.t.TemptingWurm.class));
|
||||||
cards.add(new SetCardInfo("Tephraderm", 239, Rarity.RARE, mage.cards.t.Tephraderm.class));
|
cards.add(new SetCardInfo("Tephraderm", 239, Rarity.RARE, mage.cards.t.Tephraderm.class));
|
||||||
|
cards.add(new SetCardInfo("Thoughtbound Primoc", 240, Rarity.UNCOMMON, mage.cards.t.ThoughtboundPrimoc.class));
|
||||||
cards.add(new SetCardInfo("Thrashing Mudspawn", 177, Rarity.UNCOMMON, mage.cards.t.ThrashingMudspawn.class));
|
cards.add(new SetCardInfo("Thrashing Mudspawn", 177, Rarity.UNCOMMON, mage.cards.t.ThrashingMudspawn.class));
|
||||||
cards.add(new SetCardInfo("Threaten", 241, Rarity.UNCOMMON, mage.cards.t.Threaten.class));
|
cards.add(new SetCardInfo("Threaten", 241, Rarity.UNCOMMON, mage.cards.t.Threaten.class));
|
||||||
cards.add(new SetCardInfo("Thunder of Hooves", 242, Rarity.UNCOMMON, mage.cards.t.ThunderOfHooves.class));
|
cards.add(new SetCardInfo("Thunder of Hooves", 242, Rarity.UNCOMMON, mage.cards.t.ThunderOfHooves.class));
|
||||||
|
|
Loading…
Reference in a new issue