mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Adventures basically working.
No graphics yet.
This commit is contained in:
parent
04a4b91a59
commit
19a9d98287
6 changed files with 64 additions and 6 deletions
|
@ -7,14 +7,44 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
|
||||
public class CastAdventureCardsTest extends CardTestPlayerBase {
|
||||
@Test
|
||||
public void testCastCuriousPair() {
|
||||
public void testCastTreatsToShare() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest");
|
||||
addCard(Zone.HAND, playerA, "Curious Pair");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Curious Pair");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Treats to Share");
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertPermanentCount(playerA, "Food", 1);
|
||||
assertExileCount(playerA, "Curious Pair", 1);
|
||||
assertGraveyardCount(playerA,0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCastCuriousPair() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest");
|
||||
addCard(Zone.HAND, playerA, "Curious Pair");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Curious Pair");
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertPermanentCount(playerA, "Food", 0);
|
||||
assertPermanentCount(playerA, "Curious Pair", 1);
|
||||
assertExileCount(playerA, "Curious Pair", 0);
|
||||
assertGraveyardCount(playerA,0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCastTreatsToShareAndCuriousPair() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest");
|
||||
addCard(Zone.HAND, playerA, "Curious Pair");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Treats to Share");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Curious Pair");
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertPermanentCount(playerA, "Food", 1);
|
||||
assertPermanentCount(playerA, "Curious Pair", 1);
|
||||
assertExileCount(playerA, "Curious Pair", 0);
|
||||
assertGraveyardCount(playerA, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,14 +21,14 @@ public abstract class AdventureCard extends CardImpl {
|
|||
|
||||
/* The adventure spell card, i.e. Swift End. */
|
||||
protected Card spellCard;
|
||||
/* The ability to cast the creature from exile. */
|
||||
protected SpellAbility adventureCreatureAbility;
|
||||
|
||||
public AdventureCard(UUID ownerId, CardSetInfo setInfo, CardType[] types, CardType[] typesSpell, String costs, String adventureName, String costsSpell) {
|
||||
super(ownerId, setInfo, types, costs);
|
||||
spellCard = new AdventureCardSpellImpl(ownerId, setInfo, typesSpell, costsSpell, this);
|
||||
spellCard.getSpellAbility().addEffect(ExileAdventureSpellEffect.getInstance());
|
||||
adventureCreatureAbility = new AdventureCreatureAbility(new ManaCostsImpl(costs));
|
||||
spellCard.setName(adventureName);
|
||||
spellCard.getSpellAbility().setCardName(adventureName);
|
||||
this.addAbility(spellCard.getSpellAbility());
|
||||
}
|
||||
|
||||
public AdventureCard(AdventureCard card) {
|
||||
|
|
|
@ -505,6 +505,9 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
|
|||
stackObject = game.getStack().getSpell(((SplitCard) this).getRightHalfCard().getId());
|
||||
}
|
||||
}
|
||||
if (stackObject == null && (this instanceof AdventureCard)) {
|
||||
stackObject = game.getStack().getSpell(((AdventureCard) this).getSpellCard().getId());
|
||||
}
|
||||
if (stackObject == null) {
|
||||
stackObject = game.getStack().getSpell(getId());
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package mage.filter.predicate.other;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
import mage.cards.AdventureCard;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.constants.SubType;
|
||||
|
@ -76,6 +78,14 @@ public class CardTextPredicate implements Predicate<Card> {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (input instanceof AdventureCard) {
|
||||
for (String rule : ((AdventureCard) input).getSpellCard().getRules(game)) {
|
||||
if (rule.toLowerCase(Locale.ENGLISH).contains(token)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String rule : input.getRules(game)) {
|
||||
if (rule.toLowerCase(Locale.ENGLISH).contains(token)) {
|
||||
found = true;
|
||||
|
|
|
@ -230,6 +230,12 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
gameCards.put(rightCard.getId(), rightCard);
|
||||
state.addCard(rightCard);
|
||||
}
|
||||
if (card instanceof AdventureCard) {
|
||||
Card spellCard = ((AdventureCard) card).getSpellCard();
|
||||
spellCard.setOwnerId(ownerId);
|
||||
gameCards.put(spellCard.getId(), spellCard);
|
||||
state.addCard(spellCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1767,7 +1773,7 @@ public abstract class GameImpl implements Game, Serializable {
|
|||
Iterator<Card> copiedCards = this.getState().getCopiedCards().iterator();
|
||||
while (copiedCards.hasNext()) {
|
||||
Card card = copiedCards.next();
|
||||
if (card instanceof SplitCardHalf) {
|
||||
if (card instanceof SplitCardHalf || card instanceof AdventureCardSpell) {
|
||||
continue; // only the main card is moves, not the halves
|
||||
}
|
||||
Zone zone = state.getZone(card.getId());
|
||||
|
|
|
@ -5,6 +5,7 @@ import mage.abilities.*;
|
|||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffects;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.cards.AdventureCard;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.constants.Zone;
|
||||
|
@ -811,6 +812,9 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
removeCopiedCard(((SplitCard) card).getLeftHalfCard());
|
||||
removeCopiedCard(((SplitCard) card).getRightHalfCard());
|
||||
}
|
||||
if (card instanceof AdventureCard) {
|
||||
removeCopiedCard(((AdventureCard) card).getSpellCard());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1166,6 +1170,11 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
copiedCards.put(rightCard.getId(), rightCard);
|
||||
addCard(rightCard);
|
||||
}
|
||||
if (copiedCard instanceof AdventureCard) {
|
||||
Card spellCard = ((AdventureCard) copiedCard).getSpellCard();
|
||||
copiedCards.put(spellCard.getId(), spellCard);
|
||||
addCard(spellCard);
|
||||
}
|
||||
return copiedCard;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue