本文整理了Java中mage.abilities.Ability.getManaCosts()
方法的一些代码示例,展示了Ability.getManaCosts()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ability.getManaCosts()
方法的具体详情如下:
包路径:mage.abilities.Ability
类名称:Ability
方法名:getManaCosts
[英]Gets all ManaCosts associated with this ability. These returned costs should never be modified as they represent the base costs before any modifications.
[中]获取与此技能关联的所有魔法消耗。这些退回的成本不应修改,因为它们代表任何修改之前的基本成本。
代码示例来源:origin: magefree/mage
@Override
public ManaCosts<ManaCost> getManaCosts() {
return ability.getManaCosts();
}
代码示例来源:origin: magefree/mage
protected void simulateVariableCosts(Ability ability, Game game) {
int numAvailable = getAvailableManaProducers(game).size() - ability.getManaCosts().convertedManaCost();
int start = 0;
if (!(ability instanceof SpellAbility)) {
//only use x=0 on spell abilities
if (numAvailable == 0)
return;
else
start = 1;
}
for (int i = start; i < numAvailable; i++) {
Ability newAbility = ability.copy();
newAbility.getManaCostsToPay().add(new GenericManaCost(i));
allActions.add(newAbility);
}
}
代码示例来源:origin: magefree/mage
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return sourceAbility.getManaCosts().getX() + 3;
}
代码示例来源:origin: magefree/mage
protected void simulateVariableCosts(Ability ability, List<Ability> options, Game game) {
int numAvailable = getAvailableManaProducers(game).size() - ability.getManaCosts().convertedManaCost();
int start = 0;
if (!(ability instanceof SpellAbility)) {
//only use x=0 on spell abilities
if (numAvailable == 0)
return;
else
start = 1;
}
for (int i = start; i < numAvailable; i++) {
Ability newAbility = ability.copy();
newAbility.getManaCostsToPay().add(new GenericManaCost(i));
options.add(newAbility);
}
}
代码示例来源:origin: magefree/mage
@Override
public int announceXMana(int min, int max, String message, Game game, Ability ability) {
log.debug("announceXMana");
//TODO: improve this
int numAvailable = getAvailableManaProducers(game).size() - ability.getManaCosts().convertedManaCost();
if (numAvailable < 0) {
numAvailable = 0;
} else {
if (numAvailable < min) {
numAvailable = min;
}
if (numAvailable > max) {
numAvailable = max;
}
}
return numAvailable;
}
代码示例来源:origin: magefree/mage
if (!ability.getManaCosts().getVariableCosts().isEmpty()) {
int amount = getAvailableManaProducers(game).size() - ability.getManaCosts().convertedManaCost();
if (amount > 0) {
ability = ability.copy();
代码示例来源:origin: magefree/mage
@Override
public Cost getCost(Ability ability, Game game) {
return new GenericManaCost(ability.getManaCosts().convertedManaCost());
}
代码示例来源:origin: magefree/mage
@Override
protected void addVariableXOptions(List<Ability> options, Ability ability, int targetNum, Game game) {
int numAvailable = getAvailableManaProducers(game).size() - ability.getManaCosts().convertedManaCost();
代码示例来源:origin: magefree/mage
public AbilityView(Ability ability, String sourceName, CardView sourceCard) {
this.id = ability.getId();
this.name = "Ability";
this.sourceName = sourceName;
this.sourceCard = sourceCard;
this.rules = new ArrayList<>();
rules.add(ability.getRule());
this.power = "";
this.toughness = "";
this.loyalty = "";
this.cardTypes = EnumSet.noneOf(CardType.class);
this.subTypes = new SubTypeList();
this.superTypes =EnumSet.noneOf(SuperType.class);
this.color = new ObjectColor();
this.manaCost = ability.getManaCosts().getSymbols();
}
代码示例来源:origin: magefree/mage
@Override
public String getText(Ability ability, Game game) {
return "Pay " + getCost(ability, game).getText() + " rather than " + ability.getManaCosts().getText() + " for Samurai card?";
}
}
代码示例来源:origin: magefree/mage
public List<Ability> getPlayableOptions(Game game) {
List<Ability> all = new ArrayList<>();
List<Ability> playables = getPlayableAbilities(game);
for (Ability ability: playables) {
List<Ability> options = game.getPlayer(playerId).getPlayableOptions(ability, game);
if (options.isEmpty()) {
if (!ability.getManaCosts().getVariableCosts().isEmpty()) {
simulateVariableCosts(ability, all, game);
}
else {
all.add(ability);
}
}
else {
for (Ability option: options) {
if (!ability.getManaCosts().getVariableCosts().isEmpty()) {
simulateVariableCosts(option, all, game);
}
else {
all.add(option);
}
}
}
}
return all;
}
代码示例来源:origin: magefree/mage
@Override
public boolean apply(Game game, Ability source) {
if (AbilityType.SPELL == source.getAbilityType()) {
MageObject object = game.getObject(source.getSourceId());
return object != null
&& object.getManaCost().getText().contains("X");
} else {
return source.getManaCosts().getText().contains("X");
}
}
}
代码示例来源:origin: magefree/mage
List<Ability> options = game.getPlayer(playerId).getPlayableOptions(ability, game);
if (options.isEmpty()) {
if (!ability.getManaCosts().getVariableCosts().isEmpty()) {
simulateVariableCosts(ability, game);
if (!ability.getManaCosts().getVariableCosts().isEmpty()) {
simulateVariableCosts(option, game);
代码示例来源:origin: magefree/mage
if (root.abilities.size() == 1) {
for (Ability ability : root.abilities) {
if (ability.getManaCosts().convertedManaCost() == 0
&& ability.getCosts().isEmpty()) {
if (actionCache.contains(ability.getRule() + '_' + ability.getSourceId())) {
代码示例来源:origin: magefree/mage
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
int blackSymbols = abilityToModify.getManaCosts().getMana().getBlack();
TargetControlledPermanent target = new TargetControlledPermanent(blackSymbols, blackSymbols, filter, true);
target.setRequired(false);
abilityToModify.addCost(new SacrificeTargetCost(target));
return true;
}
代码示例来源:origin: magefree/mage
/**
* Only used for AIs
*
* @param ability
* @param game
* @return
*/
@Override
public List<Ability> getPlayableOptions(Ability ability, Game game) {
List<Ability> options = new ArrayList<>();
if (ability.isModal()) {
addModeOptions(options, ability, game);
} else if (!ability.getTargets().getUnchosen().isEmpty()) {
// TODO: Handle other variable costs than mana costs
if (!ability.getManaCosts().getVariableCosts().isEmpty()) {
addVariableXOptions(options, ability, 0, game);
} else {
addTargetOptions(options, ability, 0, game);
}
} else if (!ability.getCosts().getTargets().getUnchosen().isEmpty()) {
addCostTargetOptions(options, ability, 0, game);
}
return options;
}
代码示例来源:origin: magefree/mage
private void addModeOptions(List<Ability> options, Ability option, Game game) {
// TODO: Support modal spells with more than one selectable mode
for (Mode mode : option.getModes().values()) {
Ability newOption = option.copy();
newOption.getModes().getSelectedModes().clear();
newOption.getModes().getSelectedModes().add(mode.getId());
newOption.getModes().setActiveMode(mode);
if (!newOption.getTargets().getUnchosen().isEmpty()) {
if (!newOption.getManaCosts().getVariableCosts().isEmpty()) {
addVariableXOptions(options, newOption, 0, game);
} else {
addTargetOptions(options, newOption, 0, game);
}
} else if (!newOption.getCosts().getTargets().getUnchosen().isEmpty()) {
addCostTargetOptions(options, newOption, 0, game);
} else {
options.add(newOption);
}
}
}
代码示例来源:origin: magefree/mage
case PTChangingEffects_7:
if (sublayer == SubLayer.SetPT_7b) {
MageInt power = new MageInt(source.getManaCosts().getVariableCosts().get(0).getAmount());
MageInt toughness = new MageInt(source.getManaCosts().getVariableCosts().get(0).getAmount());
permanent.getPower().setValue(power.getValue());
permanent.getToughness().setValue(toughness.getValue());
代码示例来源:origin: magefree/mage
public VoodooDoll(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{6}");
// At the beginning of your upkeep, put a pin counter on Voodoo Doll.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(CounterType.PIN.createInstance()), TargetController.YOU, false));
// At the beginning of your end step, if Voodoo Doll is untapped, destroy Voodoo Doll and it deals damage to you equal to the number of pin counters on it.
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.BATTLEFIELD, new DestroySourceEffect(), TargetController.YOU,
new InvertCondition(SourceTappedCondition.instance), false);
ability.addEffect(new DamageControllerEffect(new CountersSourceCount(CounterType.PIN)));
this.addAbility(ability);
// {X}{X}, {T}: Voodoo Doll deals damage equal to the number of pin counters on it to any target. X is the number of pin counters on Voodoo Doll.
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(new CountersSourceCount(CounterType.PIN)), new ManaCostsImpl("{X}{X}"));
ability2.addCost(new TapSourceCost());
ability2.addTarget(new TargetAnyTarget());
for (VariableCost cost : ability2.getManaCosts().getVariableCosts()) {
if (cost instanceof VariableManaCost) {
((VariableManaCost) cost).setMaxX(0);
break;
}
}
this.addAbility(ability2);
}
代码示例来源:origin: magefree/mage
for (VariableCost cost : ability.getManaCosts().getVariableCosts()) {
if (cost instanceof VariableManaCost) {
((VariableManaCost) cost).setMinX(1);
内容来源于网络,如有侵权,请联系作者删除!