mirror of
https://github.com/correl/mage.git
synced 2025-01-11 11:05:23 +00:00
* Putrid Imp - Fixed that the can't block restriction did not work correctly.
This commit is contained in:
parent
67114c40a0
commit
15389b24d8
3 changed files with 109 additions and 9 deletions
|
@ -35,6 +35,8 @@ import mage.abilities.common.SimpleStaticAbility;
|
|||
import mage.abilities.condition.common.CardsInControllerGraveCondition;
|
||||
import mage.abilities.costs.common.DiscardCardCost;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.decorator.ConditionalRestrictionEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.combat.CantBlockSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
|
@ -57,7 +59,6 @@ public class PutridImp extends CardImpl {
|
|||
this.subtype.add("Zombie");
|
||||
this.subtype.add("Imp");
|
||||
|
||||
this.color.setBlack(true);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
|
@ -68,8 +69,9 @@ public class PutridImp extends CardImpl {
|
|||
new BoostSourceEffect(1, 1, Duration.WhileOnBattlefield),
|
||||
new CardsInControllerGraveCondition(7),
|
||||
"<i>Threshold</i> - As long as seven or more cards are in your graveyard, {this} gets +1/+1"));
|
||||
ability.addEffect(new ConditionalContinuousEffect(new CantBlockSourceEffect(Duration.WhileOnBattlefield), new CardsInControllerGraveCondition(7),
|
||||
"and can't block"));
|
||||
Effect effect = new ConditionalRestrictionEffect(new CantBlockSourceEffect(Duration.WhileOnBattlefield), new CardsInControllerGraveCondition(7));
|
||||
effect.setText("and can't block");
|
||||
ability.addEffect(effect);
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* 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.keywords;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ProvokeTest extends CardTestPlayerBase{
|
||||
|
||||
@Test
|
||||
public void testProvokeTappedCreature() {
|
||||
// Creature - Beast 5/3
|
||||
// Trample
|
||||
// Provoke (When this attacks, you may have target creature defending player controls untap and block it if able.)
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Brontotherium");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
|
||||
|
||||
attack(2, playerB, "Silvercoat Lion"); // So it's tapped
|
||||
|
||||
attack(3, playerA, "Brontotherium");
|
||||
addTarget(playerA, "Silvercoat Lion");
|
||||
|
||||
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 18); // one attack from Lion
|
||||
assertLife(playerB, 17); // Because of Trample
|
||||
|
||||
assertPermanentCount(playerA, "Brontotherium", 1);
|
||||
assertGraveyardCount(playerB,"Silvercoat Lion", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProvokeCreatureThatCantBlock() {
|
||||
// Creature - Beast 5/3
|
||||
// Trample
|
||||
// Provoke (When this attacks, you may have target creature defending player controls untap and block it if able.)
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Brontotherium");
|
||||
|
||||
// Creature - Zombie Imp 1/1
|
||||
// Discard a card: Putrid Imp gains flying until end of turn.
|
||||
// Threshold - As long as seven or more cards are in your graveyard, Putrid Imp gets +1/+1 and can't block.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Putrid Imp", 1);
|
||||
addCard(Zone.GRAVEYARD, playerB, "Swamp", 7);
|
||||
|
||||
attack(2, playerB, "Putrid Imp"); // So it's tapped
|
||||
|
||||
attack(3, playerA, "Brontotherium");
|
||||
addTarget(playerA, "Putrid Imp");
|
||||
|
||||
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Brontotherium", 1);
|
||||
assertPermanentCount(playerB, "Putrid Imp", 1); // Can't Block so still alive
|
||||
|
||||
assertLife(playerA, 18); // one attack from Imp
|
||||
assertLife(playerB, 15); // Not blocked
|
||||
|
||||
}
|
||||
}
|
|
@ -229,8 +229,9 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
}
|
||||
}
|
||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_ATTACKERS, attackerId, attackerId));
|
||||
if (!game.isSimulation())
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(new StringBuilder(player.getName()).append(" attacks with ").append(groups.size()).append(groups.size() == 1 ? " creature":" creatures").toString());
|
||||
}
|
||||
}
|
||||
|
||||
protected void checkAttackRequirements(Player player, Game game) {
|
||||
|
@ -283,8 +284,9 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
for (UUID attackingCreatureId : group.getAttackers()) {
|
||||
Permanent attacker = game.getPermanent(attackingCreatureId);
|
||||
if (count > 1 && attacker != null && attacker.getAbilities().containsKey(CanAttackOnlyAloneAbility.getInstance().getId())) {
|
||||
if (!game.isSimulation())
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(attacker.getLogName() + " can only attack alone. Removing it from combat.");
|
||||
}
|
||||
tobeRemoved.add(attackingCreatureId);
|
||||
count--;
|
||||
}
|
||||
|
@ -301,8 +303,9 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
for (UUID attackingCreatureId : group.getAttackers()) {
|
||||
Permanent attacker = game.getPermanent(attackingCreatureId);
|
||||
if (attacker != null && attacker.getAbilities().containsKey(CantAttackAloneAbility.getInstance().getId())) {
|
||||
if (!game.isSimulation())
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(attacker.getLogName() + " can't attack alone. Removing it from combat.");
|
||||
}
|
||||
tobeRemoved.add(attackingCreatureId);
|
||||
}
|
||||
}
|
||||
|
@ -360,8 +363,9 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DECLARED_BLOCKERS, defenderId, defenderId));
|
||||
|
||||
// add info about attacker blocked by blocker to the game log
|
||||
if (!game.isSimulation())
|
||||
if (!game.isSimulation()) {
|
||||
this.logBlockerInfo(defender, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
// tool to catch the bug about flyers blocked by non flyers or intimidate blocked by creatures with other colors
|
||||
|
@ -467,7 +471,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
for (Ability ability : requirementEntry.getValue()) {
|
||||
UUID attackingCreatureId = requirementEntry.getKey().mustBlockAttacker(ability, game);
|
||||
Player defender = game.getPlayer(possibleBlocker.getControllerId());
|
||||
if (attackingCreatureId != null && defender != null) {
|
||||
if (attackingCreatureId != null && defender != null && possibleBlocker.canBlock(attackingCreatureId, game)) {
|
||||
if (creatureMustBlockAttackers.containsKey(possibleBlocker.getId())) {
|
||||
creatureMustBlockAttackers.get(possibleBlocker.getId()).add(attackingCreatureId);
|
||||
} else {
|
||||
|
@ -671,8 +675,9 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
}
|
||||
}
|
||||
if (possibleBlockerAvailable) {
|
||||
if (!game.isSimulation())
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayer(controller, new StringBuilder(toBeBlockedCreature.getLogName()).append(" has to be blocked by at least one creature.").toString());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue