This repository was archived by the owner on Jul 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsummon.lks
More file actions
51 lines (47 loc) · 1.68 KB
/
summon.lks
File metadata and controls
51 lines (47 loc) · 1.68 KB
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
include("bulb");
global summonsRegisterName = "canSummon";
function getSummonChips(leek){
debugC("getSummonChips", COLOR_BLUE);
var summonChips = [];
for (var key : var chip in getChips(leek)) {
var e = getChipEffects(chip);
if (e[0][0] === EFFECT_SUMMON) {
push(summonChips, chip);
}
}
return arraySort(
summonChips,
function (a, b) {
return getChipCooldown(a) - getChipCooldown(b);
}
);
}
function getCellToSummon(leek, chip, enemy){
debugC("getCellToSummon", COLOR_BLUE);
var cellToSummon = null;
for (var cell in getCellsToUseChip(chip, leek)){
if((cellToSummon === null || (null !== cellToSummon && getPathLength(getCell(), cell) > 1 && getPathLength(getCell(), cell) <= 4 && getPathLength(cellToSummon, getCell(enemy)) > getPathLength(cell, getCell(enemy)))))
cellToSummon = cell;
}
return cellToSummon;
}
function summonBulb(leek, enemy){
debugC("summonBulb", COLOR_BLUE);
var cellToSummon = null;
var summonChips = getSummonChips(leek);
for (var key : var chip in summonChips) {
if(null !== chip){
cellToSummon = getCellToSummon(leek, chip, enemy);
if(null !== cellToSummon
&& canUseChipOnCell(chip, cellToSummon)
&& getRegister(summonsRegisterName)){
var summonResult = summon(chip, cellToSummon, bulbKamikazeAI);
if(summonResult === USE_SUCCESS){
setRegister(summonsRegisterName, true);
}else if (summonResult === USE_TOO_MANY_SUMMONS){
setRegister(summonsRegisterName, false);
}
}
}
}
}