Downloads containing ArcaneWeapon6.asc

Downloads
Name Author Game Mode Rating
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 "ArcaneWeapon6.asc"
#include "MLLE-Weapons.asc"
#pragma require "TornadoGun.j2a"

namespace ArcaneWeapons {
	namespace TornadoGun {
		class Weapon : MLLEWeapons::WeaponInterface {
			bool ShouldHurt = true;
			Weapon() {
				super(
					regularObjectTemplate: MLLEWeapons::ObjectTemplate(
						xSpeed: 4,
						xAcc: 0.075,
						yAcc: -0.1,
						curAnim: 0,
						special: -1,
						killAnim: jjAnimSets[ANIM::AMMO].firstAnim + 82,
						counterEnd: 110,
						light: LIGHT::POINT,
						var: array<int> = {0, 64*64, 5}
					),
					powerupObjectTemplate: MLLEWeapons::ObjectTemplate(
						xSpeed: 6,
						xAcc: 0.075,
						yAcc: -0.1,
						animSpeed: 2,
						curAnim: 1,
						special: -1,
						killAnim: jjAnimSets[ANIM::AMMO].firstAnim + 82,
						counterEnd: 120,
						light: LIGHT::POINT2,
						var: array<int> = {0, 96*96, 10}
					),
					animSetFilename: "TornadoGun.j2a",
					pickupAnimation: 3,
					poweredUpPickupAnimation: 2,
					ammoCrateAnimation: 5,
					powerupAnimation: 4,
					apply: MLLEWeapons::applyFunction(DetermineDanger),
					traits: se::weapon_default_traits | se::weapon_increases_mobility, //increases mobility of opponents, anyway
					behavior: MLLEWeapons::behaviorFunction(DetermineBehavior)
				);
			}
			bool DetermineDanger(uint, se::WeaponHook@, jjSTREAM@ parameter) {
				if (parameter !is null && parameter.getSize() >= 1)
					parameter.pop(ShouldHurt);
				return true;
			}
			void DetermineBehavior(jjOBJ@ obj, bool powerup) const {
				if (obj.creatorType == CREATOR::PLAYER && jjPlayers[obj.creatorID].isLocal) {
					const int frequency = powerup ? 30000 : 25000;
					jjSample(obj.xPos, obj.yPos, SOUND::INTRO_BLOW, 48, frequency);
					jjSample(obj.xPos, obj.yPos, SOUND::COMMON_BIRDFLY, 48, frequency);
				}
				if (obj.eventID == OBJECT::ICEBULLET) obj.eventID = OBJECT::BLASTERBULLET;
				if (!ShouldHurt) obj.playerHandling = HANDLING::PARTICLE;//for ground force and such
				obj.behavior = Behavior;
			}
		}
		
		void Behavior(jjOBJ@ obj) {
			obj.behave(BEHAVIOR::BULLET);
			if (obj.state == STATE::FLY && jjGameState == GAME::STARTED || jjGameState == GAME::OVERTIME)
				for (int lpid = 0; lpid < jjLocalPlayerCount; ++lpid) {
					jjPLAYER@ victim = jjLocalPlayers[lpid];
					if (victim.blink == 0 && MLLEWeapons::HelpfulBulletFunctions::PlayerIsEnemy(obj, victim)) {
						const float pdx = victim.xPos - obj.xPos, pdy = victim.yPos - obj.yPos;
						if (pdx * pdx + pdy * pdy < obj.var[1]) {
							const float speedAdjustment = obj.var[2] * 0.5;
							victim.ySpeed -= speedAdjustment;
							victim.xSpeed += speedAdjustment * MLLEWeapons::HelpfulBulletFunctions::GetDirection(obj);
						}
					}
				}
			else if (obj.state == STATE::EXPLODE && obj.var[0] == 0) {
				obj.var[0] = 1;
				jjSample(obj.xPos, obj.yPos, SOUND::COMMON_SWISH4, 36, 15000);
			}
		}
	}
}