Copy to Clipboard Test

Blast Combo Changer Code

const int CF_COMBOCHANGEABLE = 98;//Combo Flag used to white-list combos to be affected by Blast Combo Changer.

//Blast Combo CHanger
//Moves like Zol/Gel. When it halts, causesexplosion, that changes combos to one set in attributes.

ffc script BlastComboCHanger{
	void run(int enemyID){
		npc ghost = Ghost_InitAutoGhost(this, enemyID);
		
		int HF = ghost->Homing;
		int HR = ghost->Haltrate;
		int RR = ghost->Rate;
		int HNG = ghost->Hunger;
		int SPD = ghost->Step;
		int WPND = ghost->WeaponDamage;
		
		int ComboChange = Ghost_GetAttribute(ghost, 0, -1);//Combo used to replace affected combos. 0 - no change.
		int CSetChange = Ghost_GetAttribute(ghost, 1, -1);//CSet used to recolor affected combos. 0 - no change.
		int radius = Ghost_GetAttribute(ghost, 2, 34);//Blast radius. <24 - normal boom, >=24 - super boom
		int kamikaze = Ghost_GetAttribute(ghost, 3, 0);//>0 - Dies on boom, like Bob-Omb 
		int sizex = Ghost_GetAttribute(ghost, 4, 1);//Enemy Size X
		int sizey = Ghost_GetAttribute(ghost, 5, 1);//EnemySize Y;
				
		ghost->Extend=3;
		Ghost_SetSize(this, ghost, sizex, sizey);
		if (sizex>2 || sizey>2)Ghost_SetHitOffsets(ghost, 8, 8, 8, 8);
		
		Ghost_SetFlag(GHF_NORMAL);
		
		int OrigTile = ghost->OriginalTile;
		int State = 0;
		int statecounter = 0;
		int haltcounter = -1;
		eweapon e;
		
		int defs[18];
		Ghost_StoreDefenses(ghost,defs);
		
		while(true){
			if (State==0){
				haltcounter = Ghost_HaltingWalk4(haltcounter, SPD, RR, HF, HNG, HR, 60);
				if (haltcounter==1){
					e =FireEWeapon(Cond(radius>=24, EW_SBOMBBLAST,EW_BOMBBLAST), CenterX(ghost)-8, CenterY(ghost)-8, 0, 0, WPND, -1, 0, 0);
					if (WPND==0)e->CollDetection=false;
					for (int i=0;i<176;i++){
						if (!ComboFI(i,CF_COMBOCHANGEABLE)) continue;
						if (Distance(ComboX(i)+7,ComboY(i)+7,CenterX(ghost), CenterY(ghost))>radius) continue;
						if (ComboChange>=0)Screen->ComboD[i]=ComboChange;
						if (CSetChange>=0)Screen->ComboC[i]=CSetChange;
						Screen->ComboF[i]=0;
					}
					if (kamikaze>0){
						ghost->ItemSet=0;
						Ghost_HP=0;
					}
				}
			}
			Ghost_Waitframe(this, ghost);
		}
	}
}