Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
TheGameCenter
GitHub Repository: TheGameCenter/TheGameCenter.github.io
Path: blob/main/assets/javascript/cookieclicker/dungeons.js
15352 views
1
var LaunchDungeons=function()
2
{
3
Game.GetWord=function(type)
4
{
5
if (type=='secret') return choose(['hidden','secret','mysterious','forgotten','forbidden','lost','sunk','buried','concealed','shrouded','invisible','elder']);
6
if (type=='ruined') return choose(['ancient','old','ruined','ravaged','destroyed','collapsed','demolished','burnt','torn-down','shattered','dilapidated','abandoned','crumbling','derelict','decaying']);
7
if (type=='magical') return choose(['arcane','magical','mystical','sacred','honed','banished','unholy','holy','demonic','enchanted','necromantic','bewitched','haunted','occult','astral']);
8
return '';
9
}
10
11
/*=====================================================================================
12
DUNGEONS
13
=======================================================================================*/
14
Game.DungeonTypes=[];
15
Game.DungeonType=function(name)
16
{
17
this.name=name;
18
this.nameGenerator=function(){return 'Mysterious dungeon';};
19
this.roomTypes=[];
20
Game.DungeonTypes[this.name]=this;
21
return this;
22
};
23
24
/*=====================================================================================
25
CREATE DUNGEON TYPES
26
=======================================================================================*/
27
new Game.DungeonType('Factory').
28
nameGenerator=function(){
29
var str='';
30
str+=Game.GetWord(choose(['secret','ruined','magical']))+' '+choose(['factory','factories','bakery','bakeries','confectionery','laboratory','research center','chocolate forge','chocolate foundry','manufactory','warehouse','machinery','works','bakeworks','workshop','assembly line']);
31
return str;
32
};
33
34
new Game.DungeonType('Mine').
35
nameGenerator=function(){
36
var str='';
37
str+=Game.GetWord(choose(['secret','ruined','magical']))+' '+choose(['chocolate','chocolate','chocolate','white chocolate','sugar','cacao'])+' '+choose(['mine','mines','pit','pits','quarry','excavation','tunnel','shaft','lode','trench','mountain','vein','cliff','peak','dome','crater','abyss','chasm','hole','burrow']);
38
return str;
39
};
40
41
new Game.DungeonType('Portal').
42
nameGenerator=function(){
43
var str='';
44
str+=Game.GetWord(choose(['secret','ruined','magical']))+' '+choose(['portal','gate','dimension','warpgate','door']);
45
return str;
46
};
47
48
new Game.DungeonType('Secret zebra level').
49
nameGenerator=function(){
50
var str='';
51
str+=Game.GetWord(choose(['secret']))+' '+choose(['zebra level']);
52
return str;
53
};
54
55
56
/*=====================================================================================
57
CREATE TILE TYPES
58
=======================================================================================*/
59
60
var D=new DungeonGen();
61
D.loadTiles([
62
['wall',[1,0],'join'],
63
['wall corner',[1,0]],
64
['floor',[1,1],'random3'],
65
['tiled floor',[1,2],'join'],
66
['round pillar',[1,4]],
67
['square pillar',[2,4]],
68
['potted plant',[3,4]],
69
['bookshelf',[4,5],'join'],
70
['door',[1,3],'join'],
71
['alt wall',[4,0],'join'],
72
['alt wall corner',[4,0]],
73
['alt floor',[4,1],'random3'],
74
['alt tiled floor',[4,2],'join'],
75
['alt round pillar',[4,4]],
76
['alt square pillar',[5,4]],
77
['alt potted plant',[6,4]],
78
['alt bookshelf',[4,6],'join'],
79
['alt door',[4,3],'join'],
80
['water',[1,5]],
81
['green water',[2,5]],
82
['dark water',[3,5]],
83
['wooden wall',[1,7],'join'],
84
['wooden floor',[1,6],'random3'],
85
['conveyor belt',[4,7],'join'],
86
['entrance',[0,1]],
87
['alt entrance',[0,3]],
88
['exit',[0,2]],
89
['alt exit',[0,4]]
90
]);
91
92
93
/*=====================================================================================
94
CREATE MONSTER TYPES
95
=======================================================================================*/
96
97
/*
98
An explanation of stats :
99
-hp : health points
100
-speed : determines who attacks first in a fight; bypasses dodging; determines how fast heroes auto-run dungeons
101
-might : determines how much damage is done to opponents
102
-guard : lowers incoming damage
103
-dodge : chance of avoiding incoming attacks completely (affected by the opponent's speed)
104
-luck : heroes only, determines drops and rare encounters
105
-rarity : monsters only, determines how often a monster is added to the spawn table
106
-level : monsters only, determines which average room depth the monster is more likely to spawn in (also determines the loot amount)
107
*/
108
Game.monsterIconY=10;//offset for dungeonItems.png monsters
109
Game.Monsters=[];
110
Game.Monster=function(name,pic,icon,level,stats,loot)
111
{
112
this.name=name;
113
this.pic=pic;
114
this.icon=icon;
115
this.level=level;
116
this.stats={};
117
for (var i in stats)
118
{this.stats[i]=stats[i];}
119
this.stats.hpm=this.stats.hp;
120
this.stats.rarity=stats.rarity||1;
121
this.loot=loot||{};
122
this.boss=0;
123
this.quotes={};
124
Game.Monsters[this.name]=this;
125
}
126
var basicLoot={cookies:{min:1,max:5,prob:0.5}};
127
var goodLoot={cookies:{min:3,max:8,prob:1},gear:{prob:0.05}};
128
var bossLoot={gear:{prob:1}};
129
var chestLoot={cookies:{min:2,max:20,prob:1},gear:{prob:0.1}};
130
var bossLoot={cookies:{min:10,max:50,prob:1},gear:{prob:0.2}};
131
132
//general monsters
133
new Game.Monster('Doughling','doughling',[0,0],1,{hp:5,might:2,guard:2,speed:6,dodge:6,rarity:0.7},basicLoot);
134
new Game.Monster('Elder doughling','elderDoughling',[1,0],7,{hp:20,might:7,guard:7,speed:4,dodge:4,rarity:0.7},goodLoot);
135
new Game.Monster('Angry sentient cookie','angrySentientCookie',[5,0],5,{hp:16,might:8,guard:4,speed:5,dodge:5,rarity:1},basicLoot);
136
new Game.Monster('Baby sentient cookie','babySentientCookie',[4,0],1,{hp:3,might:1,guard:1,speed:7,dodge:7,rarity:1},basicLoot);
137
new Game.Monster('Burnt sentient cookie','burntSentientCookie',[6,0],5,{hp:16,might:12,guard:2,speed:3,dodge:2,rarity:0.2},basicLoot);
138
new Game.Monster('Raw sentient cookie','rawSentientCookie',[5,0],5,{hp:16,might:6,guard:4,speed:7,dodge:7,rarity:0.2},basicLoot);
139
new Game.Monster('Sugar bunny','sugarBunny',[8,0],5,{hp:10,might:3,guard:8,speed:12,dodge:9,rarity:0.001},{cookies:{min:1000,max:10000}});
140
Game.Monsters['Sugar bunny'].onKill=function(){Game.Win('Follow the white rabbit');};Game.Monsters['Sugar bunny'].AI='flee';
141
142
//factory monsters
143
new Game.Monster('Crazed kneader','crazedKneader',[0,2],6,{hp:18,might:6,guard:8,speed:3,dodge:2,rarity:0.5},goodLoot);
144
new Game.Monster('Crazed chip-spurter','crazedDoughSpurter',[0,2],6,{hp:15,might:6,guard:8,speed:5,dodge:3,rarity:0.5},goodLoot);
145
new Game.Monster('Alarm bot','alarmTurret',[3,2],2,{hp:6,might:3,guard:5,speed:8,dodge:8,rarity:0.5},basicLoot);
146
new Game.Monster('Chirpy','chirpy',[4,2],3,{hp:7,might:4,guard:6,speed:9,dodge:9,rarity:0.01},{cookies:{min:500,max:5000}});
147
Game.Monsters['Chirpy'].onKill=function(){Game.Win('Chirped out');};Game.Monsters['Chirpy'].quotes={fight:'oh, hello <3'};
148
new Game.Monster('Disgruntled worker','disgruntledWorker',[1,2],4,{hp:14,might:5,guard:5,speed:6,dodge:4,rarity:0.6},basicLoot);
149
new Game.Monster('Disgruntled overseer','disgruntledOverseer',[1,2],7,{hp:22,might:7,guard:5,speed:6,dodge:4,rarity:0.5},basicLoot);
150
new Game.Monster('Disgruntled cleaning lady','disgruntledCleaningLady',[2,2],4,{hp:13,might:4,guard:5,speed:7,dodge:6,rarity:0.3},basicLoot);
151
152
new Game.Monster('Sentient Furnace','sentientFurnace',[0,3],0,{hp:60,might:14,guard:12,speed:4,dodge:0,rarity:1},bossLoot);//boss
153
Game.Monsters['Sentient Furnace'].onKill=function(){Game.Win('Getting even with the oven');};Game.Monsters['Sentient Furnace'].AI='static';Game.Monsters['Sentient Furnace'].boss=1;Game.Monsters['Sentient Furnace'].quotes={fight:'YOU ARE NOT READY!',defeat:'OH... BURN.'};
154
new Game.Monster('Ascended Baking Pod','ascendedBakingPod',[1,3],0,{hp:60,might:12,guard:14,speed:4,dodge:0,rarity:0.7},bossLoot);//boss
155
Game.Monsters['Ascended Baking Pod'].onKill=function(){Game.Win('Now this is pod-smashing');};Game.Monsters['Ascended Baking Pod'].AI='static';Game.Monsters['Ascended Baking Pod'].boss=1;Game.Monsters['Ascended Baking Pod'].quotes={fight:'rrrrrrrise.',defeat:'blrglblg.'};
156
157
158
Game.BossMonsters=[];
159
for (var i in Game.Monsters)
160
{
161
if (Game.Monsters[i].boss) Game.BossMonsters.push(Game.Monsters[i]);
162
}
163
164
/*=====================================================================================
165
ENTITY MECHANICS
166
=======================================================================================*/
167
168
Game.Entity=function(type,subtype,dungeon,pic,stats)//objects you could find on the map : doors, mobs, interactables, items, player, exits...
169
{
170
this.type=type;
171
this.subtype=subtype||'';
172
this.dungeon=dungeon;
173
this.pic=pic||[0,0];
174
this.stats={};
175
for (var i in stats)
176
{this.stats[i]=stats[i];}
177
178
this.x=-1;
179
this.y=-1;
180
this.obstacle=0;
181
this.zIndex=1;
182
if (this.type=='monster')
183
{
184
this.obstacle=1;
185
this.pic=[Game.Monsters[this.subtype].icon[0],Game.Monsters[this.subtype].icon[1]];
186
this.pic[1]+=Game.monsterIconY;
187
this.targets=[];
188
this.stuck=0;
189
this.zIndex=10;
190
this.fighting=0;
191
this.AI=Game.Monsters[this.subtype].AI||'normal';
192
this.onKill=Game.Monsters[this.subtype].onKill||function(){};
193
for (var i in Game.Monsters[this.subtype].stats){this.stats[i]=Game.Monsters[this.subtype].stats[i];}
194
}
195
else if (this.type=='hero')
196
{
197
this.obstacle=1;
198
this.pic=[Game.Heroes[this.subtype].icon[0],Game.Heroes[this.subtype].icon[1]];
199
this.targets=[];
200
this.stuck=0;
201
this.zIndex=100;
202
this.fighting=0;
203
for (var i in Game.Heroes[this.subtype].stats){this.stats[i]=Game.Heroes[this.subtype].stats[i];}
204
205
//increase stats by amount of matching building (change that later to use gear instead)
206
var mult=Math.max(0,(Game.Objects[this.dungeon.type].amount/20-1));
207
this.stats.hpm+=Math.ceil(mult*2);
208
this.stats.hp=this.stats.hpm;
209
this.stats.might+=mult;
210
this.stats.guard+=mult;
211
this.stats.speed+=mult;
212
this.stats.dodge+=mult;
213
}
214
else if (this.type=='item')
215
{
216
this.zIndex=5;
217
this.value=0;
218
}
219
else if (this.type=='destructible')//crates, doors
220
{
221
this.obstacle=1;
222
this.life=3;
223
this.zIndex=15;
224
if (this.subtype=='door') this.pic=[0,7];
225
else this.pic=[Math.floor(Math.random()*4+2),7];
226
227
this.onKill=function()
228
{
229
if (this.subtype=='random')
230
{
231
var value=Math.round(Math.pow(Math.random(),6)*(10+this.dungeon.level));
232
if (value>0)
233
{
234
var entity=this.dungeon.AddEntity('item','cookies',this.x,this.y);
235
entity.value=value;
236
}
237
}
238
}
239
}
240
else if (this.type=='special')
241
{
242
this.zIndex=5;
243
this.value='';
244
this.obstacle=1;
245
}
246
247
this.Say=function(what)
248
{
249
if (this.type=='monster')
250
{
251
if (Game.Monsters[this.subtype].quotes[what]) this.dungeon.Log(this.subtype+' : "<span style="color:#f96;">'+choose(Game.Monsters[this.subtype].quotes[what].split('|'))+'</span>"');
252
}
253
}
254
this.Draw=function()//return the string to draw this
255
{
256
var name='?';
257
if (this.subtype=='random') name='clutter'; else name=this.subtype;
258
if (this.type=='item' && this.subtype=='cookies' && this.value>0)
259
{
260
if (this.value<2) this.pic=[0,5];
261
else if (this.value<3) this.pic=[1,5];
262
else if (this.value<4) this.pic=[2,5];
263
else if (this.value<6) this.pic=[3,5];
264
else if (this.value<10) this.pic=[4,5];
265
else if (this.value<20) this.pic=[5,5];
266
else if (this.value<30) this.pic=[7,5];
267
else if (this.value<70) this.pic=[6,5];
268
else if (this.value<200) this.pic=[8,5];
269
else this.pic=[6,6];// if (this.value<1000) this.pic=[1,5];
270
}
271
else if (this.type=='special' && this.subtype=='upgrade')
272
{
273
if (this.value!='') this.pic=[7,6]; else this.pic=[8,6];
274
}
275
return '<div class="thing" title="'+name+'" style="z-index:'+(200+this.zIndex)+';left:'+(this.x*16)+'px;top:'+(this.y*16)+'px;background-position:'+(-this.pic[0]*16)+'px '+(-this.pic[1]*16)+'px;"></div>';
276
}
277
this.Wander=function()//AI to move around aimlessly
278
{
279
this.targets=[];
280
this.targets.push([-1,0],[1,0],[0,-1],[0,1]);
281
this.Move();
282
}
283
this.GoTo=function(x,y)//AI to move to a specific point
284
{
285
this.targets=[];
286
if (this.x<x) this.targets.push([1,0]);
287
if (this.x>x) this.targets.push([-1,0]);
288
if (this.y<y) this.targets.push([0,1]);
289
if (this.y>y) this.targets.push([0,-1]);
290
if (!this.Move())//really stuck? try to maneuver laterally!
291
{
292
this.targets=[];
293
if (this.x==x) this.targets.push([1,0],[-1,0]);//somehow this feels inverted... but it doesn't work the other way
294
if (this.y==y) this.targets.push([0,1],[0,-1]);//hypothesis : *MAGIC*
295
this.Move();
296
}
297
}
298
this.Flee=function(x,y)//AI to run away from a specific point
299
{
300
this.targets=[];
301
if (this.x>x) this.targets.push([1,0]);
302
if (this.x<x) this.targets.push([-1,0]);
303
if (this.y>y) this.targets.push([0,1]);
304
if (this.y<y) this.targets.push([0,-1]);
305
if (!this.Move())//really stuck? try to maneuver laterally!
306
{
307
this.targets=[];
308
if (this.x==x) this.targets.push([1,0],[-1,0]);//somehow this feels inverted... but it doesn't work the other way
309
if (this.y==y) this.targets.push([0,1],[0,-1]);//hypothesis : *MAGIC*
310
this.Move();
311
}
312
}
313
this.Move=function()//AI to move to the target
314
{
315
if (this.targets.length>0)
316
{
317
var goodTargets=[];
318
if (this.type=='hero') goodTargets=this.targets;
319
else
320
{
321
for (var i in this.targets)
322
{
323
var thisTarget=this.targets[i];
324
if (this.dungeon.CheckObstacle(this.x+thisTarget[0],this.y+thisTarget[1])!=-1) goodTargets.push([thisTarget[0],thisTarget[1]]);
325
}
326
}
327
if (goodTargets.length>0)
328
{
329
var target=choose(goodTargets);
330
var obstacle=this.dungeon.CheckObstacle(this.x+target[0],this.y+target[1]);
331
if (obstacle==this) obstacle=0;
332
if (obstacle==0 && this.AI!='static')
333
{
334
this.x+=target[0];
335
this.y+=target[1];
336
}
337
else this.stuck+=2;
338
if (obstacle!=0 && obstacle!=-1)
339
{
340
obstacle.HitBy(this);
341
}
342
if (obstacle==-1) return 0;
343
}
344
else {this.stuck+=2;return 0;}
345
if (this.AI=='static') this.stuck=0;
346
return 1;
347
}
348
return 0;
349
}
350
this.HitBy=function(by)//attacked by another entity
351
{
352
if (this.type=='destructible' && by.type=='hero')//break destructibles
353
{
354
by.stuck=0;
355
this.life--;
356
if (this.life<=0)
357
{
358
if (this.onKill) this.onKill();
359
this.Destroy();
360
}
361
else this.pic=[this.pic[0],this.pic[1]+1];
362
}
363
else if (this.type=='special' && this.subtype=='upgrade')//upgrade relic
364
{
365
this.obstacle=0;
366
if (Game.Upgrades[this.value]) Game.Upgrades[this.value].earn();
367
this.value='';
368
}
369
else if ((this.type=='monster' && by.type=='hero') || (this.type=='hero' && by.type=='monster') && this.stats.hp>0)//it's a fight!
370
{
371
by.stuck=0;
372
373
var monster=(this.type=='hero'?by:this);
374
var hero=(this.type=='hero'?this:by);
375
this.dungeon.currentOpponent=monster;
376
377
if (monster.fighting==0)//first meeting
378
{
379
Game.Heroes[hero.subtype].Say('meet '+Game.Monsters[monster.subtype].name);
380
this.Say('fight');
381
}
382
if (this.fighting==0)
383
{
384
this.fighting=1;
385
by.fighting=1;
386
}
387
388
var attackStr='';
389
var attackerName='';
390
var defenderName='';
391
if (by.type=='hero') attackerName=Game.Heroes[by.subtype].name;
392
else if (by.type=='monster') attackerName=Game.Monsters[by.subtype].name;
393
if (this.type=='hero') defenderName=Game.Heroes[this.subtype].name;
394
else if (this.type=='monster') defenderName=Game.Monsters[this.subtype].name;
395
396
//battle formulas (have fun with these)
397
attackStr+=attackerName+' swings at '+defenderName+'!';
398
var damage=Math.round(Math.max(1,Math.min(by.stats.might,Math.pow(((by.stats.might+2.5)/Math.max(1,this.stats.guard)),2)))*(0.8+Math.random()*0.4+Math.pow(Math.random()*0.8,6)));
399
var dodge=Math.random()>(by.stats.speed/Math.max(1,this.stats.dodge+2.5));
400
if (dodge)
401
{
402
attackStr+=' '+defenderName+' dodged the attack.';
403
}
404
else
405
{
406
if (by.stats.luck && by.type=='hero' && Math.random()<by.stats.luck*0.01) {damage*=2;attackStr+=' <b>It\'s a critical!</b>';}//very rare critical based on luck
407
attackStr+=' <b>'+damage+'</b> damage!';
408
409
this.stats.hp-=damage;
410
this.stats.hp=Math.max(this.stats.hp,0);
411
if (this.stats.luck && this.type=='hero')
412
{
413
if (this.stats.hp==0 && Math.random()<this.stats.luck*0.01) {this.stats.hp=1;attackStr+=' '+defenderName+' was saved from certain death!';}//very rare life-saving based on luck
414
}
415
}
416
417
if (this.type=='hero') attackStr='<span style="color:#f99;">'+attackStr+'</span>';
418
if (attackStr!='') this.dungeon.Log(attackStr);
419
420
if (this.stats.hp<=0)//die
421
{
422
this.dungeon.Log(attackerName+' crushed '+defenderName+'!');
423
if (this.type=='hero')
424
{
425
Game.Heroes[this.subtype].Say('defeat');
426
this.dungeon.Log('<span style="color:#f66;">'+Game.Heroes[this.subtype].name+' has been defeated.</span>');
427
this.dungeon.FailLevel();
428
}
429
if (this.type=='monster' && by.type=='hero')
430
{
431
l('monsterSlot'+this.dungeon.id).style.visibility='hidden';
432
this.dungeon.monstersKilledThisRun+=1;
433
if (Math.random()<0.05) Game.Heroes[by.subtype].Say('win');
434
Game.Heroes[by.subtype].Say('win against '+Game.Monsters[this.subtype].name);
435
this.Say('defeat');
436
if (Game.Monsters[this.subtype].loot)
437
{
438
var loot=Game.Monsters[this.subtype].loot;
439
if (loot.gear && (!loot.gear.prob || Math.random()<loot.gear.prob)) {}//drop gear
440
if (loot.cookies && (!loot.cookies.prob || Math.random()<loot.cookies.prob))
441
{
442
var entity=this.dungeon.AddEntity('item','cookies',this.x,this.y);//drop cookies
443
entity.value=Math.round(loot.cookies.min+Math.random()*(loot.cookies.max-loot.cookies.min));
444
}
445
}
446
if (this.onKill) this.onKill();
447
this.Destroy();
448
}
449
}
450
}
451
}
452
this.Turn=function()//do this every turn (walk around, heal up...)
453
{
454
if (this.type=='monster')
455
{
456
var howManyTurns=this.GetInitiative();
457
for (var i=0;i<howManyTurns;i++)
458
{
459
if (1==1)//this.AI!='static')
460
{
461
if (this.AI=='flee') this.Flee(this.dungeon.heroEntity.x,this.dungeon.heroEntity.y);//flee from the player
462
else
463
{
464
this.GoTo(this.dungeon.heroEntity.x,this.dungeon.heroEntity.y);//track the player
465
if (this.stuck || this.targets.length==[]) this.Wander();//can't reach the player? walk around randomly
466
}
467
}
468
}
469
}
470
if (this.type=='monster' || this.type=='hero')
471
{
472
if (this.stuck>0) this.stuck--;
473
this.stuck=Math.min(10,this.stuck);
474
this.targets=[];
475
}
476
if ((this.type=='hero' || this.type=='monster') && this.fighting==0 && this.stats.hp<this.stats.hpm) this.stats.hp++;//heal up
477
if (this.type=='hero')//collect items and cookies
478
{
479
var entities=this.dungeon.GetEntities(this.x,this.y);
480
for (var i in entities)
481
{
482
if (entities[i].type=='item' && entities[i].subtype=='cookies')
483
{
484
var entity=entities[i];
485
var value=Math.ceil(entity.value*Game.Objects[this.dungeon.type].amount*50*(1+Math.random()*((this.stats.luck)/20)));//temporary; scale with matching building CpS later
486
if (value>0)
487
{
488
this.dungeon.Log('<span style="color:#9f9;">Found <b>'+Beautify(value)+'</b> cookie'+(value==1?'':'s')+'!</span>');
489
this.dungeon.cookiesMadeThisRun+=value;
490
Game.Earn(value);
491
}
492
entity.Destroy();
493
}
494
}
495
}
496
if (this.type=='hero') this.fighting=0;
497
}
498
this.Destroy=function()
499
{
500
this.dungeon.entities.splice(this.dungeon.entities.indexOf(this),1);
501
}
502
this.GetInitiative=function()
503
{
504
return randomFloor((this.stats.speed/5)*(1/Math.max(1,(this.dungeon.heroEntity.stats.speed/5))));
505
}
506
}
507
508
/*=====================================================================================
509
DUNGEON MECHANICS
510
=======================================================================================*/
511
512
Game.Dungeons=[];
513
Game.Dungeon=function(type,id)
514
{
515
this.type=type;
516
this.id=id;
517
Game.Dungeons[this.id]=this;
518
this.log=[];
519
this.logNew=0;
520
this.name=Game.DungeonTypes[this.type].nameGenerator();
521
this.hero=null;
522
this.currentOpponent=0;
523
this.level=0;
524
this.auto=1;
525
this.portalPic='';
526
527
this.cookiesMadeThisRun=0;
528
this.monstersKilledThisRun=0;
529
530
this.Log=function(what,nested)
531
{
532
if (typeof what==='string')
533
{
534
this.log.unshift(what);
535
this.logNew++;
536
}
537
else {for (var i in what) {this.Log(what[i],1);}}
538
//if (!nested) this.UpdateLog();
539
}
540
541
this.UpdateLog=function()
542
{
543
this.log=this.log.slice(0,30);
544
var str='';
545
for (var i in this.log)
546
{
547
if (i<this.logNew) str+='<div class="new">'+this.log[i]+'</div>';
548
else str+='<div>'+this.log[i]+'</div>';
549
}
550
this.logNew=0;
551
l('dungeonLog'+this.id).innerHTML=str;
552
}
553
554
this.entities=[];
555
this.GetEntities=function(x,y)//returns the first entity found on tile x,y
556
{
557
var entities=[];
558
for (var i in this.entities) {if (this.entities[i].x==x && this.entities[i].y==y) entities.push(this.entities[i]);}
559
return entities;
560
}
561
this.AddEntity=function(type,subtype,x,y)
562
{
563
//this.RemoveEntities(x,y);
564
var entity=new Game.Entity(type,subtype,this);
565
entity.x=x;
566
entity.y=y;
567
entity.dungeon=this;
568
this.entities.push(entity);
569
return entity;
570
}
571
this.RemoveEntities=function(x,y)
572
{
573
var entities=this.GetEntities(x,y);
574
for (var i in entities)
575
{
576
entities[i].Destroy();
577
}
578
}
579
this.DrawEntities=function()
580
{
581
var str='';
582
for (var i in this.entities) {str+=this.entities[i].Draw();}
583
return str;
584
}
585
586
this.CheckObstacle=function(x,y)//returns 0 for no obstacle; -1 for a wall; an entity if there's at least one entity on this tile
587
{
588
if (x<0 || x>=this.map.w || y<0 || y>=this.map.h) return -1;
589
var entities=this.GetEntities(x,y);
590
for (var i in entities)
591
{
592
if (entities[i].obstacle) return entities[i];
593
}
594
return this.map.isObstacle(x,y)?-1:0;
595
}
596
597
598
this.map={};
599
this.Generate=function()
600
{
601
if (this.level==0) this.name=Game.DungeonTypes[this.type].nameGenerator();
602
this.entities=[];
603
var M=new D.Map(40,40,Math.random(),{
604
roomSize:10,
605
corridorSize:5,
606
fillRatio:1/2,
607
corridorRatio:0.3,
608
pillarRatio:Math.random()*0.8+0.2,
609
waterRatio:Math.random(),
610
branching:Math.ceil(Math.random()*6),
611
sizeVariance:0.4
612
});
613
r=0;
614
while (r!=1)
615
{
616
r=M.dig();
617
}
618
//all done! decorate and render.
619
M.finish();
620
//spawn treasure
621
/*
622
for (var i in M.rooms)
623
{
624
if (M.rooms[i].freeTiles>1)
625
{
626
for (var ii=0;ii<Math.ceil(Math.sqrt(M.rooms[i].freeTiles*(M.rooms[i].gen*0.25+0.1))/2);ii++)
627
{
628
if (Math.random()<0.95 && M.rooms[i].freeTiles>1)
629
{
630
var spot=M.getBestSpotInRoom(M.rooms[i]);
631
M.data[spot.x][spot.y][0]=0;
632
spot.score=0;
633
M.rooms[i].freeTiles--;
634
}
635
}
636
}
637
}*/
638
639
for (var i in M.doors)//place door entities on door positions
640
{
641
//M.data[M.doors[i][0]][M.doors[i][1]][0]=TILE_FLOOR_EDGE;
642
this.AddEntity('destructible','door',M.doors[i][0],M.doors[i][1]);
643
}
644
//set tile graphics
645
for (var i in M.rooms)
646
{
647
var altStr=choose(['alt ','','']);
648
var tiles={
649
'void':altStr+'void',
650
'wall':altStr+'wall',
651
'wall corner':altStr+'wall corner',
652
'floor':altStr+'tiled floor',
653
'floor edges':altStr+'floor',//choose([altStr+'floor',altStr+'floor edges']),
654
'door':altStr+'door',
655
'water':choose(['water','green water','dark water']),
656
'pillar':choose([altStr+'wall',altStr+'round pillar',altStr+'square pillar',altStr+'potted plant','conveyor belt']),
657
'entrance':altStr+'entrance',
658
'exit':altStr+'exit',
659
};
660
if (Math.random()<0.1) {tiles['wall corner']='wooden wall';tiles['wall']='wooden wall';tiles['floor edges']='wooden floor';tiles['pillar']='wooden wall';}
661
if (Math.random()<0.1) {tiles['wall corner']=altStr+'bookshelf';tiles['wall']=altStr+'bookshelf';tiles['pillar']=altStr+'bookshelf';}
662
M.assignTiles(M.rooms[i],tiles);
663
}
664
this.map=M;
665
this.map.str=this.map.getStr();
666
667
//place a boss
668
var tile=this.map.exit;
669
var monsters=[];
670
for (var ii in Game.BossMonsters)
671
{
672
var me=Game.BossMonsters[ii];
673
if (me.level<=(depth+this.level) && Math.random()<(me.stats.rarity||1)) monsters.push(me.name);
674
}
675
if (monsters.length==0) monsters=[choose(Game.BossMonsters).name];
676
if (monsters.length>0)
677
{
678
this.AddEntity('monster',choose(monsters),tile[0],tile[1]);
679
this.map.removeFreeTile(tile[0],tile[1]);
680
}
681
682
//place relics
683
/*
684
var tile=this.map.getBestSpotInRoom(this.map.getRoom(this.map.exit[0],this.map.exit[1]));
685
var entity=this.AddEntity('special','upgrade',tile.x,tile.y);
686
entity.value='Dungeon cookie upgrade';
687
this.map.removeFreeTile(tile.x,tile.y);
688
for (var i=0;i<Math.floor(Math.pow(Math.random(),2)*3);i++)
689
{
690
var room=choose(this.map.rooms);
691
if (room.freeTiles.length>10)
692
{
693
var tile=this.map.getBestSpotInRoom(room);
694
var entity=this.AddEntity('special','upgrade',tile.x,tile.y);
695
entity.value='Dungeon cookie upgrade';
696
this.map.removeFreeTile(tile.x,tile.y);
697
}
698
}*/
699
700
//sprinkle monsters and treasure
701
for (var i=0;i<Math.ceil(this.map.freeTiles.length*0.7);i++)//let's fill this up with A LOT of stuff
702
{
703
var tile=choose(this.map.freeTiles);
704
if (tile!=-1)
705
{
706
var room=this.map.getRoom(tile[0],tile[1]);
707
var depth=room.gen+1;
708
if (Math.random()<0.2)//2 in 10 spawns are monsters
709
{
710
var monsters=[];
711
for (var ii in Game.Monsters)
712
{
713
var me=Game.Monsters[ii];
714
if (me.level!=0 && me.level<=(depth+this.level) && Math.random()<(me.stats.rarity||1)) monsters.push(me.name);//spawn type depending on monster level and rarity
715
}
716
if (monsters.length>0)
717
{
718
this.AddEntity('monster',choose(monsters),tile[0],tile[1]);
719
this.map.removeFreeTile(tile[0],tile[1]);
720
}
721
}
722
else//the rest of the spawns are destructibles or loot
723
{
724
if (Math.random()<0.6)
725
{
726
var value=Math.round(Math.pow(Math.random(),6)*(10+this.level));
727
if (value>0)
728
{
729
var entity=this.AddEntity('item','cookies',tile[0],tile[1]);//random cookies
730
entity.value=value;
731
}
732
}
733
else this.AddEntity('destructible','random',tile[0],tile[1]);//random crates etc
734
this.map.removeFreeTile(tile[0],tile[1]);
735
}
736
}
737
}
738
}
739
740
this.onTile=-1;
741
742
this.Draw=function()
743
{
744
var str='';
745
var x=-this.hero.x;
746
var y=-this.hero.y;
747
str+='<div id="map'+this.id+'" class="map" style="width:'+(9*16)+'px;height:'+(9*16)+'px;"><div class="mapContainer" id="mapcontainer'+this.id+'" style="position:absolute;left:'+(x*16)+'px;top:'+(y*16)+'px;"><div id="mapitems'+this.id+'"></div>'+this.map.str+'</div></div>';
748
str+='<div style="position:absolute;left:'+(9*16+16)+'px;">'+
749
'<a class="control west" onclick="Game.HeroesById['+this.hero.id+'].Move(-1,0);"></a><br>'+
750
'<a class="control east" onclick="Game.HeroesById['+this.hero.id+'].Move(1,0);"></a><br>'+
751
'<a class="control north" onclick="Game.HeroesById['+this.hero.id+'].Move(0,-1);"></a><br>'+
752
'<a class="control south" onclick="Game.HeroesById['+this.hero.id+'].Move(0,1);"></a><br>'+
753
'<a class="control middle" onclick="Game.HeroesById['+this.hero.id+'].Move(0,0);"></a><br>'+
754
'</div>';
755
str+='<div style="position:absolute;left:'+(9*16+16+48*3)+'px;bottom:16px;height:100%;">'+
756
'<div class="dungeonName"><a onclick="Game.ObjectsById['+this.id+'].setSpecial(0);">Exit</a> - <span class="title" style="font-size:12px;">'+this.name+'</span> lvl.'+(this.level+1)+'</div>'+
757
'<div id="heroSlot'+this.id+'" class="mobSlot"><div id="picHero'+this.id+'" class="mobPic"></div><div id="nameHero'+this.id+'" class="title mobName"></div><div class="hpmBar"><div id="hpHero'+this.id+'" class="hpBar"></div></div></div>'+
758
'<div id="monsterSlot'+this.id+'" class="mobSlot" style="left:128px;"><div id="picMonster'+this.id+'" class="mobPic"></div><div id="nameMonster'+this.id+'" class="title mobName"></div><div class="hpmBar"><div id="hpMonster'+this.id+'" class="hpBar"></div></div></div>'+
759
'</div>'+
760
'<div id="dungeonLog'+this.id+'" class="dungeonLog"></div>';
761
l('rowSpecial'+this.id).innerHTML='<div style="width:100%;height:100%;z-index:10000;position:absolute;left:0px;top:0px;">'+str+'</div>';
762
763
l('picHero'+this.id).style.backgroundImage='url(img/'+this.hero.portrait+'.png)';
764
l('nameHero'+this.id).innerHTML=this.hero.name;
765
}
766
this.Refresh=function()
767
{
768
if (!l('mapcontainer'+this.id)) this.Draw();
769
var x=4-this.hero.x;
770
var y=4-this.hero.y;
771
l('mapcontainer'+this.id).style.left=(x*16)+'px';
772
l('mapcontainer'+this.id).style.top=(y*16)+'px';
773
l('mapitems'+this.id).innerHTML=this.DrawEntities();
774
}
775
this.RedrawMap=function()
776
{
777
this.map.str=this.map.getStr();
778
this.Draw();
779
}
780
this.Turn=function()
781
{
782
for (var i in this.entities)
783
{
784
if (this.entities[i] && this.entities[i].type) this.entities[i].Turn();
785
}
786
if (this.currentOpponent)
787
{
788
l('monsterSlot'+this.id).style.visibility='visible';
789
l('hpMonster'+this.id).style.width=Math.round((this.currentOpponent.stats.hp/this.currentOpponent.stats.hpm)*100)+'%';
790
l('picMonster'+this.id).style.backgroundImage='url(img/'+Game.Monsters[this.currentOpponent.subtype].pic+'.png)';
791
l('nameMonster'+this.id).innerHTML=Game.Monsters[this.currentOpponent.subtype].name;
792
l('picHero'+this.id).style.backgroundImage='url(img/'+this.hero.pic+'.png)';
793
}
794
else
795
{
796
l('monsterSlot'+this.id).style.visibility='hidden';
797
l('hpMonster'+this.id).style.width='100%';
798
l('picHero'+this.id).style.backgroundImage='url(img/'+this.hero.portrait+'.png)';
799
}
800
this.currentOpponent=0;
801
l('hpHero'+this.id).style.width=Math.round((this.heroEntity.stats.hp/this.heroEntity.stats.hpm)*100)+'%';
802
803
this.Refresh();
804
this.UpdateLog();
805
806
if (this.hero.x==this.map.exit[0] && this.hero.y==this.map.exit[1])
807
{
808
this.CompleteLevel();
809
}
810
}
811
812
this.DrawButton=function()
813
{
814
var str='';
815
//str+='<div style="text-align:center;margin:48px auto;color:#999;"><a onclick="Game.ObjectsById['+this.id+'].setSpecial(1);">Enter</a></div>';
816
str+='<div style="width:144px;height:144px;position:absolute;left:0px;bottom:0px;"><a class="specialButtonPic" style="background-image:url(img/'+this.portalPic+'.png);" onclick="Game.ObjectsById['+this.id+'].setSpecial(1);"><div class="specialButtonText">Enter dungeons</div></a></div>';
817
return str;
818
}
819
820
this.CompleteLevel=function()
821
{
822
this.hero.Say('completion');
823
this.level++;
824
this.Generate();
825
Game.HeroesById[0].EnterDungeon(this,this.map.entrance[0],this.map.entrance[1]);
826
this.Draw();
827
}
828
this.FailLevel=function()
829
{
830
this.Log('Cookies made this run : '+Beautify(this.cookiesMadeThisRun)+' | Monsters defeated this run : '+Beautify(this.monstersKilledThisRun));
831
this.cookiesMadeThisRun=0;
832
this.monstersKilledThisRun=0;
833
this.level=0;
834
this.Generate();
835
Game.HeroesById[0].EnterDungeon(this,this.map.entrance[0],this.map.entrance[1]);
836
this.Draw();
837
}
838
}
839
840
Game.DungeonLocationChain=function(map,x,y)//return an array of the rooms between the root room and this tile's room, inclusive
841
{//we shouldn't need all this if we used A*...
842
var room=map.getRoom(x,y);
843
var chain=[];
844
if (room!=-1)
845
{
846
while (room.parent)
847
{
848
chain.push(room);
849
room=room.parent;
850
}
851
}
852
chain.reverse();
853
return chain;
854
}
855
Game.DungeonLinkLocationChains=function(start,end)//return the room in which the first location chain should go to to get closer to the second location chain
856
{
857
/*
858
4 cases
859
-we're already in the same room
860
-the target is in a different branch
861
-the target is above in the same branch
862
-the target is below in the same branch
863
*/
864
start.reverse();
865
end.reverse();
866
if (start[0].id==end[0].id) return start[start.length-1];//same room
867
for (var i in end)
868
{
869
if (start[0]==end[i].parent) return end[i];//inferior branch, go to the inferior room
870
}
871
if (start.length>1) return start[1];//different or superior branch, go to the superior room
872
return start[0];//eeeh, let's just stay in the same room
873
}
874
875
/*=====================================================================================
876
CREATE DUNGEONS
877
=======================================================================================*/
878
Game.Objects['Factory'].special=function()
879
{
880
this.dungeon=new Game.Dungeon('Factory',this.id);
881
this.dungeon.Generate();
882
this.specialDrawFunction=function(){this.dungeon.Refresh();};
883
this.drawSpecialButton=function(){return this.dungeon.DrawButton();};
884
this.dungeon.timer=0;
885
this.dungeon.timerWarmup=5;
886
this.dungeon.portalPic='dungeonFactory';
887
888
this.EachFrame=function()
889
{
890
if (this.dungeon.auto)
891
{
892
if (this.dungeon.timer>0) this.dungeon.timer--;
893
if (this.dungeon.timer==0)
894
{
895
this.dungeon.timer=Game.fps*(Math.max(0.1,2-(this.dungeon.hero.stats.speed*0.2))+Math.max(this.dungeon.timerWarmup,0));
896
if (this.dungeon.timerWarmup>0) this.dungeon.timerWarmup--;
897
898
var dungeon=this.dungeon;
899
var hero=dungeon.heroEntity;
900
901
var targetRoom=Game.DungeonLinkLocationChains(Game.DungeonLocationChain(dungeon.map,hero.x,hero.y),Game.DungeonLocationChain(dungeon.map,dungeon.map.exit[0],dungeon.map.exit[1]));
902
var targetTile=(targetRoom.gen==0 || targetRoom.id==dungeon.map.getRoom(hero.x,hero.y).id)?[dungeon.map.exit[0],dungeon.map.exit[1]]:targetRoom.door;
903
hero.GoTo(targetTile[0],targetTile[1]);
904
if (hero.stuck) hero.Wander();
905
dungeon.hero.x=hero.x;
906
dungeon.hero.y=hero.y;
907
dungeon.Turn();
908
}
909
}
910
}
911
912
if (document.addEventListener)//clean this up later
913
{
914
l('rowSpecial'+this.dungeon.id).removeEventListener('keydown',arguments.callee,false);
915
l('rowSpecial'+this.dungeon.id).addEventListener('keydown',function(event)
916
{
917
var dungeon=Game.Objects['Factory'].dungeon;
918
var control=0;
919
if (event.keyCode==37) {dungeon.hero.Move(-1,0);control=1;}
920
else if (event.keyCode==38) {dungeon.hero.Move(0,-1);control=1;}
921
else if (event.keyCode==39) {dungeon.hero.Move(1,0);control=1;}
922
else if (event.keyCode==40) {dungeon.hero.Move(0,1);control=1;}
923
else if (event.keyCode==32) {dungeon.hero.Move(0,0);control=1;}//space
924
else if (event.keyCode==65)//A (auto)
925
{
926
if (dungeon.auto)
927
{
928
dungeon.auto=0;
929
dungeon.timerWarmup=-1;
930
}
931
else
932
{
933
dungeon.auto=1;
934
dungeon.timer=0;
935
dungeon.timerWarmup=0;
936
}
937
event.preventDefault();
938
}
939
940
if (control)
941
{
942
event.preventDefault();
943
dungeon.timer=Game.fps*10;
944
dungeon.timerWarmup=5;
945
}
946
}
947
);
948
}
949
950
var hero=choose(Game.HeroesById);
951
hero.EnterDungeon(this.dungeon,this.dungeon.map.entrance[0],this.dungeon.map.entrance[1]);
952
}
953
954
/*=====================================================================================
955
HEROES
956
=======================================================================================*/
957
Game.Heroes=[];
958
Game.HeroesById=[];
959
Game.Hero=function(name,pic,portrait,icon)
960
{
961
this.name=name;
962
this.pic=pic;
963
this.portrait=portrait;
964
this.icon=icon;
965
this.stats={
966
hp:25,
967
hpm:25,
968
might:5,
969
guard:5,
970
speed:5,
971
dodge:5,
972
luck:5
973
};
974
this.dialogue={
975
'greeting':'Oh hey.|Sup.',
976
'entrance':'Here we go.|So exciting.',
977
'completion':'That was easy.|All done here.',
978
'defeat':'Welp.|Better luck next time.'
979
};
980
this.gear={
981
'armor':-1,
982
'weapon':-1
983
};
984
this.inDungeon=-1;
985
this.completedDungeons=0;
986
987
this.x=0;
988
this.y=0;
989
990
this.EnterDungeon=function(dungeon,x,y)
991
{
992
this.inDungeon=dungeon.id;
993
dungeon.hero=this;
994
this.x=x;
995
this.y=y;
996
dungeon.heroEntity=dungeon.AddEntity('hero',dungeon.hero.name,x,y);
997
var room=dungeon.map.getRoom(this.x,this.y);
998
if (room!=-1 && room.hidden) {room.hidden=0;dungeon.RedrawMap();}
999
Game.Dungeons[this.inDungeon].Refresh();
1000
dungeon.Log('--------------------');
1001
if (dungeon.level==0) this.Say('greeting');
1002
this.Say('entrance');
1003
l('monsterSlot'+dungeon.id).style.visibility='hidden';
1004
}
1005
this.Move=function(x,y)
1006
{
1007
var dungeon=Game.Dungeons[this.inDungeon];
1008
dungeon.heroEntity.targets=[[x,y]];
1009
if (dungeon.heroEntity.Move())
1010
{
1011
this.x=dungeon.heroEntity.x;
1012
this.y=dungeon.heroEntity.y;
1013
dungeon.Turn();
1014
}
1015
}
1016
1017
this.Say=function(what)
1018
{
1019
if (this.dialogue[what]) Game.Dungeons[this.inDungeon].Log(this.name+' : "<span style="color:#99f;">'+choose(this.dialogue[what].split('|'))+'</span>"');
1020
}
1021
1022
this.save=function()
1023
{
1024
var str='';
1025
str+=
1026
this.inDungeon+','+
1027
this.completedDungeons+','+
1028
this.gear.armor+','+
1029
this.gear.weapon
1030
;
1031
return str;
1032
}
1033
this.load=function(data)
1034
{
1035
var str=data.split(',');
1036
this.inDungeon=parseInt(str[0]);
1037
this.completedDungeons=parseInt(str[1]);
1038
this.gear.armor=parseInt(str[2]);
1039
this.gear.weapon=parseInt(str[3]);
1040
}
1041
this.id=Game.HeroesById.length;
1042
Game.HeroesById.push(this);
1043
Game.Heroes[this.name]=this;
1044
}
1045
1046
/*=====================================================================================
1047
CREATE HEROES
1048
=======================================================================================*/
1049
var hero=new Game.Hero('Chip','girlscoutChip','portraitChip',[1,0]);
1050
hero.dialogue={
1051
'intro':'I\'m Chip! I just really like exploring stuff. Let\'s go have an adventure!',
1052
'greeting':'Hello there!|I\'m ready!|Where are we going today?|Adventure!',
1053
'win':'Take that!|Hah!|That\'s right.',
1054
'entrance':'Chipping in!|Welp, here goes nothing!|I wonder what I\'ll find!|Hey, this place is new!|This place seems familiar.|Let\'s make it happen.',
1055
'completion':'I\'m one smart cookie.|Oh yeah!|Let\'s explore some more!|That was easy!|That sure was fun!|I\'m not lost, am I?|More exploring? Sure, why not!',
1056
'defeat':'B-better luck next time.|That really hurt!|I yield! I yield!|That went badly.|No half-baked excuses next time.|I think I scraped my knee!|Owie.|Woopsie!',
1057
'win against Sentient Furnace':'The irony, it burns! (...it\'s funny because it was burning. And made of iron. ...Moving on.)',
1058
'win against Ascended Baking Pod':'Where is your pod now?|That was disturbing.'
1059
};
1060
hero.stats={
1061
hp:30,
1062
hpm:30,
1063
might:5,
1064
guard:5,
1065
speed:5,
1066
dodge:5,
1067
luck:5
1068
};
1069
var hero=new Game.Hero('Crumb','girlscoutCrumb','portraitCrumb',[2,0]);
1070
hero.dialogue={
1071
'intro':'I\'m Crumb. I look like this because of a baking accident when I was little. Big deal. At least now I don\'t get hurt as easily as others, I guess.',
1072
'greeting':'Hi there.|Ready for adventure, I guess.|Reporting for duty.',
1073
'win':'Oh sorry, did that hurt?|Should have moved out of the way.|Oops. My bad.',
1074
'entrance':'Let\'s do this, I guess.|Well, let\'s go...|I gotta go in there?|Are we really doing this?|I hope I won\'t get lost like last time.|Let\'s get this over with.',
1075
'completion':'I... I did it...|I\'m glad that\'s over.|What, there\'s more?|In I go, I guess.|It doesn\'t end, does it?|But it\'s dark in there.',
1076
'defeat':'I, uh, ouch.|Why does that always happen to me?|I\'m just no good, am I?|Oh no.|I\'m... I\'m not crying.|Well that wasn\'t fun at all.|I\'m sorry I failed you.|Please... make them go away...',
1077
'meet Ascended Baking Pod':'That thing shouldn\'t even be alive.|Is that where they all came from?',
1078
'win against Ascended Baking Pod':'Hm. Fascinating.'
1079
};
1080
hero.stats={
1081
hp:25,
1082
hpm:25,
1083
might:5,
1084
guard:7,
1085
speed:4,
1086
dodge:4,
1087
luck:5
1088
};
1089
var hero=new Game.Hero('Doe','girlscoutDoe','portraitDoe',[3,0]);
1090
hero.dialogue={
1091
'intro':'H-hey. Name\'s Doe. I\'m pretty fast. I uh, I promise I\'ll do my best.',
1092
'greeting':'H-hey.|Oh, uh, h-hi there.|C-can I join?',
1093
'win':'Th-that looks like it hurt... awesome...|D-did I do that?|N-neat... there\'s pieces everywhere.',
1094
'entrance':'Alright, let\'s do this!|I-if I really have to.|I-in there? By myself?|...won\'t you come with me this time?|H-here I go!',
1095
'completion':'Oh... oh my.|That\'s... I uh, I\'m glad.|Y-yeah that was real easy. Piece of pie!|T-too easy, right?|S-so many cookies...|Ooh? F-fascinating.',
1096
'defeat':'I-if you can\'t beat them... join them.|I-it\'s because I stutter, isn\'t it?|W-well that\'s just no good at all.|I, uh, I meant for that to happen.|H-how embarrassing.',
1097
'meet Ascended Baking Pod':'W-whoah... it\'s... magnificent...',
1098
'win against Ascended Baking Pod':'I\'m sorry, buddy.|I... I think I hurt it...|Oh no... I-I think I broke it...'
1099
};
1100
hero.stats={
1101
hp:25,
1102
hpm:25,
1103
might:4,
1104
guard:4,
1105
speed:7,
1106
dodge:5,
1107
luck:5
1108
};
1109
var hero=new Game.Hero('Lucky','girlscoutLucky','portraitLucky',[4,0]);
1110
hero.dialogue={
1111
'intro':'Oh joy! My name\'s Lucky. Guess what I\'m good at?',
1112
'greeting':'I\'m feeling lucky!|It\'s a bright day today!|Let\'s do great things together.',
1113
'win':'Ooh lucky shot!|Pow! One more.|Damn straight!',
1114
'entrance':'Glad to be of service!|Oooh this one\'ll be interesting.|This will be a good one, I can feel it!|Here I come!',
1115
'completion':'Over already?|Let\'s explore some more!|That was lucky!|That was no luck, I\'m just that good.|Alright, let\'s move on!|I\'m just getting warmed up!',
1116
'defeat':'I can\'t believe it!|...This is a joke, right?|Hey! No fair!|B-but...|I\'m gonna need a bandaid. And some hot chocolate.|I\'ll, uh, try again later.|Bad luck! Bad luck!',
1117
'win against Ascended Baking Pod':'Golly, that was peculiar.'
1118
};
1119
hero.stats={
1120
hp:25,
1121
hpm:25,
1122
might:5,
1123
guard:4,
1124
speed:4,
1125
dodge:5,
1126
luck:7
1127
};
1128
1129
};
1130
1131