1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-04 09:16:04 -09:00
This commit is contained in:
BetaSteward 2010-11-16 04:20:51 +00:00
parent 7a54ef231e
commit c6ff81e619
13 changed files with 46 additions and 28 deletions

View file

@ -112,10 +112,10 @@ class IceCageEffect extends ReplacementEffectImpl<IceCageEffect> {
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null && enchantment.getAttachedTo() != null) {
if (source.getSourceId().equals(enchantment.getAttachedTo())) {
if (event.getType() == EventType.DECLARE_ATTACKER || event.getType() == EventType.DECLARE_BLOCKER || event.getType() == EventType.ACTIVATE_ABILITY) {
if (event.getType() == EventType.DECLARE_ATTACKER || event.getType() == EventType.DECLARE_BLOCKER || event.getType() == EventType.ACTIVATE_ABILITY) {
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment != null && enchantment.getAttachedTo() != null) {
if (event.getSourceId().equals(enchantment.getAttachedTo())) {
return true;
}
}
@ -147,11 +147,13 @@ class IceCageAbility extends TriggeredAbilityImpl<IceCageAbility> {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent enchantment = game.getPermanent(sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null) {
if (event.getTargetId().equals(enchantment.getAttachedTo()) && event.getType() == EventType.TARGETED) {
trigger(game, event.getPlayerId());
return true;
if (event.getType() == EventType.TARGETED) {
Permanent enchantment = game.getPermanent(sourceId);
if (enchantment != null && enchantment.getAttachedTo() != null) {
if (event.getTargetId().equals(enchantment.getAttachedTo())) {
trigger(game, event.getPlayerId());
return true;
}
}
}
return false;

View file

@ -49,7 +49,7 @@ import mage.game.permanent.Permanent;
public class GarruksPackleader extends CardImpl<GarruksPackleader> {
public GarruksPackleader(UUID ownerId) {
super(ownerId, 177, "Garruks Packleader", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{4}{G}");
super(ownerId, 177, "Garruk's Packleader", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{4}{G}");
this.expansionSetCode = "M11";
this.subtype.add("Beast");
this.color.setGreen(true);

View file

@ -33,8 +33,10 @@ import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.IslandwalkAbility;
import mage.cards.CardImpl;
@ -59,6 +61,7 @@ public class HarborSerpent extends CardImpl<HarborSerpent> {
this.toughness = new MageInt(5);
this.addAbility(IslandwalkAbility.getInstance());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new HarborSerpentEffect()));
}
public HarborSerpent(final HarborSerpent card) {

View file

@ -69,7 +69,7 @@ public class HoardingDragon extends CardImpl<HoardingDragon> {
this.addAbility(FlyingAbility.getInstance());
this.addAbility(new EntersBattlefieldTriggeredAbility(new HoardingDragonEffect(this.getId()), true));
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnFromExileEffect(this.getId(), Zone.BATTLEFIELD), true));
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnFromExileEffect(this.getId(), Zone.BATTLEFIELD), false));
}
public HoardingDragon(final HoardingDragon card) {

View file

@ -41,7 +41,7 @@ import mage.cards.CardImpl;
public class GoblinPiker extends CardImpl<GoblinPiker> {
public GoblinPiker(UUID ownerId) {
super(ownerId, 209, "GoblinPiker", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{R}");
super(ownerId, 209, "Goblin Piker", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.expansionSetCode = "10E";
this.subtype.add("Goblin");
this.subtype.add("Warrier");

View file

@ -31,6 +31,7 @@ package mage.abilities;
import java.util.UUID;
import mage.Constants.AbilityType;
import mage.Constants.Zone;
import mage.MageObject;
import mage.abilities.effects.Effect;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -78,8 +79,14 @@ public abstract class TriggeredAbilityImpl<T extends TriggeredAbilityImpl<T>> ex
public boolean resolve(Game game) {
if (optional) {
Player player = game.getPlayer(this.getControllerId());
Permanent permanent = game.getPermanent(sourceId);
if (!player.chooseUse(this.effects.get(0).getOutcome(), "Use " + this.getRule() + " ability from " + permanent.getName() + "?", game)) {
MageObject object = game.getObject(sourceId);
StringBuilder sb = new StringBuilder();
sb.append("Use ").append(this.getRule()).append("ability");
if (object != null) {
sb.append(" from ").append(object.getName());
}
sb.append("?");
if (!player.chooseUse(this.effects.get(0).getOutcome(), sb.toString(), game)) {
return false;
}
}

View file

@ -34,6 +34,7 @@ import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.game.ExileZone;
import mage.game.Game;
import mage.players.Player;
@ -65,13 +66,16 @@ public class ReturnFromExileEffect extends OneShotEffect<ReturnFromExileEffect>
@Override
public boolean apply(Game game, Ability source) {
Player player;
for (UUID cardId: game.getExile().getExileZone(exileId)) {
Card card = game.getCard(cardId);
card.moveToZone(zone, game, false);
ExileZone exile = game.getExile().getExileZone(exileId);
if (exile != null) {
for (UUID cardId: exile) {
Card card = game.getCard(cardId);
card.moveToZone(zone, game, false);
}
exile.clear();
return true;
}
game.getExile().getExileZone(exileId).clear();
return true;
return false;
}
@Override

View file

@ -228,6 +228,7 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
else {
game.getExile().createZone(exileId, name).add(this);
}
zone = event.getToZone();
game.fireEvent(new ZoneChangeEvent(this.getId(), ownerId, fromZone, Zone.EXILED));
return true;
}
@ -238,6 +239,7 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
public boolean putOntoBattlefield(Game game, Zone fromZone, UUID controllerId) {
PermanentCard permanent = new PermanentCard(this, controllerId);
game.getBattlefield().addPermanent(permanent);
zone = Zone.BATTLEFIELD;
permanent.entersBattlefield(game);
game.applyEffects();
game.fireEvent(new ZoneChangeEvent(permanent.getId(), controllerId, fromZone, Zone.BATTLEFIELD));

View file

@ -409,12 +409,12 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
protected boolean playAbility(ActivatedAbility ability, Game game) {
//20091005 - 602.2a
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATE_ABILITY, ability.getId(), playerId))) {
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATE_ABILITY, ability.getSourceId(), ability.getId(), playerId))) {
game.bookmarkState();
game.getStack().push(new StackAbility(ability, playerId));
String message = ability.getActivatedMessage(game);
if (ability.activate(game, false)) {
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATED_ABILITY, ability.getId(), playerId));
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATED_ABILITY, ability.getSourceId(), ability.getId(), playerId));
game.fireInformEvent(name + message);
game.removeLastBookmark();
return true;
@ -426,10 +426,10 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
protected boolean specialAction(SpecialAction action, Game game) {
//20091005 - 114
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATE_ABILITY, action.getId(), playerId))) {
if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATE_ABILITY, action.getSourceId(), action.getId(), playerId))) {
game.bookmarkState();
if (action.activate(game, false)) {
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATED_ABILITY, action.getId(), playerId));
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ACTIVATED_ABILITY, action.getSourceId(), action.getId(), playerId));
game.fireInformEvent(name + action.getActivatedMessage(game));
if (action.resolve(game)) {
game.removeLastBookmark();

View file

@ -46,7 +46,7 @@ public class TargetAttackingCreature extends TargetCreaturePermanent<TargetAttac
}
public TargetAttackingCreature(int minNumTargets, int maxNumTargets, FilterAttackingCreature filter, boolean notTarget) {
super(1, 1, filter, notTarget);
super(minNumTargets, maxNumTargets, filter, notTarget);
this.targetName = filter.getMessage();
}

View file

@ -50,7 +50,7 @@ public class TargetCreaturePermanent<T extends TargetCreaturePermanent<T>> exten
}
public TargetCreaturePermanent(int minNumTargets, int maxNumTargets, FilterCreaturePermanent filter, boolean notTarget) {
super(1, 1, filter, notTarget);
super(minNumTargets, maxNumTargets, filter, notTarget);
this.targetName = filter.getMessage();
}

View file

@ -51,7 +51,7 @@ public class TargetLandPermanent<T extends TargetLandPermanent<T>> extends Targe
}
public TargetLandPermanent(int minNumTargets, int maxNumTargets, FilterLandPermanent filter, boolean notTarget) {
super(1, 1, filter, notTarget);
super(minNumTargets, maxNumTargets, filter, notTarget);
this.targetName = filter.getMessage();
}

View file

@ -46,7 +46,7 @@ public class TargetNonlandPermanent extends TargetPermanent<TargetNonlandPermane
}
public TargetNonlandPermanent(int minNumTargets, int maxNumTargets, boolean notTarget) {
super(1, 1, new FilterNonlandPermanent(), notTarget);
super(minNumTargets, maxNumTargets, new FilterNonlandPermanent(), notTarget);
this.targetName = filter.getMessage();
}