13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/punks/punks.rb', line 13
def self.generate( *values, style: nil, patch: nil )
if values[0].is_a?( String )
if style
values = if style.downcase.index( 'natural') && style.downcase.index( '2')
["#{values[0]} (N2)"] + values[1..-1]
elsif style.downcase[0] == 'n' ["#{values[0]} (N)"] + values[1..-1]
else
puts "!! ERROR - unknown punk style #{style}; sorry"
exit 1
end
end
archetype_key = Generator.normalize_key( values[0] )
if archetype_key.end_with?( 'bw' ) || archetype_key.end_with?( '1bit')
values = [values[0]] + values[1..-1].map do |attribute|
if attribute.is_a?( Pixelart::Image )
attribute
else
attribute_key = Generator.normalize_key( attribute )
if ['wildhair'].include?( attribute_key ) attribute
elsif attribute_key.index( "black" )
attribute else
"#{attribute} B&W"
end
end
end
pp values
end
if archetype_key.index( 'female1' ) ||
archetype_key.index( 'female2' ) ||
archetype_key.index( 'female3' ) ||
archetype_key.index( 'female4' ) ||
archetype_key.index( 'zombiefemale' )
values = [values[0]] + values[1..-1].map do |attribute|
if attribute.is_a?( Pixelart::Image )
attribute
else
attribute_key = Generator.normalize_key( attribute )
if attribute_key == 'smile' || attribute_key == 'frown'
attribute += if archetype_key.index( 'zombiefemale' ) then ' Zombie'
elsif archetype_key.index( 'female1' ) then ' 1'
elsif archetype_key.index( 'female2' ) then ' 2'
elsif archetype_key.index( 'female3' ) then ' 3'
elsif archetype_key.index( 'female4' ) then ' 4'
else
puts "!! ERROR - smile or frown (mouth expression) not supported for archetype:"
pp values
exit 1
end
end
attribute
end
end
end
end
generator.generate( *values, style: style, patch: patch )
end
|