mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- Redirected the two remaining targeting checks to the new function and removed the function canTarget from CardFactoryUtil.
This commit is contained in:
@@ -508,8 +508,9 @@ public class Upkeep implements java.io.Serializable {
|
||||
final Ability sacrificeCreature = new Ability(abyss, "") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
final CardList targets = abyssGetTargets.getTargetableCards(this);
|
||||
if (player.isHuman()) {
|
||||
if (abyssGetTargets.getTargetableCards(this).size() > 0) {
|
||||
if (targets.size() > 0) {
|
||||
AllZone.getInputControl().setInput(new Input() {
|
||||
private static final long serialVersionUID = 4820011040853968644L;
|
||||
|
||||
@@ -524,9 +525,7 @@ public class Upkeep implements java.io.Serializable {
|
||||
public void selectCard(final Card selected, final PlayerZone zone) {
|
||||
// probably need to restrict by controller
|
||||
// also
|
||||
if (selected.isCreature() && !selected.isArtifact()
|
||||
&& CardFactoryUtil.canTarget(abyss, selected)
|
||||
&& zone.is(Constant.Zone.Battlefield) && zone.getPlayer().isHuman()) {
|
||||
if (targets.contains(selected)) {
|
||||
AllZone.getGameAction().destroyNoRegeneration(selected);
|
||||
this.stop();
|
||||
}
|
||||
@@ -534,7 +533,7 @@ public class Upkeep implements java.io.Serializable {
|
||||
}); // Input
|
||||
}
|
||||
} else { // computer
|
||||
final CardList targets = abyssGetTargets.getTargetableCards(this);
|
||||
|
||||
final CardList indestruct = targets.getKeyword("Indestructible");
|
||||
if (indestruct.size() > 0) {
|
||||
AllZone.getGameAction().destroyNoRegeneration(indestruct.get(0));
|
||||
|
||||
@@ -313,6 +313,17 @@ class CardFactoryEquipment {
|
||||
// *************** START *********** START **************************
|
||||
else if (cardName.equals("Piston Sledge")) {
|
||||
|
||||
final CardList targets = new CardList();
|
||||
|
||||
final SpellAbility comesIntoPlayAbility = new Ability(card, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
if (!targets.isEmpty()) {
|
||||
card.equipCard(targets.get(0));
|
||||
}
|
||||
} // resolve()
|
||||
}; // comesIntoPlayAbility
|
||||
|
||||
final Input in = new Input() {
|
||||
private static final long serialVersionUID = 1782826197612459365L;
|
||||
|
||||
@@ -331,21 +342,14 @@ class CardFactoryEquipment {
|
||||
@Override
|
||||
public void selectCard(final Card c, final PlayerZone z) {
|
||||
if (z.is(Constant.Zone.Battlefield, card.getController()) && c.isCreature()
|
||||
&& CardFactoryUtil.canTarget(card, c)) {
|
||||
card.equipCard(c);
|
||||
&& c.canTarget(comesIntoPlayAbility)) {
|
||||
targets.add(c);
|
||||
this.stop();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
final SpellAbility comesIntoPlayAbility = new Ability(card, "0") {
|
||||
@Override
|
||||
public void resolve() {
|
||||
AllZone.getInputControl().setInput(in);
|
||||
} // resolve()
|
||||
}; // comesIntoPlayAbility
|
||||
|
||||
final Command intoPlay = new Command() {
|
||||
private static final long serialVersionUID = 2985015252466920757L;
|
||||
|
||||
@@ -357,6 +361,8 @@ class CardFactoryEquipment {
|
||||
sb.append("attach it to target creature you control.");
|
||||
comesIntoPlayAbility.setStackDescription(sb.toString());
|
||||
|
||||
AllZone.getInputControl().setInput(in);
|
||||
|
||||
AllZone.getStack().addSimultaneousStackEntry(comesIntoPlayAbility);
|
||||
|
||||
}
|
||||
|
||||
@@ -2409,7 +2409,7 @@ public class CardFactoryUtil {
|
||||
* a {@link forge.Card} object.
|
||||
* @return a boolean.
|
||||
*/
|
||||
public static boolean canTarget(final Card spell, final Card target) {
|
||||
/*public static boolean canTarget(final Card spell, final Card target) {
|
||||
if (target == null) {
|
||||
return true;
|
||||
}
|
||||
@@ -2486,7 +2486,7 @@ public class CardFactoryUtil {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
|
||||
// does "target" have protection from "card"?
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user