Sha256: 9c6a0012ae24a7231e0d236951fbc1991e9bc2d72e81b964f62d6e7650fe38f0

Contents?: true

Size: 718 Bytes

Versions: 1

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.execute :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

1 entries across 1 versions & 1 rubygems

Version Path
gamefic-standard-2.4.0 lib/gamefic-standard/actions/unlock.rb