Add new init system
This commit is contained in:
parent
d5f27ae9ea
commit
c1eb33bc21
47
lang/en.json
47
lang/en.json
@ -1,27 +1,32 @@
|
|||||||
{
|
{
|
||||||
"TYPES": {
|
"TYPES": {
|
||||||
|
"Actor": {
|
||||||
|
"character": "Character",
|
||||||
|
"npc": "NPC",
|
||||||
|
"vehicle": "Vehicle"
|
||||||
|
},
|
||||||
"Item": {
|
"Item": {
|
||||||
"Race": "Race",
|
"race": "Race",
|
||||||
"Role": "Role",
|
"role": "Role",
|
||||||
"Ability": "Ability",
|
"ability": "Ability",
|
||||||
"Specialisation": "Specialisation",
|
"specialisation": "Specialisation",
|
||||||
"Perk": "Perk",
|
"perk": "Perk",
|
||||||
"Power": "Power",
|
"power": "Power",
|
||||||
"Armor": "Armor",
|
"armor": "Armor",
|
||||||
"Shield": "Shield",
|
"shield": "Shield",
|
||||||
"Equipment": "Equipment",
|
"equipment": "Equipment",
|
||||||
"Weapon": "Weapon",
|
"weapon": "Weapon",
|
||||||
"Effect": "Effect",
|
"effect": "Effect",
|
||||||
"Money": "Money",
|
"money": "Money",
|
||||||
"Virtue": "Virtue",
|
"virtue": "Virtue",
|
||||||
"Vice": "Vice",
|
"vice": "Vice",
|
||||||
"Vehiclehull": "Vehicule Hull",
|
"vehiclehull": "Vehicule Hull",
|
||||||
"Powercoremodule": "Power Core Module",
|
"powercoremodule": "Power Core Module",
|
||||||
"Mobilitymodule": "Mobility Module",
|
"mobilitymodule": "Mobility Module",
|
||||||
"Combatmodule": "Combat Module",
|
"combatmodule": "Combat Module",
|
||||||
"Vehiclemodule": "Vehicle Module",
|
"vehiclemodule": "Vehicle Module",
|
||||||
"Vehicleweaponmodule" : "Vehicle Weapon Module",
|
"vehicleweaponmodule" : "Vehicle Weapon Module",
|
||||||
"Propulsionmodule": "Propulsion module"
|
"propulsionmodule": "Propulsion module"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,9 +92,7 @@ export class PegasusActor extends Actor {
|
|||||||
return actor;
|
return actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.type == 'character') {
|
if (data.type == 'character'|| this.type == 'npc') {
|
||||||
}
|
|
||||||
if (data.type == 'npc') {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -124,7 +122,7 @@ export class PegasusActor extends Actor {
|
|||||||
this.traumaState = "none"
|
this.traumaState = "none"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.type == 'character') {
|
if (this.type == 'character' || this.type == 'npc') {
|
||||||
this.computeNRGHealth();
|
this.computeNRGHealth();
|
||||||
this.system.encCapacity = this.getEncumbranceCapacity()
|
this.system.encCapacity = this.getEncumbranceCapacity()
|
||||||
this.buildContainerTree()
|
this.buildContainerTree()
|
||||||
@ -965,7 +963,7 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getInitiativeScore(combatId, combatantId) {
|
getInitiativeScore(combatId, combatantId) {
|
||||||
if (this.type == 'character') {
|
if (this.type == 'character' || this.type == 'npc') {
|
||||||
this.rollMR(true, combatId, combatantId)
|
this.rollMR(true, combatId, combatantId)
|
||||||
}
|
}
|
||||||
if (this.type == 'vehicle') {
|
if (this.type == 'vehicle') {
|
||||||
@ -1016,7 +1014,7 @@ export class PegasusActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getStat(statKey) {
|
getStat(statKey) {
|
||||||
let stat
|
let stat
|
||||||
if (this.type == "character" && statKey == 'mr') {
|
if ((this.type == "character" || this.type == 'npc') && statKey == 'mr') {
|
||||||
stat = duplicate(this.system.mr)
|
stat = duplicate(this.system.mr)
|
||||||
} else {
|
} else {
|
||||||
stat = duplicate(this.system.statistics[statKey])
|
stat = duplicate(this.system.statistics[statKey])
|
||||||
@ -1193,7 +1191,7 @@ export class PegasusActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
incDecNRG(value) {
|
incDecNRG(value) {
|
||||||
if (this.type == "character") {
|
if (this.type == "character" || this.type == 'npc') {
|
||||||
let nrg = duplicate(this.system.nrg)
|
let nrg = duplicate(this.system.nrg)
|
||||||
nrg.value += value
|
nrg.value += value
|
||||||
if (nrg.value >= 0 && nrg.value <= nrg.max) {
|
if (nrg.value >= 0 && nrg.value <= nrg.max) {
|
||||||
@ -1345,7 +1343,7 @@ export class PegasusActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getTraumaState() {
|
getTraumaState() {
|
||||||
this.traumaState = "none"
|
this.traumaState = "none"
|
||||||
if (this.type == "character") {
|
if (this.type == "character"|| this.type == 'npc') {
|
||||||
if (this.system.secondary.delirium.status == "trauma") {
|
if (this.system.secondary.delirium.status == "trauma") {
|
||||||
this.traumaState = "trauma"
|
this.traumaState = "trauma"
|
||||||
}
|
}
|
||||||
@ -1918,7 +1916,7 @@ export class PegasusActor extends Actor {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
computeCurrentHindrances() {
|
computeCurrentHindrances() {
|
||||||
let hindrancesDices = 0
|
let hindrancesDices = 0
|
||||||
if (this.type == "character") {
|
if (this.type == "character" || this.type == 'npc') {
|
||||||
|
|
||||||
if (this.system.combat.stunlevel > 0) {
|
if (this.system.combat.stunlevel > 0) {
|
||||||
hindrancesDices += 2
|
hindrancesDices += 2
|
||||||
@ -1960,7 +1958,7 @@ export class PegasusActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
addHindrancesList(effectsList) {
|
addHindrancesList(effectsList) {
|
||||||
if (this.type == "character") {
|
if (this.type == "character"|| this.type == 'npc') {
|
||||||
if (this.system.combat.stunlevel > 0) {
|
if (this.system.combat.stunlevel > 0) {
|
||||||
effectsList.push({ label: "Stun Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: 2 })
|
effectsList.push({ label: "Stun Hindrance", type: "hindrance", foreign: true, actorId: this.id, applied: false, value: 2 })
|
||||||
}
|
}
|
||||||
@ -2137,6 +2135,7 @@ export class PegasusActor extends Actor {
|
|||||||
let rollData = PegasusUtility.getBasicRollData(isInit)
|
let rollData = PegasusUtility.getBasicRollData(isInit)
|
||||||
rollData.alias = this.name
|
rollData.alias = this.name
|
||||||
rollData.actorImg = this.img
|
rollData.actorImg = this.img
|
||||||
|
rollData.actorType = this.type
|
||||||
rollData.tokenId = this.token?.id
|
rollData.tokenId = this.token?.id
|
||||||
rollData.actorId = (this.token) ? this.token.actor.id : this.id
|
rollData.actorId = (this.token) ? this.token.actor.id : this.id
|
||||||
rollData.img = this.img
|
rollData.img = this.img
|
||||||
@ -2147,6 +2146,8 @@ export class PegasusActor extends Actor {
|
|||||||
rollData.noBonusDice = this.checkNoBonusDice()
|
rollData.noBonusDice = this.checkNoBonusDice()
|
||||||
rollData.dicePool = []
|
rollData.dicePool = []
|
||||||
rollData.subKey = subKey
|
rollData.subKey = subKey
|
||||||
|
rollData.tic1 = "NONE"
|
||||||
|
rollData.tic2 = "NONE"
|
||||||
|
|
||||||
if (subKey == "melee-dmg" || subKey == "ranged-dmg" || subKey == "power-dmg") {
|
if (subKey == "melee-dmg" || subKey == "ranged-dmg" || subKey == "power-dmg") {
|
||||||
rollData.isDamage = true
|
rollData.isDamage = true
|
||||||
@ -2209,7 +2210,7 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (statKey == "mr") {
|
if (statKey == "mr") {
|
||||||
if (this.type == "character") {
|
if (this.type == "character"|| this.type == 'npc') {
|
||||||
rollData.mrVehicle = PegasusUtility.checkIsVehicleCrew(this.id)
|
rollData.mrVehicle = PegasusUtility.checkIsVehicleCrew(this.id)
|
||||||
if (rollData.mrVehicle) {
|
if (rollData.mrVehicle) {
|
||||||
rollData.effectsList.push({
|
rollData.effectsList.push({
|
||||||
@ -2249,7 +2250,7 @@ export class PegasusActor extends Actor {
|
|||||||
processSizeBonus(rollData) {
|
processSizeBonus(rollData) {
|
||||||
if (rollData.defenderTokenId) {
|
if (rollData.defenderTokenId) {
|
||||||
let diffSize = 0
|
let diffSize = 0
|
||||||
if (this.type == "character") {
|
if (this.type == "character"|| this.type == 'npc') {
|
||||||
this.system.biodata.sizenum = this.system.biodata?.sizenum ?? 0
|
this.system.biodata.sizenum = this.system.biodata?.sizenum ?? 0
|
||||||
this.system.biodata.sizebonus = this.system.biodata?.sizebonus ?? 0
|
this.system.biodata.sizebonus = this.system.biodata?.sizebonus ?? 0
|
||||||
diffSize = rollData.defenderSize - this.system.biodata.sizenum + this.system.biodata.sizebonus
|
diffSize = rollData.defenderSize - this.system.biodata.sizenum + this.system.biodata.sizebonus
|
||||||
|
@ -1,21 +1,98 @@
|
|||||||
import { PegasusUtility } from "./pegasus-utility.js";
|
import { PegasusUtility } from "./pegasus-utility.js";
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
export class PegasusCombatTracker extends CombatTracker {
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
static get defaultOptions() {
|
||||||
|
let path = "systems/fvtt-pegasus-rpg/templates/pegasus-combat-tracker.html";
|
||||||
|
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||||
|
template: path,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
activateListeners(html) {
|
||||||
|
super.activateListeners(html)
|
||||||
|
|
||||||
|
html.find('.combat-tracker-tic').click(ev => {
|
||||||
|
let ticNum = $(ev.currentTarget).data("tic-num")
|
||||||
|
let combatantId = $(ev.currentTarget).data("combatant-id")
|
||||||
|
game.combat.revealTIC(ticNum, combatantId)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
export class PegasusCombat extends Combat {
|
export class PegasusCombat extends Combat {
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollInitiative(ids, formula = undefined, messageOptions = {} ) {
|
async rollInitiative(ids, formula = undefined, messageOptions = {}) {
|
||||||
ids = typeof ids === "string" ? [ids] : ids;
|
ids = typeof ids === "string" ? [ids] : ids;
|
||||||
for (let cId = 0; cId < ids.length; cId++) {
|
for (let cId = 0; cId < ids.length; cId++) {
|
||||||
const c = this.combatants.get(ids[cId]);
|
const c = this.combatants.get(ids[cId]);
|
||||||
let id = c._id || c.id;
|
let id = c._id || c.id;
|
||||||
let initBonus = c.actor ? c.actor.getInitiativeScore( this.id, id ) : -1;
|
let initBonus = c.actor ? c.actor.getInitiativeScore(this.id, id) : -1;
|
||||||
await this.updateEmbeddedDocuments("Combatant", [ { _id: id, initiative: initBonus } ]);
|
await this.updateEmbeddedDocuments("Combatant", [{ _id: id, initiative: initBonus }]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
isCharacter(combatantId) {
|
||||||
|
const combatant = game.combat.combatants.get(combatantId)
|
||||||
|
if (combatant) {
|
||||||
|
return combatant.actor.type == "character"
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async setTic(combatantId, rollData) {
|
||||||
|
if ( !combatantId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const combatant = game.combat.combatants.get(combatantId)
|
||||||
|
if (combatant) {
|
||||||
|
await combatant.setFlag("world", "tic1", { revealed: false, text: rollData.tic1 })
|
||||||
|
await combatant.setFlag("world", "tic2", { revealed: false, text: rollData.tic2 })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
getTIC(num, combatantId) {
|
||||||
|
if ( !combatantId) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
const combatant = game.combat.combatants.get(combatantId)
|
||||||
|
if (combatant) {
|
||||||
|
let ticData = combatant.getFlag("world", "tic" + num)
|
||||||
|
if (ticData) {
|
||||||
|
let ticText = "TIC" + num + ":" + ticData.text
|
||||||
|
/* returns if revealed or if GM and NPC or if player and owner */
|
||||||
|
if (ticData.revealed || (game.user.isGM && combatant.isNPC) || (!game.user.isGM && combatant.isOwner)) {
|
||||||
|
return ticText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "TIC" + num + ":???"
|
||||||
|
}
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async revealTIC(num, combatantId) {
|
||||||
|
if ( !num || !combatantId) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const combatant = game.combat.combatants.get(combatantId)
|
||||||
|
if (combatant) {
|
||||||
|
let ticData = combatant.getFlag("world", "tic" + num)
|
||||||
|
if (ticData) {
|
||||||
|
ticData.revealed = true
|
||||||
|
await combatant.setFlag("world", "tic" + num, ticData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_onUpdate(changed, options, userId) {
|
_onUpdate(changed, options, userId) {
|
||||||
}
|
}
|
||||||
@ -28,11 +105,11 @@ export class PegasusCombat extends Combat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async decInitBy10( combatantId, value) {
|
static async decInitBy10(combatantId, value) {
|
||||||
const combatant = game.combat.combatants.get(combatantId)
|
const combatant = game.combat.combatants.get(combatantId)
|
||||||
let initValue = combatant.initiative + value
|
let initValue = combatant.initiative + value
|
||||||
await game.combat.setInitiative(combatantId, initValue)
|
await game.combat.setInitiative(combatantId, initValue)
|
||||||
setTimeout( this.checkTurnPosition, 400) // The setInitiative is no more blocking for unknown reason
|
setTimeout(this.checkTurnPosition, 400) // The setInitiative is no more blocking for unknown reason
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -92,9 +92,11 @@ export class PegasusActorCreate {
|
|||||||
|
|
||||||
if (step == 'select-race-optionnal') {
|
if (step == 'select-race-optionnal') {
|
||||||
let ability = this.raceOptionnalAbilities.optionnalabilities.find(item => item._id == itemId);
|
let ability = this.raceOptionnalAbilities.optionnalabilities.find(item => item._id == itemId);
|
||||||
let update = []
|
let update = {}
|
||||||
await this.actor.applyAbility(ability, update);
|
await this.actor.applyAbility(ability, update);
|
||||||
|
if (!jQuery.isEmptyObject(update)) {
|
||||||
this.actor.update(update)
|
this.actor.update(update)
|
||||||
|
}
|
||||||
this.actor.createEmbeddedDocuments('Item', [ability]);
|
this.actor.createEmbeddedDocuments('Item', [ability]);
|
||||||
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
PegasusUtility.removeChatMessageId(PegasusUtility.findChatMessageId(event.currentTarget));
|
||||||
this.raceOptionnalAbilities.optionnalabilities = this.raceOptionnalAbilities.optionnalabilities.filter(item => item._id != itemId);
|
this.raceOptionnalAbilities.optionnalabilities = this.raceOptionnalAbilities.optionnalabilities.filter(item => item._id != itemId);
|
||||||
|
@ -12,11 +12,9 @@ import { PegasusActor } from "./pegasus-actor.js";
|
|||||||
import { PegasusItemSheet } from "./pegasus-item-sheet.js";
|
import { PegasusItemSheet } from "./pegasus-item-sheet.js";
|
||||||
import { PegasusActorSheet } from "./pegasus-actor-sheet.js";
|
import { PegasusActorSheet } from "./pegasus-actor-sheet.js";
|
||||||
import { PegasusVehicleSheet } from "./pegasus-vehicle-sheet.js";
|
import { PegasusVehicleSheet } from "./pegasus-vehicle-sheet.js";
|
||||||
import { PegasusNPCSheet } from "./pegasus-npc-sheet.js";
|
|
||||||
import { PegasusUtility } from "./pegasus-utility.js";
|
import { PegasusUtility } from "./pegasus-utility.js";
|
||||||
import { PegasusCombat } from "./pegasus-combat.js";
|
import { PegasusCombatTracker,PegasusCombat } from "./pegasus-combat.js";
|
||||||
import { PegasusItem } from "./pegasus-item.js";
|
import { PegasusItem } from "./pegasus-item.js";
|
||||||
import { PegasusToken } from "./pegasus-token.js";
|
|
||||||
import { PEGASUS_CONFIG } from "./pegasus-config.js"
|
import { PEGASUS_CONFIG } from "./pegasus-config.js"
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -58,6 +56,7 @@ Hooks.once("init", async function () {
|
|||||||
CONFIG.Combat.documentClass = PegasusCombat
|
CONFIG.Combat.documentClass = PegasusCombat
|
||||||
CONFIG.Actor.documentClass = PegasusActor
|
CONFIG.Actor.documentClass = PegasusActor
|
||||||
CONFIG.Item.documentClass = PegasusItem
|
CONFIG.Item.documentClass = PegasusItem
|
||||||
|
CONFIG.ui.combat = PegasusCombatTracker
|
||||||
game.system.pegasus = {
|
game.system.pegasus = {
|
||||||
utility: PegasusUtility,
|
utility: PegasusUtility,
|
||||||
config: PEGASUS_CONFIG
|
config: PEGASUS_CONFIG
|
||||||
@ -67,6 +66,7 @@ Hooks.once("init", async function () {
|
|||||||
// Register sheet application classes
|
// Register sheet application classes
|
||||||
Actors.unregisterSheet("core", ActorSheet);
|
Actors.unregisterSheet("core", ActorSheet);
|
||||||
Actors.registerSheet("fvtt-pegasus", PegasusActorSheet, { types: ["character"], makeDefault: true })
|
Actors.registerSheet("fvtt-pegasus", PegasusActorSheet, { types: ["character"], makeDefault: true })
|
||||||
|
Actors.registerSheet("fvtt-pegasus", PegasusActorSheet, { types: ["npc"], makeDefault: true })
|
||||||
Actors.registerSheet("fvtt-pegasus", PegasusVehicleSheet, { types: ["vehicle"], makeDefault: false })
|
Actors.registerSheet("fvtt-pegasus", PegasusVehicleSheet, { types: ["vehicle"], makeDefault: false })
|
||||||
|
|
||||||
Items.unregisterSheet("core", ItemSheet);
|
Items.unregisterSheet("core", ItemSheet);
|
||||||
|
@ -39,6 +39,8 @@ export class PegasusRollDialog extends Dialog {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
roll() {
|
roll() {
|
||||||
|
this.rollData.tic1 = $('#roll-input-tic1').val()
|
||||||
|
this.rollData.tic2 = $('#roll-input-tic2').val()
|
||||||
PegasusUtility.rollPegasus(this.rollData)
|
PegasusUtility.rollPegasus(this.rollData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,9 +23,9 @@ export class PegasusUtility {
|
|||||||
Hooks.on('renderChatLog', (log, html, data) => PegasusUtility.chatListeners(html))
|
Hooks.on('renderChatLog', (log, html, data) => PegasusUtility.chatListeners(html))
|
||||||
Hooks.on('targetToken', (user, token, flag) => PegasusUtility.targetToken(user, token, flag))
|
Hooks.on('targetToken', (user, token, flag) => PegasusUtility.targetToken(user, token, flag))
|
||||||
Hooks.on('renderSidebarTab', (app, html, data) => PegasusUtility.addDiceRollButton(app, html, data))
|
Hooks.on('renderSidebarTab', (app, html, data) => PegasusUtility.addDiceRollButton(app, html, data))
|
||||||
Hooks.on("getCombatTrackerEntryContext", (html, options) => {
|
/* Deprecated, no more used in rules Hooks.on("getCombatTrackerEntryContext", (html, options) => {
|
||||||
PegasusUtility.pushInitiativeOptions(html, options);
|
PegasusUtility.pushInitiativeOptions(html, options);
|
||||||
});
|
});*/
|
||||||
Hooks.on("dropCanvasData", (canvas, data) => {
|
Hooks.on("dropCanvasData", (canvas, data) => {
|
||||||
PegasusUtility.dropItemOnToken(canvas, data)
|
PegasusUtility.dropItemOnToken(canvas, data)
|
||||||
});
|
});
|
||||||
@ -87,7 +87,12 @@ export class PegasusUtility {
|
|||||||
Handlebars.registerHelper('isGM', function () {
|
Handlebars.registerHelper('isGM', function () {
|
||||||
return game.user.isGM
|
return game.user.isGM
|
||||||
})
|
})
|
||||||
|
Handlebars.registerHelper('getTIC', function (num, id) {
|
||||||
|
return game.combat.getTIC(num, id)
|
||||||
|
})
|
||||||
|
Handlebars.registerHelper('isCharacter', function (id) {
|
||||||
|
return game.combat.isCharacter(id)
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -847,13 +852,14 @@ export class PegasusUtility {
|
|||||||
for (let res of rollData.hindranceRoll.terms[0].results) {
|
for (let res of rollData.hindranceRoll.terms[0].results) {
|
||||||
if (res.result == 6) {
|
if (res.result == 6) {
|
||||||
rollData.hindranceFailure = true
|
rollData.hindranceFailure = true
|
||||||
|
rollData.img = `systems/fvtt-pegasus-rpg/images/dice/hindrance-dice.png`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
|
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
|
||||||
|
|
||||||
// Final score and keep data
|
// Final score and keep data
|
||||||
rollData.finalScore = myRoll.total
|
rollData.finalScore = (rollData.hindranceFailure) ? 0 : myRoll.total
|
||||||
|
|
||||||
if (rollData.damages) {
|
if (rollData.damages) {
|
||||||
let dmgFormula = this.getFoundryDiceFromLevel(rollData.damages.value)
|
let dmgFormula = this.getFoundryDiceFromLevel(rollData.damages.value)
|
||||||
@ -869,6 +875,7 @@ export class PegasusUtility {
|
|||||||
// Init stuf
|
// Init stuf
|
||||||
if (rollData.isInit) {
|
if (rollData.isInit) {
|
||||||
let combat = game.combats.get(rollData.combatId)
|
let combat = game.combats.get(rollData.combatId)
|
||||||
|
await combat.setTic(rollData.combatantId, rollData)
|
||||||
combat.updateEmbeddedDocuments("Combatant", [{ _id: rollData.combatantId, initiative: rollData.finalScore }])
|
combat.updateEmbeddedDocuments("Combatant", [{ _id: rollData.combatantId, initiative: rollData.finalScore }])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@
|
|||||||
],
|
],
|
||||||
"title": "Pegasus RPG",
|
"title": "Pegasus RPG",
|
||||||
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
|
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
|
||||||
"version": "11.0.4",
|
"version": "11.0.5",
|
||||||
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.4.zip",
|
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.5.zip",
|
||||||
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
|
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
|
||||||
}
|
}
|
@ -2,6 +2,7 @@
|
|||||||
"Actor": {
|
"Actor": {
|
||||||
"types": [
|
"types": [
|
||||||
"character",
|
"character",
|
||||||
|
"npc",
|
||||||
"vehicle"
|
"vehicle"
|
||||||
],
|
],
|
||||||
"templates": {
|
"templates": {
|
||||||
@ -372,6 +373,12 @@
|
|||||||
"core"
|
"core"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"npc": {
|
||||||
|
"templates": [
|
||||||
|
"biodata",
|
||||||
|
"core"
|
||||||
|
]
|
||||||
|
},
|
||||||
"vehicle": {
|
"vehicle": {
|
||||||
"templates": [
|
"templates": [
|
||||||
"vehicle"
|
"vehicle"
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if hindranceFailure}}
|
{{#if hindranceFailure}}
|
||||||
<li><strong>Failed due to Hindrance Dice(s) !!</strong>
|
<li><strong>Failed due to Hindrance Dice !!</strong>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if isResistance}}
|
{{#if isResistance}}
|
||||||
<li><strong>Defense Result : {{finalScore}}</strong>
|
<li><strong>Defense Result : {{finalScore}}</strong>
|
||||||
|
132
templates/pegasus-combat-tracker.html
Normal file
132
templates/pegasus-combat-tracker.html
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<section class="{{cssClass}} directory flexcol" id="{{cssId}}" data-tab="{{tabName}}">
|
||||||
|
<header class="combat-tracker-header">
|
||||||
|
{{#if user.isGM}}
|
||||||
|
<nav class="encounters flexrow" aria-label="{{localize 'COMBAT.NavLabel'}}">
|
||||||
|
<a class="combat-button combat-create" aria-label="{{localize 'COMBAT.Create'}}" role="button" data-tooltip="COMBAT.Create">
|
||||||
|
<i class="fas fa-plus"></i>
|
||||||
|
</a>
|
||||||
|
{{#if combatCount}}
|
||||||
|
<a class="combat-button combat-cycle" aria-label="{{localize 'COMBAT.EncounterPrevious'}}" role="button" data-tooltip="COMBAT.EncounterPrevious"
|
||||||
|
{{#if previousId}}data-document-id="{{previousId}}"{{else}}disabled{{/if}}>
|
||||||
|
<i class="fas fa-caret-left"></i>
|
||||||
|
</a>
|
||||||
|
<h4 class="encounter">{{localize "COMBAT.Encounter"}} {{currentIndex}} / {{combatCount}}</h4>
|
||||||
|
<a class="combat-button combat-cycle" aria-label="{{localize 'COMBAT.EncounterNext'}}" role="button" data-tooltip="COMBAT.EncounterNext"
|
||||||
|
{{#if nextId}}data-document-id="{{nextId}}"{{else}}disabled{{/if}}>
|
||||||
|
<i class="fas fa-caret-right"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
<a class="combat-button combat-control" aria-label="{{localize 'COMBAT.Delete'}}" role="button" data-tooltip="COMBAT.Delete" data-control="endCombat" {{#unless combatCount}}disabled{{/unless}}>
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
</nav>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<div class="encounter-controls flexrow {{#if hasCombat}}combat{{/if}}">
|
||||||
|
{{#if user.isGM}}
|
||||||
|
<a class="combat-button combat-control" aria-label="{{localize 'COMBAT.RollAll'}}" role="button" data-tooltip="COMBAT.RollAll" data-control="rollAll" {{#unless turns}}disabled{{/unless}}>
|
||||||
|
<i class="fas fa-users"></i>
|
||||||
|
</a>
|
||||||
|
<a class="combat-button combat-control" aria-label="{{localize 'COMBAT.RollNPC'}}" role="button" data-tooltip="COMBAT.RollNPC" data-control="rollNPC" {{#unless turns}}disabled{{/unless}}>
|
||||||
|
<i class="fas fa-users-cog"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if combatCount}}
|
||||||
|
{{#if combat.round}}
|
||||||
|
<h3 class="encounter-title noborder">{{localize 'COMBAT.Round'}} {{combat.round}}</h3>
|
||||||
|
{{else}}
|
||||||
|
<h3 class="encounter-title noborder">{{localize 'COMBAT.NotStarted'}}</h3>
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
<h3 class="encounter-title noborder">{{localize "COMBAT.None"}}</h3>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if user.isGM}}
|
||||||
|
<a class="combat-button combat-control" aria-label="{{localize 'COMBAT.InitiativeReset'}}" role="button" data-tooltip="COMBAT.InitiativeReset" data-control="resetAll"
|
||||||
|
{{#unless hasCombat}}disabled{{/unless}}>
|
||||||
|
<i class="fas fa-undo"></i>
|
||||||
|
</a>
|
||||||
|
<a class="combat-button combat-control" aria-label="{{localize 'labels.scope'}}" role="button" data-tooltip="{{labels.scope}}"
|
||||||
|
data-control="toggleSceneLink" {{#unless hasCombat}}disabled{{/unless}}>
|
||||||
|
<i class="fas fa-{{#unless linked}}un{{/unless}}link"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
<a class="combat-button combat-settings" aria-label="{{localize 'COMBAT.Settings'}}" role="button" data-tooltip="COMBAT.Settings" data-control="trackerSettings">
|
||||||
|
<i class="fas fa-cog"></i>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<ol id="combat-tracker" class="directory-list">
|
||||||
|
{{#each turns}}
|
||||||
|
<li class="combatant actor directory-item flexrow {{this.css}}" data-combatant-id="{{this.id}}">
|
||||||
|
<img class="token-image" data-src="{{this.img}}" alt="{{this.name}}"/>
|
||||||
|
<div class="token-name flexcol">
|
||||||
|
<h4>{{this.name}}</h4>
|
||||||
|
<div class="combatant-controls flexrow">
|
||||||
|
{{#if ../user.isGM}}
|
||||||
|
<a class="combatant-control {{#if this.hidden}}active{{/if}}" aria-label="{{localize 'COMBAT.ToggleVis'}}" role="button" data-tooltip="COMBAT.ToggleVis" data-control="toggleHidden">
|
||||||
|
<i class="fas fa-eye-slash"></i>
|
||||||
|
</a>
|
||||||
|
<a class="combatant-control {{#if this.defeated}}active{{/if}}" aria-label="{{localize 'COMBAT.ToggleDead'}}" role="button" data-tooltip="COMBAT.ToggleDead" data-control="toggleDefeated">
|
||||||
|
<i class="fas fa-skull"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
{{#if this.canPing}}
|
||||||
|
<a class="combatant-control" aria-label="{{localize 'COMBAT.PingCombatant'}}" role="button" data-tooltip="COMBAT.PingCombatant" data-control="pingCombatant">
|
||||||
|
<i class="fa-solid fa-bullseye-arrow"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
|
<div class="token-effects">
|
||||||
|
{{#each this.effects}}
|
||||||
|
<img class="token-effect" src="{{this}}"/>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{#if this.hasResource}}
|
||||||
|
<div class="token-resource">
|
||||||
|
<span class="resource">{{this.resource}}</span>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
<div class="token-resource" id="{{this.id}}">
|
||||||
|
<a class="combat-tracker-tic" data-tic-num="1" data-combatant-id="{{this.id}}">{{getTIC 1 this.id}}</a>
|
||||||
|
{{#if (isCharacter this.id)}}
|
||||||
|
<a class="combat-tracker-tic" data-tic-num="2" data-combatant-id="{{this.id}}">{{getTIC 2 this.id}}</a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="token-initiative">
|
||||||
|
{{#if this.hasRolled}}
|
||||||
|
<span class="initiative">{{this.initiative}}</span>
|
||||||
|
{{else if this.owner}}
|
||||||
|
<a class="combatant-control roll" aria-label="{{localize 'COMBAT.InitiativeRoll'}}" role="button" data-tooltip="COMBAT.InitiativeRoll" data-control="rollInitiative"></a>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<nav id="combat-controls" class="directory-footer flexrow" data-tooltip-direction="UP">
|
||||||
|
{{#if hasCombat}}
|
||||||
|
{{#if user.isGM}}
|
||||||
|
{{#if round}}
|
||||||
|
<a class="combat-control" aria-label="{{localize 'COMBAT.RoundPrev'}}" role="button" data-tooltip="COMBAT.RoundPrev" data-control="previousRound"><i class="fas fa-step-backward"></i></a>
|
||||||
|
<a class="combat-control" aria-label="{{localize 'COMBAT.TurnPrev'}}" role="button" data-tooltip="COMBAT.TurnPrev" data-control="previousTurn"><i class="fas fa-arrow-left"></i></a>
|
||||||
|
<a class="combat-control center" aria-label="{{localize 'COMBAT.End'}}" role="button" data-control="endCombat">{{localize 'COMBAT.End'}}</a>
|
||||||
|
<a class="combat-control" aria-label="{{localize 'COMBAT.TurnNext'}}" role="button" data-tooltip="COMBAT.TurnNext" data-control="nextTurn"><i class="fas fa-arrow-right"></i></a>
|
||||||
|
<a class="combat-control" aria-label="{{localize 'COMBAT.RoundNext'}}" role="button" data-tooltip="COMBAT.RoundNext" data-control="nextRound"><i class="fas fa-step-forward"></i></a>
|
||||||
|
{{else}}
|
||||||
|
<a class="combat-control center" aria-label="{{localize 'COMBAT.Begin'}}" role="button" data-control="startCombat">{{localize 'COMBAT.Begin'}}</a>
|
||||||
|
{{/if}}
|
||||||
|
{{else if control}}
|
||||||
|
<a class="combat-control" aria-label="{{localize 'COMBAT.TurnPrev'}}" role="button" data-tooltip="COMBAT.TurnPrev" data-control="previousTurn"><i class="fas fa-arrow-left"></i></a>
|
||||||
|
<a class="combat-control center" aria-label="{{localize 'COMBAT.TurnEnd'}}" role="button" data-control="nextTurn">{{localize 'COMBAT.TurnEnd'}}</a>
|
||||||
|
<a class="combat-control" aria-label="{{localize 'COMBAT.TurnNext'}}" role="button" data-tooltip="COMBAT.TurnNext" data-control="nextTurn"><i class="fas fa-arrow-right"></i></a>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
</nav>
|
||||||
|
</section>
|
@ -65,21 +65,6 @@
|
|||||||
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<!--
|
|
||||||
{{#if isDamage}}
|
|
||||||
<div class="flexrow">
|
|
||||||
<span class="roll-dialog-label">Weapon Damage :</span>
|
|
||||||
<select class="roll-dialog-label" id="damageDiceLevel" type="text" name="damageDiceLevel"
|
|
||||||
value="{{damageDiceLevel}}" data-dtype="Number">
|
|
||||||
{{#select damageDiceLevel}}
|
|
||||||
{{{optionsDiceList}}}
|
|
||||||
{{/select}}
|
|
||||||
</select>
|
|
||||||
<span class="small-label"> </span>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
-->
|
|
||||||
|
|
||||||
<div class="dice-pool-div">
|
<div class="dice-pool-div">
|
||||||
<span>
|
<span>
|
||||||
<h3 class="dice-pool-label">Current pool</h3>
|
<h3 class="dice-pool-label">Current pool</h3>
|
||||||
@ -108,7 +93,7 @@
|
|||||||
{{#if hindranceDices}}
|
{{#if hindranceDices}}
|
||||||
<div class="dice-pool-div">
|
<div class="dice-pool-div">
|
||||||
<span>
|
<span>
|
||||||
<h3 class="dice-pool-label">Hindrance Dices</h3>
|
<h3 class="dice-pool-label">Hindrance Dice</h3>
|
||||||
</span>
|
</span>
|
||||||
<div class="flexrow dice-pool-stack">
|
<div class="flexrow dice-pool-stack">
|
||||||
{{#for 1 hindranceDices 1}}
|
{{#for 1 hindranceDices 1}}
|
||||||
@ -170,6 +155,19 @@
|
|||||||
{{> systems/fvtt-pegasus-rpg/templates/partial-roll-select-effects.html}}
|
{{> systems/fvtt-pegasus-rpg/templates/partial-roll-select-effects.html}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if isInit}}
|
||||||
|
<div class="flexrow">
|
||||||
|
<span class="roll-dialog-label">TIC 1:</span>
|
||||||
|
<input class="roll-input-tic" id="roll-input-tic1" type="text" name="tic1" value="{{tic1}}" data-dtype="String">
|
||||||
|
</div>
|
||||||
|
{{#if (eq actorType "character")}}
|
||||||
|
<div class="flexrow">
|
||||||
|
<span class="roll-dialog-label">TIC 2:</span>
|
||||||
|
<input class="roll-input-tic" id="roll-input-tic2" type="text" name="tic2" value="{{tic2}}" data-dtype="String">
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user