-
Notifications
You must be signed in to change notification settings - Fork 0
/
annalyns-infiltration.js
70 lines (67 loc) · 1.91 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
69
70
export function canExecuteFastAttack(knightIsAwake) {
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) {
if (!knightIsAwake && archerIsAwake && !prisonerIsAwake) {
return true;
} else if (knightIsAwake && archerIsAwake && prisonerIsAwake) {
return true;
} else if (!knightIsAwake && !archerIsAwake && prisonerIsAwake) {
return true;
} else if (knightIsAwake && archerIsAwake && !prisonerIsAwake) {
return true;
} else if (!knightIsAwake && archerIsAwake && prisonerIsAwake) {
return true;
} else if (knightIsAwake && !archerIsAwake && prisonerIsAwake) {
return true;
} else if (knightIsAwake && !archerIsAwake && !prisonerIsAwake) {
return true;
} else {
return false;
}
}
/**
* 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 ? true : false;
}
/**
* 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
) {
if (
(!knightIsAwake && !archerIsAwake && prisonerIsAwake) ||
(petDogIsPresent && !archerIsAwake)
) {
return true;
} else {
return false;
}
}