Remove shadows as a feature

This commit is contained in:
Pyrex 2024-02-09 21:43:01 -08:00
parent 94a410a587
commit 6a92341695
6 changed files with 402 additions and 18 deletions

View File

@ -111,7 +111,7 @@ function board:draw()
for i=1,#w.contents do
local x,y=l:place_card(i)
self.ruleset.deck:draw_card(x,y,w.contents[i],i<#w.contents)
self.ruleset.deck:draw_card(x,y,w.contents[i])
end
end
@ -130,7 +130,7 @@ function board:draw()
forall_slots(function(x,y,s_ix,s,l,n)
for i=1,n do
local x,y=l:place_card(i)
self.ruleset.deck:draw_card(x,y,s.contents[i],i<n)
self.ruleset.deck:draw_card(x,y,s.contents[i])
end
end)

View File

@ -61,7 +61,7 @@ function board:_animate_move_card(card,on_end,start_x,start_y,compute_end)
function anim_obj:draw()
local x=start_x+(end_x-start_x)*progress
local y=start_y+(end_y-start_y)*progress
_self.ruleset.deck:draw_card(x,y,card,false)
_self.ruleset.deck:draw_card(x,y,card)
end
self.animator:add(anim_obj)

View File

@ -82,7 +82,7 @@ function cursor:draw_at(x,y)
end
if card then
local card_fg=self.ruleset.deck:draw_card(x,y,card,false)
local card_fg=self.ruleset.deck:draw_card(x,y,card)
local fg=card_fg
if (acc==acceptance_state.would_accept) fg=9
if (fg) rect(x-1,y-1,x+9,y+16,fg)

View File

@ -1,4 +1,5 @@
progression={
ruleset:new(11,5,10,25),
-- level 1
ruleset:new(5,1,9,0), -- by test: always winnable
-- level 2
@ -10,7 +11,7 @@ progression={
-- level 5
ruleset:new(9,3,11,18, "l5"),
-- fortune's foundation
ruleset:new(11,4,13,22,"ff")
ruleset:new(11,4,13,22,"ff"),
-- harder than fortune's foundation
-- ruleset:new(11,5,10,25)
ruleset:new(11,5,10,25)
}

View File

@ -83,24 +83,21 @@ function ruleset:generate_deck()
if (rank==0 or rank==self.n_arcana-1) deck.instantly_accepted[#deck.cards]=true
end
function deck:draw_card(x,y,c,shadow)
function deck:draw_card(x,y,c)
local meta=deck.cards[c]
local is_extreme=meta.rank==0 or meta.rank==ruleset.n_arcana-1
local s,fg
local bg,shadowbg
local bg
if meta.suit=='a' or meta.suit=='b' then
bg,shadowbg=1,1
if (shadow) bg,shadowbg=1,1
if (is_extreme) bg,shadowbg=15,15
bg=1
if (is_extreme) bg=15
else
bg,shadowbg=7,7
--if (shadow) bg,shadowbg=7,6
bg=7
end
rectfill(x,y,x+8,y+4,bg)
rectfill(x,y+5,x+8,y+15,shadowbg)
rectfill(x,y,x+8,y+15,bg)
if (meta.suit=='p') s,fg=0,4
if (meta.suit=='s') s,fg=1,12
@ -124,9 +121,7 @@ function ruleset:generate_deck()
print(name,x2,y+1,bg)
pal(7,fg)
spr(s,x+4,y)
if not shadow then
spr(15+meta.rank,x,y+8)
end
pal()
end

View File

@ -108,3 +108,391 @@
731
629
696
741
445
743
683
688
706
771
734
773
647
778
789
752
612
764
820
622
689
814
833
793
797
863
737
767
742
738
795
816
772
897
928
879
940
949
882
934
960
957
968
973
780
864
962
976
899
982
1019
919
931
936
1009
1033
905
1034
1026
1068
1014
1015
1029
1097
975
1104
1032
1059
1040
1089
1125
1147
1126
1061
1167
1062
1148
1055
1145
1094
1215
817
1098
1186
1211
1177
1196
1239
1235
1245
1225
1263
1237
955
1163
1217
1194
1202
1276
1334
1252
1150
1191
1285
1368
1336
1328
1332
1370
1384
1376
1400
1341
1244
1288
1379
1262
1427
1236
1457
1248
1473
1466
1475
1472
1436
1428
1495
1286
1504
1509
1483
1453
1476
1317
1479
1511
1350
1535
1357
1529
1505
1555
1542
1559
1563
1576
1581
1525
1577
1603
1607
1630
1619
1546
1450
1524
1435
1669
1647
1597
1689
1629
1566
1677
1705
1701
1624
1402
1676
1642
1723
1719
1743
1611
1711
1679
1745
1782
1627
1779
1765
1716
1750
1807
1812
1653
1776
1728
1831
1731
1801
1784
1848
1832
1783
1826
1878
1706
1790
1791
1746
1862
1896
1828
1872
1903
1915
1921
1906
1947
1931
1919
1930
1936
1833
1841
1968
1645
1994
1997
1954
1970
1979
2016
1913
1957
2034
1898
2004
1927
2061
2044
1834
2068
2079
1987
1870
1953
2096
2078
2101
2106
1965
1958
2134
1969
2029
2139
2092
1961
2128
2123
2140
2064
2062
2071
2067
2195
2102
2200
2148
2111
2023
2138
2223
2165
2232
2115
2247
2112
2157
2257
2118
2206
2229
2191
2171
2268
2302
2283
2221
2331
2094
2318
2289
2186
2250
2350
2170
2243
2366
2337
2193
2286
2303
2400
2377
2332
2358
2227
2336
2253
2166
2404
2262
2093
2413
2202
2440
2371
2457
2379
2429
2491
2402
2238
2405
2315
2502
2431
2465
2531
2326
2519
2419
2430
2569
2533
2596
2602
2471
2616
2554
2590
2517
2560
2548
2407
2643
2580
2618
2498
2619
2617
2650
2334
2641
2689
2706
2685
2585
2717
2658
2644
2695
2744
2578
2687
2672
2768
2661
2651
2772
2669
2620
2795
2770
2787
2761
2629
2813
2851
2854
2725
2800
2888
2900
2844
2625
2897
2815
2934
2940
2942
2937
2947
2834
2846
2825
2830