83 lines
3.3 KiB
Plaintext
83 lines
3.3 KiB
Plaintext
global.weapons = {};
|
|
#macro wp global.weapons
|
|
function weapon(name_, description_, type_, statmods=[]) constructor {
|
|
name = name_;
|
|
description = description_;
|
|
type = WPTYPE.SWORD;
|
|
modifiers = {};
|
|
var i;
|
|
for (i=0; i<array_length(statmods); i++) {
|
|
modifiers[$statmods[i].name] = statmods[i];
|
|
}
|
|
global.weapons[$name] = self;
|
|
}
|
|
|
|
enum WPTYPE {
|
|
NULL,
|
|
SWORD,
|
|
LEAF,
|
|
GUN,
|
|
}
|
|
|
|
function c_addweapon(target, weapon_, equip=false) {
|
|
//array_push(target.inventory, deep_copy(weapon_));
|
|
array_push(target.inventory, weapon_);
|
|
if equip {
|
|
target.equippedweapon = array_length(target.inventory)-1;
|
|
c_equipweapon(target, target.inventory[target.equippedweapon]);
|
|
}
|
|
}
|
|
|
|
function c_equipweapon(target, weapon_) {
|
|
c_fulleval(target);
|
|
}
|
|
nu weapon("nothing", "it's literally nothing", WPTYPE.NULL);
|
|
nu weapon("knife", "bleed, bleed", WPTYPE.SWORD, [new statmod(st.str, 20, add), new statmod(st.hit, 100, add)]);
|
|
nu weapon("iron sword", "made of a cringe material", WPTYPE.SWORD, [new statmod(st.str, 6, add), new statmod(st.hit, 90, add)]);
|
|
|
|
nu weapon("Blade", "it's blade.", WPTYPE.SWORD, [new statmod(st.str, 6, add), new statmod(st.hit, 90, add)]);
|
|
nu weapon("Maple Leaf", "eh? not going for true end?", WPTYPE.SWORD, [new statmod(st.str, 5, add), new statmod(st.hit, 95, add)]);
|
|
nu weapon("Microlaser", "special science laser instead of magic!", WPTYPE.SWORD, [new statmod(st.str, 4, add), new statmod(st.hit, 90, add)]);
|
|
nu weapon("Wrench", "a wrench of a common material", WPTYPE.SWORD, [new statmod(st.str, 9, add), new statmod(st.hit, 60, add)]);
|
|
nu weapon("Healgun", "heal-ish gun", WPTYPE.SWORD, [new statmod(st.str, 0, add), new statmod(st.str, -1, mult), new statmod(st.hit, 100, add)]);
|
|
|
|
nu weapon("Bayonet", "it's out of ammo...", WPTYPE.SWORD, [new statmod(st.str, 9, add), new statmod(st.hit, 90, add)]);
|
|
nu weapon("Rifle", "it has ammo, i guess", WPTYPE.SWORD, [new statmod(st.str, 6, add), new statmod(st.hit, 80, add), new statmod(st.rng, 1, add)]);
|
|
nu weapon("Lunar Machete", "sick", WPTYPE.SWORD, [new statmod(st.str, 9, add), new statmod(st.hit, 90, add)]);
|
|
nu weapon("Glock", "gang shit", WPTYPE.SWORD, [new statmod(st.str, 4, add), new statmod(st.hit, 95, add)]);
|
|
nu weapon("Sniper Rifle", "gang shit", WPTYPE.SWORD, [new statmod(st.str, 11, add), new statmod(st.hit, 100, add)]);
|
|
|
|
nu weapon("Bottle", "it was full, just a minute ago...", WPTYPE.SWORD, [new statmod(st.str, 10, add), new statmod(st.hit, 33, add)]);
|
|
|
|
function c_modifierreset(target) {
|
|
var dudes = variable_struct_get_names(target.data);
|
|
var lads = variable_struct_get_names(st);
|
|
var i;
|
|
for (i=0; i<array_length(dudes); i++) {
|
|
while !array_contains(lads, dudes[i]) || dudes[i] == "hp" {
|
|
array_delete(dudes, i, 1);
|
|
if i >= array_length(dudes) break;
|
|
}
|
|
if i >= array_length(dudes) break;
|
|
target.data[$dudes[i]].val = target.data[$dudes[i]].cap;
|
|
}
|
|
}
|
|
|
|
function c_modeval(target, weapon_) {
|
|
var lads = variable_struct_get_names(target.data);
|
|
var dudes = variable_struct_get_names(weapon_.modifiers);
|
|
var i;
|
|
for (i=0; i<array_length(dudes); i++) {
|
|
if array_contains(lads, dudes[i]) {
|
|
target.data[$dudes[i]].val = weapon_.modifiers[$dudes[i]].operation(
|
|
target.data[$dudes[i]].val,
|
|
weapon_.modifiers[$dudes[i]].val
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
function c_statexists(target, statstring) {
|
|
var dudes = variable_struct_get_names(target.data);
|
|
return array_contains(dudes, statstring);
|
|
} |