0,]']>S}Wup8d%qy)6o;]AsVl3>>>>>>>>>>>>>>>>>>>>>>>``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````>>>>>>>>>>>>>>>>>>>>>>>>>>>>``````GHIJ````````GHIJ````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````IJ``GHIJ````````GHIJ``GH``````WXYZ````WXYZ````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````YZ``WXYZ````````WXYZ``WX````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````lmnolmnolmnolmnolmnolmnolmnolmnolmnolmnolmno`mnolmnolmnolmnolmnolmnolmnolmnolmnolmnolmnolmn``````````````````````````````````````|}~|}~|}~|}~|}~|}~|}~|}~|}~|}~|}~`}~|}~|}~|}~|}~|}~|}~|}~|}~|}~|}~|}~```````````````````````````````````````ˌˌˌˌ////////ˌˌˌˌˌˌˌˌˌˌˌ$$$$ˌˌǍˌ````````````````````````````````/////////////////MMMMMMMMMMMMMMMM////ۜۜۜۜ///ۜ$$$ۜۜۜۜۜ//////```````````````````````````````````````````````MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM`GHIJ```GHIJ```MMMMMMMM//////////////`MMMMMM`````/////////```````````///`MMMMMMMMMMMMM``````````````````````````` ``````IJ000GHIJ000GHIJ0GHIJ`WXYZ```WXYZ```GHIJ`MMMMMMMMMMMMMMMMMMMMMMMMMMMM`GHIJ`````MMMMMMMMMMMMMMMMMM```````````MMMMMM```GHIJ```GH````````````````````````````````` L````K `````YZ`````WXYZ````WXYZ````WXYZ````````````````````WXYZ````GHIJ````GHIJ```GHIJ`````WXYZ``````````````GHIJ````GHIJ````````````````````````GHIJ````WXYZ```WX ```````` L````````K ``````````````````````````````````````````````````````````WXYZ````WXYZ```WXY``````````````GHIJ````WXYZ````WXYZ````GHIJ````GHIJ````WXYZ`````````````>>>>>>>>>>>>>>>>>>>>>>>>````````,------------.`````````````````````````````````````````````````````````````````````````````````````````WXY`````````````````````WXYZ````WXYZ```````````````````````GHIJ````````GHIJ````````$$````````````$$``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````WXYZ````````WXYZ``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````lmno````````````````````````````````````````````````````````````````````````````````````````````````````````````````|}~````````$$````````$$`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````` ````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````` L``K```````````````````````````` ```````````` ```````````` ```````````````````````````````````` `````````` ``````````````````````````````````````````````````````` L````K`````````````````````````` L``K`````````` L``K`````````` L``K```````````````````````````````````` L``K`````````` L``K`````````````````````````````````````````````````````````````` L``````K L````K L````K L````K L````K L````K  `````````` `````hhhhhhhhh`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````-----.``````````,-----hhhhxxhcdhhhx````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````GH````````````IJ``hhhhŵ``xsthxx`ŵ``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````WX````````YZ``hhhhCCCCCCCC```BCBCBCB``lmnolmnolmnolmnolmno`lmnolmnolmnolmnolmnolmnolmnolmnolmnolmnolmnolmnolmnonolmnolmnolmno````````````hhhhBEBDDBEBee`BDBDBDB```|}~|}~|}~|}~|}~`|}~|}~|}~|}~|}~|}~|}~jk}~|}~|}~jk|}~|}~|}~~|}~|}~|}~``````````````cdxxBUBDDBUBuŵu````ˌˌˌˌˌjkˌˌˌˌˌˌjkz{ˌˌz{ˌjkˌˌˌˌˌ````$````````$````st``BCCCCCCBuBCBCCBue`ۜۜۜۜۜڈۜۜۜۜۜۜz{z{ۜۜۜz{ۜۜۜۜۜ````````````ste`B```u``BufBEBDDBuŵu``````````````````````5789``````````````````````````````%%%%``68789`````````````````````````````````````````stuBuvBUBDDBguBCBEBCBug`````````````````````````````````````````````6787887789```%```````6789`````````````````````````````````````````````stuBu`BCCCCBwufBDBUBDBfuw```````````````````````````````````````z{`````````````````````````````````````````````````````````````z{````````````````````````````````````````````````````````````stust`B`uvBCCCCCBvu`````````````````````%``%````````````````````````````````````````````````````````````````````````````````````````````stust`B`u`B`````B`u`````````````````````````000;<000`````````````````````````00;<000;<000000000000000000;<0000;<00`````````````````````````````````````````````stu000;<000````````00;<000;<000000000000000000;<0000;<00````````````````stuhhhhhhhhhhhhhhhhhhhhhh111111hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhx``xhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh>>>>>>>>>>>>>>>>>>>>>>>>>>>>````````$$$$````````stuĆĆĆĆĆĆĆĆĆĆhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhx``````xhhhhhhhhhhhcdhhhhhhhhhhhhhhhhhhhcdhhhhhhhhhhhhhhhhhhhhhhhcdhhhhhhhhhhx```GHIJ``````````GHIJ```````````````````````stuĆĆĆĆĆĆĆĆĆĆhhhhhcdhhhhhhhhhhhhcdhhhhhhhhcdhhhhhhhcdhhhhhhhhhcdh1hhhhhhcdh%%````%%hcdh1hhhhhhsthhhhhhhhcdhhhhhhhhstxhhhcdhhhhhhhhhhhcdhhhxxsthxhhcdhhxx````WXYZ``````````WXYZ```````````````````stuĆĆĆĆĆĆcdhhhhsthhhhhhhhhhhhsthhhhcdxhhhsthhhcdhhhsthhhhcdhhsthhhhcdhhsth````````hsthhhcdhhsthhxhcdhhhstxhhhcdhxxst`xxxsthhcdhxcdhhxxsthxx``stxx`xhsthx`````````````````$$````````$$``stuĆĆstxxxxsthhcdxxxxcdhhstxxxxst`xhhstxxxsthhxstxhhhhsthhsthhxxsthxstx``````xsthhhsthhhstxx`xstxxxst`xxxstx``st````stxxstx`stxx``stx``u`st````xstx``u`````````````````````````````````stust````stxxst````stxxst````st``xxst```stxx`st`xxxxstxxstxx``stx`st``````````stxxhsthxxst````st```st````st```st````st``st``st````st```ust```u`st```u```````````````````````````````stust`e``st``st````st``st``e`st```st`est``est`````st``st```est``st``st``xstx``st`e`est`e`st`e``st`e`st`e``st``stst`u``stjkufst```u`st```u`````````````````````````````````stustuste`ste``est`estuststustu%%%`e`stst`e`ust`est``ste``st`e`stu`ustustu`estu`st`u`est`eststu``stgz{uvstjk`ust```u`4`````````````````````````````````stustgustustu``ustustustggfstgustfustufstgstuustust%%stustustfuustugstuustfu`st`uustuststjk`stwu`stufstjku`4```````````````````````````````````````stufstwugfstugstuustgustfgufstwfwvstwustfvustfguvvswfstgugustgustfgstufgstfugstvuustguwstfugustvu`st`ufustgustgfstfz{st`s68789vstgu`4``````````` ```````````````` ``````stuv`st`uwwstuwststwustwwuw`u`st`ustvwu``st`ustwustvfgfgwstuvwstvuwst`ufustwu`stvuwust`vustwustwvstvz{fs`st`u`s68889``````` L``K`````````````` L``K`````stu``st`u``stu``ust``ust`ust```wv```stu``st`u`st`uvust`u`st`u`ustust`ust``st`v```````` L````K```````````````` L````K``````stu`0000000000000000000``````````000;<000000;<00 L``````K L``````K stu```st``st```st```st``stst```st`st```st```st``st```st```st``st``st```st````st``st``st`st``st```st````st```st``st``st``st`st``st```st``````st````st``st``st``st``st``st`st``est```st`e``st```st``stst```stest`e``ste``st``st`e```ste``ste`st`e`ste``st`e```st`e`st`e`st``st```st`e`st```est```st`este``st`est``ste`ste``st``````st`e```st`e`st``st`est`e``st`e`st`st``eustestu``st``e`st``stst```stu`st`u``st`u`est```st`u`e`stu`e`stu`st`u`stu`est`ue`st`est`u``st`e`st``est`u``st`e``ust`e`ste`ustu`e`st`eust``stu``st`u``st````````st`u`e`st`u``st`e`st``ustu`e`st`u`st`estuufstustue`stust``est`st`e`stust`u`e`stu``ust`estu`u`stuu`stu`estu`st`uustu`u`stu`ust`u`stust`u`st`ustu`ust``ust`uu`stuu`st`uust`e`st`ust`u`est`````e`stu``ustu``estu``stustuuste`ustu`stuuvfstfustuustustustst`u``stustu`u`stuust`ustuustuustuustustuustuu%%uustustustustustuustustuustuustuustu`stustu`ustustuustuustustustuustuustustfuu`stvugstuustustuststustustuustuustufstufufstufustufustufstfuustuufstfuustustfustfgufstugfstguustgustugustuustufustustustuustustuustuustustustuustuustufstgvuu``st`uwstuustustuststgustustuustugustuvstfufvvstuvufstuvustfuvfstvufustfuuvstvustfufstvufstvwuvstguwvstwugustwfufstfuwugstuugstuvustfustustuustgustufgustuustustustuustuustguvst`uu``st`u`stguustustffustfstwustufstuustufwustfu`stvuv`u`s%u`vs%u`ustvu`st`uvustvufu`st`ufustvufvst`uvst``u`stwu%`st`ugwut`uvstvu`uwstuuwstgu`ustvugstgustuustfwfustfuvwufstuustufgstustuustuugstwu`st`u`u`stvugustugstvvustvst`ufgstuvstgufugstfu`ustvu`st`u%`u`stu`u`stu`st`u``st`u`ust`uu``st`uvst`u`st`u`st``u`stu``s`u%`ust`u`st`u`u`stugu`stwu`ust`uwstwufstfufustfg`ffufstvu``uvstguustguvwstfgustfuustufuwst`u``u`st`uwufstgfuwst``ust`st`uvwstu`stwuvuwstvu``ust`u`st`u``u`stu`u`stu`ust%u``st`u`ust`u`u``st`u`ust`u``st`u`st``u`st`u``st`u``ust``u`t`u`u`stuwu`st`u`ust`u`st`uvgstvugvustv```vuvst`uu`stwufgustwu``stvwustvugufstuvu`st`u``u`uvstwvu`st``ust`4`st`u``stuu`u`st`u``uu``u`stu`u`stu`ust`u`u`ust`u`u`ust`u``st`ut`u``st`u``ust``u`st`stu`u`st`u`st`u`st`u`ust``%%%``u`st``st`uvwust`u``st``ust`uwuvstu`u``u`u`st``u`st``ust`4`st`u``st`u`st`u```ust`u`ust`u``st`tu`u`st`st`u``st`u``ust```````u`stst`u``ust`t``ust`u`u`stu`u`000000000000000000000000000000000000000000`````````````````****````````````````````````````````````````````****`````````````````````````````````````````````````````````****````````````````*******``****``````````````````````***```*****`````***``*****`````````****``****`**+)**`****``***`````******`````********`******``***`******````````****``****`*******``****`*************`****`*+```)********```********``*****+)*+````)*+)* *`******`*****************``**********y`y*******ii``i******y`````y```i****+i```i``****````````````i***``````***i`i````ii****i`y`i`iii``yi```y`y```iyy``iy`i````ii```i`y``y`i```y``yyy`y`````````````````````y```i````````i```y`y``i`````yi``iy``iiy`yi`i``y`yyy``i```i`y````i`i```yii``y``yii`)+y`````yy```y``i`i```i`y```i``ii``i`ii````````````````````````i``i``y````````y``i``i``i```y`````iy```yi``y``y`yi```iy``y``i`iii``y```y``i````y`y```iy`y``i``i`yy`33i```ii````i``y``y````y``i```y``yy`y`yy```````````````````````````y``y``i````````i``y``y``y````i`````y`i````iy````i```i``iy````yi``i``y``yy`y``i```i```y```````````yi`i``y``y``i`i`33y`````yy````y`````i```````y````i``iii`ii````````````````````````````````i``y````````y``i```````````y````````y````y`````y````y``y&'''''(`y``y``&''(i``i``y```y````````````````y``y``&''(`y`y`33i````i```````````y```````````y`yyy`yy```````````````````````````````y``````````````y````````````````````````````````````&''(```````&''(`````y``y``&'''(``````````````````&''(``````&''(` y`````y``````````````````````i`iii`ii````````````````````````````)+````````````````````)+```````````````````````````` ````````````````````&''(```````` `````````````)+&'''''()+``````````````````````y`yyyyy```````````````````````````````` ``````````````````` ```````````` ```` ``````````````````````````````` ````````````````` `````````````````````````` ```````````i`i`iiii```````````````````````` ```` ```````````` `` ``````` `````` ``````````````````````````` ``````````````````` ```````````````````````` ```` ```````y`y`y`yyy````   `````` ```` ```````` ``` ````````````````````` `````` i`i`i``iii``````****`````******``****`****`````````***``````***``****``````****```````````````***``````000000000000****```)**000000```****````````****````````****`````````````````****``****```````````````y`y`y``yyy````***``**********``*******`*******``*****`****`*********``***```****```***``*******``******`************``***********`***``***+&''(`i``iii````i****i`ii****y***ii****i``******`y`*********y````y****y``y****y***y``********ii*******``y``yy`y````yy```iy`yi`iiyi`y```yy````````i``i``y``iyi``i```iiy`i``iy`iiy``i``i``ii``yi``y```i``&''(i`i````ii`i````y`i`iy`i``iyyiiy``i```ii```i```i`````iy``y```i`i``y`y`i``iy``y```yy``i`i`y``yi``i``yyi``iy``y```y`y``i````i`y```i``i```i```y````y`y``````yy`y````i`y``y`i`y``yi`iyy`i``y````y``y`````y``y`````y`i``i``y``y``i``i`y``yi``i```i`i``y`y``i`iy``y``i`iy``yi``i``i`i``y````y``i````y``y```y```i````&''(``````````i````````y````````y`i``iy``yii`y````````i`````i`````````y``y``i``i``y``y`i``iy``y```y`y```i`i``y`y`i``i``y``y`i``iy``y```y``y```i```````y```````i````i```y````````````````````y``````````````````y``yi``iyy````````````y```y`````````&''(``y``y``&''(`y``y&''(```&''(```y`y`i`i``y``y``&''(`y``y`&''(````i`````y``````````````````y`````y````````````````   ````````````````````i``i`y`yii````````````````````````````````&''(``````&''(`````````````&''(y`y``&''(```````&''(`````y````````````````````````````````````````````````` ````````````````````)+````y``y`i`iyy``````````````````````` `````````````````````````````&''(``````````````````` ``````````````````````````````````````````````````` ```````  `````````````4```i``i``y`y`ii`````````` ``````` ``````````````````````````````````````````````````` ````````````````` `````````````````````` ````````````````````````4 &''(``i`i`&''( ```` `` `` ```` ```` ```````` `````````````````````````` ```````````` `` `````` ````` `````````````` `i``i``y`y``ii` ```` ``````` `` ```````````````````````````` ```` `` ````````````****`````******``****``***y``y``&''(``yy)````````````******```````****``````````*****```````******````````````````````````````````````)*****```***````***```*****```````````******`````******```***``*********+i``i``yy``ii**`***`*******```*****````*****````*****`````````````````````````````````***************````******`******i****i`ii&''(``ii``&''(******ii*****i******i```****`i****`**````````````````````````i``i*```i****ii***iiyy```iy`)y`i``i``yy``ii````y`yi```yiy```ii```y***`````````````````````````y```i`yii```i`y`iyy`yy`ii`i````y`i``i`y``y``&''(``y`y`i````i`i````iyi````iyi``````yy````i```i``````````````````````````i```y``y`y```y``i`i`yi`i``i`i``i````yy`y````i`y```y`i``i``````i`i``y`````y``y````y`y````y`iy```````i``````y````y`````````````````````````````y```i```i`i````i``y``y```iy`y``y``y``y`````````i````````y`````````&''(``````&''(``i`````i````````i```````i`y`````````y```````````````````````````````````````````````y````y`y````y`````i``y```````i````````````````y``````````````````````````````y`````y````````y`````````y``i````````````i`````````````````````````````````````````````````````````````````````y```````````y````````  ```````````````````````` ```````````````````&'''''''''''''(``y`````````````y``````````````````````````````````````````````````````````````````````````````````````````  ``````````````````)+``````````````````````` `````````````````&'''''''''''''''''(` ``````````````````````````````````````````)+`````)+`````LJ``````)+````````````````````````  `````````````````` ```` ````````` ``````````````````````````````````````````````````````````````````````````````````` ```3```````````  ``````````````````````````` `````` ````` ```````````````````````` ```````````` ````` `` ``````````` `` 3```````````````````````` ```````` ````` `````````````` ``` ``` ```` ````````""""""""""""""""""""""""""""`""""""""""""""""""""""""""`""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""``"""""`` ``` ``""""""""""""""""````"""""""""""""""""""""""""````````ab``````````ab```````#``````ab``````````ab``````!```````ab````````ab````````ab````````ab````````ab```````````"``````ab````````ab````````ab````````ab```````!#`````!#`````!#```````ab```````!``#``````ab``````````ab`````!`````ab``````ab````````````ab``````````ab````````````ab``````ab``````ab``````ab``````ab````````````ab````ab````ab````ab`````````````` `````````ab`````````````ab``````ab```````````ab````````ab``````````````ab``````ab````````````ab````ab````ab````ab````ab``````````````ab````````ab````````ab````````ab``````````````````````````````ab`````````````````ab``````ab`````````````ab````````ab````````````ab````````ab````````````ab````````ab````````ab````````ab````````ab``````````````````ab````````ab````````ab````````ab```````````````` ``` `````````ab````````!""#`````ab````````ab`````````ab``````````ab````````````ab````````ab````````````ab``````ab``````ab``````ab``````ab``````````````ab``````ab``````ab``````ab``````````````````````````ab`````````````````ab````````ab```````````ab``````ab````````````ab``````````ab````````````ab``````ab``````ab``````ab``````ab``````````````ab``````ab``````ab``````ab```````````````` `````````ab```````````````ab``````ab```````````ab``````ab``````pr``````ab``````````ab``````pr``````ab````````ab````````ab````````ab````````ab````````pr````````ab````````ab````````ab````````ab``````````````````````````````ab```````````````ab``````ab`````````````ab``````````ab``````````ab``````ab````````ab````ab````ab````ab````ab````````ab````ab````ab````ab````!#```````` ``` `!#````````ab`````````````````ab````````ab```````ab````ab````!""#``````ab````````ab``````!""#``````ab````````ab````````ab````````ab````````ab````````!""#``````ab``````ab``````ab``````ab``````````````````````22````ab```````````````ab``````ab`````````````ab````````ab``````````````````````````````````````ab````ab````````ab````````ab````ab````````````````````ab````````ab````````ab````````ab```````````` ````` ```22``````ab``` `p`````````ab``````````````r`````pab``````abr`````````````p``````````r``````````````ab````ab`pqqqqr`ab`pqqqqr`ab````ab```````pqqqqr```````ab``ab`pqqqqr`ab``ab```````pqqr`````pr``````22```````pabr````````r``````ab`pqqqqqqr`````````````````````````````````````````````````````````""""""""""""""""""""""""""`""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""`` ``` ``""""""""""""""""`` ``` ````"""""""""""""""""""""""""`#``````````````````````````!```````ab``````````ab``````````````ab````````ab````````ab````````ab````````ab``````````````````ab````````ab````````ab````````ab```````!#`````!#```````ab```````!#`````!``#``````ab``````````ab`````!```````````````````````````````````ab``````ab````````````ab``````ab``````ab``````ab``````ab``````````````ab``````ab``````ab``````ab````````` `````````ab````````` ``````````ab``````ab`````````````````````````````````````ab````````ab``````````ab````ab````ab````ab````ab``````````ab````ab````ab````ab```````````````ab````````````````````ab``````ab`````````````````````````````````````````ab````````ab``````````````ab````````ab````````ab````````ab````````ab``````````````````ab````````ab````````ab````````ab````````` ``` `````````ab````````` ``` ````````ab````````ab`````````````````````````````````````ab``````````ab``````````ab``````ab``````ab``````ab``````ab``````````````ab``````ab``````ab``````ab```````````````````ab``````````````````````ab````````ab`````````` ` ```````````````````````ab``````ab``````````ab``````ab``````ab``````ab``````ab``````````````ab``````ab``````ab``````ab````````` `````````ab````````` ``````````ab``````ab```````````` ``````````````r``````ab``````````ab``````pr``````ab````````ab````````ab````````ab````````ab````````pr````````ab````````ab````````ab````````ab```````````````````````ab````````````````````````ab``````ab````````````````````` ````````````````ab``````ab``````````ab````ab````ab````ab````ab``````````ab``````ab``````ab``````ab``````!#` ``` `!#````ab````!#` ``` `!#```````ab````````ab``````````````````````````````!"#````ab````````ab````!""#``````ab````````ab````````ab````````ab````````ab````````!""#````ab````ab````ab````ab`````````````````````ab````````````````!#``````ab``````ab````````````````````````` ```````````````ab``````ab````````````````ab````````ab````````ab````````ab````````ab````````````````````ab````````ab````````ab````````ab````````````` `````````````ab````````````` ````2`````````ab```````````````````````````````````````````qqr`````ab``````ab`````pqqqqr`````ab``ab`pqqqqr`ab``ab````````ab```````pqqqqr```````ab````````ab``ab````````ab```````pqqr`````pqqr```ab```pqqr```````2`````````ab`pqqqqqqr``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````P`QR````````````````````[\]^`````````````````````````````` | 7| :=????????????????????????????6pH9pJ:pKp?????????????????:= @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@U   @ @ o !!""##$$%%&&''(())**++,,--..f0Uq689::;<<<==>>>>>>>>???????????4 r0utyu{v}x|w|}y}~}{}~|~~}~~|~{h2p0@@0`TUECA0A@C@E0G@@@@@@@@@@@@@@@@@@@@@@@p       0 P P 0  e;q000 0A00020 0000200000000000000000`@ :67:==>>>>>>>=<=>>>>=<>?>????? 9;<=>=>>??????????????????????==;=<==<=>><>==<>=>>=>=>=>>???~%%&&''(()/////////////////////l4@<647697:<>?????????????????? !"#$% &P'p(q)r*s+u,v-{.p/p/p/p/p/p/p/p/p/p/p/p/p/p/p/p/p=,x{   / / // //////// // / / / //// /// / /   ////x//////// /OX@z             OUv vu u            Z       ]{{ { { { { {U{{x      X@0 \@0 _O?/weUE5     p `P@0 tdTD4$59    % $ X  ]{{ { { {U{ x  Z        =         V                        :                       w w*w<       ]g   g gg gg GG GG g   g gg gg GG GG g   g gg gg GG GG g   g gg gg GG GG7    >  5          G\eyZ       V fP@0 Z fP@0 ]     P@0 >  >  .  .    000````$```D@L\((88>< օօUh+ ++22+VV+ƭtMtMtMt-G?   22#2#         2 22#2#2#2#        ݙ   ݉!  ݙ        `|    ! ! ao ݀           ""!"#33" #33"#33"#33"#33""!"#33" #33"#33"#33""!"#33""!"ɉ"!"!,"" "" """"ɜ""!" ! !!ɉ!!! ! !!ɉ!!,!""00000          000000ffffffffffffffffffffffffffff00000ffffffffffffffffffffffffffff0000" " "      """"""00000!"!"!"00000          000000000000000     00000!!!!!!!!!!""""""""""!"23"323"323"323"323"323"323"323"323"3"!"23"323"323"323"323"323"323"323"3"!"23"3"!"23"3"!"23"3"%-- title: The Myths and Legends of Bone Knight -- author: MFauzan -- desc: metroidvania game about undead knight -- site: https://mfproject.itch.io/ -- license: MIT License -- version: 0.1 -- script: lua local str=tostring local remove=table.remove local flr=math.floor local rnd=math.random local rad=math.rad local sin=math.sin local cos=math.cos local sqrt=math.sqrt local t=0 local shake=0 local cam={ mx=0,my=0, x=0,y=0, a=1, ll=0,lr=0,lu=0,ld=0,--limit sh=false--shake } local player={ anim=0, x=116,y=64, vx=0,vy=0,spd=0.6,coyT=0, offs=1,offUse=1, flip=0,fliSw=0, health=3,maxHealth=3, enMax=10,enSword=10,enShield=10, armor=0,shield=0,sword=0, timeAtt=0,tiInv=0,tiIsInv=0,tiRegen=0, area=0, isPause=false, isCoy=false, isInv=false,isOver=false, isDust=false, isShield=false,isAttack=false } local doorOpen={0,0,0} local doorPos={ --yellow {29,29,209,209,188,188,188,189,189,189},--x {127,128,127,128,113,114,115,113,114,115},--y --green {29,29,209,209,179,179,179,180,180,180},--x {75,76,101,102,70,71,72,70,71,72},--y --red {29,29,30,30,30,30,179,179,179},--x {49,50,88,89,62,63,46,47,48}--y } local villSafe={0,0,0,0,0} local villRemain=5 local heartPos={ {233,233,233,6,8},--x {126,113,100,87,61}--y } function TIC() SceneManager()debug() t=t+1 end local isDoor=false local areaX={0,240,480,720,960,1200,1440,1680,1920} local areaY={0,104,208,312,416,520,624,728,832,936,1040} local function checkArea() local p=player local aX=areaX local aY=areaY ---catacomb 1st floor if p.y>aY[9] and p.yaX[1] and p.xaX[2] and p.xaX[3] and p.xaX[5] and p.xaX[7] and p.xaX[8] and p.xaY[10] and p.yaX[1] and p.xaX[2] and p.xaX[3] and p.xaX[5] and p.xaX[7] and p.xaX[8] and p.xaY[8] and p.yaX[1] and p.xaX[2] and p.xaX[3] and p.xaX[5] and p.xaX[7] and p.xaX[8] and p.xaY[7] and p.yaX[1] and p.xaX[2] and p.xaX[3] and p.xaX[7] and p.xaY[6] and p.yaX[1] and p.xaX[2] and p.xaX[3] and p.xaX[7] and p.xaY[5] and p.yaX[1] and p.xaX[2] and p.xaX[5] and p.xaX[7] and p.xaX[8] and p.xaY[4] and p.yaX[1] and p.xaX[1] and p.xaX[2] and p.xaX[3] and p.xaX[6] and p.xaX[7] and p.xaY[3] and p.yaX[1] and p.xaX[1] and p.xaX[2] and p.xaX[5] and p.xaX[7] and p.xaY[2] and p.yaX[2] and p.xaX[2] and p.xaX[5] and p.xaX[8] and p.xaY[1] and p.yaX[2] and p.xaX[2] and p.xaX[5] and p.xaX[8] and p.x1688 then music(3)isDoor=true for i=0,2 do mset(210,6+i,52)end end end ---castle right tower elseif p.y>aY[3] and p.yaX[8] and p.xaY[1] and p.yaX[1] and p.xcam.ll then cam.x=cam.ll end if cam.xcam.lu then cam.y=cam.lu end if cam.y0 then poke(0x3FF9,rnd(-d,d))poke(0x3FF9+1,rnd(-d,d)) shake=shake-1 if shake==0 then memset(0x3FF9,0,2)cam.sh=false end end end end local scn=0 function SceneManager() if scn==0 then DrawTitle() elseif scn==1 then DrawStory() elseif scn==2 then DrawGame() elseif scn==3 then DrawGameOver() elseif scn==4 then DrawTheEnd() elseif scn==5 then DrawEndPost() end end local tPal=0 function pal(c0,c1) if(c0==nil and c1==nil)then for i=0,15 do poke4(0x3FF0*2+i,i)end else poke4(0x3FF0*2+c0,c1)end end music(0,-1,-1,false) local idx=0 local txInfo="" local tStr=0 local isStart=false function DrawTitle() --draw cls() spr(407,48,8,0,2,0,0,9,2) if tPal<40 then tPal=tPal+1 for c=1,12 do pal(c,(c-2)+tPal//15)end else --input if btnp(0) and idx>0 then sfx(61,'E-3')idx=idx-1 end if btnp(1) and idx<2 then sfx(61,'E-3')idx=idx+1 end --draw text print("The Myths and Legends of",76,10,12+t%12//6,false,1,true) print("LOAD GAME",94,64,(idx==0 and 12 or 14)) print("NEW GAME",97,74,(idx==1 and 12 or 14)) print("NEW GAME+",97,84,(idx==2 and 12 or 14)) map(60,134,30,1,0,128,0) print("game by Sadness_eth",92,128,14,false,1,true) --info local lgth=print(txInfo,0,-8,0,false,1,true) print(txInfo,120-lgth/2,100,2,false,1,true) --load if idx==0 then if pmem(0)==0 then txInfo="no save data available" else txInfo="" if btnp(4)and not isStart then sfx(60,'D-5')isStart=true end end --new elseif idx==1 then if pmem(0)~=0 then txInfo="save data will be deleted" else txInfo=""end if btnp(4)and not isStart then sfx(60,'D-5')isStart=true end --new game+ else txInfo="buy king version to unlock this mode" end --change scene if isStart then tStr=tStr+1 if tStr==30 then music(1)tPal=0 if idx==1 then scn=1 elseif idx==0 then scn=2 loadGame()end end end end end local textY=120 local story={ "THE MYTHS AND LEGENDS OF", "BONE KNIGHT","","", "Once upon a time...", "a king named Lake", "uses the power of evil", "to rule the world.","", "As a result,", "Lake's old friend, Emerson,", "was resurrected from the dead", "and wanted to stop the evil power", "so he could rest in peace again." } function DrawStory() --draw cls()local p=player if tPal<40 then tPal=tPal+1 for c=1,3 do pal(c,(c-2)+tPal//15)end else if btnp(4) or textY<-115 then scn=2 textY=120 tPal=0 p.x=116 p.y=896 pmem(0,0)end --draw text textY=textY-0.1 for i=1,#story do local lgth=print(story[i],0,-8) print(story[i],120-lgth/2,textY+i*8,12) end end map(0,132,30,1,0,0,5)map(0,135,30,1,0,128,5) for y=1,15 do map(0,133,30,1,0,y*8,5)end end local isInit=false local function initGame() local p=player if not isInit then --item/equip enemySpawn(6,115,0,1,1,1)enemySpawn(4,115,0,1,2,1)enemySpawn(2,115,0,1,3,1)enemySpawn(231,61,0,27,3,6) --sign enemySpawn(65,115,1,3,1)enemySpawn(160,101,1,15,2)enemySpawn(170.5,63,1,29,3)enemySpawn(222.5,47,1,41,4)enemySpawn(23,37,1,39,5) --villager enemySpawn(237,124,2,7,1,1)enemySpawn(237,111,2,6,1,2)enemySpawn(237,98,2,13,1,3)enemySpawn(2,85,2,19,1,4)enemySpawn(2,59,2,31,1,5) enemySpawn(10,35,2,39,2,1) enemySpawn(2,98,2,18,3,1)enemySpawn(206,33,2,36,4,1) --enemy enemyDryCactus(28*8,114*8,1) enemySpawn(73,113,4,3)enemySpawn(104,113,4,3)enemySpawn(145,127,4,9) enemySpawn(142,115,5,4)enemySpawn(87,128,5,10) enemySpawn(189,128,6,8) enemySpawn(155,102,7,15)enemySpawn(43,98,7,17)enemySpawn(73,87,7,21)enemySpawn(200,87,7,22)enemySpawn(75,74,7,24) enemySpawn(124,99,8,15)enemySpawn(38.5,88,8,20)enemySpawn(50.5,88,8,20)enemySpawn(120.5,84,8,21)enemySpawn(153.5,84,8,21)enemySpawn(160.5,85,8,21)enemySpawn(169.5,71,8,24)enemySpawn(124.5,71,8,24) enemySpawn(198,74,9,23) enemySpawn(95,96,10,16)enemySpawn(81,96,10,16)enemySpawn(56,98,10,17)enemySpawn(33,96,10,17)enemySpawn(88,83,10,21)enemySpawn(219,84,10,22)enemySpawn(70,72,10,24)enemySpawn(87,72,10,24) enemySpawn(161,61,11,29)enemySpawn(138,48,11,34)enemySpawn(151,32,11,37) enemySpawn(87,40,12,34)enemySpawn(109,40,12,34)enemySpawn(120,40,12,34) enemySpawn(146,53,13,29)enemySpawn(110,53,13,30)enemySpawn(68,52,13,30)enemySpawn(46,54,13,30) enemySpawn(138,29,14,37)enemySpawn(172,29,14,37)enemySpawn(99,29,14,38)enemySpawn(34,29,14,38) enemySpawn(100,60,15,30)enemySpawn(42,60,15,30) enemySpawn(213,45,16,41)enemySpawn(232,45,16,41)enemySpawn(218,22,16,42)enemySpawn(227,22,16,42)enemySpawn(165,22,16,43)enemySpawn(145,22,16,43)enemySpawn(16,10,16,45)enemySpawn(190,9,16,47) enemySpawn(215.5,34,17,41)enemySpawn(229.5,34,17,41)enemySpawn(95.5,22,17,44)enemySpawn(75.5,22,17,44)enemySpawn(55.5,22,17,44)enemySpawn(5,16,17,45)enemySpawn(28,16,17,45)enemySpawn(9.5,8,17,45)enemySpawn(23.5,8,17,45)enemySpawn(90.5,8,17,46) enemySpawn(185,23,18,43)enemySpawn(125,23,18,43)enemySpawn(85,23,18,44)enemySpawn(65,23,18,44)enemySpawn(45,23,18,44)enemySpawn(16,20,18,45)enemySpawn(50,7,18,46)enemySpawn(110,8,18,46)enemySpawn(155,8,18,47) enemySpawn(46,3,19,46)enemySpawn(70,2,19,46)enemySpawn(97,4,19,46)enemySpawn(140,3,19,47)enemySpawn(176,5,19,47) --- isInit=true end end function DrawGame() if tPal<40 and player.health>0 then tPal=tPal+1 for c=1,12 do pal(c,(c-3)+tPal//15)end else if player.health>0 then pal()end end local p=player ---------- cls()drawEnemyBos3() initGame() limitManager() camShake()camera() hud()drawSign()drawVillager() drawEquipDrop() drawTileHurt()drawTileBreak() drawEnemySpawn() --enemy drawEnemyBos1()drawEnemyBos2()drawEnemyBos4()drawEnemyBos5() drawEffFly()drawEffSmoke()drawEnemySkulSh() drawEnemyDryCactus()drawEnemySkulang()drawEnemySkely()drawEnemyKeeper() drawEnemyBug()drawEnemySpearman()drawEnemyMiner()drawEnemyBat() drawEnemyGhost()drawEnemyWatcher()drawEnemyCactus()drawEnemyAppler()drawEnemyMagician() drawEnemyQuicker()drawEnemyAxl()drawEnemyGuard()drawEnemyCrow() ----- drawPlayer() drawEffSlash()drawEffSpear()drawEffMagic()drawEffSun()drawEnemyAxePla() drawEffNumDam()drawEffDam() drawEffDust()drawEffUp()drawEffExplode() drawEnemyCacSh()drawEnemyMagicSh()drawEnemyAxe()drawEffGuardSh() drawEnemyPhantom()drawEnemyBalBig()drawEnemymeteor() ----- end function DrawGameOver() --draw cls()map(0,132,30,1,0,0,5)map(0,135,30,1,0,128,5) for y=1,15 do map(0,133,30,1,0,y*8,5)end if tPal<40 then tPal=tPal+1 for c=1,3 do pal(c,(c-2)+tPal//15)end else pal() print("YOU DIED!",73,40,2,false,2) print("and your rest is not peaceful",68,56,14,false,1,true) if time()%1000>500 then print("press to restart",66,88,12)spr(94,101,87) end if btnp(4)then --music sfx(60,'D-5')music(1) loadGame()scn=2 tPal=0 end end end local endText={ "THE MYTHS AND LEGENDS OF", "BONE KNIGHT","","", "King Lake has been defeated", "TARKUS has been defeated", "evil power has gone","", "now the hero can rest in peace","","", "THE END" } function DrawTheEnd() cls()local p=player if tPal<40 then tPal=tPal+1 for c=1,3 do pal(c,(c-2)+tPal//15)end else if textY<-95 then tPal=0 scn=5 end --draw text textY=textY-0.1 for i=1,#endText do local lgth=print(endText[i],0,-8) print(endText[i],120-lgth/2,textY+i*8,12) end end map(0,132,30,1,0,0,5)map(0,135,30,1,0,128,5) for y=1,15 do map(0,133,30,1,0,y*8,5)end end function DrawEndPost() local p=player p.area=1 if tPal<40 then tPal=tPal+1 for c=1,12 do pal(c,(c-3)+tPal//15)end else pal()end --draw map(0,104)dialogText("THE END","thanks for playing.","") spr(338,112,64,0,1,0,0,2,1)spr(354+t%40//20,112,56) spr(368+t%120//60,224,80,10,1,0,0,1,2)spr(368+t%120//60,232,80,10,1,1,0,1,2) --drop spr(288+p.armor,48,88,10)spr(320+p.shield,32,88,10)spr(304+p.sword,16,88,10) end function loadGame() local p=player --reset isInit=false p.isOver=false p.enSword=10 p.enShield=10 if pmem(0)==0 then p.x=116 p.y=896 p.health=3 p.maxHealth=3 p.armor=0 p.shield=0 p.sword=0 else p.x=pmem(1)p.y=pmem(2) p.health=pmem(3)p.maxHealth=pmem(4) p.armor=pmem(5)p.shield=pmem(6)p.sword=pmem(7) --load open door for i=1,3 do doorOpen[i]=pmem(7+i) if doorOpen[i]==1 then for a=1,#doorPos[(2*i)-1]do mset(doorPos[(2*i)-1][a],doorPos[(2*i)][a],96) end end end --load villager for i=1,5 do villSafe[i]=pmem(10+i)end villRemain=pmem(16) end end local isSave=false function saveGame() local p=player pmem(0,1) pmem(1,flr(p.x))pmem(2,flr(p.y)) pmem(3,p.health)pmem(4,p.maxHealth) pmem(5,p.armor)pmem(6,p.shield)pmem(7,p.sword) for i=1,3 do pmem(7+i,doorOpen[i])end for i=1,5 do pmem(10+i,villSafe[i])end pmem(16,villRemain) end local function tileSave(mx,my) return mget(mx//8,my//8)==198 or mget(mx//8,my//8)==199 end local function tileSolid(mx,my) return mget(mx//8,my//8)<64 end local function tileHurt(mx,my) if mget(mx//8,my//8)==176 then return 1--water elseif mget(mx//8,my//8)==177 then return 2--spike else return 0 end end local function tileIsBreak(mx,my) if mget(mx//8,my//8)==37 then return 1--white elseif mget(mx//8,my//8)==36 then return 2--red else return 0 end end local tileBr={} local function tileBreak(mx,my,mt)--1.white 2.red local t={x=mx//8,y=my//8,tp=mt,tm=0} tileBr[#tileBr+1]=t end function drawTileBreak() local p=player for i,t in pairs(tileBr) do t.tm=t.tm+1 if t.tm==20 then mset(t.x,t.y,(t.tp==1 and 149 or 148)) elseif t.tm==120 then mset(t.x,t.y,(t.tp==1 and 37 or 36)) tileBr[i]=nil end end end function drawTileHurt() local p=player if tileHurt(p.x+4,p.y+5)~=0 and not p.isInv then local dam=(tileHurt(p.x+4,p.y+9)==1 and 9 or 1) p.health=p.health-dam p.tiIsInv=2 p.isInv=true shake=20 cam.sh=true effNumDam(p.x+4,p.y,"-"..dam.."",4) for a=0,360,45 do effDam(p.x+4,p.y+4,a,2)end end end local arName={ "WARRIOR SUIT", "IRON ARMOR", "KING ARMOR", "EXERCITUS", "GHOST ARMOR", "EARTH SOIL", "LUNAR MASK", "SOLAR ECLIPSE", "WATCHER OF THE SKY", "ACHILLES", "HERO ARMOR" } local arDesc={ "you wore this in the past.", "an armor made by iron.", "an armor that only a king can wear.", "an armor that was used by an ancient warrior.", "an armor that containing ghost energy.", "a precious material from the mainland of mother earth.", "a legendary mask that comes from the dark side of the moon.", "an armor that containing solar energy.", "Watcher of the skies watcher of all.", "the soul of a true warrior trapped in this armor.", "armor that made only for the chosen heroes." } local arAbility={ "ability: 10% chance to withstand any attack", "ability: 20% chance to withstand any attack", "ability: increase 1.5X speed", "ability: 30% chance to withstand any attack", "ability: 50% chance to withstand any attack", "ability: heart regeneration", "ability: speed up attack energy recovery", "ability: speed up shield energy recovery", "ability: increase 50% jump height", "ability: increase 2X speed", "ability: +2 attack point" } local arBlock={1,2,0,3,5,0,0,0,0,0,0} local arSpeed={0,0,0.3,0,0,0,0,0,0,0.6,0} local shName={ "RUSTY SHIELD", "IRON SHIELD", "KING SHIELD", "BARBARIAN SHIELD", "THORNS SHIELD", "STELLAR CORONA", "DEBUS", "MIRROR SHIELD", "CHLOROPLAST" } local shDesc={ "a broken shield but at least it's still usable.", "a shield made by iron.", "a shield that only a king can wield.", "a shield that worn by barbarians.", "a shield covered with hundreds of thorns.", "a great energy that comes from the surface of the sun.", "a shield that can immune to all melee attacks.", "a glass made using sand from the sahara desert.", "a shield made by the best tree on earth." } local shAbility={ "energy:6", "energy:4", "energy:0", "energy:3", "energy:7 attack:2 ability:hurt the enemy", "energy:6 attack:5 ability:hurt the enemy", "energy:9 ability:free energy for melee attack", "energy:9 ability:free energy for magic attack", "energy:9 ability:add 1 heart if hit by any attack" } local shAttack={0,0,0,0,2,5,0,0,0} local shEnergy={6,4,0,3,7,6,9,9,9} local wpName={ "RUSTY SWORD", "IRON SWORD", "KING SWORD", "BRANCH SWORD", "TRISAKTI", "KUJANG MAUNG", "BATTLE SPEAR", "TRISULA", "MAGIC WAND", "SOLAR PROMINENCE", "RAPIER", "GHOST LANCE", "BARBARIAN AXE" } local wpDesc={ "a broken sword but at least it's still usable.", "a sword made by iron.", "a sword that only a king can wield.", "a sword made by the best tree on earth.", "a masterpiece sword that made by kanekes villagers.", "a legendary sword that used by the sunda empire.", "a spear that used for war.", "a precious treasure from the deepest sea.", "a magic wand that used by an ancient witch.", "a magic wand that can emit solar energy.", "a very small and sharp weapon.", "a very thick and large spear.", "a big axe that used by barbarians." } local wpAbility={ "speed:0.6 attack:1 energy:4", "speed:0.5 attack:2 energy:3", "speed:0.2 attack:2 energy:0", "speed:0.5 attack:according to heart energy:3", "speed:0.5 attack:4 energy:3", "speed:0.5 attack:5 energy:3", "speed:0.1 attack:1 energy:2", "speed:0.1 attack:4 energy:3", "speed:0.6 attack:1 energy:4", "speed:0.6 attack:1 energy:4", "speed:0.1 attack:1 energy:1", "speed:0.3 attack:3 energy:3", "speed:1.0 attack:5 energy:4" } local wpSpeed={40,30,15,30,30,30,10,10,40,40,5,20,60} local wpAttack={1,2,2,player.health,4,5,1,4,1,1,1,3,5} local wpEnergy={4,3,0,3,3,3,2,3,4,4,1,3,4} local wpType={1,1,8,1,2,6,3,4,5,7,8,3,9} local keyColor={"YELLOW","GREEN","CRIMSON"} local equip={} local sprDrop={288,320,304,193,214,210,215} function equipDrop(mx,my,md,mt,mar) local e={ x=mx,y=my,vy=0, d=md,--1.armor 2.shield 3.weapon 4.heart 5.potion 6.key 7.1up t=mt,tm=0,tmEf=0, area=mar } equip[#equip+1]=e end function drawEquipDrop() local p=player for i,e in pairs(equip) do --collision local u=e.y+e.vy-4 local d=e.y+e.vy+12 local l=e.x-4 local r=e.x+12 if p.x+4>l and p.x+4u and p.y+6100 then playerBody() end if p.tiInv==60*p.tiIsInv then p.tiInv=0 p.isInv=false end else playerBody() end --controls if btn(2) and not tileSolid(l,u+1)and not tileSolid(l,d-1)and not p.isPause then p.vx=-1 p.offs=-1 p.flip=1 p.anim=t%30//15 elseif btn(3) and not tileSolid(r,u+1)and not tileSolid(r,d-1)and not p.isPause then p.vx=1 p.offs=1 p.flip=0 p.anim=t%30//15 else p.vx=0 p.anim=0 end --use shield if btn(6) and p.shield~=0 and p.enShield>shEnergy[p.shield] then p.isShield=true p.offUse=-1 p.flipSw=(p.flip==0) and 1 or 0 p.spd=0.1 else p.tiShield=0 p.isShield=false p.offUse=1 p.flipSw=p.flip p.spd=0.6 end --use weapon if p.isAttack then p.timeAtt=p.timeAtt+1 if p.timeAtt==wpSpeed[p.sword] then p.isAttack=false p.timeAtt=0 end else if p.sword~=0 and p.enSword>=wpEnergy[p.sword] and btnp(5) then --effect if wpType[p.sword]==1 then effSlash(l+12*p.offs,u-2,p.flip) elseif wpType[p.sword]==2 then for y=-8,4,6 do effSlash(l+12*p.offs,u-4+y,p.flip) end elseif wpType[p.sword]==3 then effSpear(l+10*p.offs,u-2,2*p.offs,0,p.flip,248,1) elseif wpType[p.sword]==4 then for y=-8,4,6 do effSpear(l+10*p.offs,u-4+y,2*p.offs,0,p.flip,249,1) end elseif wpType[p.sword]==6 then effSpear(l+10*p.offs,u-8,2*p.offs,0,p.flip,286,2) elseif wpType[p.sword]==5 then sfx(59,'C-7') for deg=45,135,45 do effMagic(l+10*p.offs,u-4,deg*p.offs,12) end elseif wpType[p.sword]==7 then sfx(59,'C-7') effSun(l+15*p.offs,u-2,p.offs) elseif wpType[p.sword]==8 then effSpear(l+10*p.offs,u-3,2*p.offs,0,p.flip,250,1) elseif wpType[p.sword]==9 then effAxePla(l+10*p.offs,u-2,p.offs) end -------- p.enSword=p.enSword-wpEnergy[p.sword] p.isAttack=true end end --collision down if tileSolid(l+2,d) or tileSolid(r-2,d) then p.vy=0 if p.isDust then effDust(l+2,d-3,p.offs*-1)effDust(l+2,d-3,p.offs) p.isDust=false p.isCoy=false end else p.isDust=true p.vy=p.vy+0.1 if not p.isCoy then p.coyT=20 p.isCoy=true end end --jump if (p.vy==0 or p.coyT>0) and btnp(4)and not p.isPause then sfx(63,'D-3') p.vy=-2-(p.armor==9 and 1 or 0) p.isCoy=true p.coyT=0 end --collision up if p.vy<0 and (tileSolid(l+1,u) or tileSolid(r-1,u)) then p.vy=0 end --update movement if p.health>0 then p.x=p.x+p.vx*(p.spd+arSpeed[p.armor~=0 and p.armor or 1]) else --death if not p.isOver then tPal=0 p.isOver=true end if tPal<60 then tPal=tPal+1 for c=1,15 do pal(c,(c-2)-tPal//20)end else music(4,-1,-1,false)scn=3 tPal=0 end end p.y=p.y+p.vy --weapon 4 ability wpAttack[4]=p.health --save game if tileSave(l+4,u+4) then dialogText("CHECKPOINT","game saved!","health restored") if not isSave then sfx(60,'D-5') p.health=p.maxHealth saveGame()effUp(5,p.x+4,p.y+4)isSave=true end else isSave=false end end ------------ function limitManager() local p=player --coyote jump time p.coyT=p.coyT-1 if p.coyT<0 then p.coyT=0 end --recover energy if t%15==0 then p.enSword=p.enSword+(p.armor==7 and 1 or 0.3) if not p.isShield then p.enShield=p.enShield+(p.armor==8 and 1 or 0.3) end end --regeneration (armor 6 ability) if p.armor==6 then p.tiRegen=p.tiRegen+1 if p.tiRegen==60*5 then effNumDam(p.x+5,p.y-2,"+1",5) p.health=p.health+1 p.tiRegen=0 end end --limit SOLAR PROMINENCE because it's so OP if p.sword==10 then if p.armor==11 then wpAttack[p.sword]=0 else wpAttack[p.sword]=1 end end --limit heart if p.health<0 then p.health=0 end if p.health>p.maxHealth then p.health=p.maxHealth end --limit energy shield if p.enShield<0 then p.enShield=0 end if p.enShield>p.enMax then p.enShield=p.enMax end --limit energy sword if p.enSword<0 then p.enSword=0 end if p.enSword>p.enMax then p.enSword=p.enMax end end ------ --effect local numDam={} function effNumDam(mx,my,mtext,mc) local s={x=mx,y=my,text=mtext,c=mc,t=0} numDam[#numDam+1]=s end function drawEffNumDam() for i,s in pairs(numDam) do local tLength=print(s.text,-8,-8) print(s.text,s.x-(tLength/2)+cam.x,s.y-4+cam.y,s.c,false,1,true) s.y=s.y-0.3 s.t=s.t+1 if s.t==30 then remove(numDam,i)end end end local slash={} function effSlash(mx,my,mf) local s={x=mx,y=my,f=mf,t=0,isSfx=false} slash[#slash+1]=s end function drawEffSlash() for i,s in pairs(slash) do if not s.isSfx then sfx(58,'E-6')s.isSfx=true end s.t=s.t+1 spr(232+t%12//3,s.x+cam.x,s.y+cam.y,0,1,s.f) if s.t==12 or player.sword==0 then remove(slash,i)end end end local spear={} function effSpear(mx,my,mvx,mvy,mf,msp,msz) local s={x=mx,y=my,vx=mvx,vy=mvy,f=mf,sp=msp,size=msz,t=0,isSfx=false} spear[#spear+1]=s end function drawEffSpear() for i,s in pairs(spear) do if not s.isSfx then sfx(58,'E-6')s.isSfx=true end s.t=s.t+1 spr(s.sp,s.x+cam.x,s.y+cam.y,0,1,s.f,0,s.size,s.size) s.x=s.x+s.vx s.y=s.y+s.vy if s.t==10 or player.sword==0 then remove(spear,i)end --attack player enemyAttack(s.x,s.x+4,s.y+2,s.y+4,4,1,1) end end local magic={} function effMagic(mx,my,md,mc) local s={x=mx,y=my,deg=md,c=mc,t=0} magic[#magic+1]=s end function drawEffMagic() for i,s in pairs(magic) do s.t=s.t+1 circ(s.x+cam.x,s.y+cam.y,3+t%10//5,s.c) local dir=rad(s.deg) s.x=s.x+sin(dir)s.y=s.y-cos(dir) if s.t==60 or player.sword==0 then remove(magic,i)end end end local sun={} function effSun(mx,my,mf) local s={x=mx,y=my,f=mf,t=0} sun[#sun+1]=s end function drawEffSun() for i,s in pairs(sun) do s.t=s.t+1 circ(s.x+cam.x,s.y+cam.y,8+t%10//5,3) circ(s.x+cam.x,s.y+cam.y,5-t%10//5,4) s.x=s.x+s.f*0.1 if s.t==90 or player.sword==0 then remove(sun,i)end end end local axePla={} function effAxePla(mx,my,mvx) local s={x=mx,y=my,vx=mvx,t=0} axePla[#axePla+1]=s end function drawEnemyAxePla() for i,s in pairs(axePla) do s.t=s.t+1 spr(400+t%24//8,s.x+cam.x,s.y+cam.y,6) s.x=s.x+s.vx if s.t==30 or player.sword==0 then remove(axePla,i)end end end local signText={ { "BLUE CATACOMB", "GOLDEN CAVE", "HAUNTED FOREST", "COURT OF THE CRIMSON KING", "KANEKES VILLAGE" }, { "it all started here and ended here.", "ancient people coated caves with gold for no reason.", "lost souls feast in this forest.", "welcome back my friends to the show that never ends.", "the village was built at the foot of the mountain and is still \nvery natural." } } local sign={} function effSign(mx,my,mt,mar) local s={x=mx,y=my,text=mt,area=mar} sign[#sign+1]=s end function drawSign() local p=player for i,s in pairs(sign) do spr(192,s.x+cam.x,s.y+cam.y) if p.x+4>s.x-4 and p.x+4s.y-4 and p.y+6p.x and 1 or 0) spr(s.sp,s.x+cam.x,s.y+cam.y-6,0,1,s.f,0,1,2) --text if s.tipe==2 then--chief if villRemain>0 then s.txt="missing villagers:"..villRemain.."" else s.idx=2 s.txt="" --small gift if not s.init then equipDrop(48,264,1,11,s.area)equipDrop(32,264,2,7,s.area)equipDrop(16,264,3,5,s.area) s.init=true end end end if p.x+4>s.x-4 and p.x+4s.y-4 and p.y+6=6 and p.armor<=8 then equipDrop(1608,280,2,shieldIdx[p.armor-5],s.area) s.idx=2 s.init=true else s.idx=1 end end end --help if s.isSafe then s.ti=s.ti+1 if s.ti==120 then for a=0,360,45 do effDam(s.x+4,s.y,a,13,1) end villRemain=villRemain-1 villSafe[s.idx]=1 end end --remove if s.area~=p.area or (s.tipe==1 and villSafe[s.idx]==1) then remove(vill,i)end end end local dm={} function effDam(mx,my,mdeg,mc,msfx) local e={ x=mx,y=my, deg=mdeg,spd=rnd(2,7)/10, t=0,r=3,col=mc, sf=msfx,isSfx=false } dm[#dm+1]=e end function drawEffDam() local c=cam for i,e in pairs(dm) do --sfx if not e.isSfx and e.sf==nil then sfx(62,'A-4')e.isSfx=true end --radius e.t=e.t+1 if e.t%8==0 then e.r=e.r-1 end --draw circ(e.x+c.x,e.y+c.y,e.r,e.col-e.r%2) --move local dir=rad(e.deg) e.x=e.x+sin(dir)*e.spd e.y=e.y-cos(dir)*e.spd --delete if e.t==32 then remove(dm,i) end end end local exp={} function effExplode(mx,my,mdeg,msp,mof,mti) local e={ x=mx,y=my,offs=mof, deg=mdeg,spd=msp, t=0,tim=mti } exp[#exp+1]=e end function drawEffExplode() local c=cam for i,e in pairs(exp) do e.t=e.t+1 --draw circ(e.x+c.x,e.y+c.y,3,4) --move local dir=rad(e.deg) e.x=(e.x+e.offs)+sin(dir)*e.spd e.y=(e.y+e.offs)-cos(dir)*e.spd --delete if e.t==32 then remove(exp,i) end end end local eup={} function effUp(mc,mx,my) local e={ x=mx,--(mx==nil and player.x+4 or mx), y=my,--(my==nil and player.y+4 or my), c=mc,r=16 } eup[#eup+1]=e end function drawEffUp() local p=player local c=cam for i,e in pairs(eup) do e.r=e.r-1 circb(e.x+c.x,e.y+c.y,e.r,e.c) if e.r<0 then p.eup=false remove(eup,i) end end end local dst={} function effDust(mx,my,mvx) local e={ x=mx,y=my, vx=mvx,vy=-(rnd(0,3)/10), r=3,t=0 } dst[#dst+1]=e end function drawEffDust() local c=cam for i,e in pairs(dst) do e.t=e.t+1 if e.t%8==0 then e.r=e.r-1 end --draw circ(e.x+c.x,e.y+c.y,e.r,12+e.r%2) --move e.x=e.x+e.vx*0.5 e.y=e.y+e.vy --delete if e.t==32 then remove(dst,i) end end end local eSmoke={} function effSmoke(mx,my) local e={ x=mx,y=my, vx=-(rnd(-2,2)/10),vy=-0.8, r=2,t=0 } eSmoke[#eSmoke+1]=e end function drawEffSmoke() local c=cam for i,e in pairs(eSmoke) do e.t=e.t+1 if e.t%8==0 then e.r=e.r-1 end --draw circ(e.x+c.x,e.y+c.y,e.r,12+e.r%2) --move e.x=e.x+e.vx e.y=e.y+e.vy --delete if e.t==40 then remove(eSmoke,i) end end end local eFly={} function effFly(mx,my) local e={x=mx,y=my,t=0} eFly[#eFly+1]=e end function drawEffFly() local c=cam for i,e in pairs(eFly) do e.t=e.t+1 pix(e.x+c.x,e.y+c.y,12) --delete if e.t==90 then remove(eFly,i) end end end function rOne(a1,a2) --return value to 1 local dist=a1-a2 if dist<0 then return -1 elseif dist>0 then return 1 else return 0 end end --enemy function enemySolid(l,r,u,d,w,h)--enemy collision local p=player return tileSolid(l-1,u+h/2) or tileSolid(r+1,u+h/2) or not tileSolid(l,d) or not tileSolid(r,d) or (l+w/2>p.x and l+w/2p.y and u+h/2l-offs and p.x+4u-offs and p.y+4=arBlock[(p.armor>0) and p.armor or 3] then shake=20 c.sh=true effNumDam(p.x+4,p.y,"-"..dam.."",4) for a=0,360,45 do effDam(p.x+4,p.y+4,a,2)end p.health=p.health-dam else effNumDam(p.x+8,p.y,"miss",12) end p.tiIsInv=2 p.isInv=true end end end function enemyDamage(mx,my,w,h,md) local p=player local u=my local d=my+h local l=mx local r=mx+w --by sword for _,s in pairs(slash) do if not md and s.x-2l and s.yu then return 1 end end --by spear for _,s in pairs(spear) do if not md and s.x-2l and s.yu then return 2 end end --by magic for _,s in pairs(magic) do if not md and s.x-3l and s.y-3u then return 3 end end --by magic sun for _,s in pairs(sun) do if not md and s.x-8l and s.y-8u then return 4 end end --by axe for _,s in pairs(axePla) do if not md and s.x-2l and s.yu then return 6 end end --by shield if not md and p.isShield and p.x+4>l-4 and p.x+4u-4 and p.y+40 then b.tAtt=b.tAtt+1 end if b.tAtt>110 and b.tAtt<140 then if b.tAtt%10==0 then effUp(4,b.x+23,b.y+10)end elseif b.tAtt>140 then if b.tAtt==141 then b.idAtt=rnd(0,2)end --attack 1 (spawn skulang) if b.idAtt==0 then if b.tAtt==142 then for i=1,4 do for a=0,360,45 do effDam(b.spawnPos[i]*8,944,a,13,1) end enemySkulang(b.spawnPos[i]*8,944,b.area) end end if b.tAtt==360 then b.tAtt=-60 end --attack 2 (spawn skull head) else if b.tAtt%30==0 then enemySkulSh(b.x+23,b.y+10,b.area)end if b.tAtt==360 then b.tAtt=-90 end end end --damage if b.h>0 and enemyDamage(b.x,b.y,32,32,b.isDam)>0 and enemyDamage(b.x,b.y,32,32,b.isDam)~=5 then if not b.isAtt then b.isAtt=true end b.h=b.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(b.x+23,b.y+10,0,0,2)b.isDam=true for i,s in pairs(axePla) do remove(axePla,i) end end if b.isDam then b.t=b.t+1 if b.t>12 then b.isDam=false b.t=0 end end --death if b.h<=0 then music()b.tDeath=b.tDeath+1 b.tAtt=0 if b.tDeath%15==0 then enemyHurt(b.x+23,b.y+10,0,0,2)end if b.tDeath==150 then b.isLife=false end end --restore if p.isOver then b.h=b.maxH b.tAtt=0 b.isAtt=false end end end end local bos2={ x=116,y=608,vx=.5, f=0,offs=1,anim=0, maxH=25,h=25, area=26, idAtt=0, tAtt=0,tDam=0,tDeath=0, isReady=false,isAtt=false,isDam=false,isLife=true, init=false } function drawEnemyBos2() local p=player local b=bos2 --check area if b.area~=p.area then b.init=false end --init if not b.init and b.area==p.area then --if death if not b.isLife then equipDrop(104,560,1,4,b.area)equipDrop(128,560,6,2,b.area) b.init=true --if life else local u=b.y local d=b.y+9 local l=b.x local r=b.x+8 --movement if b.isReady and b.h>0 and not b.isAtt then if b.x-18 and b.f==0) or (b.x-p.x<18 and b.f==1)then b.isAtt=true end else b.anim=0 if b.h>0 then b.tAtt=b.tAtt+1 end if b.tAtt==30 then b.idAtt=rnd(0,2) --attack 1 (summon bat) if b.idAtt==0 then sfx(57,'A-5') for a=0,360,45 do effDam(b.x+4,b.y-16,a,13,1)end enemyBat(b.x+4,b.y-16,b.area) --attack 2 (spear) else effSpear(b.x+10*b.offs,b.y-2,2*b.offs,-2,b.f,441,1) effSpear(b.x+10*b.offs,b.y+1,2*b.offs,0,b.f,442,1) effSpear(b.x+10*b.offs,b.y+2,2*b.offs,2,b.f,443,1) end elseif b.tAtt==60 then b.isAtt=false b.tAtt=0 end end --damage if b.h>0 and enemyDamage(l,u,8,8,b.isDam)>0 then --by shield if enemyDamage(l,u,8,8,b.isDam)==5 then if shAttack[p.shield]>0 then b.h=b.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,1)b.isDam=true end --by weapon elseif enemyDamage(l,u,8,8,b.isDam)~=0 then b.h=b.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,2)b.isDam=true end end if b.isDam then b.tDam=b.tDam+1 if b.tDam>12 then b.isDam=false b.tDam=0 end end --death if b.h<=0 then music()b.tDeath=b.tDeath+1 b.tAtt=0 if b.tDeath%15==0 then enemyHurt(l,u,4,4,2)end if b.tDeath==150 then b.isLife=false end end --restore if p.isOver then b.x=116 b.y=608 b.h=b.maxH b.tAtt=0 b.isAtt=false end end end end local bos3={ x=104,y=344, sp=452,anim=0, maxH=35,h=35, t=0,tAnim=0,tAtt=0,tDeath=0, idAtt=1, area=32, drop=rnd(0,2), isLife=true,isReady=false,isAtt=false,isDam=false,isBers=false, init=false } function drawEnemyBos3() local p=player local b=bos3 --check area if b.area~=p.area then b.init=false end --init if not b.init and b.area==p.area then --if death if not b.isLife then b.x=104 b.y=344 equipDrop(b.x,b.y,1,6+b.drop,b.area)equipDrop(b.x+24,b.y,6,3,b.area) b.init=true --if life else --draw spr(b.sp+b.anim,b.x+cam.x,b.y+cam.y,0,1,0,0,2,4) spr(b.sp+b.anim,b.x+16+cam.x,b.y+cam.y,0,1,1,0,2,4) --attack if not b.isReady then if p.x<192 then b.tAnim=b.tAnim+1 end b.anim=b.tAnim%60//20*2 if b.tAnim==50 then b.anim=4 b.isReady=true end else if b.h>0 then b.tAtt=b.tAtt+1 end if b.h>b.maxH/2 then if b.tAtt>90 and b.tAtt<120 then if b.tAtt%10==0 then effUp(4,b.x+16,b.y+5)end elseif b.tAtt==121 then b.idAtt=rnd(1,2) elseif b.tAtt>125 then --attack 1 (bullet) if b.idAtt==1 then if b.tAtt%30==0 then sfx(57,'A-5') for a=0+(b.tAtt%60//30*22.5),360,45 do enemyMagicSh(b.x+16,b.y+5,a)end end if b.tAtt==250 then b.tAtt=0 end --attack 2 (phantom) else sfx(57,'A-5') for a=0,360,45 do effDam(b.x+16,b.y+5,a,13,1)end enemyPhantom(b.x+16,b.y+5,b.area) b.tAtt=0 end end else --attack 3 (berserk) if not b.isBers then b.tAtt=60 b.isBers=true end if b.tAtt==1 then local rndX=rnd(8,200)local rndY=rnd(320,348)b.x=rndX b.y=rndY elseif b.tAtt==15 then b.anim=2 elseif b.tAtt==30 then b.anim=4 elseif b.tAtt==50 then b.anim=4 sfx(57,'A-6')enemyMagicSh(b.x+16,b.y+5) elseif b.tAtt==70 then b.anim=2 elseif b.tAtt==85 then b.anim=0 elseif b.tAtt==120 then b.tAtt=0 end end end --damage if b.h>0 and enemyDamage(b.x,b.y,32,32,b.isDam)>0 and enemyDamage(b.x,b.y,32,32,b.isDam)~=5 then if not b.isAtt then b.isAtt=true end b.h=b.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(b.x+16,b.y+5,0,0,2)b.isDam=true for i,s in pairs(axePla) do remove(axePla,i) end end if b.isDam then b.t=b.t+1 if b.t>12 then b.isDam=false b.t=0 end end --death if b.h<=0 then music()b.tDeath=b.tDeath+1 b.tAtt=0 if b.tDeath%15==0 then enemyHurt(b.x+16,b.y+5,0,0,2)end if b.tDeath==150 then b.isLife=false end end --restore if p.isOver then b.x=104 b.y=344 b.anim=4 b.h=b.maxH b.tAtt=0 b.isAtt=false end end end end local bos5={ x=1784,y=8,dx=0,dy=0,dist=0,spd=2, maxH=65,h=65, t=0,tAnim=0,tAtt=0,tDeath=0,tIdl=0,anim=0, idAtt=1, area=48, isLife=false,isReady=false,isAtt=false, init=false, dialog={ "What a shame! My power is used by a weak person like him.\nnow it's my turn.", "I-IMPOSIBLE..." } } function drawEnemyBos5() local p=player local b=bos5 --check area if b.area~=p.area then b.init=false end --init if not b.init and b.area==p.area then --if death if not b.isLife then b.init=true --if life else --draw for i=1728,1840,112 do spr(494,i+cam.x,0+cam.y,6,1,0,0,2,2)spr(494,i+16+cam.x,0+cam.y,6,1,1,0,2,2) end spr(462,1784+cam.x,0+cam.y,6,1,0,0,2,2) spr(462,1800+cam.x,0+cam.y,6,1,1,0,2,2) spr(458+b.anim,b.x+cam.x,b.y+cam.y+b.anim,6,1,0,0,2,4) spr(458+b.anim,b.x+16+cam.x,b.y+cam.y+b.anim,6,1,1,0,2,4) --attack if b.h>0 then enemyAttack(b.x+4,b.x+28,b.y+4,b.y+28,16,1,1)end if not b.isAtt then b.anim=t%60//30*2 if b.isReady then b.tAtt=b.tAtt+1 else dialogText("TARKUS",b.dialog[1],"")p.isPause=true if btnp(4)then p.isPause=false b.isReady=true end end if b.tAtt==60 then b.isAtt=true end else b.anim=0 if b.h>0 then b.tAtt=b.tAtt+1 end if b.tAtt>60 and b.tAtt<90 then if b.tAtt%10==0 then effUp(4,b.x+16,b.y+9)end elseif b.tAtt==91 then b.idAtt=rnd(1,6) elseif b.tAtt>95 then --attack 1 (crash) if b.idAtt<=2 then if b.tAtt>95 and b.tAtt<135 then if b.tAtt==96 then b.dx=p.x-16-b.x b.dy=p.y-b.y b.dist=sqrt((b.dx*b.dx)+(b.dy*b.dy)) end if b.h>0 then b.x=b.x+(b.dx/b.dist)*b.spd b.y=b.y+(b.dy/b.dist)*b.spd end elseif b.tAtt>195 and b.tAtt<235 then if b.tAtt==196 then b.dx=1784-b.x b.dy=8-b.y b.dist=sqrt((b.dx*b.dx)+(b.dy*b.dy)) end if b.h>0 then b.x=b.x+(b.dx/b.dist)*b.spd b.y=b.y+(b.dy/b.dist)*b.spd end elseif b.tAtt==236 then b.tAtt=-30 b.isAtt=false end --attack 2 (phantom) elseif b.idAtt==3 then for i=1744,1856,112 do for a=0,360,45 do effDam(i,b.y+5,a,13,1) end enemyPhantom(i,b.y+5,b.area) end b.tAtt=-30 b.isAtt=false --attack 3 (ball small) elseif b.idAtt==4 then if b.tAtt%30==0 then enemyMagicSh(b.x+16,b.y+9)end if b.tAtt==600 then b.tAtt=-30 b.isAtt=false end --attack 4 (ball big) elseif b.idAtt==5 then if b.tAtt==96 or b.tAtt==210 then enemyBalBig(b.x+16,b.y+9,-1,1)enemyBalBig(b.x+16,b.y+9,1,1) elseif b.tAtt==211 then b.tAtt=-210 b.isAtt=false end --attack 5 (meteor) elseif b.idAtt==6 then if b.tAtt%30==0 then enemyMeteor(rnd(211,238)*8,-16)end if b.tAtt==600 then b.tAtt=-30 b.isAtt=false end end end end --damage if b.h>0 and enemyDamage(b.x,b.y,32,32,b.isDam)>0 then --by shield if enemyDamage(b.x,b.y,32,32,b.isDam)==5 then if shAttack[p.shield]>0 then b.h=b.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(b.x+16,b.y+9,0,0,1)b.isDam=true end --by weapon elseif enemyDamage(b.x,b.y,32,32,b.isDam)~=0 then b.h=b.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(b.x+16,b.y+9,0,0,2)b.isDam=true end end if b.isDam then b.t=b.t+1 if b.t>12 then b.isDam=false b.t=0 end end --death if b.h<=0 then music()b.tDeath=b.tDeath+1 b.tAtt=0 p.isPause=true dialogText("TARKUS",b.dialog[2],"") if b.tDeath%15==0 then enemyHurt(b.x+16,b.y+9,0,0,2)end if b.tDeath==300 then tPal=0 if tPal<60 then tPal=tPal+1 for c=1,15 do pal(c,(c-2)-tPal//20)end end elseif b.tDeath==355 then music(2,-1,-1,false)tPal=0 scn=4 end end --restore if p.isOver then b.x=1784 b.y=8 b.h=b.maxH b.tAtt=0 b.isAtt=false end end end end local bos4={ x=1796,y=88,vx=.9, f=1,offs=-1,anim=0, maxH=70,h=70, area=48, idAtt=0, tAtt=0,tDam=0,tDeath=0,tmEf=0, isReady=false,isAtt=false,isDam=false,isLife=true, init=false,idx=1, name={"KING LAKE","EMERSON","KING LAKE","KING LAKE"}, dialog={ "emerson... my old friend. I can't believe you could come here.\nCome join me and we will rule this world together.", "I refuse! I will kill you now so I can rest in peace again.", "Emerson... you never change.", "AAHHHH... MY POWER..." } } function drawEnemyBos4() local p=player local b=bos4 --check area if b.area~=p.area then b.init=false end --init if not b.init and b.area==p.area then --if death if not b.isLife then bos5.init=false bos5.isLife=true b.init=true --if life else local u=b.y local d=b.y+9 local l=b.x local r=b.x+8 --movement if b.isReady and b.h>0 and not b.isAtt then if b.x1704 and not b.isReady then if btnp(4) then sfx(61,'E-3')b.idx=b.idx+1 end if b.idx==4 then p.isPause=false b.isReady=true else p.isPause=true dialogText(b.name[b.idx],b.dialog[b.idx],"")end end end --draw if not b.isAtt then spr(307,((l+4*b.offs)+b.anim)+cam.x,u-2+cam.y,10,1,b.f) end spr(275,l+cam.x,u+cam.y+2,0,1,b.f) spr(259,l+cam.x,u-3+cam.y-2,0,1,b.f) spr(270+b.anim,l+cam.x,u+7+cam.y,0,1,b.f) spr(323,((l-4*b.offs)-b.anim)+cam.x,u+cam.y,10,1,b.f) --smoke if b.h-18 and b.f==0) or (b.x-p.x<18 and b.f==1)then b.isAtt=true end else b.anim=0 if b.h>0 then b.tAtt=b.tAtt+1 end if b.tAtt==30 then b.idAtt=rnd(0,4) --attack 1 (summon crow) if b.idAtt==0 then for a=0,360,45 do effDam(b.x+4,b.y-16,a,13,1) end enemyCrow(b.x+4,b.y-16,b.area) --attack 2 (sword) else effSpear(l+10*b.offs,u+1,2*b.offs,0,b.f,250,1) end elseif b.tAtt==60 then b.isAtt=false b.tAtt=0 end end --damage if b.h>0 and enemyDamage(l,u,8,8,b.isDam)>0 then --by shield if enemyDamage(l,u,8,8,b.isDam)==5 then if shAttack[p.shield]>0 then b.h=b.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,1)b.isDam=true end --by weapon elseif enemyDamage(l,u,8,8,b.isDam)~=0 then b.h=b.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,2)b.isDam=true end end if b.isDam then b.tDam=b.tDam+1 if b.tDam>12 then b.isDam=false b.tDam=0 end end --death if b.h<=0 then b.tDeath=b.tDeath+1 b.tAtt=0 if b.tDeath%15==0 then enemyHurt(b.x,b.y,4,4,2)end if b.tDeath==300 then p.isPause=false b.isLife=false else p.isPause=true dialogText(b.name[b.idx],b.dialog[b.idx],"")end end --restore if p.isOver then b.x=1796 b.y=88 b.h=b.maxH b.tAtt=0 b.isAtt=false end end end end local phantom={} function enemyPhantom(mx,my,mar) local e={x=mx,y=my,t=0,isDam=false,area=mar} phantom[#phantom+1]=e end function drawEnemyPhantom() local p=player for i,e in pairs(phantom) do --movement local dx=p.x-e.x local dy=p.y-e.y local dist=sqrt((dx*dx)+(dy*dy)) e.x=e.x+(dx/dist)e.y=e.y+(dy/dist) --draw spr(330+t%20//5,e.x+cam.x,e.y+cam.y,0,1,(p.x>e.x and 0 or 1)) --attack enemyAttack(e.x,e.x+8,e.y,e.y+8,4,1,2) if p.x+4>e.x and p.x+4e.y and p.y+40 then --by shield if enemyDamage(e.x,e.y,8,8,e.isDam)==5 then if shAttack[p.shield]>0 then local dr=rnd(4,9) if dr<6 then equipDrop(e.x,e.y,dr,0,e.area)end remove(phantom,i) enemyHurt(e.x,e.y,8,8,1)e.isDam=true end --by weapon else local dr=rnd(4,9) if dr<6 then equipDrop(e.x,e.y,dr,0,e.area)end remove(phantom,i) enemyHurt(e.x,e.y,4,4,2)e.isDam=true end end --remove if e.area~=p.area then remove(phantom,i) end end end local balBig={} function enemyBalBig(mx,my,mvx,mvy) local s={x=mx,y=my,vx=mvx,vy=mvy,t=0,isSfx=false} balBig[#balBig+1]=s end function drawEnemyBalBig() for i,s in pairs(balBig) do if not s.isSfx then sfx(59,'C-7')s.isSfx=true end s.t=s.t+1 circ(s.x+cam.x,s.y+cam.y,8+t%10//5,3+t%10//5) enemyAttack(s.x-8,s.x+8,s.y-8,s.y+8,0,1,2) --bounce if tileSolid(s.x-4,s.y-2)or tileSolid(s.x-4,s.y+2)or tileSolid(s.x+4,s.y-2) or tileSolid(s.x+4,s.y+2)then s.vx=s.vx*-1 end if tileSolid(s.x+2,s.y-4)or tileSolid(s.x-2,s.y-4)or tileSolid(s.x+2,s.y+4) or tileSolid(s.x-2,s.y+4)then s.vy=s.vy*-1 end --move s.x=s.x+s.vx s.y=s.y+s.vy if s.t==480 then remove(balBig,i)end end end local meteor={} function enemyMeteor(mx,my) local s={x=mx,y=my,t=0,isSfx=false} meteor[#meteor+1]=s end function drawEnemymeteor() for i,s in pairs(meteor) do if not s.isSfx then sfx(59,'C-7')s.isSfx=true end if t%20==0 then effSmoke(s.x,s.y)end circ(s.x+cam.x,s.y+cam.y,8+t%10//5,2+t%10//5) enemyAttack(s.x-8,s.x+8,s.y-8,s.y+8,0,1,2) s.t=s.t+1 s.y=s.y+1 if s.t==120 then remove(meteor,i)end end end local eDryCac={} function enemyDryCactus(mx,my,mar) local e={x=mx,y=my,h=3,t=0,area=mar,isDam=false} eDryCac[#eDryCac+1]=e end function drawEnemyDryCactus() local p=player for i,e in pairs(eDryCac) do --draw spr(336+t%120//69,e.x+cam.x,e.y+cam.y,0,1,0,0,1,2) spr(336+t%120//69,(e.x+8)+cam.x,e.y+cam.y,0,1,1,0,1,2) --attack enemyAttack(e.x,e.x+16,e.y,e.y+16,8,9,1) --damage if enemyDamage(e.x,e.y,16,16,e.isDam)>0 then --by shield if enemyDamage(e.x,e.y,16,16,e.isDam)==5 then if shAttack[p.shield]>0 then e.h=e.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(e.x,e.y,8,8,1)e.isDam=true end --by weapon else e.h=e.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(e.x,e.y,8,8,2)e.isDam=true end end if e.isDam then e.t=e.t+1 if e.t>12 then e.isDam=false e.t=0 end end --death if e.h<=0 then equipDrop(e.x+4,e.y,5,0,e.area) remove(eDryCac,i) end --remove if e.area~=p.area or p.isOver then remove(eDryCac,i) end end end local skulang={} function enemySkulang(mx,my,mar) local e={ x=mx,y=my, vx=.3,vy=0, f=0,h=1,t=0, area=mar, isDam=false } skulang[#skulang+1]=e end function drawEnemySkulang() local p=player for i,e in pairs(skulang) do local u=e.y+e.vy local d=e.y+e.vy+9 local l=e.x+e.vx local r=e.x+e.vx+8 --movement if enemySolid(l,r,u,d,8,8) then e.f=e.f==0 and 1 or 0 e.vx=e.vx*-1 end if e.vy==0 then e.x=e.x+e.vx end --gravity if tileSolid(l+4,d-1) or tileSolid(r-4,d-1) then e.vy=0 else e.vy=e.vy+0.1 end e.y=e.y+e.vy --attack enemyAttack(l,r,u,d,4,1,1) --damage if enemyDamage(l,u,8,8,e.isDam)>0 then --by shield if enemyDamage(e.x,e.y,8,8,e.isDam)==5 then if shAttack[p.shield]>0 then e.h=e.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,1)e.isDam=true end --by weapon elseif enemyDamage(e.x,e.y,8,8,e.isDam)~=0 then e.h=e.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,2)e.isDam=true end end --death if e.h<=0 then local dr=rnd(4,7) if dr<6 then equipDrop(l,u,dr,0,e.area)end remove(skulang,i) end --remove if e.area~=p.area then remove(skulang,i) end --draw spr(340+t%24//12,e.x+cam.x,e.y+cam.y,5,1,e.f) end end local skely={} function enemySkely(mx,my,mar) local e={x=mx,y=my,vx=.6,offs=1,f=0,h=2,t=0,area=mar,isDam=false} skely[#skely+1]=e end function drawEnemySkely() local p=player local anim=t%24//12 for i,e in pairs(skely) do local u=e.y local d=e.y+9 local l=e.x local r=e.x+8 --movement if enemySolid(l,r,u,d,8,8) then e.f=e.f==0 and 1 or 0 e.offs=e.offs==1 and -1 or 1 e.vx=e.vx*-1 end e.x=e.x+e.vx --attack enemyAttack(l,r,u,d,4,1,1) --damage if enemyDamage(l,u,8,8,e.isDam)>0 then --by shield if enemyDamage(e.x,e.y,8,8,e.isDam)==5 then if shAttack[p.shield]>0 then e.h=e.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,1)e.isDam=true end --by weapon elseif enemyDamage(e.x,e.y,8,8,e.isDam)~=0 then e.h=e.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,2)e.isDam=true end end if e.isDam then e.t=e.t+1 if e.t>12 then e.isDam=false e.t=0 end end --death if e.h<=0 then local dr=rnd(0,10) if dr<7 then equipDrop(l,u,3,2,e.area)end remove(skely,i) end --remove if e.area~=p.area then remove(skely,i) end --draw spr(306,((e.x+3*e.offs)+anim)+cam.x,u-2+cam.y,10,1,e.f) spr(272,l+cam.x,u+cam.y+2,0,1,e.f) spr(367,l+cam.x,e.y-3+cam.y-2,0,1,e.f) spr(270+anim,e.x+cam.x,u+7+cam.y,0,1,e.f) spr(320,((l-4*e.offs)-anim)+cam.x,u+cam.y,10,1,e.f) end end local keeper={} function enemyKeeper(mx,my,mar) local e={x=mx,y=my,vx=.3,offs=1,f=0,h=2,t=0,area=mar,isDam=false} keeper[#keeper+1]=e end function drawEnemyKeeper() local p=player local anim=t%30//15 for i,e in pairs(keeper) do local u=e.y local d=e.y+9 local l=e.x local r=e.x+8 --movement if enemySolid(l,r,u,d,8,8) then e.f=e.f==0 and 1 or 0 e.offs=e.offs==1 and -1 or 1 e.vx=e.vx*-1 end e.x=e.x+e.vx --attack enemyAttack(l,r,u,d,4,1,1) --damage if enemyDamage(l,u,8,8,e.isDam)>0 then if (e.offs==1 and l>p.x) or (e.offs==-1 and l0 then e.h=e.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,1)e.isDam=true end --by weapon elseif enemyDamage(e.x,e.y,8,8,e.isDam)~=0 then e.h=e.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,2)e.isDam=true end else effNumDam(l+4,u,"miss",12)e.isDam=true end end if e.isDam then e.t=e.t+1 if e.t>12 then e.isDam=false e.t=0 end end --death if e.h<=0 then local dr=rnd(0,10) if dr<8 then equipDrop(l,u,2,2,e.area)end remove(keeper,i) end --remove if e.area~=p.area then remove(keeper,i) end --draw spr(318,((e.x-4*e.offs)+anim)+cam.x,u-2+cam.y,0,1,(e.f==0 and 1 or 0)) spr(344+anim,l+cam.x,u+cam.y,0,1,e.f) spr(343,l+cam.x,e.y-2+cam.y-2,0,1,e.f) spr(322,((l+5*e.offs)-anim)+cam.x,u+cam.y,10,1,e.f) end end local bug={} function enemyBug(mx,my,mar) local e={x=mx,y=my,vx=.3,f=0,h=3,t=0,area=mar,isDam=false} bug[#bug+1]=e end function drawEnemyBug() local p=player for i,e in pairs(bug) do local u=e.y local d=e.y+9 local l=e.x local r=e.x+8 --movement if enemySolid(l,r,u,d,8,8) then e.f=e.f==0 and 1 or 0 e.vx=e.vx*-1 end e.x=e.x+e.vx --attack enemyAttack(l,r,u,d,4,1,1) --damage if enemyDamage(l,u,8,8,e.isDam)>0 then --by shield if enemyDamage(e.x,e.y,8,8,e.isDam)==5 then if shAttack[p.shield]>0 then e.h=e.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,1)e.isDam=true end --by weapon elseif enemyDamage(e.x,e.y,8,8,e.isDam)~=0 then e.h=e.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,2)e.isDam=true end end if e.isDam then e.t=e.t+1 if e.t>12 then e.isDam=false e.t=0 end end --death if e.h<=0 then local dr=rnd(4,8) if dr<6 then equipDrop(l,u,dr,0,e.area)end remove(bug,i) end --remove if e.area~=p.area then remove(bug,i) end --draw spr(346+t%24//12,e.x+cam.x,e.y+cam.y,0,1,e.f) end end local spearman={} function enemySpearman(mx,my,mar) local e={x=mx,y=my,h=3,t=0,tAtt=0,f=0,offs=1,area=mar,isDam=false} spearman[#spearman+1]=e end function drawEnemySpearman() local p=player for i,e in pairs(spearman) do --flip e.f=(e.x>p.x and 1 or 0) e.offs=(e.x>p.x and -1 or 1) --draw if e.tAtt>10 then spr(311,(e.x+4*e.offs)+cam.x,e.y-2+cam.y,10,1,e.f) end spr(276,e.x+cam.x,e.y+cam.y+2,0,1,e.f) spr(367,e.x+cam.x,e.y-3+cam.y-2,0,1,e.f) spr(270,e.x+cam.x,e.y+7+cam.y,0,1,e.f) spr(320,(e.x-4*e.offs)+cam.x,e.y+cam.y,10,1,e.f) --attack enemyAttack(e.x-2,e.x+10,e.y,e.y+8,4,1,1) e.tAtt=e.tAtt+1 if e.tAtt>90 then effSpear(e.x+10*e.offs,e.y+1,2*e.offs,0,e.f,248,1) e.tAtt=0 end --damage if enemyDamage(e.x,e.y,8,8,e.isDam)>0 then --by shield if enemyDamage(e.x,e.y,8,8,e.isDam)==5 then if shAttack[p.shield]>0 then e.h=e.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(e.x,e.y,4,4,1)e.isDam=true end --by weapon else e.h=e.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(e.x,e.y,4,4,2)e.isDam=true end end if e.isDam then e.t=e.t+1 if e.t>12 then e.isDam=false e.t=0 end end --death if e.h<=0 then local dr=rnd(0,10) if dr<4 then equipDrop(e.x,e.y,3,7,e.area)end remove(spearman,i) end --remove if e.area~=p.area then remove(spearman,i) end end end local miner={} function enemyMiner(mx,my,mar) local e={x=mx,y=my,vx=.5,offs=1,f=0,h=4,t=0,area=mar,isDam=false} miner[#miner+1]=e end function drawEnemyMiner() local p=player local anim=t%30//15 for i,e in pairs(miner) do local u=e.y local d=e.y+9 local l=e.x local r=e.x+8 --movement if enemySolid(l,r,u,d,8,8) then e.f=e.f==0 and 1 or 0 e.offs=e.offs==1 and -1 or 1 e.vx=e.vx*-1 end e.x=e.x+e.vx --attack enemyAttack(l,r,u,d,4,1,1) --damage if enemyDamage(l,u,8,8,e.isDam)>0 then if (e.offs==1 and l>p.x) or (e.offs==-1 and l0 then e.h=e.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,1)e.isDam=true end --by weapon elseif enemyDamage(e.x,e.y,8,8,e.isDam)~=0 then e.h=e.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,2)e.isDam=true end else effNumDam(l+4,u,"miss",12)e.isDam=true end end if e.isDam thenV e.t=e.t+1 if e.t>12 then e.isDam=false e.t=0 end end --death if e.h<=0 then local dr=rnd(0,10) if dr<6 then equipDrop(l,u,2,4,e.area)end remove(miner,i) end --remove if e.area~=p.area then remove(miner,i) end --draw spr(319,((e.x-4*e.offs)+anim)+cam.x,u-2+cam.y,0,1,(e.f==0 and 1 or 0)) spr(360+anim,l+cam.x,u+cam.y,0,1,e.f) spr(359,l+cam.x,e.y-2+cam.y-2,0,1,e.f) spr(324,((l+5*e.offs)-anim)+cam.x,u+cam.y,10,1,e.f) end end local bat={} function enemyBat(mx,my,mar) local e={x=mx,y=my,t=0,isDam=false,area=mar} bat[#bat+1]=e end function drawEnemyBat() local p=player for i,e in pairs(bat) do --movement local dx=p.x-e.x local dy=p.y-e.y local dist=sqrt((dx*dx)+(dy*dy)) if p.x>e.x-136 and p.x0 then --by shield if enemyDamage(e.x,e.y,8,8,e.isDam)==5 then if shAttack[p.shield]>0 then local dr=rnd(4,8) if dr<6 then equipDrop(e.x,e.y,dr,0,e.area)end remove(bat,i) enemyHurt(e.x,e.y,8,8,1)e.isDam=true end --by weapon else local dr=rnd(4,8) if dr<6 then equipDrop(e.x,e.y,dr,0,e.area)end remove(bat,i) enemyHurt(e.x,e.y,4,4,2)e.isDam=true end end --remove if e.area~=p.area then remove(bat,i) end end end local ghost={} function enemyGhost(mx,my,mar) local e={x=mx,y=my,vx=.3,f=0,h=1,t=0,tInv=0,area=mar,isInv=false,isDam=false} ghost[#ghost+1]=e end function drawEnemyGhost() local p=player for i,e in pairs(ghost) do local u=e.y local d=e.y+9 local l=e.x local r=e.x+16 --movement if enemySolid(l,r,u,d,8,8) then e.f=e.f==0 and 1 or 0 e.vx=e.vx*-1 end e.x=e.x+e.vx --attack if not e.isInv then enemyAttack(l,r,u,d,8,1,2)end --damage if enemyDamage(l,u-8,16,16,e.isDam)>0 then --by shield if enemyDamage(l,u-8,16,16,e.isDam)==5 then if shAttack[p.shield]>0 then e.isInv=true effNumDam(l+8,u-4,"miss",12)e.isDam=true end --by magic elseif enemyDamage(l,u-8,16,16,e.isDam)==3 or enemyDamage(e.x,e.y,16,16,e.isDam)==4 then e.h=e.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,8,4,2)e.isDam=true --by weapon else e.isInv=true effNumDam(l+8,u-4,"miss",12)e.isDam=true end end if e.isDam then e.t=e.t+1 if e.t>12 then e.isDam=false e.t=0 end end --death if e.h<=0 then local dr=rnd(0,10) if dr<1 then equipDrop(e.x,e.y,1,5,e.area)end remove(ghost,i) end --remove if e.area~=p.area then remove(ghost,i) end --draw if e.isInv then e.tInv=e.tInv+1 if e.tInv==120 then e.isInv=false e.tInv=0 end if time()%50>25 then spr(370+t%36//9*2,e.x+cam.x,e.y-8+cam.y,6,1,e.f,0,2,2) end else spr(370+t%36//9*2,e.x+cam.x,e.y-8+cam.y,6,1,e.f,0,2,2) end end end local appler={} function enemyAppler(mx,my,mar) local e={ x=mx,y=my, vx=0,vy=0, flip=0, h=1,t=0, area=mar, init=false,isBreak=false } appler[#appler+1]=e end function drawEnemyAppler() local p=player for i,e in pairs(appler) do --movement if not e.isBreak then if p.x+4>e.x-2 and p.x+40 then --by shield if enemyDamage(e.x,e.y,16,16,e.isDam)==5 then if shAttack[p.shield]>0 then e.h=e.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(e.x,e.y,8,8,1)e.isDam=true end --by weapon else e.h=e.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(e.x,e.y,8,8,2)e.isDam=true end end --death if e.h<=0 then local dr=rnd(0,10) if dr<4 then equipDrop(e.x,e.y,3,12,e.area)end remove(appler,i) end --remove if e.area~=p.area then remove(appler,i) end end end local watcher={} function enemyWatcher(mx,my,mar) local e={x=mx,y=my,t=0,tEff=0,h=3,isDam=false,area=mar} watcher[#watcher+1]=e end function drawEnemyWatcher() local p=player for i,e in pairs(watcher) do --movement local dx=p.x-e.x local dy=p.y-e.y local dist=sqrt((dx*dx)+(dy*dy)) if p.x>e.x-136 and p.x0 then --by shield if enemyDamage(e.x,e.y,8,8,e.isDam)==5 then if shAttack[p.shield]>0 then e.h=e.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(e.x,e.y,4,4,1)e.isDam=true end --by weapon else e.h=e.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(e.x,e.y,4,4,2)e.isDam=true end end if e.isDam then e.t=e.t+1 if e.t>12 then e.isDam=false e.t=0 end end --death if e.h<=0 then local dr=rnd(0,10) if dr<4 then equipDrop(e.x,e.y,1,9,e.area) else local dr=rnd(4,8) if dr<6 then equipDrop(e.x,e.y,dr,0,e.area)end end remove(watcher,i) end --remove if e.area~=p.area then remove(watcher,i) end end end local magicSh={} function enemyMagicSh(mx,my,md) local e={x=mx,y=my,deg=md,dx=0,dy=0,dist=0,init=false,t=0} magicSh[#magicSh+1]=e end function drawEnemyMagicSh() local p=player for i,e in pairs(magicSh) do circ(e.x+cam.x,e.y+cam.y,3-t%10//5,11) --movement if e.deg==nil then if not e.init then e.dx=p.x-e.x e.dy=p.y-e.y e.dist=sqrt((e.dx*e.dx)+(e.dy*e.dy)) e.init=true end e.x=e.x+e.dx/e.dist e.y=e.y+e.dy/e.dist else local dir=rad(e.deg) e.x=e.x+sin(dir)e.y=e.y-cos(dir) end --attack enemyAttack(e.x-4,e.x+4,e.y-4,e.y+4,0,1,2) --remove e.t=e.t+1 if e.t==120 then remove(magicSh,i) end end end local magician={} function enemyMagician(mx,my,mar) local e={x=mx,y=my,h=1,t=0,sp=404,area=mar,isDam=false} magician[#magician+1]=e end function drawEnemyMagician() local p=player for i,e in pairs(magician) do local u=e.y local d=e.y+8 local l=e.x local r=e.x+8 --movement if p.x>e.x-136 and p.x0 then --by shield if enemyDamage(e.x,e.y,8,8,e.isDam)==5 then if shAttack[p.shield]>0 then e.h=e.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,1)e.isDam=true end --by weapon elseif enemyDamage(e.x,e.y,8,8,e.isDam)~=0 then e.h=e.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,2)e.isDam=true end end --death if e.h<=0 then local dr=rnd(0,10) if dr<2 then equipDrop(e.x,e.y,3,9,e.area) else local dr=rnd(4,8) if dr<6 then equipDrop(e.x,e.y,dr,0,e.area)end end remove(magician,i) end --remove if e.area~=p.area then remove(magician,i) end --draw spr(e.sp,e.x+cam.x,e.y+cam.y,0) end end local cacSh={} function enemyCacSh(mx,my,mvx) local e={x=mx,y=my,vx=mvx,t=0} cacSh[#cacSh+1]=e end function drawEnemyCacSh() for i,e in pairs(cacSh) do circ(e.x+cam.x,e.y+cam.y,3-t%10//5,12) e.x=e.x+e.vx enemyAttack(e.x-4,e.x+4,e.y-4,e.y+4,0,1,2) --remove e.t=e.t+1 if e.t==30 then remove(cacSh,i) end end end local eCac={} function enemyCactus(mx,my,mar) local e={x=mx,y=my,h=4,t=0,sp=368,area=mar,isSho=false,isDam=false} eCac[#eCac+1]=e end function drawEnemyCactus() local p=player for i,e in pairs(eCac) do --draw spr(e.sp+t%120//60,e.x+cam.x,e.y+cam.y,10,1,0,0,1,2) spr(e.sp+t%120//60,(e.x+8)+cam.x,e.y+cam.y,10,1,1,0,1,2) --attack enemyAttack(e.x,e.x+16,e.y,e.y+16,8,1,1) if t%120//60==0 then if not e.isSho then enemyCacSh(e.x+8,e.y+9,-1)enemyCacSh(e.x+8,e.y+9,1) e.isSho=true end else e.isSho=false end --damage if enemyDamage(e.x,e.y,16,16,e.isDam)>0 then --by shield if enemyDamage(e.x,e.y,16,16,e.isDam)==5 then if shAttack[p.shield]>0 then e.h=e.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(e.x,e.y,8,8,1)e.isDam=true end --by weapon else e.h=e.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(e.x,e.y,8,8,2)e.isDam=true end end if e.isDam then e.t=e.t+1 if e.t>12 then e.isDam=false e.t=0 end end --death if e.h<=0 then local dr=rnd(0,10) if dr<2 then equipDrop(e.x+2,e.y,2,5,e.area)end remove(eCac,i) end --remove if e.area~=p.area then remove(eCac,i) end end end local quic={} function enemyQuicker(mx,my,mar) local e={x=mx,y=my,vx=.4,f=0,h=8,t=0,tmEf=0,anim=t%24//12,area=mar,init=false,isDam=false} quic[#quic+1]=e end function drawEnemyQuicker() local p=player for i,e in pairs(quic) do local u=e.y local d=e.y+9 local l=e.x local r=e.x+8 --movement if enemySolid(l,r,u,d,8,8) then e.f=e.f==0 and 1 or 0 e.vx=e.vx*-1 end if e.h<5 then if not e.init then e.vx=e.vx*2 e.init=true end e.tmEf=e.tmEf+1 if e.tmEf==20 then effSmoke(e.x+4,e.y+1)e.tmEf=0 end e.anim=t%16//8 else e.anim=t%24//12 end e.x=e.x+e.vx --attack enemyAttack(l,r,u,d,4,1,1) --damage if enemyDamage(l,u,8,8,e.isDam)>0 then --by shield if enemyDamage(e.x,e.y,8,8,e.isDam)==5 then if shAttack[p.shield]>0 then e.h=e.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,1)e.isDam=true end --by weapon elseif enemyDamage(e.x,e.y,8,8,e.isDam)~=0 then e.h=e.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,2)e.isDam=true end end if e.isDam then e.t=e.t+1 if e.t>12 then e.isDam=false e.t=0 end end --death if e.h<=0 then local dr=rnd(0,10) if dr<2 then equipDrop(e.x,e.y,1,10,e.area) else local dr=rnd(4,8) if dr<6 then equipDrop(e.x,e.y,dr,0,e.area)end end remove(quic,i) end --remove if e.area~=p.area or p.isOver then remove(quic,i) end --draw spr(356+e.anim,e.x+cam.x,e.y+cam.y,0,1,e.f) end end local axe={} function enemyAxe(mx,my,mvx) local s={x=mx,y=my,vx=mvx,t=0} axe[#axe+1]=s end function drawEnemyAxe() for i,s in pairs(axe) do s.t=s.t+1 spr(400+t%24//8,s.x+cam.x,s.y+cam.y,6) s.x=s.x+s.vx if s.t==60 then for a=0,360,45 do effDam(s.x+4,s.y+4,a,13,1) end remove(axe,i) end --attack player enemyAttack(s.x,s.x+8,s.y,s.y+8,4,1,1) end end local axl={} function enemyAxl(mx,my,mar) local e={x=mx,y=my,h=4,t=0,tAtt=0,f=0,offs=1,area=mar,isDam=false} axl[#axl+1]=e end function drawEnemyAxl() local p=player for i,e in pairs(axl) do --flip e.f=(e.x>p.x and 1 or 0) e.offs=(e.x>p.x and -1 or 1) --draw if e.tAtt>10 then spr(400,(e.x+4*e.offs)+cam.x,e.y-2+cam.y,6,1,e.f) end spr(276,e.x+cam.x,e.y+cam.y+2,0,1,e.f) spr(358,e.x+cam.x,e.y-3+cam.y-2,0,1,e.f) spr(270,e.x+cam.x,e.y+7+cam.y,0,1,e.f) spr(320,(e.x-4*e.offs)+cam.x,e.y+cam.y,10,1,e.f) --attack enemyAttack(e.x,e.x+8,e.y,e.y+8,4,1,1) e.tAtt=e.tAtt+1 if e.tAtt>90 then enemyAxe(e.x+10*e.offs,e.y-1,e.offs) e.tAtt=0 end --damage if enemyDamage(e.x,e.y,8,8,e.isDam)>0 then --by shield if enemyDamage(e.x,e.y,8,8,e.isDam)==5 then if shAttack[p.shield]>0 then e.h=e.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(e.x,e.y,4,4,1)e.isDam=true end --by weapon else e.h=e.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(e.x,e.y,4,4,2)e.isDam=true end end if e.isDam then e.t=e.t+1 if e.t>12 then e.isDam=false e.t=0 end end --death if e.h<=0 then local dr=rnd(0,10) if dr<2 then equipDrop(e.x,e.y,3,13,e.area)end remove(axl,i) end --remove if e.area~=p.area or p.isOver then remove(axl,i) end end end local guardSh={} function effSGuardSh(mx,my,mvx,mf) local s={x=mx,y=my,vx=mvx,f=mf,t=0} guardSh[#guardSh+1]=s end function drawEffGuardSh() for i,s in pairs(guardSh) do s.t=s.t+1 spr(422,s.x+cam.x,s.y+cam.y,0,1,s.f,0,1,2) s.x=s.x+s.vx*2 if s.t==20 then remove(guardSh,i) end --attack player enemyAttack(s.x+2,s.x+6,s.y+4,s.y+14,4,1,1) end end local guard={} function enemyGuard(mx,my,mar) local e={x=mx,y=my,h=10,t=0,tAtt=0,sp=416,f=0,offs=1,area=mar,isDam=false} guard[#guard+1]=e end function drawEnemyGuard() local p=player for i,e in pairs(guard) do --flip e.f=(e.x>p.x and 1 or 0) e.offs=(e.x>p.x and -1 or 1) --draw spr(e.sp,e.x+cam.x,e.y+cam.y,0,1,e.f,0,2,2) --attack e.tAtt=e.tAtt+1 if e.tAtt==10 then e.sp=416 elseif e.tAtt==60 then e.sp=418 elseif e.tAtt==90 then e.sp=420 effSGuardSh(e.x+(8*e.offs),e.y,e.offs,e.f)e.tAtt=0 end enemyAttack(e.x+4,e.x+12,e.y+2,e.y+16,8,1,1) --damage if enemyDamage(e.x,e.y,16,16,e.isDam)>0 then --by shield if enemyDamage(e.x,e.y,16,16,e.isDam)==5 then if shAttack[p.shield]>0 then e.h=e.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(e.x,e.y,8,8,1)e.isDam=true end --by weapon else e.h=e.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(e.x,e.y,8,8,2)e.isDam=true end end if e.isDam then e.t=e.t+1 if e.t>12 then e.isDam=false e.t=0 end end --death if e.h<=0 then local dr=rnd(0,10) if dr<2 then equipDrop(e.x,e.y,3,11,e.area)end remove(guard,i) end --remove if e.area~=p.area or p.isOver then remove(guard,i) end end end local crow={} function enemyCrow(mx,my,mar) local e={x=mx,y=my,vx=0,vy=0,dist=1,spd=1.5,f=0,h=1,t=0,tAt=0,tmEf=0,sp=382,anim=t%24//12,area=mar,isAtt=false,isDam=false} crow[#crow+1]=e end function drawEnemyCrow() local p=player for i,e in pairs(crow) do local u=e.y local d=e.y+8 local l=e.x local r=e.x+8 --movement e.x=e.x+e.vx/e.dist*e.spd e.y=e.y+e.vy/e.dist*e.spd --attack if p.x>e.x-120 and p.xp.x and 1 or 0)e.anim=t%20//10 else e.tmEf=e.tmEf+1 if e.tmEf==5 then effFly(e.x+3,e.y+4)e.tmEf=0 end end if e.tAt==60 then sfx(57,'A-6') if not e.isAtt then e.vx=p.x-e.x e.vy=p.y-e.y e.dist=sqrt((e.vx*e.vx)+(e.vy*e.vy)) e.sp=398 e.anim=0 e.isAtt=true end elseif e.tAt==150 then e.sp=382 e.isAtt=false e.tAt=0 end enemyAttack(l,r,u,d,4,1,1) if l+4>p.x and l+4p.y and u+40 then --by shield if p.shield~=0 and enemyDamage(e.x,e.y,8,8,e.isDam)==5 then if shAttack[p.shield]>0 then e.h=e.h-(shAttack[p.shield]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,1)e.isDam=true end --by weapon elseif p.sword~=0 and enemyDamage(e.x,e.y,8,8,e.isDam)~=0 then e.h=e.h-(wpAttack[p.sword]+(p.armor==11 and 2 or 0)) enemyHurt(l,u,4,4,2)e.isDam=true end end if e.isDam then e.t=e.t+1 if e.t>12 then e.isDam=false e.t=0 end end --death if e.h<=0 then local dr=rnd(4,8) if dr<6 then equipDrop(e.x,e.y,dr,0,e.area)end remove(crow,i) end --remove if e.area~=p.area or bos4.h<=0 or p.isOver then remove(crow,i) end --draw spr(e.sp+e.anim,e.x+cam.x,e.y+cam.y,10,1,e.f) end end local skul={} function enemySkulSh(mx,my,mar) local e={x=mx,y=my,vx=0.8,vy=rnd(-5,5)/10,t=0,area=mar,isSfx=false} skul[#skul+1]=e end function drawEnemySkulSh() local p=player for i,e in pairs(skul) do if not e.isSfx then sfx(59,'C-7')e.isSfx=true end spr(439+t%10//5,e.x+cam.x,e.y+cam.y,6) e.x=e.x+e.vx e.y=e.y+e.vy enemyAttack(e.x,e.x+8,e.y,e.y+8,4,1,2) --damage if enemyDamage(e.x,e.y,8,8,false)>0 and enemyDamage(e.x,e.y,32,32,false)<5 then enemyHurt(e.x,e.y,4,4,1)remove(skul,i) end --remove e.t=e.t+1 if e.t==360 or e.area~=p.area or not bos1.isLife then remove(skul,i)end end end ------ --screen function hud() local p=player --draw box map(30,132,30,4,0,104) --text print("health",20,105,12,false,1,true) print("energy",108,105,12,false,1,true) --health for x=1,p.maxHealth do spr(231,3+(x*8),117) end for x=1,p.health do spr(247,3+(x*8),117) end --energy sword rect(100,116,56,2,15) rect(100,116,56*(10/100*p.enSword),2,6) --energy shield rect(100,124,56,2,15) rect(100,124,56*(10/100*p.enShield),2,9) --armor spr(288+p.armor,176,117,10) --shield if p.shield~=0 then spr(320+p.shield,200,117,10) end --sword if p.sword~=0 then spr(304+p.sword,224,117,10) end end function dialogText(title,text,plus) --draw box rect(0,104,240,32,0) map(0,132,30,4,0,104,5) --bg title local length=print(title,0,-8,0,false,1,true) rect(16,104,length+8,8,0) --text print(title,20,105,10,false,1,true) print(text,8,114,12,false,1,true) print(plus,8,122,5,false,1,true) end local debugTipe=0 function debug() local p=player --------- if keyp(31) then debugTipe=0 elseif keyp(28) then debugTipe=1 elseif keyp(29) then debugTipe=2 elseif keyp(30) then debugTipe=3 -- elseif keyp(36) then tPal=0 scn=4 end --------- --change equipment if debugTipe==1 then if btn(0) then if btnp(5) then p.sword=p.sword+1 end if btnp(6) then p.shield=p.shield+1 end if btnp(7) then p.armor=p.armor+1 end end if btn(1) then if btnp(5) then p.sword=p.sword-1 end if btnp(6) then p.shield=p.shield-1 end if btnp(7) then p.armor=p.armor-1 end end --------- print("tPal: "..tPal.."",8,0,12) print(p.isShield,8,8,12)print(p.isAttack,40,8,12) print("offset: "..p.offs.."",8,16,12) print("speedMv: "..p.spd+arSpeed[p.armor~=0 and p.armor or 1].."",8,24,12) print("weaponNum: "..p.sword.."",8,32,12) print("wpSpeed: "..wpSpeed[p.sword~=0 and p.sword or 1].."",8,40,12) print("wpAttack: "..wpAttack[p.sword~=0 and p.sword or 1].."",8,48,12) print("sign: "..#sign.."",8,56,12) --- print("itemDrop: "..#equip.."",8,64,12) print("slash: "..#slash.."",8,72,12) print("spear: "..#spear.."",8,80,12) print("magic: "..#magic.."",8,88,12) print("sun: "..#sun.."",8,96,12) print("axePla: "..#axePla.."",8,104,12) --- print("area: "..p.area.."",80,0,12) print("playerX: "..flr(p.x).."",80,8,12) print("playerY: "..flr(p.y).."",80,16,12) print("camX: "..flr(cam.x).."",80,24,12) print("camY: "..flr(cam.x).."",80,32,12) print("limitLeft: "..cam.ll.."",80,40,12) print("limitRight: "..cam.lr.."",80,48,12) print("limitUp: "..cam.lu.."",80,56,12) print("limitDown: "..cam.ld.."",80,64,12) print(p.isInv,80,72,12) print("effDam: "..#dm.."",80,80,12) print("effDust: "..#dst.."",80,88,12) print("effUp: "..#eup.."",80,96,12) -- print("coyote: "..p.coyT.."",176,0,12) print("effFly: "..#eFly.."",176,8,12) print("effSmoke: "..#eSmoke.."",176,16,12) print("tileBr: "..#tileBr.."",176,24,12) print("explode: "..#exp.."",176,32,12) print("scene: "..scn.."",176,48,12) elseif debugTipe==2 then print("spawner: "..#spawner.."",8,0,12) print("dryCactus: "..#eDryCac.."",8,8,12) print("skulang: "..#skulang.."",8,16,12) print("skely: "..#skely.."",8,24,12) print("keeper: "..#keeper.."",8,32,12) -- print("bug: "..#bug.."",88,8,12) print("spearman: "..#spearman.."",88,16,12) print("miner: "..#miner.."",88,24,12) print("bat: "..#bat.."",88,32,12) -- print("ghost: "..#ghost.."",168,8,12) print("appler: "..#appler.."",168,16,12) print("watcher: "..#watcher.."",168,24,12) print("magician: "..#magician.."",168,32,12) print("cactus: "..#eCac.."",168,40,12) print("cactusBul: "..#cacSh.."",168,48,12) print("magicBul: "..#magicSh.."",168,56,12) print("phantom: "..#phantom.."",168,64,12) print("ballBig: "..#balBig.."",168,72,12) print("meteor: "..#meteor.."",168,80,12) -- print("quicker: "..#quic.."",8,56,12) print("axl: "..#axl.."",8,64,12) print("guard: "..#guard.."",8,72,12) print("crow: "..#crow.."",8,80,12) print("axl axe: "..#axe.."",8,88,12) print("guardSh: "..#guardSh.."",8,96,12) -- print("bos1: "..str(bos1.isLife).."",88,56,12) print("bos2: "..str(bos2.isLife).."",88,64,12) print("bos3: "..str(bos3.isLife).."",88,72,12) print("bos4: "..str(bos4.isLife).."",88,80,12) print("bos5: "..str(bos5.isLife).."",88,88,12) -- print("villager: "..#vill.."",168,88,12) print("skull: "..#skul.."",168,96,12) elseif debugTipe==3 then print("pmem0(isSave): "..pmem(0).."",8,8,12) print("pmem1(pX): "..pmem(1).."",8,16,12) print("pmem2(pY): "..pmem(2).."",8,24,12) print("pmem3(pH): "..pmem(3).."",8,32,12) print("pmem4(pMaxH): "..pmem(4).."",8,40,12) print("pmem5(armor): "..pmem(5).."",8,48,12) print("pmem6(shield): "..pmem(6).."",8,56,12) print("pmem7(sword): "..pmem(7).."",8,64,12) -- print("pmem8(door1): "..pmem(8).."",104,8,12) print("pmem9(door2): "..pmem(9).."",104,16,12) print("pmem10(door3): "..pmem(10).."",104,24,12) -- print("pmem11(vil1): "..pmem(11).."",104,40,12) print("pmem12(vil2): "..pmem(12).."",104,48,12) print("pmem13(vil3): "..pmem(13).."",104,56,12) print("pmem14(vil4): "..pmem(14).."",104,64,12) print("pmem15(vil5): "..pmem(15).."",104,72,12) print("pmem16(vilAm): "..pmem(16).."",104,80,12) end end