Skip to content

HouseRules.Stack_All : allows any colour "+2" on "+4" stacking. #12

@Dan-N-B

Description

@Dan-N-B

Hello folks,

This assumed that HouseRules.Stack_All is true.

At the moment players are permitted to stack any colour "+2" on top of a "+4" no matter the colour in-play.
Which, i think most will agree, seems wrong.

I hope you don't mind, as I took the initiative to see if I can change the behaviour; so that it checks for colour when stacking "+2" on "+4".

under function CheckPlayedCard(card_played) just before return true for if lastCard.Name == "+2" or HouseRules.Stack_All.
I added a check to return false if the last card played was "+4" and the colour of the "+2" is not the same as the colour in-play.

                    if lastCard.Name == "+2" or HouseRules.Stack_All -- check that the last card played was also a +2, or the ALL stacking rule is enabled
                    then
                        -- start of added lines
                        if lastCard.Name == "+4" and card_played.getDescription() ~= lastCard.Description -- if last card played was +4 and colour of "card_played" doesn't matches colour in-play, return false
                        then
                            return false -- return false : as the colour of the "+2" does not match the colour in-play
                        end
                        -- end of added lines
                        return true -- return true : the card being played is allowed
                    end

No existing lines were changed. just four lines added.

With my small amount of testing I did with myself; I don't see an issue, and it's now checking to see if the "+2" played after a "+4" matches the colour in-play, before allowing it to be played.

Hope that helps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions