Fixing saga implementation

Related to #4875, still need to rework how the SBA removes the saga with respect to the final trigger
This commit is contained in:
Evan Kranzler 2018-04-27 15:12:11 -04:00
parent 1583c3af08
commit 4ac6e7d86c
3 changed files with 72 additions and 59 deletions

View file

@ -25,11 +25,17 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.game.turn;
import java.util.UUID;
import mage.constants.PhaseStep;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
/**
*
@ -37,6 +43,12 @@ import mage.game.events.GameEvent.EventType;
*/
public class PreCombatMainStep extends Step {
private static final FilterPermanent filter = new FilterPermanent("Saga");
static {
filter.add(new SubtypePredicate(SubType.SAGA));
}
public PreCombatMainStep() {
super(PhaseStep.PRECOMBAT_MAIN, true);
this.stepEvent = EventType.PRECOMBAT_MAIN_STEP;
@ -48,6 +60,16 @@ public class PreCombatMainStep extends Step {
super(step);
}
@Override
public void beginStep(Game game, UUID activePlayerId) {
super.beginStep(game, activePlayerId);
for (Permanent saga : game.getBattlefield().getAllActivePermanents(filter, activePlayerId, game)) {
if (saga != null) {
saga.addCounters(CounterType.LORE.createInstance(), null, game);
}
}
}
@Override
public PreCombatMainStep copy() {
return new PreCombatMainStep(this);