I'm making a mod that has magic spells in it, and you cast these spells by selecting the spell from a book and then right-clicking a staff, which then casts the spell, provided that you have the correct number of runes, and the runes are removed. The problem is that if the player has enough of one rune but not another, the spell isn't cast but the rune they do have is still removed. For example, a spell called "destroy undead" requires 2 earth and 2 life runes. Right now, if a player has 2 earth but only 1 life rune, the earth runes and life rune are removed, but the spell isn't cast.
I've tried two methods, and both produce similar results (this is in my staff class):