-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvirgil.js
More file actions
52 lines (42 loc) · 1.09 KB
/
virgil.js
File metadata and controls
52 lines (42 loc) · 1.09 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
52
import {getPlayerX, getPlayerLevel} from './player.js';
import {getMapLengthX} from './Map/main.js';
import {getPathYs} from './Map/icon.js';
import {getRandN, getRandArrVal} from './Packages/utilities.js'
import {deleteOtherAtXY} from './others.js'
var VIRGIL={
type:"virgil",
icon: 'V',
style:{
color: 'aqua'
}
};
export function resetVirgil(){
VIRGIL.x = 0;
VIRGIL.y = 0;
}
export function moveVirgil(){
const virgilRange = 10;
if(getPlayerLevel() < 21) return;
deleteOtherAtXY(...getVirgilXY());
const mapLastIndexX = getMapLengthX() -1;
if(getPlayerX() < getVirgilX() - 1) return;
if(getVirgilX() >= mapLastIndexX - virgilRange) return setVirgilXY(mapLastIndexX,getPathYs(mapLastIndexX)[0]);
const x = getPlayerX() + getRandN(virgilRange) + 1;
const y = getRandArrVal(getPathYs(x));
deleteOtherAtXY(x,y);
return setVirgilXY(x,y);
}
function getVirgil(){
return R.clone(VIRGIL);
}
function getVirgilXY(){
return [VIRGIL.x, VIRGIL.y]
}
function getVirgilX(){
return VIRGIL.x;
}
function setVirgilXY(x,y){
VIRGIL.x = x;
VIRGIL.y = y;
return getVirgil();
}