mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Fix doOnlyOnce clause on triggered abilities
This commit is contained in:
parent
242490373e
commit
2b77d53f81
2 changed files with 4 additions and 3 deletions
|
@ -91,7 +91,7 @@ public class TriggeredAbilities extends ConcurrentHashMap<String, TriggeredAbili
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ability.checkTrigger(event, game) && ability.checkTriggeredAlready(game) && ability.checkUsedAlready(game)) {
|
if (ability.checkTrigger(event, game) && ability.checkTriggeredAlready(game) && !ability.checkUsedAlready(game)) {
|
||||||
NumberOfTriggersEvent numberOfTriggersEvent = new NumberOfTriggersEvent(ability, event);
|
NumberOfTriggersEvent numberOfTriggersEvent = new NumberOfTriggersEvent(ability, event);
|
||||||
if (!game.replaceEvent(numberOfTriggersEvent)) {
|
if (!game.replaceEvent(numberOfTriggersEvent)) {
|
||||||
for (int i = 0; i < numberOfTriggersEvent.getAmount(); i++) {
|
for (int i = 0; i < numberOfTriggersEvent.getAmount(); i++) {
|
||||||
|
|
|
@ -111,12 +111,12 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
|
||||||
@Override
|
@Override
|
||||||
public boolean checkUsedAlready(Game game) {
|
public boolean checkUsedAlready(Game game) {
|
||||||
if (!doOnlyOnce) {
|
if (!doOnlyOnce) {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
Integer lastTurnUsed = (Integer) game.getState().getValue(
|
Integer lastTurnUsed = (Integer) game.getState().getValue(
|
||||||
CardUtil.getCardZoneString("lastTurnUsed" + originalId, sourceId, game)
|
CardUtil.getCardZoneString("lastTurnUsed" + originalId, sourceId, game)
|
||||||
);
|
);
|
||||||
return lastTurnUsed == null || lastTurnUsed != game.getTurnNum();
|
return lastTurnUsed != null && lastTurnUsed == game.getTurnNum();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TriggeredAbility setDoOnlyOnce(boolean doOnlyOnce) {
|
public TriggeredAbility setDoOnlyOnce(boolean doOnlyOnce) {
|
||||||
|
@ -139,6 +139,7 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
|
||||||
MageObject object = game.getObject(getSourceId());
|
MageObject object = game.getObject(getSourceId());
|
||||||
Player player = game.getPlayer(this.getControllerId());
|
Player player = game.getPlayer(this.getControllerId());
|
||||||
if (player == null || object == null
|
if (player == null || object == null
|
||||||
|
|| (doOnlyOnce && checkUsedAlready(game))
|
||||||
|| !player.chooseUse(
|
|| !player.chooseUse(
|
||||||
getEffects().getOutcome(this),
|
getEffects().getOutcome(this),
|
||||||
this.getRule(object.getLogName()), this, game
|
this.getRule(object.getLogName()), this, game
|
||||||
|
|
Loading…
Reference in a new issue