Add Garth One-Eye and necessary support

This commit is contained in:
Lyu Zong-Hong
2021-06-09 23:07:55 +09:00
parent cfb755ce20
commit f9abb8ca75
3 changed files with 47 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
package forge.game.ability.effects;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -62,6 +63,7 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
boolean randomChoice = sa.hasParam("AtRandom");
boolean chooseFromDefined = sa.hasParam("ChooseFromDefinedCards");
boolean chooseFromOneTimeList = sa.hasParam("ChooseFromOneTimeList");
if (!randomChoice) {
if (sa.hasParam("SelectPrompt")) {
@@ -100,7 +102,7 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
} else if (chooseFromDefined) {
CardCollection choices = AbilityUtils.getDefinedCards(host, sa.getParam("ChooseFromDefinedCards"), sa);
choices = CardLists.getValidCards(choices, valid, host.getController(), host, sa);
List<ICardFace> faces = Lists.newArrayList();
List<ICardFace> faces = new ArrayList<>();
// get Card
for (final Card c : choices) {
final CardRules rules = c.getRules();
@@ -114,6 +116,22 @@ public class ChooseCardNameEffect extends SpellAbilityEffect {
}
Collections.sort(faces);
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 {
// use CardFace because you might name a alternate names
Predicate<ICardFace> cpp = Predicates.alwaysTrue();

View File

@@ -35,6 +35,7 @@ import forge.game.zone.Zone;
import forge.game.zone.ZoneType;
import forge.item.PaperCard;
import forge.util.Aggregates;
import forge.util.CardTranslation;
import forge.util.Lang;
import forge.util.Localizer;
@@ -93,8 +94,7 @@ public class PlayEffect extends SpellAbilityEffect {
if (sa.hasParam("ShowCards")) {
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");
List<PaperCard> cards = null;
if (valid.startsWith("Names:")){
@@ -139,8 +139,14 @@ public class PlayEffect extends SpellAbilityEffect {
else {
return;
}
}
else {
} else if (sa.hasParam("CopyFromChosenName")) {
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();
// filter only cards that didn't changed zones
for (Card c : getTargetCards(sa)) {
@@ -179,7 +185,16 @@ public class PlayEffect extends SpellAbilityEffect {
while (!tgtCards.isEmpty() && amount > 0) {
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();
if (tgtCard == null) {
break;

View 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.)