Combat tracker enhancements
This commit is contained in:
parent
ff57953e75
commit
c4160b2fd5
@ -38,7 +38,6 @@ export class PegasusActorSheet extends ActorSheet {
|
||||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
data: actorData.system,
|
||||
traumaState: this.actor.getTraumaState(),
|
||||
effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)),
|
||||
limited: this.object.limited,
|
||||
specs: this.actor.getSpecs( ),
|
||||
config: game.system.pegasus.config,
|
||||
|
@ -778,6 +778,10 @@ export class PegasusActor extends Actor {
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM'))
|
||||
}
|
||||
this.createEmbeddedDocuments("ActiveEffect", [
|
||||
{ label: 'EFFECT.StatusDaze', icon: 'icons/svg/daze.svg', flags: { core: { statusId: 'daze' } } }
|
||||
])
|
||||
|
||||
if (incDec > 0) {
|
||||
chatData.content = `<div>${this.name} suffered a Stun level.</div`
|
||||
} else {
|
||||
@ -801,6 +805,11 @@ export class PegasusActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
modifyMomentum(incDec) {
|
||||
if ( this.system.stun.value > 0 ) {
|
||||
ui.notifications.warn("Unable to gain/use Momentum while stunned")
|
||||
return
|
||||
}
|
||||
|
||||
let momentum = duplicate(this.system.momentum)
|
||||
momentum.value += incDec
|
||||
this.update({ 'system.momentum': momentum })
|
||||
@ -1902,9 +1911,6 @@ export class PegasusActor extends Actor {
|
||||
let hindrancesDices = 0
|
||||
if (this.type == "character" || this.type == 'npc') {
|
||||
|
||||
if (this.system.combat.stunlevel > 0) {
|
||||
hindrancesDices += 2
|
||||
}
|
||||
hindrancesDices += this.system.combat.hindrancedice
|
||||
let overCapacity = Math.floor(this.encCurrent / this.getEncumbranceCapacity())
|
||||
if (overCapacity > 0) {
|
||||
@ -1924,9 +1930,6 @@ export class PegasusActor extends Actor {
|
||||
}
|
||||
}
|
||||
if (this.type == "vehicle") {
|
||||
if (this.system.stun.value > 0) {
|
||||
hindrancesDices += 2
|
||||
}
|
||||
if (this.isVehicleCrawling()) {
|
||||
hindrancesDices += 3
|
||||
}
|
||||
@ -2136,8 +2139,6 @@ export class PegasusActor extends Actor {
|
||||
rollData.noBonusDice = this.checkNoBonusDice()
|
||||
rollData.dicePool = []
|
||||
rollData.subKey = subKey
|
||||
rollData.tic1 = "NONE"
|
||||
rollData.tic2 = "NONE"
|
||||
|
||||
if (subKey == "melee-dmg" || subKey == "ranged-dmg" || subKey == "power-dmg") {
|
||||
rollData.isDamage = true
|
||||
@ -2270,6 +2271,15 @@ export class PegasusActor extends Actor {
|
||||
}
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getExtraTICsFromEffect() {
|
||||
let effects = this.items.filter(it => it.type == "effect" && Number(it.system.extratics)>0)
|
||||
let nbTics = 0
|
||||
for (let e of effects) {
|
||||
nbTics += Number(it.system.extratics)
|
||||
}
|
||||
return nbTics
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getLevelRemainingList() {
|
||||
@ -2390,6 +2400,11 @@ export class PegasusActor extends Actor {
|
||||
console.log("MR ROLL", rollData)
|
||||
if (isInit) {
|
||||
rollData.title = "MR / Initiative"
|
||||
rollData.nbTIC = ((this.type == "character") ? 2 : 1) + this.getExtraTICsFromEffect()
|
||||
rollData.TICs = []
|
||||
for(let i=0; i<rollData.nbTIC; i++) {
|
||||
rollData.TICs.push( {text:"NONE", revealed: false, displayed: false})
|
||||
}
|
||||
}
|
||||
this.startRoll(rollData);
|
||||
} else {
|
||||
|
@ -10,6 +10,23 @@ export class PegasusCombatTracker extends CombatTracker {
|
||||
template: path,
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
let combatData = await super.getData()
|
||||
for (let t of combatData.turns) {
|
||||
let c = game.combat.combatants.get(t.id)
|
||||
let TICs = c.getFlag("world", "TICs")
|
||||
if (TICs) {
|
||||
t.TICs = TICs
|
||||
} else {
|
||||
t.TICs = []
|
||||
}
|
||||
}
|
||||
console.log("CBT", combatData)
|
||||
return combatData
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html)
|
||||
@ -23,6 +40,11 @@ export class PegasusCombatTracker extends CombatTracker {
|
||||
html.find('.reset-npc-initiative').click(ev => {
|
||||
game.combat.resetNPCInitiative()
|
||||
})
|
||||
html.find('.select-combat-actor').click(ev => {
|
||||
let combatantId = $(ev.currentTarget).data("combatant-id")
|
||||
game.combat.selectActor(combatantId)
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -46,11 +68,11 @@ export class PegasusCombat extends Combat {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async resetNPCInitiative() {
|
||||
for(let c of this.combatants) {
|
||||
for (let c of this.combatants) {
|
||||
if (c.actor && c.actor.type == "npc") {
|
||||
await this.updateEmbeddedDocuments("Combatant", [{ _id: c.id, initiative: -1 }]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -62,6 +84,21 @@ export class PegasusCombat extends Combat {
|
||||
return false
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
selectActor(combatantId) {
|
||||
const combatant = game.combat.combatants.get(combatantId)
|
||||
if (combatant) {
|
||||
let chatData = {
|
||||
user: game.user.id,
|
||||
alias: combatant.actor.name,
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')),
|
||||
content: `<div>${combatant.actor.name} has been nominated to act, ${combatant.actor.name} choose which TIC you wish to activate!</div`
|
||||
}
|
||||
ChatMessage.create(chatData);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async setTic(combatantId, rollData) {
|
||||
if (!combatantId) {
|
||||
@ -69,65 +106,74 @@ export class PegasusCombat extends Combat {
|
||||
}
|
||||
const combatant = game.combat.combatants.get(combatantId)
|
||||
if (combatant) {
|
||||
await combatant.setFlag("world", "tic1", { revealed: false, text: rollData.tic1, displayed: false })
|
||||
await combatant.setFlag("world", "tic2", { revealed: false, text: rollData.tic2, displayed: false })
|
||||
await combatant.setFlag("world", "TICs", rollData.TICs)
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getTIC(num, combatantId) {
|
||||
if (!combatantId) {
|
||||
return ""
|
||||
}
|
||||
const combatant = game.combat.combatants.get(combatantId)
|
||||
if (combatant) {
|
||||
let ticData = combatant.getFlag("world", "tic" + num)
|
||||
if (ticData) {
|
||||
/* returns if revealed */
|
||||
if (ticData.revealed && ticData.displayed) {
|
||||
return "ACTED"
|
||||
}
|
||||
if (ticData.revealed && !ticData.displayed) {
|
||||
ticData.displayed = true
|
||||
combatant.setFlag("world", "tic" + num, ticData ).then(() => {
|
||||
let chatData = {
|
||||
user: game.user.id,
|
||||
alias: combatant.actor.name,
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')),
|
||||
content: `<div>${combatant.actor.name} is performing ${ticData.text}</div`
|
||||
};
|
||||
ChatMessage.create(chatData);
|
||||
return "ACTED"
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
return "TIC " + num
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async revealTIC(num, combatantId) {
|
||||
if (!num || !combatantId) {
|
||||
console.log('revealTIC', num, combatantId)
|
||||
if (num == undefined || combatantId == undefined) {
|
||||
return
|
||||
}
|
||||
const combatant = game.combat.combatants.get(combatantId)
|
||||
if (combatant) {
|
||||
let ticData = combatant.getFlag("world", "tic" + num)
|
||||
console.log('revealTIC', num, combatantId, combatant)
|
||||
let ticData = combatant.getFlag("world", "TICs")
|
||||
if (ticData) {
|
||||
ticData.revealed = true
|
||||
await combatant.setFlag("world", "tic" + num, ticData)
|
||||
console.log('revealTIC', num, combatantId, ticData)
|
||||
num = Number(num)
|
||||
ticData[num].revealed = true
|
||||
ticData[num].displayed = true
|
||||
combatant.setFlag("world", "TICs", ticData).then(() => {
|
||||
let chatData = {
|
||||
user: game.user.id,
|
||||
alias: combatant.actor.name,
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')),
|
||||
content: `<div>${combatant.actor.name} is performing ${ticData[num].text}</div`
|
||||
};
|
||||
ChatMessage.create(chatData);
|
||||
// Manage if all TIC has been ACTED
|
||||
let allRevealed = true
|
||||
for (let c of this.combatants) {
|
||||
let TICs = c.getFlag("world", "TICs")
|
||||
if (TICs) {
|
||||
for (let t of TICs) {
|
||||
if (!t.revealed) {
|
||||
allRevealed = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// If all TIC has been ACTED, display a message
|
||||
if (allRevealed) {
|
||||
let chatData = {
|
||||
user: game.user.id,
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
content: `<div>All Characters have acted, All Characters who do not have Stun gain 1 Momentum!</div`
|
||||
}
|
||||
ChatMessage.create(chatData);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
nextRound() {
|
||||
for(let c of this.combatants) {
|
||||
c.setFlag("world", "tic1", { revealed: false, text: "", displayed: false })
|
||||
c.setFlag("world", "tic2", { revealed: false, text: "", displayed: false })
|
||||
for (let c of this.combatants) {
|
||||
let TICs = duplicate(c.getFlag("world", "TICs"))
|
||||
for (let t of TICs) {
|
||||
t.displayed = false
|
||||
t.revealed = false
|
||||
t.text = ""
|
||||
}
|
||||
c.setFlag("world", "TICs", TICs)
|
||||
}
|
||||
super.nextRound()
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_onUpdate(changed, options, userId) {
|
||||
}
|
||||
|
@ -26,5 +26,12 @@ export const PEGASUS_CONFIG = {
|
||||
shaken: { key:'shaken',name: 'Shaken', hindrance: 0, hasfear: true },
|
||||
anxious: { key:'anxious',name: 'Anxious', hindrance: 0, nostunrecover: true },
|
||||
lostface: { key:'lostface',name: 'Lost Face', hindrance: 0 }
|
||||
},
|
||||
extraTIC: {
|
||||
"0": {key: "0", name: "None", value: 0},
|
||||
"1": {key: "1", name: "+1 TIC", value: 1},
|
||||
"2": {key: "2", name: "+2 TIC", value: 2},
|
||||
"3": {key: "3", name: "+3 TIC", value: 3},
|
||||
"4": {key: "4", name: "+4 TIC", value: 4},
|
||||
}
|
||||
}
|
@ -57,6 +57,7 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
type: objectData.type,
|
||||
img: objectData.img,
|
||||
name: objectData.name,
|
||||
config: game.system.pegasus.config,
|
||||
editable: this.isEditable,
|
||||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
optionsDiceList: PegasusUtility.getOptionsDiceList(),
|
||||
|
@ -39,8 +39,9 @@ export class PegasusRollDialog extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
roll() {
|
||||
this.rollData.tic1 = $('#roll-input-tic1').val()
|
||||
this.rollData.tic2 = $('#roll-input-tic2').val()
|
||||
for(let i=0; i<this.rollData.nbTIC; i++) {
|
||||
this.rollData.TICs[i].text = $('#roll-input-tic'+i).val()
|
||||
}
|
||||
PegasusUtility.rollPegasus(this.rollData)
|
||||
}
|
||||
|
||||
|
@ -110,9 +110,6 @@ export class PegasusUtility {
|
||||
Handlebars.registerHelper('isGM', function () {
|
||||
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)
|
||||
})
|
||||
|
@ -1365,6 +1365,12 @@ Focus FOC: #ff0084
|
||||
font-size: 0.8rem;
|
||||
margin:2px;
|
||||
}
|
||||
.combat-tracker-tic-button {
|
||||
max-height: 1.8rem;
|
||||
margin-bottom: 4px;
|
||||
background: linear-gradient(to bottom, #21374afc 5%, #152833ab 100%);
|
||||
border-radius: 3px;
|
||||
}
|
||||
.no-grow {
|
||||
flex-grow: 1;
|
||||
max-width: 32px;
|
||||
|
@ -244,15 +244,15 @@
|
||||
"flags": {}
|
||||
}
|
||||
],
|
||||
"primaryTokenAttribute": "secondary.health",
|
||||
"secondaryTokenAttribute": "secondary.delirium",
|
||||
"primaryTokenAttribute": "secondary.health.status",
|
||||
"secondaryTokenAttribute": "secondary.delirium.status",
|
||||
"socket": true,
|
||||
"styles": [
|
||||
"styles/simple.css"
|
||||
],
|
||||
"title": "Pegasus RPG",
|
||||
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
|
||||
"version": "11.0.9",
|
||||
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.9.zip",
|
||||
"version": "11.0.10",
|
||||
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.10.zip",
|
||||
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
|
||||
}
|
@ -439,6 +439,7 @@
|
||||
"noperksallowed": false,
|
||||
"affectstatus": false,
|
||||
"affectedstatus": "",
|
||||
"extratics": "none",
|
||||
"locked": false,
|
||||
"droptext": "",
|
||||
"description": ""
|
||||
|
@ -24,6 +24,11 @@
|
||||
{{#if isDamage}}
|
||||
<li>Weapon Damage Dice : {{weaponDamageDice}}</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if (eq subKey "dmg-res")}}
|
||||
<li>Damage Resistance</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if isResistance}}
|
||||
<li>Armor Resistance Dice : {{armor.system.resistanceDice}}</li>
|
||||
<li>ADRL : {{armor.system.adrl}}</li>
|
||||
@ -53,12 +58,11 @@
|
||||
{{/if}}
|
||||
|
||||
{{#if (eq subKey "dmg-res")}}
|
||||
<li>Damage Resistance</li>
|
||||
{{#each armorsList as |armor idx|}}
|
||||
{{#if armor.applied}}
|
||||
<li>ADRL: {{armor.adrl}}</li>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
{{#each armorsList as |armor idx|}}
|
||||
{{#if armor.applied}}
|
||||
<li>ADRL: {{armor.adrl}}</li>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
|
||||
{{#if power}}
|
||||
|
@ -88,7 +88,13 @@
|
||||
<li class="flexrow"><label class="generic-label">Display Text when added to Actor</label>
|
||||
<input type="text" class="input-numeric-short padd-right" name="system.droptext" value="{{data.droptext}}" data-dtype="String"/>
|
||||
</li>
|
||||
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Provide extra TICs ?</label>
|
||||
<select class="competence-base flexrow" type="text" name="system.extratics" value="{{data.extratics}}" data-dtype="String">
|
||||
{{selectOptions config.extraTIC selected=data.extratics nameAttr="key" labelAttr="name" }}
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Affect Status?</label>
|
||||
<label class="attribute-value checkbox"><input type="checkbox" name="system.affectstatus" {{checked data.affectstatus}}/></label>
|
||||
</li>
|
||||
|
@ -66,7 +66,7 @@
|
||||
<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>
|
||||
<h4>{{this.name}}</h4><a class="select-combat-actor" data-combatant-id="{{this.id}}"><i class="fas fa-hand-pointer"></i></a>
|
||||
<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">
|
||||
@ -96,10 +96,15 @@
|
||||
{{/if}}
|
||||
|
||||
<div class="combat-tracker-tic-section flexcol" 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}}
|
||||
{{#each this.TICs as | tic index|}}
|
||||
<button class="combat-tracker-tic-button"><a class="combat-tracker-tic" data-tic-num="{{index}}" data-combatant-id="{{../id}}">
|
||||
{{#if tic.revealed}}
|
||||
ACTED
|
||||
{{else}}
|
||||
TIC: {{add index 1}}
|
||||
{{/if}}
|
||||
</a></button>
|
||||
{{/each}}
|
||||
</div>
|
||||
|
||||
<div class="token-initiative">
|
||||
|
@ -156,16 +156,12 @@
|
||||
{{/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")}}
|
||||
{{#each TICs as |tic index|}}
|
||||
<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">
|
||||
<span class="roll-dialog-label">TIC {{add index 1}}:</span>
|
||||
<input class="roll-input-tic" id="roll-input-tic{{index}}" type="text" value="{{tic.text}}" data-dtype="String">
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user