This commit is contained in:
TheGiddyLimit
2024-01-25 23:07:09 +00:00
parent 5ffd4acdb4
commit a4e391a3e7
94 changed files with 7263 additions and 939 deletions

View File

@@ -25,44 +25,44 @@ class PageFilterVehicles extends PageFilter {
this._miscFilter = new Filter({header: "Miscellaneous", items: ["SRD", "Legacy", "Has Images", "Has Info", "Has Token"], isMiscFilter: true});
}
static mutateForFilters (it) {
it._fSpeed = 0;
if (typeof it.speed === "number" && it.speed > 0) {
it._fSpeed = it.speed;
} else if (it.speed) {
const maxSpeed = Math.max(...Object.values(it.speed));
if (maxSpeed > 0) it._fSpeed = maxSpeed;
} else if (it.pace && typeof it.pace === "number") {
it._fSpeed = it.pace * 10; // Based on "Special Travel Pace," DMG p242
static mutateForFilters (ent) {
ent._fSpeed = 0;
if (typeof ent.speed === "number" && ent.speed > 0) {
ent._fSpeed = ent.speed;
} else if (ent.speed) {
const maxSpeed = Math.max(...Object.values(ent.speed));
if (maxSpeed > 0) ent._fSpeed = maxSpeed;
} else if (ent.pace && typeof ent.pace === "number") {
ent._fSpeed = ent.pace * 10; // Based on "Special Travel Pace," DMG p242
}
it._fHp = 0;
if (it.hp && it.hp.hp != null) {
it._fHp = it.hp.hp;
} else if (it.hull && it.hull.hp != null) {
it._fHp = it.hull.hp;
} else if (it.hp && it.hp.average != null) {
it._fHp = it.hp.average;
ent._fHp = 0;
if (ent.hp && ent.hp.hp != null) {
ent._fHp = ent.hp.hp;
} else if (ent.hull && ent.hull.hp != null) {
ent._fHp = ent.hull.hp;
} else if (ent.hp && ent.hp.average != null) {
ent._fHp = ent.hp.average;
}
it._fAc = 0;
if (it.hull && it.hull.ac != null) {
it._fAc = it.hull.ac;
} else if (it.vehicleType === "INFWAR") {
it._fAc = 19 + Parser.getAbilityModNumber(it.dex == null ? 10 : it.dex);
} else if (it.ac instanceof Array) {
it._fAc = it.ac.map(it => it.special ? null : (it.ac || it)).filter(it => it !== null);
} else if (it.ac) {
it._fAc = it.ac;
ent._fAc = 0;
if (ent.hull && ent.hull.ac != null) {
ent._fAc = ent.hull.ac;
} else if (ent.vehicleType === "INFWAR") {
ent._fAc = 19 + Parser.getAbilityModNumber(ent.dex == null ? 10 : ent.dex);
} else if (ent.ac instanceof Array) {
ent._fAc = ent.ac.map(it => it.special ? null : (it.ac || it)).filter(it => it !== null);
} else if (ent.ac) {
ent._fAc = ent.ac;
}
it._fCreatureCapacity = (it.capCrew || 0) + (it.capPassenger || 0) + (it.capCreature || 0);
ent._fCreatureCapacity = (ent.capCrew || 0) + (ent.capPassenger || 0) + (ent.capCreature || 0);
it._fMisc = it.srd ? ["SRD"] : [];
if (SourceUtil.isLegacySourceWotc(it.source)) it._fMisc.push("Legacy");
if (it.tokenUrl || it.hasToken) it._fMisc.push("Has Token");
if (it.hasFluff || it.fluff?.entries) it._fMisc.push("Has Info");
if (it.hasFluffImages || it.fluff?.images) it._fMisc.push("Has Images");
ent._fMisc = ent.srd ? ["SRD"] : [];
if (SourceUtil.isLegacySourceWotc(ent.source)) ent._fMisc.push("Legacy");
if (Renderer.vehicle.hasToken(ent)) ent._fMisc.push("Has Token");
if (ent.hasFluff || ent.fluff?.entries) ent._fMisc.push("Has Info");
if (ent.hasFluffImages || ent.fluff?.images) ent._fMisc.push("Has Images");
}
addToFilters (it, isExcluded) {