It is currently 01 Mar 2021, 14:22
Text Size

Shandalar - Program Bugs

40 basic lands added to duel deck (fix completed)


41 card deck in deck builder.

81 card deck in duel. (73 library, 1 ante, 7 hand)

It seems as though the 40 mystery cards are all basic lands. This happens repeatedly, even when I reload the game.

Seems as though the old "add random basic lands until the deck size is at least 40" was replaced with "add 40 random basic lands".

Edit1: Creating a new game did not fix the issue.
Last edited by Korath on 16 Aug 2016, 00:12, edited 3 times in total.
Reason: Component Duel Engine->Adventure Mode (where the bug is located internally); rename from "40 unknown cards added to duel deck"


Posted by TheKillerNacho » 15 Aug 2016, 13:57

Yep, same here.

Posted by Korath » 16 Aug 2016, 00:09

commit 4222514b7b5b946bdef3a06b93775237c4c97fd0
Author: Korath <dgk@Dirge.none>
Date: Mon Aug 15 20:08:17 2016 -0400

[HS] FIX #1150: properly enforce minimum number of cards in deck

This correctly counted the current number of cards in your library, but rather
than copying the return value of the function that did so into the local
variable that's later checked for adding temporary basic lands, instead copied
whatever was in that local variable into the return value (and left the local
variable unchanged).

Usually, the local is set to 0, so that either 30, 35, or 40 basic lands were
added, depending on difficulty level; sometimes, it instead was left
uninitialized, so there was a roughly 50% chance of adding no basic lands (if
the variable happened to have a positive value greater than 30/35/40), and a
roughly 50% chance of adding an apparently-random number of lands between 1 and
2^31 (if the variable happened to have a negative number, or a positive number
lower than 30/35/40).

Instead of just relying on the rewritten assembly at runtime - which is always
risky and error-prone - to put the return value in the right place, also expand
expand responsibility of count_cards_currently_in_deck() to also add the random
basic lands itself, and rename it to enforce_minimum_cards_in_deck(). This
will make it easy to add config variables to change the minimum deck size
(perhaps to 60), or to change which cards get randomly added (perhaps to
Wastes, or to random basic lands that match your deck's colors).

Also remove a previous runtime assembly rewrite that fixed counting of cards in
a dungeon that forbids cards of a particular type or color, and which gets
skipped by the call to count_cards_currently_in_deck().

Ticket details

  • Ticket ID: 1150
  • Project: Shandalar
  • Status: Fix completed
  • Component: Adventure Mode
  • Project version: Hall of the Sultan 1
  • Priority: Normal
  • Severity: Major
  • Assigned to: Korath
  • Reported by: Rawky
  • Reporter's tickets: List all tickets
  • Reported on: 14 Aug 2016, 18:57
  • Last visited by Korath » 06 Apr 2018, 11:18.

Login Form