hurkyl_master_wizard.txt refactor

This commit is contained in:
Northmoc
2022-10-31 13:23:23 -04:00
parent 53d6facd65
commit c79888c238
2 changed files with 36 additions and 22 deletions

View File

@@ -1,22 +1,19 @@
package forge.game.ability.effects; package forge.game.ability.effects;
import java.util.Collections; import java.util.*;
import java.util.List;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import forge.GameCommand; import forge.GameCommand;
import forge.card.CardType;
import forge.game.Game; import forge.game.Game;
import forge.game.GameEntityCounterTable; import forge.game.GameEntityCounterTable;
import forge.game.GameObject; import forge.game.GameObject;
import forge.game.ability.AbilityUtils; import forge.game.ability.AbilityUtils;
import forge.game.ability.SpellAbilityEffect; import forge.game.ability.SpellAbilityEffect;
import forge.game.card.*;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.card.CardCollectionView;
import forge.game.card.CardDamageMap;
import forge.game.card.CardLists;
import forge.game.card.CardZoneTable;
import forge.game.player.Player; import forge.game.player.Player;
import forge.game.spellability.SpellAbility; import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityStackInstance; import forge.game.spellability.SpellAbilityStackInstance;
@@ -139,6 +136,33 @@ public class RepeatEachEffect extends SpellAbilityEffect {
} }
} }
if (sa.hasParam("RepeatTypesFromDefined")) {
final String def = sa.getParam("RepeatTypesFromDefined");
final Set<String> validTypes = new HashSet<>();
final List<Card> res;
if (def.startsWith("ThisTurnCast")) {
final String[] workingCopy = def.split("_");
final String validFilter = workingCopy[1];
res = CardUtil.getThisTurnCast(validFilter, source, sa);
} else {
res = AbilityUtils.getDefinedCards(source, def, sa);
}
for (final Card c : res) {
for (CardType.CoreType type : c.getType().getCoreTypes()) {
validTypes.add(type.name());
}
}
final String storedType = source.getChosenType();
while (validTypes.size() > 0) {
String chosenT = player.getController().chooseSomeType("card", sa, validTypes, null);
source.setChosenType(chosenT);
AbilityUtils.resolve(repeat);
validTypes.remove(chosenT);
}
source.setChosenType(storedType);
}
if (sa.hasParam("RepeatPlayers")) { if (sa.hasParam("RepeatPlayers")) {
final FCollection<Player> repeatPlayers = AbilityUtils.getDefinedPlayers(source, sa.getParam("RepeatPlayers"), sa); final FCollection<Player> repeatPlayers = AbilityUtils.getDefinedPlayers(source, sa.getParam("RepeatPlayers"), sa);
if (sa.hasParam("ClearRememberedBeforeLoop")) { if (sa.hasParam("ClearRememberedBeforeLoop")) {

View File

@@ -1,24 +1,14 @@
Name:Hurkyl, Master Wizard Name:Hurkyl, Master Wizard
ManaCost:1 U U ManaCost:1 U U
Types:Legendary Creature - Human Wizard Advisor Types:Legendary Creature Human Wizard Advisor
PT:2/4 PT:2/4
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | TriggerZones$ Battlefield | CheckSVar$ X | SVarCompare$ GE1 | Execute$ TrigDig | TriggerDescription$ At the beginning of your end step, if you've cast a noncreature spell this turn, reveal the top five cards of your library. For each card type among noncreature spells you've cast this turn, you may put a card of that type from among the revealed cards into your hand. Put the rest on the bottom of your library in a random order. T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | TriggerZones$ Battlefield | CheckSVar$ X | SVarCompare$ GE1 | Execute$ TrigDig | TriggerDescription$ At the beginning of your end step, if you've cast a noncreature spell this turn, reveal the top five cards of your library. For each card type among noncreature spells you've cast this turn, you may put a card of that type from among the revealed cards into your hand. Put the rest on the bottom of your library in a random order.
SVar:TrigDig:DB$ Dig | DigNum$ 5 | Reveal$ True | NoMove$ True | RememberRevealed$ True | SubAbility$ DBChooseCardOne SVar:TrigDig:DB$ Dig | DigNum$ 5 | Reveal$ True | NoMove$ True | RememberRevealed$ True | SubAbility$ DBRepeatEach
SVar:DBChooseCardOne:DB$ ChooseCard | Defined$ You | Choices$ Instant.YouCtrl+IsRemembered | ImprintChosen$ True | ConditionCheckSVar$ CheckInstant | ConditionSVarCompare$ EQ1 | ChoiceTitle$ You may choose an instant card if you cast an instant spell this turn | ChoiceZone$ Library | AILogic$ BestCard | SubAbility$ DBChooseCardTwo SVar:DBRepeatEach:DB$ RepeatEach | RepeatTypesFromDefined$ ThisTurnCast_Card.nonCreature+YouCtrl | RepeatSubAbility$ ChooseCard | SubAbility$ DBChangeZoneAll
SVar:DBChooseCardTwo:DB$ ChooseCard | Defined$ You | Choices$ Sorcery.YouCtrl+IsRemembered | ImprintChosen$ True | ConditionCheckSVar$ CheckSorcery | ConditionSVarCompare$ EQ1 | ChoiceTitle$ You may choose a sorcery card if you cast a sorcery spell this turn | ChoiceZone$ Library | AILogic$ BestCard | SubAbility$ DBChooseCardThree SVar:ChooseCard:DB$ ChooseCard | Choices$ Card.IsRemembered+ChosenType | ImprintChosen$ True | ForgetChosen$ True | ChoiceTitle$ You may choose a card of this type to put into your hand | ChoiceZone$ Library | AILogic$ BestCard
SVar:DBChooseCardThree:DB$ ChooseCard | Defined$ You | Choices$ Planeswalker.YouCtrl+IsRemembered | ImprintChosen$ True | ConditionCheckSVar$ CheckPlaneswalker | ConditionSVarCompare$ EQ1 | ChoiceTitle$ You may choose a planeswalker card if you cast a planeswalker spell this turn | ChoiceZone$ Library | AILogic$ BestCard | SubAbility$ DBChooseCardFour
SVar:DBChooseCardFour:DB$ ChooseCard | Defined$ You | Choices$ Tribal.YouCtrl+IsRemembered | ImprintChosen$ True | ConditionCheckSVar$ CheckTribal | ConditionSVarCompare$ EQ1 | ChoiceTitle$ You may choose a tribal card if you cast a tribal spell this turn | ChoiceZone$ Library | AILogic$ BestCard | SubAbility$ DBChooseCardFive
SVar:DBChooseCardFive:DB$ ChooseCard | Defined$ You | Choices$ Enchantment.YouCtrl+IsRemembered | ImprintChosen$ True | ConditionCheckSVar$ CheckEnchantment | ConditionSVarCompare$ EQ1 | ChoiceTitle$ You may choose an enchantment card if you cast an enchantment spell this turn | ChoiceZone$ Library | AILogic$ BestCard | SubAbility$ DBChooseCardSix
SVar:DBChooseCardSix:DB$ ChooseCard | Defined$ You | Choices$ Artifact.YouCtrl+IsRemembered | ImprintChosen$ True | ChoiceTitle$ You may choose an artifact card if you cast an artifact spell this turn | ChoiceZone$ Library | AILogic$ BestCard | ConditionCheckSVar$ CheckArtifact | ConditionSVarCompare$ EQ1 | SubAbility$ DBChangeZoneAll
SVar:DBChangeZoneAll:DB$ ChangeZone | Defined$ Imprinted | Origin$ Library | Destination$ Hand | SubAbility$ DBRestRandomOrder SVar:DBChangeZoneAll:DB$ ChangeZone | Defined$ Imprinted | Origin$ Library | Destination$ Hand | SubAbility$ DBRestRandomOrder
SVar:DBRestRandomOrder:DB$ ChangeZoneAll | ChangeType$ Card.IsRemembered | Origin$ Library | Destination$ Library | LibraryPosition$ -1 | RandomOrder$ True | SubAbility$ DBCleanup SVar:DBRestRandomOrder:DB$ ChangeZoneAll | ChangeType$ Card.IsRemembered | Origin$ Library | Destination$ Library | LibraryPosition$ -1 | RandomOrder$ True | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True | ClearImprinted$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True | ClearImprinted$ True | ClearChosenCard$ True
SVar:X:Count$ThisTurnCast_Card.nonCreature+YouCtrl SVar:X:Count$ThisTurnCast_Card.nonCreature+YouCtrl
SVar:CheckArtifact:Count$ThisTurnCast_Card.Artifact.YouCtrl SVar:BuffedBy:Card.nonCreature
SVar:CheckEnchantment:Count$ThisTurnCast_Enchantment.YouCtrl
SVar:CheckInstant:Count$ThisTurnCast_Instant.YouCtrl
SVar:CheckSorcery:Count$ThisTurnCast_Sorcery.YouCtrl
SVar:CheckPlaneswalker:Count$ThisTurnCast_Planeswalker.YouCtrl
SVar:CheckTribal:Count$ThisTurnCast_Tribal.YouCtrl
DeckHints:Type$Artifact
Oracle:At the beginning of your end step, if you've cast a noncreature spell this turn, reveal the top five cards of your library. For each card type among noncreature spells you've cast this turn, you may put a card of that type from among the revealed cards into your hand. Put the rest on the bottom of your library in a random order. Oracle:At the beginning of your end step, if you've cast a noncreature spell this turn, reveal the top five cards of your library. For each card type among noncreature spells you've cast this turn, you may put a card of that type from among the revealed cards into your hand. Put the rest on the bottom of your library in a random order.