Downloads containing ArcaneWeapon9.asc

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: A Titan, Ornery cooba Battle N/A Download file
TSF with JJ2+ Only: Anniversary Bash 26 CTF Jazz2Online Capture the flag N/A Download file
JJ2+ Only: Anniversary Bash 25 CTF Jazz2Online Capture the flag N/A Download file
TSF with JJ2+ Only: Blast ConcussionFeatured Download Violet CLM Capture the flag 9.7 Download file
TSF with JJ2+ Only: Anniversary Bash 24 Battle Jazz2Online Battle N/A Download file
TSF with JJ2+ Only: Acid ReignFeatured Download cooba Battle 9.2 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 "ArcaneWeapon9.asc"
#include "MLLE-Weapons.asc"
#pragma require "FusionCannon.j2a"
#pragma offer "f_fus1.wav"
#pragma offer "f_fus3.wav"

namespace ArcaneWeapons {
	namespace FusionCannon {
		class Weapon : MLLEWeapons::WeaponInterface {
			Weapon() {
				super(
					regularObjectTemplate: MLLEWeapons::ObjectTemplate(
						xSpeed: 5,
						curAnim: jjAnimSets[ANIM::AMMO].firstAnim + 75,
						killAnim: jjAnimSets[ANIM::AMMO].firstAnim + 82,
						frameID: 4,
						var: array<int> = {40,59,0,0,0,1,2|16},
						lightType: LIGHT::POINT2,
						counterEnd: 255
					),
					powerupObjectTemplate: MLLEWeapons::ObjectTemplate(
						xSpeed: 5,
						animSpeed: 3,
						curAnim: jjAnimSets[ANIM::AMMO].firstAnim + 75,
						killAnim: jjAnimSets[ANIM::AMMO].firstAnim + 82,
						frameID: 4,
						var: array<int> = {35,32,0,0,0,2,2|16},
						lightType: LIGHT::POINT2,
						counterEnd: 255
					),
					animSetFilename: "FusionCannon.j2a",
					pickupAnimation: 0,
					poweredUpPickupAnimation: 1,
					ammoCrateAnimation: 3,
					powerupAnimation: 2,
					sampleFilenames: array<string> = {"f_fus1.wav", "f_fus3.wav"},
					roundsPerPickup: 2,
					style: WEAPON::CAPPED,
					traits: se::weapon_default_traits | se::weapon_causes_splash_damage | se::weapon_is_super_weapon,
					behavior: MLLEWeapons::behaviorFunction(DetermineBehavior)
				);
			}
			void DetermineBehavior(jjOBJ@ obj, bool powerup) {
				if (obj.creatorType == CREATOR::PLAYER)
					jjSample(obj.xPos, obj.yPos, Samples[jjRandom() & 1]);
				if (obj.eventID == OBJECT::ICEBULLET) obj.eventID = OBJECT::BLASTERBULLET;
				obj.var[7] = 0;
				obj.behavior = Behavior;
			}
		}
		
		void Behavior(jjOBJ@ obj) {
			obj.behave(BEHAVIOR::BULLET, obj.state == STATE::EXPLODE);
			
			switch (obj.state) {
				case STATE::FLY:
					for (int i = 0; i < 2; ++i)
						jjDrawSprite(obj.xPos, obj.yPos, ANIM::AMMO, 77, 6, 0, SPRITE::ALPHAMAP, obj.var[0]);
					
					if (obj.counter % 5 == 0 && !jjLowDetail) {
						jjOBJ@ trail = jjObjects[jjAddObject(OBJECT::EXPLOSION, obj.xPos, obj.yPos, obj.creatorID, obj.creatorType, function(trail){
							trail.behave(BEHAVIOR::EXPLOSION, false);
							jjDrawSpriteFromCurFrame(trail.xPos, trail.yPos, trail.curFrame, trail.direction, SPRITE::TRANSLUCENTSINGLEHUE, trail.var[0]);
						})];
						trail.determineCurAnim(ANIM::AMMO, 12);
						trail.lightType = LIGHT::POINT;
						trail.playerHandling = HANDLING::PARTICLE;
						trail.var[0] = obj.var[1];
					}
					break;
				
				case STATE::EXPLODE:
					if (obj.var[2] == 0) {
						obj.var[2] = 1;
						jjOBJ@ blast = jjObjects[jjAddObject(OBJECT::BULLET, obj.xPos, obj.yPos, obj.creatorID, obj.creatorType, BEHAVIOR::INACTIVE)];
						blast.var[5] = obj.var[5];
						blast.counter = 4 + (obj.var[5] << 3);
						blast.playerHandling = HANDLING::PARTICLE;
						blast.bulletHandling = HANDLING::IGNOREBULLET;
						blast.animSpeed = 1;
						blast.light = 0;
						blast.lightType = LIGHT::RING2;
						blast.behavior = Shockwave;
					}
					break;
			}
		}
		void Shockwave(jjOBJ@ obj) {
			obj.light += 3;
			const int 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;
			if ((jjIsServer || jjGameConnection == GAME::LOCAL) && (jjGameState == GAME::STARTED || jjGameState == GAME::OVERTIME) && !(creator !is null && creator.blink != 0))
				for (int i = 0; i < 32; i++)
					if (obj.var[8] & 1 << i == 0) {
						jjPLAYER@ victim = jjPlayers[i];
						if (victim.isInGame && victim.health > 0 && (creator is null || creator.isEnemy(victim))) {
							const float dx = victim.xPos - obj.xPos, dy = victim.yPos - obj.yPos;
							if (dx * dx + dy * dy < maxDistance) {
								victim.hurt(obj.var[5], false, creator);
								obj.var[8] = obj.var[8] | 1 << i;
							}
						}
					}
			
			if (--obj.counter == 0)
				obj.delete();
		}
	}
}