Module: Gamefic::Standard::ImplicitTaking
- Included in:
- Character
- Defined in:
- lib/gamefic/standard/implicit_taking.rb
Overview
A mixin that provides a #have_or_take method to automate possession. Authors can use it to ensure that an actor is holding an entity as a prerequisite to doing something with it.
Instance Method Summary collapse
-
#have_or_take(entity) ⇒ Boolean
(also: #has_or_takes)
True if the actor is already holding the entity or successfully takes possession of it.
Instance Method Details
#have_or_take(entity) ⇒ Boolean Also known as: has_or_takes
True if the actor is already holding the entity or successfully takes possession of it.
24 25 26 27 28 |
# File 'lib/gamefic/standard/implicit_taking.rb', line 24 def have_or_take(entity) execute(:take, entity) unless possessions.include?(entity) possessions.include?(entity) end |