added MagicFadeVanishCounterTrigger. added Aven Riftwatcher and Blastoderm

master
beholder 2011-10-14 12:44:48 +02:00
parent ee2b504591
commit da9140d001
4 changed files with 161 additions and 0 deletions

View File

@ -15333,3 +15333,31 @@ cost={1}{W}
pt=1/2
ability=vigilance
timing=main
>Aven Riftwatcher
url=http://magiccards.info/pc/en/1.html
image=http://magiccards.info/scans/en/pc/1.jpg
value=3
rarity=C
type=Creature
subtype=Bird,Rebel,Soldier
color=w
converted=3
cost={2}{W}
pt=2/3
ability=flying
timing=main
>Blastoderm
url=http://magiccards.info/gvl/en/7.html
image=http://magiccards.info/scans/en/gvl/7.jpg
value=4
rarity=C
type=Creature
subtype=Beast
color=g
converted=4
cost={2}{G}{G}
pt=5/5
ability=shroud
timing=main

View File

@ -0,0 +1,61 @@
package magic.card;
import magic.model.MagicCounterType;
import magic.model.MagicGame;
import magic.model.MagicPermanent;
import magic.model.MagicPlayer;
import magic.model.action.MagicChangeLifeAction;
import magic.model.event.MagicEvent;
import magic.model.trigger.MagicComesIntoPlayWithCounterTrigger;
import magic.model.trigger.MagicFadeVanishCounterTrigger;
import magic.model.trigger.MagicWhenComesIntoPlayTrigger;
import magic.model.trigger.MagicWhenLeavesPlayTrigger;
public class Aven_Riftwatcher {
public static final MagicComesIntoPlayWithCounterTrigger T1 =
new MagicComesIntoPlayWithCounterTrigger(MagicCounterType.Charge,"time",2);
public static final MagicWhenComesIntoPlayTrigger T2 = new MagicWhenComesIntoPlayTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPlayer player) {
return new MagicEvent(
permanent,
player,
new Object[]{player},
this,
player + " gains 2 life.");
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object data[],
final Object[] choiceResults) {
game.doAction(new MagicChangeLifeAction((MagicPlayer)data[0],2));
}
};
public static final MagicWhenLeavesPlayTrigger T3 = new MagicWhenLeavesPlayTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPermanent data) {
final MagicPlayer player = permanent.getController();
return (permanent == data) ?
new MagicEvent(
permanent,
player,
new Object[]{player},
this,
player + " gains 2 life.") :
MagicEvent.NONE;
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object data[],
final Object[] choiceResults) {
game.doAction(new MagicChangeLifeAction((MagicPlayer)data[0],2));
}
};
public static final MagicFadeVanishCounterTrigger T4 = new MagicFadeVanishCounterTrigger("time");
}

View File

@ -0,0 +1,12 @@
package magic.card;
import magic.model.MagicCounterType;
import magic.model.trigger.MagicComesIntoPlayWithCounterTrigger;
import magic.model.trigger.MagicFadeVanishCounterTrigger;
public class Blastoderm {
public static final MagicComesIntoPlayWithCounterTrigger T1 =
new MagicComesIntoPlayWithCounterTrigger(MagicCounterType.Charge,"fade",3);
public static final MagicFadeVanishCounterTrigger T2 = new MagicFadeVanishCounterTrigger("fade");
}

View File

@ -0,0 +1,60 @@
package magic.model.trigger;
import magic.model.MagicCounterType;
import magic.model.MagicGame;
import magic.model.MagicPermanent;
import magic.model.MagicPlayer;
import magic.model.action.MagicChangeCountersAction;
import magic.model.action.MagicSacrificeAction;
import magic.model.event.MagicEvent;
public class MagicFadeVanishCounterTrigger extends MagicAtUpkeepTrigger {
private final String counterType;
public MagicFadeVanishCounterTrigger(final String counterType) {
this.counterType = counterType;
}
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent, final MagicPlayer data) {
final MagicPlayer player = permanent.getController();
if (player == data) {
boolean sacrifice = false;
final int amount = permanent.getCounters(MagicCounterType.Charge);
if (counterType == "fade") {
sacrifice = amount == 0;
} else if (amount == 1){
sacrifice = true;
game.doAction(new MagicChangeCountersAction(permanent,MagicCounterType.Charge,-1,true));
}
return new MagicEvent(
permanent,
player,
new Object[]{permanent,sacrifice},
this,
sacrifice ?
player + " sacrifices " + permanent + "." :
player + " removes a " + counterType + " counter from " + permanent + ".");
}
return MagicEvent.NONE;
}
@Override
public void executeEvent(
final MagicGame game,
final MagicEvent event,
final Object data[],
final Object[] choiceResults) {
final boolean sacrifice = (Boolean)data[1];
if (sacrifice) {
game.doAction(new MagicSacrificeAction((MagicPermanent)data[0]));
} else {
game.doAction(new MagicChangeCountersAction(
(MagicPermanent)data[0],
MagicCounterType.Charge,
-1,
true));
}
}
}