mage.abilities.Ability.getManaCostsToPay()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中mage.abilities.Ability.getManaCostsToPay()方法的一些代码示例,展示了Ability.getManaCostsToPay()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ability.getManaCostsToPay()方法的具体详情如下:
包路径:mage.abilities.Ability
类名称:Ability
方法名:getManaCostsToPay

Ability.getManaCostsToPay介绍

[英]Gets all the ManaCosts that must be paid before activating this ability. These costs should be modified by any modification effects currently present within the game state.
[中]获取激活此技能之前必须支付的所有魔法费用。这些成本应该通过游戏状态中当前存在的任何修改效果进行修改。

代码示例

代码示例来源:origin: magefree/mage

@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
  int paid = sourceAbility.getManaCostsToPay().getX();
  return paid;
}

代码示例来源:origin: magefree/mage

@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
  int manaCost = abilityToModify.getManaCostsToPay().convertedManaCost();
  if (manaCost < 3) {
    CardUtil.increaseCost(abilityToModify, 3 - manaCost);
  }
  return true;
}

代码示例来源: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 adjustTargets(Ability ability, Game game) {
    Target target = new TargetPermanent(0, ability.getManaCostsToPay().getX(), filter, false);
    ability.addTarget(target);
  }
}

代码示例来源:origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
  if (targetPlayer != null) {
    targetPlayer.drawCards(source.getManaCostsToPay().getX(), game);
    targetPlayer.loseLife(source.getManaCostsToPay().getX(), game, false);
    return true;
  }
  return false;
}

代码示例来源:origin: magefree/mage

@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
  MageObject mageObject = game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.STACK);
  if (mageObject != null && mageObject instanceof StackObject) {
    return ((StackObject) mageObject).getStackAbility().getManaCostsToPay().getX();
  }
  return 0;
}

代码示例来源:origin: magefree/mage

@Override
  public void adjustCosts(Ability ability, Game game) {
    int numTargets = ability.getTargets().isEmpty() ? 0 : ability.getTargets().get(0).getTargets().size();
    if (numTargets > 1) {
      ability.getManaCostsToPay().add(new GenericManaCost(numTargets - 1));
    }
  }
}

代码示例来源:origin: magefree/mage

@Override
  public void adjustTargets(Ability ability, Game game) {
    ability.getTargets().clear();
    ability.addTarget(new TargetCardInYourGraveyard(
        ability.getManaCostsToPay().getX(),
        StaticFilters.FILTER_CARD_FROM_YOUR_GRAVEYARD
    ));
  }
}

代码示例来源:origin: magefree/mage

@Override
  public void adjustTargets(Ability ability, Game game) {
    ability.getTargets().clear();
    ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter));
  }
}

代码示例来源:origin: magefree/mage

@Override
  public void adjustTargets(Ability ability, Game game) {
    ability.getTargets().clear();
    int xValue = ability.getManaCostsToPay().getX();
    ability.addTarget(new TargetLandPermanent(xValue, xValue, filter, false));
  }
}

代码示例来源:origin: magefree/mage

@Override
  public void adjustTargets(Ability ability, Game game) {
    ability.getTargets().clear();
    int xValue = ability.getManaCostsToPay().getX();
    ability.addTarget(new TargetCreaturePermanent(xValue, xValue, filter, false));
  }
}

代码示例来源:origin: magefree/mage

@Override
  public void adjustTargets(Ability ability, Game game) {
    ability.getTargets().clear();
    int xValue = ability.getManaCostsToPay().getX();
    Target target = new TargetCardInYourGraveyard(xValue, new FilterCreatureCard((xValue != 1 ? " creature cards" : "creature card") + " from your graveyard"));
    ability.addTarget(target);
  }
}

代码示例来源:origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  for (Permanent permanent : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) {
    if (!permanent.isLand() && permanent.getConvertedManaCost() <= source.getManaCostsToPay().getX()) {
      permanent.destroy(source.getSourceId(), game, false);
    }
  }
  return true;
}

代码示例来源:origin: magefree/mage

@Override
  public boolean apply(Game game, Ability source) {
    for (Permanent permanent : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) {
      if (permanent != null && permanent.isArtifact() && permanent.getConvertedManaCost() <= source.getManaCostsToPay().getX()) {
        permanent.destroy(source.getSourceId(), game, false);
      }
    }
    return true;
  }
}

代码示例来源:origin: magefree/mage

@Override
  public void adjustTargets(Ability ability, Game game) {
    int xValue = ability.getManaCostsToPay().getX();
    ability.getTargets().clear();
    FilterSpell filter = new FilterSpell("spell with converted mana cost " + xValue);
    filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
    ability.addTarget(new TargetSpell(filter));
  }
}

代码示例来源:origin: magefree/mage

@Override
  public void adjustTargets(Ability ability, Game game) {
    ability.getTargets().clear();
    int xValue = ability.getManaCostsToPay().getX();
    FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost X");
    filter.add(new ConvertedManaCostPredicate(ComparisonType.EQUAL_TO, xValue));
    ability.addTarget(new TargetCreaturePermanent(filter));
  }
}

代码示例来源:origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  int count = source.getManaCostsToPay().getX();
  OozeToken oozeToken = new OozeToken();
  oozeToken.getPower().modifyBaseValue(count);
  oozeToken.getToughness().modifyBaseValue(count);
  oozeToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
  return true;
}

代码示例来源:origin: magefree/mage

@Override
  public void adjustTargets(Ability ability, Game game) {
    int xValue = ability.getManaCostsToPay().getX();
    FilterPermanent permanentFilter = new FilterCreaturePermanent("creature with power " + xValue + " or less");
    permanentFilter.add(new PowerPredicate(ComparisonType.FEWER_THAN, xValue + 1));
    ability.getTargets().clear();
    ability.getTargets().add(new TargetPermanent(permanentFilter));
  }
}

代码示例来源:origin: magefree/mage

@Override
  public void adjustTargets(Ability ability, Game game) {
    ability.getTargets().clear();
    int xValue = ability.getManaCostsToPay().getX();
    FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with converted mana cost X or less");
    filter.add(Predicates.not(new ConvertedManaCostPredicate(ComparisonType.MORE_THAN, xValue)));
    ability.addTarget(new TargetCreaturePermanent(filter));
  }
}

代码示例来源:origin: magefree/mage

@Override
public boolean apply(Game game, Ability source) {
  Player controller = game.getPlayer(source.getControllerId());
  if (controller != null) {
    for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) {
      permanent.addCounters(CounterType.P1P1.createInstance(source.getManaCostsToPay().getX()), source, game);
    }
    return true;
  }
  return false;
}

相关文章