From 45bd4acd07eff32b437c34e8664497a8a0746586 Mon Sep 17 00:00:00 2001 From: twanvl Date: Sun, 13 May 2007 16:05:59 +0000 Subject: [PATCH] Added match_rule to replace filter_rule + {input!=""}; Default color for lands does not look at costs git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@354 0fc631ac-6414-0410-93d0-97cfa31319b6 --- data/magic-default-image.mse-include/scripts | 2 ++ data/magic.mse-game/game | 22 +++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/data/magic-default-image.mse-include/scripts b/data/magic-default-image.mse-include/scripts index 75409c16..8c0a2e04 100644 --- a/data/magic-default-image.mse-include/scripts +++ b/data/magic-default-image.mse-include/scripts @@ -16,12 +16,14 @@ default_image := { else if input == "red" then default_image_1("red.jpg") else if input == "black" then default_image_1("black.jpg") else if input == "green" then default_image_1("green.jpg") + else if input == "land" then default_image_2(image1:"colorless.jpg", image2:"artifact.jpg") else if input == "land 1 color white" then default_image_2(image1:"colorless.jpg", image2:"white.jpg") else if input == "land 1 color blue" then default_image_2(image1:"colorless.jpg", image2:"blue.jpg") else if input == "land 1 color red" then default_image_2(image1:"colorless.jpg", image2:"red.jpg") else if input == "land 1 color black" then default_image_2(image1:"colorless.jpg", image2:"black.jpg") else if input == "land 1 color green" then default_image_2(image1:"colorless.jpg", image2:"green.jpg") else if input == "land 1 color multicolor" then default_image_2(image1:"colorless.jpg", image2:"multicolor.jpg") + else if is_land() then default_image_2(image1:"colorless.jpg", image2:"multicolor.jpg") else if input == "hybrid 2 color white / blue" then default_image_2(image1:"white.jpg", image2:"blue.jpg" ) else if input == "hybrid 2 color blue / black" then default_image_2(image1:"blue.jpg", image2:"black.jpg") else if input == "hybrid 2 color black / red" then default_image_2(image1:"black.jpg", image2:"red.jpg" ) diff --git a/data/magic.mse-game/game b/data/magic.mse-game/game index 7360e592..52f917c5 100644 --- a/data/magic.mse-game/game +++ b/data/magic.mse-game/game @@ -89,7 +89,15 @@ init script: } # color based on land text box, input = textbox contents - color_text_filter := filter_rule(match: "]*>([^<]+)") + color_filter; + color_text_filter := + # remove activation costs + replace_rule( + match: "]*>[^<]+]*>" + in_context: "(?ix)(,|:)|(pays?|additional|costs?)[ ]", + replace: "" + ) + + # keep only mana + filter_rule(match: "]*>([^<]+)") + color_filter; land_to_color := { # Based on watermark if card.watermark = "mana symbol white" then "land 1 color white" @@ -122,10 +130,10 @@ init script: # Index for sorting, white cards are first, so white->A, blue->B, .. , # multi->F, hybrid->G, arti->H, land->J, basic land->I - is_multicolor := filter_rule(match: "^multicolor") + {input != ""}; - is_hybrid := filter_rule(match: "^hybrid") + {input != ""}; - is_colorless := filter_rule(match: "^colorless") + {input != ""}; - is_artifact := filter_rule(match: "^artifact") + {input != ""}; + is_multicolor := match_rule(match: "^multicolor") + is_hybrid := match_rule(match: "^hybrid") + is_colorless := match_rule(match: "^colorless") + is_artifact := match_rule(match: "^artifact") sort_index := { if card.casting_cost_2 !="" and card.card_color != card.card_color_2 then "H" else if card.card_color=="white" then "A" @@ -141,8 +149,8 @@ init script: }; # The color of a card - is_artifact := filter_rule(match: "(?i)Artifact") + {input != ""}; - is_land := filter_rule(match: "(?i)Land") + {input != ""}; + is_artifact := match_rule(match: "(?i)Artifact") + is_land := match_rule(match: "(?i)Land") card_color := { # usually the color of mana mana_color := mana_to_color(casting_cost);