public CreatureToken withSubType(SubType extraSubType) { if (!this.subtype.contains(extraSubType)) { this.subtype.add(extraSubType); } return this; }
@Override public boolean hasSubtype(SubType subtype, Game game) { if (this.getSpellAbility() instanceof BestowAbility) { // workaround for Bestow (don't like it) SubTypeList subtypes = card.getSubtype(game); if (!subtypes.contains(SubType.AURA)) { // do it only once subtypes.add(SubType.AURA); } if (subtypes.contains(subtype)) { return true; } } return card.hasSubtype(subtype, game); }
public static int getFixedPermanentScore(final Game game, final Permanent permanent) { //TODO: cache it inside Card int score = getCardDefinitionScore(game, permanent); score += PERMANENT_SCORE; if (permanent.getCardType().contains(CardType.CREATURE)) { // TODO: implement in the mage core //score + =cardDefinition.getActivations().size()*50; //score += cardDefinition.getManaActivations().size()*80; } else { if (permanent.getSubtype(game).contains(SubType.EQUIPMENT)) { score += 100; } } return score; }
@Override public SubTypeList getSubtype(Game game) { if (this.getSpellAbility() instanceof BestowAbility) { SubTypeList subtypes = card.getSubtype(game); if (!subtypes.contains(SubType.AURA)) { // do it only once subtypes.add(SubType.AURA); } return subtypes; } return card.getSubtype(game); }
private void setChosenSubtype(SubTypeList subtype, SubType choice) { if (subtype.size() != 1 || !subtype.contains(choice)) { subtype.removeAll(SubType.getCreatureTypes(false)); subtype.add(choice); } }
public MageScoredCard(Card card, List<ColoredManaSymbol> allowedColors, RateCallback cardRater) { this.card = card; int type; if (card.isCreature()) { type = 10; } else if (card.getSubtype(null).contains(SubType.EQUIPMENT)) { type = 8; } else if (card.getSubtype(null).contains(SubType.AURA)) { type = 5; } else if (card.isInstant()) { type = 7; } else { type = 6; } this.score = // 5*card.getValue() + // not possible now 3 * cardRater.rateCard(card) + // 3*card.getRemoval() + // not possible now type + getManaCostScore(card, allowedColors); }
protected static Paint getBackgroundPaint(ObjectColor colors, Collection<CardType> types, SubTypeList subTypes) { if (subTypes.contains(SubType.VEHICLE)) { return BG_TEXTURE_VEHICLE; } else if (types.contains(CardType.LAND)) { return BG_TEXTURE_LAND; } else if (types.contains(CardType.ARTIFACT)) { return BG_TEXTURE_ARTIFACT; } else if (colors.isMulticolored()) { return BG_TEXTURE_GOLD; } else if (colors.isWhite()) { return BG_TEXTURE_WHITE; } else if (colors.isBlue()) { return BG_TEXTURE_BLUE; } else if (colors.isBlack()) { return BG_TEXTURE_BLACK; } else if (colors.isRed()) { return BG_TEXTURE_RED; } else if (colors.isGreen()) { return BG_TEXTURE_GREEN; } else { // Colorless return new Color(71, 86, 101); } }
protected static BufferedImage getBackgroundImage(ObjectColor colors, Collection<CardType> types, SubTypeList subTypes, boolean isExped) { if (subTypes.contains(SubType.VEHICLE)) { return BG_IMG_VEHICLE; } else if (types.contains(CardType.LAND)) { if (isExped) { return BG_IMG_EXPEDITION; } return BG_IMG_LAND; } else if (types.contains(CardType.ARTIFACT)) { return BG_IMG_ARTIFACT; } else if (colors.isMulticolored()) { return BG_IMG_GOLD; } else if (colors.isWhite()) { return BG_IMG_WHITE; } else if (colors.isBlue()) { return BG_IMG_BLUE; } else if (colors.isBlack()) { return BG_IMG_BLACK; } else if (colors.isRed()) { return BG_IMG_RED; } else if (colors.isGreen()) { return BG_IMG_GREEN; } else { // Colorless return BG_IMG_COLORLESS; } }
@Override public boolean hasSubtype(SubType value, Game game) { if (value == null) { return false; } SubTypeList subtypes = this.getSubtype(game); if (subtypes.contains(value)) { return true; } else { // checking for Changeling // first make sure input parameter is a creature subtype // if not, then ChangelingAbility doesn't matter if (value.getSubTypeSet() != SubTypeSet.CreatureType) { return false; } // as it is creature subtype, then check the existence of Changeling return abilities.contains(ChangelingAbility.getInstance()) || isAllCreatureTypes(); } }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Permanent bestowPermanent = game.getPermanentEntering(source.getSourceId()); if (bestowPermanent != null) { if (bestowPermanent.hasSubtype(SubType.AURA, game)) { MageObject basicObject = bestowPermanent.getBasicMageObject(game); if (basicObject != null && !basicObject.getSubtype(null).contains(SubType.AURA)) { basicObject.getSubtype(null).add(SubType.AURA); basicObject.getCardType().remove(CardType.CREATURE); } } } return false; }
@Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanentEntering(source.getSourceId()); SubType subtype = (SubType) game.getState().getValue(source.getSourceId() + "_type"); if (permanent != null && subtype != null) { if (!permanent.getSubtype(game).contains(subtype)) { permanent.getSubtype(game).add(subtype); } return true; } return false; } }
@Override public boolean apply(Game game, Ability source) { List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game); for (Permanent permanent : permanents) { if (permanent != null) { SubTypeList subtype = permanent.getSubtype(game); if (subtype != null && (subtype.size() != 1 || !subtype.contains(SubType.SHADE))) { subtype.removeAll(SubType.getCreatureTypes(false)); subtype.add(SubType.SHADE); } } } return true; }
case AbilityAddingRemovingEffects_6: land.removeAllAbilities(source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.FOREST)) { land.addAbility(new GreenManaAbility(), source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.PLAINS)) { land.addAbility(new WhiteManaAbility(), source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.MOUNTAIN)) { land.addAbility(new RedManaAbility(), source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.ISLAND)) { land.addAbility(new BlueManaAbility(), source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.SWAMP)) { land.addAbility(new BlackManaAbility(), source.getSourceId(), game);
@Override public boolean apply(Game game, Ability source) { for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) { int count = 0; List<UUID> attachments = creature.getAttachments(); for (UUID attachmentId : attachments) { Permanent attached = game.getPermanent(attachmentId); if (attached != null && attached.getSubtype(game).contains(SubType.AURA)) { count++; } } creature.damage(count * 2, source.getId(), game, false, true); } return true; } }
switch (layer) { case TypeChangingEffects_4: if (land.getSubtype(game).contains(SubType.MOUNTAIN)) { land.getSubtype(game).clear(); land.getSubtype(game).add(SubType.PLAINS); + land.getZoneChangeCounter(game)).equals("true")) { land.removeAllAbilities(source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.FOREST)) { land.addAbility(new GreenManaAbility(), source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.PLAINS)) { land.addAbility(new WhiteManaAbility(), source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.MOUNTAIN)) { land.addAbility(new RedManaAbility(), source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.ISLAND)) { land.addAbility(new BlueManaAbility(), source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.SWAMP)) { land.addAbility(new BlackManaAbility(), source.getSourceId(), game);
switch (layer) { case TypeChangingEffects_4: if (land.getSubtype(game).contains(SubType.MOUNTAIN)) { land.getSubtype(game).clear(); land.getSubtype(game).add(SubType.PLAINS); + land.getZoneChangeCounter(game)).equals("true")) { land.removeAllAbilities(source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.FOREST)) { land.addAbility(new GreenManaAbility(), source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.PLAINS)) { land.addAbility(new WhiteManaAbility(), source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.MOUNTAIN)) { land.addAbility(new RedManaAbility(), source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.ISLAND)) { land.addAbility(new BlueManaAbility(), source.getSourceId(), game); if (land.getSubtype(game).contains(SubType.SWAMP)) { land.addAbility(new BlackManaAbility(), source.getSourceId(), game);
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source.getSourceId()); if (controller == null || sourceObject == null) { return false; } Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); if (targetCreature != null) { game.getState().setValue(CardUtil.getCardZoneString("savedCounters", source.getSourceId(), game), targetCreature.getCounters(game).copy()); game.getState().setValue(CardUtil.getCardZoneString("targetId", source.getSourceId(), game), targetCreature.getId()); Set<Card> toExile = new HashSet<>(); toExile.add(targetCreature); for (UUID attachementId : targetCreature.getAttachments()) { Permanent attachment = game.getPermanent(attachementId); if (attachment != null && attachment.getSubtype(game).contains(SubType.AURA)) { toExile.add(attachment); } } controller.moveCardsToExile(toExile, source, game, true, CardUtil.getCardExileZoneId(game, source), sourceObject.getIdName()); } return true; } }
veiledSentry.addCardType(CardType.CREATURE); if (!veiledSentry.getSubtype(game).contains(SubType.ILLUSION)) { veiledSentry.getSubtype(game).add(SubType.ILLUSION);
if (enchantment.getSubtype(game).contains(SubType.AURA)) { boolean canTarget = false; for (Target target : enchantment.getSpellAbility().getTargets()) {