/** * Used to check if the ability itself defines mana types it can produce. * * @return */ @Override public boolean definesMana(Game game) { return !getNetMana(game).isEmpty(); }
@Override public List<Mana> getNetMana(Game game) { if (predictable) { return super.getNetMana(game); } return new ArrayList<Mana>(netMana); }
@Override public List<Mana> getMana() { List<Mana> mana = new ArrayList<>(); for (ActivatedManaAbilityImpl ability : this.abilities.getActivatedManaAbilities(Zone.BATTLEFIELD)) { mana.addAll(ability.getNetMana(null)); } return mana; }
@Override public List<Mana> getNetMana(Game game) { this.netMana.clear(); this.netMana.add(new Mana(0,0,0,0,0,0, amount.calculate(game, this, null), 0)); return super.getNetMana(game); }
@Override public int compare(ActivatedManaAbilityImpl a1, ActivatedManaAbilityImpl a2) { int a1Max = 0; for (Mana netMana : a1.getNetMana(game)) { if (netMana.count() > a1Max) { a1Max = netMana.count(); } } int a2Max = 0; for (Mana netMana : a2.getNetMana(game)) { if (netMana.count() > a2Max) { a2Max = netMana.count(); } } return a2Max - a1Max; } });
for (Card card : lands) { for (ActivatedManaAbilityImpl ability : card.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD)) { for (Mana netMana : ability.getNetMana(game)) { if (netMana.enough(mana)) { this.playLand(card, game, false); for (Card card : lands) { for (ActivatedManaAbilityImpl ability : card.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD)) { for (Mana netMana : ability.getNetMana(game)) { if (mana.contains(netMana)) { this.playLand(card, game, false);
private Mana getManaTypes(Game game, Ability source) { Mana types = new Mana(); for (Cost cost : source.getCosts()) { if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) { Permanent land = ((SacrificeTargetCost) cost).getPermanents().get(0); if (land != null) { Abilities<ActivatedManaAbilityImpl> manaAbilities = land.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD); for (ActivatedManaAbilityImpl ability : manaAbilities) { if (!ability.equals(source) && ability.definesMana(game)) { for (Mana netMana : ability.getNetMana(game)) { types.add(netMana); } } } } } } return types; }
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<ActivatedManaAbilityImpl> manaAbilities = land.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD); for (ActivatedManaAbilityImpl ability : manaAbilities) { if (!ability.equals(source) && ability.definesMana(game)) { for (Mana netMana : ability.getNetMana(game)) { types.add(netMana); } } } } return types; }
if (abilities.size() == 1) { List<Mana> netManas = abilities.get(0).getNetMana(game); if (netManas.size() == 1) { if (!hasTapCost(abilities.get(0)) || checkTappedForManaReplacement(abilities.get(0), game, netManas.get(0))) { for (ActivatedManaAbilityImpl ability : abilities) { boolean hasTapCost = hasTapCost(ability); for (Mana netMana : ability.getNetMana(game)) { if (!hasTapCost || checkTappedForManaReplacement(ability, game, netMana)) { SkipAddMana:
Abilities: for (ActivatedManaAbilityImpl ability : mageObject.getAbilities().getAvailableActivatedManaAbilities(Zone.BATTLEFIELD, game)) { for (Mana netMana : ability.getNetMana(game)) { if (cost.testPay(netMana)) { score++;
private Mana getManaTypes(Game game, Ability source) { Mana types = new Mana(); if (game == null || game.getPhase() == null) { return types; } if (inManaTypeCalculation) { return types; } inManaTypeCalculation = true; List<Permanent> lands = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); for (Permanent land : lands) { Abilities<ActivatedManaAbilityImpl> mana = land.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD); for (ActivatedManaAbilityImpl ability : mana) { if (!ability.equals(source) && ability.definesMana(game)) { for (Mana netMana : ability.getNetMana(game)) { types.add(netMana); } } } } inManaTypeCalculation = false; return types; }
private Mana getManaTypes(Game game, Ability source) { Mana types = new Mana(); if (game == null || game.getPhase() == null) { return types; } if (inManaTypeCalculation) { return types; } inManaTypeCalculation = true; List<Permanent> lands = game.getBattlefield().getActivePermanents(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, source.getControllerId(), source.getSourceId(), game); for (Permanent land : lands) { Abilities<ActivatedManaAbilityImpl> mana = land.getAbilities().getActivatedManaAbilities(Zone.BATTLEFIELD); for (ActivatedManaAbilityImpl ability : mana) { if (!ability.equals(source) && ability.definesMana(game)) { for (Mana netMana : ability.getNetMana(game)) { types.add(netMana); } } } } inManaTypeCalculation = false; return types; } }
for (Mana netMana : ability.getNetMana(game)) { mana.add(netMana); for (Mana netMana : ability.getNetMana(game)) { opponentLandMana.add(netMana);
for (ActivatedManaAbilityImpl manaAbility : getManaAbilitiesSortedByManaCount(mageObject, game)) { int colored = 0; for (Mana mana : manaAbility.getNetMana(game)) { if (!unpaid.getMana().includesMana(mana)) { continue ManaAbility; for (Mana netMana : manaAbility.getNetMana(game)) { if (cost.testPay(netMana)) { if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) { for (Mana netMana : manaAbility.getNetMana(game)) { if (cost.testPay(netMana) || permittingObject != null) { if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) { for (Mana netMana : manaAbility.getNetMana(game)) { if (cost.testPay(netMana) || permittingObject != null) { if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) { for (Mana netMana : manaAbility.getNetMana(game)) { if (cost.testPay(netMana) || permittingObject != null) { if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) { for (Mana netMana : manaAbility.getNetMana(game)) { if (cost.testPay(netMana) || permittingObject != null) { if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) { for (Mana netMana : manaAbility.getNetMana(game)) { if (cost.testPay(netMana) || permittingObject != null) { if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) {
List<Mana> netManas = abilities.get(0).getNetMana(game); for (ActivatedManaAbilityImpl ability : abilities) { boolean hasTapCost = hasTapCost(ability); List<Mana> netManas = ability.getNetMana(game);
ActivatedManaAbilityImpl mana = (ActivatedManaAbilityImpl) ab; try { List<Mana> manaAdded = mana.getNetMana(game); for (Mana m : manaAdded) { if (m.getAny() > 0) {