Review initiative

This commit is contained in:
LeRatierBretonnien 2023-05-01 18:50:32 +02:00
parent 59ee6684ab
commit 268ac0a25a
8 changed files with 36 additions and 17 deletions

View File

@ -156,6 +156,7 @@
"BOL.ui.armorAgiMalus": "Rüschtung+Schild-Malus (Geschick)",
"BOL.ui.armorInitMalus": "Rüstungsmalus (Init)",
"BOL.ui.attackValue": "Angriffswert",
"BOL.ui.initMalus": "Init malus",
"BOL.featureCategory.origins": "Herkünfte",
"BOL.featureCategory.races": "Rassen",

View File

@ -154,6 +154,7 @@
"BOL.ui.armorInitMalus": "Armor Modifier (Init)",
"BOL.ui.attackValue": "Attack Value",
"BOL.ui.weaponbonus": "Cette arme bénéficie déja d'un Dé de Bonus (Arme Favorite prise en compte, par exemple)",
"BOL.ui.initMalus": "Init malus",
"BOL.featureCategory.origins": "Origins",
"BOL.featureCategory.races": "Races",

View File

@ -132,6 +132,7 @@
"BOL.ui.concentrate": "Concentration à maintenir ?",
"BOL.ui.aggressive": "Sort aggressif ?",
"BOL.ui.registerInit": "Enregistrer comme Init. de combat",
"BOL.ui.initMalus": "Malus d'initiative",
"BOL.ui.magicnewrules": "Règles supplémentaires (cf. supplément fan-made Sorcellerie!)",
"BOL.ui.isSorcerer": "Carrière de Sorcier ?",

View File

@ -48,7 +48,13 @@ export class BoLActor extends Actor {
}
return false
}
/* -------------------------------------------- */
getInitiativeMalus() {
if ( this.type === 'encounter' && (this.chartype == "adversary" || this.chartype == "tough")) {
return this.system.aptitudes.init.value
}
return 0
}
/* -------------------------------------------- */
getBougette() {
if (this.type == "character") {
@ -871,17 +877,17 @@ export class BoLActor extends Actor {
/*-------------------------------------------- */
getInitiativeRank(rollData = undefined, isCombat = false, combatData) {
if (!rollData) {
rollData = this.getFlag("world", "last-initiative")
}
let fvttInit = 4 // Pietaille par defaut
if (this.type == 'character') {
fvttInit = 5
fvttInit = -1
if (!rollData) {
if (isCombat) {
if (game.user.isGM ) {
game.socket.emit("system.bol", { name: "msg_request_init_roll", data: { actorId: this.id, combatData : combatData } })
if (this.hasPlayerOwner) {
game.socket.emit("system.bol", { name: "msg_request_init_roll", data: { actorId: this.id, combatData } })
} else {
BoLRoll.aptitudeCheck(this, "init", undefined, combatData);
}
}
}
} else {

View File

@ -584,7 +584,8 @@ export class BoLRoll {
}
let diceData = BoLUtility.getDiceData()
const modifiers = rollbase + rollData.careerBonus + rollData.mod + rollData.weaponModifier - rollData.defence - rollData.modArmorMalus + rollData.shieldMalus + rollData.attackModifier + rollData.appliedArmorMalus + rollData.effectModifier
let malusInit = rollData.combatData?.malusInit || 0
const modifiers = rollbase + rollData.careerBonus + rollData.mod + rollData.weaponModifier - rollData.defence - rollData.modArmorMalus + rollData.shieldMalus + rollData.attackModifier + rollData.appliedArmorMalus + rollData.effectModifier - malusInit
const formula = (isMalus) ? rollData.nbDice + "d" + diceData.diceFormula + "kl2 + " + modifiers : rollData.nbDice + "d" + diceData.diceFormula + "kh2 + " + modifiers
rollData.formula = formula
rollData.modifiers = modifiers
@ -647,10 +648,11 @@ export class BoLDefaultRoll {
this.rollData.reroll = actor.heroReroll()
}
if (this.rollData.registerInit) {
actor.registerInit(this.rollData)
await actor.registerInit(this.rollData)
this.rollData.initiativeRank = actor.getInitiativeRank(this.rollData)
if (this.rollData.combatData) { // If combatData present
let combat = game.combats.get(this.rollData.combatData.combatId)
console.log("SET INIT!!!!!", this.rollData.initiativeRank)
combat.setInitiative(this.rollData.combatData.combatantId, this.rollData.initiativeRank)
}
}

View File

@ -20,12 +20,15 @@ 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;
// Get initiative malus from tough/adversary
let malusInit = 0
for (let combatant of this.combatants) {
malusInit = Math.max(malusInit, combatant.actor.getInitiativeMalus())
}
// calculate initiative
for (let cId = 0; cId < ids.length; cId++) {
const combatant = this.combatants.get(ids[cId])
let fvttInit = combatant.actor.getInitiativeRank(false, true, { combatId: this.id, combatantId: combatant.id })
let fvttInit = combatant.actor.getInitiativeRank(false, true, { combatId: this.id, combatantId: combatant.id, malusInit })
fvttInit += (cId / 100)
await this.updateEmbeddedDocuments("Combatant", [{ _id: ids[cId], initiative: fvttInit }]);
}
@ -64,7 +67,7 @@ export class BoLCombatManager extends Combat {
return super.startCombat()
}
/************************************************************************************/
/*-***********************************************************************************/
_onDelete() {
if (game.user.isGM) {
let combatants = this.combatants.contents

View File

@ -14,7 +14,7 @@
],
"url": "https://www.uberwald.me/gitea/public/bol",
"license": "LICENSE.txt",
"version": "10.5.15",
"version": "10.5.16",
"compatibility": {
"minimum": "10",
"verified": "10"
@ -202,7 +202,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.5.15.zip",
"download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v10.5.16.zip",
"background": "systems/bol/ui/page_accueil.webp",
"gridDistance": 1.5,
"gridUnits": "m",

View File

@ -23,7 +23,12 @@
</label>
</div>
</div>
<div class="flexrow" style="margin-bottom: 1px;">
<div class="flex1 center bg-darkred">
<label for="mod">{{localize 'BOL.ui.initMalus'}}</label>
</div>
<div class="flex1 center cell">{{combatData.malusInit}}</div>
</div>
{{/if}}
{{> "systems/bol/templates/dialogs/career-roll-part.hbs"}}