Skip to content

Commit

Permalink
Removed Tempest Remastered from "full" first/last-printed search. Upd…
Browse files Browse the repository at this point in the history
…ated tests.

Fixed bug with direct print time tests.
  • Loading branch information
jhallbachner authored and jhallbachner-mb committed Aug 21, 2016
1 parent 5499454 commit 7db36e7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
6 changes: 4 additions & 2 deletions lib/card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def all_legalities(date=nil)
def first_release_date(filter="all")
case filter
when "full"
@printings.select{|pr| !%w(promo masters).include?(pr.set_type)}.map(&:release_date).compact.min
@printings.select{|pr| !%w(promo masters).include?(pr.set_type) && pr.set_code != 'tpr'}.map(&:release_date)
.compact.min
when "expert"
@printings.select{|pr| %w(core expansion).include?(pr.set_type)}.map(&:release_date).compact.min
else
Expand All @@ -89,7 +90,8 @@ def first_release_date(filter="all")
def last_release_date(filter="all")
case filter
when "full"
@printings.select{|pr| !%w(promo masters).include?(pr.set_type)}.map(&:release_date).compact.max
@printings.select{|pr| !%w(promo masters).include?(pr.set_type) && pr.set_code != 'tpr'}.map(&:release_date)
.compact.max
when "expert"
@printings.select{|pr| %w(core expansion).include?(pr.set_type)}.map(&:release_date).compact.max
else
Expand Down
4 changes: 2 additions & 2 deletions lib/condition/condition_print.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This condition checks printing, first/lastprinted check card.
# Should they check same thing?
class ConditionPrint < Condition
def initialize(op, date, type)
def initialize(op, date, type = '')
@op = op
# Just for ConditionPrint#==
if date.is_a?(Date)
Expand All @@ -21,7 +21,7 @@ def search(db)
ps = db.printings.select{|card| match_date?(get_date(card, max_date), query_date, precision)}.to_set

# avoid getting an and un confused
ps.select!{|printing| printing.set_code == @date} unless @date.is_a?(Date) || @op != '='
ps.select!{|printing| printing.set_code == @date} if %w(an un).include?(@date)
ps
else
db.printings.to_set
Expand Down
6 changes: 3 additions & 3 deletions test/test_full.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_print
assert_search_results "t:jace firstprint=2012", "Jace, Architect of Thought"

# This is fairly silly, as it includes prerelease promos etc.
assert_search_results "e:ktk firstprint<ktk",
assert_search_results "e:ktk firstprint*<ktk",
"Abzan Ascendancy", "Act of Treason", "Anafenza, the Foremost",
"Ankle Shanker", "Arc Lightning", "Avalanche Tusker", "Bloodsoaked Champion",
"Bloodstained Mire", "Butcher of the Horde", "Cancel", "Crackling Doom",
Expand All @@ -107,7 +107,7 @@ def test_print
"Trumpet Blast", "Utter End", "Villainous Wealth", "Windstorm", "Windswept Heath",
"Wooded Foothills", "Zurgo Helmsmasher"

assert_search_results "e:ktk lastprint>ktk",
assert_search_results "e:ktk lastprint*>ktk",
"Act of Treason", "Ainok Tracker", "Altar of the Brood", "Arc Lightning", "Bloodfell Caves", "Bloodstained Mire", "Blossoming Sands", "Briber's Purse", "Debilitating Injury", "Disdainful Stroke", "Dismal Backwater", "Dragonscale Boon", "Dutiful Return", "Flooded Strand", "Forest", "Ghostfire Blade", "Grim Haruspex", "Hordeling Outburst", "Incremental Growth", "Island", "Jeering Instigator", "Jungle Hollow", "Mountain", "Mystic of the Hidden Way", "Naturalize", "Plains", "Polluted Delta", "Ride Down", "Rugged Highlands", "Ruthless Ripper", "Scoured Barrens", "Shatter", "Smite the Monstrous", "Sultai Charm", "Summit Prowler", "Suspension Field", "Swamp", "Swiftwater Cliffs", "Thornwood Falls", "Throttle", "Tormenting Voice", "Tranquil Cove", "Watcher of the Roost", "Weave Fate", "Wind-Scarred Crag", "Windstorm", "Windswept Heath", "Wooded Foothills"
end

Expand All @@ -116,7 +116,7 @@ def test_firstprint
end

def test_lastprint
assert_search_results "t:planeswalker lastprint<=roe", "Chandra Ablaze", "Sarkhan the Mad"
assert_search_results "t:planeswalker lastprint*<=roe", "Chandra Ablaze", "Sarkhan the Mad"
assert_search_results "t:planeswalker lastprint<=2011",
"Ajani Goldmane", "Ajani Vengeant", "Chandra Ablaze", "Elspeth Tirel",
"Garruk Relentless", "Garruk, the Veil-Cursed", "Gideon Jura", "Liliana of the Veil",
Expand Down
23 changes: 22 additions & 1 deletion test/test_printed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def test_last_printed
"Karn, Silver Golem",
"Masticore",
"Memory Jar",
"Mox Diamond",
"Sundering Titan",
"Zuran Orb"
# excludes cards reprinted in vintage masters
Expand All @@ -48,6 +49,26 @@ def test_last_printed

assert_count_results "lastprint!=un", 27
assert_count_results "lastprint=un", 25
assert_count_results "lastprint=un", 5
assert_count_results "lastprint*=un", 5
end

def test_unique_scenarios
# all reserved list cards that have been reprinted in paper nonetheless
assert_search_results "(lastprint>ud is:reserved) OR (lastprint*>ud st:promo is:reserved)",
"Deranged Hermit",
"Intuition",
"Karn, Silver Golem",
"Lightning Dragon",
"Masticore",
"Memory Jar",
"Morphling",
"Mox Diamond",
"Phyrexian Dreadnought",
"Phyrexian Negator",
"Powder Keg",
"Survival of the Fittest",
"Thawing Glaciers",
"Wheel of Fortune",
"Yawgmoth's Will"
end
end

0 comments on commit 7db36e7

Please sign in to comment.