File: HE.lua

package info (click to toggle)
vcmi 1.6.5%2Bdfsg-2
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid, trixie
  • size: 32,060 kB
  • sloc: cpp: 238,971; python: 265; sh: 224; xml: 157; ansic: 78; objc: 61; makefile: 49
file content (181 lines) | stat: -rw-r--r-- 3,229 bytes parent folder | download | duplicates (2)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
local ReceiverBase = require("core:erm.ReceiverBase")

local HE = ReceiverBase:new()

function HE:new(ERM, p1, p2, p3)
	assert(p1 ~= nil, "!!HE requires hero identifier")

	if p2 and p3 then
		--by coordinates
		error("!!HEx/y/l: form is not implemented")
	else
		-- assume p1 is identifier
		local hero = GAME:getHeroWithSubid(p1)

		if not hero then
			logError("Hero with id ".. tostring(p1) .. " not found")
		end

		return ReceiverBase.new(self,
		{
			id=p1,
			ERM=ERM,
			hero=hero
		})
	end
end

function HE:A(x, ...)
	--artifacts
	logError("!!HE:A is not implemented")
end

HE:p1Dispatcher("B")

function HE:B0(x, ...)
	--name
	logError("!!HE:B is not implemented")
end

function HE:B1(x, ...)
	--bio
	logError("!!HE:B is not implemented")
end

function HE:B2(x, ...)
	--class
	logError("!!HE:B is not implemented")
end

function HE:B3(x, _)
	--get default bio
	logError("!!HE:B is not implemented")
end

function HE:C(x, ...)

	local argc = select("#", ...)

	if argc == 14 then
		return self:C14(x, ...)
	elseif argc == 4 then
		local N = select(1, ...)

		return nil, self["C"..tostring(N)](self, x, select(2, ...))
	else
		logError("!!HE:C extended form is not implemented")
	end
end

function HE:C0(x, slot, typ, count)
	--change creatures by slot

	if typ~=nil or count ~=nil then
		logError("!!HE:C0 set is not implemented")
		return
	end

	local stack = self.hero:getStack(slot)

	if not stack then
		return nil, -1, 0
	else
		return nil, stack:getType():getIndex(), stack:getCount()
	end

end

function HE:C1(x, ...)
	--change creatures by type
end

function HE:C05(x, ...)
	--change creatures by slot adv
end

function HE:C15(x, ...)
	--change creatures by type adv
end


function HE:C2(x, ...)
	--add creatures
end

function HE:C14(x, ...)
	-- change creatures with Query
end

function HE:D(x, ...)
	logError("!!HE:D not implemented")
end
function HE:E(x, ...)
	logError("!!HE:E is not implemented")
end
function HE:F(x, ...)
	logError("!!HE:F is not implemented")
end
function HE:G(x, ...)
	logError("!!HE:G is not implemented")
end
function HE:H(x, ...)
	logError("!!HE:H is not implemented")
end
function HE:I(x, ...)
	logError("!!HE:I is not implemented")
end
function HE:K(x, ...)
	logError("!!HE:K is not implemented")
end
function HE:L(x, ...)
	logError("!!HE:L is not implemented")
end
function HE:M(x, ...)
	logError("!!HE:M is not implemented")
end
function HE:N(x, ...)
	logError("!!HE:N is not implemented")
end

function HE:O(x, owner)
	if owner~=nil then
		logError("!!HE:O set is not implemented")
		return
	else
		if not self.hero then
			return 255
		end
		return self.hero:getOwner()
	end
end

function HE:P(x, ...)
	logError("!!HE:P is not implemented")
end
function HE:R(x, ...)
	logError("!!HE:R is not implemented")
end
function HE:S(x, ...)
	logError("!!HE:S is not implemented")
end
function HE:T(x, ...)
	logError("!!HE:T is not implemented")
end
function HE:U(x, ...)
	logError("!!HE:U is not implemented")
end
function HE:V(x, ...)
	logError("!!HE:V is not implemented")
end
function HE:W(x, ...)
	logError("!!HE:A is not implemented")
end
function HE:X(x, ...)
	logError("!!HE:X is not implemented")
end
function HE:Y(x, ...)
	logError("!!HE:Y is ot implemented")
end


return HE