Sha256: 8a7d9e125c293149985be6dd527c3c0c7a6d45e5de8db4c92bd9f892f5c34a60

Contents?: true

Size: 718 Bytes

Versions: 2

Compression:

Stored size: 718 Bytes

Contents

Gamefic.script do
  respond :unlock, Use.available do |actor, thing|
    actor.tell "You can't unlock #{the thing}."
  end

  respond :unlock, Use.available(Lockable, :has_lock_key?), Use.children do |actor, thing, key|
    if thing.lock_key == key
      thing.locked = false
      actor.tell "You unlock ##{the thing} with #{the key}."
    else
      actor.tell "You can't unlock #{the thing} with #{the key}."
    end
  end

  respond :unlock, Use.available(Lockable, :has_lock_key?), Use.available do |actor, _thing, key|
    actor.perform :take, key if key.parent != actor
    actor.proceed if key.parent == actor
  end

  interpret "unlock :container with :key", "unlock :container :key"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gamefic-standard-2.3.1 lib/gamefic-standard/actions/unlock.rb
gamefic-standard-2.3.0 lib/gamefic-standard/actions/unlock.rb