-
Notifications
You must be signed in to change notification settings - Fork 1
/
unit_count.mdtlbl
66 lines (57 loc) · 1.36 KB
/
unit_count.mdtlbl
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
#**
一个统计所有单位的小逻辑
*#
id, count = 0;
while id < @unitCount {
lookup unit unit_type id;
const Bind = (@unit: ubind unit_type;);
:restart # 用于开始统计该种单位的跳转点
skip Bind === null {
# 目前已经绑定了一个非空单位
first icount = @unit 1;
while Bind != first {
# 若头单位死亡, 则重新统计该类单位
goto :restart (sensor $ first @dead;);
icount++;
}
count += icount; # 将该单位数累加到总单位数
# 打印每种存在的单位
print unit_type ": " icount "\n";
}
id++; # 推进单位id
}
print "unit total: " count;
printflush message1;
#* Li >>>
set id 0
set count id
jump ___3 greaterThanEq id @unitCount
___4:
lookup unit unit_type id
restart:
ubind unit_type
jump ___2 strictEqual @unit null
set first @unit
set icount 1
ubind unit_type
jump ___0 equal @unit first
___1:
sensor __0 first @dead
jump restart notEqual __0 false
op add icount icount 1
ubind unit_type
jump ___1 notEqual @unit first
___0:
op add count count icount
print unit_type
print ": "
print icount
print "\n"
___2:
op add id id 1
jump ___4 lessThan id @unitCount
___3:
print "unit total: "
print count
printflush message1
*#