Class: Mgmg::Cuisine

Inherits:
Object
  • Object
show all
Defined in:
lib/mgmg/cuisine.rb

Constant Summary collapse

MainFood =
{
	'獣肉'         => Vec[10,  0,  0],
	'ウッチ'       => Vec[ 0, 10, 10],
	'ゴッチ'       => Vec[ 0, 12, 12],
	'ガガッチ'     => Vec[ 0, 14, 14],
	'ドランギョ'   => Vec[15, 15, 10],
	'ドラバーン'   => Vec[20, 20, 15],
	'フレドラン'   => Vec[50,  0,  0],
	'アースドラン' => Vec[ 0, 50,  0],
	'アクアドラン' => Vec[ 0,  0, 50],
	'ダークドン'   => Vec[30, 30, 30],
}
SubFood =
{
	'氷酒'     => Vec[ 50,  70,  50],
	'氷水酒'   => Vec[ 50,  90,  50],
	'氷河酒'   => Vec[ 50, 110,  50],
	'カエン酒' => Vec[ 70,  50,  70],
	'爆炎酒'   => Vec[ 90,  50,  90],
	'煉獄酒'   => Vec[110,  50, 110],
}
Cookery =
{
	'焼き' => Vec[50, 50, 30],
	'蒸す' => Vec[30, 75, 75],
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(vec) ⇒ Cuisine

Returns a new instance of Cuisine.



4
5
6
# File 'lib/mgmg/cuisine.rb', line 4

def initialize(vec)
	@vec = vec
end

Instance Attribute Details

#vecObject

Returns the value of attribute vec.



7
8
9
# File 'lib/mgmg/cuisine.rb', line 7

def vec
  @vec
end

Class Method Details

.cook(cookery_s, main_s, sub_s, level) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/mgmg/cuisine.rb', line 60

def cook(cookery_s, main_s, sub_s, level)
	begin
		c = Cookery[cookery_s]
		m = MainFood[main_s]
		s = SubFood[sub_s]
		v = Vec[1, 1, 1]
		v.e_mul!(m).e_mul!(c).e_mul!(s.dup.add!(100+level)).e_div!(10000)
		new(v)
	rescue
		arg = [cookery_s, main_s, sub_s, level].inspect
		raise ArgumentError, "Some of arguments for cooking seems to be wrong. #{arg} is given, but they should be [cookery (String), main food (String), sub food (String), cooking level (Integer)]. Not all of cookeries and foods are supported."
	end
end

Instance Method Details

#attackObject



12
13
14
# File 'lib/mgmg/cuisine.rb', line 12

def attack
	@vec[0]
end

#initialize_copy(other) ⇒ Object



8
9
10
# File 'lib/mgmg/cuisine.rb', line 8

def initialize_copy(other)
	@vec = other.vec.dup
end

#magdefObject



18
19
20
# File 'lib/mgmg/cuisine.rb', line 18

def magdef
	@vec[2]
end

#phydefObject



15
16
17
# File 'lib/mgmg/cuisine.rb', line 15

def phydef
	@vec[1]
end

#to_sObject Also known as: inspect



21
22
23
# File 'lib/mgmg/cuisine.rb', line 21

def to_s
	"料理[攻撃:#{self.attack}, 物防:#{self.phydef}, 魔防:#{self.magdef}]"
end