Bunny.rb
RubyMud/Mobiles/Bunny.rb · 801 B
From the archive rbmud-0.1rc2.tar.gz
Download the archive « Back to the archive contents
# Inheritance require "Mobile.rb" module RubyMud class Bunny < Mobile include Tickable def onLoad() #$mainTick.AddTickable(self) TickObject.new(self,Time.now+1) end def initialize(room,name) super(room,name,"") # Initialize the standard stats Hp.new(self,10) Xp.new(self,10) XpWhenKilled.new(self,100) end def tick() # Add itself to the tick queue again TickObject.new(self,Time.now+rand(10)+5) room = @parent # Find a random exit exit = room.exits[rand(room.exits.length)] return if exit == nil newRoom = exit.otherRoom(room) return if newRoom == nil if getFlagByClass(NoMove) != nil room.roomTalk(self,"The bunny struggles to move") return end moveThroughExit(exit) end end BaseObject.addClass(Bunny) end # module