Midori wrote:SNAPSHOT-30720
Jori En, Ruin Diver's ability seems broken.
It won't trigger for a spell with buyback if it was cast previously this turn (probably thinking that spell is still the first spell).
It will also trigger multiple times for a spell with buyback, if that spell was previously cast as the second spell this turn (probably thinking that spell is still the second spell).
Ok, this was a little bit of a "deeper" issue. The problem was that functions like getSpellsCastThisTurn / getSpellsCastLastTurn processed spells in terms of cards they were cast from, and filtering functions that normally deal with card objects (read: unique objects) discarded duplicates. This actually probably affected many things outside this scenario, it's just that these possible scenarios are not very common, which is why they're not very obvious.
In r30723 I implemented an experimental fix such that functions that count spells cast this turn/last turn allow duplicate card objects during iteration and filtering. This allows, for example, spells cast with Buyback to be counted properly (fixes
Jori En, Ruin Diver triggering on a second spell that was previously cast that same turn with Buyback, and other similar scenarios). This fix required an expansion to CardLists that adds versions of a couple validity test and filtering functions that return the result as a List<Card> instead of as a CardCollection. I'm not sure how desirable that is. I tried to do it in a couple other ways (initially I wanted to process spells cast this turn/last turn in terms of spell abilities that were cast instead of cards they were cast from), but that proved to be rather difficult because all of the underlying code implies the use of a CardCollection... If you feel like you know a better way to work around this limitation and implement a better fix, please feel free to tweak/update.

My fix assumes that the functions mentioned above should always care for duplicates if any. Please report any weird behavior you may encounter from this.
- Agetian