Class: Pktool::Command::Party

Inherits:
Thor
  • Object
show all
Defined in:
lib/cli/command/party.rb

Instance Method Summary collapse

Instance Method Details

#add(name, description = "", nature = "", effort_value = "", individual_value = "", ability = "", item = "", level = "") ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cli/command/party.rb', line 18

def add(name, description = "", nature = "", effort_value = "", individual_value = "", ability = "", item = "", level = "")
  feature = {}
  # feature = {
  #   description: description,
  #   nature: nature,
  #   effort_value: effort_value.to_sym,
  #   individual_value: individual_value,
  #   ability: ability,
  #   item: item,
  #   level: level
  # }
  party = Pktool::Party.new
  pokemon = Pktool::Pokemon.fetch(name, feature)
  party.add(pokemon)
  party.save
end

#delete(id) ⇒ Object



36
37
38
39
40
41
# File 'lib/cli/command/party.rb', line 36

def delete(id)
  party = Pktool::Party.new
  # todo: raise error
  party.delete( - 1)
  party.save
end

#listObject



9
10
11
12
13
14
15
# File 'lib/cli/command/party.rb', line 9

def list
  Pktool::Party.new.list.each_with_index do |p,index|
    puts "<bold>#{index+1} #{p.name}#{"(#{p.description})" unless p.description.empty?}</bold> #{p.nature} #{p.ability} #{p.item}".termcolor
    puts "努力値:#{p.ev.map{|k,v| "#{k}#{v} "}.join} 個体値:#{p.iv.map{|k,v| "#{k}#{v} "}.join}".termcolor
    puts ""
  end
end

#updateObject



44
45
46
# File 'lib/cli/command/party.rb', line 44

def update
  party = Pktool::party.new
end