#!/usr/bin/env ruby # -*- coding: utf-8 -*- require 'csv' require './Module_QUESTION' class ITEM attr_accessor :item_name, :item_data include QUESTION def initialize(name=nil) @item_name=name csv=CSV.read("Item_Data.csv") b=[] csv[1..].length.times do |n| a=[] csv[n+1][1..].length.times do |m| z =csv[n+1][m+1] if not z.nil? if csv[0][m+1]=="属性" z=z.split(";") elsif csv[0][m+1]=="効果" && csv[n+1][m+1].include?(":") y=z.split(",") y.length.times do |l| x= y[l].split(":") if x[0]=="状態" y[l]={x[0]=>x[1].split(";")} else y[l]={x[0]=>number_change(x[1])} end end y.length.times do |l| y[0].merge!(y[l]) end z=y[0] end end a << {csv[0][m+1] =>z} end a.length.times do |m| a[0].merge!(a[m]) end b<<{csv[n+1][0]=>a[0]} end b.length.times do |n| b[0].merge!(b[n]) end @@items_data=b[0] if not @item_name.nil? @item_data=@@items_data[@item_name] end end def use_item(status) end def items_data_getter return @@items_data end end