From 7bad8154e314c7fce0b5521a4d5063bcc0e44624 Mon Sep 17 00:00:00 2001 From: twanvl Date: Sun, 13 May 2007 15:34:40 +0000 Subject: [PATCH] Nicer colors for card list/stats panel; Keywords updated so splits correctly git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@352 0fc631ac-6414-0410-93d0-97cfa31319b6 --- data/magic-blends.mse-include/card-colors | 128 +++++++++++++++++++++- data/magic.mse-game/game | 36 +++--- src/data/keyword.cpp | 10 ++ src/gui/control/keyword_list.cpp | 8 +- 4 files changed, 163 insertions(+), 19 deletions(-) diff --git a/data/magic-blends.mse-include/card-colors b/data/magic-blends.mse-include/card-colors index 708fcc5b..b9f3cea8 100644 --- a/data/magic-blends.mse-include/card-colors +++ b/data/magic-blends.mse-include/card-colors @@ -297,17 +297,137 @@ choice colors: hybrid vertical black / artifact : rgb(243,26,136) hybrid vertical red / artifact : rgb(243,26,136) hybrid vertical green / artifact : rgb(243,26,136) - # TODO : Add the rest # ... and for the card list choice colors cardlist: - white : rgb(130,130,110) + white : rgb(156,134,90) blue : rgb(0,64,168) black : rgb(0,0,0) red : rgb(168,0,0) green : rgb(0,168,0) - colorless : rgb(72,90,100) + colorless : rgb(119,83,83) artifact : rgb(72,90,100) multicolor : rgb(120,120,0) - land : rgb(84,84,60) + land : rgb(109,62,39) + # Sub menus, same colors + multicolor 2 color white / blue : rgb(120,120,0) + multicolor 2 color blue / black : rgb(120,120,0) + multicolor 2 color black / red : rgb(120,120,0) + multicolor 2 color red / green : rgb(120,120,0) + multicolor 2 color green / white : rgb(120,120,0) + multicolor 2 color white / black : rgb(120,120,0) + multicolor 2 color blue / red : rgb(120,120,0) + multicolor 2 color black / green : rgb(120,120,0) + multicolor 2 color red / white : rgb(120,120,0) + multicolor 2 color green / blue : rgb(120,120,0) + multicolor 3 color white / blue / black : rgb(120,120,0) + multicolor 3 color blue / black / red : rgb(120,120,0) + multicolor 3 color black / red / green : rgb(120,120,0) + multicolor 3 color red / green / white : rgb(120,120,0) + multicolor 3 color green / white / blue : rgb(120,120,0) + multicolor 3 color white / black / red : rgb(120,120,0) + multicolor 3 color blue / red / green : rgb(120,120,0) + multicolor 3 color black / green / white : rgb(120,120,0) + multicolor 3 color red / white / blue : rgb(120,120,0) + multicolor 3 color green / blue / black : rgb(120,120,0) + multicolor 4 color white / blue / black / red : rgb(120,120,0) + multicolor 4 color blue / black / red / green : rgb(120,120,0) + multicolor 4 color black / red / green / white : rgb(120,120,0) + multicolor 4 color red / green / white / blue : rgb(120,120,0) + multicolor 4 color green / white / blue / black : rgb(120,120,0) + multicolor 5 color white / blue / black / red / green : rgb(120,120,0) + multicolor 5 color horizontal white / blue / black / red / green: rgb(120,120,0) + land 1 color white : rgb(109,62,39) + land 1 color blue : rgb(109,62,39) + land 1 color black : rgb(109,62,39) + land 1 color red : rgb(109,62,39) + land 1 color green : rgb(109,62,39) + land 1 color multicolor : rgb(109,62,39) + land 2 color white / blue : rgb(109,62,39) + land 2 color blue / black : rgb(109,62,39) + land 2 color black / red : rgb(109,62,39) + land 2 color red / green : rgb(109,62,39) + land 2 color green / white : rgb(109,62,39) + land 2 color white / black : rgb(109,62,39) + land 2 color blue / red : rgb(109,62,39) + land 2 color black / green : rgb(109,62,39) + land 2 color red / white : rgb(109,62,39) + land 2 color green / blue : rgb(109,62,39) + hybrid 2 color white / blue : rgb(115,0,160) # purple + hybrid 2 color blue / black : rgb(115,0,160) + hybrid 2 color black / red : rgb(115,0,160) + hybrid 2 color red / green : rgb(115,0,160) + hybrid 2 color green / white : rgb(115,0,160) + hybrid 2 color white / black : rgb(115,0,160) + hybrid 2 color blue / red : rgb(115,0,160) + hybrid 2 color black / green : rgb(115,0,160) + hybrid 2 color red / white : rgb(115,0,160) + hybrid 2 color green / blue : rgb(115,0,160) + hybrid 2 color artifact / white : rgb(115,0,160) + hybrid 2 color artifact / blue : rgb(115,0,160) + hybrid 2 color artifact / black : rgb(115,0,160) + hybrid 2 color artifact / red : rgb(115,0,160) + hybrid 2 color artifact / green : rgb(115,0,160) + hybrid 3 color white / blue / black : rgb(115,0,160) + hybrid 3 color blue / black / red : rgb(115,0,160) + hybrid 3 color black / red / green : rgb(115,0,160) + hybrid 3 color red / green / white : rgb(115,0,160) + hybrid 3 color green / white / blue : rgb(115,0,160) + hybrid 3 color white / black / red : rgb(115,0,160) + hybrid 3 color blue / red / green : rgb(115,0,160) + hybrid 3 color black / green / white : rgb(115,0,160) + hybrid 3 color red / white / blue : rgb(115,0,160) + hybrid 3 color green / blue / black : rgb(115,0,160) + hybrid 3 color horizontal white / blue / black : rgb(115,0,160) + hybrid 3 color horizontal blue / black / red : rgb(115,0,160) + hybrid 3 color horizontal black / red / green : rgb(115,0,160) + hybrid 3 color horizontal red / green / white : rgb(115,0,160) + hybrid 3 color horizontal green / white / blue : rgb(115,0,160) + hybrid 3 color horizontal white / black / red : rgb(115,0,160) + hybrid 3 color horizontal blue / red / green : rgb(115,0,160) + hybrid 3 color horizontal black / green / white : rgb(115,0,160) + hybrid 3 color horizontal red / white / blue : rgb(115,0,160) + hybrid 3 color horizontal green / blue / black : rgb(115,0,160) + hybrid 4 color white / blue / black / red : rgb(115,0,160) + hybrid 4 color blue / black / red / green : rgb(115,0,160) + hybrid 4 color black / red / green / white : rgb(115,0,160) + hybrid 4 color red / green / white / blue : rgb(115,0,160) + hybrid 4 color green / white / blue / black : rgb(115,0,160) + hybrid 4 color horizontal white / blue / black / red : rgb(115,0,160) + hybrid 4 color horizontal blue / black / red / green : rgb(115,0,160) + hybrid 4 color horizontal black / red / green / white : rgb(115,0,160) + hybrid 4 color horizontal red / green / white / blue : rgb(115,0,160) + hybrid 4 color horizontal green / white / blue / black : rgb(115,0,160) + hybrid 5 color white / blue / black / red / green : rgb(115,0,160) + hybrid 5 color horizontal white / blue / black / red / green : rgb(115,0,160) + hybrid vertical white / blue : rgb(115,0,160) + hybrid vertical white / black : rgb(115,0,160) + hybrid vertical white / red : rgb(115,0,160) + hybrid vertical white / green : rgb(115,0,160) + hybrid vertical blue / white : rgb(115,0,160) + hybrid vertical blue / black : rgb(115,0,160) + hybrid vertical blue / red : rgb(115,0,160) + hybrid vertical blue / green : rgb(115,0,160) + hybrid vertical black / white : rgb(115,0,160) + hybrid vertical black / blue : rgb(115,0,160) + hybrid vertical black / red : rgb(115,0,160) + hybrid vertical black / green : rgb(115,0,160) + hybrid vertical red / white : rgb(115,0,160) + hybrid vertical red / blue : rgb(115,0,160) + hybrid vertical red / black : rgb(115,0,160) + hybrid vertical red / green : rgb(115,0,160) + hybrid vertical green / white : rgb(115,0,160) + hybrid vertical green / blue : rgb(115,0,160) + hybrid vertical green / red : rgb(115,0,160) + hybrid vertical green / black : rgb(115,0,160) + hybrid vertical artifact / white : rgb(115,0,160) + hybrid vertical artifact / blue : rgb(115,0,160) + hybrid vertical artifact / black : rgb(115,0,160) + hybrid vertical artifact / red : rgb(115,0,160) + hybrid vertical artifact / green : rgb(115,0,160) + hybrid vertical white / artifact : rgb(115,0,160) + hybrid vertical blue / artifact : rgb(115,0,160) + hybrid vertical black / artifact : rgb(115,0,160) + hybrid vertical red / artifact : rgb(115,0,160) + hybrid vertical green / artifact : rgb(115,0,160) # TODO : Add the rest diff --git a/data/magic.mse-game/game b/data/magic.mse-game/game index 12b1a5aa..7360e592 100644 --- a/data/magic.mse-game/game +++ b/data/magic.mse-game/game @@ -157,7 +157,7 @@ init script: if input.separator_before == "—" then "{input.param}" else - "{add}{input.param}" + "{add}{input.param}" } alternative_cost := replace_rule(match:"^[A-Z]", replace: { to_lower() }) format_alt_cost := { @@ -184,7 +184,7 @@ init script: |adds?|pay(ed)?[ ](with|using) ) ([ ]either)? # pay either X or Y - ([ ]]*>[STXYZWUBRG0-9/|]+]*>[ ](and|or))* # pay X or Y + ([ ]]*>[STXYZWUBRG0-9/|]+]*>[ ](and|or|and/or))* # pay X or Y [ ] ([,.)]|$ # (end of word) |[ ][^ .,]*$ # still typing... @@ -639,8 +639,8 @@ card field: basic land: rgb(109,62,39) common: rgb(33,33,33) uncommon: rgb(224,224,224) - rare: rgb(214,196,94) - special: rgb(58,7,80) + rare: rgb(255,207,52) + special: rgb(190,0,255) ############################# Text box card field: @@ -979,6 +979,16 @@ statistics dimension: multicolor : rgb(255,188,14) land : rgb(109,62,39) hybrid : rgb(243,26,136) + group: white + group: blue + group: black + group: red + group: green + group: colorless + group: artifact + group: multicolor + group: land + group: hybrid statistics dimension: name: converted mana cost @@ -1006,6 +1016,7 @@ statistics dimension: statistics category: name: color / rarity + type: stack dimension: card color2 dimension: rarity @@ -1174,7 +1185,7 @@ keyword parameter type: match: [^(,\n]+ keyword parameter type: name: name - match: [^(.,\n-—]+ + match: [^(.,\n—-]+ keyword parameter type: name: prefix description: Prefix for things like "walk" @@ -1290,6 +1301,11 @@ keyword: match: Fading number mode: expert reminder: This comes into play with {english_number_a(param1)} fade counter(s) on it. At the beginning of your upkeep, remove a fade counter from it. If you can’t, sacrifice it. +keyword: + keyword: Kicker + match: Kicker mana and/or mana + mode: expert + reminder: You may pay an additional {param1} and/or {param2} as you play this spell. keyword: keyword: Kicker match: Kicker cost @@ -1365,15 +1381,9 @@ keyword: match: Sunburst mode: expert reminder: This comes into play with a {if has_pt() then "+1/+1" else "charge"} counter on it for each color of mana used to pay its cost. -#Two versions of splice needed because if there's no separator, the program doesn't know when to switch from param1 to param2. keyword: - keyword: Splice (Mana Cost) - match: Splice onto name mana - mode: expert - reminder: As you play a {param1} spell, you may reveal this card from your hand and pay its splice cost. If you do, add this card’s effects to that spell. -keyword: - keyword: Splice (Alternative Cost) - match: Splice onto nameaction + keyword: Splice + match: Splice onto name cost mode: expert reminder: As you play a {param1} spell, you may reveal this card from your hand and pay its splice cost. If you do, add this card’s effects to that spell. keyword: diff --git a/src/data/keyword.cpp b/src/data/keyword.cpp index 7741d10a..7a951d5e 100644 --- a/src/data/keyword.cpp +++ b/src/data/keyword.cpp @@ -359,6 +359,7 @@ void KeywordDatabase::add(const Keyword& kw) { // Add to trie String text; // normal text size_t param = 0; + bool only_star = true; for (size_t i = 0 ; i < kw.match.size() ;) { Char c = kw.match.GetChar(i); if (is_substr(kw.match, i, _("insert(text); text.clear(); cur = cur->insertAnyStar(); + // enough? + if (!only_star) { + // If we have matched anything specific, this is a good time to stop + // it doesn't really matter how long we go on, since the trie is only used + // as an optimization to not have to match lots of regexes. + // As an added bonus, we get a better behaviour of matching earlier keywords first. + break; + } } else { text += c; i++; + only_star = false; } } cur = cur->insert(text); diff --git a/src/gui/control/keyword_list.cpp b/src/gui/control/keyword_list.cpp index dbaae30c..6719f22c 100644 --- a/src/gui/control/keyword_list.cpp +++ b/src/gui/control/keyword_list.cpp @@ -137,7 +137,11 @@ int KeywordList::OnGetItemImage(long pos) const { wxListItemAttr* KeywordList::OnGetItemAttr(long pos) const { // black for set keywords, grey for game keywords (uneditable) const Keyword& kw = *getKeyword(pos); - if (!kw.fixed) return nullptr; - item_attr.SetTextColour(lerp(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW),wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),0.5)); + if (!kw.fixed && kw.valid) return nullptr; + if (!kw.valid) { + item_attr.SetTextColour(*wxRED); + } else if (kw.fixed) { + item_attr.SetTextColour(lerp(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW),wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),0.5)); + } return &item_attr; }