Ritsuna / Foundry_FFD20

GNU General Public License v3.0
5 stars 0 forks source link

Limitbreaks maximum not properly initialized #2

Closed SeekerAT closed 1 year ago

SeekerAT commented 1 year ago

Hello, A recent update to the ffd20.js file has caused Limitbreaks to no longer display a maximum value.

Within the prepareBaseData() function, the statement that initialized the limitbreak maximum was deleted.

It was previously initialized at the same time as the bab total was initialized, near the end of the function.

Below is the current function plus the limitbreak initialization statement that I copied from an older version. The limitbreak statement is bolded, not currently in the master code.

prepareBaseData() { super.prepareBaseData(), this.equipment = { shield: { type: CONFIG.FFD20.shieldTypes.none, id: void 0 }, armor: { type: CONFIG.FFD20.armorTypes.none, id: void 0 } }, this.classes = {}, this.resources ??= {}, this._resetInherentTotals(), callOldNamespaceHookAll("ffd20.prepareBaseActorData", "ffd20PrepareBaseActorData", this), Hooks.callAll("ffd20PrepareBaseActorData", this); const e2 = this.items.filter((e3) => "class" === e3.type), { level: t2, mythicTier: s2 } = e2.reduce((e3, t3) => (t3.prepareDerivedData(), e3.level += t3.hitDice, e3.mythicTier += t3.mythicTier, e3), { level: 0, mythicTier: 0 }); this.system.details.level.value = t2, this.system.details.mythicTier = s2; for (const e3 of Object.keys(CONFIG.FFD20.conditions)) this.system.attributes.conditions[e3] ??= false; { const e3 = Object.keys(this.system.abilities); for (const t3 of e3) { const e4 = this.system.abilities[t3].value; null == e4 ? (this.system.abilities[t3].total = null, this.system.abilities[t3].base = null, this.system.abilities[t3].baseMod = 0) : (this.system.abilities[t3].total = e4 - this.system.abilities[t3].drain, this.system.abilities[t3].penalty = (this.system.abilities[t3].penalty || 0) - Math.abs(this.system.abilities[t3].userPenalty || 0), this.system.abilities[t3].base = this.system.abilities[t3].total); } this.refreshAbilityModifiers(); } { const t3 = "system.attributes.bab.total", s3 = Math.floor(e2.reduce((e3, s4) => { const l2 = s4.system.babBase; return 0 !== l2 && getSourceInfo(this.sourceInfo, t3).positive.push({ name: s4.name, value: fractionalToString(l2) }), e3 + l2; }, 0)); this.system.attributes.bab.total = Math.floor(s3), setProperty(this,"system.attributes.limitbreak.max",1+Math.floor(getProperty(this,"system.details.level.value")/4)); } this._prepareClassSkills(), setProperty(this, "system.attributes.hd.total", this.system.details.level.value); }

Apologies if this is not the correct way to communicate the issue, or if this causes other problems. I am not familiar with github or a competent coder, I just hacked this together to fix an apparent problem.

Ritsuna commented 1 year ago

Limitbreaks did not work as intended before, as the best it did was give a pure max, the next version will have the second wind limitbreak added to all classes, allowing other limitbreaks to be linked into it as children/charge options so that uses are used properly. if someone with more knowledge then me can figure out how to make limitbreaks properly drain the primary limitbreak stat, i will restore it as it would then need less instructions then this:

For second wind it has: Instructions for setup Remove duplicates of this limitbreak Add all other Limitbreaks under this one in links>charges

For all others it reads: Instructions for setup Link this limitbreak under Limitbreak: Second Wind under links>charges to ensure proper use count tracking

SeekerAT commented 1 year ago

Thank you for explaining, I appreciate it. Thank you as well for creating and developing this system plugin.

What you explained is how we set up most class resources/ charges, it will be very easy to use.