Fixes to Azor's Elocutors, Street Sweeper and Treefolk Mystic

This commit is contained in:
LevelX2 2012-10-16 01:19:26 +02:00
parent bd60011f60
commit 3c49bdb4b3
3 changed files with 50 additions and 6 deletions

View file

@ -34,14 +34,17 @@ import mage.Constants.Rarity;
import mage.Constants.TargetController;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.RemoveCounterSourceEffect;
import mage.cards.CardImpl;
import mage.counters.Counter;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
@ -61,7 +64,7 @@ public class AzorsElocutors extends CardImpl<AzorsElocutors> {
this.toughness = new MageInt(5);
// At the beginning of your upkeep, put a filibuster counter on Azor's Elocutors. Then if Azor's Elocutors has five or more filibuster counters on it, you win the game.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(new Counter("filibuster",1)), TargetController.YOU, false));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new AzorsElocutorsEffect(), TargetController.YOU, false));
// Whenever a source deals damage to you, remove a filibuster counter from Azor's Elocutors.
this.addAbility(new AzorsElocutorsTriggeredAbility());
@ -106,3 +109,36 @@ class AzorsElocutorsTriggeredAbility extends TriggeredAbilityImpl<AzorsElocutors
}
}
class AzorsElocutorsEffect extends OneShotEffect<AzorsElocutorsEffect> {
public AzorsElocutorsEffect() {
super(Constants.Outcome.Benefit);
}
public AzorsElocutorsEffect(final AzorsElocutorsEffect effect) {
super(effect);
staticText = "put a filibuster counter on Azor's Elocutors. Then if Azor's Elocutors has five or more filibuster counters on it, you win the game";
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.addCounters(new Counter("filibuster",1), game);
if (permanent.getCounters().getCount("filibuster") > 4) {
Player player = game.getPlayer(permanent.getControllerId());
if (player != null) {
player.won(game);
}
}
return true;
}
return false;
}
@Override
public AzorsElocutorsEffect copy() {
return new AzorsElocutorsEffect(this);
}
}

View file

@ -27,6 +27,8 @@
*/
package mage.sets.returntoravnica;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
@ -102,12 +104,14 @@ class StreetSweeperDestroyEffect extends OneShotEffect<StreetSweeperDestroyEffec
Permanent permanent = game.getPermanent(source.getFirstTarget());
if(permanent != null)
{
for(UUID uuid : permanent.getAttachments())
LinkedList<UUID> attachments = new LinkedList();
attachments.addAll(permanent.getAttachments());
for(UUID uuid : attachments)
{
Permanent aura = game.getPermanent(uuid);
if(aura != null && aura.getSubtype().contains("Aura"))
{
permanent.destroy(source.getSourceId(), game, false);
aura.destroy(source.getSourceId(), game, false);
}
}
return true;

View file

@ -27,6 +27,8 @@
*/
package mage.sets.urzaslegacy;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
@ -93,12 +95,14 @@ class TreefolkMysticEffect extends OneShotEffect<TreefolkMysticEffect> {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if(permanent != null)
{
for(UUID uuid : permanent.getAttachments())
LinkedList<UUID> attachments = new LinkedList();
attachments.addAll(permanent.getAttachments());
for(UUID uuid : attachments)
{
Permanent aura = game.getPermanent(uuid);
if(aura != null && aura.getSubtype().contains("Aura"))
{
permanent.destroy(source.getId(), game, false);
aura.destroy(source.getId(), game, false);
}
}
}