Quote Originally Posted by Tamamo View Post
I can confirm something is seriously wacky here. Here is the code, and i didn't change a thing.
Code:
    // charging up weapon...
    //
    if(((attack==wSword && attackclk==SWORDCHARGEFRAME && itemid>=0 && isWpnPressed(itype_sword)) ||
#if 0
            (attack==wWand && attackclk==WANDCHARGEFRAME && itemid>=0 isWpnPressed(itype_wand)) ||
#endif
            (attack==wHammer && attackclk==HAMMERCHARGEFRAME && itemid>=0 && isWpnPressed(itype_hammer))) && z==0 && checkmagiccost(itemid)) //this check prevents that
    {
        // Increase charging while holding down button.
        if(spins==0 && charging<magiccharge)
            charging++;
            
        // Once a charging threshold is reached, play the sound.
        if(charging==normalcharge)
        {
			paymagiccost(itemid);
            sfx(WAV_ZN1CHARGE,pan(int(x)));
        }
        else
        {
            itemid = current_item_id(attack==wHammer ? itype_quakescroll2 : itype_spinscroll2);
            
            if(itemid>-1 && charging==magiccharge && checkmagiccost(itemid))
            {
                paymagiccost(itemid);
                charging++; // charging>magiccharge signifies a successful supercharge.
                sfx(WAV_ZN1CHARGE2,pan(int(x)));
            }
        }
    }


Is that the same version that I have, or did you get a fresher copy? (I need to sleep, or I;d just check.)

So, anyhow, it certainly has some problems...

I'm pretty sure that the culprit is the lack of a call to checkmagiccost() before starting the charge cycle. A call to that before this codeblock, should fix it in general, but you'd need to isolate these into individual items, as checkmagiccost() is item specific, and the charging cycle sort of combines items that have the ability. It's mandatory to split the hammer, and sword, in any event.

I'd add a call to checkmagicost() to every item use function/block, as it'd make it possible to assign a cost to anything, and ensure it works. I'd prefer to make all of these blocks into isolated functions too, but that's another matter, as it might make it easier to debug, modify, and expand them.

I'm just waiting for the open source stuff, so that I have a complete set of the absolute latest 2.50.3-ish code, before mucking with it. Not knowing what Gleeok changed, I'd rather not make changes to what I have, and need to do them over again.