Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.07 KB | None | 0 0
  1. const int MAX_ICE_TIME = 600;//Time ice platform exists
  2. const int ICEBLOCK_CSET = 2;//Cset for ice block.
  3.  
  4. ffc script IceRodFFC{
  5. void run(int Weapon_ID){
  6. this->Data = GH_INVISIBLE_COMBO;
  7. npc current_enemy;
  8. bool Stop = false;
  9. bool impact = false;//Tests whether an enemy or freezable combo has been hit.
  10. //Two variables used to save location of ffc upon impact.
  11. int impactX;
  12. int impactY;
  13. //Increase size of platform for larger enemies.
  14. int BlockWidth=1;
  15. int BlockHeight=1;
  16. int Ice_Timer;//Used internally by ffc to track how long ice combo has existed.
  17. int i;
  18. int j;
  19. lweapon beam = FindMiscLWeapon(Weapon_ID);//Find previously saved lweapon.
  20. //Position ffc.
  21. if(beam->isValid()){
  22. this->X = beam->X;
  23. this->Y = beam->Y;
  24. }
  25. else{
  26. this->Data = 0;
  27. Quit();
  28. }
  29. while(!Stop){
  30. while(!impact && this->X>0 && this->Y>0 && this->X<256 && this->Y<170){
  31. //Adjust the position of the ffc every frame, based on the direction Link was facing when he fired it.
  32. if(beam->isValid()){
  33. this->X = beam->X;
  34. this->Y = beam->Y;
  35. }
  36. else{
  37. this->Data = 0;
  38. Quit();
  39. }
  40. //Update current number of enemies.
  41. for(i=Screen->NumNPCs();i>0;i--){
  42. current_enemy = Screen->LoadNPC(i);
  43. if(current_enemy->HP<=0)break;
  44. if (Collision(beam,current_enemy)){
  45. if(current_enemy->Defense[NPCD_SCRIPT]!=NPCDT_IGNORE
  46. && (current_enemy->Misc[GEN_MISC_FLAGS]&NPC_F_FREEZE)==0){
  47. impactX = current_enemy->X;
  48. impactY = current_enemy->Y;
  49. if(current_enemy->TileWidth>1)BlockWidth = current_enemy->TileWidth;
  50. if(current_enemy->TileHeight>1)BlockHeight = current_enemy->TileHeight;
  51. //Stun the enemy.
  52. current_enemy->Stun = MAX_ICE_TIME;
  53. current_enemy->Misc[GEN_MISC_FLAGS]|=NPC_F_FREEZE;
  54. impact = true;
  55. this->Flags[FFCF_OVERLAY]= true;
  56. this->Flags[FFCF_TRANS] = true;
  57. if(beam->isValid())
  58. KillLWeapon(beam);
  59. }
  60. else{
  61. if(beam->isValid())
  62. KillLWeapon(beam);
  63. }
  64. }
  65. }
  66. Waitframe();
  67. }
  68. //You've hit an enemy.
  69. if(impact){
  70. //Position the ffc.
  71. this->X = impactX;
  72. this->Y = impactY;
  73. //Set up timer.
  74. Ice_Timer = MAX_ICE_TIME;
  75. }
  76. while(Ice_Timer>0){
  77. Ice_Timer--;
  78. if(BlockWidth>1){
  79. for(i=impactX;i<(impactX+BlockWidth*16);i+=16)
  80. Screen->FastCombo(3,i,impactY,ICE_BLOCK_COMBO,ICEBLOCK_CSET,64);
  81. }
  82. else
  83. Screen->FastCombo(3,impactX,impactY,ICE_BLOCK_COMBO,ICEBLOCK_CSET,64);
  84. if(BlockHeight >1){
  85. for(j= impactY;j<=impactY+(BlockHeight*16);j+=16){
  86. for(i=impactX;i<(impactX+BlockWidth*16);i+=16)
  87. Screen->FastCombo(3,i,j,ICE_BLOCK_COMBO,ICEBLOCK_CSET,64);
  88. }
  89. }
  90. else
  91. Screen->FastCombo(3,impactX,impactY,ICE_BLOCK_COMBO,ICEBLOCK_CSET,64);
  92. if(Ice_Timer<5){
  93. if(current_enemy->isValid())
  94. current_enemy->Misc[GEN_MISC_FLAGS]&=~NPC_F_FREEZE;
  95. Stop = true;
  96. break;
  97. }
  98. Waitframe();
  99. }
  100. Waitframe();
  101. }
  102. this->Data = 0;
  103. Quit();
  104. }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement