mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
fixed Barren Glory not triggering properly
This commit is contained in:
parent
376aaa19d5
commit
44d0022d14
1 changed files with 17 additions and 54 deletions
|
@ -28,36 +28,41 @@
|
||||||
package mage.cards.b;
|
package mage.cards.b;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.TriggeredAbility;
|
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.condition.CompoundCondition;
|
||||||
import mage.abilities.condition.Condition;
|
|
||||||
import mage.abilities.condition.common.CardsInHandCondition;
|
import mage.abilities.condition.common.CardsInHandCondition;
|
||||||
|
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||||
import mage.abilities.effects.common.WinGameSourceControllerEffect;
|
import mage.abilities.effects.common.WinGameSourceControllerEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.ComparisonType;
|
import mage.constants.ComparisonType;
|
||||||
import mage.constants.Zone;
|
import mage.constants.TargetController;
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.common.FilterControlledPermanent;
|
||||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.game.events.GameEvent;
|
|
||||||
import mage.game.events.GameEvent.EventType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author fireshoes
|
* @author fireshoes
|
||||||
*/
|
*/
|
||||||
public class BarrenGlory extends CardImpl {
|
public class BarrenGlory extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterControlledPermanent filter = new FilterControlledPermanent();
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(new AnotherPredicate());
|
||||||
|
}
|
||||||
|
|
||||||
public BarrenGlory(UUID ownerId, CardSetInfo setInfo) {
|
public BarrenGlory(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}{W}");
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}{W}");
|
||||||
|
|
||||||
// At the beginning of your upkeep, if you control no permanents other than Barren Glory and have no cards in hand, you win the game.
|
// At the beginning of your upkeep, if you control no permanents other than Barren Glory and have no cards in hand, you win the game.
|
||||||
Condition condition = new CardsInHandCondition(ComparisonType.EQUAL_TO, 0);
|
this.addAbility(new ConditionalTriggeredAbility(
|
||||||
TriggeredAbility ability = new BarrenGloryTriggeredAbility();
|
new BeginningOfUpkeepTriggeredAbility(new WinGameSourceControllerEffect(), TargetController.YOU, false),
|
||||||
this.addAbility(new ConditionalTriggeredAbility(ability,
|
new CompoundCondition(
|
||||||
condition,
|
new CardsInHandCondition(ComparisonType.EQUAL_TO, 0),
|
||||||
|
new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.EQUAL_TO, 0)
|
||||||
|
),
|
||||||
"At the beginning of your upkeep, if you control no permanents other than {this} and have no cards in hand, you win the game"));
|
"At the beginning of your upkeep, if you control no permanents other than {this} and have no cards in hand, you win the game"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,45 +75,3 @@ public class BarrenGlory extends CardImpl {
|
||||||
return new BarrenGlory(this);
|
return new BarrenGlory(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BarrenGloryTriggeredAbility extends TriggeredAbilityImpl {
|
|
||||||
|
|
||||||
private static final FilterPermanent filter = new FilterPermanent();
|
|
||||||
|
|
||||||
static {
|
|
||||||
filter.add(new AnotherPredicate());
|
|
||||||
}
|
|
||||||
|
|
||||||
BarrenGloryTriggeredAbility() {
|
|
||||||
super(Zone.BATTLEFIELD, new WinGameSourceControllerEffect());
|
|
||||||
}
|
|
||||||
|
|
||||||
BarrenGloryTriggeredAbility(final BarrenGloryTriggeredAbility ability) {
|
|
||||||
super(ability);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BarrenGloryTriggeredAbility copy() {
|
|
||||||
return new BarrenGloryTriggeredAbility(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkEventType(GameEvent event, Game game) {
|
|
||||||
return event.getType() == EventType.UPKEEP_STEP_PRE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
|
||||||
if (event.getPlayerId().equals(this.controllerId)) {
|
|
||||||
if (game.getBattlefield().count(filter, this.getSourceId(), this.getControllerId(), game) == 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getRule() {
|
|
||||||
return "At the beginning of your upkeep, if you control no permanents other than {this} and have no cards in hand, you win the game";
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue