Update AvenShrine.java

This commit is contained in:
cbt33 2013-08-25 01:58:06 -04:00
parent a31a92995b
commit 2b030366da

View file

@ -1,7 +1,12 @@
package mage.sets.odyssey
import mage.card.CardImpl;
import
import mage.constants.Rarity;
import mage.constants.CardType;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.GainLifeTriggeredEffect;
import java.util.UUID
@ -11,11 +16,12 @@ public class AvenShrine extends CardImpl<AvenShrine> {
public AvenShrine(ownerID UUID){
super(ownerID, 9, "Aven Shrine", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{W}");
this.ExpansionSetCode = "ODY";
this.color.setWhite(true);
// Whenever a player casts a spell, that player gains X life,
// where X is the number of cards in all graveyards with the same name as that spell.
this.addAbility = new(AvenShrineAbility());
this.addAbility = new AvenShrineAbility() ;
}
@ -34,7 +40,7 @@ public class AvenShrineAbility extends TriggeredAbilityImpl<AvenShrineAbility> {
public AvenShrineAbility(){
super(Zone.BATTLEFILED, new GainLifeEffect(new CardsInAllGraveyardCount(filter)), true);
super(Zone.BATTLEFIELD, new GainLifeTargetEffect(new CardsInAllGraveyardCount(filter)), false);
}
public AvenShrineAbility(final AvenShrineAbility ability) {
@ -46,15 +52,24 @@ public class AvenShrineAbility extends TriggeredAbilityImpl<AvenShrineAbility> {
return new AngelsFeatherAbility(this);
}
// I don't know if you can use the filter before it is declared nor if the code as written will correctly count
// all of the cards with the same name as the spell just cast that are in all graveyards.
public boolean checkTrigger(GameEvent event, Game game) {
if (event.GetType == EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetID())
String cardName = game.getStack().getSpell(event.getName());
FilterCard filter = FilterCard(cardName);
if (CardsInAllGraveyardCount(filter) != 0) {
return true;
if (CardsInAllGraveyardCount(filter) != 0) {
if (spell != null) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(spell.getControllerId()));
}
return true;
}
}
return true;
}
return false;
}
}