forked from External/mage
parent
64aeba659e
commit
eb0ed8d630
3 changed files with 142 additions and 4 deletions
|
|
@ -13,15 +13,15 @@ import mage.players.Player;
|
|||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class ReturnToHandChosenControlledPermanentCost extends CostImpl {
|
||||
|
||||
private final List<Permanent> permanents = new ArrayList<>();
|
||||
|
||||
public ReturnToHandChosenControlledPermanentCost(TargetControlledPermanent target) {
|
||||
target.withNotTarget(true);
|
||||
this.addTarget(target);
|
||||
|
|
@ -37,8 +37,11 @@ public class ReturnToHandChosenControlledPermanentCost extends CostImpl {
|
|||
}
|
||||
}
|
||||
|
||||
private ReturnToHandChosenControlledPermanentCost(final ReturnToHandChosenControlledPermanentCost cost) {
|
||||
protected ReturnToHandChosenControlledPermanentCost(final ReturnToHandChosenControlledPermanentCost cost) {
|
||||
super(cost);
|
||||
for (Permanent permanent : cost.permanents) {
|
||||
this.permanents.add(permanent.copy());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -52,6 +55,7 @@ public class ReturnToHandChosenControlledPermanentCost extends CostImpl {
|
|||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
addReturnTarget(game, permanent);
|
||||
permanentsToReturn.add(permanent);
|
||||
}
|
||||
controller.moveCards(permanentsToReturn, Zone.HAND, ability, game);
|
||||
|
|
@ -61,6 +65,10 @@ public class ReturnToHandChosenControlledPermanentCost extends CostImpl {
|
|||
return paid;
|
||||
}
|
||||
|
||||
protected void addReturnTarget(Game game, Permanent permanent) {
|
||||
permanents.add(permanent.copy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(Ability ability, Ability source, UUID controllerId, Game game) {
|
||||
return this.getTargets().canChoose(controllerId, source, game);
|
||||
|
|
@ -71,4 +79,8 @@ public class ReturnToHandChosenControlledPermanentCost extends CostImpl {
|
|||
return new ReturnToHandChosenControlledPermanentCost(this);
|
||||
}
|
||||
|
||||
public List<Permanent> getPermanents() {
|
||||
return permanents;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue