Enhance initiative + fix combat
This commit is contained in:
parent
b2fe67ab05
commit
622f31e1c7
@ -477,6 +477,7 @@
|
||||
"BOL.chat.rollbougette": "Jet de Bougette",
|
||||
"BOL.chat.bougettesuccess": "Votre bougette reste inchangée !",
|
||||
"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.veryeasy": "Trés Facile (+2)",
|
||||
|
@ -141,6 +141,7 @@ export class BoLActorSheet extends ActorSheet {
|
||||
formData.ammos = this.actor.ammos
|
||||
formData.misc = this.actor.misc
|
||||
formData.combat = this.actor.buildCombat()
|
||||
formData.initiativeRank = this.actor.getInitiativeRank()
|
||||
//formData.combatCreature = this.actor.buildCombatCreature()
|
||||
formData.features = this.actor.buildFeatures()
|
||||
formData.isGM = game.user.isGM
|
||||
|
@ -648,13 +648,35 @@ export class BoLActor extends Actor {
|
||||
}
|
||||
|
||||
/*-------------------------------------------- */
|
||||
registerInit(initScore, isCritical, isFumble) {
|
||||
this.update({ 'system.combat.lastinit': initScore, 'system.combat.iscritical': isCritical, 'system.combat.isfumble': isFumble })
|
||||
registerInit(rollData) {
|
||||
rollData.actor = undefined // Cleanup if present
|
||||
this.setFlag("world", "last-initiative", rollData)
|
||||
}
|
||||
|
||||
/*-------------------------------------------- */
|
||||
getLastInitData() {
|
||||
return this.system.combat
|
||||
getInitiativeRank() {
|
||||
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
|
||||
}
|
||||
|
||||
/*-------------------------------------------- */
|
||||
|
@ -41,7 +41,7 @@ Hooks.once('init', async function () {
|
||||
*/
|
||||
CONFIG.Combat.initiative = {
|
||||
formula: "2d6+@attributes.mind.value+@aptitudes.init.value",
|
||||
decimals: 3
|
||||
decimals: 2
|
||||
};
|
||||
|
||||
// Define custom Entity classes
|
||||
|
@ -570,7 +570,8 @@ export class BoLDefaultRoll {
|
||||
}
|
||||
|
||||
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
|
||||
this.rollData.remainingPP = actor.spendPowerPoint(this.rollData.ppCost + this.rollData.ppCostArmor)
|
||||
|
@ -10,6 +10,8 @@ Init order =
|
||||
3 - Echec critique
|
||||
*/
|
||||
|
||||
import { BoLUtility } from "../system/bol-utility.js";
|
||||
|
||||
|
||||
export class BoLCombatManager extends Combat {
|
||||
|
||||
@ -18,35 +20,12 @@ export class BoLCombatManager extends Combat {
|
||||
console.log(`${game.system.title} | Combat.rollInitiative()`, ids, formula, messageOptions);
|
||||
// Structure input data
|
||||
ids = typeof ids === "string" ? [ids] : ids;
|
||||
const currentId = this.combatant._id;
|
||||
const currentId = this.combatant.id;
|
||||
|
||||
// calculate initiative
|
||||
for (let cId = 0; cId < ids.length; cId++) {
|
||||
const combatant = this.combatants.get(ids[cId]);
|
||||
let fvttInit = 5
|
||||
//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
|
||||
}
|
||||
}
|
||||
const combatant = this.combatants.get(ids[cId])
|
||||
let fvttInit = combatant.actor.getInitiativeRank()
|
||||
fvttInit += (cId / 100)
|
||||
await this.updateEmbeddedDocuments("Combatant", [{ _id: ids[cId], initiative: fvttInit }]);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
],
|
||||
"url": "https://www.uberwald.me/gitea/public/bol",
|
||||
"license": "LICENSE.txt",
|
||||
"version": "10.4.6",
|
||||
"version": "10.4.7",
|
||||
"compatibility": {
|
||||
"minimum": "10",
|
||||
"verified": "10",
|
||||
@ -203,7 +203,7 @@
|
||||
],
|
||||
"socket": true,
|
||||
"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",
|
||||
"gridDistance": 1.5,
|
||||
"gridUnits": "m",
|
||||
|
@ -34,6 +34,12 @@
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if initiativeRank}}
|
||||
<div>
|
||||
{{localize "BOL.chat.initiative"}}: {{initiativeRank}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if (eq mode "bougette")}}
|
||||
<div>
|
||||
{{localize "BOL.chat.rollbougette"}} :
|
||||
|
Loading…
Reference in New Issue
Block a user