* Fervent Champion - Fixed that it's possible to equip the Champion also without having the regular mana (#6698).

This commit is contained in:
LevelX2 2020-07-27 22:27:11 +02:00
parent 6e68e038b6
commit 82dfd76ee3
4 changed files with 58 additions and 13 deletions

View file

@ -90,14 +90,22 @@ class FerventChampionEffect extends CostModificationEffectImpl {
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
return abilityToModify instanceof EquipAbility
&& abilityToModify.isControlledBy(source.getControllerId())
&& abilityToModify
if (abilityToModify instanceof EquipAbility
&& abilityToModify.isControlledBy(source.getControllerId())) {
if (game != null && game.inCheckPlayableState()) {
return !abilityToModify.getTargets().isEmpty() &&
abilityToModify.getTargets().get(0).canTarget(source.getSourceId(), abilityToModify, game);
} else {
return abilityToModify
.getTargets()
.stream()
.map(Target::getTargets)
.flatMap(Collection::stream)
.anyMatch(source.getSourceId()::equals);
.anyMatch(source.getSourceId()::equals);
}
}
return false;
}
@Override

View file

@ -41,7 +41,7 @@ public final class SwordOfFireAndIce extends CardImpl {
// Whenever equipped creature deals combat damage to a player, Sword of Fire
// and Ice deals 2 damage to any target and you draw a card.
this.addAbility(new SwordOfFireAndIceAbility());
// Equip
// Equip {2}
this.addAbility(new EquipAbility(Outcome.Benefit, new GenericManaCost(2)));
}

View file

@ -0,0 +1,44 @@
/*
* 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.cost.modification;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class FerventChampionTest extends CardTestPlayerBase {
@Test
public void testFerventChampion() {
setStrictChooseMode(true);
// First strike, Haste
// Whenever Fervent Champion attacks, another target attacking Knight you control gets +1/+0 until end of turn.
// Equip abilities you activate that target Fervent Champion cost {3} less to activate.
addCard(Zone.BATTLEFIELD, playerA, "Fervent Champion");
// Equipped creature gets +2/+2 and has protection from red and from blue.
// Whenever equipped creature deals combat damage to a player, Sword of Fire
// and Ice deals 2 damage to any target and you draw a card.
// Equip {2}
addCard(Zone.BATTLEFIELD, playerA, "Sword of Fire and Ice", 1);
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Equip");
addTarget(playerA, "Fervent Champion");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertAllCommandsUsed();
assertPowerToughness(playerA, "Fervent Champion", 3,3);
}
}

View file

@ -3420,14 +3420,7 @@ public abstract class PlayerImpl implements Player, Serializable {
boolean previousState = game.inCheckPlayableState();
game.setCheckPlayableState(true);
try {
// basic mana
ManaOptions availableMana = getManaAvailable(game);
// availableMana.addMana(manaPool.getMana());
// conditional mana
// for (ConditionalMana conditionalMana : manaPool.getConditionalMana()) {
// availableMana.addMana(conditionalMana);
// }
ManaOptions availableMana = getManaAvailable(game); // get available mana options (mana pool and conditional mana added (but conditional still lose condition))
boolean fromAll = fromZone.equals(Zone.ALL);
if (hidden && (fromAll || fromZone == Zone.HAND)) {
for (Card card : hand.getCards(game)) {