Merge pull request #831 from FenrisulfrX/fixes

Fixes Phyrexian Totem
This commit is contained in:
LevelX2 2015-03-25 21:35:08 +01:00
commit 9b29e72e82
8 changed files with 27 additions and 21 deletions

View file

@ -31,7 +31,7 @@ import java.util.UUID;
/** /**
* *
* @author anonymous * @author FenrisulfrX
*/ */
public class PhyrexianBattleflies extends mage.sets.phyrexiavsthecoalition.PhyrexianBattleflies { public class PhyrexianBattleflies extends mage.sets.phyrexiavsthecoalition.PhyrexianBattleflies {

View file

@ -31,7 +31,7 @@ import java.util.UUID;
/** /**
* *
* @author anonymous * @author FenrisulfrX
*/ */
public class PhyrexianColossus extends mage.sets.eighthedition.PhyrexianColossus { public class PhyrexianColossus extends mage.sets.eighthedition.PhyrexianColossus {

View file

@ -31,7 +31,7 @@ import java.util.UUID;
/** /**
* *
* @author anonymous * @author FenrisulfrX
*/ */
public class PhyrexianProcessor extends mage.sets.urzassaga.PhyrexianProcessor { public class PhyrexianProcessor extends mage.sets.urzassaga.PhyrexianProcessor {

View file

@ -37,7 +37,6 @@ import mage.abilities.effects.common.SacrificeEffect;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect; import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.TrampleAbility;
import mage.abilities.mana.BlackManaAbility; import mage.abilities.mana.BlackManaAbility;
import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
@ -46,8 +45,8 @@ import mage.constants.Zone;
import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterControlledPermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token; import mage.game.permanent.token.Token;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTarget;
/** /**
@ -80,7 +79,7 @@ public class PhyrexianTotem extends CardImpl {
private class PhyrexianTotemToken extends Token { private class PhyrexianTotemToken extends Token {
PhyrexianTotemToken() { PhyrexianTotemToken() {
super("", "a 5/5 black Horror artifact creature with trample"); super("Horror", "a 5/5 black Horror artifact creature with trample");
cardType.add(CardType.ARTIFACT); cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE); cardType.add(CardType.CREATURE);
color.setBlack(true); color.setBlack(true);
@ -107,20 +106,27 @@ class PhyrexianTotemTriggeredAbility extends TriggeredAbilityImpl {
return new PhyrexianTotemTriggeredAbility(this); return new PhyrexianTotemTriggeredAbility(this);
} }
@Override
public boolean checkInterveningIfClause(Game game) {
Permanent permanent = game.getPermanentOrLKIBattlefield(getSourceId());
if (permanent != null) {
return permanent.getCardType().contains(CardType.CREATURE);
}
return false;
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_CREATURE;
}
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if(event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.sourceId)) { if (event.getTargetId().equals(getSourceId())) {
UUID controller = game.getControllerId(event.getTargetId()); getEffects().get(0).setTargetPointer(new FixedTarget(getControllerId()));
if(controller != null) {
Player player = game.getPlayer(controller);
Card card = game.getCard(event.getSourceId());
if(player != null && card.getCardType().contains(CardType.CREATURE)) {
getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
((SacrificeEffect) getEffects().get(0)).setAmount(new StaticValue(event.getAmount())); ((SacrificeEffect) getEffects().get(0)).setAmount(new StaticValue(event.getAmount()));
return true; return true;
} }
}
}
return false; return false;
} }

View file

@ -31,7 +31,7 @@ import java.util.UUID;
/** /**
* *
* @author anonymous * @author FenrisulfrX
*/ */
public class PhyrexianColossus extends mage.sets.eighthedition.PhyrexianColossus { public class PhyrexianColossus extends mage.sets.eighthedition.PhyrexianColossus {

View file

@ -31,7 +31,7 @@ import java.util.UUID;
/** /**
* *
* @author anonymous * @author FenrisulfrX
*/ */
public class HornetCannon extends mage.sets.phyrexiavsthecoalition.HornetCannon { public class HornetCannon extends mage.sets.phyrexiavsthecoalition.HornetCannon {

View file

@ -31,7 +31,7 @@ import java.util.UUID;
/** /**
* *
* @author anonymous * @author FenrisulfrX
*/ */
public class PhyrexianTotem extends mage.sets.phyrexiavsthecoalition.PhyrexianTotem { public class PhyrexianTotem extends mage.sets.phyrexiavsthecoalition.PhyrexianTotem {

View file

@ -31,7 +31,7 @@ import java.util.UUID;
/** /**
* *
* @author anonymous * @author FenrisulfrX
*/ */
public class PhyrexianColossus extends mage.sets.eighthedition.PhyrexianColossus { public class PhyrexianColossus extends mage.sets.eighthedition.PhyrexianColossus {