-
Notifications
You must be signed in to change notification settings - Fork 0
/
strategies.js
115 lines (106 loc) · 2.86 KB
/
strategies.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
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
'use strict';
class CloneSpawner {
static run(f, clone, bullet) {
f.showWeaponName();
Game.transition = Option.transitionReset;
var c = new Clone({'r' : 0, 'battlefield' : f, 'arsenalIndex' : f.p1.arsenalIndex});
c.game = f;
c.x = 0.5 * c.fw;
c.y = 1/8 * c.fh;
var record = f.getPilotPattern(1)
c.recordPlayer = new RecordPlayer({'record' : record});
f.resetPilotPattern();
f.add('ships', c);
f.assignKillsLeft();
f.resetAllBullets();
f.deadline.reset();
if (f.nokills) {
f.scoreDisplay.points = 1;
f.nokills = false;
}
}
}
class CoopCloneSpawner {
static run(f, clone, bullet) {
f.showWeaponName();
Game.transition = Option.transitionReset;
var amount = 1;
if (f.p2.active == false) {
amount = 2;
}
for (var i = 0; i <amount; i++) {
var c = new Clone({'r' : 0, 'battlefield' : f, 'bullet_team' : 'bullets2', 'arsenalIndex' : f.p1.arsenalIndex});
c.team = 'clone';
c.game = f;
if (i == 1) {
c.flip = -1;
}
c.x = 0.5 * c.fw;
c.y = 1/8 * c.fh;
c.recordPlayer = new RecordPlayer({'record' : f.getPilotPattern(1)});
f.add('ships', c);
}
amount = 1;
if (f.p1.active == false) {
amount = 2;
}
for (var i = 0; i <amount; i++) {
var c2 = new Clone({'r' : 0, 'battlefield' : f, 'bullet_team' : 'bullets2', 'arsenalIndex' : f.p1.arsenalIndex});
c2.team = 'clone';
if (i == 1) {
c2.flip = -1;
}
c2.game = f;
c2.x = 0.5 * c2.fw;
c2.y = 1/8 * c2.fh;
c2.p2 = true;
c2.recordPlayer = new RecordPlayer({'record' : f.getPilotPattern(2)});
}
f.resetPilotPattern();
f.add('ships', c2);
// f.assignKillsLeft();
f.resetAllBullets();
f.deadline.reset();
if (f.nokills) {
f.scoreDisplay.points = 1;
f.nokills = false;
}
f.killCounter.recordKill();
}
}
class TournamentCloneSpawner {
static run(f, pilot, bullet) {
var c;
var h;
f.resetPilotPositions();
if (pilot == f.p1) {
var c = new TournamentClone({'r' : pilot.r, 'battlefield' : f, 'arsenalIndex' : 0, 'team' : 'p1', 'targets' : ['p2']});
c.teamColor = f.p1.teamColor;
c.shipDrawColor = f.p2.teamColor;
var record = f.p2.recorder.saveRecording();
f.p1.recorder.saveRecording();
c.recordPlayer = new RecordPlayer({'record' : record});
c.y = f.p1.y;
c.sy = c.y;
c.r = pilot.r;
} else if (pilot == f.p2) {
var c = new TournamentClone({'r' : pilot.r, 'battlefield' : f, 'arsenalIndex' : 0, 'team' : 'p2', 'targets' : ['p1']});
var record = f.p1.recorder.saveRecording();
f.p2.recorder.saveRecording();
c.recordPlayer = new RecordPlayer({'record' : record});
c.teamColor = f.p2.teamColor;
c.shipDrawColor = f.p1.teamColor;
c.y = f.p2.y;
c.sy = c.y;
c.r = pilot.r;
// h = QuantumPilot.y;
}
c.game = f;
c.x = 0.5 * c.fw;
// c.y = h;
f.resetPilotPattern();
f.add('ships', c);
f.resetAllClones();
f.resetAllBullets();
}
}