Advertisement
ywkls

Magic Book

Aug 20th, 2019
108
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const int SPR_BOOK_VERT = 62;
  2. const int SPR_BOOK_HORIZ= 63;
  3. const int SFX_BOOK = 0;
  4. const int BOOK_SCRIPT =171;
  5.  
  6. //We want wands that slash!
  7. item script Run_Wand(int dummy, int item_ID){
  8. lweapon magic;
  9. lweapon wand;
  10. int spr;
  11. if(Link->Dir==DIR_DOWN||
  12. Link->Dir==DIR_UP)
  13. spr= SPR_BOOK_VERT;
  14. else
  15. spr= SPR_BOOK_HORIZ;
  16. int damage = 8;
  17. if(NumLWeaponsOf(LW_SCRIPT1)==0)
  18. wand = FireLWeapon(LW_SCRIPT1,Link->X+InFrontX(Link->Dir,2), Link->Y+InFrontY(Link->Dir,2),
  19. __DirtoRad(Link->Dir), 0, 0, spr, SFX_BOOK, 0);
  20. int Cost;
  21. Cost = 8;
  22. if(CountFFCsRunning(BOOK_SCRIPT)==0 && Link->MP>Cost){
  23. int Args[8] = {damage,Cost,item_ID};
  24. NewFFCScript(BOOK_SCRIPT, Args);
  25. }
  26. }
  27.  
  28. ffc script Magic_Book{
  29.  
  30. void run(int damage, int Cost, int item_ID){
  31. bool InputAbility(){
  32. if(GetEquipmentA()==item_ID)
  33. return Link->InputA;
  34. else if(GetEquipmentB()==item_ID)
  35. return Link->InputB;
  36. }
  37. this->Data = GH_INVISIBLE_COMBO;
  38. lweapon beam_1;
  39. float angle;;
  40. int X_Dist= 32;
  41. int Y_Dist= 32;
  42. while(InputAbility() && Link->MP>=Cost){
  43. if(Link->Dir==DIR_UP)
  44. angle = 270;
  45. else if(Link->Dir==DIR_DOWN)
  46. angle = 90;
  47. else if(Link->Dir==DIR_RIGHT)
  48. angle = 0;
  49. else
  50. angle = 180;
  51. beam_1= FireLWeapon(LW_FIRE, Link->X+VectorX(X_Dist,angle),
  52. Link->Y+VectorY(Y_Dist,angle),
  53. DegtoRad(angle),0, damage, SPR_FIRE,
  54. SFX_FIRE,0);
  55. if(Link->Dir==DIR_LEFT){
  56. if((Link->X-X_Dist)>0)
  57. X_Dist+=16;
  58. else
  59. X_Dist= 32;
  60. }
  61. else if(Link->Dir==DIR_RIGHT){
  62. if((Link->X+X_Dist)<240)
  63. X_Dist+=16;
  64. else
  65. X_Dist= 32;
  66. }
  67. else
  68. X_Dist= 32;
  69. if(Link->Dir==DIR_UP){
  70. if((Link->Y-Y_Dist)>0)
  71. Y_Dist+=16;
  72. else
  73. Y_Dist= 32;
  74. }
  75. else if(Link->Dir==DIR_DOWN){
  76. if((Link->Y+Y_Dist)<160)
  77. Y_Dist+=16;
  78. else
  79. Y_Dist= 32;
  80. }
  81. else
  82. Y_Dist= 32;
  83. SetLWeaponLifespan(beam_1,LWL_TIMER,60);
  84. SetLWeaponDeathEffect(beam_1,LWD_VANISH,0);
  85. Link->MP-=Cost;
  86. Waitframes(10);
  87. }
  88. RemoveLWeaponType(LW_SCRIPT1);
  89. }
  90. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement