forked from External/mage
Fix casting of Disturb cards with Auras on the back (#8600)
This commit is contained in:
parent
b473300680
commit
a94c837ad0
4 changed files with 18 additions and 6 deletions
|
|
@ -30,14 +30,10 @@ public class DisturbAbility extends SpellAbility {
|
||||||
private SpellAbility spellAbilityToResolve;
|
private SpellAbility spellAbilityToResolve;
|
||||||
|
|
||||||
public DisturbAbility(Card card, String manaCost) {
|
public DisturbAbility(Card card, String manaCost) {
|
||||||
super(card.getSpellAbility());
|
super(card.getSecondFaceSpellAbility());
|
||||||
this.newId();
|
this.newId();
|
||||||
|
|
||||||
// verify check
|
// getSecondFaceSpellAbility() already verified that second face exists
|
||||||
if (card.getSecondCardFace() == null || card.getSecondCardFace().getClass().equals(card.getClass())) {
|
|
||||||
throw new IllegalArgumentException("Wrong code usage. Disturb ability can be added to double faces card only (main side).");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setCardName(card.getSecondCardFace().getName() + " with Disturb");
|
this.setCardName(card.getSecondCardFace().getName() + " with Disturb");
|
||||||
this.zone = Zone.GRAVEYARD;
|
this.zone = Zone.GRAVEYARD;
|
||||||
this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE;
|
this.spellAbilityType = SpellAbilityType.BASE_ALTERNATE;
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,8 @@ public interface Card extends MageObject {
|
||||||
|
|
||||||
Card getSecondCardFace();
|
Card getSecondCardFace();
|
||||||
|
|
||||||
|
SpellAbility getSecondFaceSpellAbility();
|
||||||
|
|
||||||
boolean isNightCard();
|
boolean isNightCard();
|
||||||
|
|
||||||
void assignNewId();
|
void assignNewId();
|
||||||
|
|
|
||||||
|
|
@ -636,6 +636,15 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
||||||
return secondSideCard;
|
return secondSideCard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SpellAbility getSecondFaceSpellAbility() {
|
||||||
|
Card secondFace = getSecondCardFace();
|
||||||
|
if (secondFace == null || secondFace.getClass().equals(getClass())) {
|
||||||
|
throw new IllegalArgumentException("Wrong code usage. getSecondFaceSpellAbility can only be used for double faced card (main side).");
|
||||||
|
}
|
||||||
|
return secondFace.getSpellAbility();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNightCard() {
|
public boolean isNightCard() {
|
||||||
return this.nightCard;
|
return this.nightCard;
|
||||||
|
|
|
||||||
|
|
@ -768,6 +768,11 @@ public class Spell extends StackObjectImpl implements Card {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SpellAbility getSecondFaceSpellAbility() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNightCard() {
|
public boolean isNightCard() {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue