Пример #1
0
 @Override
 public ObjectColor getFrameColor(Game game) {
   // For lands, add any colors of mana the land can produce to
   // its frame colors.
   if (getCardType().contains(CardType.LAND)) {
     ObjectColor cl = frameColor.copy();
     for (Ability ab : getAbilities()) {
       if (ab instanceof ManaAbility) {
         ManaAbility mana = (ManaAbility) ab;
         try {
           List<Mana> manaAdded = mana.getNetMana(game);
           for (Mana m : manaAdded) {
             if (m.getAny() > 0) {
               return new ObjectColor("WUBRG");
             }
             if (m.getWhite() > 0) {
               cl.setWhite(true);
             }
             if (m.getBlue() > 0) {
               cl.setBlue(true);
             }
             if (m.getBlack() > 0) {
               cl.setBlack(true);
             }
             if (m.getRed() > 0) {
               cl.setRed(true);
             }
             if (m.getGreen() > 0) {
               cl.setGreen(true);
             }
           }
         } catch (NullPointerException e) {
           // Ability depends on game
           // but no game passed
           // All such abilities are 5-color ones
           return new ObjectColor("WUBRG");
         }
       }
     }
     return cl;
   } else {
     // For everything else, just return the frame colors
     return frameColor;
   }
 }
Пример #2
0
 private Mana getManaTypes(Game game, Ability source) {
   List<Permanent> lands =
       game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game);
   Mana types = new Mana();
   for (Permanent land : lands) {
     Abilities<ManaAbility> manaAbilities = land.getAbilities().getManaAbilities(Zone.BATTLEFIELD);
     for (ManaAbility ability : manaAbilities) {
       if (!ability.equals(source) && ability.definesMana()) {
         for (Mana netMana : ability.getNetMana(game)) {
           types.add(netMana);
           if (netMana.getAny() > 0) {
             return types;
           }
         }
       }
     }
   }
   return types;
 }