forked from pokemoncentral/wiki-lua-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMovesData.lua
90 lines (64 loc) · 1.63 KB
/
MovesData.lua
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
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
--[[
Module used as a frontend to wikicode for data modules relative to moves.
Each interface function is documented in its own comment, with examples.
--]]
local b = {}
local txt = require('Wikilib-strings') -- luacheck: no unused
local multigen = require('Wikilib-multigen')
local moves = require("Move-data")
--[[
Returns type given move name.
--]]
b.getType = function(frame)
return string.fu(
multigen.getGenValue(
moves[string.trim(frame.args[1]:lower())].type,
tonumber(frame.args.gen)
)
)
end
b.get_type = b.getType
--[[
Returns damage category given move name.
--]]
b.getDamageCategory = function(frame)
return string.fu(
multigen.getGenValue(
moves[string.trim(frame.args[1]:lower())].category,
tonumber(frame.args.gen)
)
)
end
b.get_damage_category, b.getCat, b.get_cat =
b.getDamageCategory, b.getDamageCategory, b.getDamageCategory
--[[
Returns power given move name.
--]]
b.getPower = function(frame)
return multigen.getGenValue(
moves[string.trim(frame.args[1]:lower())].power,
tonumber(frame.args.gen)
)
end
b.get_power = b.getPower
--[[
Returns type given move name.
--]]
b.getAccuracy = function(frame)
return multigen.getGenValue(
moves[string.trim(frame.args[1]:lower())].accuracy,
tonumber(frame.args.gen)
)
end
b.get_accuracy = b.getAccuracy
--[[
Returns type given move name.
--]]
b.getPP = function(frame)
return multigen.getGenValue(
moves[string.trim(frame.args[1]:lower())].pp,
tonumber(frame.args.gen)
)
end
b.get_pp = b.getPP
return b