global script hpmpcounters{
	void run(){
		
		
		while(true)
		{
			Game->Counter[CR_SCRIPT2] = Link->HP;
			Game->Counter[CR_SCRIPT3] = Link->MP;
			Game->Counter[CR_SCRIPT4] = Link->MaxHP;
			Game->Counter[CR_SCRIPT5] = Link->MaxMP;



			float angle;
			{
				if (usebombodo == 1)
				{            
					slower ++;
					if (slower == 5)
					{  
						rad++;
						slower = 0;
					}  
					angle = (angle + ORBIT_SPEED) % 360;          
					f1 = 100 + rad * Cos(angle);
					f2 = 100 + rad * Sin(angle);
					Screen->FastCombo(6, f1, f2, 80, 2, 128);
					
					r1 = 40+Rand(150);
					r2 = 40+Rand(100);
					
					slowera++;
					if (slowera  == 20)
					{
						slowera = 0;
						if (bombs < 30)
						{
							bombs ++;  
							lweapon bomb = CreateLWeaponAt(LW_BOMBBLAST, r1, r2);
							Game->PlaySound(SFX_BOMB);
							if (bombs == 30) usebombodo = 0;
						}
					}
				}
				
				Waitframe();
				
			}
			if ( ringOn && Link->MP ){                
				//Decrement magic
				ringTimer = (ringTimer+1) % ringTimePerMP;
				if ( !ringTimer ) Link->MP--;
				
				if ( Link->MP <= 0 //If magic ran out
						|| Link->Action == LA_SCROLLING //Or left screen
						){ //Take off ring
					ringOn = false;
					Link->CollDetection = true;
					Link->Invisible = false;
				}

			}
			else if ( !ringOn ){ //Disable ring
				Link->CollDetection = true;
				Link->Invisible = false;
			}
		}
	}
}