Jump to content

Negotiation Modifier CanPlayCard Passes Game Engine Instead Of Negotiation Engine

  • Branch: Preview Branch Version: Windows Pending

The CanPlayCard function in negotiation modifiers determines whether a card can be played, and passes in source, engine, target as the parameters. Unfortunately, instead of passing in self.engine, the negotiation engine, it passes in the global variable "engine", which is the game engine, a completely different thing. It won't crash the game from referring to nil values, but it will crash the game when an invalid field of engine is called. As such, it isn't noticeable in the base game.

Steps to Reproduce

1. Create a modifier that has the CanPlayCard function. This is the modifier I used.

        loc_strings = {
            CANT_PLAY = "Can't play cards from hand",
        hidden = true,
        CanPlayCard = function( self, source, engine, target )

            if engine:GetHandDeck():HasCard(source) then
                return false, (self.def or self):GetLocalizedString("CANT_PLAY")

            return true

As you can see, it's such a terrible modifier that no one wants.

2. Create this modifier in a negotiation.

3. Game crashes.

User Feedback

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...