[LCI] Implement Ojer Axonil, Deepest Might (#11195)

* [LCI] Implement Ojer Axonil, Deepest Might

* add tests

* Alter text generation on ActivateIfConditionActivatedAbility to handle "and as a sorcery"
This commit is contained in:
Susucre 2023-10-08 23:52:36 +02:00 committed by GitHub
parent 287e25b28f
commit 8e1ef15b70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 521 additions and 13 deletions

View file

@ -0,0 +1,194 @@
package org.mage.test.cards.single.lci;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author Susucr
*/
public class OjerAxonilDeepestMightTest extends CardTestPlayerBase {
/**
* Ojer Axonil, Deepest Might
* {2}{R}{R}
* Legendary Creature God
*
* Trample
* If a red source you control would deal an amount of noncombat damage less than Ojer Axonils power to an opponent, that source deals damage equal to Ojer Axonils power instead.
* When Ojer Axonil dies, return it to the battlefield tapped and transformed under its owners control.
* 4/4
*
* Temple of Power
* Land
*
* (Transforms from Ojer Axonil, Deepest Might.)
* {T}: Add {R}.
* {2}{R}, {T}: Transform Temple of Power. Activate only if red sources you controlled dealt 4 or more noncombat damage this turn and only as a sorcery.
*/
private static final String ojer = "Ojer Axonil, Deepest Might";
private static final String temple = "Temple of Power";
private static final String templeTransformAbility = "{2}{R}, {T}: Transform {this}. Activate only if red sources you controlled dealt 4 or more noncombat damage this turn and only as a sorcery.";
/**
* Lightning Bolt
* {R}
* Instant
*
* Lightning Bolt deals 3 damage to any target.
*/
private static final String bolt = "Lightning Bolt";
/**
* Lava Axe
* {4}{R}
* Sorcery
*
* Lava Axe deals 5 damage to target player or planeswalker.
*/
private static final String axe = "Lava Axe";
@Test
public void testReplacement_BoltFace() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, ojer, 1);
addCard(Zone.HAND, playerA, bolt, 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, playerB);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerB, 20 - 4);
}
@Test
public void testReplacement_BoltOwnFace() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, ojer, 1);
addCard(Zone.HAND, playerA, bolt, 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, playerA);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20 - 3); // only work on opponnent
}
@Test
public void testReplacement_BoltOjer() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, ojer, 1);
addCard(Zone.HAND, playerA, bolt, 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, ojer);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertDamageReceived(playerA, ojer, 3); // does not work on creatures
}
@Test
public void testReplacement_CombatDamageNotReplaced() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, ojer, 1);
addCard(Zone.BATTLEFIELD, playerA, "Raging Goblin", 1);
attack(1, playerA, "Raging Goblin", playerB);
setStopAt(1, PhaseStep.END_COMBAT);
execute();
assertLife(playerB, 20 - 1); // does not alter combat damage
}
@Test
public void testReplacement_Hellrider() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, ojer, 1);
// Whenever a creature you control attacks, Hellrider deals 1 damage to the player or planeswalker its attacking.
addCard(Zone.BATTLEFIELD, playerA, "Hellrider", 1);
addCard(Zone.BATTLEFIELD, playerA, "Raging Goblin", 1);
attack(1, playerA, "Raging Goblin", playerB);
setStopAt(1, PhaseStep.END_COMBAT);
execute();
assertLife(playerB, 20 - 1 - 4); // Hellrider's trigger is altered.
}
@Test
public void testReplacement_LavaAxeFace() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, ojer, 1);
addCard(Zone.HAND, playerA, axe, 1);
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 5);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, axe, playerB);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerB, 20 - 5); // no replacement
}
@Test
public void testReplacement_GiantGrowth_LavaAxeFace() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, ojer, 1);
addCard(Zone.HAND, playerA, axe, 1);
addCard(Zone.HAND, playerA, "Giant Growth", 1); // +3/+3 until end of turn
addCard(Zone.BATTLEFIELD, playerA, "Taiga", 6);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, axe, playerB);
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Giant Growth", ojer);
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerB, 20 - (4 + 3));
}
@Test
public void testTransform() {
setStrictChooseMode(true);
addCard(Zone.BATTLEFIELD, playerA, ojer, 1);
addCard(Zone.HAND, playerA, axe, 1);
addCard(Zone.HAND, playerA, "Bathe in Dragonfire", 1); // 4 damage to target creature
addCard(Zone.BATTLEFIELD, playerA, "Battlefield Forge", 5 + 3); // Using Forge to distinguish the mana ability from the Temple one.
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Bathe in Dragonfire", ojer, true);
checkPermanentTapped("temple in play", 1, PhaseStep.PRECOMBAT_MAIN, playerA, temple, true, 1);
checkPlayableAbility("condition false", 3, PhaseStep.PRECOMBAT_MAIN, playerA, templeTransformAbility, false);
activateManaAbility(3, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}. {this} deals 1 damage to you.", 5);
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, axe, playerB);
waitStackResolved(3, PhaseStep.PRECOMBAT_MAIN);
activateManaAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Add {R}. {this} deals 1 damage to you.", 3);
checkPlayableAbility("condition true", 3, PhaseStep.POSTCOMBAT_MAIN, playerA, templeTransformAbility, true);
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, templeTransformAbility);
setStopAt(3, PhaseStep.END_TURN);
execute();
assertLife(playerB, 20 - 5);
assertPermanentCount(playerA, ojer, 1);
assertTapped(ojer, true);
}
}