Compare commits

..

3 Commits

1 changed files with 21 additions and 23 deletions

View File

@ -40,6 +40,10 @@ function TIC()
local points_of_interest = player_state.get_points_of_interest()
local discard_x=((240 - 24) / 2)
local draw_pile_x=discard_x - 24 - 4
local end_turn_x=discard_x + 24 + 4
if not hovered and #points_of_interest>0 then
hovered=points_of_interest[1]
end
@ -117,28 +121,19 @@ function TIC()
print("New\nMeld", meld_x, 17, 13)
end
-- render draw pile
for i,card in ipairs(draw_pile) do
local sel_state = nil
if hovered and hovered.interest == card then
sel_state = 1
end
card:render(3, 80 + (i - 1) * -0.25, true, sel_state)
end
-- render discard pile
for i,card in ipairs(discard_pile) do
local sel_state = nil
if hovered and hovered.interest == card then
sel_state = 1
end
card:render(39, 80 + (i - 1) * -0.25, false, sel_state)
card:render(discard_x, 80 + (i - 1) * -0.25, false, sel_state)
end
if is_an_interest(points_of_interest, "Discard") then
if hovered and hovered.interest=="Discard" then
spr(Card.spr_hilight.sid,
39,
discard_x,
80 + (#discard_pile - 1) * -0.25,
Card.spr_hilight.colorkey,
1, 0, 0,
@ -147,28 +142,31 @@ function TIC()
end
end
if player_state == player_state_draw_card then
print("Your turn! Draw a card.", 60, 60, 15, false, 1, false)
elseif player_state == player_state_action then
print("Your turn! Meld, Lay-off, or End Turn", 60, 60, 15, false, 1, false)
-- render draw pile
for i,card in ipairs(draw_pile) do
local sel_state = nil
if hovered and hovered.interest == card then
sel_state = 1
end
card:render(draw_pile_x, 80 + (i - 1) * -0.25, true, sel_state)
end
if is_an_interest(points_of_interest, "End\nTurn") then
print("End\nTurn", 110, 87, 0)
print("End\nTurn", end_turn_x, 80+7, 0)
if hovered and hovered.interest=="End\nTurn" then
spr(Card.spr_hilight.sid,
110,
80,
end_turn_x, 80,
Card.spr_hilight.colorkey,
1, 0, 0,
Card.spr_hilight.tw,
Card.spr_hilight.th)
end
else
print("End\nTurn", 110, 87, 13)
print("End\nTurn", end_turn_x, 80+7, 13)
end
local hand_start_x=((240 - #cards_in_hand * 12) / 2)
local hand_start_x=((240 - #cards_in_hand * 12 - 24) / 2)
for i,card in ipairs(cards_in_hand) do
local ty=0
local sel_state = nil
@ -289,7 +287,7 @@ player_state_action = {
player_state_secondary_action = {
update=function(point_of_interest)
if cards_in_hand:contains(point_of_interest.interest) then
cards_in_meld_draft=CardStack:new(point_of_interest.interest)
cards_in_meld_draft=CardStack:new({ point_of_interest.interest })
elseif point_of_interest.interest=="Discard" then
if #cards_in_meld_draft==1 then
table.remove(cards_in_hand, cards_in_hand:index_of(cards_in_meld_draft[1]))
@ -401,7 +399,7 @@ function rummy_is_valid_meld(stack)
end
end
local expected_suit=stack[1].rank
local expected_suit=stack[1].suit
local is_valid_run=true
for i=2,#stack do
local card=stack[i]