changes on the form persist now, spell is now correctly queued.
parent
c51e281530
commit
8be096f464
|
|
@ -165,7 +165,6 @@ export class LiturgyData {
|
|||
|
||||
if (found) {
|
||||
durationText = this.#ranks[currentDuration].duration
|
||||
console.log({currentDuration, durationText, adjustedDurationText})
|
||||
return {currentDuration, durationText, adjustedDurationText}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,10 +96,9 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
|
||||
static async #onSubmitForm(event, form, formData) {
|
||||
event.preventDefault()
|
||||
console.log(formData.object)
|
||||
// handle changes in variable Inputs
|
||||
this._selectedRepresentation = formData.object.representation ?? this._selectedRepresentation
|
||||
this._variants = foundry.utils.expandObject(formData.object)["variants"] ?? {}
|
||||
this._variants = foundry.utils.expandObject(formData.object)["variants"] ?? this._variants
|
||||
if (this._spell.system.probe.includes("*")) { // ATTRIBUTO
|
||||
if (this._variants["Mut"]) {
|
||||
this._spellDie = "MU"
|
||||
|
|
@ -121,15 +120,8 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
this._spellDie = null
|
||||
}
|
||||
}
|
||||
if (this._selectedRepresentation) {
|
||||
this._costModel = this._spell.system.kosten.find(c => c.repräsentation === context.selectedRepresentation) ?? this._spell.system.kosten.find(c => c.repräsentation === "")
|
||||
this._castTimeModel = this._spell.system.zauberdauer
|
||||
this._castTimeMutators = {}
|
||||
this._costMutators = {}
|
||||
this._costModel.variables.forEach(v => this._costMutators[v] = 0)
|
||||
this._castTimeModel.variables.forEach(v => this._castTimeMutators[v] = 0)
|
||||
}
|
||||
let costMutators = foundry.utils.expandObject(formData.object)["costMutators"]
|
||||
|
||||
let costMutators = foundry.utils.expandObject(formData.object)["costMutators"] ?? this._costMutators
|
||||
|
||||
if (costMutators) {
|
||||
this._costMutators = costMutators
|
||||
|
|
@ -137,9 +129,9 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
|
||||
this.cost = this.normalizeCastingCost()
|
||||
|
||||
let castTimeMutators = foundry.utils.expandObject(formData.object)["castTimeMutators"]
|
||||
let castTimeMutators = foundry.utils.expandObject(formData.object)["castTimeMutators"] ?? this._castTimeMutators
|
||||
|
||||
this._castTimeMutators = castTimeMutators ?? {}
|
||||
this._castTimeMutators = castTimeMutators
|
||||
|
||||
|
||||
this.mod = 0
|
||||
|
|
@ -196,6 +188,62 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
}
|
||||
|
||||
static async #cast(event, target) {
|
||||
ChatMessage.create({
|
||||
user: game.user._id,
|
||||
speaker: {actor: this._actor},
|
||||
content: `beginnt ${this._spell.name} zu wirken`,
|
||||
type: CONST.CHAT_MESSAGE_TYPES.IC
|
||||
})
|
||||
const cooldowns = this._actor.system.cooldowns
|
||||
let m = (queue, data) => {
|
||||
|
||||
|
||||
ChatMessage.create({
|
||||
user: game.user._id,
|
||||
speaker: {actor: this._actor},
|
||||
content: data.message,
|
||||
type: CONST.CHAT_MESSAGE_TYPES.IC
|
||||
})
|
||||
}
|
||||
|
||||
let message = this._spell.system.wirkung
|
||||
if (this._activeVariants.length > 0) {
|
||||
message += "<hr/>"
|
||||
message += this._activeVariants.map(v => v.name).join(", ")
|
||||
}
|
||||
if (Object.keys(this._spoMods).length > 0) {
|
||||
message += "<hr/>"
|
||||
Object.entries(this._spoMods).forEach(([modName, times]) => {
|
||||
if (times > 0) {
|
||||
message += times + "x" + modName + "<br/>"
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (Object.keys({...this._castTimeMutators, ...this._costMutators}).length > 0) {
|
||||
message += "<hr/>"
|
||||
Object.entries({...this._castTimeMutators, ...this._costMutators}).forEach(([mutatorName, mutatorValue]) => {
|
||||
message += mutatorName + ": " + mutatorValue + "<br/>"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
cooldowns.push({
|
||||
start: this.castingTime,
|
||||
current: 0,
|
||||
data: {
|
||||
cssClass: "Magisch",
|
||||
title: this._spell.name,
|
||||
taw: this.zfp,
|
||||
mod: 0,
|
||||
actorId: this._actor._id,
|
||||
spellId: this._spell._id,
|
||||
message,
|
||||
maneuver: m.toString()
|
||||
}
|
||||
|
||||
})
|
||||
await this._actor.update({"system.cooldowns": cooldowns})
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -208,12 +256,12 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
}
|
||||
)
|
||||
if (result.tap >= 0) { // erfolg
|
||||
result.evaluated.toMessage({
|
||||
await result.evaluated.toMessage({
|
||||
speaker: ChatMessage.getSpeaker({actor: this._actor}),
|
||||
flavor: ` ${result.meisterlich ? 'Meisterlich geschafft' : 'Geschafft'} mit ${result.tap} Punkten übrig`,
|
||||
})
|
||||
} else { // misserfolg
|
||||
result.evaluated.toMessage({
|
||||
await result.evaluated.toMessage({
|
||||
speaker: ChatMessage.getSpeaker({actor: this._actor}),
|
||||
flavor: ` ${result.meisterlich ? 'Gepatzt' : ''} mit ${Math.abs(result.tap)} Punkten daneben`,
|
||||
})
|
||||
|
|
@ -279,7 +327,6 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
let formula = spell.system.zauberdauer.additionalFormula
|
||||
if (formula) {
|
||||
Object.entries(additionalFormulaData).forEach(([variableName, variableValue]) => {
|
||||
console.log(variableName, variableValue)
|
||||
formula = formula.replaceAll(variableName, variableValue)
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ function initSocketLib() {
|
|||
|
||||
|
||||
Hooks.on("socketlib.ready", () => {
|
||||
console.log("Socketlib is registering")
|
||||
let socket = socketlib.registerSystem("DSA_4-1")
|
||||
socket.register("removeFromLootTable", removeFromLootTable)
|
||||
socket.register("buyFromLootTable", buyFromLootTable)
|
||||
|
|
|
|||
|
|
@ -127,7 +127,6 @@ export class ActionManager {
|
|||
source: ActionManager.SF,
|
||||
cooldown: (options) => options.mod - 2,
|
||||
activate: (queue, data) => {
|
||||
console.log(queue, data)
|
||||
data.actor.rollAttack(data)
|
||||
return true
|
||||
},
|
||||
|
|
|
|||
|
|
@ -104,7 +104,6 @@ export class StandaloneLiturgies extends HandlebarsApplicationMixin(ActorSheetV2
|
|||
// sort by rank
|
||||
const rankData = LiturgyData.getRankOfLiturgy(item.system, deity)
|
||||
if (rankData) {
|
||||
console.log(rankData)
|
||||
let {index, name, lkp, mod, costKaP} = rankData;
|
||||
|
||||
insertObject["count" + name] = insertObject["count" + name] + 1;
|
||||
|
|
|
|||
|
|
@ -158,7 +158,6 @@ export default {
|
|||
initial: thisObject.actor.system.setEquipped ? "pane" + (thisObject.actor.system.setEquipped + 1) : "pane1",
|
||||
group: "set-tabs",
|
||||
callback: (event, tab, tabName) => {
|
||||
console.log(event, tab, tabName)
|
||||
thisObject.selectedTab = tabName
|
||||
thisObject.element.querySelectorAll(tab._contentSelector).forEach(
|
||||
(tab) => {
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ export default {
|
|||
// sort by rank
|
||||
const rankData = LiturgyData.getRankOfLiturgy(item.system, deity)
|
||||
if (rankData) {
|
||||
console.log(rankData)
|
||||
let {index, name, lkp, mod, costKaP} = rankData;
|
||||
|
||||
insertObject["count" + name] = insertObject["count" + name] + 1;
|
||||
|
|
|
|||
|
|
@ -189,7 +189,6 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
|||
|
||||
if (cooldown && cooldown.current >= cooldown.start) {
|
||||
const am = new ActionManager(this.document)
|
||||
console.log(cooldown.data.maneuver)
|
||||
const action = new Function(`return ${cooldown.data.maneuver}`)
|
||||
|
||||
if (action) {
|
||||
|
|
@ -245,13 +244,11 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
|||
|
||||
static openSpellDialog(event, target) {
|
||||
const {itemId} = target.dataset
|
||||
console.log(itemId)
|
||||
this.document.itemTypes["Spell"]?.find(p => p.id === itemId)?.sheet.render(true)
|
||||
}
|
||||
|
||||
static castSpell(event, target) {
|
||||
const {itemId} = target.dataset
|
||||
console.log(itemId)
|
||||
new SpellDialog(this.document, itemId).render(true)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue