merged with changes to tap and untap

master
beholder 2011-11-01 08:18:01 +01:00
commit 95193c483b
17 changed files with 27 additions and 43 deletions

View File

@ -47,9 +47,7 @@ public class Air_Servant {
final Object[] choiceResults) {
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
if (!creature.isTapped()) {
game.doAction(new MagicTapAction(creature,true));
}
game.doAction(new MagicTapAction(creature,true));
}
});
}

View File

@ -49,9 +49,7 @@ public class Avacynian_Priest {
final Object[] choiceResults) {
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
if (!creature.isTapped()) {
game.doAction(new MagicTapAction(creature,true));
}
game.doAction(new MagicTapAction(creature,true));
}
});
}

View File

@ -35,7 +35,7 @@ public class Backlash {
game.doAction(new MagicMoveCardAction((MagicCardOnStack)data[0]));
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
if (!creature.isTapped()) {
if (creature.isUntapped()) {
game.doAction(new MagicTapAction(creature,true));
final MagicDamage damage=new MagicDamage(creature,creature.getController(),creature.getPower(game),false);
game.doAction(new MagicDealDamageAction(damage));

View File

@ -39,7 +39,7 @@ public class Claustrophobia {
final Object[] choiceResults) {
final MagicPermanent permanent=(MagicPermanent)data[0];
final MagicPermanent enchantedCreature = permanent.getEnchantedCreature();
if (enchantedCreature.isValid() && !enchantedCreature.isTapped()) {
if (enchantedCreature.isValid()) {
game.doAction(new MagicTapAction(enchantedCreature,true));
}
}

View File

@ -101,9 +101,7 @@ public class Deathbringer_Liege {
if (MagicMayChoice.isYesChoice(choiceResults[0])) {
event.processTargetPermanent(game,choiceResults,1,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
if (!creature.isTapped()) {
game.doAction(new MagicTapAction(creature,true));
}
game.doAction(new MagicTapAction(creature,true));
}
});
}

View File

@ -43,9 +43,7 @@ public class Gustcloak_Cavalier {
if (MagicMayChoice.isYesChoice(choiceResults[0])) {
event.processTargetPermanent(game,choiceResults,1,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
if (!creature.isTapped()) {
game.doAction(new MagicTapAction(creature,true));
}
game.doAction(new MagicTapAction(creature,true));
}
});
}

View File

@ -11,7 +11,7 @@ public class Howling_Mine {
public static final MagicAtUpkeepTrigger T = new MagicAtUpkeepTrigger() {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer player) {
return (!permanent.isTapped()) ?
return (permanent.isUntapped()) ?
new MagicEvent(
permanent,
player,

View File

@ -49,9 +49,7 @@ public class Icy_Manipulator {
final Object[] choiceResults) {
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
public void doAction(final MagicPermanent permanent) {
if (!permanent.isTapped()) {
game.doAction(new MagicTapAction(permanent,true));
}
game.doAction(new MagicTapAction(permanent,true));
}
});
}

View File

@ -41,9 +41,7 @@ public class Kitsune_Dawnblade {
if (MagicMayChoice.isYesChoice(choiceResults[0])) {
event.processTargetPermanent(game,choiceResults,1,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
if (!creature.isTapped()) {
game.doAction(new MagicTapAction(creature,true));
}
game.doAction(new MagicTapAction(creature,true));
}
});
}

View File

@ -43,9 +43,7 @@ public class Merfolk_Seastalkers {
public void executeEvent(final MagicGame game,final MagicEvent event,final Object[] data,final Object[] choiceResults) {
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
if (!creature.isTapped()) {
game.doAction(new MagicTapAction(creature,true));
}
game.doAction(new MagicTapAction(creature,true));
}
});
}

View File

@ -42,9 +42,7 @@ public class Mind_Games {
final MagicCardOnStack cardOnStack = (MagicCardOnStack)data[0];
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
public void doAction(final MagicPermanent permanent) {
if (!permanent.isTapped()) {
game.doAction(new MagicTapAction(permanent,true));
}
game.doAction(new MagicTapAction(permanent,true));
}
});
if (MagicBuybackChoice.isYesChoice(choiceResults[1])) {

View File

@ -21,7 +21,7 @@ public class Narcolepsy {
@Override
public MagicEvent executeTrigger(final MagicGame game,final MagicPermanent permanent,final MagicPlayer data) {
final MagicPermanent enchantedCreature=permanent.getEnchantedCreature();
return (enchantedCreature.isValid() && !enchantedCreature.isTapped()) ?
return (enchantedCreature.isValid() && enchantedCreature.isUntapped()) ?
new MagicEvent(
permanent,
permanent.getController(),
@ -38,7 +38,7 @@ public class Narcolepsy {
final Object[] choiceResults) {
final MagicPermanent permanent=(MagicPermanent)data[0];
final MagicPermanent enchantedCreature=permanent.getEnchantedCreature();
if (enchantedCreature.isValid() && !enchantedCreature.isTapped()) {
if (enchantedCreature.isValid()) {
game.doAction(new MagicTapAction(enchantedCreature,true));
}
}

View File

@ -37,9 +37,7 @@ public class Sidar_Jabari {
final Object[] choiceResults) {
event.processTargetPermanent(game,choiceResults,0,new MagicPermanentAction() {
public void doAction(final MagicPermanent creature) {
if (!creature.isTapped()) {
game.doAction(new MagicTapAction(creature,true));
}
game.doAction(new MagicTapAction(creature,true));
}
});
}

View File

@ -48,9 +48,7 @@ public class Stun_Sniper {
public void doAction(final MagicPermanent creature) {
final MagicDamage damage=new MagicDamage((MagicPermanent)data[0],creature,1,false);
game.doAction(new MagicDealDamageAction(damage));
if (!creature.isTapped()) {
game.doAction(new MagicTapAction(creature,true));
}
game.doAction(new MagicTapAction(creature,true));
}
});
}

View File

@ -230,6 +230,10 @@ public class MagicPermanent implements MagicSource,MagicTarget,Comparable<MagicP
return hasState(MagicPermanentState.Tapped);
}
public boolean isUntapped() {
return !hasState(MagicPermanentState.Tapped);
}
@Override
public MagicColoredType getColoredType() {
return cardDefinition.getColoredType();

View File

@ -10,7 +10,7 @@ import magic.model.trigger.MagicTriggerType;
public class MagicTapAction extends MagicAction {
private final MagicPermanent permanent;
private boolean tap;
private boolean isUntapped;
private final boolean hasScore;
public MagicTapAction(final MagicPermanent permanent,final boolean hasScore) {
@ -20,8 +20,8 @@ public class MagicTapAction extends MagicAction {
@Override
public void doAction(final MagicGame game) {
tap=!permanent.hasState(MagicPermanentState.Tapped);
if (tap) {
isUntapped=!permanent.hasState(MagicPermanentState.Tapped);
if (isUntapped) {
permanent.setState(MagicPermanentState.Tapped);
if (hasScore) {
setScore(permanent.getController(),ArtificialScoringSystem.getTappedScore(permanent,game));
@ -33,7 +33,7 @@ public class MagicTapAction extends MagicAction {
@Override
public void undoAction(final MagicGame game) {
if (tap) {
if (isUntapped) {
permanent.clearState(MagicPermanentState.Tapped);
}
}

View File

@ -9,7 +9,7 @@ import magic.model.MagicPermanentState;
public class MagicUntapAction extends MagicAction {
private final MagicPermanent permanent;
private boolean untap;
private boolean isTapped;
public MagicUntapAction(final MagicPermanent permanent) {
this.permanent=permanent;
@ -17,8 +17,8 @@ public class MagicUntapAction extends MagicAction {
@Override
public void doAction(final MagicGame game) {
untap=permanent.hasState(MagicPermanentState.Tapped);
if (untap) {
isTapped=permanent.hasState(MagicPermanentState.Tapped);
if (isTapped) {
permanent.clearState(MagicPermanentState.Tapped);
setScore(permanent.getController(),-ArtificialScoringSystem.getTappedScore(permanent,game));
game.setStateCheckRequired();
@ -27,7 +27,7 @@ public class MagicUntapAction extends MagicAction {
@Override
public void undoAction(final MagicGame game) {
if (untap) {
if (isTapped) {
permanent.setState(MagicPermanentState.Tapped);
}
}