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