mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
commit
c989fde625
185 changed files with 2282 additions and 2426 deletions
|
|
@ -36,10 +36,6 @@ public interface MageObject extends MageItem, Serializable {
|
|||
|
||||
boolean hasSubtype(SubType subtype, Game game);
|
||||
|
||||
default boolean hasSubtype(String subtype, Game game){
|
||||
return hasSubtype(SubType.byDescription(subtype), game);
|
||||
}
|
||||
|
||||
EnumSet<SuperType> getSuperType();
|
||||
|
||||
Abilities<Ability> getAbilities();
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class ChooseCreatureTypeEffect extends OneShotEffect {
|
|||
if (!game.isSimulation()) {
|
||||
game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
}
|
||||
game.getState().setValue(mageObject.getId() + "_type", typeChoice.getChoice());
|
||||
game.getState().setValue(mageObject.getId() + "_type", SubType.byDescription(typeChoice.getChoice()));
|
||||
if (mageObject instanceof Permanent) {
|
||||
((Permanent) mageObject).addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice()), game);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class ChooseLandTypeEffect extends OneShotEffect {
|
|||
if (!game.isSimulation()) {
|
||||
game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
}
|
||||
game.getState().setValue(mageObject.getId() + "_type", typeChoice.getChoice());
|
||||
game.getState().setValue(mageObject.getId() + "_type", SubType.byDescription(typeChoice.getChoice()));
|
||||
if (mageObject instanceof Permanent) {
|
||||
((Permanent) mageObject).addInfo("chosen type", CardUtil.addToolTipMarkTags("Chosen type: " + typeChoice.getChoice()), game);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,24 +30,19 @@ package mage.abilities.effects.common.continuous;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.mana.*;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class BecomesBasicLandEnchantedEffect extends ContinuousEffectImpl {
|
||||
|
||||
protected final static ArrayList<String> allLandTypes = new ArrayList<>();
|
||||
protected List<SubType> landTypes = new ArrayList<>();
|
||||
|
||||
|
||||
protected ArrayList<String> landTypes = new ArrayList<>();
|
||||
|
||||
public BecomesBasicLandEnchantedEffect(String... landNames) {
|
||||
public BecomesBasicLandEnchantedEffect(SubType... landNames) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
landTypes.addAll(Arrays.asList(landNames));
|
||||
this.staticText = setText();
|
||||
|
|
@ -77,30 +72,30 @@ public class BecomesBasicLandEnchantedEffect extends ContinuousEffectImpl {
|
|||
switch (layer) {
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
permanent.removeAllAbilities(source.getSourceId(), game);
|
||||
for (String landType : landTypes) {
|
||||
for (SubType landType : landTypes) {
|
||||
switch (landType) {
|
||||
case "Swamp":
|
||||
if (permanent.getSubtype(game).contains("Swamp")) { // type can be removed by other effect with newer timestamp, so no ability adding
|
||||
case SWAMP:
|
||||
if (permanent.getSubtype(game).contains(SubType.SWAMP)) { // type can be removed by other effect with newer timestamp, so no ability adding
|
||||
permanent.addAbility(new BlackManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
break;
|
||||
case "Mountain":
|
||||
if (permanent.getSubtype(game).contains("Mountain")) {
|
||||
case MOUNTAIN:
|
||||
if (permanent.getSubtype(game).contains(SubType.MOUNTAIN)) {
|
||||
permanent.addAbility(new RedManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
break;
|
||||
case "Forest":
|
||||
if (permanent.getSubtype(game).contains("Forest")) {
|
||||
case FOREST:
|
||||
if (permanent.getSubtype(game).contains(SubType.FOREST)) {
|
||||
permanent.addAbility(new GreenManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
break;
|
||||
case "Island":
|
||||
if (permanent.getSubtype(game).contains("Island")) {
|
||||
case ISLAND:
|
||||
if (permanent.getSubtype(game).contains(SubType.ISLAND)) {
|
||||
permanent.addAbility(new BlueManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
break;
|
||||
case "Plains":
|
||||
if (permanent.getSubtype(game).contains("Plains")) {
|
||||
case PLAINS:
|
||||
if (permanent.getSubtype(game).contains(SubType.PLAINS)) {
|
||||
permanent.addAbility(new WhiteManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
break;
|
||||
|
|
@ -109,7 +104,7 @@ public class BecomesBasicLandEnchantedEffect extends ContinuousEffectImpl {
|
|||
break;
|
||||
case TypeChangingEffects_4:
|
||||
// subtypes are all removed by changing the subtype to a land type.
|
||||
permanent.getSubtype(game).removeAll(allLandTypes);
|
||||
permanent.getSubtype(game).removeAll(SubType.getLandTypes(false));
|
||||
permanent.getSubtype(game).addAll(landTypes);
|
||||
break;
|
||||
}
|
||||
|
|
@ -127,7 +122,7 @@ public class BecomesBasicLandEnchantedEffect extends ContinuousEffectImpl {
|
|||
private String setText() {
|
||||
StringBuilder sb = new StringBuilder("Enchanted land is a ");
|
||||
int i = 1;
|
||||
for (String landType : landTypes) {
|
||||
for (SubType landType : landTypes) {
|
||||
if (i > 1) {
|
||||
if (i == landTypes.size()) {
|
||||
sb.append(" and ");
|
||||
|
|
|
|||
|
|
@ -48,9 +48,9 @@ public class BoostAllOfChosenSubtypeEffect extends BoostAllEffect {
|
|||
|
||||
@Override
|
||||
protected void setRuntimeData(Ability source, Game game) {
|
||||
String s = (String) game.getState().getValue(source.getSourceId() + "_type");
|
||||
if (subtype != null) {
|
||||
subtype = SubType.byDescription(s);
|
||||
SubType s = (SubType) game.getState().getValue(source.getSourceId() + "_type");
|
||||
if (s != null) {
|
||||
subtype = s;
|
||||
} else {
|
||||
discard();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ public class GainAbilityAllOfChosenSubtypeEffect extends GainAbilityAllEffect {
|
|||
|
||||
@Override
|
||||
protected void setRuntimeData(Ability source, Game game) {
|
||||
String s = (String) game.getState().getValue(source.getSourceId() + "_type");
|
||||
subtype = SubType.byDescription(s);
|
||||
subtype = (SubType) game.getState().getValue(source.getSourceId() + "_type");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ public class SpellsCostReductionAllOfChosenSubtypeEffect extends SpellsCostReduc
|
|||
|
||||
@Override
|
||||
protected boolean selectedByRuntimeData(Card card, Ability source, Game game) {
|
||||
String subtype = (String) game.getState().getValue(source.getSourceId() + "_type");
|
||||
SubType subtype = (SubType) game.getState().getValue(source.getSourceId() + "_type");
|
||||
if (subtype != null) {
|
||||
return card.hasSubtype(SubType.byDescription(subtype), game);
|
||||
return card.hasSubtype(subtype, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import mage.MageObject;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
|
@ -57,7 +58,7 @@ public class EnterAttributeAddChosenSubtypeEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
||||
String subtype = (String) game.getState().getValue(source.getSourceId() + "_type");
|
||||
SubType subtype = (SubType) game.getState().getValue(source.getSourceId() + "_type");
|
||||
if (permanent != null && subtype != null) {
|
||||
MageObject mageObject = permanent.getBasicMageObject(game);
|
||||
if (!mageObject.getSubtype(null).contains(subtype)) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
package mage.cards;
|
||||
|
||||
import java.io.Serializable;
|
||||
import mage.constants.Rarity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public final class CardSetInfo implements Serializable {
|
||||
|
||||
private final String name;
|
||||
|
|
@ -22,7 +23,7 @@ public final class CardSetInfo implements Serializable {
|
|||
this.rarity = rarity;
|
||||
if (graphicInfo == null && Rarity.LAND == rarity) {
|
||||
// Workaround to get images of basic land permanents loaded
|
||||
this.graphicInfo = new CardGraphicInfo(null, true);
|
||||
this.graphicInfo = ExpansionSet.NON_FULL_USE_VARIOUS;
|
||||
} else {
|
||||
this.graphicInfo = graphicInfo;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
public abstract class ExpansionSet implements Serializable {
|
||||
|
||||
public final static CardGraphicInfo NON_FULL_USE_VARIOUS = new CardGraphicInfo(null, true);
|
||||
public final static CardGraphicInfo FULL_ART_BFZ_VARIOUS = new CardGraphicInfo(FrameStyle.BFZ_FULL_ART_BASIC, true);
|
||||
|
||||
public class SetCardInfo implements Serializable {
|
||||
|
||||
private final String name;
|
||||
|
|
@ -305,29 +308,22 @@ public abstract class ExpansionSet implements Serializable {
|
|||
private void addSpecial(List<Card> booster) {
|
||||
int specialCards = 0;
|
||||
List<CardInfo> specialBonus = getSpecialBonus();
|
||||
if (specialBonus != null) {
|
||||
specialCards += specialBonus.size();
|
||||
}
|
||||
specialCards += specialBonus.size();
|
||||
|
||||
List<CardInfo> specialMythic = getSpecialMythic();
|
||||
if (specialMythic != null) {
|
||||
specialCards += specialMythic.size();
|
||||
}
|
||||
specialCards += specialMythic.size();
|
||||
List<CardInfo> specialRare = getSpecialRare();
|
||||
if (specialRare != null) {
|
||||
specialCards += specialRare.size();
|
||||
}
|
||||
specialCards += specialRare.size();
|
||||
List<CardInfo> specialUncommon = getSpecialUncommon();
|
||||
if (specialUncommon != null) {
|
||||
specialCards += specialUncommon.size();
|
||||
}
|
||||
specialCards += specialUncommon.size();
|
||||
List<CardInfo> specialCommon = getSpecialCommon();
|
||||
if (specialCommon != null) {
|
||||
specialCards += specialCommon.size();
|
||||
}
|
||||
|
||||
specialCards += specialCommon.size();
|
||||
|
||||
if (specialCards > 0) {
|
||||
for (int i = 0; i < numBoosterSpecial; i++) {
|
||||
if (RandomUtil.nextInt(15) < 10) {
|
||||
if (specialCommon != null && !specialCommon.isEmpty()) {
|
||||
if (!specialCommon.isEmpty()) {
|
||||
addToBooster(booster, specialCommon);
|
||||
} else {
|
||||
i--;
|
||||
|
|
@ -335,7 +331,7 @@ public abstract class ExpansionSet implements Serializable {
|
|||
continue;
|
||||
}
|
||||
if (RandomUtil.nextInt(4) < 3) {
|
||||
if (specialUncommon != null && !specialUncommon.isEmpty()) {
|
||||
if (!specialUncommon.isEmpty()) {
|
||||
addToBooster(booster, specialUncommon);
|
||||
} else {
|
||||
i--;
|
||||
|
|
@ -343,15 +339,15 @@ public abstract class ExpansionSet implements Serializable {
|
|||
continue;
|
||||
}
|
||||
if (RandomUtil.nextInt(8) < 7) {
|
||||
if (specialRare != null && !specialRare.isEmpty()) {
|
||||
if (!specialRare.isEmpty()) {
|
||||
addToBooster(booster, specialRare);
|
||||
} else {
|
||||
i--;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (specialMythic != null && !specialMythic.isEmpty()) {
|
||||
if (specialBonus != null && !specialBonus.isEmpty()) {
|
||||
if (!specialMythic.isEmpty()) {
|
||||
if (!specialBonus.isEmpty()) {
|
||||
if (RandomUtil.nextInt(3) < 2) {
|
||||
addToBooster(booster, specialMythic);
|
||||
continue;
|
||||
|
|
@ -363,7 +359,7 @@ public abstract class ExpansionSet implements Serializable {
|
|||
} else {
|
||||
i--;
|
||||
}
|
||||
if (specialBonus != null && !specialBonus.isEmpty()) {
|
||||
if (!specialBonus.isEmpty()) {
|
||||
addToBooster(booster, specialBonus);
|
||||
}
|
||||
}
|
||||
|
|
@ -404,27 +400,27 @@ public abstract class ExpansionSet implements Serializable {
|
|||
}
|
||||
|
||||
public List<CardInfo> getSpecialCommon() {
|
||||
return null;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<CardInfo> getSpecialUncommon() {
|
||||
return null;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<CardInfo> getSpecialRare() {
|
||||
return null;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<CardInfo> getSpecialMythic() {
|
||||
return null;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<CardInfo> getSpecialBonus() {
|
||||
return null;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public List<CardInfo> getSpecialLand() {
|
||||
return null;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean isCustomSet() {
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ public class ChosenSubtypePredicate implements Predicate<MageObject> {
|
|||
|
||||
@Override
|
||||
public boolean apply(MageObject input, Game game) {
|
||||
String subtype = (String) game.getState().getValue(cardID + "_type");
|
||||
return input.hasSubtype(SubType.byDescription(subtype), game);
|
||||
SubType subtype = (SubType) game.getState().getValue(cardID + "_type");
|
||||
return input.hasSubtype(subtype, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ package mage.game.permanent.token;
|
|||
import mage.constants.CardType;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.constants.SubType;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -40,8 +41,8 @@ public class RiptideReplicatorToken extends Token {
|
|||
public RiptideReplicatorToken() {
|
||||
this(null, null, 1);
|
||||
}
|
||||
public RiptideReplicatorToken(ObjectColor color, String type, int x) {
|
||||
super(type, "X/X creature token of the chosen color and type");
|
||||
public RiptideReplicatorToken(ObjectColor color, SubType type, int x) {
|
||||
super(type.getDescription(), "X/X creature token of the chosen color and type");
|
||||
cardType.add(CardType.CREATURE);
|
||||
if (color != null) {
|
||||
this.color.setColor(color);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ package mage.game.permanent.token;
|
|||
import mage.constants.CardType;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.constants.SubType;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -40,8 +41,8 @@ public class VolrathsLaboratoryToken extends Token {
|
|||
public VolrathsLaboratoryToken() {
|
||||
this(null, null);
|
||||
}
|
||||
public VolrathsLaboratoryToken(ObjectColor color, String type) {
|
||||
super(type, "2/2 creature token of the chosen color and type");
|
||||
public VolrathsLaboratoryToken(ObjectColor color, SubType type) {
|
||||
super(type.getDescription(), "2/2 creature token of the chosen color and type");
|
||||
cardType.add(CardType.CREATURE);
|
||||
if (color != null) {
|
||||
this.color.setColor(color);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue