-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdgm.rb
38 lines (36 loc) · 1.23 KB
/
dgm.rb
1
2
3
4
5
6
7
8
9
10
11
12
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
c_position = 0;
u_position = 0;
r_position = 0;
name = "";
skip = false;
File.open("dgm seed", "w") do |output|
File.open("dgm spoiler") do |file|
file.each do |line|
if line.start_with? "Name"
skip = false;
name = line.split(%r{\t})[1].strip.split(%r{[ ]}).each{|word| word.downcase!};
if name[-1].start_with?('(') then
name[-1] = name[-1].delete('()')
if name[0] == name[-1] then
skip = true;
next
end
name.pop()
end
# p name.join(" ")
end
if line.start_with?("Set/Rarity:") and skip == false
r_position += 1;
output << "Card.create({ :name => \""<< name.join(" ") <<"\", :position => \""<< r_position << "\", :set => 'dgm', :color => 'r'}) \n";
if !line.strip.end_with?("Rare")
u_position += 1;
output << "Card.create({ :name => \""<< name.join(" ") <<"\", :position => \""<< u_position << "\", :set => 'dgm', :color => 'u'}) \n"
if !line.strip.end_with?("Uncommon")
c_position += 1;
output << "Card.create({ :name => \""<< name.join(" ") <<"\", :position => \""<< c_position << "\", :set => 'dgm', :color => 'c'}) \n"
end
end
end
end
end
end