forked from External/mage
Some rework to end turn logic and removing of stack objects (related to #2977).
This commit is contained in:
parent
2446abcc98
commit
097a8ce0dd
9 changed files with 110 additions and 104 deletions
|
|
@ -27,6 +27,10 @@
|
|||
*/
|
||||
package mage.game.stack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
|
|
@ -58,11 +62,6 @@ import mage.game.permanent.PermanentCard;
|
|||
import mage.players.Player;
|
||||
import mage.util.GameLog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -334,8 +333,8 @@ public class Spell extends StackObjImpl implements Card {
|
|||
* determine whether card was kicked or not. E.g. Desolation Angel
|
||||
*/
|
||||
private void updateOptionalCosts(int index) {
|
||||
spellCards.get(index).getAbilities().get(spellAbilities.get(index).getId()).ifPresent(abilityOrig ->
|
||||
{
|
||||
spellCards.get(index).getAbilities().get(spellAbilities.get(index).getId()).ifPresent(abilityOrig
|
||||
-> {
|
||||
for (Object object : spellAbilities.get(index).getOptionalCosts()) {
|
||||
Cost cost = (Cost) object;
|
||||
for (Cost costOrig : abilityOrig.getOptionalCosts()) {
|
||||
|
|
@ -749,24 +748,7 @@ public class Spell extends StackObjImpl implements Card {
|
|||
|
||||
@Override
|
||||
public boolean moveToExile(UUID exileId, String name, UUID sourceId, Game game, ArrayList<UUID> appliedEffects) {
|
||||
ZoneChangeEvent event = new ZoneChangeEvent(this.getId(), sourceId, this.getOwnerId(), Zone.STACK, Zone.EXILED, appliedEffects);
|
||||
if (!game.replaceEvent(event)) {
|
||||
game.getStack().remove(this);
|
||||
game.rememberLKI(this.getId(), event.getFromZone(), this);
|
||||
|
||||
if (!this.isCopiedSpell()) {
|
||||
if (exileId == null) {
|
||||
game.getExile().getPermanentExile().add(this.card);
|
||||
} else {
|
||||
game.getExile().createZone(exileId, name).add(this.card);
|
||||
}
|
||||
|
||||
game.setZone(this.card.getId(), event.getToZone());
|
||||
}
|
||||
game.fireEvent(event);
|
||||
return event.getToZone() == Zone.EXILED;
|
||||
}
|
||||
return false;
|
||||
return this.card.moveToExile(exileId, name, sourceId, game, appliedEffects);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue