•  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
r666
r549
(삭제된 사용자)
1[[분류:알파위키 연습장]][include(틀:알파위키 연습장)][include(틀:알파위키 연습장/설명문서, 연습장=연습장, 버전=768)]
r666
2##이 위의 서술을 임의로 수정하지 마세요. 이 줄 아래부터 연습장입니다.
3var _mochiads_game_id = "8ba53e5d63bd23f5";
4bcount = 0;
5dcount = 0;
6enemyCount = 0;
7_root.charname = "Billy";
8_root.jewelslot.gotoAndStop(1);
9_root.jewstr = 0;
10_root.jewagi = 0;
11_root.jewend = 0;
12_root.jewwil = 0;
13_root.jewarm = 0;
14_root.bdy = 1;
15_root.arm = 0;
16_root.rep = 50;
17_root.armstr = 0;
18_root.armagi = 0;
19_root.armend = 0;
20_root.armwil = 0;
21_root.armarm = 1;
22_root.blockrating = 0;
23_root.armorslot.gotoAndStop(5);
24_root.headslot.gotoAndStop(1);
25_root.head = 1;
26_root.headstr = 0;
27_root.headagi = 0;
28_root.headend = 0;
29_root.headwil = 0;
30_root.headarm = 0;
31_root.wpnslot.gotoAndStop(4);
32_root.dmgmin = 1;
33_root.dmgmax = 3;
34_root.dmgtype = 2;
35_root.critical = 0;
36_root.criticalhitting = false;
37_root.dmgrangemin = 0;
38_root.dmgrangemax = 0;
39_root.dmgrangetype = 0;
40_root.strdmg = 0;
41_root.attspeed = 15;
42_root.magattspeed = 5;
43_root.wpn = 1;
44_root.wpnstr = 0;
45_root.wpnagi = 0;
46_root.wpnend = 0;
47_root.wpnwil = 0;
48_root.wpnarm = 0;
49_root.wpnrange = 1;
50_root.wpnrangestr = 0;
51_root.wpnrangeagi = 0;
52_root.wpnrangeend = 0;
53_root.wpnrangewil = 0;
54_root.wpnrangearm = 0;
55_root.rangeammo = " ";
56_root.shislot.gotoAndStop(13);
57_root.shi = 1;
58_root.shistr = 0;
59_root.shiagi = 0;
60_root.shiend = 0;
61_root.shiwil = 0;
62_root.shiarm = 5;
63_root.shiblock = 1;
64_root.movespd = 6;
65_root.moving = false;
66_root.attacking = false;
67_root.defending = false;
68_root.dir = "L";
69_root.str = 5;
70_root.agi = 5;
71_root.bg.gotoAndStop(1);
72_root.end = 5;
73_root.wil = 5;
74_root.gold = 10;
75_root.hpmax = (_root.end + _root.armend + _root.headend + _root.wpnend + _root.jewend) * 2;
76_root.hp = _root.hpmax;
77_root.lvl = 1;
78_root.spnt = 3;
79_root.xpneed = 200;
80_root.xp = 0;
81var timer = 0;
82var sectimer = 0;
83var tiptimer = 0;
84_root.maintip._visible = false;
85_root.hudeverything.journa = " ";
86_root.chatperson = 0;
87_root.shop = false;
88_root.shoptab._visible = false;
89_root.shoptab.stop();
90_root.help._visible = false;
91_root.chat._visible = false;
92_root.main.tip._visible = false;
93_root.quest1 = 13;
94_root.quest2 = 1;
95_root.quest3 = 1;
96_root.quest4 = 1;
97_root.quest5 = 1;
98_root.quest6 = 1;
99_root.quest7 = 1;
100_root.quest8 = 1;
101_root.quest9 = 1;
102_root.quest10 = 1;
103_root.quest11 = 1;
104_root.quest12 = 1;
105_root.crate0 = false;
106_root.keg0 = false;
107_root.chest0 = false;
108_root.chest1 = false;
109_root.chest2 = false;
110_root.chest3 = false;
111_root.chest4 = false;
112_root.chest5 = false;
113_root.chest6 = false;
114_root.chest7 = false;
115_root.foodheal = 0;
116_root.foodtimer = 0;
117_root.buffstr = 0;
118_root.buffagi = 0;
119_root.buffend = 0;
120_root.buffwil = 0;
121_root.buffarm = 0;
122_root.buffatrtimer = 0;
123_root.savechat = false;
124_root.savename1 = "No Data";
125_root.savetab.name1 = "No Data";
126_root.savename2 = "No Data";
127_root.savetab.name2 = "No Data";
128_root.savetab._visible = false;
129_root.loadtab._visible = false;
130_root.menuon = true;
131_root.soundplay = "none";
132_root.area = "menu";
133_root.areaswitch = "menu";
134_root.tracknum = 1;
135_root.trackswitch = 0;
136_quality = "HIGH";
137_root.soundoff = false;
138_root.hudeverything.s1.gotoAndStop(1);
139_root.hudeverything.s2.gotoAndStop(1);
140_root.hudeverything.s3.gotoAndStop(1);
141_root.hudeverything.s4.gotoAndStop(1);
142_root.hudeverything.s5.gotoAndStop(1);
143_root.hudeverything.s6.gotoAndStop(1);
144_root.hudeverything.s7.gotoAndStop(1);
145_root.hudeverything.s8.gotoAndStop(1);
146_root.hudeverything.s9.gotoAndStop(1);
147_root.hudeverything.s10.gotoAndStop(1);
148_root.hudeverything.s11.gotoAndStop(1);
149_root.hudeverything.s12.gotoAndStop(1);
150_root.hudeverything.s13.gotoAndStop(1);
151_root.hudeverything.s14.gotoAndStop(1);
152_root.hudeverything.s15.gotoAndStop(1);
153_root.hudeverything.s16.gotoAndStop(1);
154_root.hudeverything.s17.gotoAndStop(1);
155_root.hudeverything.s18.gotoAndStop(1);
156_root.hudeverything.s19.gotoAndStop(1);
157_root.hudeverything.s20.gotoAndStop(1);
158rearrangeinventory = function()
159{
160 var _loc3_ = 1;
161 while(_loc3_ < 19)
162 {
163 var _loc4_ = "s" + _loc3_;
164 var _loc2_ = "s" + (_loc3_ + 1);
165 if(_root.hudeverything[_loc4_]._currentframe == 1 && _root.hudeverything[_loc2_]._currentframe != 1)
166 {
167 _root.hudeverything[_loc4_].stacknum = _root.hudeverything[_loc2_].stacknum;
168 _root.hudeverything[_loc4_].gotoAndStop(_root.hudeverything[_loc2_]._currentframe);
169 _root.hudeverything[_loc2_].gotoAndStop(1);
170 }
171 _loc3_ = _loc3_ + 1;
172 }
173};
174musiccontroller.onEnterFrame = function()
175{
176 if(_root.soundoff == false)
177 {
178 _root.soundplay = "track" + _root.area + _root.tracknum;
179 if(_root.area != _root.areaswitch)
180 {
181 _root.trackswitch -= 2;
182 if(_root.trackswitch >= 60)
183 {
184 global_sound.setVolume(_root.trackswitch - 60);
185 }
186 else if(_root.trackswitch <= 0)
187 {
188 stopBGSongs();
189 _root.tracknum = 1;
190 _root.area = _root.areaswitch;
191 global_sound.setVolume(40);
192 }
193 }
194 if(_root.area == "menu")
195 {
196 tracktravel2.start(0,999999);
197 }
198 else if(_root.area == "travel")
199 {
200 if(_root.tracknum == 3)
201 {
202 tracktravel2.start(0,999999);
203 tracktravel2.onSoundComplete = function()
204 {
205 stopBGSongs();
206 _root.tracknum = 1;
207 };
208 }
209 else if(_root.tracknum == 2)
210 {
211 tracktown5.start(0,999999);
212 tracktown5.onSoundComplete = function()
213 {
214 stopBGSongs();
215 _root.tracknum = 3;
216 };
217 }
218 else if(_root.tracknum == 1)
219 {
220 tracktown1.start(0,999999);
221 tracktown1.onSoundComplete = function()
222 {
223 stopBGSongs();
224 _root.tracknum = 2;
225 };
226 }
227 }
228 else if(_root.area == "enemy")
229 {
230 if(_root.tracknum == 2)
231 {
232 trackenemy2.start(0,999999);
233 trackenemy2.onSoundComplete = function()
234 {
235 stopBGSongs();
236 _root.tracknum = 1;
237 };
238 }
239 else if(_root.tracknum == 1)
240 {
241 trackenemy3.start(0,999999);
242 trackenemy3.onSoundComplete = function()
243 {
244 stopBGSongs();
245 _root.tracknum = 2;
246 };
247 }
248 }
249 }
250};
251stopBGSongs = function()
252{
253 tracktravel2.stop();
254 tracktown5.stop();
255 tracktown1.stop();
256 trackenemy2.stop();
257 trackenemy3.stop();
258};
259shootbow = function()
260{
261 var _loc5_ = "bullet" + bcount;
262 _root.bg.projlayer.attachMovie("range1",_loc5_,bcount);
263 _root.bg.projlayer[_loc5_]._x = _root.hero._x;
264 _root.bg.projlayer[_loc5_]._y = _root.hero._y - 40;
265 _root.bg.projlayer[_loc5_].ymax = _root.hero._y;
266 if(_root.dir == "R")
267 {
268 _root.bg.projlayer[_loc5_]._rotation = 90;
269 _root.bg.projlayer[_loc5_].dx = 20;
270 }
271 else
272 {
273 _root.bg.projlayer[_loc5_]._rotation = -90;
274 _root.bg.projlayer[_loc5_].dx = -20;
275 }
276 _root.bg.projlayer[_loc5_].dy = -3;
277 _root.bg.projlayer[_loc5_].onEnterFrame = function()
278 {
279 this.dy += 0.75;
280 this._x += this.dx;
281 this._y += this.dy;
282 if(this._x < -50 || this._x > 600 || this._y < -50 || this._y > this.ymax)
283 {
284 this.removeMovieClip();
285 }
286 var _loc4_ = 0;
287 while(_loc4_ < 10)
288 {
289 var _loc3_ = "enemy" + _loc4_;
290 if(this.hitTest(_root.bg.enemylayer[_loc3_]) && _root.bg.enemylayer[_loc3_].hits > 0)
291 {
292 effect("impact0",this._x,this._y);
293 _root.bg.enemylayer[_loc3_].attacked = true;
294 _root.bg.enemylayer[_loc3_].hits -= _root.dmggen3;
295 damagethingy("dmgtxtshow",this._x,this._y,_root.dmggen3);
296 this.removeMovieClip();
297 }
298 _loc4_ = _loc4_ + 1;
299 }
300 };
301 bcount++;
302 bcount %= 10;
303};
304shootmagic = function()
305{
306 var _loc5_ = "bullet" + bcount;
307 _root.bg.projlayer.attachMovie("range2",_loc5_,bcount);
308 _root.bg.projlayer[_loc5_]._x = _root.hero._x;
309 _root.bg.projlayer[_loc5_]._y = _root.hero._y - 30;
310 _root.bg.projlayer[_loc5_].ymax = _root.hero._y;
311 _root.bg.projlayer[_loc5_].gotoAndStop(_root.wpnrange);
312 if(_root.dir == "R")
313 {
314 _root.bg.projlayer[_loc5_]._rotation = 90;
315 _root.bg.projlayer[_loc5_].dx = 12;
316 _root.bg.projlayer[_loc5_]._x += 20;
317 }
318 else
319 {
320 _root.bg.projlayer[_loc5_]._rotation = -90;
321 _root.bg.projlayer[_loc5_].dx = -12;
322 _root.bg.projlayer[_loc5_]._x -= 20;
323 }
324 _root.bg.projlayer[_loc5_].dy = (random(10) - 10) * -0.1;
325 _root.bg.projlayer[_loc5_].onEnterFrame = function()
326 {
327 this._x += this.dx;
328 this._y += this.dy;
329 if(this._x < -50 || this._x > 600 || this._y < -50 || this._y > this.ymax)
330 {
331 this.removeMovieClip();
332 }
333 var _loc4_ = 0;
334 while(_loc4_ < 10)
335 {
336 var _loc3_ = "enemy" + _loc4_;
337 if(this.hitTest(_root.bg.enemylayer[_loc3_]) && _root.bg.enemylayer[_loc3_].hits > 0)
338 {
339 effect("impact" + _root.wpnrange,this._x,this._y);
340 _root.bg.enemylayer[_loc3_].attacked = true;
341 _root.bg.enemylayer[_loc3_].hits -= _root.dmggen3;
342 damagethingy("dmgtxtshow",this._x,this._y,_root.dmggen3);
343 this.removeMovieClip();
344 }
345 _loc4_ = _loc4_ + 1;
346 }
347 };
348 bcount++;
349 bcount %= 10;
350};
351damagethingy = function(type, x, y, dmg)
352{
353 var _loc3_ = "dmgtxt" + dcount;
354 _root.dmgtxtlayer.attachMovie(type,_loc3_,dcount);
355 _root.dmgtxtlayer[_loc3_]._x = x;
356 _root.dmgtxtlayer[_loc3_]._y = y;
357 _root.dmgtxtlayer[_loc3_].dmgtxt = dmg;
358 _root.dmgtxtlayer[_loc3_].dmgtxt2 = dmg;
359 _root.dmgtxtlayer[_loc3_].dy = random(8) + 8;
360 _root.dmgtxtlayer[_loc3_].dy2 = _root.dmgtxtlayer[_loc3_].dy;
361 _root.dmgtxtlayer[_loc3_].onEnterFrame = function()
362 {
363 this._y -= this.dy;
364 this.dy *= 0.8;
365 this._alpha = this.dy / this.dy2 * 100;
366 if(this.dy <= 0.5)
367 {
368 this.removeMovieClip();
369 }
370 };
371 dcount++;
372 dcount %= 30;
373};
374effect = function(type, x, y)
375{
376 var _loc3_ = "bullet" + bcount;
377 _root.bg.projlayer.attachMovie(type,_loc3_,bcount);
378 _root.bg.projlayer[_loc3_]._x = x;
379 _root.bg.projlayer[_loc3_]._y = y;
380 _root.bg.projlayer[_loc3_].onEnterFrame = function()
381 {
382 if(this._x < -50 || this._x > 600 || this._y < -50 || this._y > this.ymax)
383 {
384 this.removeMovieClip();
385 }
386 };
387 bcount++;
388 bcount %= 10;
389};
390var onepress = true;
391var cursorhide = 100;
392onMouseMove = function()
393{
394 cursorhide = 100;
395};
396onMouseDown = function()
397{
398 cursorhide = 100;
399};
400hero.onEnterFrame = function()
401{
402 if(cursorhide > 0)
403 {
404 cursorhide--;
405 _root.cursor._visible = true;
406 }
407 else
408 {
409 _root.cursor._visible = false;
410 }
411 if(Key.isDown(16) == false)
412 {
413 onepress = true;
414 }
415 if(Key.isDown(16) && onepress == true)
416 {
417 if(_root.hudeverything._visible == false)
418 {
419 _root.hudeverything._visible = true;
420 onepress = false;
421 }
422 else
423 {
424 if(_root.help._visible == true)
425 {
426 _root.help._visible = false;
427 _root.menuon = false;
428 }
429 _root.hudeverything._visible = false;
430 onepress = false;
431 }
432 }
433 _root.cursor._x = _xmouse;
434 _root.cursor._y = _ymouse;
435 Mouse.hide();
436 if(_root.menuon == false)
437 {
438 _root.hudeverything.q1.gotoAndStop(_root.quest1);
439 _root.hudeverything.q2.gotoAndStop(_root.quest2);
440 _root.hudeverything.q3.gotoAndStop(_root.quest3);
441 _root.hudeverything.q4.gotoAndStop(_root.quest4);
442 _root.hudeverything.q5.gotoAndStop(_root.quest5);
443 _root.hudeverything.q6.gotoAndStop(_root.quest6);
444 _root.hudeverything.q7.gotoAndStop(_root.quest7);
445 _root.hudeverything.q8.gotoAndStop(_root.quest8);
446 _root.hudeverything.q9.gotoAndStop(_root.quest9);
447 _root.hudeverything.q10.gotoAndStop(_root.quest10);
448 _root.hudeverything.q11.gotoAndStop(_root.quest11);
449 _root.hudeverything.q12.gotoAndStop(_root.quest12);
450 if(Key.isDown(37) && _root.attacking == false && _root.defending == false)
451 {
452 _root.moving = true;
453 _root.dir = "L";
454 this.gotoAndStop(3);
455 this._x -= _root.movespd + (_root.addagi + _root.agi) / 5 * 0.1;
456 }
457 else if(Key.isDown(39) && _root.attacking == false && _root.defending == false)
458 {
459 _root.moving = true;
460 _root.dir = "R";
461 this.gotoAndStop(4);
462 this._x += _root.movespd + (_root.addagi + _root.agi) / 5 * 0.1;
463 }
464 if(Key.isDown(38) && _root.attacking == false && _root.defending == false)
465 {
466 _root.moving = true;
467 this._y -= _root.movespd + (_root.addagi + _root.agi) / 5 * 0.1;
468 if(_root.dir == "L")
469 {
470 this.gotoAndStop(3);
471 }
472 else
473 {
474 this.gotoAndStop(4);
475 }
476 }
477 else if(Key.isDown(40) && _root.attacking == false && _root.defending == false)
478 {
479 _root.moving = true;
480 this._y += _root.movespd + (_root.addagi + _root.agi) / 5 * 0.1;
481 if(_root.dir == "L")
482 {
483 this.gotoAndStop(3);
484 }
485 else
486 {
487 this.gotoAndStop(4);
488 }
489 }
490 if(_root.hitrange == true)
491 {
492 if(_root.dmgrangetype == 1)
493 {
494 shootbow();
495 }
496 else if(_root.dmgrangetype == 2)
497 {
498 shootmagic();
499 }
500 else if(_root.dmgrangetype == 3)
501 {
502 if(_root.rangeammo >= 1)
503 {
504 shootmagic();
505 _root.rangeammo = _root.rangeammo - 1;
506 }
507 else if(_root.rangeammo == 0)
508 {
509 _root.rangeammo = _root.rangeammo - 1;
510 _root.wpnrange = 0;
511 _root.dmgrangemin = 0;
512 _root.dmgrangemax = 0;
513 _root.dmgrangetype = 0;
514 _root.wpnrangestr = 0;
515 _root.wpnrangeagi = 0;
516 _root.wpnrangeend = 0;
517 _root.wpnrangewil = 0;
518 _root.wpnrangearm = 0;
519 _root.magattspeed = 0;
520 _root.bowslot.gotoAndStop(1);
521 _root.rangeammo = 0;
522 }
523 }
524 }
525 if(_root.spdagi >= _root.attspeed)
526 {
527 var _loc3_ = 0;
528 }
529 else
530 {
531 _loc3_ = _root.attspeed - _root.spdagi;
532 }
533 if(_root.hero.ani._currentframe >= 20 + Math.round(_loc3_) && (_root.hero._currentframe == 5 || _root.hero._currentframe == 6) && _root.criticalhitting == false)
534 {
535 _root.attacking = false;
536 _root.hero.ani.gotoAndPlay(1);
537 }
538 if(_root.hero.ani._currentframe >= 30 + Math.round(_root.magattspeed) && (_root.hero._currentframe == 13 || _root.hero._currentframe == 14))
539 {
540 _root.attacking = false;
541 _root.hero.ani.gotoAndPlay(1);
542 }
543 if(Key.isDown(37) == false && Key.isDown(39) == false && Key.isDown(38) == false && Key.isDown(40) == false)
544 {
545 _root.moving = false;
546 if(Key.isDown(65) && _root.attacking == false && _root.defending == false)
547 {
548 _root.attacking = true;
549 _root.defending = false;
550 if(_root.dir == "L")
551 {
552 this.gotoAndStop(5);
553 }
554 else
555 {
556 this.gotoAndStop(6);
557 }
558 }
559 else if(Key.isDown(83) && _root.attacking == false && _root.defending == false)
560 {
561 _root.attacking = true;
562 _root.defending = false;
563 if(_root.dir == "L")
564 {
565 this.gotoAndStop(7);
566 }
567 else
568 {
569 this.gotoAndStop(8);
570 }
571 }
572 else if(Key.isDown(70) && _root.attacking == false && _root.defending == false)
573 {
574 if(_root.dmgrangetype == 3)
575 {
576 _root.attacking = true;
577 _root.defending = false;
578 if(_root.dir == "L")
579 {
580 this.gotoAndStop(13);
581 }
582 else
583 {
584 this.gotoAndStop(14);
585 }
586 }
587 else if(_root.dmgrangetype == 2)
588 {
589 _root.attacking = true;
590 _root.defending = false;
591 if(_root.dir == "L")
592 {
593 this.gotoAndStop(13);
594 }
595 else
596 {
597 this.gotoAndStop(14);
598 }
599 }
600 else if(_root.dmgrangetype == 1)
601 {
602 _root.attacking = true;
603 _root.defending = false;
604 if(_root.dir == "L")
605 {
606 this.gotoAndStop(11);
607 }
608 else
609 {
610 this.gotoAndStop(12);
611 }
612 }
613 else
614 {
615 tiptimer = 15;
616 _root.maintip.tipvar = "No Ranged Weapon";
617 _root.maintip._visible = true;
618 _root.attacking = true;
619 _root.defending = false;
620 if(_root.dir == "L")
621 {
622 this.gotoAndStop(7);
623 }
624 else
625 {
626 this.gotoAndStop(8);
627 }
628 }
629 }
630 else if(Key.isDown(68) && _root.attacking == false)
631 {
632 _root.defending = true;
633 _root.attacking = false;
634 if(_root.dir == "L")
635 {
636 this.gotoAndStop(9);
637 }
638 else
639 {
640 this.gotoAndStop(10);
641 }
642 }
643 else if(Key.isDown(68) == false && _root.attacking == false)
644 {
645 _root.defending = false;
646 _root.attacking = false;
647 if(_root.dir == "L")
648 {
649 this.gotoAndStop(1);
650 }
651 else
652 {
653 this.gotoAndStop(2);
654 }
655 }
656 }
657 if(_root.showtip == "food")
658 {
659 _root.main.tip.tipvar = "Food is restoring " + _root.foodheal / 2 + " health every second for " + _root.foodtimer * 2 + " more seconds.";
660 _root.main.tip._visible = true;
661 }
662 else if(_root.showtip == "strp")
663 {
664 _root.main.tip.tipvar = "Your Strength is increased by " + _root.buffstr + " for " + _root.buffatrtimer * 2 + " more seconds.";
665 _root.main.tip._visible = true;
666 }
667 else if(_root.showtip == "agip")
668 {
669 _root.main.tip.tipvar = "Your Agility is increased by " + _root.buffagi + " for " + _root.buffatrtimer * 2 + " more seconds.";
670 _root.main.tip._visible = true;
671 }
672 else if(_root.showtip == "endp")
673 {
674 _root.main.tip.tipvar = "Your Endurance is increased by " + _root.buffend + " for " + _root.buffatrtimer * 2 + " more seconds.";
675 _root.main.tip._visible = true;
676 }
677 else if(_root.showtip == "wilp")
678 {
679 _root.main.tip.tipvar = "Your Willpower is increased by " + _root.buffwil + " for " + _root.buffatrtimer * 2 + " more seconds.";
680 _root.main.tip._visible = true;
681 }
682 else if(_root.showtip == "armp")
683 {
684 _root.main.tip.tipvar = "Your Armour is increased by " + _root.buffarm + " for " + _root.buffatrtimer * 2 + " more seconds.";
685 _root.main.tip._visible = true;
686 }
687 else
688 {
689 _root.main.tip._visible = false;
690 }
691 timer++;
692 timer %= 100;
693 sectimer++;
694 sectimer %= 40;
695 if(tiptimer < 0)
696 {
697 _root.maintip._visible = false;
698 }
699 else
700 {
701 tiptimer -= 0.25;
702 }
703 if(_root.foodtimer > 0)
704 {
705 if(sectimer == 0)
706 {
707 _root.hero.foodheal.gotoAndPlay(2);
708 _root.foodtimer = _root.foodtimer - 1;
709 _root.main.bufffood._visible = true;
710 if(_root.hp <= _root.hpmax - Math.round(_root.foodheal))
711 {
712 _root.hp += Math.round(_root.foodheal);
713 }
714 else
715 {
716 _root.hp = _root.hpmax;
717 }
718 }
719 }
720 else
721 {
722 _root.foodheal = 0;
723 _root.main.bufffood._visible = false;
724 }
725 if(_root.buffatrtimer > 0)
726 {
727 if(sectimer == 0)
728 {
729 _root.buffatrtimer = _root.buffatrtimer - 1;
730 _root.hero.ability.gotoAndPlay(2);
731 if(_root.buffstr > 0)
732 {
733 _root.main.buffstr._visible = true;
734 }
735 else
736 {
737 _root.main.buffstr._visible = false;
738 }
739 if(_root.buffagi > 0)
740 {
741 _root.main.buffagi._visible = true;
742 }
743 else
744 {
745 _root.main.buffagi._visible = false;
746 }
747 if(_root.buffend > 0)
748 {
749 _root.main.buffend._visible = true;
750 }
751 else
752 {
753 _root.main.buffend._visible = false;
754 }
755 if(_root.buffwil > 0)
756 {
757 _root.main.buffwil._visible = true;
758 }
759 else
760 {
761 _root.main.buffwil._visible = false;
762 }
763 if(_root.buffarm > 0)
764 {
765 _root.main.buffarm._visible = true;
766 }
767 else
768 {
769 _root.main.buffarm._visible = false;
770 }
771 }
772 }
773 else
774 {
775 _root.buffarm = 0;
776 _root.buffstr = 0;
777 _root.buffagi = 0;
778 _root.buffend = 0;
779 _root.buffwil = 0;
780 _root.main.buffstr._visible = false;
781 _root.main.buffagi._visible = false;
782 _root.main.buffend._visible = false;
783 _root.main.buffwil._visible = false;
784 _root.main.buffarm._visible = false;
785 }
786 if(timer == 0 && _root.attacking == false && _root.defending == false)
787 {
788 if(_root.hp <= _root.hpmax - Math.round(Math.round((_root.wil + _root.addwil - 5) / 6) + 1))
789 {
790 _root.hp += Math.round((_root.wil + _root.addwil - 5) / 6) + 1;
791 }
792 else
793 {
794 _root.hp = _root.hpmax;
795 }
796 }
797 _root.main.lvl = _root.lvl;
798 this.ani.weapon.gotoAndStop(_root.wpn);
799 this.ani.bow.gotoAndStop(_root.wpnrange);
800 this.ani.projectile.gotoAndStop(_root.wpnrange);
801 this.ani.shield.gotoAndStop(_root.shi);
802 this.ani.body.gotoAndStop(_root.bdy);
803 this.ani.shoulder.gotoAndStop(_root.bdy);
804 this.ani.head.gotoAndStop(_root.head);
805 _root.hudeverything.dmg = _root.dmgmin + _root.strdmg + " - " + (_root.dmgmax + _root.strdmg);
806 if(_root.dmgrangetype >= 2)
807 {
808 _root.hudeverything.dmgrange = _root.dmgrangemin + _root.wildmg + " - " + (_root.dmgrangemax + _root.wildmg);
809 }
810 else if(_root.dmgrangetype == 1)
811 {
812 _root.hudeverything.dmgrange = _root.dmgrangemin + _root.agidmg + " - " + (_root.dmgrangemax + _root.agidmg);
813 }
814 else
815 {
816 _root.hudeverything.dmgrange = "Not Equiped";
817 }
818 _root.hudeverything.arm = _root.arm;
819 _root.blockrating = Math.round((_root.end + _root.addend - 5) * 0.33) + 14 + _root.shiblock * 2;
820 _root.hpmax = Math.round((_root.end + _root.addend) * 2);
821 _root.hudeverything.hp = _root.hp + "/" + _root.hpmax;
822 _root.hudeverything.blok = _root.blockrating - 14;
823 _root.hudeverything.weapon.gotoAndStop(_root.wpnslot._currentframe);
824 _root.hudeverything.shield.gotoAndStop(_root.shislot._currentframe);
825 _root.hudeverything.bow.gotoAndStop(_root.bowslot._currentframe);
826 _root.hudeverything.armor.gotoAndStop(_root.armorslot._currentframe);
827 _root.hudeverything.head.gotoAndStop(_root.headslot._currentframe);
828 _root.hudeverything.jewel.gotoAndStop(_root.jewelslot._currentframe);
829 _root.hudeverything.weapontop.gotoAndStop(_root.wpnslot._currentframe);
830 _root.hudeverything.shieldtop.gotoAndStop(_root.shislot._currentframe);
831 _root.hudeverything.bowtop.gotoAndStop(_root.bowslot._currentframe);
832 _root.hudeverything.armortop.gotoAndStop(_root.armorslot._currentframe);
833 _root.hudeverything.headtop.gotoAndStop(_root.headslot._currentframe);
834 _root.hudeverything.jeweltop.gotoAndStop(_root.jewelslot._currentframe);
835 _root.hudeverything.spnt = _root.spnt;
836 _root.hudeverything.str = _root.str;
837 _root.hudeverything.agi = _root.agi;
838 _root.hudeverything.end = _root.end;
839 _root.hudeverything.wil = _root.wil;
840 _root.hudeverything.rep = _root.rep;
841 _root.main.charname = _root.charname;
842 if(_root.shop == true)
843 {
844 _root.chat.shopbtn._visible = true;
845 }
846 else
847 {
848 _root.chat.shopbtn._visible = false;
849 _root.shoptab._visible = false;
850 }
851 if(_root.savechat == true)
852 {
853 _root.chat.savebtn._visible = true;
854 playerSO = SharedObject.getLocal("playerInfo");
855 player = new Object();
856 _root.savename1 = playerSO.data.playerDat.charname;
857 _root.savetab.name1 = playerSO.data.playerDat.charname;
858 playerSO2 = SharedObject.getLocal("playerInfo");
859 player2 = new Object();
860 _root.savename2 = playerSO2.data.playerDat2.charname;
861 _root.savetab.name2 = playerSO2.data.playerDat2.charname;
862 }
863 else
864 {
865 _root.chat.savebtn._visible = false;
866 _root.savechat._visible = false;
867 }
868 if(_root.spnt > 0)
869 {
870 _root.hudeverything.btnaddstr._visible = true;
871 _root.hudeverything.btnaddagi._visible = true;
872 _root.hudeverything.btnaddend._visible = true;
873 _root.hudeverything.btnaddwil._visible = true;
874 _root.skills2spend._visible = true;
875 }
876 else
877 {
878 _root.hudeverything.btnaddstr._visible = false;
879 _root.hudeverything.btnaddagi._visible = false;
880 _root.hudeverything.btnaddend._visible = false;
881 _root.hudeverything.btnaddwil._visible = false;
882 _root.skills2spend._visible = false;
883 }
884 _root.strdmg = Math.round((_root.str + _root.addstr - 5) / 2);
885 _root.dmgminhit = _root.dmgmin + _root.strdmg;
886 _root.dmgdiffhit = _root.dmgmax + _root.strdmg - _root.dmgminhit;
887 _root.dmgmaxhit = _root.dmgminhit + _root.dmgdiffhit;
888 _root.agidmg = Math.round((_root.agi + _root.addagi - 5) / 6);
889 _root.wildmg = Math.round((_root.wil + _root.addwil - 5) / 6);
890 _root.hudeverything.bow.stacknum = _root.rangeammo;
891 if(_root.dmgrangetype >= 2)
892 {
893 _root.dmgrangeminhit = _root.dmgrangemin + _root.wildmg;
894 _root.dmgrangediffhit = _root.dmgrangemax + _root.wildmg - _root.dmgrangeminhit;
895 _root.dmgrangemaxhit = _root.dmgrangeminhit + _root.dmgrangediffhit;
896 _root.dmggen3 = _root.dmgrangeminhit + random(_root.dmgrangediffhit + 1);
897 }
898 else if(_root.dmgrangetype == 1)
899 {
900 _root.dmgrangeminhit = _root.dmgrangemin + _root.agidmg;
901 _root.dmgrangediffhit = _root.dmgrangemax + _root.agidmg - _root.dmgrangeminhit;
902 _root.dmgrangemaxhit = _root.dmgrangeminhit + _root.dmgrangediffhit;
903 _root.dmggen3 = _root.dmgrangeminhit + random(_root.dmgrangediffhit + 1);
904 }
905 else
906 {
907 _root.dmgrangeminhit = 0;
908 _root.dmgrangediffhit = 0;
909 _root.dmgrangemaxhit = 0;
910 _root.dmggen3 = _root.dmgrangeminhit + random(_root.dmgrangediffhit + 1);
911 }
912 if(_root.dmgtype == 1)
913 {
914 _root.dmggen = Math.round(0.666 * (_root.dmgminhit + random(_root.dmgdiffhit)));
915 _root.dmggen2 = _root.dmgminhit + random(_root.dmgdiffhit + 1);
916 }
917 else if(_root.dmgtype == 2)
918 {
919 _root.dmggen = _root.dmgminhit + random(_root.dmgdiffhit + 1);
920 _root.dmggen2 = Math.round(0.666 * (_root.dmgminhit + random(_root.dmgdiffhit)));
921 }
922 else
923 {
924 _root.dmggen = _root.dmgminhit + random(_root.dmgdiffhit + 1);
925 _root.dmggen2 = Math.round(0.333 * (_root.dmgminhit + random(_root.dmgdiffhit)));
926 }
927 _root.endarm = Math.round((_root.addend + _root.end - 5) / 2);
928 _root.arm = _root.wpnarm + _root.armarm + _root.headarm + _root.jewarm + _root.shiarm + _root.endarm + _root.buffarm;
929 _root.armeff = Math.round(_root.arm / 8);
930 _root.addstr = _root.wpnstr + _root.armstr + _root.headstr + _root.jewstr + _root.shistr + _root.buffstr;
931 _root.addagi = _root.wpnagi + _root.armagi + _root.headagi + _root.jewagi + _root.shiagi + _root.buffagi;
932 _root.addend = _root.wpnend + _root.armend + _root.headend + _root.jewend + _root.shiend + _root.buffend;
933 _root.addwil = _root.wpnwil + _root.armwil + _root.headwil + _root.jewwil + _root.shiwil + _root.buffwil;
934 _root.addarm = _root.wpnarm + _root.armarm + _root.headarm + _root.jewarm + _root.shiarm + _root.buffarm;
935 _root.spdagi = Math.round((_root.agi + _root.addagi - 5) / 9);
936 _root.hudeverything.addstr = "+ " + _root.addstr;
937 _root.hudeverything.addagi = "+ " + _root.addagi;
938 _root.hudeverything.addend = "+ " + _root.addend;
939 _root.hudeverything.addwil = "+ " + _root.addwil;
940 _root.hudeverything.gold = "You have " + _root.gold + " coins";
941 _root.shoptab.goldshop = "You have " + _root.gold + " coins";
942 if(_root.hudeverything._visible == false || _root.hudeverything._currentframe != 1)
943 {
944 rearrangeinventory();
945 }
946 if(_root.xp >= _root.xpneed)
947 {
948 _root.xp -= _root.xpneed;
949 _root.lvl = _root.lvl + 1;
950 _root.spnt += 3;
951 _root.xpneed = Math.round(_root.xpneed * 1.5);
952 _root.hero.lvlup.gotoAndPlay(2);
953 _root.hp = _root.hpmax;
954 tiptimer = 15;
955 _root.maintip.tipvar = "Level Up!! Your now level " + _root.lvl + " you have " + _root.spnt + " points to spend";
956 _root.maintip._visible = true;
957 }
958 if(_root.hp < 0)
959 {
960 stopAllSounds();
961 _root.area = "enemy";
962 _root.areaswitch = "enemy";
963 tracknum == 1;
964 _root.menuon = true;
965 _root.mainmenu.gotoAndStop(7);
966 }
967 }
968};
969createEnemy = function(type, x, y, hp, dmg)
970{
971 var _loc3_ = "enemy" + enemyCount;
972 _root.bg.enemylayer.attachMovie(type,_loc3_,enemyCount);
973 _root.bg.enemylayer[_loc3_]._x = x;
974 _root.bg.enemylayer[_loc3_]._y = y;
975 _root.bg.enemylayer[_loc3_].hits = hp + 3;
976 _root.bg.enemylayer[_loc3_].hitmax = hp + 3;
977 _root.bg.enemylayer[_loc3_].dmg = dmg;
978 _root.bg.enemylayer[_loc3_].hit = false;
979 _root.bg.enemylayer[_loc3_].attacking = false;
980 _root.bg.enemylayer[_loc3_].moving = false;
981 _root.bg.enemylayer[_loc3_].attacked = false;
982 _root.bg.enemylayer[_loc3_].alive = true;
983 _root.bg.enemylayer[_loc3_].gotoAndStop(1);
984 _root.bg.enemylayer[_loc3_].onEnterFrame = function()
985 {
986 if(_root.menuon == false)
987 {
988 this.hud.lvl = Math.round((this.hitmax - 10) / 6 + this.dmg / 5);
989 var _loc5_ = this._x - _root.hero._x - _root.bg._x;
990 var _loc4_ = this._y - _root.hero._y - _root.bg._y;
991 var _loc7_ = Math.sqrt(_loc5_ * _loc5_ + _loc4_ * _loc4_);
992 if(this.attacking == false && this.alive == true)
993 {
994 if(this._x > _root.hero._x)
995 {
996 var _loc8_ = "L";
997 }
998 else if(this._x < _root.hero._x)
999 {
1000 _loc8_ = "R";
1001 }
1002 if(_loc7_ < 60)
1003 {
1004 this.moving = false;
1005 if(_loc8_ == "L")
1006 {
1007 this.gotoAndStop(4);
1008 }
1009 else
1010 {
1011 this.gotoAndStop(5);
1012 }
1013 this.attacked = true;
1014 this.attacking = true;
1015 }
1016 else if(_loc7_ < 150 || this.attacked == true)
1017 {
1018 this.moving = true;
1019 }
1020 }
1021 if(this.moving == true)
1022 {
1023 if(_loc8_ == "L")
1024 {
1025 this.gotoAndStop(2);
1026 this._x -= 4;
1027 }
1028 else
1029 {
1030 this.gotoAndStop(3);
1031 this._x += 4;
1032 }
1033 if(this._y > _root.hero._y + 10)
1034 {
1035 this._y -= 5;
1036 }
1037 else if(this._y < _root.hero._y - 10)
1038 {
1039 this._y += 5;
1040 }
1041 }
1042 if(this.hit == true)
1043 {
1044 if(_root.defending == false)
1045 {
1046 if(this.dmg > Math.round(_root.arm / 20))
1047 {
1048 var _loc3_ = Math.abs(this.dmg - Math.round(_root.arm / 20));
1049 _root.hp -= _loc3_;
1050 damagethingy("dmgtxtshow2",_root.hero._x,_root.hero._y - 50,_loc3_);
1051 }
1052 }
1053 else if(_root.defending == true)
1054 {
1055 if(this._x >= _root.hero._x && _root.dir == "R" || this._x <= _root.hero._x && _root.dir == "L")
1056 {
1057 var _loc6_ = random(2 * this.dmg + 30);
1058 }
1059 else
1060 {
1061 _loc6_ = random(6 * this.dmg + 50);
1062 }
1063 _root.blockchance2 = _loc6_;
1064 if(_loc6_ < _root.blockrating)
1065 {
1066 _root.hero.ani.gotoAndPlay("block");
1067 }
1068 else
1069 {
1070 _root.hero.ani.gotoAndPlay(1);
1071 if(this.dmg > _root.armeff)
1072 {
1073 _loc3_ = Math.abs(this.dmg - _root.armeff);
1074 _root.hp -= _loc3_;
1075 damagethingy("dmgtxtshow2",_root.hero._x,_root.hero._y - 50,_loc3_);
1076 }
1077 }
1078 }
1079 }
1080 if(_root.hit == true && this.hitTest(_root.hero) && this.hits > 0)
1081 {
1082 this.attacked = true;
1083 if(_root.hero._currentframe == 5 || _root.hero._currentframe == 6)
1084 {
1085 this.hits -= _root.dmggen;
1086 damagethingy("dmgtxtshow",this._x,this._y - 50,_root.dmggen);
1087 }
1088 else
1089 {
1090 this.hits -= _root.dmggen2;
1091 damagethingy("dmgtxtshow",this._x,this._y - 50,_root.dmggen2);
1092 }
1093 }
1094 if(this.hits <= 0)
1095 {
1096 this.attacking = false;
1097 this.moving = false;
1098 this.alive = false;
1099 this.gotoAndStop(6);
1100 }
1101 }
1102 };
1103 enemyCount++;
1104 enemyCount %= 10;
1105};
1106createDryad = function(type, x, y, hp, dmg)
1107{
1108 var _loc3_ = "enemy" + enemyCount;
1109 _root.bg.enemylayer.attachMovie(type,_loc3_,enemyCount);
1110 _root.bg.enemylayer[_loc3_]._x = x;
1111 _root.bg.enemylayer[_loc3_]._y = y;
1112 _root.bg.enemylayer[_loc3_].hits = hp + 3;
1113 _root.bg.enemylayer[_loc3_].hitmax = hp + 3;
1114 _root.bg.enemylayer[_loc3_].dmg = dmg;
1115 _root.bg.enemylayer[_loc3_].hit = false;
1116 _root.bg.enemylayer[_loc3_].attacking = false;
1117 _root.bg.enemylayer[_loc3_].moving = false;
1118 _root.bg.enemylayer[_loc3_].attacked = false;
1119 _root.bg.enemylayer[_loc3_].alive = true;
1120 _root.bg.enemylayer[_loc3_].gotoAndStop(1);
1121 _root.bg.enemylayer[_loc3_].onEnterFrame = function()
1122 {
1123 if(_root.menuon == false)
1124 {
1125 this.hud.lvl = Math.round((this.hitmax - 10) / 6 + this.dmg / 5);
1126 var _loc5_ = this._x - _root.hero._x - _root.bg._x;
1127 var _loc4_ = this._y - _root.hero._y - _root.bg._y;
1128 var _loc7_ = Math.sqrt(_loc5_ * _loc5_ + _loc4_ * _loc4_);
1129 if(this.attacking == false && this.alive == true)
1130 {
1131 if(this._x > _root.hero._x)
1132 {
1133 var _loc8_ = "L";
1134 }
1135 else if(this._x < _root.hero._x)
1136 {
1137 _loc8_ = "R";
1138 }
1139 if(_loc7_ < 60)
1140 {
1141 this.moving = false;
1142 if(_loc8_ == "L")
1143 {
1144 this.gotoAndStop(5);
1145 }
1146 else
1147 {
1148 this.gotoAndStop(6);
1149 }
1150 this.attacked = true;
1151 this.attacking = true;
1152 }
1153 else if(_loc7_ < 150 || this.attacked == true)
1154 {
1155 if(this._currentframe <= 2 && this.moving == false)
1156 {
1157 this.gotoAndStop(2);
1158 }
1159 else
1160 {
1161 this.moving = true;
1162 }
1163 }
1164 }
1165 if(this.moving == true)
1166 {
1167 if(_loc8_ == "L")
1168 {
1169 this.gotoAndStop(3);
1170 this._x -= 4;
1171 }
1172 else
1173 {
1174 this.gotoAndStop(4);
1175 this._x += 4;
1176 }
1177 if(this._y > _root.hero._y + 10)
1178 {
1179 this._y -= 5;
1180 }
1181 else if(this._y < _root.hero._y - 10)
1182 {
1183 this._y += 5;
1184 }
1185 }
1186 if(this.hit == true)
1187 {
1188 if(_root.defending == false)
1189 {
1190 if(this.dmg > Math.round(_root.arm / 20))
1191 {
1192 var _loc3_ = Math.abs(this.dmg - Math.round(_root.arm / 20));
1193 _root.hp -= _loc3_;
1194 damagethingy("dmgtxtshow2",_root.hero._x,_root.hero._y - 50,_loc3_);
1195 }
1196 }
1197 else if(_root.defending == true)
1198 {
1199 if(this._x >= _root.hero._x && _root.dir == "R" || this._x <= _root.hero._x && _root.dir == "L")
1200 {
1201 var _loc6_ = random(2 * this.dmg + 30);
1202 }
1203 else
1204 {
1205 _loc6_ = random(6 * this.dmg + 50);
1206 }
1207 _root.blockchance2 = _loc6_;
1208 if(_loc6_ < _root.blockrating)
1209 {
1210 _root.hero.ani.gotoAndPlay("block");
1211 }
1212 else
1213 {
1214 _root.hero.ani.gotoAndPlay(1);
1215 if(this.dmg > _root.armeff)
1216 {
1217 _loc3_ = Math.abs(this.dmg - _root.armeff);
1218 _root.hp -= _loc3_;
1219 damagethingy("dmgtxtshow2",_root.hero._x,_root.hero._y - 50,_loc3_);
1220 }
1221 }
1222 }
1223 }
1224 if(_root.hit == true && this.hitTest(_root.hero) && this.hits > 0)
1225 {
1226 this.attacked = true;
1227 if(_root.hero._currentframe == 5 || _root.hero._currentframe == 6)
1228 {
1229 this.hits -= _root.dmggen;
1230 damagethingy("dmgtxtshow",this._x,this._y - 50,_root.dmggen);
1231 }
1232 else
1233 {
1234 this.hits -= _root.dmggen2;
1235 damagethingy("dmgtxtshow",this._x,this._y - 50,_root.dmggen2);
1236 }
1237 }
1238 if(this.hits <= 0)
1239 {
1240 this.attacking = false;
1241 this.moving = false;
1242 this.alive = false;
1243 this.gotoAndStop(7);
1244 }
1245 }
1246 };
1247 enemyCount++;
1248 enemyCount %= 10;
1249};
1250createRangedEnemy = function(type, x, y, hp, dmg, ran)
1251{
1252 var _loc3_ = "enemy" + enemyCount;
1253 _root.bg.enemylayer.attachMovie(type,_loc3_,enemyCount);
1254 _root.bg.enemylayer[_loc3_]._x = x;
1255 _root.bg.enemylayer[_loc3_]._y = y;
1256 _root.bg.enemylayer[_loc3_].hits = hp + 4;
1257 _root.bg.enemylayer[_loc3_].hitmax = hp + 4;
1258 _root.bg.enemylayer[_loc3_].dmg = dmg;
1259 _root.bg.enemylayer[_loc3_].ran = ran;
1260 _root.bg.enemylayer[_loc3_].hit = false;
1261 _root.bg.enemylayer[_loc3_].attacking = false;
1262 _root.bg.enemylayer[_loc3_].moving = false;
1263 _root.bg.enemylayer[_loc3_].attacked = false;
1264 _root.bg.enemylayer[_loc3_].alive = true;
1265 _root.bg.enemylayer[_loc3_].gotoAndStop(1);
1266 _root.bg.enemylayer[_loc3_].onEnterFrame = function()
1267 {
1268 if(_root.menuon == false)
1269 {
1270 this.hud.lvl = Math.round((this.hitmax - 10) / 6 + this.dmg / 5);
1271 var _loc5_ = this._x - _root.hero._x - _root.bg._x;
1272 var _loc4_ = this._y - _root.hero._y - _root.bg._y;
1273 var _loc7_ = Math.sqrt(_loc5_ * _loc5_ + _loc4_ * _loc4_);
1274 if(this.attacking == false && this.alive == true)
1275 {
1276 if(this._x > _root.hero._x)
1277 {
1278 var _loc8_ = "L";
1279 }
1280 else if(this._x < _root.hero._x)
1281 {
1282 _loc8_ = "R";
1283 }
1284 if(_loc7_ < this.ran)
1285 {
1286 this.moving = false;
1287 if(_loc8_ == "L")
1288 {
1289 this.gotoAndStop(4);
1290 }
1291 else
1292 {
1293 this.gotoAndStop(5);
1294 }
1295 this.attacked = true;
1296 this.attacking = true;
1297 }
1298 else if(_loc7_ < 150 || this.attacked == true)
1299 {
1300 this.moving = true;
1301 }
1302 }
1303 if(this.moving == true)
1304 {
1305 if(_loc8_ == "L")
1306 {
1307 this.gotoAndStop(2);
1308 this._x -= 4;
1309 }
1310 else
1311 {
1312 this.gotoAndStop(3);
1313 this._x += 4;
1314 }
1315 if(this._y > _root.hero._y + 10)
1316 {
1317 this._y -= 5;
1318 }
1319 else if(this._y < _root.hero._y - 10)
1320 {
1321 this._y += 5;
1322 }
1323 }
1324 if(this.hit == true)
1325 {
1326 if(_root.defending == false)
1327 {
1328 if(this.dmg > Math.round(_root.arm / 20))
1329 {
1330 var _loc3_ = Math.abs(this.dmg - Math.round(_root.arm / 20));
1331 _root.hp -= _loc3_;
1332 damagethingy("dmgtxtshow2",_root.hero._x,_root.hero._y - 50,_loc3_);
1333 }
1334 }
1335 else if(_root.defending == true)
1336 {
1337 if(this._x >= _root.hero._x && _root.dir == "R" || this._x <= _root.hero._x && _root.dir == "L")
1338 {
1339 var _loc6_ = random(2 * this.dmg + 30);
1340 }
1341 else
1342 {
1343 _loc6_ = random(6 * this.dmg + 50);
1344 }
1345 _root.blockchance2 = _loc6_;
1346 if(_loc6_ < _root.blockrating)
1347 {
1348 _root.hero.ani.gotoAndPlay("block");
1349 }
1350 else
1351 {
1352 _root.hero.ani.gotoAndPlay(1);
1353 if(this.dmg > _root.armeff)
1354 {
1355 _loc3_ = Math.abs(this.dmg - _root.armeff);
1356 _root.hp -= _loc3_;
1357 damagethingy("dmgtxtshow2",_root.hero._x,_root.hero._y - 50,_loc3_);
1358 }
1359 }
1360 }
1361 }
1362 if(_root.hit == true && this.hitTest(_root.hero) && this.hits > 0)
1363 {
1364 this.attacked = true;
1365 if(_root.hero._currentframe == 5 || _root.hero._currentframe == 6)
1366 {
1367 this.hits -= _root.dmggen;
1368 damagethingy("dmgtxtshow",this._x,this._y - 50,_root.dmggen);
1369 }
1370 else
1371 {
1372 this.hits -= _root.dmggen2;
1373 damagethingy("dmgtxtshow",this._x,this._y - 50,_root.dmggen2);
1374 }
1375 }
1376 if(this.hits <= 0)
1377 {
1378 this.attacking = false;
1379 this.moving = false;
1380 this.alive = false;
1381 this.gotoAndStop(6);
1382 }
1383 }
1384 };
1385 enemyCount++;
1386 enemyCount %= 10;
1387};
1388createPassiveEnemy = function(type, x, y, hp, dmg)
1389{
1390 var _loc3_ = "enemy" + enemyCount;
1391 _root.bg.enemylayer.attachMovie(type,_loc3_,enemyCount);
1392 _root.bg.enemylayer[_loc3_]._x = x;
1393 _root.bg.enemylayer[_loc3_]._y = y;
1394 _root.bg.enemylayer[_loc3_].hits = hp + 3;
1395 _root.bg.enemylayer[_loc3_].hitmax = hp + 3;
1396 _root.bg.enemylayer[_loc3_].dmg = dmg;
1397 _root.bg.enemylayer[_loc3_].hit = false;
1398 _root.bg.enemylayer[_loc3_].attacking = false;
1399 _root.bg.enemylayer[_loc3_].moving = false;
1400 _root.bg.enemylayer[_loc3_].alive = true;
1401 _root.bg.enemylayer[_loc3_].gotoAndStop(1);
1402 _root.bg.enemylayer[_loc3_].onEnterFrame = function()
1403 {
1404 if(_root.menuon == false)
1405 {
1406 this.hud.lvl = 0;
1407 var _loc5_ = this._x - _root.hero._x - _root.bg._x;
1408 var _loc4_ = this._y - _root.hero._y - _root.bg._y;
1409 var _loc8_ = Math.sqrt(_loc5_ * _loc5_ + _loc4_ * _loc4_);
1410 if(this.attacking == false && this.alive == true)
1411 {
1412 if(this._x > _root.hero._x)
1413 {
1414 var _loc7_ = "L";
1415 }
1416 else if(this._x < _root.hero._x)
1417 {
1418 _loc7_ = "R";
1419 }
1420 if(this.attacked == true)
1421 {
1422 if(_loc8_ < 60)
1423 {
1424 this.moving = false;
1425 if(_loc7_ == "L")
1426 {
1427 this.gotoAndStop(4);
1428 }
1429 else
1430 {
1431 this.gotoAndStop(5);
1432 }
1433 this.attacked = true;
1434 this.attacking = true;
1435 }
1436 else if(this.attacked == true)
1437 {
1438 this.moving = true;
1439 }
1440 }
1441 else
1442 {
1443 this.moving = false;
1444 this.gotoAndStop(1);
1445 }
1446 }
1447 if(this.moving == true)
1448 {
1449 if(_loc7_ == "L")
1450 {
1451 this.gotoAndStop(2);
1452 this._x -= 4;
1453 }
1454 else
1455 {
1456 this.gotoAndStop(3);
1457 this._x += 4;
1458 }
1459 if(this._y > _root.hero._y + 10)
1460 {
1461 this._y -= 5;
1462 }
1463 else if(this._y < _root.hero._y - 10)
1464 {
1465 this._y += 5;
1466 }
1467 }
1468 if(this.hit == true)
1469 {
1470 if(_root.defending == false)
1471 {
1472 if(this.dmg > Math.round(_root.arm / 20))
1473 {
1474 var _loc3_ = Math.abs(this.dmg - Math.round(_root.arm / 20));
1475 _root.hp -= _loc3_;
1476 damagethingy("dmgtxtshow2",_root.hero._x,_root.hero._y - 50,_loc3_);
1477 }
1478 }
1479 else if(_root.defending == true)
1480 {
1481 if(this._x >= _root.hero._x && _root.dir == "R" || this._x <= _root.hero._x && _root.dir == "L")
1482 {
1483 var _loc6_ = random(2 * this.dmg + 30);
1484 }
1485 else
1486 {
1487 _loc6_ = random(6 * this.dmg + 50);
1488 }
1489 _root.blockchance2 = _loc6_;
1490 if(_loc6_ < _root.blockrating)
1491 {
1492 _root.hero.ani.gotoAndPlay("block");
1493 }
1494 else
1495 {
1496 _root.hero.ani.gotoAndPlay(1);
1497 if(this.dmg > _root.armeff)
1498 {
1499 _loc3_ = Math.abs(this.dmg - _root.armeff);
1500 _root.hp -= _loc3_;
1501 damagethingy("dmgtxtshow2",_root.hero._x,_root.hero._y - 50,_loc3_);
1502 }
1503 }
1504 }
1505 }
1506 if(_root.hit == true && this.hitTest(_root.hero) && this.hits > 0)
1507 {
1508 this.attacked = true;
1509 if(_root.hero._currentframe == 5 || _root.hero._currentframe == 6)
1510 {
1511 this.hits -= _root.dmggen;
1512 damagethingy("dmgtxtshow",this._x,this._y - 50,_root.dmggen);
1513 }
1514 else
1515 {
1516 this.hits -= _root.dmggen2;
1517 damagethingy("dmgtxtshow",this._x,this._y - 50,_root.dmggen2);
1518 }
1519 }
1520 if(this.hits <= 0)
1521 {
1522 this.attacking = false;
1523 this.moving = false;
1524 this.alive = false;
1525 this.gotoAndStop(6);
1526 }
1527 }
1528 };
1529 enemyCount++;
1530 enemyCount %= 10;
1531};
1532createGuard = function(type, x, y, hp, dmg)
1533{
1534 var _loc3_ = "enemy" + enemyCount;
1535 _root.bg.enemylayer.attachMovie(type,_loc3_,enemyCount);
1536 _root.bg.enemylayer[_loc3_]._x = x;
1537 _root.bg.enemylayer[_loc3_]._y = y;
1538 _root.bg.enemylayer[_loc3_].hits = hp + 3;
1539 _root.bg.enemylayer[_loc3_].hitmax = hp + 3;
1540 _root.bg.enemylayer[_loc3_].dmg = dmg;
1541 _root.bg.enemylayer[_loc3_].hit = false;
1542 _root.bg.enemylayer[_loc3_].attacking = false;
1543 _root.bg.enemylayer[_loc3_].moving = false;
1544 _root.bg.enemylayer[_loc3_].alive = true;
1545 _root.bg.enemylayer[_loc3_].gotoAndStop(1);
1546 _root.bg.enemylayer[_loc3_].onEnterFrame = function()
1547 {
1548 if(_root.menuon == false)
1549 {
1550 this.hud.lvl = Math.round((this.hitmax - 10) / 6 + this.dmg / 5);
1551 var _loc5_ = this._x - _root.hero._x - _root.bg._x;
1552 var _loc4_ = this._y - _root.hero._y - _root.bg._y;
1553 var _loc7_ = Math.sqrt(_loc5_ * _loc5_ + _loc4_ * _loc4_);
1554 if(this.attacking == false && this.alive == true)
1555 {
1556 if(this._x > _root.hero._x)
1557 {
1558 var _loc8_ = "L";
1559 }
1560 else if(this._x < _root.hero._x)
1561 {
1562 _loc8_ = "R";
1563 }
1564 if(_root.rep < -50 || this.attacked == true)
1565 {
1566 if(_loc7_ < 60)
1567 {
1568 this.moving = false;
1569 if(_loc8_ == "L")
1570 {
1571 this.gotoAndStop(4);
1572 }
1573 else
1574 {
1575 this.gotoAndStop(5);
1576 }
1577 this.attacked = true;
1578 this.attacking = true;
1579 }
1580 else if(_loc7_ < 200 || this.attacked == true)
1581 {
1582 this.moving = true;
1583 }
1584 }
1585 else
1586 {
1587 this.moving = false;
1588 this.gotoAndStop(1);
1589 }
1590 }
1591 if(this.moving == true)
1592 {
1593 if(_loc8_ == "L")
1594 {
1595 this.gotoAndStop(2);
1596 this._x -= 4;
1597 }
1598 else
1599 {
1600 this.gotoAndStop(3);
1601 this._x += 4;
1602 }
1603 if(this._y > _root.hero._y + 10)
1604 {
1605 this._y -= 5;
1606 }
1607 else if(this._y < _root.hero._y - 10)
1608 {
1609 this._y += 5;
1610 }
1611 }
1612 if(this.hit == true)
1613 {
1614 if(_root.defending == false)
1615 {
1616 if(this.dmg > Math.round(_root.arm / 20))
1617 {
1618 var _loc3_ = Math.abs(this.dmg - Math.round(_root.arm / 20));
1619 _root.hp -= _loc3_;
1620 damagethingy("dmgtxtshow2",_root.hero._x,_root.hero._y - 50,_loc3_);
1621 }
1622 }
1623 else if(_root.defending == true)
1624 {
1625 if(this._x >= _root.hero._x && _root.dir == "R" || this._x <= _root.hero._x && _root.dir == "L")
1626 {
1627 var _loc6_ = random(2 * this.dmg + 30);
1628 }
1629 else
1630 {
1631 _loc6_ = random(6 * this.dmg + 50);
1632 }
1633 _root.blockchance2 = _loc6_;
1634 if(_loc6_ < _root.blockrating)
1635 {
1636 _root.hero.ani.gotoAndPlay("block");
1637 }
1638 else
1639 {
1640 _root.hero.ani.gotoAndPlay(1);
1641 if(this.dmg > _root.armeff)
1642 {
1643 _loc3_ = Math.abs(this.dmg - _root.armeff);
1644 _root.hp -= _loc3_;
1645 damagethingy("dmgtxtshow2",_root.hero._x,_root.hero._y - 50,_loc3_);
1646 }
1647 }
1648 }
1649 }
1650 if(_root.hit == true && this.hitTest(_root.hero) && this.hits > 0)
1651 {
1652 this.attacked = true;
1653 if(_root.hero._currentframe == 5 || _root.hero._currentframe == 6)
1654 {
1655 this.hits -= _root.dmggen;
1656 damagethingy("dmgtxtshow",this._x,this._y - 50,_root.dmggen);
1657 }
1658 else
1659 {
1660 this.hits -= _root.dmggen2;
1661 damagethingy("dmgtxtshow",this._x,this._y - 50,_root.dmggen2);
1662 }
1663 }
1664 if(this.hits <= 0)
1665 {
1666 this.attacking = false;
1667 this.moving = false;
1668 this.alive = false;
1669 this.gotoAndStop(6);
1670 }
1671 }
1672 };
1673 enemyCount++;
1674 enemyCount %= 10;
1675};
1676spawner.onRelease = function()
1677{
1678 _root.createRangedEnemy("enm_queenspider",200,200,47,14,200);
1679};
1680saver1.onRelease = function()
1681{
1682 _root.setPlayerInfo1();
1683 _root.savePlayer1();
1684 _root.tiptimer = 15;
1685 _root.maintip.tipvar = _root.charname + " saved to Slot 1";
1686 _root.maintip._visible = true;
1687};
1688loader1.onRelease = function()
1689{
1690 _root.loadPlayer1();
1691 _root.tiptimer = 15;
1692 _root.maintip.tipvar = _root.charname + " loaded from Slot 1";
1693 _root.maintip._visible = true;
1694};
1695loadtab.loadbtn1.onRelease = function()
1696{
1697 _root.tutorial.gotoAndStop(60);
1698 if(_root.loadtab.name1 != undefined)
1699 {
1700 _root.loadPlayer1();
1701 _root.tiptimer = 15;
1702 _root.maintip.tipvar = _root.charname + " loaded from Slot 1";
1703 _root.maintip._visible = true;
1704 _root.areaswitch = "travel";
1705 _root.trackswitch = 100;
1706 _root.loadtab._visible = false;
1707 _root.menuon = false;
1708 mainmenu.gotoAndStop(4);
1709 }
1710};
1711saver2.onRelease = function()
1712{
1713 _root.setPlayerInfo2();
1714 _root.savePlayer2();
1715 _root.tiptimer = 15;
1716 _root.maintip.tipvar = _root.charname + " saved to Slot 2";
1717 _root.maintip._visible = true;
1718};
1719loader2.onRelease = function()
1720{
1721 _root.loadPlayer2();
1722 _root.tiptimer = 15;
1723 _root.maintip.tipvar = _root.charname + " loaded from Slot 2";
1724 _root.maintip._visible = true;
1725};
1726loadtab.loadbtn2.onRelease = function()
1727{
1728 _root.tutorial.gotoAndStop(60);
1729 if(_root.loadtab.name2 != undefined)
1730 {
1731 _root.hero._x = 275;
1732 _root.hero._y = 150;
1733 _root.loadPlayer2();
1734 _root.tiptimer = 15;
1735 _root.maintip.tipvar = _root.charname + " loaded from Slot 2";
1736 _root.maintip._visible = true;
1737 _root.areaswitch = "travel";
1738 _root.trackswitch = 100;
1739 _root.loadtab._visible = false;
1740 _root.menuon = false;
1741 mainmenu.gotoAndStop(4);
1742 }
1743};
1744trackenemy2 = new Sound(hero);
1745trackenemy2.attachSound("Enemy2_Kill The Thief.mp3");
1746trackenemy3 = new Sound(hero);
1747trackenemy3.attachSound("Enemy3_Open The Gates.mp3");
1748tracktown1 = new Sound(hero);
1749tracktown1.attachSound("Town1_Bakery.mp3");
1750tracktown5 = new Sound(hero);
1751tracktown5.attachSound("Town5_Traders.mp3");
1752tracktravel2 = new Sound(hero);
1753tracktravel2.attachSound("Travel2_Medieval.mp3");
1754arrowshoot = new Sound(hero);
1755arrowshoot.attachSound("ArrowShoot.wav");
1756global_sound = new Sound();
1757global_sound.setVolume(60);
1758stop();
1759