Commit da864989 authored by twanvl's avatar twanvl

implemented justification;

fixed initialization bug in item_list;
commented out statistics fields for debugging and added 'match' for all keywords in magic.mse-game
parent 37398185
......@@ -778,28 +778,28 @@ statistics dimension:
numeric: true
icon: stats/colored_casting_cost.png
statistics dimension:
name: power2
script: card.power
numeric: true
icon: stats/power.png
#statistics dimension:
# name: power2
# script: card.power
# numeric: true
# icon: stats/power.png
statistics dimension:
name: toughness2
script: card.toughness
numeric: true
icon: stats/toughness.png
#statistics dimension:
# name: toughness2
# script: card.toughness
# numeric: true
# icon: stats/toughness.png
statistics category:
name: color / rarity
dimension: card_color
dimension: rarity
#statistics category:
# name: color / rarity
# dimension: card_color
# dimension: rarity
statistics category:
name: power / toughness
type: scatter
dimension: power2
dimension: toughness2
#statistics category:
# name: power / toughness
# type: scatter
# dimension: power2
# dimension: toughness2
#statistics field:
# name: creature type
......@@ -938,18 +938,22 @@ keyword parameter type:
keyword:
keyword: Flying
match: Flying
mode: core
reminder: This creature can’t be blocked except by creatures with flying.
keyword:
keyword: Haste
match: Haste
mode: core
reminder: This creature can attack and tap the turn it comes under your control.
keyword:
keyword: Fear
match: Fear
mode: core
reminder: This creature can’t be blocked except by artifact creatures and/or black creatures.
keyword:
keyword: First strike
match: First strike
mode: core
reminder: This creature deals combat damage before creatures without first strike.
keyword:
......@@ -964,10 +968,12 @@ keyword:
reminder: {param1}, Discard this card: Draw a card.
keyword:
keyword: Trample
match: Trample
mode: core
reminder: If this creature would deal enough combat damage to its blockers to destroy them, you may have it deal the rest of its damage to defending player.
keyword:
keyword: Banding
match: Banding
mode: old
reminder: When declaring attackers or blockers this creature may group with others creatures with banding and one creature without banding. When damage is dealt, you decide where damage is dealt.
keyword:
......@@ -977,10 +983,12 @@ keyword:
reminder: Whenever this creature becomes blocked, it gets +{param1}/+{param1} until end of turn for each creature blocking it beyond the first.
keyword:
keyword: Vigilance
match: Vigilance
mode: core
reminder: Attacking doesn’t cause this creature to tap.
keyword:
keyword: Defender
match: Defender
mode: core
reminder: This creature can’t attack.
keyword:
......@@ -990,10 +998,12 @@ keyword:
reminder: At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay {param1} for each age counter on it.
keyword:
keyword: Horsemanship
match: Horsemanship
mode: old
reminder: This creature can’t be blocked except by creatures with horsemanship.
keyword:
keyword: Phasing
match: Phasing
mode: old
reminder: At the beginning of your upkeep, put this and any cards attached to it in the phased-out zone. If this is already in the phased-out zone, return it and any card attached to it to play. If there were counters on this card when it phased out, put that many counters on it when it returns to play. This ability does not cause comes-into-play or leaves play abilities to trigger.
keyword:
......@@ -1003,6 +1013,7 @@ keyword:
reminder: Whenever a creature without flanking blocks this creature, the blocking creature gets -{param1}/-{param1} until end of turn.
keyword:
keyword: Shadow
match: Shadow
mode: core
reminder: This creature can block or be blocked by only creatures with shadow.
keyword:
......@@ -1012,6 +1023,7 @@ keyword:
reminder: You may pay {param1} in addition to any other costs as you play this spell. If you do, put ~ into your hand instead of your graveyard as part of its resolution.
keyword:
keyword: Echo
match: Echo
mode: expert
reminder: At the beginning of your next upkeep after this permanent comes under your control, sacrifice it unless you pay its mana cost.
keyword:
......@@ -1056,14 +1068,17 @@ keyword:
reminder: As this card comes into play, put {english_number(param1)} +1/+1 counter(s) on it for each creature that shares a type with this that you reveal in your hand.
keyword:
keyword: Double strike
match: Double strike
mode: expert
reminder: This creature deals both first-strike and regular combat damage.
keyword:
keyword: Provoke
match: Provoke
mode: expert
reminder: When this attacks, you may have target creature defending player controls untap and block it if able.
keyword:
keyword: Storm
match: Storm
mode: expert
reminder: When you play this spell, copy it for each spell played before it this turn. You may choose new targets for the copies.
keyword:
......@@ -1098,6 +1113,7 @@ keyword:
reminder: Look at the top {english_number_multiple(param1)} card(s) of your library. Put any number of them on the bottom of your library in any order and the rest on top of your library in any order.
keyword:
keyword: Sunburst
match: Sunburst
mode: expert
reminder: This comes into play with a +1/+1 counter on it for each color of mana used to pay its cost. If it is not a creature, use charge counters instead.
keyword:
......@@ -1127,10 +1143,12 @@ keyword:
reminder: When this is put into a graveyard from play, you may return target Spirit card with converted mana cost {param1} or less from you graveyard to your hand.
keyword:
keyword: Epic
match: Epic
mode: expert
reminder: For the rest of the game, you can’t play spells. At the beginning of each of your upkeeps, copy this spell except for its epic ability. If the spell has any targets, you may choose new targets for the copy.
keyword:
keyword: Convoke
match: Convoke
mode: expert
reminder: Each creature you tap while playing this spell reduces its cost by <sym>1</sym> or by one mana of that creature’s color.
keyword:
......@@ -1140,6 +1158,7 @@ keyword:
reminder: {param1}, Discard this card: Search your library for a card with the same converted mana cost as this card, reveal it, and put it into your hand. Then shuffle your library. Play only as a sorcery.
keyword:
keyword: Haunt
match: Haunt
mode: expert
reminder: When this card is put into a graveyard from play, remove it from the game haunting target creature.
keyword:
......@@ -1154,18 +1173,22 @@ keyword:
reminder: When you play this spell, copy it for each time you paid its replicate cost. You may choose new targets for the copies.
keyword:
keyword: Legendary Landwalk
match: Legendary Landwalk
mode: core
reminder: This creature is unblockable as long as defending player controls a Legendary land.
keyword:
keyword: Non-basic Landwalk
match: Non-basic Landwalk
mode: core
reminder: This creature is unblockable as long as defending player controls a non-basic land.
keyword:
keyword: Snow-covered Landwalk
match: Snow-covered Landwalk
mode: core
reminder: This creature is unblockable as long as defending player controls a Snow-covered land.
keyword:
keyword: Denimwalk
match: Denimwalk
mode: core
reminder: If defending player is wearing any clothing made of denim, this creature is unblockable.
keyword:
......
......@@ -13,6 +13,8 @@
ItemList::ItemList(Window* parent, int id, long additional_style)
: wxListView(parent, id, wxDefaultPosition, wxDefaultSize, additional_style | wxLC_REPORT | wxLC_VIRTUAL | wxLC_SINGLE_SEL)
, selected_item_pos(-1)
, sort_by_column(-1), sort_ascending(true)
{
// create image list
wxImageList* il = new wxImageList(18,14);
......
......@@ -75,8 +75,16 @@ void TextViewer::draw(RotatedDC& dc, const TextStyle& style, DrawWhat what) {
// Draw the text, line by line
FOR_EACH(l, lines) {
if (l.visible(dc)) {
RealRect rect(l.positions.front(), l.top, l.width(), l.line_height);
elements.draw(dc, scale, rect, &*l.positions.begin(), what, l.start, l.end());
if (justifying) {
// Draw characters separatly
for (size_t i = 0 ; i < l.positions.size() - 1 ; ++i) {
RealRect rect(l.positions[i], l.top, l.positions[i+1] - l.positions[i] , l.line_height);
elements.draw(dc, scale, rect, &l.positions[i], what, l.start + i, l.start + i + 1);
}
} else {
RealRect rect(l.positions.front(), l.top, l.width(), l.line_height);
elements.draw(dc, scale, rect, &*l.positions.begin(), what, l.start, l.end());
}
}
}
}
......@@ -524,7 +532,7 @@ void TextViewer::alignLines(RotatedDC& dc, const vector<CharInfo>& chars, const
if ((style.alignment & ALIGN_JUSTIFY) ||
(style.alignment & ALIGN_JUSTIFY_OVERFLOW && width > s.width)) {
// justify text
// justifying = true;
justifying = true;
double hdelta = s.width - width; // amount of space to distribute
int count = (int)l.positions.size() - 1; // distribute it among this many characters
if (count == 0) count = 1; // prevent div by 0
......@@ -532,9 +540,9 @@ void TextViewer::alignLines(RotatedDC& dc, const vector<CharInfo>& chars, const
FOR_EACH(c, l.positions) {
c += hdelta * i++ / count;
}
} else if (style.alignment & ALIGN_JUSTIFY) {
} else if (style.alignment & ALIGN_JUSTIFY_WORDS) {
// justify text, by words
// justifying = true;
justifying = true;
double hdelta = s.width - width; // amount of space to distribute
int count = 0; // distribute it among this many words
for (size_t k = l.start + 1 ; k < l.end() - 1 ; ++k) {
......@@ -548,7 +556,7 @@ void TextViewer::alignLines(RotatedDC& dc, const vector<CharInfo>& chars, const
}
} else {
// simple alignment
// justifying = false;
justifying = false;
double hdelta = align_delta_x(style.alignment, s.width, width);
FOR_EACH(c, l.positions) {
c += hdelta;
......
......@@ -117,7 +117,8 @@ class TextViewer {
private:
// --------------------------------------------------- : More drawing
double scale; /// < Scale when drawing
double scale; ///< Scale when drawing
bool justifying; ///< Is text justified?
// --------------------------------------------------- : Elements
TextElements elements; ///< The elements of the prepared text
......
......@@ -36,15 +36,15 @@ RealPoint align_in_rect(Alignment align, const RealSize& to_align, const RealRec
/// Convert a String to an Alignment
Alignment from_string(const String& s) {
int al = ALIGN_TOP_LEFT;
if (s.find(_("left")) !=String::npos) al = ALIGN_LEFT | (al & ALIGN_VERTICAL);
if (s.find(_("center")) !=String::npos) al = ALIGN_CENTER | (al & ALIGN_VERTICAL);
if (s.find(_("right")) !=String::npos) al = ALIGN_RIGHT | (al & ALIGN_VERTICAL);
if (s.find(_("justify")) !=String::npos) al = ALIGN_JUSTIFY | (al & ALIGN_VERTICAL);
if (s.find(_("justify-words")) !=String::npos) al = ALIGN_JUSTIFY_WORDS | (al & ALIGN_VERTICAL);
if (s.find(_("left")) !=String::npos) al = ALIGN_LEFT | (al & ~ALIGN_HORIZONTAL);
if (s.find(_("center")) !=String::npos) al = ALIGN_CENTER | (al & ~ALIGN_HORIZONTAL);
if (s.find(_("right")) !=String::npos) al = ALIGN_RIGHT | (al & ~ALIGN_HORIZONTAL);
if (s.find(_("justify")) !=String::npos) al = ALIGN_JUSTIFY | (al & ~ALIGN_HORIZONTAL);
if (s.find(_("justify-words")) !=String::npos) al = ALIGN_JUSTIFY_WORDS | (al & ~ALIGN_HORIZONTAL);
if (s.find(_("shrink-overflow"))!=String::npos) al = ALIGN_JUSTIFY_OVERFLOW | (al & ~ALIGN_JUSTIFY_OVERFLOW);
if (s.find(_("top")) !=String::npos) al = ALIGN_TOP | (al & ALIGN_HORIZONTAL);
if (s.find(_("middle")) !=String::npos) al = ALIGN_MIDDLE | (al & ALIGN_HORIZONTAL);
if (s.find(_("bottom")) !=String::npos) al = ALIGN_BOTTOM | (al & ALIGN_HORIZONTAL);
if (s.find(_("top")) !=String::npos) al = ALIGN_TOP | (al & ~ALIGN_VERTICAL);
if (s.find(_("middle")) !=String::npos) al = ALIGN_MIDDLE | (al & ~ALIGN_VERTICAL);
if (s.find(_("bottom")) !=String::npos) al = ALIGN_BOTTOM | (al & ~ALIGN_VERTICAL);
if (s.find(_("stretch")) !=String::npos) al = ALIGN_STRETCH;
return static_cast<Alignment>(al);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment