Skip to content

Commit

Permalink
Merge pull request #6614 from Northmoc/ydsk4
Browse files Browse the repository at this point in the history
YDSK: harrowing_swarm.txt + support
  • Loading branch information
paulsnoops authored Nov 25, 2024
2 parents 2e8a373 + 05d812d commit 239ad37
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 44 deletions.
92 changes: 48 additions & 44 deletions forge-game/src/main/java/forge/game/cost/CostAdjustment.java
Original file line number Diff line number Diff line change
Expand Up @@ -526,64 +526,68 @@ private static boolean checkRequirement(final SpellAbility sa, final StaticAbili
}

if (st.hasParam("Type")) {
final String type = st.getParam("Type");
if (type.equals("Spell")) {
if (!sa.isSpell()) {
return false;
}
if (st.hasParam("OnlyFirstSpell")) {
if (activator == null ) {
switch (st.getParam("Type")) {
case "Spell" -> {
if (!sa.isSpell()) {
return false;
}
List<Card> list;
if (st.hasParam("ValidCard")) {
list = CardUtil.getThisTurnCast(st.getParam("ValidCard"), hostCard, st, controller);
} else {
list = game.getStack().getSpellsCastThisTurn();
}
if (st.hasParam("OnlyFirstSpell")) {
if (activator == null) {
return false;
}
List<Card> list;
if (st.hasParam("ValidCard")) {
list = CardUtil.getThisTurnCast(st.getParam("ValidCard"), hostCard, st, controller);
} else {
list = game.getStack().getSpellsCastThisTurn();
}

if (st.hasParam("ValidSpell")) {
list = CardLists.filterAsList(list, CardPredicates.castSA(
SpellAbilityPredicates.isValid(st.getParam("ValidSpell").split(","), controller, hostCard, st))
);
}
if (st.hasParam("ValidSpell")) {
list = CardLists.filterAsList(list, CardPredicates.castSA(
SpellAbilityPredicates.isValid(st.getParam("ValidSpell").split(","), controller, hostCard, st))
);
}

if (CardLists.filterControlledBy(list, activator).size() > 0) {
return false;
if (!CardLists.filterControlledBy(list, activator).isEmpty()) return false;
}
}
} else if (type.equals("Ability")) {
if (!sa.isActivatedAbility() || sa.isReplacementAbility()) {
return false;
}
if (st.hasParam("OnlyFirstActivation")) {
int times = 0;
for (IndividualCostPaymentInstance i : game.costPaymentStack) {
SpellAbility paymentSa = i.getPayment().getAbility();
if (paymentSa.isActivatedAbility() && st.matchesValidParam("ValidCard", paymentSa.getHostCard())) {
times++;
if (times > 1) {
return false;
case "Ability" -> {
if (!sa.isActivatedAbility() || sa.isReplacementAbility()) {
return false;
}
if (st.hasParam("OnlyFirstActivation")) {
int times = 0;
for (IndividualCostPaymentInstance i : game.costPaymentStack) {
SpellAbility paymentSa = i.getPayment().getAbility();
if (paymentSa.isActivatedAbility() && st.matchesValidParam("ValidCard", paymentSa.getHostCard())) {
times++;
if (times > 1) {
return false;
}
}
}
}
}
} else if (type.equals("NonManaAbility")) {
if (!sa.isActivatedAbility() || sa.isManaAbility() || sa.isReplacementAbility()) {
return false;
}
} else if (type.equals("MorphDown")) {
if (!sa.isSpell() || !sa.isCastFaceDown()) {
return false;
case "NonManaAbility" -> {
if (!sa.isActivatedAbility() || sa.isManaAbility() || sa.isReplacementAbility()) {
return false;
}
}
} else if (type.equals("Foretell")) {
if (!sa.isForetelling()) {
return false;
case "MorphDown" -> {
if (!sa.isSpell() || !sa.isCastFaceDown()) {
return false;
}
}
if (st.hasParam("FirstForetell") && activator.getNumForetoldThisTurn() > 0) {
return false;
case "Foretell" -> {
if (!sa.isForetelling()) {
return false;
}
if (st.hasParam("FirstForetell") && activator.getNumForetoldThisTurn() > 0) {
return false;
}
}
}

}
if (st.hasParam("AffectedZone")) {
List<ZoneType> zones = ZoneType.listValueOf(st.getParam("AffectedZone"));
Expand Down
10 changes: 10 additions & 0 deletions forge-gui/res/cardsfolder/h/harrowing_swarm.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Name:Harrowing Swarm
ManaCost:1 G
Types:Sorcery
A:SP$ ManifestDread | SubAbility$ DBAnimate | SpellDescription$ Manifest dread.
SVar:DBAnimate:DB$ AnimateAll | ValidCards$ Creature.faceDown+YouCtrl | Zone$ Battlefield | staticAbilities$ ReduceCost | Triggers$ TurnedFaceUp | Duration$ Permanent | StackDescription$ SpellDescription | SpellDescription$ Then each face-down creature you control gains "This permanent costs {2} less to turn face up" and "When this permanent is turned face up, if it's a creature, put a +1/+1 counter on it."
SVar:ReduceCost:Mode$ ReduceCost | Amount$ 2 | ValidSpell$ Static.isTurnFaceUp | ValidCard$ Card.Self | Activator$ You | EffectZone$ All | Description$ This permanent costs {2} less to turn face up.
SVar:TurnedFaceUp:Mode$ TurnFaceUp | ValidCard$ Card.Self | Execute$ TrigPump | TriggerZones$ Battlefield | TriggerDescription$ When this permanent is turned face up, if it's a creature, put a +1/+1 counter on it.
SVar:TrigPump:DB$ PutCounter | Defined$ TriggeredCard | CounterType$ P1P1 | ConditionDefined$ TriggeredCard | ConditionPresent$ Creature
DeckHas:Ability$Counters
Oracle:Manifest dread. Then each face-down creature you control gains "This permanent costs {2} less to turn face up" and "When this permanent is turned face up, if it's a creature, put a +1/+1 counter on it."

0 comments on commit 239ad37

Please sign in to comment.