mirror of
https://github.com/correl/mage.git
synced 2025-04-10 17:00:08 -09:00
Merge pull request #2 from SpikesCafe-google/SpikesCafe-google-reyhan
Fix Reyhan death trigger (fixes #4055)
This commit is contained in:
commit
57a9c04032
1 changed files with 24 additions and 12 deletions
|
@ -108,19 +108,31 @@ class ReyhanLastOfTheAbzanTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if ((((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD || ((ZoneChangeEvent) event).getToZone() == Zone.COMMAND)
|
ZoneChangeEvent zcEvent = (ZoneChangeEvent) event;
|
||||||
&& ((ZoneChangeEvent) event).getFromZone() == Zone.BATTLEFIELD) {
|
// Dies or is put in the command zone
|
||||||
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
|
if (zcEvent.getFromZone() != Zone.BATTLEFIELD) {
|
||||||
if (permanent.getControllerId().equals(this.getControllerId()) && permanent.isCreature()) {
|
return false;
|
||||||
int countersOn = permanent.getCounters(game).getCount(CounterType.P1P1);
|
|
||||||
if (countersOn > 0) {
|
|
||||||
this.getEffects().clear();
|
|
||||||
this.addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance(countersOn)));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
if (zcEvent.getToZone() != Zone.GRAVEYARD && zcEvent.getToZone() != Zone.COMMAND) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
|
||||||
|
// A creature you control
|
||||||
|
if (!permanent.getControllerId().equals(this.getControllerId()) || !permanent.isCreature()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If it had one or more +1/+1 counters on it
|
||||||
|
int countersOn = permanent.getCounters(game).getCount(CounterType.P1P1);
|
||||||
|
if (countersOn == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// You may put that may +1/+1 counters on target creature
|
||||||
|
this.getEffects().clear();
|
||||||
|
this.addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance(countersOn)));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue