Add effects and tabs
This commit is contained in:
+182
-20
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* Weapon types based on Prism RPG rules
|
||||
* Default weapon types based on Prism RPG rules
|
||||
* APC determines weapon class: Light (1 APC), One-Handed (2 APC), Heavy (3 APC)
|
||||
*/
|
||||
export const TYPE = Object.freeze({
|
||||
const DEFAULT_TYPES = {
|
||||
light: {
|
||||
id: "light",
|
||||
label: "PRISMRPG.Weapon.Type.light",
|
||||
@@ -27,22 +27,75 @@ export const TYPE = Object.freeze({
|
||||
apc: 0, // Variable based on specific weapon
|
||||
hands: 2
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get weapon types (default + custom from settings)
|
||||
*/
|
||||
export function getWeaponTypes() {
|
||||
if (!game?.settings) return DEFAULT_TYPES;
|
||||
|
||||
const customTypes = game.settings.get("fvtt-prism-rpg", "customWeaponTypes") || {};
|
||||
return foundry.utils.mergeObject(DEFAULT_TYPES, customTypes, { inplace: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Weapon types (dynamically loaded)
|
||||
*/
|
||||
export const TYPE = new Proxy({}, {
|
||||
get(target, prop) {
|
||||
const types = getWeaponTypes();
|
||||
return types[prop];
|
||||
},
|
||||
ownKeys(target) {
|
||||
return Object.keys(getWeaponTypes());
|
||||
},
|
||||
getOwnPropertyDescriptor(target, prop) {
|
||||
return {
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Simplified Weapon Types object for form choices (label-only format)
|
||||
*/
|
||||
export const TYPE_CHOICES = Object.freeze(
|
||||
Object.fromEntries(
|
||||
Object.entries(TYPE).map(([key, value]) => [key, value.label])
|
||||
)
|
||||
);
|
||||
export function getWeaponTypeChoices() {
|
||||
const types = getWeaponTypes();
|
||||
return Object.fromEntries(
|
||||
Object.entries(types).map(([key, value]) => [key, value.label])
|
||||
);
|
||||
}
|
||||
|
||||
export const TYPE_CHOICES = new Proxy({}, {
|
||||
get(target, prop) {
|
||||
const choices = getWeaponTypeChoices();
|
||||
return choices[prop];
|
||||
},
|
||||
ownKeys(target) {
|
||||
return Object.keys(getWeaponTypeChoices());
|
||||
},
|
||||
getOwnPropertyDescriptor(target, prop) {
|
||||
return {
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Weapon groups and their associated passives
|
||||
* Default weapon groups and their associated passives
|
||||
* Each weapon belongs to a group and possesses its passive while wielded
|
||||
*/
|
||||
export const WEAPON_GROUP = Object.freeze({
|
||||
const DEFAULT_WEAPON_GROUPS = {
|
||||
shortsword: {
|
||||
id: "shortsword",
|
||||
label: "PRISMRPG.WeaponGroup.shortsword",
|
||||
passive: "quickBlade",
|
||||
passiveLabel: "PRISMRPG.Weapon.Passive.quickBlade",
|
||||
passiveDescription: "PRISMRPG.Weapon.PassiveDescription.quickBlade"
|
||||
},
|
||||
longsword: {
|
||||
id: "longsword",
|
||||
label: "PRISMRPG.WeaponGroup.longsword",
|
||||
@@ -50,12 +103,19 @@ export const WEAPON_GROUP = Object.freeze({
|
||||
passiveLabel: "PRISMRPG.Weapon.Passive.turningEdge",
|
||||
passiveDescription: "PRISMRPG.Weapon.PassiveDescription.turningEdge"
|
||||
},
|
||||
warhammer: {
|
||||
id: "warhammer",
|
||||
label: "PRISMRPG.WeaponGroup.warhammer",
|
||||
passive: "puncturingBlows",
|
||||
passiveLabel: "PRISMRPG.Weapon.Passive.puncturingBlows",
|
||||
passiveDescription: "PRISMRPG.Weapon.PassiveDescription.puncturingBlows"
|
||||
greatsword: {
|
||||
id: "greatsword",
|
||||
label: "PRISMRPG.WeaponGroup.greatsword",
|
||||
passive: "cleave",
|
||||
passiveLabel: "PRISMRPG.Weapon.Passive.cleave",
|
||||
passiveDescription: "PRISMRPG.Weapon.PassiveDescription.cleave"
|
||||
},
|
||||
handaxe: {
|
||||
id: "handaxe",
|
||||
label: "PRISMRPG.WeaponGroup.handaxe",
|
||||
passive: "throwingAxe",
|
||||
passiveLabel: "PRISMRPG.Weapon.Passive.throwingAxe",
|
||||
passiveDescription: "PRISMRPG.Weapon.PassiveDescription.throwingAxe"
|
||||
},
|
||||
battleaxe: {
|
||||
id: "battleaxe",
|
||||
@@ -64,6 +124,62 @@ export const WEAPON_GROUP = Object.freeze({
|
||||
passiveLabel: "PRISMRPG.Weapon.Passive.shieldEater",
|
||||
passiveDescription: "PRISMRPG.Weapon.PassiveDescription.shieldEater"
|
||||
},
|
||||
greataxe: {
|
||||
id: "greataxe",
|
||||
label: "PRISMRPG.WeaponGroup.greataxe",
|
||||
passive: "devastatingBlow",
|
||||
passiveLabel: "PRISMRPG.Weapon.Passive.devastatingBlow",
|
||||
passiveDescription: "PRISMRPG.Weapon.PassiveDescription.devastatingBlow"
|
||||
},
|
||||
club: {
|
||||
id: "club",
|
||||
label: "PRISMRPG.WeaponGroup.club",
|
||||
passive: "stun",
|
||||
passiveLabel: "PRISMRPG.Weapon.Passive.stun",
|
||||
passiveDescription: "PRISMRPG.Weapon.PassiveDescription.stun"
|
||||
},
|
||||
mace: {
|
||||
id: "mace",
|
||||
label: "PRISMRPG.WeaponGroup.mace",
|
||||
passive: "armorBreaker",
|
||||
passiveLabel: "PRISMRPG.Weapon.Passive.armorBreaker",
|
||||
passiveDescription: "PRISMRPG.Weapon.PassiveDescription.armorBreaker"
|
||||
},
|
||||
greatMaul: {
|
||||
id: "greatMaul",
|
||||
label: "PRISMRPG.WeaponGroup.greatMaul",
|
||||
passive: "earthshatter",
|
||||
passiveLabel: "PRISMRPG.Weapon.Passive.earthshatter",
|
||||
passiveDescription: "PRISMRPG.Weapon.PassiveDescription.earthshatter"
|
||||
},
|
||||
javelin: {
|
||||
id: "javelin",
|
||||
label: "PRISMRPG.WeaponGroup.javelin",
|
||||
passive: "piercingThrow",
|
||||
passiveLabel: "PRISMRPG.Weapon.Passive.piercingThrow",
|
||||
passiveDescription: "PRISMRPG.Weapon.PassiveDescription.piercingThrow"
|
||||
},
|
||||
spear: {
|
||||
id: "spear",
|
||||
label: "PRISMRPG.WeaponGroup.spear",
|
||||
passive: "reach",
|
||||
passiveLabel: "PRISMRPG.Weapon.Passive.reach",
|
||||
passiveDescription: "PRISMRPG.Weapon.PassiveDescription.reach"
|
||||
},
|
||||
longSpear: {
|
||||
id: "longSpear",
|
||||
label: "PRISMRPG.WeaponGroup.longSpear",
|
||||
passive: "extendedReach",
|
||||
passiveLabel: "PRISMRPG.Weapon.Passive.extendedReach",
|
||||
passiveDescription: "PRISMRPG.Weapon.PassiveDescription.extendedReach"
|
||||
},
|
||||
warhammer: {
|
||||
id: "warhammer",
|
||||
label: "PRISMRPG.WeaponGroup.warhammer",
|
||||
passive: "puncturingBlows",
|
||||
passiveLabel: "PRISMRPG.Weapon.Passive.puncturingBlows",
|
||||
passiveDescription: "PRISMRPG.Weapon.PassiveDescription.puncturingBlows"
|
||||
},
|
||||
dagger: {
|
||||
id: "dagger",
|
||||
label: "PRISMRPG.WeaponGroup.dagger",
|
||||
@@ -85,16 +201,62 @@ export const WEAPON_GROUP = Object.freeze({
|
||||
passiveLabel: "PRISMRPG.Weapon.Passive.volleyFire",
|
||||
passiveDescription: "PRISMRPG.Weapon.PassiveDescription.volleyFire"
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get weapon groups (default + custom from settings)
|
||||
*/
|
||||
export function getWeaponGroups() {
|
||||
if (!game?.settings) return DEFAULT_WEAPON_GROUPS;
|
||||
|
||||
const customGroups = game.settings.get("fvtt-prism-rpg", "customWeaponGroups") || {};
|
||||
return foundry.utils.mergeObject(DEFAULT_WEAPON_GROUPS, customGroups, { inplace: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Weapon groups (dynamically loaded)
|
||||
*/
|
||||
export const WEAPON_GROUP = new Proxy({}, {
|
||||
get(target, prop) {
|
||||
const groups = getWeaponGroups();
|
||||
return groups[prop];
|
||||
},
|
||||
ownKeys(target) {
|
||||
return Object.keys(getWeaponGroups());
|
||||
},
|
||||
getOwnPropertyDescriptor(target, prop) {
|
||||
return {
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Simplified Weapon Groups object for form choices (label-only format)
|
||||
*/
|
||||
export const WEAPON_GROUP_CHOICES = Object.freeze(
|
||||
Object.fromEntries(
|
||||
Object.entries(WEAPON_GROUP).map(([key, value]) => [key, value.label])
|
||||
)
|
||||
);
|
||||
export function getWeaponGroupChoices() {
|
||||
const groups = getWeaponGroups();
|
||||
return Object.fromEntries(
|
||||
Object.entries(groups).map(([key, value]) => [key, value.label])
|
||||
);
|
||||
}
|
||||
|
||||
export const WEAPON_GROUP_CHOICES = new Proxy({}, {
|
||||
get(target, prop) {
|
||||
const choices = getWeaponGroupChoices();
|
||||
return choices[prop];
|
||||
},
|
||||
ownKeys(target) {
|
||||
return Object.keys(getWeaponGroupChoices());
|
||||
},
|
||||
getOwnPropertyDescriptor(target, prop) {
|
||||
return {
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Damage types for weapons
|
||||
|
||||
Reference in New Issue
Block a user