本文整理了Java中mage.abilities.Ability.isUsesStack()
方法的一些代码示例,展示了Ability.isUsesStack()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ability.isUsesStack()
方法的具体详情如下:
包路径:mage.abilities.Ability
类名称:Ability
方法名:isUsesStack
[英]Retrieves whether or not this abilities activation will use the stack.
[中]检索此能力激活是否将使用堆栈。
代码示例来源:origin: magefree/mage
public boolean usesStack() {
if (abilities != null && !abilities.isEmpty()) {
return abilities.get(abilities.size() -1).isUsesStack();
}
return true;
}
}
代码示例来源:origin: magefree/mage
public boolean usesStack() {
if (abilities != null && !abilities.isEmpty()) {
return abilities.get(abilities.size() -1).isUsesStack();
}
return true;
}
}
代码示例来源:origin: magefree/mage
protected void act(Game game) {
if (actions == null || actions.isEmpty())
pass(game);
else {
boolean usedStack = false;
while (actions.peek() != null) {
Ability ability = actions.poll();
this.activateAbility((ActivatedAbility) ability, game);
if (logger.isDebugEnabled())
logger.debug("activating: " + ability);
if (ability.isUsesStack())
usedStack = true;
}
if (usedStack)
pass(game);
}
logger.info("Turn " + game.getTurnNum() + " Step " + game.getStep().toString() + " Player " + name + " Life " + life);
}
代码示例来源:origin: magefree/mage
if (ability.isUsesStack()) {
usedStack = true;
代码示例来源:origin: magefree/mage
&& (action.isUsesStack() || action instanceof PassAbility)) {
代码示例来源:origin: magefree/mage
protected void addAbilityNode(SimulationNode2 parent, Ability ability, int depth, Game game) {
Game sim = game.copy();
sim.getStack().push(new StackAbility(ability, playerId));
if (ability.activate(sim, false) && ability.isUsesStack()) {
game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability.getSourceId(), ability.getControllerId()));
}
sim.applyEffects();
SimulationNode2 newNode = new SimulationNode2(parent, sim, depth, playerId);
logger.debug("simulating -- node #:" + SimulationNode2.getCount() + " triggered ability option");
for (Target target : ability.getTargets()) {
for (UUID targetId : target.getTargets()) {
newNode.getTargets().add(targetId);
}
}
parent.children.add(newNode);
}
代码示例来源:origin: magefree/mage
if (ability.isUsesStack()) {
game.getStack().push(new StackAbility(ability, playerId));
if (ability.activate(game, false)) {
代码示例来源:origin: magefree/mage
@Override
public boolean triggerAbility(TriggeredAbility source, Game game) {
Ability ability = source.copy();
List<Ability> options = getPlayableOptions(ability, game);
if (options.isEmpty()) {
if (logger.isDebugEnabled())
logger.debug("simulating -- triggered ability:" + ability);
game.getStack().push(new StackAbility(ability, playerId));
if (ability.activate(game, false) && ability.isUsesStack()) {
game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability.getSourceId(), ability.getControllerId()));
}
game.applyEffects();
game.getPlayers().resetPassed();
}
else {
SimulationNode parent = (SimulationNode) game.getCustomData();
if (parent.getDepth() == maxDepth) return true;
logger.debug(indent(parent.getDepth()) + "simulating -- triggered ability - adding children:" + options.size());
for (Ability option: options) {
addAbilityNode(parent, option, game);
}
}
return true;
}
代码示例来源:origin: magefree/mage
@Override
public boolean triggerAbility(TriggeredAbility source, Game game) {
Ability ability = source.copy();
List<Ability> options = getPlayableOptions(ability, game);
if (options.isEmpty()) {
logger.debug("simulating -- triggered ability:" + ability);
game.getStack().push(new StackAbility(ability, playerId));
if (ability.activate(game, false) && ability.isUsesStack()) {
game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability.getSourceId(), ability.getControllerId()));
}
game.applyEffects();
game.getPlayers().resetPassed();
} else {
SimulationNode2 parent = (SimulationNode2) game.getCustomData();
int depth = parent.getDepth() - 1;
if (depth == 0) {
return true;
}
logger.debug("simulating -- triggered ability - adding children:" + options.size());
for (Ability option : options) {
addAbilityNode(parent, option, depth, game);
}
}
return true;
}
代码示例来源:origin: magefree/mage
continue;
if (!sim.checkIfGameIsOver() && action.isUsesStack()) {
代码示例来源:origin: magefree/mage
protected void addAbilityNode(SimulationNode parent, Ability ability, Game game) {
Game sim = game.copy();
sim.getStack().push(new StackAbility(ability, playerId));
ability.activate(sim, false);
if (ability.activate(sim, false) && ability.isUsesStack()) {
game.fireEvent(new GameEvent(GameEvent.EventType.TRIGGERED_ABILITY, ability.getId(), ability.getSourceId(), ability.getControllerId()));
}
sim.applyEffects();
SimulationNode newNode = new SimulationNode(parent, sim, playerId);
logger.debug(indent(newNode.getDepth()) + "simulating -- node #:" + SimulationNode.getCount() + " triggered ability option");
for (Target target: ability.getTargets()) {
for (UUID targetId: target.getTargets()) {
newNode.getTargets().add(targetId);
}
}
parent.children.add(newNode);
}
代码示例来源:origin: magefree/mage
if (test == null)
return false;
if (action.isUsesStack()) {
Game testSim = sim.copy();
StackObject ability = testSim.getStack().pop();
内容来源于网络,如有侵权,请联系作者删除!