Merge pull request #1582 from GitHubMage/master

fixed Ali from Cairo
This commit is contained in:
LevelX2 2016-03-03 23:12:05 +01:00
commit 23518b16f5
2 changed files with 50 additions and 7 deletions

View file

@ -97,11 +97,7 @@ class AliFromCairoReplacementEffect extends ReplacementEffectImpl {
&& (controller.getLife() > 0) &&(controller.getLife() - event.getAmount()) < 1
&& event.getPlayerId().equals(controller.getId())
) {
return true;
//unsure how to make this comply with
// 10/1/2008: The ability doesn't change how much damage is dealt;
// it just changes how much life that damage makes you lose.
// An effect such as Spirit Link will see the full amount of damage being dealt.
return true;
}
}
return false;
@ -110,10 +106,17 @@ class AliFromCairoReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
// 10/1/2008: The ability doesn't change how much damage is dealt;
// it just changes how much life that damage makes you lose.
// An effect such as Spirit Link will see the full amount of damage being dealt.
game.fireEvent(event);
if (controller != null) {
event.setAmount(controller.getLife() - 1);
controller.setLife(1, game);
}
return false;
return true;
}
}

View file

@ -0,0 +1,40 @@
package org.mage.test.cards.single;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author BetaSteward
*/
public class AliFromCairoTest extends CardTestPlayerBase {
@Test
public void testCard() {
addCard(Zone.BATTLEFIELD, playerA, "Ali from Cairo", 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 12);
addCard(Zone.BATTLEFIELD, playerB, "Soulfire Grand Master", 1);
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 12);
addCard(Zone.HAND, playerA, "Lightning Bolt", 7);
addCard(Zone.HAND, playerB, "Lightning Bolt", 7);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerA);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerB, "Lightning Bolt", playerA);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 1);
assertLife(playerB, 23);
}
}