Class: Oakdex::Pokemon::GrowthEvents::Evolution

Inherits:
Base
  • Object
show all
Defined in:
lib/oakdex/pokemon/growth_events/evolution.rb

Overview

When pokemon could learn move

Instance Method Summary collapse

Methods inherited from Base

#initialize, #read_only?, #to_h

Constructor Details

This class inherits a constructor from Oakdex::Pokemon::GrowthEvents::Base

Instance Method Details

#execute(action) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/oakdex/pokemon/growth_events/evolution.rb', line 15

def execute(action)
  if action == 'Skip'
    @pokemon.add_growth_event(GrowthEvents::SkippedEvolution,
                              after: self)
  else
    original = @pokemon.name
    @pokemon.envolve_to(@options[:evolution])
    @pokemon.add_growth_event(GrowthEvents::DidEvolution,
                              original: original,
                              after: self)
  end

  remove_event
end

#messageObject



7
8
9
# File 'lib/oakdex/pokemon/growth_events/evolution.rb', line 7

def message
  "#{@pokemon.name} wants to envolve to #{@options[:evolution]}."
end

#possible_actionsObject



11
12
13
# File 'lib/oakdex/pokemon/growth_events/evolution.rb', line 11

def possible_actions
  %w[Continue Skip]
end