-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtester.js
170 lines (141 loc) · 7.22 KB
/
tester.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
const _ = require('lodash');
const GameManager = require('./src/model/gameManager');
const Mob = require('./src/model/mob');
const Location = require('./src/model/location');
const Action = require('./src/model/action');
const ResourceModifier = require('./src/model/resourceModifier');
const InfluenceModifier = require('./src/model/influenceModifier');
const LocationUnownedBySource = require ('./src/model/actionRequirements/locationUnownedBySource');
const LocationOwnedBySource = require ('./src/model/actionRequirements/locationOwnedBySource');
const SourceHasMinResource = require ('./src/model/actionRequirements/sourceHasMinResource');
console.log('\n\n\n=======Welcome to Penny Mob=====');
// const mobbo = new Mob('Mobbo');
// const theLads = new Mob('The Lads');
// console.log('Creating new mob: ' + mobbo.name);
// console.log('Creating new mob: ' + theLads.name);
// const digs = new Location('digs', 'Digs', 'Where you live.', 10);
// console.log('Creating new Location: ' + digs.name);
// const freeInfluence = new Action('Spread Influence');
// freeInfluence.sourceMods.push(new InfluenceModifier(5));
// console.log('Creating new Action: ' + freeInfluence.name);
// digs.addAction(freeInfluence);
const testloader = require('./data/testLoader');
const gm = testloader.getGameManager();
gm.startGame();
console.log(gm.getState());
console.log(gm.getLocationDetail('barrowland'));
// manage();
function manage () {
gm = new GameManager ([
new Mob('Mobbo'),
new Mob('The Lads'),
new Mob('Gregor\'s Gits')
], {
digs: digs,
docks: new Location('docks', 'Docks', 'Boats \'n hoes', 5),
cemetary: new Location('cemetary', 'Cemetary', 'Deaders and whatnot.', 5),
warehouse: new Location('warehouse', 'Warehouse', 'Ware! Where?', 5),
orphanage: new Location('orphanage', 'Orphanage', 'Bastard laden.', 5),
pub: new Location('pub', 'Pub', 'Time for a pint.', 5)
});
gm.startGame();
for (let i = 0; i < 3; i++) {
gm.executeAction('digs', freeInfluence);
}
const gameState = gm.getState();
console.log(gameState);
console.log(gm.getLocationDetail('digs'));
}
// doSomeThings();
function doSomeThings() {
console.log('\n\n\n=======Distributing Loot=======');
mobbo.loot = 30;
theLads.loot = 30;
console.log('-Mobbos Loot: ' + mobbo.loot);
console.log('-The Lads Loot: ' + mobbo.loot);
console.log('\n\n\n=======Spreading Influence=======');
digs.spreadInfluence(mobbo, 5);
digs.spreadInfluence(mobbo, 5);
digs.spreadInfluence(theLads, 5);
digs.spreadInfluence(mobbo, 5);
digs.spreadInfluence(theLads, 5);
digs.spreadInfluence(theLads, 5);
digs.spreadInfluence(theLads, 5);
digs.spreadInfluence(theLads, 5);
console.log('Mobbo owns ' + mobbo.locations.length + ' locations');
_.forEach(mobbo.locations, loc => {console.log('--' + loc.name);});
console.log('The Lads own ' + theLads.locations.length + ' locations');
_.forEach(theLads.locations, loc => {console.log('--' + loc.name);});
console.log('Mobbos Influence: ' + digs.getInfluence(mobbo).amount);
console.log('The Lads Influence: ' + digs.getInfluence(theLads).amount);
console.log('\n\n\n=======Actions=======');
// Create Heist
const heist = new Action('~Heist~', 'Steal a bit of loot, sell it at a ridiculous markup.');
heist.sourceMods.push(new ResourceModifier({lootMod: 10}));
heist.targetMods.push(new ResourceModifier({lootMod: -5}));
heist.requirements.push(new LocationUnownedBySource());
heist.requirements.push(new SourceHasMinResource('loot', 10));
digs.addAction(heist);
// Create Production
const produce = new Action('~Brew Bathtub Gin~', 'Maybe give it a good scrub first, eh?');
produce.sourceMods.push(new ResourceModifier({lootMod: 5}));
produce.sourceMods.push(new InfluenceModifier(2));
produce.requirements.push(new LocationOwnedBySource());
produce.requirements.push(new SourceHasMinResource('loot', 25));
digs.addAction(produce);
// Spread Influence
const infl = new Action('~Buy the lads a round~', 'Share a pint and a few stories and people will pay attention.');
infl.sourceMods.push(new ResourceModifier({lootMod: -1}));
infl.sourceMods.push(new InfluenceModifier(5));
infl.targetMods.push(new InfluenceModifier(-1));
infl.requirements.push(new LocationUnownedBySource());
digs.addAction(infl);
// Super spread Influence
const infl2 = new Action('~Put on a puppet show~', 'Not sure why everyone seems to enjoy these so much.');
infl2.sourceMods.push(new ResourceModifier({lootMod: -15}));
infl2.sourceMods.push(new InfluenceModifier(30));
produce.requirements.push(new SourceHasMinResource('loot', 15));
digs.addAction(infl2);
let mobboActions = digs.getMobActions(mobbo);
let theLadsActions = digs.getMobActions(theLads);
console.log('Mobbo actions: ' + mobboActions.length);
_.forEach(mobboActions, action => {console.log('--' + action.name);});
console.log('The Lads actions: ' + theLadsActions.length);
_.forEach(theLadsActions, action => {console.log('--' + action.name);});
console.log('\n===Round1 - Getting in the Door===');
infl.execute(digs, mobbo, theLads);
console.log('-Mobbos Loot: ' + mobbo.loot);
console.log('-The Lads Loot: ' + theLads.loot);
console.log('Mobbos Influence: ' + digs.getInfluence(mobbo).amount);
console.log('The Lads Influence: ' + digs.getInfluence(theLads).amount);
console.log('\n===Round2 - The Celebration===');
produce.execute(digs, theLads, mobbo);
console.log('-Mobbos Loot: ' + mobbo.loot);
console.log('-The Lads Loot: ' + theLads.loot);
console.log('Mobbos Influence: ' + digs.getInfluence(mobbo).amount);
console.log('The Lads Influence: ' + digs.getInfluence(theLads).amount);
console.log('\n===Round3 - The Heist===');
heist.execute(digs, mobbo, theLads);
console.log('-Mobbos Loot: ' + mobbo.loot);
console.log('-The Lads Loot: ' + theLads.loot);
console.log('Mobbos Influence: ' + digs.getInfluence(mobbo).amount);
console.log('The Lads Influence: ' + digs.getInfluence(theLads).amount);
console.log('\n===Round4 - The Lads Accidentally Click End Turn A Bit Prematurely===');
console.log('\n===Round5 - The Puppet Show===');
infl2.execute(digs, mobbo, theLads);
console.log('-Mobbos Loot: ' + mobbo.loot);
console.log('-The Lads Loot: ' + theLads.loot);
console.log('Mobbo owns ' + mobbo.locations.length + ' locations');
_.forEach(mobbo.locations, loc => {console.log('--' + loc.name);});
console.log('The Lads own ' + theLads.locations.length + ' locations');
_.forEach(theLads.locations, loc => {console.log('--' + loc.name);});
console.log('Mobbos Influence: ' + digs.getInfluence(mobbo).amount);
console.log('The Lads Influence: ' + digs.getInfluence(theLads).amount);
mobboActions = digs.getMobActions(mobbo);
theLadsActions = digs.getMobActions(theLads);
console.log('\nNew Actions:')
console.log('Mobbo actions: ' + mobboActions.length);
_.forEach(mobboActions, action => {console.log('--' + action.name);});
console.log('The Lads actions: ' + theLadsActions.length);
_.forEach(theLadsActions, action => {console.log('--' + action.name);});
}