mirror of
https://github.com/correl/mage.git
synced 2024-12-27 03:00:13 +00:00
- Added Port Inspector and Robber Fly
This commit is contained in:
parent
5b84462eff
commit
2abeb43449
4 changed files with 174 additions and 2 deletions
77
Mage.Sets/src/mage/cards/p/PortInspector.java
Normal file
77
Mage.Sets/src/mage/cards/p/PortInspector.java
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
package mage.cards.p;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.BecomesBlockedSourceTriggeredAbility;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jeffwadsworth
|
||||||
|
*/
|
||||||
|
public final class PortInspector extends CardImpl {
|
||||||
|
|
||||||
|
public PortInspector(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.HUMAN);
|
||||||
|
this.power = new MageInt(1);
|
||||||
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
|
// Whenever Port Inspector becomes blocked, you may look at defending player's hand.
|
||||||
|
this.addAbility(new BecomesBlockedSourceTriggeredAbility(
|
||||||
|
Zone.BATTLEFIELD, new LookAtDefendingPlayersHandEffect(), true, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
private PortInspector(final PortInspector card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PortInspector copy() {
|
||||||
|
return new PortInspector(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LookAtDefendingPlayersHandEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
public LookAtDefendingPlayersHandEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
this.staticText = "look at defending player's hand";
|
||||||
|
}
|
||||||
|
|
||||||
|
public LookAtDefendingPlayersHandEffect(final LookAtDefendingPlayersHandEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LookAtDefendingPlayersHandEffect copy() {
|
||||||
|
return new LookAtDefendingPlayersHandEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
Player defendingPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
||||||
|
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||||
|
if (controller != null
|
||||||
|
&& defendingPlayer != null) {
|
||||||
|
controller.lookAtCards(sourceObject != null
|
||||||
|
? sourceObject.getIdName() : null,
|
||||||
|
defendingPlayer.getHand(), game);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
80
Mage.Sets/src/mage/cards/r/RobberFly.java
Normal file
80
Mage.Sets/src/mage/cards/r/RobberFly.java
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
package mage.cards.r;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.BecomesBlockedSourceTriggeredAbility;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author jeffwadsworth
|
||||||
|
*/
|
||||||
|
public final class RobberFly extends CardImpl {
|
||||||
|
|
||||||
|
public RobberFly(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.INSECT);
|
||||||
|
this.power = new MageInt(1);
|
||||||
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
|
// Flying
|
||||||
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
|
// Whenever Robber Fly becomes blocked, defending player discards all the cards in their hand, then draws that many cards.
|
||||||
|
this.addAbility(new BecomesBlockedSourceTriggeredAbility(
|
||||||
|
Zone.BATTLEFIELD, new DrawCardsDefendingPlayerEffect(), false, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
private RobberFly(final RobberFly card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RobberFly copy() {
|
||||||
|
return new RobberFly(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DrawCardsDefendingPlayerEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
public DrawCardsDefendingPlayerEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
this.staticText = "defending player discards all the cards in their hand, "
|
||||||
|
+ "then draws that many cards";
|
||||||
|
}
|
||||||
|
|
||||||
|
public DrawCardsDefendingPlayerEffect(final DrawCardsDefendingPlayerEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DrawCardsDefendingPlayerEffect copy() {
|
||||||
|
return new DrawCardsDefendingPlayerEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
Player defendingPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
||||||
|
if (controller != null
|
||||||
|
&& defendingPlayer != null) {
|
||||||
|
int numberOfCardsInHand = defendingPlayer.getHand().size();
|
||||||
|
defendingPlayer.discard(defendingPlayer.getHand(), source, game);
|
||||||
|
defendingPlayer.drawCards(numberOfCardsInHand, source.getSourceId(), game);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -236,6 +236,7 @@ public final class MercadianMasques extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Plains", 332, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Plains", 332, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
||||||
cards.add(new SetCardInfo("Plains", 333, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Plains", 333, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
||||||
cards.add(new SetCardInfo("Plains", 334, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Plains", 334, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
||||||
|
cards.add(new SetCardInfo("Port Inspector", 90, Rarity.COMMON, mage.cards.p.PortInspector.class));
|
||||||
cards.add(new SetCardInfo("Power Matrix", 309, Rarity.RARE, mage.cards.p.PowerMatrix.class));
|
cards.add(new SetCardInfo("Power Matrix", 309, Rarity.RARE, mage.cards.p.PowerMatrix.class));
|
||||||
cards.add(new SetCardInfo("Primeval Shambler", 152, Rarity.UNCOMMON, mage.cards.p.PrimevalShambler.class));
|
cards.add(new SetCardInfo("Primeval Shambler", 152, Rarity.UNCOMMON, mage.cards.p.PrimevalShambler.class));
|
||||||
cards.add(new SetCardInfo("Puffer Extract", 310, Rarity.UNCOMMON, mage.cards.p.PufferExtract.class));
|
cards.add(new SetCardInfo("Puffer Extract", 310, Rarity.UNCOMMON, mage.cards.p.PufferExtract.class));
|
||||||
|
@ -264,6 +265,7 @@ public final class MercadianMasques extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Rishadan Footpad", 94, Rarity.UNCOMMON, mage.cards.r.RishadanFootpad.class));
|
cards.add(new SetCardInfo("Rishadan Footpad", 94, Rarity.UNCOMMON, mage.cards.r.RishadanFootpad.class));
|
||||||
cards.add(new SetCardInfo("Rishadan Pawnshop", 311, Rarity.RARE, mage.cards.r.RishadanPawnshop.class));
|
cards.add(new SetCardInfo("Rishadan Pawnshop", 311, Rarity.RARE, mage.cards.r.RishadanPawnshop.class));
|
||||||
cards.add(new SetCardInfo("Rishadan Port", 324, Rarity.RARE, mage.cards.r.RishadanPort.class));
|
cards.add(new SetCardInfo("Rishadan Port", 324, Rarity.RARE, mage.cards.r.RishadanPort.class));
|
||||||
|
cards.add(new SetCardInfo("Robber Fly", 209, Rarity.UNCOMMON, mage.cards.r.RobberFly.class));
|
||||||
cards.add(new SetCardInfo("Rock Badger", 210, Rarity.UNCOMMON, mage.cards.r.RockBadger.class));
|
cards.add(new SetCardInfo("Rock Badger", 210, Rarity.UNCOMMON, mage.cards.r.RockBadger.class));
|
||||||
cards.add(new SetCardInfo("Rouse", 157, Rarity.COMMON, mage.cards.r.Rouse.class));
|
cards.add(new SetCardInfo("Rouse", 157, Rarity.COMMON, mage.cards.r.Rouse.class));
|
||||||
cards.add(new SetCardInfo("Rushwood Dryad", 263, Rarity.COMMON, mage.cards.r.RushwoodDryad.class));
|
cards.add(new SetCardInfo("Rushwood Dryad", 263, Rarity.COMMON, mage.cards.r.RushwoodDryad.class));
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.abilities.common;
|
package mage.abilities.common;
|
||||||
|
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
@ -6,6 +5,7 @@ import mage.abilities.effects.Effect;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -13,12 +13,20 @@ import mage.game.events.GameEvent;
|
||||||
*/
|
*/
|
||||||
public class BecomesBlockedSourceTriggeredAbility extends TriggeredAbilityImpl {
|
public class BecomesBlockedSourceTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
|
boolean setTargetPointer;
|
||||||
|
|
||||||
public BecomesBlockedSourceTriggeredAbility(Effect effect, boolean optional) {
|
public BecomesBlockedSourceTriggeredAbility(Effect effect, boolean optional) {
|
||||||
super(Zone.BATTLEFIELD, effect, optional);
|
this(Zone.BATTLEFIELD, effect, optional, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BecomesBlockedSourceTriggeredAbility(Zone zone, Effect effect, boolean optional, boolean setTargetPointer) {
|
||||||
|
super(zone, effect, optional);
|
||||||
|
this.setTargetPointer = setTargetPointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BecomesBlockedSourceTriggeredAbility(final BecomesBlockedSourceTriggeredAbility ability) {
|
public BecomesBlockedSourceTriggeredAbility(final BecomesBlockedSourceTriggeredAbility ability) {
|
||||||
super(ability);
|
super(ability);
|
||||||
|
this.setTargetPointer = ability.setTargetPointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,6 +36,11 @@ public class BecomesBlockedSourceTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
|
// set the defending player via targetPointer
|
||||||
|
if (setTargetPointer) {
|
||||||
|
this.getEffects().setTargetPointer(
|
||||||
|
new FixedTarget(game.getCombat().getDefendingPlayerId(getSourceId(), game)));
|
||||||
|
}
|
||||||
return event.getTargetId().equals(this.getSourceId());
|
return event.getTargetId().equals(this.getSourceId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue