Sha256: 3e760ddffa59f673cd441c80368fabeda629790ae9790ecc35019606737091b0

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

module Gamefic
  module Standard
    module Actions
      module Give
        extend Gamefic::Scriptable

        include Gamefic::What

        script do
          respond :give, available, children do |actor, _character, _gift|
            actor.tell 'Nothing happens.'
          end

          respond :give, available(Character), available do |actor, character, gift|
            actor.tell "#{The character} has no use for #{the gift}."
          end

          respond :give, available(Character), available do |actor, _character, gift|
            actor.execute :take, gift if gift.parent != actor

            actor.proceed if gift.parent == actor
          end

          respond :give, Thing do |actor, thing|
            actor.tell "Who do you want to give #{the thing} to?"
            actor.ask_for_what "give #{thing} to __what__"
          end

          respond :give, Character do |actor, character|
            actor.tell "What do you want to give to #{the character}?"
            actor.ask_for_what "give __what__ to #{character}"
          end

          interpret 'give :gift to :character', 'give :character :gift'
        end
      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/give.rb