mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
Fix Grimgrin, Corpse Born
This commit is contained in:
parent
d91147f01a
commit
80cc908216
1 changed files with 18 additions and 54 deletions
|
@ -1,10 +1,8 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldTappedAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
|
@ -21,19 +19,23 @@ import mage.constants.Zone;
|
|||
import mage.counters.CounterType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.filter.predicate.permanent.DefendingPlayerControlsPredicate;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
* @author North, xenohedron
|
||||
*/
|
||||
public final class GrimgrinCorpseBorn extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
|
||||
|
||||
static {
|
||||
filter.add(DefendingPlayerControlsPredicate.instance);
|
||||
}
|
||||
|
||||
public GrimgrinCorpseBorn(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{B}");
|
||||
this.supertype.add(SuperType.LEGENDARY);
|
||||
|
@ -51,11 +53,15 @@ public final class GrimgrinCorpseBorn extends CardImpl {
|
|||
|
||||
// Sacrifice another creature: Untap Grimgrin and put a +1/+1 counter on it.
|
||||
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UntapSourceEffect(),
|
||||
new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, false)));
|
||||
ability.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance()));
|
||||
new SacrificeTargetCost(new TargetControlledCreaturePermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE)));
|
||||
ability.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance()).setText("and put a +1/+1 counter on it"));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Whenever Grimgrin attacks, destroy target creature defending player controls, then put a +1/+1 counter on Grimgrin.
|
||||
this.addAbility(new GrimgrinCorpseBornAbility());
|
||||
ability = new AttacksTriggeredAbility(new DestroyTargetEffect());
|
||||
ability.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance()).concatBy(", then"));
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private GrimgrinCorpseBorn(final GrimgrinCorpseBorn card) {
|
||||
|
@ -67,45 +73,3 @@ public final class GrimgrinCorpseBorn extends CardImpl {
|
|||
return new GrimgrinCorpseBorn(this);
|
||||
}
|
||||
}
|
||||
|
||||
class GrimgrinCorpseBornAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public GrimgrinCorpseBornAbility() {
|
||||
super(Zone.BATTLEFIELD, new DestroyTargetEffect());
|
||||
this.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance()));
|
||||
}
|
||||
|
||||
public GrimgrinCorpseBornAbility(final GrimgrinCorpseBornAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ATTACKER_DECLARED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getSourceId().equals(this.getSourceId())) {
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
|
||||
UUID defenderId = game.getCombat().getDefenderId(sourceId);
|
||||
filter.add(new ControllerIdPredicate(defenderId));
|
||||
|
||||
this.getTargets().clear();
|
||||
TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
|
||||
this.addTarget(target);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever {this} attacks, destroy target creature defending player controls, then put a +1/+1 counter on {this}.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public GrimgrinCorpseBornAbility copy() {
|
||||
return new GrimgrinCorpseBornAbility(this);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue