Fix maximum magicka calculation (Fixes #1795)