Compare commits
No commits in common. "2166ea47cfa631c65dc51aca9f48990a7dbe828e" and "af73c6b75fa953d44c11f5f33b9e6728e751aa9d" have entirely different histories.
2166ea47cf
...
af73c6b75f
44
rummy.lua
44
rummy.lua
|
@ -40,10 +40,6 @@ 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
|
||||
|
@ -121,19 +117,28 @@ function TIC()
|
|||
print("New\nMeld", meld_x, 17, 13)
|
||||
end
|
||||
|
||||
-- render discard pile
|
||||
-- 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
|
||||
|
||||
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(discard_x, 80 + (i - 1) * -0.25, false, sel_state)
|
||||
card:render(39, 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,
|
||||
discard_x,
|
||||
39,
|
||||
80 + (#discard_pile - 1) * -0.25,
|
||||
Card.spr_hilight.colorkey,
|
||||
1, 0, 0,
|
||||
|
@ -142,31 +147,28 @@ function TIC()
|
|||
end
|
||||
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(draw_pile_x, 80 + (i - 1) * -0.25, true, sel_state)
|
||||
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)
|
||||
end
|
||||
|
||||
if is_an_interest(points_of_interest, "End\nTurn") then
|
||||
print("End\nTurn", end_turn_x, 80+7, 0)
|
||||
print("End\nTurn", 110, 87, 0)
|
||||
if hovered and hovered.interest=="End\nTurn" then
|
||||
spr(Card.spr_hilight.sid,
|
||||
end_turn_x, 80,
|
||||
110,
|
||||
80,
|
||||
Card.spr_hilight.colorkey,
|
||||
1, 0, 0,
|
||||
Card.spr_hilight.tw,
|
||||
Card.spr_hilight.th)
|
||||
end
|
||||
else
|
||||
print("End\nTurn", end_turn_x, 80+7, 13)
|
||||
print("End\nTurn", 110, 87, 13)
|
||||
end
|
||||
|
||||
local hand_start_x=((240 - #cards_in_hand * 12 - 24) / 2)
|
||||
local hand_start_x=((240 - #cards_in_hand * 12) / 2)
|
||||
for i,card in ipairs(cards_in_hand) do
|
||||
local ty=0
|
||||
local sel_state = nil
|
||||
|
@ -287,7 +289,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]))
|
||||
|
@ -399,7 +401,7 @@ function rummy_is_valid_meld(stack)
|
|||
end
|
||||
end
|
||||
|
||||
local expected_suit=stack[1].suit
|
||||
local expected_suit=stack[1].rank
|
||||
local is_valid_run=true
|
||||
for i=2,#stack do
|
||||
local card=stack[i]
|
||||
|
|
Loading…
Reference in New Issue