Page 1 of 1

[fixed/closed]Bonds of Faith (on a Human?) crashes game

PostPosted: 05 Mar 2016, 08:50
by Showdown
Describe the Bug:
Attempting to cast Bonds of Faith crashes the game. It allows selection and payment of the spell, but crashes upon clicking the target creature. Perhaps only crashes when the target is a Human. I was able to cast it on an Angel I controlled, but the game crashes at the start of the opponents next turn.

Which card did behave improperly ?
Bonds of Faith

Which update are you using?(date,name)Which type(Duel,Gauntlet,Sealed Deck)
2015.12.25, BFZ v1, Duel

What exactly should be the correct behavior/interaction ?
The game should not crash when casting the spell.

Are any other cards possibly affected by this bug ?

Re: Bonds of Faith (on a Human?) crashes game

PostPosted: 05 Mar 2016, 11:15
by BAgate
Works in a clean game and your save doesn't cause a crash.

Re: Bonds of Faith (on a Human?) crashes game

PostPosted: 05 Mar 2016, 12:53
by stassy
He is using BFZ v1 so not up to date, you should update to v2

Re: Bonds of Faith (on a Human?) crashes game

PostPosted: 05 Mar 2016, 13:32
by Korath
Short version: this was fixed in BFZv2.

Long version: The card tries to checks the subtype of the object it's enchanting on every single call to its card function, without first checking to see if it's an event that needs to know what the subtype is - in this case EVENT_POWER, EVENT_TOUGHNESS, or EVENT_ABILITIES. Since each card's function is called many tens of thousands of times each turn, and checking all the special cases for determining subtype is expensive, this is appallingly inefficient, though it's usually harmless.

BFZv1 added EVENT_SUBTYPE to begin to remove all those special cases - for example, the program would no longer have to specifically search for an Aurification on the battlefield whenever anything was checked to see if it was a Wall, whether or not Aurification was in either player's decks (which it almost never will be). However, it combines with the inefficiency above to cause an infinite loop - the card's function gets called with EVENT_SUBTYPE to see whether something added a subtype, then the card checks its enchantee's subtype, which causes the card's function to get called again with EVENT_SUBTYPE, until the call stack overflows and the game crashes.

BFZv2 can detect this situation as it's happening and work around it, but it's still better to fix the individual cards too, and I've now done so for Bonds of Faith in commit 592234c.