Thursday 8 September 2011

 OK, Girl class now,
class Girl
        attr_accessor :name         # girl's name
        attr_accessor :obedience    # 100 == perfect obedience
        attr_accessor :alertness    # 0 == asleep, 100 == hyper
        attr_accessor :energy       # 0 == sick, 100 == fighting fit
        attr_accessor :actions      # action tabs - all possible actions
        attr_accessor :current      # currently selected action

#
#       set name from params, defaults for other stats
#       only one action (sleep) for now
#
        def initialize(args)
                @name           = args[:name]
                @obedience      = args[:obedience]      || 10
                @alertness      = args[:alertness]      || 100
                @energy         = args[:energy]         || 100
                @actions = {
                        :sleep => Action_Sleep.new({})
                }
                @current = @actions[:sleep]
        end
       
#      
#       call perform on the current action
#
        def do_shift(shift_id)
                @current.perform(self)
        end
end
Stats are 1 - 100 in range.
 That was simple too. Never mind, next one makes up for it

No comments: