mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +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);
|
||||
if (!game.replaceEvent(numberOfTriggersEvent)) {
|
||||
for (int i = 0; i < numberOfTriggersEvent.getAmount(); i++) {
|
||||
|
|
|
@ -111,12 +111,12 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
|
|||
@Override
|
||||
public boolean checkUsedAlready(Game game) {
|
||||
if (!doOnlyOnce) {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
Integer lastTurnUsed = (Integer) game.getState().getValue(
|
||||
CardUtil.getCardZoneString("lastTurnUsed" + originalId, sourceId, game)
|
||||
);
|
||||
return lastTurnUsed == null || lastTurnUsed != game.getTurnNum();
|
||||
return lastTurnUsed != null && lastTurnUsed == game.getTurnNum();
|
||||
}
|
||||
|
||||
public TriggeredAbility setDoOnlyOnce(boolean doOnlyOnce) {
|
||||
|
@ -139,6 +139,7 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
|
|||
MageObject object = game.getObject(getSourceId());
|
||||
Player player = game.getPlayer(this.getControllerId());
|
||||
if (player == null || object == null
|
||||
|| (doOnlyOnce && checkUsedAlready(game))
|
||||
|| !player.chooseUse(
|
||||
getEffects().getOutcome(this),
|
||||
this.getRule(object.getLogName()), this, game
|
||||
|
|
Loading…
Reference in a new issue