mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Codechanges and lots of fixes related to playing other player's cards from exile.
- Cards now keep track of who's allowed to cast them, fixing possible issues in multiplayer. - Face-down cards can now be properly looked at when allowed to by a static ability. - Improve support for casting a face-down exiled card in general. - Add Shared Fate (including AI support).
This commit is contained in:
@@ -34,6 +34,7 @@ import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
import forge.card.CardStateName;
|
||||
import forge.card.CardType;
|
||||
import forge.card.MagicColor;
|
||||
import forge.card.CardType.Supertype;
|
||||
@@ -335,7 +336,7 @@ public class AiController {
|
||||
sa.setActivatingPlayer(player);
|
||||
//add alternative costs as additional spell abilities
|
||||
newAbilities.add(sa);
|
||||
newAbilities.addAll(GameActionUtil.getAlternativeCosts(sa));
|
||||
newAbilities.addAll(GameActionUtil.getAlternativeCosts(sa, player));
|
||||
}
|
||||
|
||||
final ArrayList<SpellAbility> result = new ArrayList<SpellAbility>();
|
||||
@@ -352,6 +353,11 @@ public class AiController {
|
||||
for (final SpellAbility sa : c.getSpellAbilities()) {
|
||||
spellAbilities.add(sa);
|
||||
}
|
||||
if (c.isFaceDown() && c.isInZone(ZoneType.Exile) && c.mayPlay(player) != null) {
|
||||
for (final SpellAbility sa : c.getState(CardStateName.Original).getSpellAbilities()) {
|
||||
spellAbilities.add(sa);
|
||||
}
|
||||
}
|
||||
}
|
||||
return spellAbilities;
|
||||
}
|
||||
@@ -392,11 +398,15 @@ public class AiController {
|
||||
});
|
||||
|
||||
final CardCollection landsNotInHand = new CardCollection(player.getCardsIn(ZoneType.Graveyard));
|
||||
landsNotInHand.addAll(game.getCardsIn(ZoneType.Exile));
|
||||
if (!player.getCardsIn(ZoneType.Library).isEmpty()) {
|
||||
landsNotInHand.add(player.getCardsIn(ZoneType.Library).get(0));
|
||||
}
|
||||
for (final Card crd : landsNotInHand) {
|
||||
if (crd.isLand() && crd.hasKeyword("May be played")) {
|
||||
if (!(crd.isLand() || (crd.isFaceDown() && crd.getState(CardStateName.Original).getType().isLand()))) {
|
||||
continue;
|
||||
}
|
||||
if (crd.hasKeyword("May be played") || crd.mayPlay(player) != null) {
|
||||
landList.add(crd);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user