Compare commits
14 Commits
foundryvtt
...
v10
Author | SHA1 | Date |
---|---|---|
LeRatierBretonnien | a3b6908a17 | |
LeRatierBretonnien | 6e5bb5da32 | |
LeRatierBretonnien | 29ff86f4bd | |
LeRatierBretonnien | aa243a7b80 | |
LeRatierBretonnien | c061b67bb3 | |
LeRatierBretonnien | c6c8622552 | |
LeRatierBretonnien | f6104e533c | |
LeRatierBretonnien | 23b6a41eac | |
LeRatierBretonnien | f0c5e7b95d | |
sladecraven | 4b9af6a383 | |
sladecraven | d94c1a4dce | |
sladecraven | bef1750231 | |
sladecraven | 1f0506f5c2 | |
sladecraven | e52b62a314 |
|
@ -22,7 +22,7 @@ export class SoSActorSheet extends ActorSheet {
|
|||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getData() {
|
||||
async getData() {
|
||||
const objectData = this.object
|
||||
let formData = {
|
||||
title: this.title,
|
||||
|
@ -34,6 +34,9 @@ export class SoSActorSheet extends ActorSheet {
|
|||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
data: foundry.utils.deepClone(this.object.system),
|
||||
effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)),
|
||||
history: await TextEditor.enrichHTML(this.object.system.history, {async: true}),
|
||||
notes: await TextEditor.enrichHTML(this.object.system.notes, {async: true}),
|
||||
gmnotes: await TextEditor.enrichHTML(this.object.system.gmnotes, {async: true}),
|
||||
limited: this.object.limited,
|
||||
options: this.options,
|
||||
owner: this.document.isOwner
|
||||
|
@ -61,12 +64,12 @@ export class SoSActorSheet extends ActorSheet {
|
|||
formData.gearsRoot = formData.gears.filter(item => item.system.containerid == "");
|
||||
for ( let container of formData.gearsRoot) {
|
||||
if ( container.type == 'container') {
|
||||
container.data.contains = []
|
||||
container.data.containerEnc = 0;
|
||||
container.system.contains = []
|
||||
container.system.containerEnc = 0;
|
||||
for (let gear of formData.gears) {
|
||||
console.log("GEAR", gear, container)
|
||||
if ( gear.system.containerid == container.id) {
|
||||
container.data.contains.push( gear )
|
||||
container.system.contains.push( gear )
|
||||
if ( !gear.system.neg && !gear.system.software ) {
|
||||
container.system.containerEnc += (gear.system.big > 0) ? gear.system.big : 1;
|
||||
}
|
||||
|
|
|
@ -335,7 +335,7 @@ export class SoSActor extends Actor {
|
|||
totalWounds: this.system.scores.wound.value
|
||||
}
|
||||
let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/chat-character-death.html', woundData );
|
||||
ChatMessage.create( { content: html, whisper: [ChatMessage.getWhisperRecipients(this.name), ChatMessage.getWhisperRecipients("GM") ] } );
|
||||
ChatMessage.create( { content: html, whisper: ChatMessage.getWhisperRecipients(this.name).concat(ChatMessage.getWhisperRecipients("GM") ) } )
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -369,7 +369,7 @@ export class SoSActor extends Actor {
|
|||
totalWounds: this.system.scores.wound.value
|
||||
}
|
||||
let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/chat-damage-consequence.html', woundData );
|
||||
ChatMessage.create( { content: html, whisper: ChatMessage.getWhisperRecipients(this.name).concat(ChatMessage.getWhisperRecipients("GM")) } );
|
||||
ChatMessage.create( { content: html, whisper: ChatMessage.getWhisperRecipients(this.name).concat(ChatMessage.getWhisperRecipients("GM")) } )
|
||||
|
||||
this.checkDeath();
|
||||
}
|
||||
|
@ -388,10 +388,10 @@ export class SoSActor extends Actor {
|
|||
if ( alreadyInside.length >= container.system.container ) {
|
||||
ui.notifications.warn("Container is already full !");
|
||||
} else {
|
||||
await this.updateEmbeddedDocuments( "Item", [{ _id: object.id, 'system.containerid':containerId }]);
|
||||
setTimeout(function() { this.updateEmbeddedDocuments( "Item", [{ _id: object.id, 'system.containerid':containerId }])}, 800 )
|
||||
}
|
||||
} else if ( object && object.system.containerid) { // remove from container
|
||||
await this.updateEmbeddedDocuments( "Item", [{ _id: object.id, 'system.containerid':"" }]);
|
||||
setTimeout(function() { this.updateEmbeddedDocuments( "Item", [{ _id: object.id, 'system.containerid':"" }])}, 800 )
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,7 @@ export class SoSActor extends Actor {
|
|||
async applyWounds( flipData ) {
|
||||
if ( flipData.damageStatus == 'no_damage') {
|
||||
let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/chat-nodamage-taken.html', flipData );
|
||||
ChatMessage.create( { content: html, whisper: [ChatMessage.getWhisperRecipients(this.name), ChatMessage.getWhisperRecipients("GM") ] } );
|
||||
ChatMessage.create( { content: html, whisper: ChatMessage.getWhisperRecipients(this.name).concat(ChatMessage.getWhisperRecipients("GM")) } );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -437,7 +437,7 @@ export class SoSActor extends Actor {
|
|||
flipData.currentWounds = sumWound;
|
||||
flipData.totalWounds = this.system.scores.wound.value;
|
||||
let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/chat-damage-taken.html', flipData );
|
||||
ChatMessage.create( { content: html, whisper: [ChatMessage.getWhisperRecipients(this.name), ChatMessage.getWhisperRecipients("GM") ] } );
|
||||
ChatMessage.create( { content: html, whisper: ChatMessage.getWhisperRecipients(this.name).concat(ChatMessage.getWhisperRecipients("GM")) } );
|
||||
|
||||
this.checkDeath();
|
||||
}
|
||||
|
|
|
@ -56,7 +56,8 @@ export class SoSItemSheet extends ItemSheet {
|
|||
effects: this.object.effects.map(e => foundry.utils.deepClone(e.system)),
|
||||
limited: this.object.limited,
|
||||
options: this.options,
|
||||
owner: this.document.isOwner
|
||||
owner: this.document.isOwner,
|
||||
description: await TextEditor.enrichHTML(this.object.system.description, {async: true}),
|
||||
};
|
||||
|
||||
formData.isGM = game.user.isGM;
|
||||
|
@ -66,6 +67,12 @@ export class SoSItemSheet extends ItemSheet {
|
|||
if ( objectData.type == 'skill' && this.object.options?.actor) {
|
||||
formData.skillExperienceList = this.object.options.actor.getSkillExperience( objectData.name )
|
||||
}
|
||||
if ( objectData.type == 'geneline') {
|
||||
formData.weakness = await TextEditor.enrichHTML(this.object.system.weakness, {async: true})
|
||||
}
|
||||
if ( objectData.type == 'malady') {
|
||||
formData.notes = await TextEditor.enrichHTML(this.object.system.notes, {async: true})
|
||||
}
|
||||
return formData;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
html.find('.item .item-name h4').click(event => this._onItemSummary(event));
|
||||
|
||||
/**
|
||||
* Handle toggling of an item from the Actor sheet
|
||||
* @private
|
||||
*/
|
||||
_onItemSummary(event) {
|
||||
event.preventDefault();
|
||||
let li = $(event.currentTarget).parents(".item"),
|
||||
item = this.actor.getOwnedItem(li.data("item-id"));
|
||||
|
||||
// Toggle summary
|
||||
if (item.data.data.description !== undefined && item.data.data.description !== null){
|
||||
if ( li.hasClass("expanded") ) {
|
||||
let summary = li.children(".item-summary");
|
||||
summary.slideUp(200, () => summary.remove());
|
||||
} else {
|
||||
let div = $(`<div class="item-summary">${item.data.data.description}</div>`);
|
||||
li.append(div.hide());
|
||||
div.slideDown(200);
|
||||
}
|
||||
li.toggleClass("expanded");
|
||||
}
|
||||
}
|
|
@ -247,7 +247,7 @@ export class SoSCardDeck {
|
|||
if ( flipData.mode == 'stat' || flipData.mode == 'weapon' ) {
|
||||
flipData.baseScore = flipData.stat.value + flipData.malusConsequence + flipData.bonusConsequence + flipData.woundMalus;
|
||||
} else if (flipData.mode == 'skill') {
|
||||
flipData.baseScore = Math.floor(flipData.stat.value/2) + flipData.skill.data.value + flipData.malusConsequence + flipData.bonusConsequence + flipData.woundMalus;
|
||||
flipData.baseScore = Math.floor(flipData.stat.value/2) + flipData.skill.system.value + flipData.malusConsequence + flipData.bonusConsequence + flipData.woundMalus;
|
||||
}
|
||||
flipData.finalScore = flipData.baseScore + flipData.cardTotal + Number(flipData.modifier);
|
||||
flipData.magnitude = flipData.finalScore - flipData.tn;
|
||||
|
@ -272,10 +272,10 @@ export class SoSCardDeck {
|
|||
async processWeapon( flipData ) {
|
||||
flipData.damageCardsuit = flipData.cardSlot[flipData.cardSlotIndex].cardsuit;
|
||||
let damageKey = 'damage_'+ flipData.damageCardsuit;
|
||||
flipData.damageString = flipData.weapon.data[damageKey];
|
||||
flipData.damageString = flipData.weapon.system[damageKey];
|
||||
if (flipData.damageString.includes('Str') ) {
|
||||
let damageRegexp = flipData.damageString.match( /Str([\d])?\+?([\d])?([LMSC])/i );
|
||||
flipData.damageValue = (flipData.actor.data.data.stats.strength.value * Number(damageRegexp[1]?damageRegexp[1]:1)) + Number(damageRegexp[2]?damageRegexp[2]:0);
|
||||
flipData.damageValue = (flipData.actor.system.stats.strength.value * Number(damageRegexp[1]?damageRegexp[1]:1)) + Number(damageRegexp[2]?damageRegexp[2]:0);
|
||||
flipData.damageSeverity = damageRegexp[3];
|
||||
} else {
|
||||
let damageRegexp = flipData.damageString.match( /(\d*)([LMSC])/i );
|
||||
|
|
|
@ -5,26 +5,30 @@ import { SoSDialogCombatActions } from "./sos-dialog-combat-actions.js";
|
|||
|
||||
/* -------------------------------------------- */
|
||||
export class SoSCombat extends Combat {
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
requestActions() {
|
||||
if ( game.user.isGM && !this.actionsRequested) {
|
||||
console.log("REQUEST ACTIONS !!!");
|
||||
if (game.user.isGM && !this.actionsRequested) {
|
||||
console.log("REQUEST ACTIONS !!!")
|
||||
this.actionsRequested = true;
|
||||
this.phaseSetup = {}; // Reset each new round/update
|
||||
for( let combatant of this.combatants) {
|
||||
this.setInitiative(combatant._id, -1 ); // Reset init
|
||||
let uniq = randomID(16);
|
||||
for (let combatant of this.combatants) {
|
||||
this.setInitiative(combatant.id, -1); // Reset init
|
||||
let uniq = randomID(16)
|
||||
const name = combatant.actor ? combatant.actor.name : combatant.name;
|
||||
if ( combatant.players[0]) {
|
||||
if (combatant.players && combatant.players[0] ) {
|
||||
// A player controls this combatant -> message !
|
||||
ChatMessage.create( { content: `New round ! Click on the button below to declare the actions of ${name} for round ${this.round} !<br>
|
||||
<a class='chat-card-button' id='button-declare-actions' data-uniq-id='${uniq}' data-combatant-id='${combatant._id}' data-combat-id='${this._id}' data-round='${this.round}'>Declare actions</a>`,
|
||||
whisper: [ combatant.players[0].data._id] } );
|
||||
ChatMessage.create({
|
||||
content: `New round ! Click on the button below to declare the actions of ${name} for round ${this.round} !<br>
|
||||
<a class='chat-card-button' id='button-declare-actions' data-uniq-id='${uniq}' data-combatant-id='${combatant.id}' data-combat-id='${this.id}' data-round='${this.round}'>Declare actions</a>`,
|
||||
whisper: [combatant.players[0].id]
|
||||
});
|
||||
} else {
|
||||
ChatMessage.create( { content: `New round ! Click on the button below to declare the actions of ${name} for round ${this.round} !<br>
|
||||
<a class='chat-card-button' id='button-declare-actions' data-uniq-id='${uniq}' data-combatant-id='${combatant._id}' data-combat-id='${this._id}' data-round='${this.round}'>Declare actions</a>`,
|
||||
whisper: [ ChatMessage.getWhisperRecipients("GM") ] } );
|
||||
ChatMessage.create({
|
||||
content: `New round ! Click on the button below to declare the actions of ${name} for round ${this.round} !<br>
|
||||
<a class='chat-card-button' id='button-declare-actions' data-uniq-id='${uniq}' data-combatant-id='${combatant.id}' data-combat-id='${this.id}' data-round='${this.round}'>Declare actions</a>`,
|
||||
whisper: ChatMessage.getWhisperRecipients("GM"),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,56 +43,61 @@ export class SoSCombat extends Combat {
|
|||
/* -------------------------------------------- */
|
||||
gotoNextTurn() {
|
||||
this.phaseNumber -= 1;
|
||||
if ( this.phaseNumber <= 0) {
|
||||
if (this.phaseNumber <= 0) {
|
||||
this.applyConsequences();
|
||||
this.nextRound(); // Auto-switch to next round
|
||||
} else {
|
||||
} else {
|
||||
this.nextTurn();
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async nextTurn() {
|
||||
console.log("Going to phase !", this.phaseNumber );
|
||||
console.log("Going to phase !", this.phaseNumber);
|
||||
// Get all actions for this phase
|
||||
let phaseIndex = this.phaseNumber - 1;
|
||||
let actionList = [];
|
||||
let actionMsg = `<h4>Actions for phase ${this.phaseNumber}</h4>`;
|
||||
for (let combatantId in this.phaseSetup ) {
|
||||
for (let combatantId in this.phaseSetup) {
|
||||
let actionData = this.phaseSetup[combatantId];
|
||||
if ( actionData.phaseArray[phaseIndex].name != 'No Action' ) {
|
||||
let combatant = this.combatants.find( comb => comb._id == actionData.combatantId);
|
||||
const name = combatant.actor ? combatant.actor.data.name : combatant.name;
|
||||
actionList.push( { combatant: combatant,
|
||||
action: actionData.phaseArray[phaseIndex],
|
||||
isDone: false
|
||||
});
|
||||
if (actionData.phaseArray[phaseIndex].name != 'No Action') {
|
||||
let combatant = this.combatants.find(comb => comb._id == actionData.combatantId);
|
||||
const name = combatant.actor ? combatant.actor.name : combatant.name;
|
||||
actionList.push({
|
||||
combatant: combatant,
|
||||
action: actionData.phaseArray[phaseIndex],
|
||||
isDone: false
|
||||
});
|
||||
actionMsg += `<br>${name} is going to : ${actionData.phaseArray[phaseIndex].name}`;
|
||||
}
|
||||
}
|
||||
if ( actionList.length == 0) {
|
||||
if (actionList.length == 0) {
|
||||
actionMsg += "<br>No actions for the phase !";
|
||||
this.gotoNextTurn();
|
||||
}
|
||||
// Display a nice message
|
||||
ChatMessage.create( { content: actionMsg });
|
||||
ChatMessage.create({ content: actionMsg });
|
||||
|
||||
// Now push specific messages
|
||||
for ( let action of actionList) {
|
||||
for (let action of actionList) {
|
||||
let uniq = randomID(16);
|
||||
action.uniqId = uniq; // Easy tracking with chat messages
|
||||
const name = action.combatant.actor ? action.combatant.actor.data.name : action.combatant.name;
|
||||
if ( action.combatant.players[0]) {
|
||||
const name = action.combatant.actor ? action.combatant.actor.name : action.combatant.name;
|
||||
if (action.combatant.players[0]) {
|
||||
// A player controls this combatant -> message !
|
||||
ChatMessage.create( { content: `Phase ${this.phaseNumber} ! ${name} must perform a <strong>${action.action.name}</strong> action.
|
||||
ChatMessage.create({
|
||||
content: `Phase ${this.phaseNumber} ! ${name} must perform a <strong>${action.action.name}</strong> action.
|
||||
When done, click on the button below to close the action.
|
||||
<a class='chat-card-button' id='button-end-action' data-uniq-id='${uniq}' data-combatant-id='${action.combatant._id}' data-combat-id='${this._id}' data-round='${this.round}'>Action is done !</a>`,
|
||||
whisper: [ action.combatant.players[0].data._id] } );
|
||||
<a class='chat-card-button' id='button-end-action' data-uniq-id='${uniq}' data-combatant-id='${action.combatant.id}' data-combat-id='${this.id}' data-round='${this.round}'>Action is done !</a>`,
|
||||
whisper: [action.combatant.players[0].id]
|
||||
});
|
||||
} else {
|
||||
ChatMessage.create( { content: `Phase ${this.phaseNumber} ! ${name} must perform a <strong>${action.action.name}</strong> action.<br>
|
||||
ChatMessage.create({
|
||||
content: `Phase ${this.phaseNumber} ! ${name} must perform a <strong>${action.action.name}</strong> action.<br>
|
||||
When done, click on the button below to close the action.
|
||||
<a class='chat-card-button' id='button-end-action' data-uniq-id='${uniq}' data-combatant-id='${action.combatant._id}' data-combat-id='${this._id}' data-round='${this.round}'>Action is done !</a>`,
|
||||
whisper: [ ChatMessage.getWhisperRecipients("GM") ] } );
|
||||
<a class='chat-card-button' id='button-end-action' data-uniq-id='${uniq}' data-combatant-id='${action.combatant.id}' data-combat-id='${this.id}' data-round='${this.round}'>Action is done !</a>`,
|
||||
whisper: ChatMessage.getWhisperRecipients("GM")
|
||||
});
|
||||
}
|
||||
}
|
||||
// Save for easy access
|
||||
|
@ -96,28 +105,28 @@ export class SoSCombat extends Combat {
|
|||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
applyConsequences( ) {
|
||||
if (game.user.isGM ) {
|
||||
for( let combatant of this.combatants) {
|
||||
applyConsequences() {
|
||||
if (game.user.isGM) {
|
||||
for (let combatant of this.combatants) {
|
||||
if (!combatant.actor) continue; // Can't check tokens without assigned actors, Maybe print chat message about bleeding happening so that the GM can manually track this?
|
||||
let bleeding = combatant.actor.data.items.find( item => item.type == 'consequence' && item.name == 'Bleeding');
|
||||
combatant.actor.applyConsequenceWound( bleeding.data.severity, "bleeding" );
|
||||
let bleeding = combatant.actor.items.find(item => item.type == 'consequence' && item.name == 'Bleeding');
|
||||
combatant.actor.applyConsequenceWound(bleeding.system.severity, "bleeding");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
closeAction( uniqId) {
|
||||
closeAction(uniqId) {
|
||||
// Delete message !
|
||||
const toDelete = game.messages.filter(it => it.data.content.includes( uniqId ));
|
||||
toDelete.forEach(it => it.delete());
|
||||
const toDelete = game.messages.filter(it => it.content.includes(uniqId));
|
||||
toDelete.forEach(it => it.delete())
|
||||
|
||||
let action = this.currentActions.find( _action => _action.uniqId == uniqId );
|
||||
let action = this.currentActions.find(_action => _action.uniqId == uniqId);
|
||||
if (action) {
|
||||
action.isDone = true;
|
||||
|
||||
let filtered = this.currentActions.filter( _action => action.isDone );
|
||||
if ( filtered.length == this.currentActions.length) { // All actions closed !
|
||||
let filtered = this.currentActions.filter(_action => action.isDone);
|
||||
if (filtered.length == this.currentActions.length) { // All actions closed !
|
||||
console.log("Going next turn !!!");
|
||||
this.gotoNextTurn();
|
||||
}
|
||||
|
@ -125,22 +134,22 @@ export class SoSCombat extends Combat {
|
|||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getPhaseRank( actionConf) {
|
||||
for (let i=2; i>=0; i--) {
|
||||
getPhaseRank(actionConf) {
|
||||
for (let i = 2; i >= 0; i--) {
|
||||
let action = actionConf.phaseArray[i];
|
||||
if (action.name != "No Action") {
|
||||
return i+1;
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getAPFromActor( actorId ) {
|
||||
for( let combatant of this.combatants) {
|
||||
getAPFromActor(actorId) {
|
||||
for (let combatant of this.combatants) {
|
||||
//console.log(combatant);
|
||||
if ( combatant.actor.data._id == actorId ) {
|
||||
let phase = this.phaseSetup[combatant._id];
|
||||
if (combatant.actor.id == actorId) {
|
||||
let phase = this.phaseSetup[combatant.id];
|
||||
return phase.remainingAP;
|
||||
}
|
||||
}
|
||||
|
@ -148,42 +157,43 @@ export class SoSCombat extends Combat {
|
|||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
decreaseAPFromActor( actorId ) {
|
||||
for( let combatant of this.combatants) {
|
||||
decreaseAPFromActor(actorId) {
|
||||
for (let combatant of this.combatants) {
|
||||
//console.log(combatant);
|
||||
if ( combatant.actor.data._id == actorId ) {
|
||||
let phase = this.phaseSetup[combatant._id];
|
||||
if (combatant.actor.id == actorId) {
|
||||
let phase = this.phaseSetup[combatant.id];
|
||||
phase.remainingAP -= 1;
|
||||
if ( phase.remainingAP < 0 ) phase.remainingAP = 0;
|
||||
if (phase.remainingAP < 0) phase.remainingAP = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async setupActorActions(actionConf) {
|
||||
console.log("Setting combat for phase : ", actionConf, actionConf.uniqId);
|
||||
|
||||
// Delete message !
|
||||
const toDelete = game.messages.filter(it => it.data.content.includes( actionConf.uniqId ));
|
||||
console.log("MESSAGE : ", toDelete);
|
||||
const toDelete = game.messages.filter(it => it.content.includes(actionConf.uniqId));
|
||||
toDelete.forEach(it => it.delete());
|
||||
|
||||
if ( !this.phaseSetup) this.phaseSetup = {}; // Opportunistic init
|
||||
|
||||
if (!this.phaseSetup) this.phaseSetup = {}; // Opportunistic init
|
||||
|
||||
// Keep track
|
||||
this.phaseSetup[actionConf.combatantId] = actionConf;
|
||||
console.log( this.combatants );
|
||||
console.log(this.combatants);
|
||||
//let combatant = this.combatants.find( comb => comb._id == actionConf.combatantId);
|
||||
await this.setInitiative( actionConf.combatantId, this.getPhaseRank( actionConf ) );
|
||||
await this.setInitiative(actionConf.combatantId, this.getPhaseRank(actionConf));
|
||||
|
||||
let actionsDone = true
|
||||
for( let combatant of this.combatants) {
|
||||
if ( combatant.initiative == -1 ) actionsDone = false;
|
||||
for (let combatant of this.combatants) {
|
||||
if (combatant.initiative == -1) actionsDone = false;
|
||||
}
|
||||
if ( actionsDone ) {
|
||||
if (actionsDone) {
|
||||
this.actionsRequested = false;
|
||||
ChatMessage.create( { content: `Action declaration has been completed ! Now proceeding with actions.`,
|
||||
whisper: [ ChatMessage.getWhisperRecipients("GM") ] } );
|
||||
ChatMessage.create({
|
||||
content: `Action declaration has been completed ! Now proceeding with actions.`,
|
||||
whisper: ChatMessage.getWhisperRecipients("GM")
|
||||
})
|
||||
this.phaseNumber = 3;
|
||||
this.nextTurn();
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ export class SoSDialogCombatActions extends Dialog {
|
|||
actionPoints: SoSUtility.fillRange(0, 6),
|
||||
combatId: combatId,
|
||||
combatantId: combatantId,
|
||||
combatantsList: combat.data.combatants,
|
||||
combatantsList: combat.combatants,
|
||||
uniqId: uniqId,
|
||||
round: round
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ export class SoSGMDeck extends Dialog {
|
|||
let cardPath = `systems/foundryvtt-shadows-over-sol/img/cards/${card.cardName}.webp`;
|
||||
let cardData = { card: card, cardPath: cardPath };
|
||||
let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/chat-card.html', cardData );
|
||||
ChatMessage.create( { content: html, whisper: [ ChatMessage.getWhisperRecipients("GM") ] });
|
||||
ChatMessage.create( { content: html, whisper: ChatMessage.getWhisperRecipients("GM") } );
|
||||
//dialog.onFlipClose();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import { SoSUtility } from "./sos-utility.js";
|
|||
import { SoSCombat } from "./sos-combat.js";
|
||||
import { gearConverter } from "./gears_convert.js";
|
||||
import { SoSGMDeck } from "./sos-gm-deck.js";
|
||||
import { ClassCounter} from "https://www.uberwald.me/fvtt_appcount/count-class-ready.js"
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Foundry VTT Initialization */
|
||||
|
@ -89,30 +90,6 @@ function welcomeMessage() {
|
|||
` });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// Register world usage statistics
|
||||
function registerUsageCount( registerKey ) {
|
||||
if ( game.user.isGM ) {
|
||||
game.settings.register(registerKey, "world-key", {
|
||||
name: "Unique world key",
|
||||
scope: "world",
|
||||
config: false,
|
||||
default: "XXX",
|
||||
type: String
|
||||
});
|
||||
|
||||
let worldKey = game.settings.get(registerKey, "world-key")
|
||||
if ( worldKey == undefined || worldKey == "" ) {
|
||||
worldKey = randomID(32)
|
||||
game.settings.set(registerKey, "world-key", worldKey )
|
||||
}
|
||||
// Simple API counter
|
||||
let regURL = `https://www.uberwald.me/fvtt_appcount/count.php?name="${registerKey}"&worldKey="${worldKey}"&version="${game.release.generation}.${game.release.build}"&system="${game.system.id}"&systemversion="${game.system.version}"`
|
||||
$.ajax(regURL)
|
||||
/* -------------------------------------------- */
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Foundry VTT Initialization */
|
||||
/* -------------------------------------------- */
|
||||
|
@ -126,7 +103,7 @@ Hooks.once("ready", function () {
|
|||
user: game.user._id
|
||||
});
|
||||
}
|
||||
registerUsageCount("foundryvtt-shadows-over-sol")
|
||||
ClassCounter.registerUsageCount()
|
||||
|
||||
welcomeMessage();
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ export class SoSUtility {
|
|||
let trappings = items.filter( item => item.type == 'gear' || item.type == 'armor' || item.type == 'weapon' );
|
||||
let sumEnc = 0;
|
||||
for (let object of trappings) {
|
||||
if ( (!object.data.worn) && (!object.data.neg) && (!object.data.software) && (!object.data.implant) && (!object.data.containerid || object.data.containerid == "") ) {
|
||||
if ( (!object.system.worn) && (!object.system.neg) && (!object.system.software) && (!object.system.implant) && (!object.system.containerid || object.system.containerid == "") ) {
|
||||
sumEnc += (object.big > 0) ? object.big : 1;
|
||||
}
|
||||
}
|
||||
|
@ -275,20 +275,20 @@ export class SoSUtility {
|
|||
}
|
||||
|
||||
// DR management
|
||||
let armor = flipData.target.actor.data.items.find( item => item.type == 'armor' && item.data.worn);
|
||||
flipData.armorDR = armor ? armor.data.dr : 0;
|
||||
flipData.armorGel = armor ?armor.data.gel : 0;
|
||||
flipData.armorReflect = armor ? armor.data.reflect : 0;
|
||||
let dr = flipData.target.actor.data.data.scores.dr.value + flipData.armorDR;
|
||||
if (flipData.weapon.data.category == 'ballistic') {
|
||||
let armor = flipData.target.actor.system.items.find( item => item.type == 'armor' && item.system.worn);
|
||||
flipData.armorDR = armor ? armor.system.dr : 0;
|
||||
flipData.armorGel = armor ?armor.system.gel : 0;
|
||||
flipData.armorReflect = armor ? armor.system.reflect : 0;
|
||||
let dr = flipData.target.actor.system.scores.dr.value + flipData.armorDR;
|
||||
if (flipData.weapon.system.category == 'ballistic') {
|
||||
dr += flipData.armorGel;
|
||||
}
|
||||
if (flipData.weapon.data.category == 'laser') {
|
||||
if (flipData.weapon.system.category == 'laser') {
|
||||
dr += flipData.armorReflect;
|
||||
}
|
||||
|
||||
let shock = flipData.target.actor.data.data.scores.shock.value || 1;
|
||||
let defenseCritical = flipData.target.actor.data.data.scores.defense.critical;
|
||||
let shock = flipData.target.actor.system.scores.shock.value || 1;
|
||||
let defenseCritical = flipData.target.actor.system.scores.defense.critical;
|
||||
flipData.damageStatus = 'apply_damage';
|
||||
|
||||
flipData.targetShock = shock;
|
||||
|
@ -341,17 +341,17 @@ export class SoSUtility {
|
|||
|
||||
// Is target able to dodge ??
|
||||
let defender = game.actors.get( flipData.target.actor._id);
|
||||
flipData.coverConsequence = defender.data.items.find( item => item.type == 'consequence' && item.name == 'Cover');
|
||||
flipData.APavailable = game.combat.getAPFromActor( defender.data._id );
|
||||
flipData.coverConsequence = defender.items.find( item => item.type == 'consequence' && item.name == 'Cover');
|
||||
flipData.APavailable = game.combat.getAPFromActor( defender._id );
|
||||
console.log("FLIPDATE : ", flipData);
|
||||
if ( !flipData.isReaction && flipData.APavailable > 0) {
|
||||
if ( (flipData.weapon.data.category == 'melee' ) || ( (flipData.weapon.data.category == 'laser' || flipData.weapon.data.category == 'ballistic') &&
|
||||
flipData.coverConsequence.data.severity != 'none') ) {
|
||||
flipData.coverSeverityLevel = this.getConsequenceSeverityLevel( flipData.coverConsequence.data.severity ) * 2;
|
||||
if ( (flipData.weapon.system.category == 'melee' ) || ( (flipData.weapon.system.category == 'laser' || flipData.weapon.system.category == 'ballistic') &&
|
||||
flipData.coverConsequence.system.severity != 'none') ) {
|
||||
flipData.coverSeverityLevel = this.getConsequenceSeverityLevel( flipData.coverConsequence.system.severity ) * 2;
|
||||
flipData.coverSeverityFlag = (flipData.coverSeverityLevel > 0);
|
||||
flipData.isMelee = (flipData.weapon.data.category == 'melee' );
|
||||
let melee = defender.data.items.find( item => item.type == 'skill' && item.name == 'Melee');
|
||||
flipData.defenderMelee = melee.data.value;
|
||||
flipData.isMelee = (flipData.weapon.system.category == 'melee' );
|
||||
let melee = defender.items.find( item => item.type == 'skill' && item.name == 'Melee');
|
||||
flipData.defenderMelee = melee.system.value;
|
||||
flipData.uniqId = randomID(16);
|
||||
this.registry[flipData.uniqId] = flipData;
|
||||
let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/chat-damage-request-dodge.html', flipData );
|
||||
|
|
67
system.json
67
system.json
|
@ -2,19 +2,14 @@
|
|||
"id": "foundryvtt-shadows-over-sol",
|
||||
"title": "Shadows over Sol",
|
||||
"description": "Shadows over Sol for FoundryVTT",
|
||||
"author": "LeRatierBretonnien",
|
||||
"authors": [],
|
||||
"url": "https://www.uberwald.me/gitea/public/foundryvtt-shadows-over-sol/",
|
||||
"license": "LICENSE.txt",
|
||||
"flags": {},
|
||||
"version": "10.0.0",
|
||||
"version": "11.0.1",
|
||||
"compatibility": {
|
||||
"minimum": 10,
|
||||
"verified": 10,
|
||||
"maximum": 10
|
||||
"minimum": "10",
|
||||
"verified": "10",
|
||||
"maximum": "11"
|
||||
},
|
||||
"templateVersion": 50,
|
||||
"scripts": [],
|
||||
"esmodules": [
|
||||
"module/sos-main.js"
|
||||
],
|
||||
|
@ -25,88 +20,96 @@
|
|||
{
|
||||
"lang": "en",
|
||||
"name": "English",
|
||||
"path": "lang/en.json"
|
||||
"path": "lang/en.json",
|
||||
"flags": {}
|
||||
}
|
||||
],
|
||||
"packs": [
|
||||
{
|
||||
"name": "skills",
|
||||
"label": "Skills",
|
||||
"path": "./packs/skills.db",
|
||||
"path": "packs/skills.db",
|
||||
"type": "Item",
|
||||
"system": "foundryvtt-shadows-over-sol",
|
||||
"private": false
|
||||
"private": false,
|
||||
"flags": {}
|
||||
},
|
||||
{
|
||||
"name": "consequences",
|
||||
"label": "Consequences",
|
||||
"path": "./packs/consequences.db",
|
||||
"path": "packs/consequences.db",
|
||||
"type": "Item",
|
||||
"system": "foundryvtt-shadows-over-sol",
|
||||
"private": false
|
||||
"private": false,
|
||||
"flags": {}
|
||||
},
|
||||
{
|
||||
"name": "gears",
|
||||
"label": "Gears",
|
||||
"path": "./packs/gears.db",
|
||||
"path": "packs/gears.db",
|
||||
"type": "Item",
|
||||
"system": "foundryvtt-shadows-over-sol",
|
||||
"private": false
|
||||
"private": false,
|
||||
"flags": {}
|
||||
},
|
||||
{
|
||||
"name": "injuries",
|
||||
"label": "Injuries",
|
||||
"path": "./packs/injuries.db",
|
||||
"path": "packs/injuries.db",
|
||||
"type": "Item",
|
||||
"system": "foundryvtt-shadows-over-sol",
|
||||
"private": false
|
||||
"private": false,
|
||||
"flags": {}
|
||||
},
|
||||
{
|
||||
"name": "weaknesses",
|
||||
"label": "Weaknesses",
|
||||
"path": "./packs/weaknesses.db",
|
||||
"path": "packs/weaknesses.db",
|
||||
"type": "Item",
|
||||
"system": "foundryvtt-shadows-over-sol",
|
||||
"private": false
|
||||
"private": false,
|
||||
"flags": {}
|
||||
},
|
||||
{
|
||||
"name": "languages",
|
||||
"label": "Languages",
|
||||
"path": "./packs/languages.db",
|
||||
"path": "packs/languages.db",
|
||||
"type": "Item",
|
||||
"system": "foundryvtt-shadows-over-sol",
|
||||
"private": false
|
||||
"private": false,
|
||||
"flags": {}
|
||||
},
|
||||
{
|
||||
"name": "combat-actions",
|
||||
"label": "Combat Actions",
|
||||
"path": "./packs/combat-actions.db",
|
||||
"path": "packs/combat-actions.db",
|
||||
"type": "Item",
|
||||
"system": "foundryvtt-shadows-over-sol",
|
||||
"private": false
|
||||
"private": false,
|
||||
"flags": {}
|
||||
},
|
||||
{
|
||||
"name": "genelines",
|
||||
"label": "Genelines",
|
||||
"path": "./packs/genelines.db",
|
||||
"path": "packs/genelines.db",
|
||||
"type": "Item",
|
||||
"system": "foundryvtt-shadows-over-sol",
|
||||
"private": false
|
||||
"private": false,
|
||||
"flags": {}
|
||||
},
|
||||
{
|
||||
"name": "subcultures",
|
||||
"label": "Subcultures",
|
||||
"path": "./packs/subcultures.db",
|
||||
"path": "packs/subcultures.db",
|
||||
"type": "Item",
|
||||
"system": "foundryvtt-shadows-over-sol",
|
||||
"private": false
|
||||
"private": false,
|
||||
"flags": {}
|
||||
}
|
||||
],
|
||||
"relationships": { },
|
||||
"socket": true,
|
||||
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-shadows-over-sol/raw/branch/master/system.json",
|
||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-shadows-over-sol/archive/foundryvtt-shadows-over-sol-10.0.0.zip",
|
||||
"protected": false,
|
||||
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-shadows-over-sol/raw/branch/v10/system.json",
|
||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-shadows-over-sol/archive/foundryvtt-shadows-over-sol-11.0.1.zip",
|
||||
"gridDistance": 5,
|
||||
"gridUnits": "ft"
|
||||
}
|
|
@ -390,12 +390,12 @@
|
|||
<hr>
|
||||
<h3>Biography : </h3>
|
||||
<div class="form-group editor">
|
||||
{{editor data.history target="system.history" button=true owner=owner editable=editable}}
|
||||
{{editor history target="system.history" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
<hr>
|
||||
<h3>Notes : </h3>
|
||||
<div class="form-group editor">
|
||||
{{editor data.notes target="system.notes" button=true owner=owner editable=editable}}
|
||||
{{editor notes target="system.notes" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
<hr>
|
||||
{{>"systems/foundryvtt-shadows-over-sol/templates/editor-notes-gm.html"}}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{{#if data.isGM}}
|
||||
<h3>GM Notes : </h3>
|
||||
<div class="form-group editor">
|
||||
{{editor data.gmnotes target="system.gmnotes" button=true owner=owner editable=editable}}
|
||||
{{editor gmnotes target="system.gmnotes" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
<div class="flexcol">
|
||||
<label class="generic-label">Description</label>
|
||||
<div class="form-group medium-editor">
|
||||
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
|
||||
{{editor description target="system.description" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -46,6 +46,6 @@
|
|||
<div class="flexcol">
|
||||
<label class="generic-label">Description</label>
|
||||
<div class="form-group medium-editor">
|
||||
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
|
||||
{{editor description target="system.description" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<div class="flexcol">
|
||||
<label class="generic-label">Description</label>
|
||||
<div class="form-group medium-editor">
|
||||
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
|
||||
{{editor description target="system.description" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div class="flexcol">
|
||||
<label class="generic-label">Description</label>
|
||||
<div class="form-group medium-editor">
|
||||
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
|
||||
{{editor description target="system.description" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flexcol">
|
||||
|
@ -31,7 +31,7 @@
|
|||
<div class="flexcol">
|
||||
<label class="generic-label">Weakness</label>
|
||||
<div class="form-group small-editor">
|
||||
{{editor data.weakness target="system.weakness" button=true owner=owner editable=editable}}
|
||||
{{editor weakness target="system.weakness" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<div class="flexcol">
|
||||
<label class="generic-label">Description</label>
|
||||
<div class="form-group medium-editor">
|
||||
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
|
||||
{{editor description target="system.description" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div class="flexcol">
|
||||
<label class="generic-label">Description</label>
|
||||
<div class="form-group medium-editor">
|
||||
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
|
||||
{{editor description target="system.description" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<div class="flexcol">
|
||||
<label class="generic-label">Notes</label>
|
||||
<div class="form-group medium-editor">
|
||||
{{editor data.notes target="system.notes" button=true owner=owner editable=editable}}
|
||||
{{editor notes target="system.notes" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
{{/each}}
|
||||
</ul>
|
||||
<label class="generic-label">Description</label>
|
||||
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
|
||||
{{editor description target="system.description" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<div class="flexcol">
|
||||
<label class="generic-label">Description</label>
|
||||
<div class="form-group medium-editor">
|
||||
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
|
||||
{{editor description target="system.description" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div class="flexcol">
|
||||
<label class="generic-label">Description</label>
|
||||
<div class="form-group medium-editor">
|
||||
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
|
||||
{{editor description target="system.description" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flexcol">
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<div class="flexcol">
|
||||
<label class="generic-label">Description</label>
|
||||
<div class="form-group medium-editor">
|
||||
{{editor data.description target="system.description" button=true owner=owner editable=editable}}
|
||||
{{editor description target="system.description" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue