Downloads containing roastAnnouncer.mut

Downloads
Name Author Game Mode Rating
JJ2+ Only: Roast Announcer szmol96 Mutator N/A Download file

File preview

#pragma name "Roast Announcer"

#pragma require "first_blood.wav"
#pragma require "Killing_Spree.wav"
#pragma require "Rampage.wav"
#pragma require "Dominating.wav"
#pragma require "Unstoppable.wav"
#pragma require "GodLike.wav"
#pragma require "WhickedSick.wav"
#pragma require "Double_Kill.wav"
#pragma require "MultiKill.wav"
#pragma require "MegaKill.wav"
#pragma require "UltraKill.wav"
#pragma require "MonsterKill.wav"
#pragma require "LudicrousKill.wav"
#pragma require "HolyShit.wav"

enum packet_type {packet_sendSync, packet_requestSync};
array<string> multiKillStrings = {"", "Double Kill", "Multi Kill", "Mega Kill", "Ultra Kill", "Monster Kill", "Ludicrous Kill", "HOLY SHIT"};
bool firstBloodTaken = false;
uint8 killStreak = 0;
uint8 multiKill = 0;
uint8 multiCounter = 0;

void requestSync() {
	jjSTREAM packet;
	packet.push(uint8(packet_requestSync));
	jjSendPacket(packet);
}

void sendSync(uint8 player, bool request) {
	jjSTREAM packet;
	packet.push(uint8(packet_sendSync));
	packet.push(firstBloodTaken);
	packet.push(player);
	packet.push(request);
	jjSendPacket(packet);
}

void onLevelLoad() {
	jjSampleLoad(SOUND::P2_CRUNCH, "first_blood.wav");
	jjSampleLoad(SOUND::P2_FART, "Killing_Spree.wav");
	jjSampleLoad(SOUND::P2_FOEW1, "Rampage.wav");
	jjSampleLoad(SOUND::P2_FOEW4, "Dominating.wav");
	jjSampleLoad(SOUND::P2_FOEW5, "Unstoppable.wav");
	jjSampleLoad(SOUND::P2_FROG1, "GodLike.wav");
	jjSampleLoad(SOUND::P2_FROG2, "WhickedSick.wav");
	jjSampleLoad(SOUND::P2_FROG3, "Double_Kill.wav");
	jjSampleLoad(SOUND::P2_FROG4, "MultiKill.wav");
	jjSampleLoad(SOUND::P2_FROG5, "MegaKill.wav");
	jjSampleLoad(SOUND::P2_KISS4, "UltraKill.wav");
	jjSampleLoad(SOUND::P2_OPEN, "MonsterKill.wav");
	jjSampleLoad(SOUND::P2_PINCH1, "LudicrousKill.wav");
	jjSampleLoad(SOUND::P2_PINCH2, "HolyShit.wav");
	
	requestSync();
}

void onMain() { 
	if (multiCounter > 0) multiCounter--;
	else if (multiKill > 0) multiKill = 0;
}

void onRoast(jjPLAYER@ victim, jjPLAYER@ killer) {
	jjPLAYER@ p = jjLocalPlayers[0];
	
	if (killer.playerID == p.playerID && victim.playerID != p.playerID) {
		killStreak++;
		multiKill++;
		multiCounter = 3 * 70;
		
		if (!firstBloodTaken) {
			jjSamplePriority(SOUND::P2_CRUNCH);
			firstBloodTaken = true;
			sendSync(p.playerID, false);
			if (jjIsServer) jjAlert(join(p.name.split("|"), "") + " drew |first blood!");
		}
		
		switch (killStreak) {
			case 5:
				jjSamplePriority(SOUND::P2_FART);
				break;
			case 10:
				jjSamplePriority(SOUND::P2_FOEW1);
				break;
			case 15:
				jjSamplePriority(SOUND::P2_FOEW4);
				break;
			case 20:
				jjSamplePriority(SOUND::P2_FOEW5);
				break;
			case 25:
				jjSamplePriority(SOUND::P2_FROG1);
				break;
			case 30:
				jjSamplePriority(SOUND::P2_FROG2);
				break;
		}
		
		switch (multiKill) {
			case 1:
				break;
			case 2:
				jjSamplePriority(SOUND::P2_FROG3);
				break;
			case 3:
				jjSamplePriority(SOUND::P2_FROG4);
				break;
			case 4:
				jjSamplePriority(SOUND::P2_FROG5);
				break;
			case 5:
				jjSamplePriority(SOUND::P2_KISS4);
				break;
			case 6:
				jjSamplePriority(SOUND::P2_OPEN);
				break;
			case 7:
				jjSamplePriority(SOUND::P2_PINCH1);
				break;
			default:
				jjSamplePriority(SOUND::P2_PINCH2);
				break;
		}
	}
	
	if (victim.playerID == p.playerID) {
		killStreak = 0;
		multiKill = 0;
		multiCounter = 0;
	}
}

void onReceive(jjSTREAM &in packet, int clientID) {
	jjOBJ@ nodeObj;
	uint8 type;
	
	packet.pop(type);
	if (jjIsServer) {
		switch (type) {
			case packet_requestSync:
			{	
				sendSync(0, true);
			}
				break;
			case packet_sendSync:
			{	
				uint8 player;
				bool request;
				
				packet.pop(firstBloodTaken);
				packet.pop(player);
				packet.pop(request);
				
				if (!request) jjAlert(join(jjPlayers[player].name.split("|"), "") + " drew |first blood!");
				
				sendSync(player, request);
			}
				break;
		}
	} else {
		switch (type) {
			case packet_sendSync:
			{
				uint8 player;
				bool request;
				
				packet.pop(firstBloodTaken);
				packet.pop(player);
				packet.pop(request);
				
				if (!request) jjAlert(join(jjPlayers[player].name.split("|"), "") + " drew |first blood!");
			}
				break;
		}
	}
}

bool onDrawHealth(jjPLAYER@ p, jjCANVAS@ canvas) {
	jjTEXTAPPEARANCE centeredString(STRING::PALSHIFT);
	centeredString.align = STRING::CENTER;
	//centeredString.pipe = STRING::SPECIALSIGN;

	if (multiKill > 0 && multiKill < 8) canvas.drawString(jjResolutionWidth / 2, jjResolutionHeight / 2 - 64, "" + multiKillStrings[multiKill - 1], STRING::MEDIUM, centeredString, 24, SPRITE::BLEND_NORMAL, int((float(multiCounter) / 210) * 255));
	else if (multiKill >= 8) canvas.drawString(jjResolutionWidth / 2, jjResolutionHeight / 2 - 64, "" + multiKillStrings[7], STRING::MEDIUM, centeredString, 24, SPRITE::BLEND_NORMAL, int((float(multiCounter) / 210) * 255));
	
	return false;
}