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; }
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; } }