FictitiousFrode / AIF

AIF Framework for Inform 7
GNU General Public License v2.0
16 stars 8 forks source link

Blocking but shiftable? #47

Open theburning opened 7 years ago

theburning commented 7 years ago

I want to be able to shift clothing under shifted clothing, while still not being able to remove the lower layer of clothing if they are blocked. For example, a pair of pants and a pair of boxers, both lowerable. I was able to accomplish this (though I haven't thoroughly tested) by changing the can be shifted decision to use the modified cover areas list instead of the blocked cover areas list AND adding a check for the cloth to be shifted.

To decide whether (G - a garment) can be shifted:
    If G is not worn by someone:
        Decide yes;[Technically, no; but we don't want to stop that here.]
    Let cover be the shifting revealed cover areas of G;
    Let clothing be the list of garments worn by the holder of G;
    If G is listed in clothing, remove G from clothing; [We don't want to let G block itself]
    Sort clothing in reverse clothing layer order;
    Repeat with A running through cover:
        Repeat with cloth running through clothing:
            If clothing layer of cloth is greater than clothing layer of G:
                If A is listed in the modified cover areas of cloth:
                    If cloth is unshifted, decide no;
    Decide yes;
FictitiousFrode commented 7 years ago

The code you provided might work, but I think your use-case is better handled through a properly worded instead rule. I'll keep this one in mind for the next release though, so leaving it open.