changes on the form persist now, spell is now correctly queued.
parent
c51e281530
commit
8be096f464
|
|
@ -165,7 +165,6 @@ export class LiturgyData {
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
durationText = this.#ranks[currentDuration].duration
|
durationText = this.#ranks[currentDuration].duration
|
||||||
console.log({currentDuration, durationText, adjustedDurationText})
|
|
||||||
return {currentDuration, durationText, adjustedDurationText}
|
return {currentDuration, durationText, adjustedDurationText}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,10 +96,9 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
|
|
||||||
static async #onSubmitForm(event, form, formData) {
|
static async #onSubmitForm(event, form, formData) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
console.log(formData.object)
|
|
||||||
// handle changes in variable Inputs
|
// handle changes in variable Inputs
|
||||||
this._selectedRepresentation = formData.object.representation ?? this._selectedRepresentation
|
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._spell.system.probe.includes("*")) { // ATTRIBUTO
|
||||||
if (this._variants["Mut"]) {
|
if (this._variants["Mut"]) {
|
||||||
this._spellDie = "MU"
|
this._spellDie = "MU"
|
||||||
|
|
@ -121,15 +120,8 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
this._spellDie = null
|
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 === "")
|
let costMutators = foundry.utils.expandObject(formData.object)["costMutators"] ?? this._costMutators
|
||||||
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"]
|
|
||||||
|
|
||||||
if (costMutators) {
|
if (costMutators) {
|
||||||
this._costMutators = costMutators
|
this._costMutators = costMutators
|
||||||
|
|
@ -137,9 +129,9 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
|
|
||||||
this.cost = this.normalizeCastingCost()
|
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
|
this.mod = 0
|
||||||
|
|
@ -196,6 +188,62 @@ export class SpellDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static async #cast(event, target) {
|
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
|
if (result.tap >= 0) { // erfolg
|
||||||
result.evaluated.toMessage({
|
await result.evaluated.toMessage({
|
||||||
speaker: ChatMessage.getSpeaker({actor: this._actor}),
|
speaker: ChatMessage.getSpeaker({actor: this._actor}),
|
||||||
flavor: ` ${result.meisterlich ? 'Meisterlich geschafft' : 'Geschafft'} mit ${result.tap} Punkten übrig`,
|
flavor: ` ${result.meisterlich ? 'Meisterlich geschafft' : 'Geschafft'} mit ${result.tap} Punkten übrig`,
|
||||||
})
|
})
|
||||||
} else { // misserfolg
|
} else { // misserfolg
|
||||||
result.evaluated.toMessage({
|
await result.evaluated.toMessage({
|
||||||
speaker: ChatMessage.getSpeaker({actor: this._actor}),
|
speaker: ChatMessage.getSpeaker({actor: this._actor}),
|
||||||
flavor: ` ${result.meisterlich ? 'Gepatzt' : ''} mit ${Math.abs(result.tap)} Punkten daneben`,
|
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
|
let formula = spell.system.zauberdauer.additionalFormula
|
||||||
if (formula) {
|
if (formula) {
|
||||||
Object.entries(additionalFormulaData).forEach(([variableName, variableValue]) => {
|
Object.entries(additionalFormulaData).forEach(([variableName, variableValue]) => {
|
||||||
console.log(variableName, variableValue)
|
|
||||||
formula = formula.replaceAll(variableName, variableValue)
|
formula = formula.replaceAll(variableName, variableValue)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,6 @@ function initSocketLib() {
|
||||||
|
|
||||||
|
|
||||||
Hooks.on("socketlib.ready", () => {
|
Hooks.on("socketlib.ready", () => {
|
||||||
console.log("Socketlib is registering")
|
|
||||||
let socket = socketlib.registerSystem("DSA_4-1")
|
let socket = socketlib.registerSystem("DSA_4-1")
|
||||||
socket.register("removeFromLootTable", removeFromLootTable)
|
socket.register("removeFromLootTable", removeFromLootTable)
|
||||||
socket.register("buyFromLootTable", buyFromLootTable)
|
socket.register("buyFromLootTable", buyFromLootTable)
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,6 @@ export class ActionManager {
|
||||||
source: ActionManager.SF,
|
source: ActionManager.SF,
|
||||||
cooldown: (options) => options.mod - 2,
|
cooldown: (options) => options.mod - 2,
|
||||||
activate: (queue, data) => {
|
activate: (queue, data) => {
|
||||||
console.log(queue, data)
|
|
||||||
data.actor.rollAttack(data)
|
data.actor.rollAttack(data)
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,6 @@ export class StandaloneLiturgies extends HandlebarsApplicationMixin(ActorSheetV2
|
||||||
// sort by rank
|
// sort by rank
|
||||||
const rankData = LiturgyData.getRankOfLiturgy(item.system, deity)
|
const rankData = LiturgyData.getRankOfLiturgy(item.system, deity)
|
||||||
if (rankData) {
|
if (rankData) {
|
||||||
console.log(rankData)
|
|
||||||
let {index, name, lkp, mod, costKaP} = rankData;
|
let {index, name, lkp, mod, costKaP} = rankData;
|
||||||
|
|
||||||
insertObject["count" + name] = insertObject["count" + name] + 1;
|
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",
|
initial: thisObject.actor.system.setEquipped ? "pane" + (thisObject.actor.system.setEquipped + 1) : "pane1",
|
||||||
group: "set-tabs",
|
group: "set-tabs",
|
||||||
callback: (event, tab, tabName) => {
|
callback: (event, tab, tabName) => {
|
||||||
console.log(event, tab, tabName)
|
|
||||||
thisObject.selectedTab = tabName
|
thisObject.selectedTab = tabName
|
||||||
thisObject.element.querySelectorAll(tab._contentSelector).forEach(
|
thisObject.element.querySelectorAll(tab._contentSelector).forEach(
|
||||||
(tab) => {
|
(tab) => {
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ export default {
|
||||||
// sort by rank
|
// sort by rank
|
||||||
const rankData = LiturgyData.getRankOfLiturgy(item.system, deity)
|
const rankData = LiturgyData.getRankOfLiturgy(item.system, deity)
|
||||||
if (rankData) {
|
if (rankData) {
|
||||||
console.log(rankData)
|
|
||||||
let {index, name, lkp, mod, costKaP} = rankData;
|
let {index, name, lkp, mod, costKaP} = rankData;
|
||||||
|
|
||||||
insertObject["count" + name] = insertObject["count" + name] + 1;
|
insertObject["count" + name] = insertObject["count" + name] + 1;
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,6 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
||||||
|
|
||||||
if (cooldown && cooldown.current >= cooldown.start) {
|
if (cooldown && cooldown.current >= cooldown.start) {
|
||||||
const am = new ActionManager(this.document)
|
const am = new ActionManager(this.document)
|
||||||
console.log(cooldown.data.maneuver)
|
|
||||||
const action = new Function(`return ${cooldown.data.maneuver}`)
|
const action = new Function(`return ${cooldown.data.maneuver}`)
|
||||||
|
|
||||||
if (action) {
|
if (action) {
|
||||||
|
|
@ -245,13 +244,11 @@ class CharacterSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
||||||
|
|
||||||
static openSpellDialog(event, target) {
|
static openSpellDialog(event, target) {
|
||||||
const {itemId} = target.dataset
|
const {itemId} = target.dataset
|
||||||
console.log(itemId)
|
|
||||||
this.document.itemTypes["Spell"]?.find(p => p.id === itemId)?.sheet.render(true)
|
this.document.itemTypes["Spell"]?.find(p => p.id === itemId)?.sheet.render(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
static castSpell(event, target) {
|
static castSpell(event, target) {
|
||||||
const {itemId} = target.dataset
|
const {itemId} = target.dataset
|
||||||
console.log(itemId)
|
|
||||||
new SpellDialog(this.document, itemId).render(true)
|
new SpellDialog(this.document, itemId).render(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue