Sha256: ee5e08351a11bd6e0ce572a91e0c2c9f4162e042037dabbc999bf4d69a204f9b
Contents?: true
Size: 1.83 KB
Versions: 1
Compression:
Stored size: 1.83 KB
Contents
# frozen_string_literal: true module Gamefic module Standard module Actions module Leave extend Gamefic::Scriptable respond :leave, parent do |actor, thing| actor.tell "There's no way out of #{the thing}." end respond :leave, parent(Enterable, proc(&:enterable?)) do |actor, thing| actor.tell "You leave #{the thing}." actor.parent = thing.parent end respond :leave, parent(Supporter, proc(&:enterable?)) do |actor, thing| actor.tell "You get off #{the thing}." actor.parent = thing.parent end respond :leave, room do |actor, room| portals = room.children.that_are(Portal) if portals.length == 0 actor.tell "You don't see any obvious exits." elsif portals.length == 1 actor.execute :go, portals[0] else actor.tell "I don't know which way you want to go: #{portals.map(&:instruction).join_or}." end end respond :leave do |actor| if actor.parent actor.execute :leave, actor.parent else actor.tell "You don't see any obvious exits." end end respond :leave, parent(Container, proc(&:enterable?), proc(&:closed?)) do |actor, container| actor.execute :open, container actor.proceed if container.open? end interpret 'exit', 'leave' interpret 'exit :supporter', 'leave :supporter' interpret 'get on :supporter', 'enter :supporter' interpret 'get off :supporter', 'leave :supporter' interpret 'get out :container', 'leave :container' interpret 'get out of :container', 'leave :container' interpret 'out', 'leave' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gamefic-standard-3.3.0 | lib/gamefic-standard/actions/leave.rb |