forked from External/mage
Merge branch 'master' of https://github.com/magefree/mage.git into MorphRework_v2
# Conflicts: # Mage.Sets/src/mage/cards/b/Banefire.java
This commit is contained in:
commit
26af2602e4
484 changed files with 6960 additions and 5629 deletions
|
|
@ -33,7 +33,7 @@ public abstract class Emblem extends CommandObjectImpl {
|
|||
private static final ManaCosts emptyCost = new ManaCostsImpl<>();
|
||||
|
||||
private UUID controllerId;
|
||||
private MageObject sourceObject;
|
||||
protected MageObject sourceObject;
|
||||
private boolean copy;
|
||||
private MageObject copyFrom; // copied card INFO (used to call original adjusters)
|
||||
private FrameStyle frameStyle;
|
||||
|
|
|
|||
108
Mage/src/main/java/mage/game/command/emblems/EmblemOfCard.java
Normal file
108
Mage/src/main/java/mage/game/command/emblems/EmblemOfCard.java
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
package mage.game.command.emblems;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.AbilityImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.decks.DeckCardInfo;
|
||||
import mage.cards.mock.MockCard;
|
||||
import mage.cards.repository.CardCriteria;
|
||||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.util.CardUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author artemiswkearney
|
||||
* Emblem with all the abilities of an existing card.
|
||||
* Can be used for custom gamemodes like Omniscience Draft (as seen on Arena),
|
||||
* mana burn with Yurlok of Scorch Thrash, and anything else players might think of.
|
||||
*/
|
||||
public final class EmblemOfCard extends Emblem {
|
||||
private final boolean usesVariousArt;
|
||||
private static final Logger logger = Logger.getLogger(EmblemOfCard.class);
|
||||
|
||||
public static Card lookupCard(
|
||||
String cardName,
|
||||
String cardNumber,
|
||||
String setCode,
|
||||
String infoTypeForError
|
||||
) {
|
||||
int cardNumberInt = CardUtil.parseCardNumberAsInt(cardNumber);
|
||||
List<CardInfo> found = CardRepository.instance.findCards(new CardCriteria()
|
||||
.name(cardName)
|
||||
.minCardNumber(cardNumberInt)
|
||||
.maxCardNumber(cardNumberInt)
|
||||
.setCodes(setCode));
|
||||
return found.stream()
|
||||
.filter(ci -> ci.getCardNumber().equals(cardNumber))
|
||||
.findFirst()
|
||||
.orElseGet(() -> found.stream()
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalArgumentException("No real card for " + infoTypeForError + " " + cardName)))
|
||||
.getCard();
|
||||
}
|
||||
|
||||
public static Card cardFromDeckInfo(DeckCardInfo info) {
|
||||
return lookupCard(
|
||||
info.getCardName(),
|
||||
info.getCardNum(),
|
||||
info.getSetCode(),
|
||||
"DeckCardInfo"
|
||||
);
|
||||
}
|
||||
|
||||
public EmblemOfCard(Card card, Zone zone) {
|
||||
super(card.getName());
|
||||
if (card instanceof MockCard) {
|
||||
card = lookupCard(
|
||||
card.getName(),
|
||||
card.getCardNumber(),
|
||||
card.getExpansionSetCode(),
|
||||
"MockCard"
|
||||
);
|
||||
}
|
||||
this.getAbilities().addAll(card.getAbilities().stream().filter(
|
||||
ability -> zone.match(ability.getZone())
|
||||
).map(ability -> {
|
||||
if (ability instanceof AbilityImpl && ability.getZone() == zone) {
|
||||
return ((AbilityImpl)ability).copyWithZone(Zone.COMMAND);
|
||||
}
|
||||
return ability;
|
||||
}).collect(Collectors.toList()));
|
||||
this.getAbilities().setSourceId(this.getId());
|
||||
this.setExpansionSetCode(card.getExpansionSetCode());
|
||||
this.setCardNumber(card.getCardNumber());
|
||||
this.setImageNumber(card.getImageNumber());
|
||||
this.usesVariousArt = card.getUsesVariousArt();
|
||||
}
|
||||
|
||||
public EmblemOfCard(Card card) {
|
||||
this(card, Zone.BATTLEFIELD);
|
||||
}
|
||||
|
||||
private EmblemOfCard(EmblemOfCard eoc) {
|
||||
super(eoc);
|
||||
this.usesVariousArt = eoc.usesVariousArt;
|
||||
}
|
||||
@Override
|
||||
public EmblemOfCard copy() {
|
||||
return new EmblemOfCard(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSourceObject(MageObject sourceObject) {
|
||||
this.sourceObject = sourceObject;
|
||||
// super method would try and fail to find the emblem image here
|
||||
// (not sure why that would be setSoureObject's job; we get our image during construction)
|
||||
}
|
||||
|
||||
public boolean getUsesVariousArt() {
|
||||
return usesVariousArt;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -51,8 +51,9 @@ class GideonOfTheTrialsCantLoseEffect extends ContinuousRuleModifyingEffectImpl
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.WINS
|
||||
|| event.getType() == GameEvent.EventType.LOSES;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -52,11 +52,6 @@ class NarsetTranscendentCantCastEffect extends ContinuousRuleModifyingEffectImpl
|
|||
return new NarsetTranscendentCantCastEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInfoMessage(Ability source, GameEvent event, Game game) {
|
||||
MageObject mageObject = game.getObject(source);
|
||||
|
|
|
|||
|
|
@ -84,11 +84,6 @@ class EdgeOfMalacolEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
return new EdgeOfMalacolEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.UNTAP;
|
||||
|
|
|
|||
|
|
@ -62,16 +62,14 @@ public class TheEonFogPlane extends Plane {
|
|||
|
||||
class TheEonFogSkipUntapStepEffect extends ContinuousRuleModifyingEffectImpl {
|
||||
|
||||
boolean allPlayers = false;
|
||||
final boolean allPlayers;
|
||||
|
||||
public TheEonFogSkipUntapStepEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Neutral, false, false);
|
||||
this.allPlayers = false;
|
||||
staticText = "Players skip their untap steps";
|
||||
this(Duration.WhileOnBattlefield, false);
|
||||
}
|
||||
|
||||
public TheEonFogSkipUntapStepEffect(Duration d, boolean allPlayers) {
|
||||
super(d, Outcome.Neutral, false, false);
|
||||
public TheEonFogSkipUntapStepEffect(Duration duration, boolean allPlayers) {
|
||||
super(duration, Outcome.Neutral, false, false);
|
||||
this.allPlayers = allPlayers;
|
||||
staticText = "Players skip their untap steps";
|
||||
}
|
||||
|
|
@ -86,6 +84,11 @@ class TheEonFogSkipUntapStepEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
return new TheEonFogSkipUntapStepEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.UNTAP_STEP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Plane cPlane = game.getState().getCurrentPlane();
|
||||
|
|
@ -95,6 +98,6 @@ class TheEonFogSkipUntapStepEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
if (!cPlane.getPlaneType().equals(Planes.PLANE_THE_EON_FOG)) {
|
||||
return false;
|
||||
}
|
||||
return event.getType() == GameEvent.EventType.UNTAP_STEP;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue