glqgamemaster/Gentle-Love-Quest — pull request #17 by gegerlan (2011-12-31 22:53:13+00:00)
Title: Raise and lower attribute

Added :raise and :lower for Game_Actor where you can provide a "top" level to which is highest value a change can do, and "lowest" level which the change can't bring the attribute under.

actor.raise("sexAppeal", 1, 10) # adds one to sexAppeal, unless the change brings sexAppeal over 10
actor.lower("sexAppeal", 1, 10) # removes one from sexAppeal, unless the change brings sexAppeal under 10

If the change is more than 1, and brings the change past the level, the change will be altered so the level is hit, but not further. e.g.

actor.sexAppeal = 10
=> 10
actor.raise("sexAppeal", 3, 15)
=> 13 # + 3
actor.raise("sexAppeal", 3, 15)
=> 15 # + 2
actor.raise("sexAppeal", 3, 15)
=> 15 # + 0

The old commands for setting the attributes are still available when you don't want to do these checks

actor.sexAppeal += 1 # adds one to sexAppeal
actor.sexAppeal -= 1 # removes one from sexAppeal

As discussed in [issue 16](https://github.com/glqgamemaster/Gentle-Love-Quest/issues/16)