mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 12:31:59 -08:00
Merge origin/master
This commit is contained in:
commit
7ef0a5f654
31 changed files with 136 additions and 238 deletions
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.abilities.effects;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
|
|
@ -19,6 +17,8 @@ import mage.players.Player;
|
|||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Cards with the Aura subtype don't change the zone they are in, if there is no
|
||||
* valid target on the battlefield. Also, when entering the battlefield and it
|
||||
|
|
@ -60,6 +60,9 @@ public class AuraReplacementEffect extends ReplacementEffectImpl {
|
|||
Card card = game.getCard(event.getTargetId());
|
||||
UUID sourceId = event.getSourceId();
|
||||
UUID controllerId = event.getPlayerId();
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null) {
|
||||
card = card.getSecondCardFace();
|
||||
|
|
@ -149,7 +152,6 @@ public class AuraReplacementEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
Player targetPlayer = game.getPlayer(targetId);
|
||||
if (targetCard != null || targetPermanent != null || targetPlayer != null) {
|
||||
card = game.getCard(event.getTargetId());
|
||||
card.removeFromZone(game, fromZone, sourceId);
|
||||
PermanentCard permanent = new PermanentCard(card, (controllingPlayer == null ? card.getOwnerId() : controllingPlayer.getId()), game);
|
||||
ZoneChangeEvent zoneChangeEvent = new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD);
|
||||
|
|
@ -184,14 +186,12 @@ public class AuraReplacementEffect extends ReplacementEffectImpl {
|
|||
if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD
|
||||
&& (((ZoneChangeEvent) event).getFromZone() != Zone.STACK)) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null && (card.isEnchantment() && card.hasSubtype(SubType.AURA, game)
|
||||
return card != null && (card.isEnchantment() && card.hasSubtype(SubType.AURA, game)
|
||||
|| // in case of transformable enchantments
|
||||
(game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null
|
||||
&& card.getSecondCardFace() != null
|
||||
&& card.getSecondCardFace().isEnchantment()
|
||||
&& card.getSecondCardFace().hasSubtype(SubType.AURA, game)))) {
|
||||
return true;
|
||||
}
|
||||
&& card.getSecondCardFace() != null
|
||||
&& card.getSecondCardFace().isEnchantment()
|
||||
&& card.getSecondCardFace().hasSubtype(SubType.AURA, game)));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -14,11 +11,7 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.EmptyToken;
|
||||
|
|
@ -27,8 +20,11 @@ import mage.util.CardUtil;
|
|||
import mage.util.functions.ApplyToPermanent;
|
||||
import mage.util.functions.EmptyApplyToPermanent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
||||
|
|
@ -73,12 +69,11 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param playerId null the token is controlled/owned by the controller of
|
||||
* the source ability
|
||||
* @param playerId null the token is controlled/owned by the controller of
|
||||
* the source ability
|
||||
* @param additionalCardType the token gains this card type in addition
|
||||
* @param hasHaste the token gains haste
|
||||
* @param number number of tokens to put into play
|
||||
* @param hasHaste the token gains haste
|
||||
* @param number number of tokens to put into play
|
||||
* @param tapped
|
||||
* @param attacking
|
||||
*/
|
||||
|
|
@ -165,7 +160,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
copyFrom = game.getCard(getTargetPointer().getFirst(game, source));
|
||||
}
|
||||
|
||||
if (permanent == null && copyFrom == null) {
|
||||
if (copyFrom == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
package mage.abilities.effects.common.discard;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
|
|
@ -20,8 +17,10 @@ import mage.target.TargetCard;
|
|||
import mage.target.common.TargetCardInHand;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author noxx
|
||||
*/
|
||||
public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
|
||||
|
|
@ -98,7 +97,6 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
if (player != null && controller != null) {
|
||||
if (revealAllCards) {
|
||||
this.numberCardsToReveal = new StaticValue(player.getHand().size());
|
||||
|
|
@ -125,6 +123,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
|
|||
revealedCards.addAll(player.getHand());
|
||||
}
|
||||
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
player.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ')' : "Discard", revealedCards, game);
|
||||
|
||||
boolean result = true;
|
||||
|
|
|
|||
|
|
@ -544,7 +544,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
return watcherClass.cast(watchers.get(watcherClass.getSimpleName(), uuid.toString()));
|
||||
}
|
||||
|
||||
public <T extends Watcher> T getWatcher(Class<T> watcherClass,String prefix) {
|
||||
public <T extends Watcher> T getWatcher(Class<T> watcherClass, String prefix) {
|
||||
return watcherClass.cast(watchers.get(watcherClass.getSimpleName(), prefix));
|
||||
}
|
||||
|
||||
|
|
@ -776,7 +776,9 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
ZoneChangeEvent castEvent = (ZoneChangeEvent) event;
|
||||
UUID targetId = castEvent.getTargetId();
|
||||
Card card = game.getCard(targetId);
|
||||
movedCards.add(card);
|
||||
if (card != null) {
|
||||
movedCards.add(card);
|
||||
}
|
||||
}
|
||||
ZoneChangeData eventData = entry.getKey();
|
||||
if (!movedCards.isEmpty()) {
|
||||
|
|
@ -1117,7 +1119,7 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
this.watchers.add(watcher);
|
||||
}
|
||||
|
||||
public void resetWatchers(){
|
||||
public void resetWatchers() {
|
||||
this.watchers.reset();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -186,7 +186,9 @@ public class Library implements Serializable {
|
|||
Map<String, Card> cards = new HashMap<>();
|
||||
for (UUID cardId : library) {
|
||||
Card card = game.getCard(cardId);
|
||||
cards.putIfAbsent(card.getName(), card);
|
||||
if (card != null) {
|
||||
cards.putIfAbsent(card.getName(), card);
|
||||
}
|
||||
}
|
||||
return cards.values();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue