* Skarrgan Firebird - Fixed that the condtion check of the activated ability was inverted.

This commit is contained in:
LevelX2 2015-05-29 00:18:51 +02:00
parent 4d6e7ce6a2
commit 5a5722b248
9 changed files with 145 additions and 64 deletions

View file

@ -88,7 +88,7 @@ class OpponentWasDealtDamageCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
BloodthirstWatcher watcher = (BloodthirstWatcher) game.getState().getWatchers().get("DamagedOpponents", source.getControllerId());
return !watcher.conditionMet();
return watcher.conditionMet();
}
@Override

View file

@ -48,6 +48,8 @@ public class Bonesplitter extends CardImpl {
super(ownerId, 146, "Bonesplitter", Rarity.COMMON, new CardType[]{CardType.ARTIFACT}, "{1}");
this.expansionSetCode = "MRD";
this.subtype.add("Equipment");
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 0)));
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1)));
}

View file

@ -1,51 +1,49 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.mage.test.cards.abilities.activated;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class PutOntoBattlefieldTest extends CardTestPlayerBase {
/**
* Tests to put a token onto the battlefield
*/
@Test
public void testOozeFlux() {
// Enchantment
// {1}{G}, Remove one or more +1/+1 counters from among creatures you control: Put an X/X green Ooze creature token onto the battlefield, where X is the number of +1/+1 counters removed this way.
addCard(Zone.BATTLEFIELD, playerA, "Ooze Flux");
// Trample
// Kalonian Hydra enters the battlefield with four +1/+1 counters on it.
// Whenever Kalonian Hydra attacks, double the number of +1/+1 counters on each creature you control.
addCard(Zone.BATTLEFIELD, playerA, "Kalonian Hydra");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{G},");
setChoice(playerA, "X=2"); // Remove how many
setChoice(playerA,"Kalonian Hydra");
setChoice(playerA, "X=2"); // Remove from Hydra
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, "Kalonian Hydra", 2, 2);
assertPermanentCount(playerA, "Ooze", 1);
assertPowerToughness(playerA, "Ooze", 2, 2);
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.mage.test.cards.abilities.activated;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class PutOntoBattlefieldTest extends CardTestPlayerBase {
/**
* Tests to put a token onto the battlefield
*/
@Test
public void testOozeFlux() {
// Enchantment
// {1}{G}, Remove one or more +1/+1 counters from among creatures you control: Put an X/X green Ooze creature token onto the battlefield, where X is the number of +1/+1 counters removed this way.
addCard(Zone.BATTLEFIELD, playerA, "Ooze Flux");
// Trample
// Kalonian Hydra enters the battlefield with four +1/+1 counters on it.
// Whenever Kalonian Hydra attacks, double the number of +1/+1 counters on each creature you control.
addCard(Zone.BATTLEFIELD, playerA, "Kalonian Hydra");
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{G},");
setChoice(playerA, "X=2"); // Remove how many
setChoice(playerA,"Kalonian Hydra");
setChoice(playerA, "X=2"); // Remove from Hydra
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPowerToughness(playerA, "Kalonian Hydra", 2, 2);
assertPermanentCount(playerA, "Ooze", 1);
assertPowerToughness(playerA, "Ooze", 2, 2);
}
}

View file

@ -0,0 +1,78 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package org.mage.test.cards.abilities.activated;
import mage.abilities.keyword.BloodthirstAbility;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class ReturnToHandTest extends CardTestPlayerBase {
/**
* Tests to put a token onto the battlefield
*/
@Test
public void SkarrganFirebirdTest() {
addCard(Zone.BATTLEFIELD, playerA, "Pillarfield Ox");
// Bloodthirst 3
// Flying
// {R}{R}{R}: Return Skarrgan Firebird from your graveyard to your hand. Activate this ability only if an opponent was dealt damage this turn.
addCard(Zone.BATTLEFIELD, playerB, "Skarrgan Firebird");
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2);
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3);
addCard(Zone.HAND, playerB, "Bone Splinters");
// As an additional cost to cast Bone Splinters, sacrifice a creature.
// Destroy target creature.
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Bone Splinters", "Pillarfield Ox");
setChoice(playerB, "Skarrgan Firebird");
attack(2, playerB, "Silvercoat Lion");
activateAbility(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "{R}{R}{R}: Return");
setStopAt(2, PhaseStep.END_TURN);
execute();
assertPermanentCount(playerA, "Skarrgan Firebird", 0);
assertGraveyardCount(playerA, "Pillarfield Ox", 1);
assertGraveyardCount(playerB, "Bone Splinters", 1);
assertHandCount(playerB, "Skarrgan Firebird", 1);
}
}

View file

@ -48,7 +48,7 @@ public class BloodthirstAbility extends EntersBattlefieldAbility {
}
class BloodthirstEffect extends OneShotEffect {
private int amount;
private final int amount;
BloodthirstEffect(int amount) {
super(Outcome.BoostCreature);

View file

@ -30,7 +30,6 @@ package mage.game;
import java.io.IOException;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
@ -118,7 +117,9 @@ import mage.target.Target;
import mage.target.TargetPermanent;
import mage.target.TargetPlayer;
import mage.util.functions.ApplyToPermanent;
import mage.watchers.Watchers;
import mage.watchers.common.BlockedAttackerWatcher;
import mage.watchers.common.BloodthirstWatcher;
import mage.watchers.common.CastSpellLastTurnWatcher;
import mage.watchers.common.MorbidWatcher;
import mage.watchers.common.PlayerDamagedBySourceWatcher;
@ -884,15 +885,17 @@ public abstract class GameImpl implements Game, Serializable {
saveState(false);
} while (!mulliganPlayers.isEmpty());
getState().setChoosingPlayerId(null);
// add watchers
Watchers watchers = state.getWatchers();
// add default watchers
for (UUID playerId : state.getPlayerList(startingPlayerId)) {
state.getWatchers().add(new PlayerDamagedBySourceWatcher(playerId));
watchers.add(new PlayerDamagedBySourceWatcher(playerId));
watchers.add(new BloodthirstWatcher(playerId));
}
state.getWatchers().add(new MorbidWatcher());
state.getWatchers().add(new CastSpellLastTurnWatcher());
state.getWatchers().add(new SoulbondWatcher());
state.getWatchers().add(new PlayerLostLifeWatcher());
state.getWatchers().add(new BlockedAttackerWatcher());
watchers.add(new MorbidWatcher());
watchers.add(new CastSpellLastTurnWatcher());
watchers.add(new SoulbondWatcher());
watchers.add(new PlayerLostLifeWatcher());
watchers.add(new BlockedAttackerWatcher());
//20100716 - 103.5
for (UUID playerId: state.getPlayerList(startingPlayerId)) {

View file

@ -444,7 +444,7 @@ public abstract class PlayerImpl implements Player, Serializable {
this.payManaMode = false;
this.setLife(game.getLife(), game);
this.setReachedNextTurnAfterLeaving(false);
game.getState().getWatchers().add(new BloodthirstWatcher(playerId));
this.castSourceIdWithAlternateMana = null;
this.castSourceIdManaCosts = null;
}

View file

@ -65,9 +65,9 @@ public class AmountOfDamageAPlayerReceivedThisTurnWatcher extends Watcher {
if (playerId != null) {
Integer amount = amountOfDamageReceivedThisTurn.get(playerId);
if (amount == null) {
amount = Integer.valueOf(event.getAmount());
amount = event.getAmount();
} else {
amount = Integer.valueOf(amount + event.getAmount());
amount = amount + event.getAmount();
}
amountOfDamageReceivedThisTurn.put(playerId, amount);
}

View file

@ -44,7 +44,7 @@ import java.util.UUID;
*/
public class SourceDidDamageWatcher extends Watcher {
public List<UUID> damageSources = new ArrayList<UUID>();
public List<UUID> damageSources = new ArrayList<>();
public SourceDidDamageWatcher() {
super("SourceDidDamageWatcher", WatcherScope.GAME);