Downloads containing ArcaneWeapon7.asc

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Min* Commotion Violet CLM Battle N/A Download file
TSF with JJ2+ Only: Laboratory 38Featured Download Dragusela Battle 8 Download file
TSF with JJ2+ Only: Lori FortressFeatured Download Primpy Single player 8.7 Download file
TSF with JJ2+ Only: Anniversary Bash 23 levels Jazz2Online Multiple N/A Download file
JJ2+ Only: violetclm DOM Episodes I...Featured Download Violet CLM Custom / Concept 9 Download file
Custom Weapons...Featured Download Violet CLM Other 10 Download file

File preview

#pragma require "ArcaneWeapon7.asc"
#include "MLLE-Weapons.asc"
#pragma require "Lightningrod.j2a"
#pragma require "ZAPFIZZ1.wav"
#pragma require "ZAPFIZZ2.wav"

namespace ArcaneWeapons {
	namespace LightningRod {
		class Weapon : MLLEWeapons::WeaponInterface {
			Weapon() {
				super(
					regularObjectTemplate: MLLEWeapons::ObjectTemplate(
						playerHandling: HANDLING::PARTICLE,
						curAnim: 0,
						counterEnd: 255,
						lightType: LIGHT::POINT,
						light: 10,
						state: STATE::FALL
					),
					animSetFilename: "Lightningrod.j2a",
					pickupAnimation: 0,
					ammoCrateAnimation: 5,
					apply: MLLEWeapons::applyFunction(LoadCustomFireSounds),
					roundsPerPickup: 1,
					spread: SPREAD::ICE,
					behavior: function(obj, powerup) {
						jjSample(obj.xPos, obj.yPos, SOUND::COMMON_MONITOR, 0, 12500);
						obj.behavior = Behavior;
						if (powerup && (AlternatingPowerupDirection = !AlternatingPowerupDirection)) {
							obj.ySpeed = -6;
							obj.yAcc = -8;
							obj.direction = SPRITE::FLIPV;
						} else {
							obj.ySpeed = 6;
							obj.yAcc = 8;
						}
						if (!powerup) obj.age = 120; //reduced lifetime
						else obj.var[6] = 8;
					}
				);
			}
			bool LoadCustomFireSounds(uint, se::WeaponHook@, jjSTREAM@ parameter) {
				if (parameter !is null && !parameter.isEmpty()) {
					bool customFireSounds;
					parameter.pop(customFireSounds);
					if (!customFireSounds)
						return true;
				} //else continue, loading the sounds by default if no parameter is provided
				jjSampleLoad(SOUND::COMMON_ELECTRICHIT, "ZAPFIZZ1.wav");
				jjSampleLoad(SOUND::COMMON_ELECTRIC2, "ZAPFIZZ2.wav");
				return true;
			}
		}
		bool AlternatingPowerupDirection;
		
		void Behavior(jjOBJ@ obj) {
			jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction);
			
			if (obj.state == STATE::FALL) {
				if (!jjMaskedHLine(int(obj.xPos - 8), 16, int(obj.yPos + obj.yAcc))) {
					obj.yPos += obj.ySpeed;
				} else {
					jjSample(obj.xPos, obj.yPos, SOUND::COMMON_LANDCAN1, 0, 30000);
					obj.state = STATE::LAND;
					obj.lightType = LIGHT::BRIGHT;
					if (jjGameMode == GAME::CTF && obj.creatorType == CREATOR::PLAYER) {
						switch (jjPlayers[obj.creatorID].team) {
							case TEAM::BLUE: obj.curAnim += 1; break;
							case TEAM::RED: obj.curAnim += 2; break;
							case TEAM::YELLOW: obj.curAnim += 3; break;
							case TEAM::GREEN: obj.curAnim += 4; break;
						}
					} else
						obj.curAnim += 1; //blue by default
				}
			} else {
				if (++obj.age % 20 == 0) {
					for (int i = -4; i <= 4; i += 4) {
						int id = jjAddObject(OBJECT::LIGHTNINGSHIELDBULLET, obj.xPos, obj.yPos - 12, obj.creatorID, CREATOR::PLAYER, function(obj) { obj.behave(BEHAVIOR::BULLET, false); });
						if (id != 0) {
							jjOBJ@ zap = jjObjects[id];
							zap.lightType = LIGHT::NONE;
							zap.counterEnd = 6;
							zap.animSpeed = MLLEWeapons::HelpfulBulletFunctions::IsPowerup(obj) ? 2 : 1;
							zap.direction = i;
							zap.lightType = LIGHT::NONE;
							zap.playerHandling = obj.creatorType == CREATOR::PLAYER ? HANDLING::PLAYERBULLET : HANDLING::ENEMYBULLET;
							zap.var[3] = obj.var[3];
							zap.var[6] = obj.var[6];
							zap.xSpeed = i;
							zap.xAcc = 0;
							zap.ySpeed = 0;
							zap.yAcc = 0;
							if (i == 0) zap.ySpeed = -4;
						}
					}
				}
			
				if (obj.age == 420) {
					obj.particlePixelExplosion(0);
					obj.delete();
				} else {
					obj.curFrame = jjAnimations[obj.curAnim] + ((jjGameTicks / 10) & 1);
				}
			}
		}
	}
}