mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Add Garth One-Eye and necessary support
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package forge.game.ability.effects;
|
package forge.game.ability.effects;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -62,6 +63,7 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
|
|||||||
|
|
||||||
boolean randomChoice = sa.hasParam("AtRandom");
|
boolean randomChoice = sa.hasParam("AtRandom");
|
||||||
boolean chooseFromDefined = sa.hasParam("ChooseFromDefinedCards");
|
boolean chooseFromDefined = sa.hasParam("ChooseFromDefinedCards");
|
||||||
|
boolean chooseFromOneTimeList = sa.hasParam("ChooseFromOneTimeList");
|
||||||
|
|
||||||
if (!randomChoice) {
|
if (!randomChoice) {
|
||||||
if (sa.hasParam("SelectPrompt")) {
|
if (sa.hasParam("SelectPrompt")) {
|
||||||
@@ -100,7 +102,7 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
|
|||||||
} else if (chooseFromDefined) {
|
} else if (chooseFromDefined) {
|
||||||
CardCollection choices = AbilityUtils.getDefinedCards(host, sa.getParam("ChooseFromDefinedCards"), sa);
|
CardCollection choices = AbilityUtils.getDefinedCards(host, sa.getParam("ChooseFromDefinedCards"), sa);
|
||||||
choices = CardLists.getValidCards(choices, valid, host.getController(), host, sa);
|
choices = CardLists.getValidCards(choices, valid, host.getController(), host, sa);
|
||||||
List<ICardFace> faces = Lists.newArrayList();
|
List<ICardFace> faces = new ArrayList<>();
|
||||||
// get Card
|
// get Card
|
||||||
for (final Card c : choices) {
|
for (final Card c : choices) {
|
||||||
final CardRules rules = c.getRules();
|
final CardRules rules = c.getRules();
|
||||||
@@ -114,6 +116,22 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
Collections.sort(faces);
|
Collections.sort(faces);
|
||||||
chosen = p.getController().chooseCardName(sa, faces, message);
|
chosen = p.getController().chooseCardName(sa, faces, message);
|
||||||
|
} else if (chooseFromOneTimeList) {
|
||||||
|
String [] names = sa.getParam("ChooseFromOneTimeList").split(",");
|
||||||
|
List<ICardFace> faces = new ArrayList<>();
|
||||||
|
for (String name : names) {
|
||||||
|
faces.add(StaticData.instance().getCommonCards().getFaceByName(name));
|
||||||
|
}
|
||||||
|
chosen = p.getController().chooseCardName(sa, faces, message);
|
||||||
|
|
||||||
|
// Remove chosen Name from List
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (String name : names) {
|
||||||
|
if (chosen.equals(name)) continue;
|
||||||
|
if (sb.length() > 0) sb.append(',');
|
||||||
|
sb.append(name);
|
||||||
|
}
|
||||||
|
sa.putParam("ChooseFromOneTimeList", sb.toString());
|
||||||
} else {
|
} else {
|
||||||
// use CardFace because you might name a alternate names
|
// use CardFace because you might name a alternate names
|
||||||
Predicate<ICardFace> cpp = Predicates.alwaysTrue();
|
Predicate<ICardFace> cpp = Predicates.alwaysTrue();
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import forge.game.zone.Zone;
|
|||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.item.PaperCard;
|
import forge.item.PaperCard;
|
||||||
import forge.util.Aggregates;
|
import forge.util.Aggregates;
|
||||||
|
import forge.util.CardTranslation;
|
||||||
import forge.util.Lang;
|
import forge.util.Lang;
|
||||||
import forge.util.Localizer;
|
import forge.util.Localizer;
|
||||||
|
|
||||||
@@ -93,8 +94,7 @@ public class PlayEffect extends SpellAbilityEffect {
|
|||||||
if (sa.hasParam("ShowCards")) {
|
if (sa.hasParam("ShowCards")) {
|
||||||
showCards = new CardCollection(AbilityUtils.filterListByType(game.getCardsIn(zones), sa.getParam("ShowCards"), sa));
|
showCards = new CardCollection(AbilityUtils.filterListByType(game.getCardsIn(zones), sa.getParam("ShowCards"), sa));
|
||||||
}
|
}
|
||||||
}
|
} else if (sa.hasParam("AnySupportedCard")) {
|
||||||
else if (sa.hasParam("AnySupportedCard")) {
|
|
||||||
final String valid = sa.getParam("AnySupportedCard");
|
final String valid = sa.getParam("AnySupportedCard");
|
||||||
List<PaperCard> cards = null;
|
List<PaperCard> cards = null;
|
||||||
if (valid.startsWith("Names:")){
|
if (valid.startsWith("Names:")){
|
||||||
@@ -139,8 +139,14 @@ public class PlayEffect extends SpellAbilityEffect {
|
|||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} else if (sa.hasParam("CopyFromChosenName")) {
|
||||||
else {
|
String name = source.getChosenName();
|
||||||
|
if (name.isBlank()) return;
|
||||||
|
Card card = Card.fromPaperCard(StaticData.instance().getCommonCards().getUniqueByName(name), controller);
|
||||||
|
card.setToken(true);
|
||||||
|
tgtCards = new CardCollection();
|
||||||
|
tgtCards.add(card);
|
||||||
|
} else {
|
||||||
tgtCards = new CardCollection();
|
tgtCards = new CardCollection();
|
||||||
// filter only cards that didn't changed zones
|
// filter only cards that didn't changed zones
|
||||||
for (Card c : getTargetCards(sa)) {
|
for (Card c : getTargetCards(sa)) {
|
||||||
@@ -179,7 +185,16 @@ public class PlayEffect extends SpellAbilityEffect {
|
|||||||
|
|
||||||
while (!tgtCards.isEmpty() && amount > 0) {
|
while (!tgtCards.isEmpty() && amount > 0) {
|
||||||
activator.getController().tempShowCards(showCards);
|
activator.getController().tempShowCards(showCards);
|
||||||
Card tgtCard = controller.getController().chooseSingleEntityForEffect(tgtCards, sa, Localizer.getInstance().getMessage("lblSelectCardToPlay"), optional, null);
|
Card tgtCard = null;
|
||||||
|
if (tgtCards.size() == 1 && amount == 1 && optional) {
|
||||||
|
tgtCard = tgtCards.get(0);
|
||||||
|
if (!controller.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoYouWantPlayCard", CardTranslation.getTranslatedName(tgtCard.getName())))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tgtCard = controller.getController().chooseSingleEntityForEffect(tgtCards, sa, Localizer.getInstance().getMessage("lblSelectCardToPlay"), optional, null);
|
||||||
|
}
|
||||||
|
|
||||||
activator.getController().endTempShowCards();
|
activator.getController().endTempShowCards();
|
||||||
if (tgtCard == null) {
|
if (tgtCard == null) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
8
forge-gui/res/cardsfolder/upcoming/garth_one_eye.txt
Normal file
8
forge-gui/res/cardsfolder/upcoming/garth_one_eye.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
Name:Garth One-Eye
|
||||||
|
ManaCost:W U B R G
|
||||||
|
Types:Legendary Creature Human Wizard
|
||||||
|
PT:5/5
|
||||||
|
A:AB$ NameCard | Cost$ T | Defined$ You | ChooseFromOneTimeList$ Disenchant,Braingeyser,Terror,Shivan Dragon,Regrowth,Black Lotus | SubAbility$ DBCast | StackDescription$ SpellDescription | SpellDescription$ Choose a card name that hasn't been chosen from among Disenchant, Braingeyser, Terror, Shivan Dragon, Regrowth, and Black Lotus. Create a copy of the card with the chosen name. You may cast the copy. (You still pay its costs.)
|
||||||
|
SVar:DBCast:DB$ Play | CopyFromChosenName$ True | Optional$ True | StackDescription$ None
|
||||||
|
AI:RemoveDeck:All
|
||||||
|
Oracle:{T}: Choose a card name that hasn't been chosen from among Disenchant, Braingeyser, Terror, Shivan Dragon, Regrowth, and Black Lotus. Create a copy of the card with the chosen name. You may cast the copy. (You still pay its costs.)
|
||||||
Reference in New Issue
Block a user