本文整理了Java中mage.abilities.Ability.getCosts()
方法的一些代码示例,展示了Ability.getCosts()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ability.getCosts()
方法的具体详情如下:
包路径:mage.abilities.Ability
类名称:Ability
方法名:getCosts
[英]Gets all Costs associated with this ability.
[中]获取与此能力关联的所有成本。
代码示例来源:origin: magefree/mage
private boolean hasTapCost(Ability ability) {
for (Cost cost : ability.getCosts()) {
if (cost instanceof TapSourceCost) {
return true;
}
}
return false;
}
代码示例来源:origin: magefree/mage
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof RevealTargetFromHandCost) {
return ((RevealTargetFromHandCost) cost).getNumberRevealedCards();
}
}
return 0;
}
代码示例来源:origin: magefree/mage
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof RemoveVariableCountersSourceCost) {
return ((RemoveVariableCountersSourceCost) cost).getAmount();
}
}
return 0;
}
代码示例来源:origin: magefree/mage
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof PayVariableLoyaltyCost) {
return ((PayVariableLoyaltyCost) cost).getAmount();
}
}
return 0;
}
代码示例来源:origin: magefree/mage
@Override
public int calculate(Game game, Ability source, Effect effect) {
int count = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof VishKalBloodArbiterCost) {
count += ((VishKalBloodArbiterCost) cost).getAmount();
}
}
return count;
}
代码示例来源:origin: magefree/mage
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof PayVariableLoyaltyCost) {
return ((PayVariableLoyaltyCost) cost).getAmount();
}
}
return 0;
}
代码示例来源:origin: magefree/mage
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof SacrificeTargetCost) {
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
return sacrificeCost.getPermanents()
.stream().mapToInt(p -> p.getPower().getValue()).sum();
}
}
return 0;
}
代码示例来源:origin: magefree/mage
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof SacrificeTargetCost) {
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
return sacrificeCost.getPermanents().stream().mapToInt(p -> p.getToughness().getValue()).sum();
}
}
return 0;
}
代码示例来源:origin: magefree/mage
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
int amount = 0;
for (VariableCost cost : sourceAbility.getCosts().getVariableCosts()) {
amount += cost.getAmount();
}
return amount;
}
代码示例来源:origin: magefree/mage
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
int amount = 0;
for (VariableCost cost : sourceAbility.getCosts().getVariableCosts()) {
amount += cost.getAmount();
}
return 2 * amount;
}
代码示例来源:origin: magefree/mage
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
int xValue = sourceAbility.getManaCostsToPay().getX();
for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof DiscardXTargetCost) {
xValue = ((DiscardXTargetCost) cost).getAmount();
}
}
return xValue;
}
代码示例来源:origin: magefree/mage
@Override
public void adjustCosts(Ability ability, Game game) {
int numTargets = ability.getTargets().get(0).getTargets().size();
if (numTargets > 0) {
ability.getCosts().add(new PayLifeCost(numTargets * 3));
}
}
}
代码示例来源:origin: magefree/mage
@Override
public boolean apply(Game game, Ability source) {
RevealTargetFromHandCost cost = (RevealTargetFromHandCost) source.getCosts().get(0);
if (cost != null) {
Player player = game.getPlayer(source.getControllerId());
int CMC = cost.convertedManaCosts;
if (player != null) {
player.gainLife(CMC, game, source);
}
}
return true;
}
代码示例来源:origin: magefree/mage
@Override
public boolean apply(Game game, Ability source) {
for (Cost cost : source.getCosts()) {
if (cost instanceof SacrificeTargetCost) {
UUID targetId = cost.getTargets().getFirstTarget();
Permanent permanent = game.getPermanentOrLKIBattlefield(targetId);
if (filter.match(permanent, game)) {
return true;
}
}
}
return false;
}
代码示例来源:origin: magefree/mage
@Override
public void adjustTargets(Ability ability, Game game) {
Target target = new TargetPermanent(ability.getCosts().getVariableCosts().get(0).getAmount(), new FilterAttackingCreature());
ability.addTarget(target);
}
}
代码示例来源:origin: magefree/mage
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Card sourceCard = game.getCard(sourceAbility.getSourceId());
if (sourceCard != null) {
for (Object cost : sourceAbility.getCosts()) {
if (cost instanceof SacrificeTargetCost) {
Permanent p = (Permanent) game.getLastKnownInformation(((SacrificeTargetCost) cost).getPermanents().get(0).getId(), Zone.BATTLEFIELD);
return -1 * p.getPower().getValue();
}
}
}
return 0;
}
代码示例来源:origin: magefree/mage
@Override
public boolean apply(Game game, Ability source) {
NecromancersStockpileDiscardTargetCost cost = (NecromancersStockpileDiscardTargetCost) source.getCosts().get(0);
if (cost != null && cost.isZombieCard()) {
new CreateTokenEffect(new ZombieToken(), 1, true, false).apply(game, source);
}
return true;
}
代码示例来源:origin: magefree/mage
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
for (Cost cost : abilityToModify.getCosts()) {
if (cost instanceof SacrificeTargetCost) {
SacrificeTargetCost sacrificeCost = (SacrificeTargetCost) cost;
Filter filter = sacrificeCost.getTargets().get(0).getFilter();
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
}
}
return true;
}
代码示例来源:origin: magefree/mage
@Override
public void adjustTargets(Ability ability, Game game) {
int amount = 0;
for (Cost cost : ability.getCosts()) {
if (cost instanceof RevealVariableBlackCardsFromHandCost) {
amount = ((VariableCost) cost).getAmount();
}
}
ability.getTargets().clear();
ability.addTarget(new TargetCardInASingleGraveyard(0, amount, new FilterCard()));
}
}
代码示例来源:origin: magefree/mage
@Override
public void adjustTargets(Ability ability, Game game) {
int value = 0;
for (VariableCost cost : ability.getCosts().getVariableCosts()) {
value = cost.getAmount();
}
FilterCreaturePermanent filterCreaturePermanent = new FilterCreaturePermanent("creature with power " + value + " or less");
filterCreaturePermanent.add(new PowerPredicate(ComparisonType.FEWER_THAN, value + 1));
ability.getTargets().clear();
ability.addTarget(new TargetCreaturePermanent(filterCreaturePermanent));
}
}
内容来源于网络,如有侵权,请联系作者删除!