Downloads containing ArcaneWeapon4.asc

Downloads
Name Author Game Mode Rating
JJ2+ Only: Knapweed Bog Lark Battle N/A Download file
JJ2+ Only: Anniversary Bash 25 CTF Jazz2Online Capture the flag N/A Download file
JJ2+ Only: Forgotten CivilisationFeatured Download PurpleJazz Capture the flag 8.7 Download file
TSF with JJ2+ Only: Blast ConcussionFeatured Download Violet CLM Capture the flag 9.7 Download file
TSF with JJ2+ Only: Star of the year V2Featured Download TreyLina Capture the flag 8.5 Download file
TSF with JJ2+ Only: Western WildernessFeatured Download Dragusela Capture the flag 9.2 Download file
TSF with JJ2+ Only: Anniversary Bash 24 CTF Jazz2Online Capture the flag N/A Download file
TSF with JJ2+ Only: Laboratory 38Featured Download Dragusela Battle 8 Download file
TSF with JJ2+ Only: Peaceful Worlds Dragusela Multiple 7.5 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 "ArcaneWeapon4.asc"
#include "MLLE-Weapons.asc"
#pragma require "Mortar.j2a"
#pragma offer "f_gren4.wav"

namespace ArcaneWeapons {
	namespace MortarLauncher {
		SOUND::Sample FireSound = SOUND::COMMON_GUNSM1;
		class Weapon : MLLEWeapons::WeaponInterface {
			Weapon() {
				super(
					regularObjectTemplate: MLLEWeapons::ObjectTemplate(
						xSpeed: 7,
						xAcc: -0.025,
						ySpeed: -9,
						yAcc: 0.225,
						animSpeed: 2,
						killAnim: jjAnimSets[ANIM::AMMO].firstAnim + 5,
						lightType: LIGHT::POINT,
						counterEnd: 90,
						state: STATE::FLY
					),
					powerupObjectTemplate: MLLEWeapons::ObjectTemplate(
						xSpeed: 7,
						xAcc: -0.025,
						ySpeed: -10,
						yAcc: 0.225,
						animSpeed: 3,
						killAnim: jjAnimSets[ANIM::AMMO].firstAnim + 5,
						curAnim: 2,
						lightType: LIGHT::POINT,
						counterEnd: 105,
						state: STATE::FLY
					),
					animSetFilename: "Mortar.j2a",
					pickupAnimation: 1,
					poweredUpPickupAnimation: 3,
					ammoCrateAnimation: 4,
					powerupAnimation: 5,
					sampleFilenames: array<string> = {"f_gren4.wav"},
					style: WEAPON::MISSILE,
					apply: MLLEWeapons::applyFunction(RememberSample),
					traits: se::weapon_default_traits | se::weapon_causes_splash_damage | se::weapon_increases_mobility | se::weapon_fails_in_interiors,
					behavior: function(obj, powerup) {
						if (obj.creatorType == CREATOR::PLAYER && jjPlayers[obj.creatorID].isLocal)
							jjSample(obj.xPos, obj.yPos, FireSound);
						if (obj.eventID == OBJECT::ICEBULLET) obj.eventID = OBJECT::BLASTERBULLET;
						obj.behavior = Behavior;
					}
				);
			}
			bool RememberSample(uint, se::WeaponHook@, jjSTREAM@) {
				if (SamplesLoaded[0]) FireSound = SOUND::COMMON_GUNSM1;
				return true;
			}
		}
		
		void Behavior(jjOBJ@ obj) {
			obj.behave(obj.state == STATE::EXPLODE? BEHAVIOR::RFBULLET : BEHAVIOR::BULLET, false);
			
			switch (obj.state) {
				case STATE::FLY: {
					if (obj.counter % 5 == 0 && !jjLowDetail) {
						jjOBJ@ trail = jjObjects[jjAddObject(OBJECT::EXPLOSION, obj.xPos, obj.yPos)];
						trail.determineCurAnim(ANIM::AMMO, 3);
						trail.lightType = LIGHT::NONE;
						trail.playerHandling = HANDLING::PARTICLE;
						trail.bulletHandling = HANDLING::IGNOREBULLET;
						trail.isBlastable = false;
					}
					
					if (obj.ySpeed > 12) obj.ySpeed = 12;
					
					jjDrawRotatedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, MLLEWeapons::HelpfulBulletFunctions::GetAngle(obj), MLLEWeapons::HelpfulBulletFunctions::GetDirection(obj) * 0.75, 0.75);
					break; }
				
				case STATE::EXPLODE:
					if (obj.playerHandling == HANDLING::EXPLOSION)
					jjDrawResizedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, 2, 2);
				
					if (obj.var[2] == 0) {
						obj.var[2] = 1;
						jjOBJ@ blast = jjObjects[jjAddObject(OBJECT::BULLET, obj.xPos, obj.yPos, obj.creatorID, obj.creatorType, Shockwave)];
						blast.var[5] = MLLEWeapons::HelpfulBulletFunctions::IsPowerup(obj) ? 2 : 1;
						blast.playerHandling = HANDLING::PARTICLE;
						blast.bulletHandling = HANDLING::IGNOREBULLET;
						blast.lightType = LIGHT::RING2;
						blast.light = 0;
						blast.animSpeed = 1;
						blast.counter = 0;
					}
				break;
			}
		}
		void Shockwave(jjOBJ@ obj) {
			obj.light += 2;
			const float maxDistance = obj.light * obj.light * 16;
			
			if (obj.creatorType == CREATOR::PLAYER)
				for (int i = 1; i < jjObjectCount; i++) {
					jjOBJ@ target = jjObjects[i];
					if (target.state == STATE::KILL || target.state == STATE::DONE || target.state == STATE::EXPLODE)
						continue;
					const float dx = target.xPos - obj.xPos, dy = target.yPos - obj.yPos;
					if (target.var[4] == 0 && (target.behavior == BEHAVIOR::MONITOR || (target.eventID >= OBJECT::BOMBCRATE && target.eventID <= OBJECT::TOASTERAMMO15) || target.eventID == OBJECT::GUNCRATE || target.eventID == OBJECT::GEMCRATE || target.eventID == OBJECT::CARROTCRATE || target.isTarget || target.eventID == OBJECT::DESTRUCTSCENERY)) {
						if (dx * dx + dy * dy < maxDistance) {
							obj.objectHit(target, target.playerHandling == HANDLING::ENEMY? HANDLING::ENEMY : HANDLING::SPECIAL);
							//if (target.playerHandling != HANDLING::ENEMY) target.state = STATE::KILL;
							target.var[4] = 1;
						}
					}
					else if (target.playerHandling == HANDLING::PICKUP && target.state == STATE::FLOAT) {
						if (dx * dx + dy * dy < maxDistance)
							target.state = STATE::FLOATFALL;
					}
				}
			
			jjPLAYER@ creator = (obj.creatorType == CREATOR::PLAYER) ? jjPlayers[obj.creatorID] : null;
			const bool canDamageOtherPlayers = (jjIsServer || jjGameConnection == GAME::LOCAL) && (jjGameState == GAME::STARTED || jjGameState == GAME::OVERTIME) && !(creator !is null && creator.blink != 0);
			for (int i = 0; i < 32; i++) {
				jjPLAYER@ victim = jjPlayers[i];
				if (victim.isInGame && victim.health > 0) {
					const float dx = victim.xPos - obj.xPos, dy = victim.yPos - obj.yPos;
					if (dx * dx + dy * dy < maxDistance) {
						victim.xSpeed = dx>0 ? 8 : -8;
						victim.ySpeed = dy>0 ? 8 : -8;
						if (canDamageOtherPlayers && obj.var[8] & 1 << i == 0 && (creator is null || creator.isEnemy(victim))) {
							victim.hurt(obj.var[5], false, creator);
							obj.var[8] = obj.var[8] | 1 << i;
						}
					}
				}
			}
			
			if (++obj.counter == 14)
				obj.delete();
		}
	}
}