-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathannalyns-infiltration.js
68 lines (63 loc) · 1.75 KB
/
annalyns-infiltration.js
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
// @ts-check
/**
* The fast attack is available when the knight is sleeping
*
* @param {boolean} knightIsAwake
*
* @return {boolean} Whether or not you can execute a fast attack.
*/
export function canExecuteFastAttack(knightIsAwake) {
/**
* Operador Condicional Ternário
*
* O operador condicional (ternário) é o único operador JavaScript que possui três operandos. Este operador é frequentemente
* usado como um atalho para a instrução if.
*
* condition ? expr1 : expr2
*/
return !knightIsAwake;
}
/**
* A useful spy captures information, which they can't do if everyone's asleep.
*
* @param {boolean} knightIsAwake
* @param {boolean} archerIsAwake
* @param {boolean} prisonerIsAwake
*
* @returns {boolean} Whether or not you can spy on someone.
*/
export function canSpy(knightIsAwake, archerIsAwake, prisonerIsAwake) {
return knightIsAwake || archerIsAwake || prisonerIsAwake;
}
/**
* You'll get caught by the archer if you signal while they're awake.
*
* @param {boolean} archerIsAwake
* @param {boolean} prisonerIsAwake
*
* @returns {boolean} Whether or not you can send a signal to the prisoner.
*/
export function canSignalPrisoner(archerIsAwake, prisonerIsAwake) {
return !archerIsAwake && prisonerIsAwake;
}
/**
* The final stage in the plan: freeing Annalyn's best friend.
*
* @param {boolean} knightIsAwake
* @param {boolean} archerIsAwake
* @param {boolean} prisonerIsAwake
* @param {boolean} petDogIsPresent
*
* @returns {boolean} Whether or not you can free Annalyn's friend.
*/
export function canFreePrisoner(
knightIsAwake,
archerIsAwake,
prisonerIsAwake,
petDogIsPresent
) {
return (
(!archerIsAwake && petDogIsPresent) ||
(prisonerIsAwake && !knightIsAwake && !archerIsAwake)
);
}