forked from public/bol
Enhance initiative + fix combat
This commit is contained in:
parent
b2fe67ab05
commit
ac96f3ca67
@ -477,6 +477,7 @@
|
|||||||
"BOL.chat.rollbougette": "Jet de Bougette",
|
"BOL.chat.rollbougette": "Jet de Bougette",
|
||||||
"BOL.chat.bougettesuccess": "Votre bougette reste inchangée !",
|
"BOL.chat.bougettesuccess": "Votre bougette reste inchangée !",
|
||||||
"BOL.chat.bougettefailure": "Vous avez trop dépensé, votre bougette s'est réduite...",
|
"BOL.chat.bougettefailure": "Vous avez trop dépensé, votre bougette s'est réduite...",
|
||||||
|
"BOL.chat.initiative": "Rang d'intiative (10 à 1)",
|
||||||
|
|
||||||
"BOL.dialog.soeasy": "Inmanquable (+4)",
|
"BOL.dialog.soeasy": "Inmanquable (+4)",
|
||||||
"BOL.dialog.veryeasy": "Trés Facile (+2)",
|
"BOL.dialog.veryeasy": "Trés Facile (+2)",
|
||||||
|
@ -141,6 +141,7 @@ export class BoLActorSheet extends ActorSheet {
|
|||||||
formData.ammos = this.actor.ammos
|
formData.ammos = this.actor.ammos
|
||||||
formData.misc = this.actor.misc
|
formData.misc = this.actor.misc
|
||||||
formData.combat = this.actor.buildCombat()
|
formData.combat = this.actor.buildCombat()
|
||||||
|
formData.initiativeRank = this.actor.getInitiativeRank()
|
||||||
//formData.combatCreature = this.actor.buildCombatCreature()
|
//formData.combatCreature = this.actor.buildCombatCreature()
|
||||||
formData.features = this.actor.buildFeatures()
|
formData.features = this.actor.buildFeatures()
|
||||||
formData.isGM = game.user.isGM
|
formData.isGM = game.user.isGM
|
||||||
|
@ -648,15 +648,37 @@ export class BoLActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------- */
|
/*-------------------------------------------- */
|
||||||
registerInit(initScore, isCritical, isFumble) {
|
registerInit(rollData) {
|
||||||
this.update({ 'system.combat.lastinit': initScore, 'system.combat.iscritical': isCritical, 'system.combat.isfumble': isFumble })
|
rollData.actor = undefined // Cleanup if present
|
||||||
|
this.setFlag("world", "last-initiative", rollData)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------- */
|
/*-------------------------------------------- */
|
||||||
getLastInitData() {
|
getInitiativeRank() {
|
||||||
return this.system.combat
|
let rollData = this.getFlag("world", "last-initiative")
|
||||||
|
let fvttInit = 5
|
||||||
|
if (this.type == 'character') {
|
||||||
|
if (rollData.isLegendary) {
|
||||||
|
fvttInit = 10
|
||||||
|
} else if (rollData.isCritical) {
|
||||||
|
fvttInit = 9
|
||||||
|
} else if (rollData.isSuccess ) {
|
||||||
|
fvttInit = 8
|
||||||
|
} else if (rollData.isFumble) {
|
||||||
|
fvttInit = 3
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fvttInit = 4 // Pietaille par defautco
|
||||||
|
if ( this.getCharType() == 'adversary') {
|
||||||
|
fvttInit = 7
|
||||||
|
}
|
||||||
|
if ( this.getCharType() == 'tough') {
|
||||||
|
fvttInit = 6
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fvttInit
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------- */
|
/*-------------------------------------------- */
|
||||||
async subHeroPoints(nb) {
|
async subHeroPoints(nb) {
|
||||||
let newHeroP = this.system.resources.hero.value - nb;
|
let newHeroP = this.system.resources.hero.value - nb;
|
||||||
|
@ -41,7 +41,7 @@ Hooks.once('init', async function () {
|
|||||||
*/
|
*/
|
||||||
CONFIG.Combat.initiative = {
|
CONFIG.Combat.initiative = {
|
||||||
formula: "2d6+@attributes.mind.value+@aptitudes.init.value",
|
formula: "2d6+@attributes.mind.value+@aptitudes.init.value",
|
||||||
decimals: 3
|
decimals: 2
|
||||||
};
|
};
|
||||||
|
|
||||||
// Define custom Entity classes
|
// Define custom Entity classes
|
||||||
|
@ -570,7 +570,8 @@ export class BoLDefaultRoll {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.rollData.registerInit) {
|
if (this.rollData.registerInit) {
|
||||||
actor.registerInit(r.total, this.rollData.isCritical, this.rollData.isFumble)
|
actor.registerInit(this.rollData)
|
||||||
|
this.rollData.initiativeRank = actor.getInitiativeRank()
|
||||||
}
|
}
|
||||||
if (this.rollData.isSuccess && this.rollData.mode == "spell") { // PP cost management
|
if (this.rollData.isSuccess && this.rollData.mode == "spell") { // PP cost management
|
||||||
this.rollData.remainingPP = actor.spendPowerPoint(this.rollData.ppCost + this.rollData.ppCostArmor)
|
this.rollData.remainingPP = actor.spendPowerPoint(this.rollData.ppCost + this.rollData.ppCostArmor)
|
||||||
|
@ -10,6 +10,8 @@ Init order =
|
|||||||
3 - Echec critique
|
3 - Echec critique
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { BoLUtility } from "../system/bol-utility.js";
|
||||||
|
|
||||||
|
|
||||||
export class BoLCombatManager extends Combat {
|
export class BoLCombatManager extends Combat {
|
||||||
|
|
||||||
@ -18,35 +20,12 @@ export class BoLCombatManager extends Combat {
|
|||||||
console.log(`${game.system.title} | Combat.rollInitiative()`, ids, formula, messageOptions);
|
console.log(`${game.system.title} | Combat.rollInitiative()`, ids, formula, messageOptions);
|
||||||
// Structure input data
|
// Structure input data
|
||||||
ids = typeof ids === "string" ? [ids] : ids;
|
ids = typeof ids === "string" ? [ids] : ids;
|
||||||
const currentId = this.combatant._id;
|
const currentId = this.combatant.id;
|
||||||
|
|
||||||
// calculate initiative
|
// calculate initiative
|
||||||
for (let cId = 0; cId < ids.length; cId++) {
|
for (let cId = 0; cId < ids.length; cId++) {
|
||||||
const combatant = this.combatants.get(ids[cId]);
|
const combatant = this.combatants.get(ids[cId])
|
||||||
let fvttInit = 5
|
let fvttInit = combatant.actor.getInitiativeRank()
|
||||||
//console.log("TYPE", combatant.actor.type)
|
|
||||||
if (combatant.actor.type == 'character') {
|
|
||||||
let initData = combatant.actor.getLastInitData()
|
|
||||||
console.log("Init data !!!", initData)
|
|
||||||
if (initData.isLegendary) {
|
|
||||||
fvttInit = 10
|
|
||||||
} else if (initData.isCritical) {
|
|
||||||
fvttInit = 9
|
|
||||||
} else if (initData.lastinit >= 9) {
|
|
||||||
fvttInit = 8
|
|
||||||
} else if (initData.isFumble) {
|
|
||||||
fvttInit = 3
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fvttInit = 4 // Pietaille par defautco
|
|
||||||
//console.log("ACTOR", combatant.actor.getCharType())
|
|
||||||
if ( combatant.actor.getCharType() == 'adversary') {
|
|
||||||
fvttInit = 7
|
|
||||||
}
|
|
||||||
if ( combatant.actor.getCharType() == 'tough') {
|
|
||||||
fvttInit = 6
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fvttInit += (cId / 100)
|
fvttInit += (cId / 100)
|
||||||
await this.updateEmbeddedDocuments("Combatant", [{ _id: ids[cId], initiative: fvttInit }]);
|
await this.updateEmbeddedDocuments("Combatant", [{ _id: ids[cId], initiative: fvttInit }]);
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ export class BoLUtility {
|
|||||||
static getOtherWhisperRecipients(name) {
|
static getOtherWhisperRecipients(name) {
|
||||||
let users = []
|
let users = []
|
||||||
for (let user of game.users) {
|
for (let user of game.users) {
|
||||||
if (!user.isGM && user.name != name) {
|
if ( !user.isGM && user.name != name) {
|
||||||
users.push(user.id)
|
users.push(user.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
],
|
],
|
||||||
"url": "https://www.uberwald.me/gitea/public/bol",
|
"url": "https://www.uberwald.me/gitea/public/bol",
|
||||||
"license": "LICENSE.txt",
|
"license": "LICENSE.txt",
|
||||||
"version": "10.4.6",
|
"version": "10.4.7",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "10",
|
"minimum": "10",
|
||||||
"verified": "10",
|
"verified": "10",
|
||||||
@ -203,7 +203,7 @@
|
|||||||
],
|
],
|
||||||
"socket": true,
|
"socket": true,
|
||||||
"manifest": "https://www.uberwald.me/gitea/public/bol/raw/v10/system.json",
|
"manifest": "https://www.uberwald.me/gitea/public/bol/raw/v10/system.json",
|
||||||
"download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v10.4.6.zip",
|
"download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v10.4.7.zip",
|
||||||
"background": "systems/images/map_lemurie.webp",
|
"background": "systems/images/map_lemurie.webp",
|
||||||
"gridDistance": 1.5,
|
"gridDistance": 1.5,
|
||||||
"gridUnits": "m",
|
"gridUnits": "m",
|
||||||
|
@ -34,6 +34,12 @@
|
|||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if initiativeRank}}
|
||||||
|
<div>
|
||||||
|
{{localize "BOL.chat.initiative"}}: {{initiativeRank}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#if (eq mode "bougette")}}
|
{{#if (eq mode "bougette")}}
|
||||||
<div>
|
<div>
|
||||||
{{localize "BOL.chat.rollbougette"}} :
|
{{localize "BOL.chat.rollbougette"}} :
|
||||||
|
Loading…
Reference in New Issue
Block a user