mirror of
https://github.com/correl/mage.git
synced 2025-03-07 20:53:18 -10:00
* Homing Sliver - Fixed the gain Slivercycling ability.
This commit is contained in:
parent
fb1ba5f3c8
commit
01c81c1cb1
4 changed files with 52 additions and 74 deletions
|
@ -29,10 +29,9 @@ package mage.sets.futuresight;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.DiscardSourceCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.keyword.CyclingAbility;
|
||||
|
@ -52,8 +51,9 @@ import mage.players.Player;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author anonymous
|
||||
* @author Luna Skyrise
|
||||
*/
|
||||
|
||||
public class HomingSliver extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("Sliver card");
|
||||
|
@ -70,31 +70,10 @@ public class HomingSliver extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Each Sliver card in each player's hand has slivercycling {3}.
|
||||
Ability ability = new CyclingAbility(new ManaCostsImpl("{3}"), filter, "Slivercycling");
|
||||
ability.addCost(new DiscardSourceCost());
|
||||
this.addAbility(new SimpleStaticAbility(Zone.HAND, new HomingSliverEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new HomingSliverEffect()));
|
||||
|
||||
// Slivercycling {3}
|
||||
this.addAbility(ability);
|
||||
/**
|
||||
* 01/02/2009 Slivercycling is a form of cycling. Any ability that
|
||||
* triggers on a card being cycled also triggers on Slivercycling this
|
||||
* card. Any ability that stops a cycling ability from being activated
|
||||
* also stops Plainscycling from being activated.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 01/02/2009 Slivercycling is an activated ability. Effects that
|
||||
* interact with activated abilities (such as Stifle or Rings of
|
||||
* Brighthearth) will interact with Slivercycling. Effects that interact
|
||||
* with spells (such as Remove Soul or Faerie Tauntings) will not.
|
||||
*/
|
||||
/**
|
||||
* 01/02/2009 You can choose to find any card with the Sliver creature
|
||||
* type, even if it isn't a creature card. This includes, for example,
|
||||
* Tribal cards with the Changeling ability. You can also choose not to
|
||||
* find a card, even if there is a Sliver card in your graveyard.
|
||||
*
|
||||
*/
|
||||
this.addAbility(new CyclingAbility(new ManaCostsImpl("{3}"), filter, "Slivercycling"));
|
||||
}
|
||||
|
||||
public HomingSliver(final HomingSliver card) {
|
||||
|
@ -109,15 +88,15 @@ public class HomingSliver extends CardImpl {
|
|||
|
||||
class HomingSliverEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static final FilterCard filter2 = new FilterCard("Sliver card");
|
||||
private static final FilterCard filter = new FilterCard("Sliver card");
|
||||
|
||||
static {
|
||||
filter2.add(new SubtypePredicate("Sliver"));
|
||||
filter.add(new SubtypePredicate("Sliver"));
|
||||
}
|
||||
|
||||
public HomingSliverEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||
this.staticText = "Each Sliver card in each player's hand has slivercycling {3}";
|
||||
this.staticText = "each Sliver card in each player's hand has slivercycling {3}";
|
||||
}
|
||||
|
||||
public HomingSliverEffect(final HomingSliverEffect effect) {
|
||||
|
@ -129,45 +108,19 @@ class HomingSliverEffect extends ContinuousEffectImpl {
|
|||
return new HomingSliverEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
if (this.affectedObjectsSet) {
|
||||
for (UUID p : game.getPlayerList()) {
|
||||
Player player = game.getPlayer(p);
|
||||
if (player != null) {
|
||||
for (UUID cardId : player.getHand()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card.getSubtype().contains("Sliver")) {
|
||||
affectedObjectList.add(new MageObjectReference(card, game));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (UUID p : game.getPlayerList()) {
|
||||
Player player = game.getPlayer(p);
|
||||
if (player != null) {
|
||||
for (UUID cardId : player.getHand()) {
|
||||
if (affectedObjectList.contains(new MageObjectReference(cardId, game))) {
|
||||
Card card = game.getCard(cardId);
|
||||
CyclingAbility ability = null;
|
||||
if (card.hasSubtype("Sliver")) {
|
||||
ability = new CyclingAbility(new ManaCostsImpl("{3}"), filter2, "Slivercycling");
|
||||
}
|
||||
if (ability != null) {
|
||||
ability.setSourceId(cardId);
|
||||
ability.setControllerId(card.getOwnerId());
|
||||
game.getState().addOtherAbility(card, ability);
|
||||
}
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Card card : player.getHand().getCards(filter, game)) {
|
||||
game.getState().addOtherAbility(card, new CyclingAbility(new GenericManaCost(3), filter, "Slivercycling"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CycleTest extends CardTestPlayerBase {
|
||||
public class CyclingTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* 702.28. Cycling
|
||||
|
@ -60,7 +60,7 @@ public class CycleTest extends CardTestPlayerBase {
|
|||
*/
|
||||
|
||||
@Test
|
||||
public void CycleAndTriggerTest() {
|
||||
public void cycleAndTriggerTest() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
|
||||
// Destroy all creatures. They can't be regenerated. Draw a card for each creature destroyed this way.
|
||||
// Cycling {3}{B}{B}
|
||||
|
@ -82,15 +82,13 @@ public class CycleTest extends CardTestPlayerBase {
|
|||
|
||||
assertPermanentCount(playerB, "Pillarfield Ox", 1);
|
||||
assertPowerToughness(playerB, "Pillarfield Ox", 0, 2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Cycle from graveyard or battlefield may not work
|
||||
*/
|
||||
@Test
|
||||
public void CycleFromGraveyard() {
|
||||
public void cycleFromGraveyard() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
|
||||
// Destroy all creatures. They can't be regenerated. Draw a card for each creature destroyed this way.
|
||||
// Cycling {3}{B}{B}
|
||||
|
@ -113,5 +111,32 @@ public class CycleTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerB, "Disciple Of Grace", 1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Type cycling for sliver
|
||||
*/
|
||||
@Test
|
||||
public void cycleFromHomingSliver() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
|
||||
// Each Sliver card in each player's hand has slivercycling {3}.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Homing Sliver");
|
||||
// All Sliver creatures have flying.
|
||||
addCard(Zone.HAND, playerA, "Winged Sliver");
|
||||
|
||||
addCard(Zone.LIBRARY, playerA, "Horned Sliver");
|
||||
addCard(Zone.LIBRARY, playerA, "Silvercoat Lion", 10);
|
||||
skipInitShuffling();
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Slivercycling {3}");
|
||||
addTarget(playerA, "Horned Sliver");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertHandCount(playerA, 1);
|
||||
|
||||
assertGraveyardCount(playerA, "Winged Sliver", 1);
|
||||
|
||||
assertHandCount(playerA, "Horned Sliver", 1); // searched by slivercyclibng
|
||||
}
|
||||
}
|
|
@ -32,7 +32,7 @@ import mage.constants.Zone;
|
|||
import mage.abilities.ActivatedAbilityImpl;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.DiscardSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
|
||||
import mage.filter.FilterCard;
|
||||
|
@ -76,11 +76,11 @@ public class CyclingAbility extends ActivatedAbilityImpl {
|
|||
@Override
|
||||
public String getRule() {
|
||||
StringBuilder rule = new StringBuilder(this.text);
|
||||
if(cost instanceof ManaCosts){
|
||||
if(cost instanceof ManaCost){
|
||||
rule.append(" ");
|
||||
}
|
||||
else{
|
||||
rule.append(" - ");
|
||||
rule.append("—");
|
||||
}
|
||||
rule.append(cost.getText()).append(" <i>(").append(super.getRule(true)).append(")</i>");
|
||||
return rule.toString();
|
||||
|
|
|
@ -2379,7 +2379,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
if (hidden) {
|
||||
for (Card card : hand.getUniqueCards(game)) {
|
||||
for (Ability ability : card.getAbilities()) { // gets this activated ability from hand? (Morph?)
|
||||
for (Ability ability : card.getAbilities(game)) { // gets this activated ability from hand? (Morph?)
|
||||
if (ability.getZone().match(Zone.HAND)) {
|
||||
if (ability instanceof ActivatedAbility) {
|
||||
if (!(ability instanceof PlayLandAbility)
|
||||
|
|
Loading…
Add table
Reference in a new issue