mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Fixed bug of Armored Transport, Simic Charm, Changed wrong exileId handling of Bane Alley Broker and Nightveil Specter.
This commit is contained in:
parent
8af2628094
commit
a0d0fc8b7e
5 changed files with 38 additions and 28 deletions
|
@ -59,4 +59,3 @@ public class AEtherize extends CardImpl<AEtherize> {
|
|||
return new AEtherize(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ import mage.cards.CardImpl;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -73,46 +74,47 @@ public class ArmoredTransport extends CardImpl<ArmoredTransport> {
|
|||
class ArmoredTransportPreventCombatDamageSourceEffect extends PreventionEffectImpl<ArmoredTransportPreventCombatDamageSourceEffect> {
|
||||
|
||||
public ArmoredTransportPreventCombatDamageSourceEffect(Duration duration) {
|
||||
super(duration);
|
||||
staticText = "Prevent all combat damage that would be dealt to {this} by creatures blocking it" + duration.toString();
|
||||
super(duration);
|
||||
staticText = "Prevent all combat damage that would be dealt to {this} by creatures blocking it" + duration.toString();
|
||||
}
|
||||
|
||||
public ArmoredTransportPreventCombatDamageSourceEffect(final ArmoredTransportPreventCombatDamageSourceEffect effect) {
|
||||
super(effect);
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArmoredTransportPreventCombatDamageSourceEffect copy() {
|
||||
return new ArmoredTransportPreventCombatDamageSourceEffect(this);
|
||||
return new ArmoredTransportPreventCombatDamageSourceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), event.getAmount(), false);
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
int damage = event.getAmount();
|
||||
event.setAmount(0);
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), damage));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), event.getAmount(), false);
|
||||
if (!game.replaceEvent(preventEvent)) {
|
||||
int damage = event.getAmount();
|
||||
event.setAmount(0);
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), damage));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (super.applies(event, source, game)) {
|
||||
DamageEvent damageEvent = (DamageEvent) event;
|
||||
if (event.getTargetId().equals(source.getSourceId()) && damageEvent.isCombatDamage()) {
|
||||
if (game.getState().getCombat().getAttackers().contains(source.getSourceId())) {
|
||||
return true;
|
||||
}
|
||||
if (super.applies(event, source, game)) {
|
||||
DamageEvent damageEvent = (DamageEvent) event;
|
||||
if (event.getTargetId().equals(source.getSourceId()) && damageEvent.isCombatDamage()) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (sourcePermanent != null && sourcePermanent.isAttacking()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,7 +140,11 @@ class BaneAlleyBrokerDrawExileEffect extends OneShotEffect<BaneAlleyBrokerDrawEx
|
|||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
if (card != null && sourceCard != null) {
|
||||
card.setFaceDown(true);
|
||||
UUID exileId = UUID.fromString(new StringBuilder(sourceCard.getId().toString()).append(sourceCard.getZoneChangeCounter()).toString());
|
||||
UUID exileId = (UUID) game.getState().getValue(new StringBuilder("exileZone").append(source.getSourceId()).append(sourceCard.getZoneChangeCounter()).toString());
|
||||
if (exileId == null) {
|
||||
exileId = UUID.randomUUID();
|
||||
game.getState().setValue(new StringBuilder("exileZone").append(source.getSourceId()).append(sourceCard.getZoneChangeCounter()).toString(), exileId);
|
||||
}
|
||||
return card.moveToExile(exileId, new StringBuilder(sourceCard.getName()).append("(").append(sourceCard.getZoneChangeCounter()).append(")").toString(), source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +173,7 @@ class TargetCardInBaneAlleyBrokerExile extends TargetCard<TargetCardInBaneAlleyB
|
|||
Set<UUID> possibleTargets = new HashSet<UUID>();
|
||||
Card sourceCard = game.getCard(sourceId);
|
||||
if (sourceCard != null) {
|
||||
UUID exileId = UUID.fromString(new StringBuilder(sourceCard.getId().toString()).append(sourceCard.getZoneChangeCounter()).toString());
|
||||
UUID exileId = (UUID) game.getState().getValue(new StringBuilder("exileZone").append(sourceId).append(sourceCard.getZoneChangeCounter()).toString());
|
||||
ExileZone exile = game.getExile().getExileZone(exileId);
|
||||
if (exile != null && exile.size() > 0) {
|
||||
possibleTargets.addAll(exile);
|
||||
|
@ -182,7 +186,7 @@ class TargetCardInBaneAlleyBrokerExile extends TargetCard<TargetCardInBaneAlleyB
|
|||
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
Card sourceCard = game.getCard(sourceId);
|
||||
if (sourceCard != null) {
|
||||
UUID exileId = UUID.fromString(new StringBuilder(sourceCard.getId().toString()).append(sourceCard.getZoneChangeCounter()).toString());
|
||||
UUID exileId = (UUID) game.getState().getValue(new StringBuilder("exileZone").append(sourceId).append(sourceCard.getZoneChangeCounter()).toString());
|
||||
ExileZone exile = game.getExile().getExileZone(exileId);
|
||||
if (exile != null && exile.size() > 0) {
|
||||
return true;
|
||||
|
@ -198,7 +202,7 @@ class TargetCardInBaneAlleyBrokerExile extends TargetCard<TargetCardInBaneAlleyB
|
|||
ExileZone exile = null;
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
if (sourceCard != null) {
|
||||
UUID exileId = UUID.fromString(new StringBuilder(sourceCard.getId().toString()).append(sourceCard.getZoneChangeCounter()).toString());
|
||||
UUID exileId = (UUID) game.getState().getValue(new StringBuilder("exileZone").append(source.getSourceId()).append(sourceCard.getZoneChangeCounter()).toString());
|
||||
exile = game.getExile().getExileZone(exileId);
|
||||
}
|
||||
if (exile != null && exile.contains(id)) {
|
||||
|
|
|
@ -45,6 +45,7 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
|
@ -111,7 +112,11 @@ class NightveilSpecterExileEffect extends OneShotEffect<NightveilSpecterExileEff
|
|||
Card card = player.getLibrary().removeFromTop(game);
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
if (card != null && sourceCard != null) {
|
||||
UUID exileId = UUID.fromString(new StringBuilder(sourceCard.getId().toString()).append(sourceCard.getZoneChangeCounter()).toString());
|
||||
UUID exileId = (UUID) game.getState().getValue(new StringBuilder("exileZone").append(source.getSourceId()).append(sourceCard.getZoneChangeCounter()).toString());
|
||||
if (exileId == null) {
|
||||
exileId = UUID.randomUUID();
|
||||
game.getState().setValue(new StringBuilder("exileZone").append(source.getSourceId()).append(sourceCard.getZoneChangeCounter()).toString(), exileId);
|
||||
}
|
||||
return card.moveToExile(exileId, "Nightveil Specter", source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +156,7 @@ class NightveilSpecterEffect extends AsThoughEffectImpl<NightveilSpecterEffect>
|
|||
Card card = game.getCard(sourceId);
|
||||
if (card != null && game.getState().getZone(card.getId()) == Zone.EXILED) {
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
UUID exileId = UUID.fromString(new StringBuilder(sourceCard.getId().toString()).append(sourceCard.getZoneChangeCounter()).toString());
|
||||
UUID exileId = (UUID) game.getState().getValue(new StringBuilder("exileZone").append(source.getSourceId()).append(sourceCard.getZoneChangeCounter()).toString());
|
||||
ExileZone zone = game.getExile().getExileZone(exileId);
|
||||
if (zone != null && zone.contains(card.getId())) {
|
||||
if (card.getCardType().contains(CardType.INSTANT) || game.canPlaySorcery(source.getControllerId())) {
|
||||
|
|
|
@ -47,7 +47,7 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
public class SimicCharm extends CardImpl<SimicCharm> {
|
||||
|
||||
public SimicCharm (UUID ownerId) {
|
||||
super(ownerId, 195, "Simic Charm", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{B}{U}");
|
||||
super(ownerId, 195, "Simic Charm", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{G}{U}");
|
||||
this.expansionSetCode = "GTC";
|
||||
|
||||
this.color.setBlack(true);
|
||||
|
|
Loading…
Reference in a new issue