-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
3371 lines (3356 loc) · 240 KB
/
index.html
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="zh" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="UTF-8">
<title>Screeps Arena中文文档</title>
<link rel="stylesheet" type="text/css" href="css/atom-one-dark-reasonable.min.css">
<link rel="stylesheet" type="text/css" href="css/base.css">
<script src="js/highlight.min.js"></script>
<script src="js/base.js"></script>
</head>
<body id="wid-body" class="all" style="overflow-y: hidden" onload="load()">
<script>
hljs.highlightAll();
</script>
<div class="content-all">
<div class="content-left" style="padding-left: 8px">
<h2>Screeps API</h2>
<label style="padding-left: 10px">
<input type="search" id="search-box" placeholder="搜索" oninput="search()"/>
</label>
<div style="padding-top: 10px">
<details open>
<summary class="tle">OBJECTS</summary>
<p><a class="cl" href="#objects-arenaInfo" target="_parent">arenaInfo</a></p>
<p><a class="cl" href="#objects-ConstructionSite" target="_parent">ConstructionSite</a></p>
<p><a class="cl" href="#objects-Creep" target="_parent">Creep</a></p>
<p><a class="cl" href="#objects-GameObject" target="_parent">GameObject</a></p>
<p><a class="cl" href="#objects-OwnedStructure" target="_parent">OwnedStructure</a></p>
<p><a class="cl" href="#objects-Resource" target="_parent">Resource</a></p>
<p><a class="cl" href="#objects-Source" target="_parent">Source</a></p>
<p><a class="cl" href="#objects-Store" target="_parent">Store</a></p>
<p><a class="cl" href="#objects-Structure" target="_parent">Structure</a></p>
<p><a class="cl" href="#objects-StructureContainer" target="_parent">StructureContainer</a></p>
<p><a class="cl" href="#objects-StructureExtension" target="_parent">StructureExtension</a></p>
<p><a class="cl" href="#objects-StructureRampart" target="_parent">StructureRampart</a></p>
<p><a class="cl" href="#objects-StructureRoad" target="_parent">StructureRoad</a></p>
<p><a class="cl" href="#objects-StructureSpawn" target="_parent">StructureSpawn</a></p>
<p><a class="cl" href="#objects-StructureTower" target="_parent">StructureTower</a></p>
<p><a class="cl" href="#objects-StructureWall" target="_parent">StructureWall</a></p>
<p><a class="cl" href="#objects-Spawning" target="_parent">Spawning</a></p>
<p><a class="cl" href="#objects-CostMatrix" target="_parent">CostMatrix</a></p>
<p><a class="cl" href="#objects-Visual" target="_parent">Visual</a></p>
</details><br>
<details open>
<summary class="tle">FUNCTIONS</summary>
<p><a class="cl" href="#functions-createConstructionSite" target="_parent">createConstructionSite</a></p>
<p><a class="cl" href="#functions-findClosestByPath" target="_parent">findClosestByPath</a></p>
<p><a class="cl" href="#functions-findClosestByRange" target="_parent">findClosestByRange</a></p>
<p><a class="cl" href="#functions-findInRange" target="_parent">findInRange</a></p>
<p><a class="cl" href="#functions-findPath" target="_parent">findPath</a></p>
<p><a class="cl" href="#functions-getCpuTime" target="_parent">getCpuTime</a></p>
<p><a class="cl" href="#functions-getDirection" target="_parent">getDirection</a></p>
<p><a class="cl" href="#functions-getHeapStatistics" target="_parent">getHeapStatistics</a></p>
<p><a class="cl" href="#functions-getObjectById" target="_parent">getObjectById</a></p>
<p><a class="cl" href="#functions-getObjectsByPrototype" target="_parent">getObjectsByPrototype</a></p>
<p><a class="cl" href="#functions-getObjects" target="_parent">getObjects</a></p>
<p><a class="cl" href="#functions-getRange" target="_parent">getRange</a></p>
<p><a class="cl" href="#functions-getTerrainAt" target="_parent">getTerrainAt</a></p>
<p><a class="cl" href="#functions-getTicks" target="_parent">getTicks</a></p>
<p><a class="cl" href="#functions-searchPath" target="_parent">searchPath</a></p>
</details><br>
<details open>
<summary class="tle">CAPTURE THE FLAG</summary>
<p><a class="cl" href="#capture-the-flag-BodyPart" target="_parent">BodyPart</a></p>
<p><a class="cl" href="#capture-the-flag-Flag" target="_parent">Flag</a></p>
<p><a class="cl" href="#capture-the-flag-StructureTower" target="_parent">StructureTower</a></p>
</details><br>
<details open>
<summary class="tle">SPAWN AND SWAMP</summary>
</details><br>
<details open>
<summary class="tle">COLLECT AND CONTROL</summary>
<p><a class="cl" href="#collect-and-control-AreaEffect" target="_parent">AreaEffect</a></p>
<p><a class="cl" href="#collect-and-control-ScoreCollector" target="_parent">ScoreCollector</a></p>
<p><a class="cl" href="#collect-and-control-EFFECT_DAMAGE" target="_parent">EFFECT_DAMAGE</a></p>
<p><a class="cl" href="#collect-and-control-EFFECT_FREEZE" target="_parent">EFFECT_FREEZE</a></p>
<p><a class="cl" href="#collect-and-control-EFFECT_HEAL" target="_parent">EFFECT_HEAL</a></p>
<p><a class="cl" href="#collect-and-control-RESOURCE_SCORE" target="_parent">RESOURCE_SCORE</a></p>
<p><a class="cl" href="#collect-and-control-RESOURCE_SCORE_X" target="_parent">RESOURCE_SCORE_X</a></p>
<p><a class="cl" href="#collect-and-control-RESOURCE_SCORE_Y" target="_parent">RESOURCE_SCORE_Y</a></p>
<p><a class="cl" href="#collect-and-control-RESOURCE_SCORE_Z" target="_parent">RESOURCE_SCORE_Z</a></p>
</details><br>
<details open>
<summary class="tle">CONSTANTS</summary>
<p><a class="cl" href="#constants-ALL" target="_parent">ALL</a></p>
</details>
</div>
</div>
<div class="content-right">
<div class="content-chapter" id="objects-arenaInfo">
<div class="content-desc">
<p><span style="color: #6394f8;" class="f24">arenaInfo</span><span style="color: gray;" class="f16">object</span></p>
<div class="content-inside" id="arenaInfo-name">
<p class="f16"><a class="head" href="#arenaInfo-name">name</a><span style="color: gray;" class="f12">string</span></p>
<p class="f12">竞技场的名字</p>
</div>
<div class="content-inside" id="arenaInfo-level">
<p class="f16"><a class="head" href="#arenaInfo-level">level</a><span style="color: gray;" class="f12">number</span></p>
<p class="f12">目前处于Basic(基础)竞技场的等级为1,Advance(高级)竞技场的等级为2</p>
</div>
<div class="content-inside" id="arenaInfo-season">
<p class="f16"><a class="head" href="#arenaInfo-season">season</a><span style="color: gray;" class="f12">string</span></p>
<p class="f12">赛季,目前等于“alpha”</p>
</div>
<div class="content-inside" id="arenaInfo-ticksLimit">
<p class="f16"><a class="head" href="#arenaInfo-ticksLimit">ticksLimit</a><span style="color: gray;" class="f12">number</span></p>
<p class="f12">游戏tick(时间)限制</p>
</div>
<div class="content-inside" id="arenaInfo-cpuTimeLimit">
<p class="f16"><a class="head" href="#arenaInfo-cpuTimeLimit">cpuTimeLimit</a><span style="color: gray;" class="f12">number</span></p>
<p class="f12">每刻的CPU执行效率时间限制(除了第一刻)</p>
</div>
<div class="content-inside" id="arenaInfo-cpuTimeLimitFirstTick">
<p class="f16"><a class="head" href="#arenaInfo-cpuTimeLimitFirstTick">cpuTimeLimitFirstTick</a><span style="color: gray;" class="f12">number</span></p>
<p class="f12">第一刻的CPU执行效率时间限制</p>
</div>
</div>
<div class="content-code">
<div style="padding-top: 0">
<pre><code class="javascript">import { arenaInfo } from 'game';
export function loop(){
console.log(arenaInfo.name);
}</code></pre>
</div>
</div>
</div>
<div class="content-chapter" id="objects-ConstructionSite">
<div class="content-desc">
<p><span style="color: #6394f8;" class="f24">ConstructionSite</span><span style="color: gray;" class="f16">class extends <a class="hl" href="#objects-GameObject">GameObject</a>
</span></p>
<p class="f12">一个正在建筑中的结构空位,要在该空位上建造一个结构,你需要给附有 WORK 属性的creep一些能量,并且执行build功能。</p>
<div class="content-inside" id="constructionSite-my">
<p class="f16"><a class="head" href="#constructionSite-my">my</a><span style="color: gray;" class="f12">boolean</span></p>
<p class="f12">该结构空位目前是你正在建造的</p>
</div>
<div class="content-inside" id="constructionSite-progress">
<p class="f16"><a class="head" href="#constructionSite-progress">progress</a><span style="color: gray;" class="f12">number</span></p>
<p class="f12">该结构目前建筑的进度</p>
</div>
<div class="content-inside" id="constructionSite-progressTotal">
<p class="f16"><a class="head" href="#constructionSite-progressTotal">progressTotal</a><span style="color: gray;" class="f12">number</span></p>
<p class="f12">场上要建筑的结构的总进度</p>
</div>
<div class="content-inside" id="constructionSite-structure">
<p class="f16"><a class="head" href="#constructionSite-structure">structure</a><span style="color: gray;" class="f12"><a class="hl" href="#objects-Structure">Structure</a></span></p>
<p class="f12">建造的结构(当该结构建完成时)</p>
</div>
<div class="content-inside" id="constructionSite-remove">
<p class="f16"><a class="head" href="#constructionSite-remove">remove</a><span style="color: white;">()</span></p>
<p class="f12">移除建造的结构</p>
</div>
</div>
<div class="content-code">
<div style="padding-top: 0">
<pre><code class="javascript"></code></pre>
</div>
</div>
</div>
<div class="content-chapter" id="objects-CostMatrix">
<div class="content-desc">
<p><span style="color: #6394f8;" class="f24">CostMatrix</span><span style="color: gray;" class="f16">class
</span></p>
<p class="f12">用于自定义导航成本数据的一个类,如果在该类中发现非0值,则将使用该值代替掉默认地形造成的成本。</p>
<div class="content-inside" id="CostMatrix-constructor" style="height: +102px;">
<p class="f16"><a class="head" href="#CostMatrix-constructor">constructor</a><span style="color: gray;" class="f12">()</span></p>
<p class="f12">为所有位置创建一个初始值为0的新<a class="cost" href="#objects-CostMatrix">CostMatrix</a>。</p>
</div>
<div class="content-inside" id="CostMatrix-set">
<p class="f16"><a class="head" href="#CostMatrix-set">set</a><span style="color: white;">(</span><span class="tch">x</span><span style="color: white;">, </span><span class="tch">y</span><span style="color: white;">, </span><span class="tch">cost</span><span style="color: white;">)</span></p>
<p class="f12">在该<a class="cost" href="#objects-CostMatrix">CostMatrix</a>中设置来自x, y位置的成本值。</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<thead>
<tr style="border-bottom: 1px solid gray; font-weight: bold;">
<td style="width: 80px;">参数</td>
<td style="width: 50px;">类型</td>
<td style="width: 460px;">描述</td>
</tr>
</thead>
<tbody>
<tr>
<td style="color: #f05654;">x</td>
<td><span style="color: gray">number</span></td>
<td>游戏场上的x轴</td>
</tr>
<tr>
<td style="color: #f05654;">y</td>
<td><span style="color: gray">number</span></td>
<td>游戏场上的y轴</td>
</tr>
<tr>
<td style="color: #f05654;">cost</td>
<td><span style="color: gray">number</span></td>
<td>该位置的成本值,必须是一个整数。0的成本将使用该位置的默认成本。大于或等于255的成本将被视作无法使用。</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="content-inside" id="CostMatrix-get">
<p class="f16"><a class="head" href="#CostMatrix-get">get</a><span style="color: white;">(</span><span class="tch">x</span><span style="color: white;">, </span><span class="tch">y</span><span style="color: white;">)</span></p>
<p class="f12">在该<a class="cost" href="#objects-CostMatrix">CostMatrix</a>中获取来自x, y位置的成本值。</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<thead>
<tr style="border-bottom: 1px solid gray; font-weight: bold;">
<td style="width: 80px;">参数</td>
<td style="width: 50px;">类型</td>
<td style="width: 460px;">描述</td>
</tr>
</thead>
<tbody>
<tr>
<td style="color: #f05654;">x</td>
<td><span style="color: gray">number</span></td>
<td>游戏场上的x轴</td>
</tr>
<tr>
<td style="color: #f05654;">y</td>
<td><span style="color: gray">number</span></td>
<td>游戏场上的y轴</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="content-inside" id="CostMatrix-clone">
<p class="f16"><a class="head" href="#CostMatrix-clone">clone</a><span style="color: white;">()</span></p>
<p class="f12">将该<a class="cost" href="#objects-CostMatrix">CostMatrix</a>复制到具有着相同数据的一个新的<a class="cost" href="#objects-CostMatrix">CostMatrix</a>中,并返回一个新的<a class="cost" href="#objects-CostMatrix">CostMatrix</a>。</p>
</div>
</div>
<div class="content-code">
<div style="padding-top: 82px">
<pre><code class="javascript">import { CostMatrix } from 'game/path-finder';
export function loop() {
let costs = new CostMatrix;
}</code></pre>
</div>
<div style="padding-top: 0px">
<pre><code class="javascript">import { CostMatrix } from 'game/path-finder';
export function loop() {
let costs = new CostMatrix;
costs.set(constructionSite.x, constructionSite.y, 10); // 避免在建筑空位上走过。
}
</code></pre>
</div>
</div>
</div>
<div class="content-chapter" id="objects-Creep">
<div class="content-desc">
<p><span style="color: #6394f8;" class="f24">Creep</span><span style="color: gray;" class="f16">class extends <a class="hl" href="#objects-GameObject">GameObject</a></span></p>
<p class="f12">Creep们是你的工作单位,Creep们可以移动、抓取能量、建造结构、攻击其他人的Creep以及执行很多别的功能。每个Creep最多可以拥有50个bodyPart(属性【下同】)构成,可以有以下几种类型:</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<thead>
<tr>
<td style="border-bottom: 1px solid gray; width: 80px; font-weight: bold;">属性</td>
<td style="border-bottom: 1px solid gray; width: 50px; font-weight: bold;">花费</td>
<td style="border-bottom: 1px solid gray; width: 460px; font-weight: bold;">属性功能</td>
</tr>
</thead>
<tbody>
<tr>
<td style="border-bottom: 1px solid gray;"><a class="cp move" href="#constants-all-MOVE">MOVE</a></td>
<td style="border-bottom: 1px solid gray;"><a class="cost" href="#constants-all-BODYPART_COST">50</a></td>
<td style="border-bottom: 1px solid gray;">每刻减少2点疲劳值</td>
</tr>
<tr>
<td style="border-bottom: 1px solid gray;"><a class="cp work" href="#constants-WORK">WORK</a></td>
<td style="border-bottom: 1px solid gray;"><a class="cost" href="#constants-all-BODYPART_COST">100</a></td>
<td style="border-bottom: 1px solid gray;">每刻从一个能量源抓取2点能量单元<br>每刻构建一个可容纳5点能源单元的结构</td>
</tr>
<tr>
<td style="border-bottom: 1px solid gray;"><a class="cp carry" href="#constants-all-CARRY">CARRY</a></td>
<td style="border-bottom: 1px solid gray;"><a class="cost" href="#constants-all-BODYPART_COST">50</a></td>
<td style="border-bottom: 1px solid gray;">最多可以容纳50个资源单元</td>
</tr>
<tr>
<td style="border-bottom: 1px solid gray;"><a class="cp attack" href="#constants-all-ATTACK">ATTACK</a></td>
<td style="border-bottom: 1px solid gray;"><a class="cost" href="#constants-all-BODYPART_COST">80</a></td>
<td style="border-bottom: 1px solid gray;">攻击其他的Creep、结构,用短距离每刻攻击30次</td>
</tr>
<tr>
<td style="border-bottom: 1px solid gray;"><a class="cp ranged" href="#constants-all-RANGED_ATTACK">RANGED_ATTACK</a></td>
<td style="border-bottom: 1px solid gray;"><a class="cost" href="#constants-all-BODYPART_COST">150</a></td>
<td style="border-bottom: 1px solid gray;">攻击其他的Creep、结构,用3格远长距离每刻攻击10次<br>攻击3格范围内所有Creep、结构,命中1-4-10次【取决于格数】</td>
</tr>
<tr>
<td style="border-bottom: 1px solid gray;"><a class="cp heal" href="#constants-all-HEAL">HEAL</a></td>
<td style="border-bottom: 1px solid gray;"><a class="cost" href="#constants-all-BODYPART_COST">250</a></td>
<td style="border-bottom: 1px solid gray;">治疗自身或另一个Creep,在短距离内每刻治疗12次,远距离每刻治疗4次</td>
</tr>
<tr>
<td style="border-bottom: 1px solid gray;"><a class="cp tough" href="#constants-all-TOUGH">TOUGH</a></td>
<td style="border-bottom: 1px solid gray;"><a class="cost" href="#constants-all-BODYPART_COST">10</a></td>
<td style="border-bottom: 1px solid gray;">没有任何效果,只是对Creep增加了额外的命中点。(ps:就一占位符)</td>
</tr>
</tbody>
</table>
</div>
<div class="content-inside" id="creep-body">
<p class="f16"><a class="head" href="#creep-body">body</a><span style="color: gray;" class="f12">array</span></p>
<p class="f12">
描述Creep的属性列表,每个元素包含以下几个数值:
<ul class="f12" style="padding-left: 32px;">
<li>type:string(该Creeps的类型之一)</li>
<li>hits:number(该Creeps剩余的血量)</li>
</ul>
</p>
</div>
<div class="content-inside" id="creep-fatigue">
<p class="f16"><a class="head" href="#creep-fatigue">fatigue</a><span style="color: gray;" class="f12">number</span></p>
<p class="f12">疲劳值,如果该值大于0,则该Creep不能移动</p>
</div>
<div class="content-inside" id="creep-hits">
<p class="f16"><a class="head" href="#creep-hits">hits</a><span style="color: gray;" class="f12">number</span></p>
<p class="f12">该Creep目前的血量</p>
</div>
<div class="content-inside" id="creep-hitsMax">
<p class="f16"><a class="head" href="#creep-hitsMax">hitsMax</a><span style="color: gray;" class="f12">number</span></p>
<p class="f12">该Creep的最大血量</p>
</div>
<div class="content-inside" id="creep-my">
<p class="f16"><a class="head" href="#creep-my">my</a><span style="color: gray;" class="f12">boolean</span></p>
<p class="f12">属于你自己的Creep</p>
</div>
<div class="content-inside" id="creep-store">
<p class="f16"><a class="head" href="#creep-store">store</a><span style="color: gray;" class="f12"><a class="hl" href="#objects-Store">Store</a></span></p>
<p class="f12">一个<a class="cost" href="#objects-Store">Store</a>对象,包含目前该Creep所拥有的货物</p>
</div>
<div class="content-inside" id="creep-attack">
<p class="f16"><a class="head" href="#creep-attack">attack</a><span style="color: white;">(</span><span class="tch">target</span><span style="color: white;">)</span></p>
<p class="f12">使用近战攻击邻近的另一个Creep或结构。需要该Creep具有<a class="cp attack" href="#constants-all-ATTACK">ATTACK</a>属性。如果要攻击的目标位于墙壁内,则会攻击该墙壁。要攻击的目标必须位于Creep的相邻区块中。</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<thead>
<tr style="border-bottom: 1px solid gray; font-weight: bold;">
<td style="width: 80px;">参数</td>
<td style="width: 50px;">类型</td>
<td style="width: 460px;">描述</td>
</tr>
</thead>
<tbody>
<tr>
<td style="color: #f05654;">target</td>
<td><a class="cp carry" href="#objects-Creep">Creep</a><br><a class="cp carry" href="#objects-Structure">Structure</a></td>
<td>要攻击的目标对象</td>
</tr>
</tbody>
</table>
</div>
<p class="f12">返回以下代码之一:</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<tr>
<td style="width: 120px;"><a class="cl cp" href="#constants-all-OK">OK</a></td>
<td style="width: 20px;">0</td>
<td style="width: 460px;">操作已成功执行</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_OWNER">ERR_NOT_OWNER</a></td>
<td>-1</td>
<td>该Creep不属于你</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_INVALID_TARGET">ERR_INVALID_TARGET</a></td>
<td>-7</td>
<td>目标不属于可被攻击的对象</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_IN_RANGE">ERR_NOT_IN_RANGE</a></td>
<td>-9</td>
<td>目标太远啦</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NO_BODYPART">ERR_NO_BODYPART</a></td>
<td>-12</td>
<td>这个Creep的属性列表里并没有ATTACK(攻击)属性</td>
</tr>
</table>
</div>
</div>
<div class="content-inside" id="creep-build">
<p class="f16"><a class="head" href="#creep-build">build</a><span style="color: white;">(</span><span class="tch">target</span><span style="color: white;">)</span></p>
<p class="f12">使用该Creep携带的能量在目标区块建造一个结构。需要该Creep具有<a class="cp work" href="#constants-all-WORK">WORK</a>和<a class="cp carry" href="#constants-all-CARRY">CARRY</a>属性。目标区块必须在Creep的3个区块范围以内。</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<thead>
<tr style="border-bottom: 1px solid gray; font-weight: bold;">
<td style="width: 80px;">参数</td>
<td style="width: 50px;">类型</td>
<td style="width: 460px;">描述</td>
</tr>
</thead>
<tbody>
<tr>
<td style="color: #f05654;">target</td>
<td><a class="cp carry" href="#objects-ConstructionSite">ConstructionSite</a></td>
<td>要建造的目标建筑描述</td>
</tr>
</tbody>
</table>
</div>
<p class="f12">返回以下代码之一:</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<tr>
<td style="width: 120px;"><a class="cl cp" href="#constants-all-OK">OK</a></td>
<td style="width: 20px;">0</td>
<td style="width: 460px;">操作已成功执行</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_OWNER">ERR_NOT_OWNER</a></td>
<td>-1</td>
<td>该Creep不属于你</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_ENOUGH_RESOURCES">ERR_NOT_ENOUGH_RESOURCES</a></td>
<td>-6</td>
<td>该Creep没有足够多的搬运能量</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_INVALID_TARGET">ERR_INVALID_TARGET</a></td>
<td>-7</td>
<td>目标不是可以被建造的单位,或者是你无法在此处建造结构(可能是因为你要建造的区块有障碍物)</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_IN_RANGE">ERR_NOT_IN_RANGE</a></td>
<td>-9</td>
<td>目标太远啦</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NO_BODYPART">ERR_NO_BODYPART</a></td>
<td>-12</td>
<td>这个Creep的属性列表里并没有WORK(攻击)属性</td>
</tr>
</table>
</div>
</div>
<div class="content-inside" id="creep-drop">
<p class="f16"><a class="head" href="#creep-drop">drop</a><span style="color: white;">(</span><span class="tch">resourceType</span><span style="color: white;">, </span><span class="tch">[amount]</span><span style="color: white;">)</span></p>
<p class="f12">将该Creep身上的资源置于当前区块位置(扔掉)</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<thead>
<tr style="border-bottom: 1px solid gray; font-weight: bold;">
<td style="width: 80px;">参数</td>
<td style="width: 50px;">类型</td>
<td style="width: 460px;">描述</td>
</tr>
</thead>
<tbody>
<tr>
<td style="color: #f05654;">resourceType</td>
<td><span style="color: gray">string</span></td>
<td>RESOURCE_*的常量之一</td>
</tr>
<tr>
<td style="color: #f05654;">amount (optional)</td>
<td><span style="color: gray">number</span></td>
<td>要置于当前区块的资源数量</td>
</tr>
</tbody>
</table>
</div>
<p class="f12">返回以下代码之一:</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<tr>
<td style="width: 120px;"><a class="cl cp" href="#constants-all-OK">OK</a></td>
<td style="width: 20px;">0</td>
<td style="width: 460px;">操作已成功执行</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_OWNER">ERR_NOT_OWNER</a></td>
<td>-1</td>
<td>该Creep不属于你</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_ENOUGH_RESOURCES">ERR_NOT_ENOUGH_RESOURCES</a></td>
<td>-6</td>
<td>该Creep没有该数量那么多的资源要置于地上</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_INVALID_ARGS">ERR_INVALID_ARGS</a></td>
<td>-10</td>
<td>resourceType参数有误,并不是有效的RESOURCE_*常量之一</td>
</tr>
</table>
</div>
</div>
<div class="content-inside" id="creep-harvest">
<p class="f16"><a class="head" href="#creep-harvest">harvest</a><span style="color: white;">(</span><span class="tch">target</span><span style="color: white;">)</span></p>
<p class="f12">从能量源区块获取能量,需要该Creep具有<a class="cp work" href="#constants-all-WORK">WORK</a>属性,如果该Creep具有<a class="cp carry" href="#constants-all-CARRY">CARRY</a>属性,将会把收集的资源置入身体里,否则资源将会掉落在相邻的地面上。目标必须位于该Creep的相邻区块内</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<thead>
<tr style="border-bottom: 1px solid gray; font-weight: bold;">
<td style="width: 80px;">参数</td>
<td style="width: 50px;">类型</td>
<td style="width: 460px;">描述</td>
</tr>
</thead>
<tbody>
<tr>
<td style="color: #f05654;">target</td>
<td><a class="cp carry" href="#objects-Source">Source</a></td>
<td>要收集的资源对象</td>
</tr>
</tbody>
</table>
</div>
<p class="f12">返回以下代码之一:</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<tr>
<td style="width: 120px;"><a class="cl cp" href="#constants-all-OK">OK</a></td>
<td style="width: 20px;">0</td>
<td style="width: 460px;">操作已成功执行</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_OWNER">ERR_NOT_OWNER</a></td>
<td>-1</td>
<td>该Creep不属于你</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_ENOUGH_RESOURCES">ERR_NOT_ENOUGH_RESOURCES</a></td>
<td>-6</td>
<td>目标不包含任何可收集的资源</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_INVALID_TARGET">ERR_INVALID_TARGET</a></td>
<td>-7</td>
<td>目标不属于可以被收集资源的对象</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_IN_RANGE">ERR_NOT_IN_RANGE</a></td>
<td>-9</td>
<td>目标太远啦</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NO_BODYPART">ERR_NO_BODYPART</a></td>
<td>-12</td>
<td>你的Creep属性列表没有包含WORK属性</td>
</tr>
</table>
</div>
</div>
<div class="content-inside" id="creep-heal">
<p class="f16"><a class="head" href="#creep-heal">heal</a><span style="color: white;">(</span><span class="tch">target</span><span style="color: white;">)</span></p>
<p class="f12">治疗自己或其他己方的Creep,它将恢复Creep们受到伤害的部分,并恢复血量。需要该Creep具有<a class="cp heal" href="#constants-all-HEAL">HEAL</a>属性,目标必须位于该Creep的相邻区块内</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<thead>
<tr style="border-bottom: 1px solid gray; font-weight: bold;">
<td style="width: 80px;">参数</td>
<td style="width: 50px;">类型</td>
<td style="width: 460px;">描述</td>
</tr>
</thead>
<tbody>
<tr>
<td style="color: #f05654;">target</td>
<td><a class="cp carry" href="#objects-Creep">Creep</a></td>
<td>要治疗的目标对象</td>
</tr>
</tbody>
</table>
</div>
<p class="f12">返回以下代码之一:</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<tr>
<td style="width: 120px;"><a class="cl cp" href="#constants-all-OK">OK</a></td>
<td style="width: 20px;">0</td>
<td style="width: 460px;">操作已成功执行</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_OWNER">ERR_NOT_OWNER</a></td>
<td>-1</td>
<td>该Creep不属于你</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_INVALID_TARGET">ERR_INVALID_TARGET</a></td>
<td>-7</td>
<td>目标不是有效的Creep对象</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_IN_RANGE">ERR_NOT_IN_RANGE</a></td>
<td>-9</td>
<td>目标太远啦</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NO_BODYPART">ERR_NO_BODYPART</a></td>
<td>-12</td>
<td>你的Creep属性列表没有包含HEAL属性</td>
</tr>
</table>
</div>
</div>
<div class="content-inside" id="creep-move">
<p class="f16"><a class="head" href="#creep-move">move</a><span style="color: white;">(</span><span class="tch">direction</span><span style="color: white;">)</span></p>
<p class="f12">将该Creep沿指定方向一直移动,直到撞到墙壁。需要该Creep具有<a class="cp move" href="#constants-all-MOVE">MOVE</a>属性</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<thead>
<tr style="border-bottom: 1px solid gray; font-weight: bold;">
<td style="width: 80px;">参数</td>
<td style="width: 50px;">类型</td>
<td style="width: 460px;">描述</td>
</tr>
</thead>
<tbody>
<tr>
<td style="color: #f05654;">direction</td>
<td><span style="color: gray">number</span></td>
<td>支持以下常量之一<br><a class="cl cp" href="#constants-all-TOP">TOP</a> <a class="cl cp" href="#constants-all-TOP_RIGHT">TOP_RIGHT</a> <a class="cl cp" href="#constants-all-RIGHT">RIGHT</a> <a class="cl cp" href="#constants-all-BOTTOM_RIGHT">BOTTOM_RIGHT</a> <a class="cl cp" href="#constants-all-BOTTOM">BOTTOM</a> <a class="cl cp" href="#constants-all-BOTTOM_LEFT">BOTTOM_LEFT</a> <a class="cl cp" href="#constants-all-LEFT">LEFT</a> <a class="cl cp" href="#constants-all-TOP_LEFT">TOP_LEFT</a></td>
</tr>
</tbody>
</table>
</div>
<p class="f12">返回以下代码之一:</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<tr>
<td style="width: 120px;"><a class="cl cp" href="#constants-all-OK">OK</a></td>
<td style="width: 20px;">0</td>
<td style="width: 460px;">操作已成功执行</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_OWNER">ERR_NOT_OWNER</a></td>
<td>-1</td>
<td>该Creep不属于你</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_INVALID_ARGS">ERR_INVALID_ARGS</a></td>
<td>-10</td>
<td>输入的方向常量不正确</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_TIRED">ERR_TIRED</a></td>
<td>-11</td>
<td>该Creep的疲劳值大于0,无法移动</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NO_BODYPART">ERR_NO_BODYPART</a></td>
<td>-12</td>
<td>你的Creep属性列表没有包含MOVE属性</td>
</tr>
</table>
</div>
</div>
<div class="content-inside" id="creep-moveTo">
<p class="f16"><a class="head" href="#creep-moveTo">moveTo</a><span style="color: white;">(</span><span class="tch">target</span><span style="color: white;">, </span><span class="tch">opts</span><span style="color: white;">)</span></p>
<p class="f12">找到到达目标区块的最佳路径,并尝试移动到该目标区块。需要该Creep具有<a class="cp move" href="#constants-all-MOVE">MOVE</a>属性</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<thead>
<tr style="border-bottom: 1px solid gray; font-weight: bold;">
<td style="width: 80px;">参数</td>
<td style="width: 50px;">类型</td>
<td style="width: 460px;">描述</td>
</tr>
</thead>
<tbody>
<tr>
<td style="color: #f05654;">target</td>
<td><span style="color: gray">object</span></td>
<td>可以是<a class="cost" href="#objects-GameObject">GameObject</a>或者任何包含了x和y属性的对象</td>
</tr>
<tr>
<td style="color: #f05654;">opts</td>
<td><span style="color: gray">object</span></td>
<td>一个附带着附加属性的对象,这些选项将按照参数传值给<a class="cl" href="#">game/utils</a> <a class="cost" href="#functions-findPath">findPath</a></td>
</tr>
</tbody>
</table>
</div>
<p class="f12">返回以下代码之一:</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<tr>
<td style="width: 120px;"><a class="cl cp" href="#constants-all-OK">OK</a></td>
<td style="width: 20px;">0</td>
<td style="width: 460px;">操作已成功执行</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_OWNER">ERR_NOT_OWNER</a></td>
<td>-1</td>
<td>该Creep不属于你</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_TIRED">ERR_TIRED</a></td>
<td>-11</td>
<td>该Creep的疲劳值大于0,无法移动</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NO_BODYPART">ERR_NO_BODYPART</a></td>
<td>-12</td>
<td>你的Creep属性列表没有包含MOVE属性</td>
</tr>
</table>
</div>
</div>
<div class="content-inside" id="creep-pickup">
<p class="f16"><a class="head" href="#creep-pickup">pickup</a><span style="color: white;">(</span><span class="tch">target</span><span style="color: white;">)</span></p>
<p class="f12">捡起该区块的一个物品(一个扔掉的资源),需要该Creep具有<a class="cp carry" href="#constants-all-CARRY">CARRY</a>属性。目标必须位于该Creep的相邻区块或位于同一区块内</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<thead>
<tr style="border-bottom: 1px solid gray; font-weight: bold;">
<td style="width: 80px;">参数</td>
<td style="width: 50px;">类型</td>
<td style="width: 460px;">描述</td>
</tr>
</thead>
<tbody>
<tr>
<td style="color: #f05654;">target</td>
<td><a class="cp carry" href="#objects-Resource">Resource</a></td>
<td>要拾取的目标对象</td>
</tr>
</tbody>
</table>
</div>
<p class="f12">返回以下代码之一:</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<tr>
<td style="width: 120px;"><a class="cl cp" href="#constants-all-OK">OK</a></td>
<td style="width: 20px;">0</td>
<td style="width: 460px;">操作已成功执行</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_OWNER">ERR_NOT_OWNER</a></td>
<td>-1</td>
<td>该Creep不属于你</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_TIRED">ERR_INVALID_TARGET</a></td>
<td>-7</td>
<td>目标不是一个有效的Creep对象</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NO_BODYPART">ERR_FULL</a></td>
<td>-8</td>
<td>该Creep已经不能接收更多的资源了(已经满了)</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NO_BODYPART">ERR_NOT_IN_RANGE</a></td>
<td>-9</td>
<td>目标太远啦</td>
</tr>
</table>
</div>
</div>
<div class="content-inside" id="creep-pull">
<p class="f16"><a class="head" href="#creep-pull">pull</a><span style="color: white;">(</span><span class="tch">target</span><span style="color: white;">)</span></p>
<p class="f12">帮助另一个Creep跟随这个Creep,target(目标)移动所产生的疲劳值将赋给这个Creep。需要该Creep具有<a class="cp move" href="#constants-all-MOVE">MOVE</a>属性。目标必须位于该Creep的相邻区块内,Creep必须移动到其他地方,目标需要向着该Creep移动。</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<thead>
<tr style="border-bottom: 1px solid gray; font-weight: bold;">
<td style="width: 80px;">参数</td>
<td style="width: 50px;">类型</td>
<td style="width: 460px;">描述</td>
</tr>
</thead>
<tbody>
<tr>
<td style="color: #f05654;">target</td>
<td><a class="cp carry" href="#objects-Creep">Creep</a></td>
<td>目标Creep</td>
</tr>
</tbody>
</table>
</div>
<p class="f12">返回以下代码之一:</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<tr>
<td style="width: 120px;"><a class="cl cp" href="#constants-all-OK">OK</a></td>
<td style="width: 20px;">0</td>
<td style="width: 460px;">操作已成功执行</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_OWNER">ERR_NOT_OWNER</a></td>
<td>-1</td>
<td>该Creep不属于你</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_TIRED">ERR_INVALID_TARGET</a></td>
<td>-7</td>
<td>目标不是一个有效的Creep对象</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NO_BODYPART">ERR_NOT_IN_RANGE</a></td>
<td>-9</td>
<td>目标太远啦</td>
</tr>
</table>
</div>
</div>
<div class="content-inside" id="creep-rangedAttack">
<p class="f16"><a class="head" href="#creep-rangedAttack">rangedAttack</a><span style="color: white;">(</span><span class="tch">target</span><span style="color: white;">)</span></p>
<p class="f12">使用远程攻击邻近的另一个Creep或结构。需要该Creep具有<a class="cp ranged" href="#constants-all-RANGED_ATTACK">RANGED_ATTACK</a>属性。如果要攻击的目标位于墙壁内,则会攻击该墙壁。要攻击的目标必须位于Creep的3格区块内</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<thead>
<tr style="border-bottom: 1px solid gray; font-weight: bold;">
<td style="width: 80px;">参数</td>
<td style="width: 50px;">类型</td>
<td style="width: 460px;">描述</td>
</tr>
</thead>
<tbody>
<tr>
<td style="color: #f05654;">target</td>
<td><a class="cp carry" href="#objects-Creep">Creep</a><br><a class="cp carry" href="#objects-Structure">Structure</a></td>
<td>要攻击的目标对象</td>
</tr>
</tbody>
</table>
</div>
<p class="f12">返回以下代码之一:</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<tr>
<td style="width: 120px;"><a class="cl cp" href="#constants-all-OK">OK</a></td>
<td style="width: 20px;">0</td>
<td style="width: 460px;">操作已成功执行</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_OWNER">ERR_NOT_OWNER</a></td>
<td>-1</td>
<td>该Creep不属于你</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_INVALID_TARGET">ERR_INVALID_TARGET</a></td>
<td>-7</td>
<td>目标不属于可被攻击的对象</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_IN_RANGE">ERR_NOT_IN_RANGE</a></td>
<td>-9</td>
<td>目标太远啦</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NO_BODYPART">ERR_NO_BODYPART</a></td>
<td>-12</td>
<td>这个Creep的属性列表里并没有<a class="cp ranged" href="#constants-all-RANGED_ATTACK">RANGED_ATTACK</a>属性</td>
</tr>
</table>
</div>
</div>
<div class="content-inside" id="creep-rangedHeal">
<p class="f16"><a class="head" href="#creep-rangedHeal">rangedHeal</a><span style="color: white;">(</span><span class="tch">target</span><span style="color: white;">)</span></p>
<p class="f12">治疗自己或远处的其他己方的Creep,它将恢复Creep们受到伤害的部分,并恢复血量。需要该Creep具有<a class="cp heal" href="#constants-all-HEAL">HEAL</a>属性,目标必须位于该Creep的3格区块内</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<thead>
<tr style="border-bottom: 1px solid gray; font-weight: bold;">
<td style="width: 80px;">参数</td>
<td style="width: 50px;">类型</td>
<td style="width: 460px;">描述</td>
</tr>
</thead>
<tbody>
<tr>
<td style="color: #f05654;">target</td>
<td><a class="cp carry" href="#objects-Creep">Creep</a></td>
<td>要治疗的目标Creep对象</td>
</tr>
</tbody>
</table>
</div>
<p class="f12">返回以下代码之一:</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<tr>
<td style="width: 120px;"><a class="cl cp" href="#constants-all-OK">OK</a></td>
<td style="width: 20px;">0</td>
<td style="width: 460px;">操作已成功执行</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_OWNER">ERR_NOT_OWNER</a></td>
<td>-1</td>
<td>该Creep不属于你</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_INVALID_TARGET">ERR_INVALID_TARGET</a></td>
<td>-7</td>
<td>目标不是有效的Creep对象</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_IN_RANGE">ERR_NOT_IN_RANGE</a></td>
<td>-9</td>
<td>目标太远啦</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NO_BODYPART">ERR_NO_BODYPART</a></td>
<td>-12</td>
<td>你的Creep属性列表没有包含<a class="cp heal" href="#constants-all-HEAL">HEAL</a>属性</td>
</tr>
</table>
</div>
</div>
<div class="content-inside" id="creep-rangedMassAttack">
<p class="f16"><a class="head" href="#creep-rangedHeal">rangedMassAttack</a><span style="color: white;">()</span></p>
<p class="f12">对3格区块以内的所有敌方Creep或建筑进行远程攻击。需要该Creep具有<a class="cp ranged" href="#constants-all-RANGED_ATTACK">RANGED_ATTACK</a>属性,攻击力取决于该Creep对每个目标的射程,己方单位不受此影响。</p>
<p class="f12">返回以下代码之一:</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<tr>
<td style="width: 120px;"><a class="cl cp" href="#constants-all-OK">OK</a></td>
<td style="width: 20px;">0</td>
<td style="width: 460px;">操作已成功执行</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_OWNER">ERR_NOT_OWNER</a></td>
<td>-1</td>
<td>该Creep不属于你</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NO_BODYPART">ERR_NO_BODYPART</a></td>
<td>-12</td>
<td>你的Creep属性列表没有包含<a class="cp ranged" href="#constants-all-RANGED_ATTACK">RANGED_ATTACK</a>属性</td>
</tr>
</table>
</div>
</div>
<div class="content-inside" id="creep-transfer">
<p class="f16"><a class="head" href="#creep-transfer">transfer</a><span style="color: white;">(</span><span class="tch">target</span><span style="color: white;">, </span><span class="tch">resourceType</span><span style="color: white;">, </span><span class="tch">[amount]</span><span style="color: white;">)</span></p>
<p class="f12">将资源从Creep身上转到另一个【对象】上。目标必须位于该Creep的相邻区块内</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<thead>
<tr style="border-bottom: 1px solid gray; font-weight: bold;">
<td style="width: 80px;">参数</td>
<td style="width: 50px;">类型</td>
<td style="width: 460px;">描述</td>
</tr>
</thead>
<tbody>
<tr>
<td style="color: #f05654;">target</td>
<td><a class="cp carry" href="#objects-Creep">Creep</a><br><a class="cp carry" href="#objects-Structure">Structure</a></td>
<td>要转移的目标对象</td>
</tr>
<tr>
<td style="color: #f05654;">resourceType</td>
<td><span style="color: gray">string</span></td>
<td>RESOURCE_*的常量之一</td>
</tr>
<tr>
<td style="color: #f05654;">amount (optional)</td>
<td><span style="color: gray">number</span></td>
<td>要转移的资源数量,如果省略该值,则默认转移所有可用的资源。</td>
</tr>
</tbody>
</table>
</div>
<p class="f12">返回以下代码之一:</p>
<div class="f12">
<table style="border-collapse: collapse;" cellpadding="8">
<tr>
<td style="width: 120px;"><a class="cl cp" href="#constants-all-OK">OK</a></td>
<td style="width: 20px;">0</td>
<td style="width: 460px;">操作已成功执行</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_OWNER">ERR_NOT_OWNER</a></td>
<td>-1</td>
<td>该Creep不属于你</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_INVALID_TARGET">ERR_NOT_ENOUGH_RESOURCES</a></td>
<td>-6</td>
<td>该Creep目前没有指定数量的资源可供转移</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_INVALID_TARGET">ERR_INVALID_TARGET</a></td>
<td>-7</td>
<td>要转移的目标对象不属于可以包含指定资源的有效对象</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_INVALID_TARGET">ERR_FULL</a></td>
<td>-8</td>
<td>目标已经不能接收更多的资源了(已经满了)</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_NOT_IN_RANGE">ERR_NOT_IN_RANGE</a></td>
<td>-9</td>
<td>目标太远啦</td>
</tr>
<tr>
<td><a class="cl cp" href="#constants-all-ERR_INVALID_TARGET">ERR_INVALID_ARGS</a></td>
<td>-10</td>