Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Anniversary Bash 26 Battle | Jazz2Online | Battle | N/A | |||||
Anniversary Bash 24 Battle | Jazz2Online | Battle | N/A | |||||
RAID: Mirrow Legends | Violet CLM | Battle | 8.5 | |||||
Custom Weapons... | Violet CLM | Other | 10 |
#pragma require "FlashBang.asc"
#include "MLLE-Weapons.asc"
#pragma require "FlashBang.j2a"
namespace FlashBang {
class Weapon : MLLEWeapons::WeaponInterface {
Weapon() {
super(
regularObjectTemplate: MLLEWeapons::ObjectTemplate(
xSpeed: 6,
xAcc: 0.125,
ySpeed: -4,
playerHandling: HANDLING::PARTICLE,
killAnim: 1,
curAnim: 0,
var: array<int> = {0,0,0,0,0, 90},
lightType: LIGHT::POINT,
counterEnd: 90
),
powerupObjectTemplate: MLLEWeapons::ObjectTemplate(
xSpeed: 8,
xAcc: 0.1875,
ySpeed: -4,
playerHandling: HANDLING::PARTICLE,
killAnim: 1,
curAnim: 2,
var: array<int> = {0,0,0,0,0, 180},
lightType: LIGHT::POINT,
counterEnd: 90
),
animSetFilename: "FlashBang.j2a",
pickupAnimation: 0,
poweredUpPickupAnimation: 2,
powerupAnimation: 3,
traits: (se::weapon_default_traits | se::weapon_causes_splash_damage | se::weapon_inflicts_status_condition) ^ se::weapon_deals_damage,
behavior: function(obj, powerup) {
if (obj.creatorType == CREATOR::PLAYER && jjPlayers[obj.creatorID].isLocal) {
jjSample(obj.xPos, obj.yPos, SOUND::LABRAT_EYE3, 42, 0);
jjSample(obj.xPos, obj.yPos, SOUND::COMMON_ITEMTRE, 42, 0);
}
if (obj.eventID == OBJECT::ICEBULLET) obj.eventID = OBJECT::FIREBALLBULLET;
obj.behavior = Behavior;
}
);
}
uint getMaxDamage(bool powerup) const override { return 0; }
}
void Behavior(jjOBJ@ obj) {
obj.behave(BEHAVIOR::BULLET);
if (obj.state == STATE::FLY) {
if (obj.ySpeed < 8 && obj.xSpeed != 0)
obj.ySpeed += 0.25;
} else if (obj.state == STATE::EXPLODE && obj.var[2] == 0) {
obj.var[2] = 1;
jjOBJ@ blast = jjObjects[jjAddObject(OBJECT::BULLET, obj.xPos, obj.yPos, obj.creatorID, obj.creatorType, Shockwave)];
blast.counter = 0;
blast.var[5] = obj.var[5];
blast.animSpeed = MLLEWeapons::HelpfulBulletFunctions::IsPowerup(obj) ? 2 : 1;
blast.playerHandling = HANDLING::PARTICLE;
blast.bulletHandling = HANDLING::IGNOREBULLET;
blast.lightType = LIGHT::RING2;
blast.light = 0;
}
}
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;
}
}
if ((jjGameState == GAME::STARTED || jjGameState == GAME::OVERTIME)) {
for (int i = 0; i < jjLocalPlayerCount; i++)
if (obj.var[8] & 1 << i == 0) {
jjPLAYER@ victim = jjLocalPlayers[i];
if (victim.isInGame && victim.health > 0 && victim.blink == 0 && MLLEWeapons::HelpfulBulletFunctions::PlayerIsEnemy(obj, victim)) {
const float dx = victim.xPos - obj.xPos, dy = victim.yPos - obj.yPos;
if (dx * dx + dy * dy < maxDistance) {
victim.stoned = obj.var[5];
jjObjects[jjAddObject(0,0, OBJECT::SHARD, victim.playerID, CREATOR::OBJECT, Flash)].playerHandling = HANDLING::PARTICLE;
obj.var[8] = obj.var[8] | 1 << i;
}
}
}
}
if (++obj.counter == 14)
obj.delete();
}
void Flash(jjOBJ@ obj) { //doing this effect as an object behavior to minimize unnecessary hooks, thereby maximizing flexibility of use
if (++obj.age == 20)
obj.delete();
else {
const jjPLAYER@ play = jjPlayers[obj.creatorID];
jjDrawRectangle(play.cameraX - 32, play.cameraY - 32, jjSubscreenWidth + 64, jjSubscreenHeight + 64, 15, SPRITE::BLEND_NORMAL, obj.age * 12, -101, 4, obj.creatorID);
}
}
}
Jazz2Online © 1999-INFINITY (Site Credits). We have a Privacy Policy. Jazz Jackrabbit, Jazz Jackrabbit 2, Jazz Jackrabbit Advance and all related trademarks and media are ™ and © Epic Games. Lori Jackrabbit is © Dean Dodrill. J2O development powered by Loops of Fury and Chemical Beats.
Eat your lima beans, Johnny.