mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
Some minor changes to SplitCard.
This commit is contained in:
parent
e904f9e6ff
commit
8bc21a7c1c
1 changed files with 13 additions and 10 deletions
|
@ -51,7 +51,7 @@ import mage.watchers.Watcher;
|
||||||
public abstract class SplitCard<T extends SplitCard<T>> extends CardImpl<T> {
|
public abstract class SplitCard<T extends SplitCard<T>> extends CardImpl<T> {
|
||||||
|
|
||||||
public enum ActiveCardHalf {
|
public enum ActiveCardHalf {
|
||||||
NONE, LEFT, RIGHT
|
NONE, LEFT, RIGHT, BOTH
|
||||||
}
|
}
|
||||||
private Card leftHalfCard;
|
private Card leftHalfCard;
|
||||||
private Card rightHalfCard;
|
private Card rightHalfCard;
|
||||||
|
@ -67,8 +67,8 @@ public abstract class SplitCard<T extends SplitCard<T>> extends CardImpl<T> {
|
||||||
|
|
||||||
public SplitCard(SplitCard card) {
|
public SplitCard(SplitCard card) {
|
||||||
super(card);
|
super(card);
|
||||||
this.leftHalfCard = card.leftHalfCard;
|
this.leftHalfCard = card.leftHalfCard.copy();
|
||||||
this.rightHalfCard = card.rightHalfCard;
|
this.rightHalfCard = card.rightHalfCard.copy();
|
||||||
this.activeCardHalf = card.activeCardHalf;
|
this.activeCardHalf = card.activeCardHalf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,16 +104,19 @@ public abstract class SplitCard<T extends SplitCard<T>> extends CardImpl<T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean cast(Game game, Constants.Zone fromZone, SpellAbility ability, UUID controllerId) {
|
public boolean cast(Game game, Constants.Zone fromZone, SpellAbility ability, UUID controllerId) {
|
||||||
|
if (this.getAbilities().contains(ability)) {
|
||||||
|
activeCardHalf = ActiveCardHalf.BOTH;
|
||||||
|
} else if (leftHalfCard.getAbilities().contains(ability)) {
|
||||||
|
activeCardHalf = ActiveCardHalf.LEFT;
|
||||||
|
} else if (rightHalfCard.getAbilities().contains(ability)) {
|
||||||
|
activeCardHalf = ActiveCardHalf.RIGHT;
|
||||||
|
} else {
|
||||||
|
activeCardHalf = ActiveCardHalf.NONE;
|
||||||
|
}
|
||||||
if (super.cast(game, fromZone, ability, controllerId)) {
|
if (super.cast(game, fromZone, ability, controllerId)) {
|
||||||
if (leftHalfCard.getAbilities().contains(ability)) {
|
|
||||||
activeCardHalf = ActiveCardHalf.LEFT;
|
|
||||||
} else if (rightHalfCard.getAbilities().contains(ability)) {
|
|
||||||
activeCardHalf = ActiveCardHalf.RIGHT;
|
|
||||||
} else {
|
|
||||||
activeCardHalf = ActiveCardHalf.NONE;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
activeCardHalf = ActiveCardHalf.NONE;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue