Re: Card Development - talk about cards code here
Posted: 14 Dec 2020, 06:06
You're overcomplicating things. draw_cards_exe(player, amount) just calls draw_a_card(player) amount times in a for loop; and draw_a_card() returns the index of the drawn card. That might be -1 if the draw is prevented early, or might not be in_hand() if the draw is replaced, so you have to check for both.
I'd say to look at Sindbad for an example of usage, except it's been broken to check the highest-index card that was drawn this turn. That's not reliably the most-recently-drawn card (though it usually is), and it'll be plainly incorrect if the draw is replaced or it triggers another draw.
I'd say to look at Sindbad for an example of usage, except it's been broken to check the highest-index card that was drawn this turn. That's not reliably the most-recently-drawn card (though it usually is), and it'll be plainly incorrect if the draw is replaced or it triggers another draw.