improve connive and explore

added new face_code to improve this_or_that for action keywords.
face_if_ruletext_flipthis_<keyword>_then_that <type>_else_{this_or_that("<type>")}_end
if this_or_that returns "that <type>", it still resolves as that
if it returns "this <type>" and the face's rule_text matches (it|he|she|they|He|She|They|CARDNAME|THIS) <keyword>, it still resolves as that.
otherwise it switches to "that <type>"
This commit is contained in:
cajun
2025-10-12 03:45:24 -05:00
parent e8877d0ceb
commit 15f4ccc781
2 changed files with 19 additions and 9 deletions

View File

@@ -1247,7 +1247,7 @@ keyword:
keyword: Explore keyword: Explore
match: explores match: explores
mode: action mode: action
reminder: {handle_action_rt(to:"explore", "Reveal")} the top card of your library. Put that card into your hand if it's a land. Otherwise, put a +1/+1 counter on {this_or_that("creature")}, then put the card back or put it into your graveyard. reminder: {handle_action_rt(to:"explore", "Reveal")} the top card of your library. Put that card into your hand if it's a land. Otherwise, put a +1/+1 counter on face_if_ruletext_flipthis_explores_then_that creature_else_{this_or_that("creature")}_end, then put the card back or put it into your graveyard.
#Unstable #Unstable
keyword: keyword:
keyword: Assemble a Contraption keyword: Assemble a Contraption
@@ -1577,17 +1577,17 @@ keyword:
keyword: Connive keyword: Connive
match: connive match: connive
mode: action mode: action
reminder: {handle_action_rt(to:"have a creature connive", "Draw")} a card, then discard a card. If you discarded a nonland card, put a +1/+1 counter on that creature. reminder: To have a creature connive, draw a card, then discard a card. If you discarded a nonland card, put a +1/+1 counter on that creature.
keyword: keyword:
keyword: Connives keyword: Connives
match: connives match: connives
mode: action mode: action
reminder: {handle_action_rt(to:"have a creature connive", "Draw")} a card, then discard a card. If you discarded a nonland card, put a +1/+1 counter on {this_or_that("creature")}. reminder: {handle_action_rt(to:"have a creature connive", "Draw")} a card, then discard a card. If you discarded a nonland card, put a +1/+1 counter on face_if_ruletext_flipthis_connives_then_that creature_else_{this_or_that("creature")}_end.
keyword: keyword:
keyword: Connives N keyword: Connives N
match: connives <atom-param>number</atom-param> match: connives <atom-param>number</atom-param>
mode: action mode: action
reminder: {handle_action_rt(to:"have a creature connive", "Draw")} {english_number_a(param1)} card(s), then discard {english_number_a(param1)} card(s). Put a +1/+1 counter on {this_or_that("creature")} for each nonland card discarded this way. reminder: {handle_action_rt(to:"have a creature connive", "Draw")} {english_number_a(param1)} card(s), then discard {english_number_a(param1)} card(s). Put a +1/+1 counter on face_if_ruletext_flipthis_connives_then_that creature_else_{this_or_that("creature")}_end for each nonland card discarded this way.
keyword: keyword:
keyword: Blitz keyword: Blitz
match: Blitz <atom-param>cost</atom-param> match: Blitz <atom-param>cost</atom-param>

View File

@@ -1999,11 +1999,10 @@ flavor_text_filter :=
card_face := { card_face := {
front := card[input] front := card[input]
back := if card[input+"_2"] or else "" != "" then card[input+"_2"] else card[input] back := if card[input+"_2"] or else "" != "" then card[input+"_2"] else card[input]
if match(margin_code, match:"(text[2456]|lv[5678])") then back else front if match(margin_code, match:"(text[2456]|lv9|lv1[0-6])") then back else front
} }
face_code := { face_code := {
face := "" face := if match_text(margin_code, match:"(text[2456]|lv9|lv1[0-6])") then "_2" else ""
if margin_code == "text2" or margin_code == "lv5" or margin_code == "lv6" or margin_code == "lv7" or margin_code == "lv8" then face := "_2"
output := face_scripts[input](face) or else if_parse(input, face:face) or else input output := face_scripts[input](face) or else if_parse(input, face:face) or else input
output output
} }
@@ -2023,6 +2022,16 @@ face_scripts := [
contains(card[field+face], match:query) contains(card[field+face], match:query)
}, },
notcontains: {not contains(card[field+face], match:query)}, notcontains: {not contains(card[field+face], match:query)},
flipthis: {
# always send back That/that
# send back This/this if (it|he|she|they|CARDNAME) keywords
# else flip to That/that
if t == f
then false
else if match_text(card[field+face], match:"(\\bit|\\b[Hh]e|\\b[Ss]he|\\b[Tt]hey|<atom-(card|print)name>.*?</atom-(card|print)name>) <kw[^>]+><nospellcheck><key>"+query)
then false
else true
},
name: {card["name"+face]}, name: {card["name"+face]},
cost: {card["casting_cost"+face]}, cost: {card["casting_cost"+face]},
altname: {card["name"+flip_face(face)]}, altname: {card["name"+flip_face(face)]},
@@ -2034,7 +2043,8 @@ face_scripts := [
expand_facecodes := [ expand_facecodes := [
subtype: "sub_type", subtype: "sub_type",
castingcost: "casting_cost", castingcost: "casting_cost",
manacost: "casting_cost" manacost: "casting_cost",
ruletext: "rule_text"
] ]
if_parse := replace@( if_parse := replace@(
match: "if_(.*)_then_(.*)_else_(.*)", match: "if_(.*)_then_(.*)_else_(.*)",
@@ -2051,7 +2061,7 @@ if_scripts := {
query := contCheck[2] query := contCheck[2]
) )
field := expand_facecodes[field] or else field field := expand_facecodes[field] or else field
if face_scripts[func](face, field:field, query:query) or else false then t else f if face_scripts[func](face, field:field, query:query, t:t, f:f) or else false then t else f
} }
############################################################## Level Margins ############################################################## Level Margins
#### these will be determined by the style affecting the margins and otherwise be 0 #### these will be determined by the style affecting the margins and otherwise be 0