mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
Refactored more subtypes usages to enum
This commit is contained in:
parent
80b61ccbd6
commit
252c941b4f
21 changed files with 63 additions and 46 deletions
|
|
@ -47,6 +47,7 @@ import mage.constants.Duration;
|
|||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -142,7 +143,7 @@ class LicidContinuousEffect extends ContinuousEffectImpl {
|
|||
licid.getCardType().clear();
|
||||
licid.addCardType(CardType.ENCHANTMENT);
|
||||
licid.getSubtype(game).clear();
|
||||
licid.getSubtype(game).add("Aura");
|
||||
licid.getSubtype(game).add(SubType.AURA);
|
||||
break;
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
ArrayList<Ability> toRemove = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ 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.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -61,8 +62,8 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
private boolean gainsHaste;
|
||||
private final int number;
|
||||
private List<Permanent> addedTokenPermanents;
|
||||
private String additionalSubType;
|
||||
private String onlySubType;
|
||||
private SubType additionalSubType;
|
||||
private SubType onlySubType;
|
||||
private boolean tapped;
|
||||
private boolean attacking;
|
||||
private UUID attackedPlayer;
|
||||
|
|
@ -296,11 +297,11 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
return addedTokenPermanents;
|
||||
}
|
||||
|
||||
public void setAdditionalSubType(String additionalSubType) {
|
||||
public void setAdditionalSubType(SubType additionalSubType) {
|
||||
this.additionalSubType = additionalSubType;
|
||||
}
|
||||
|
||||
public void setOnlySubType(String onlySubType) {
|
||||
public void setOnlySubType(SubType onlySubType) {
|
||||
this.onlySubType = onlySubType;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ import mage.constants.Duration;
|
|||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
|
|
@ -83,8 +84,8 @@ public class BecomesAuraSourceEffect extends ContinuousEffectImpl implements Sou
|
|||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
if (!permanent.getSubtype(game).contains("Aura")) {
|
||||
permanent.getSubtype(game).add("Aura");
|
||||
if (!permanent.getSubtype(game).contains(SubType.AURA)) {
|
||||
permanent.getSubtype(game).add(SubType.AURA);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SpellAbilityType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterControlledLandPermanent;
|
||||
|
|
@ -163,7 +164,7 @@ class AwakenElementalToken extends Token {
|
|||
super("", "0/0 Elemental creature with haste");
|
||||
this.cardType.add(CardType.CREATURE);
|
||||
|
||||
this.subtype.add("Elemental");
|
||||
this.subtype.add(SubType.ELEMENTAL);
|
||||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(0);
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SpellAbilityType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
|
@ -149,12 +150,12 @@ public class BestowAbility extends SpellAbility {
|
|||
if (permanent != null) {
|
||||
MageObject basicObject = permanent.getBasicMageObject(game);
|
||||
if (basicObject != null) {
|
||||
basicObject.getSubtype(null).remove("Aura");
|
||||
basicObject.getSubtype(null).remove(SubType.AURA);
|
||||
if (!basicObject.isCreature()) {
|
||||
basicObject.addCardType(CardType.CREATURE);
|
||||
}
|
||||
}
|
||||
permanent.getSubtype(null).remove("Aura");
|
||||
permanent.getSubtype(null).remove(SubType.AURA);
|
||||
if (!permanent.isCreature()) {
|
||||
permanent.addCardType(CardType.CREATURE);
|
||||
}
|
||||
|
|
@ -187,9 +188,9 @@ class BestowEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent bestowPermanent = game.getPermanentEntering(source.getSourceId());
|
||||
if (bestowPermanent != null) {
|
||||
if (bestowPermanent.getSubtype(game).contains("Aura")) {
|
||||
if (bestowPermanent.getSubtype(game).contains(SubType.AURA)) {
|
||||
MageObject basicObject = bestowPermanent.getBasicMageObject(game);
|
||||
basicObject.getSubtype(null).add("Aura");
|
||||
basicObject.getSubtype(null).add(SubType.AURA);
|
||||
basicObject.getCardType().remove(CardType.CREATURE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@
|
|||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
*/
|
||||
package mage.cards.basiclands;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -34,6 +33,7 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
|
||||
/**
|
||||
|
|
@ -44,7 +44,7 @@ public abstract class BasicLand extends CardImpl {
|
|||
public BasicLand(UUID ownerId, CardSetInfo setInfo, ActivatedManaAbilityImpl mana) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.LAND}, null);
|
||||
addSuperType(SuperType.BASIC);
|
||||
this.subtype.add(name);
|
||||
this.subtype.add(SubType.byDescription(name));
|
||||
this.addAbility(mana);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,10 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.game.permanent.token;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -41,7 +42,7 @@ public class CamaridToken extends Token {
|
|||
this.getPower().modifyBaseValue(1);
|
||||
this.getToughness().modifyBaseValue(1);
|
||||
this.color.setBlue(true);
|
||||
this.getSubtype(null).add("Camarid");
|
||||
this.getSubtype(null).add(SubType.CAMARID);
|
||||
this.addCardType(CardType.CREATURE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
package mage.game.permanent.token;
|
||||
import mage.constants.CardType;
|
||||
import mage.abilities.keyword.ForestwalkAbility;
|
||||
import mage.constants.SubType;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -42,8 +43,8 @@ public class CatWarriorToken extends Token {
|
|||
this.getPower().modifyBaseValue(2);
|
||||
this.getToughness().modifyBaseValue(2);
|
||||
this.color.setGreen(true);
|
||||
this.getSubtype(null).add("Cat");
|
||||
this.getSubtype(null).add("Warrior");
|
||||
this.getSubtype(null).add(SubType.CAT);
|
||||
this.getSubtype(null).add(SubType.WARRIOR);
|
||||
this.addCardType(CardType.CREATURE);
|
||||
this.addAbility(new ForestwalkAbility());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,9 +25,10 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.game.permanent.token;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
|
||||
/**
|
||||
|
|
@ -43,7 +44,7 @@ public class NissaSageAnimistToken extends Token {
|
|||
this.getPower().modifyBaseValue(4);
|
||||
this.getToughness().modifyBaseValue(4);
|
||||
this.color.setGreen(true);
|
||||
this.getSubtype(null).add("Elemental");
|
||||
this.getSubtype(null).add(SubType.ELEMENTAL);
|
||||
this.addCardType(CardType.CREATURE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
package mage.game.permanent.token;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
|
||||
/**
|
||||
|
|
@ -43,7 +44,7 @@ public class RagavanToken extends Token {
|
|||
this.getPower().modifyBaseValue(2);
|
||||
this.getToughness().modifyBaseValue(1);
|
||||
this.color.setRed(true);
|
||||
this.getSubtype(null).add("Monkey");
|
||||
this.getSubtype(null).add(SubType.MONKEY);
|
||||
this.addCardType(CardType.CREATURE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ package mage.game.permanent.token;
|
|||
|
||||
import mage.constants.CardType;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.constants.SubType;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -41,7 +42,7 @@ public class WireflyToken extends Token {
|
|||
this.setOriginalExpansionSetCode("DST");
|
||||
this.getPower().modifyBaseValue(2);
|
||||
this.getToughness().modifyBaseValue(2);
|
||||
this.getSubtype(null).add("Insect");
|
||||
this.getSubtype(null).add(SubType.INSECT);
|
||||
this.addCardType(CardType.ARTIFACT);
|
||||
this.addCardType(CardType.CREATURE);
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
// Must be removed first time, after that will be removed by continous effect
|
||||
// Otherwise effects like evolve trigger from creature comes into play event
|
||||
card.getCardType().remove(CardType.CREATURE);
|
||||
card.getSubtype(game).add("Aura");
|
||||
card.getSubtype(game).add(SubType.AURA);
|
||||
}
|
||||
if (controller.moveCards(card, Zone.BATTLEFIELD, ability, game, false, faceDown, false, null)) {
|
||||
if (bestow) {
|
||||
|
|
@ -482,7 +482,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
public SubTypeList getSubtype(Game game) {
|
||||
if (this.getSpellAbility() instanceof BestowAbility) {
|
||||
SubTypeList subtypes = card.getSubtype(game);
|
||||
subtypes.add("Aura");
|
||||
subtypes.add(SubType.AURA);
|
||||
return subtypes;
|
||||
}
|
||||
return card.getSubtype(game);
|
||||
|
|
@ -492,7 +492,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
public boolean hasSubtype(SubType subtype, Game game) {
|
||||
if (this.getSpellAbility() instanceof BestowAbility) { // workaround for Bestow (don't like it)
|
||||
SubTypeList subtypes = card.getSubtype(game);
|
||||
subtypes.add("Aura");
|
||||
subtypes.add(SubType.AURA);
|
||||
if (subtypes.contains(subtype)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ package mage.util.functions;
|
|||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
|
@ -17,9 +18,9 @@ import mage.game.permanent.Permanent;
|
|||
*/
|
||||
public class AddSubtypeApplier extends ApplyToPermanent {
|
||||
|
||||
private final String subtype;
|
||||
private final SubType subtype;
|
||||
|
||||
public AddSubtypeApplier(String subtype) {
|
||||
public AddSubtypeApplier(SubType subtype) {
|
||||
this.subtype = subtype;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue