I've been trying (and failing) to modify the King functions from the Apothecary presets. The problem I have is that if I remove the rank restriction for the king's jump, the preset just doesn't work anymore, unless I also remove the check to make sure the king isn't in check. So I can make the jump work, but jumping moves are still shown as legal even if the king is in check. This is what I have:
def King
checkleap #0 #1 0 2
or checkleap #0 #1 1 2
or checkleap #0 #1 2 2
or checkleap #0 #1 0 3
or checkleap #0 #1 1 3
or checkleap #0 #1 2 3
or checkleap #0 #1 3 3
// and not sub checked #0 If this line is uncommented the preset won't work?
and flag #0
or checkleap #0 #1 1 0
or checkleap #0 #1 1 1;
def King-Range mergeall
leaps #0 1 0
leaps #0 1 1
leaps #0 0 2
leaps #0 1 2
leaps #0 2 2
leaps #0 0 3
leaps #0 1 3
leaps #0 2 3
leaps #0 3 3;
sub King from to:
if checkleap #from #to 1 1 or checkleap #from #to 1 0:
return true;
endif;
move #to #from;
if checkleap #from #to 0 2
or checkleap #from #to 1 2
or checkleap #from #to 2 2
or checkleap #from #to 0 3
or checkleap #from #to 1 3
or checkleap #from #to 2 3
or checkleap #from #to 3 3
and flag #from :
if sub checked #from:
die You may not perform the special moves out of check.;
endif;
move #from #to;
return true;
endif;
endsub;
I've been trying (and failing) to modify the King functions from the Apothecary presets. The problem I have is that if I remove the rank restriction for the king's jump, the preset just doesn't work anymore, unless I also remove the check to make sure the king isn't in check. So I can make the jump work, but jumping moves are still shown as legal even if the king is in check. This is what I have:
What am I missing?