Minion can now choose a stance and if they are prepared in sheet
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
- Fix js error when Advancement is not embed in a actor
|
- Fix js error when Advancement is not embed in a actor
|
||||||
- Click on a weapon show the DicePicker with the weapon skill selected
|
- Click on a weapon show the DicePicker with the weapon skill selected
|
||||||
- Display Rarity in Compendiums for Items, Armors and Weapons
|
- Display Rarity in Compendiums for Items, Armors and Weapons
|
||||||
|
- Minion can now choose a stance and if they are prepared
|
||||||
- Other minors fix
|
- Other minors fix
|
||||||
|
|
||||||
## 1.1.1 - The Huns War
|
## 1.1.1 - The Huns War
|
||||||
|
|||||||
@@ -52,25 +52,21 @@ export class CombatL5r5e extends Combat {
|
|||||||
// Shortcut to data
|
// Shortcut to data
|
||||||
const data = combatant.actor.data.data;
|
const data = combatant.actor.data.data;
|
||||||
|
|
||||||
|
// Prepared is a boolean or if null we get the info in the actor sheet
|
||||||
|
const isPc = combatant.actor.data.type === "character";
|
||||||
|
let isPrepared = isPc ? cfg.prepared.character : cfg.prepared[data.type];
|
||||||
|
if (isPrepared === "null") {
|
||||||
|
isPrepared = data.prepared ? "true" : "false";
|
||||||
|
}
|
||||||
|
|
||||||
// A character’s initiative value is based on their state of preparedness when the conflict began.
|
// A character’s initiative value is based on their state of preparedness when the conflict began.
|
||||||
// If the character was ready for the conflict, their base initiative value is their focus attribute.
|
// If the character was ready for the conflict, their base initiative value is their focus attribute.
|
||||||
// If the character was unprepared (such as when surprised), their base initiative value is their vigilance attribute.
|
// If the character was unprepared (such as when surprised), their base initiative value is their vigilance attribute.
|
||||||
let initiative;
|
// Minion NPCs can generate initiative value without a check, using their focus or vigilance attribute
|
||||||
|
let initiative = isPrepared === "true" ? data.focus : data.is_compromised ? 1 : data.vigilance;
|
||||||
if (combatant.actor.data.type === "npc" && combatant.actor.data.data.type === "minion") {
|
|
||||||
// Minion NPCs can generate initiative value without a check, using their focus or vigilance attribute
|
|
||||||
initiative = cfg.prepared.minion === "true" ? data.focus : data.is_compromised ? 1 : data.vigilance;
|
|
||||||
} else {
|
|
||||||
// PC and Adversary
|
|
||||||
const isPc = combatant.actor.data.type === "character";
|
|
||||||
|
|
||||||
// prepared is a boolean or if null we get the info in the actor sheet
|
|
||||||
let isPrepared = isPc ? cfg.prepared.character : cfg.prepared.adversary;
|
|
||||||
if (isPrepared === "null") {
|
|
||||||
isPrepared = data.prepared ? "true" : "false";
|
|
||||||
}
|
|
||||||
initiative = isPrepared === "true" ? data.focus : data.is_compromised ? 1 : data.vigilance;
|
|
||||||
|
|
||||||
|
// Roll only for PC and Adversary
|
||||||
|
if (isPc || data.type === "adversary") {
|
||||||
// Roll formula
|
// Roll formula
|
||||||
if (!formula) {
|
if (!formula) {
|
||||||
const createFormula = [`${data.rings[data.stance]}dr`];
|
const createFormula = [`${data.rings[data.stance]}dr`];
|
||||||
@@ -131,8 +127,22 @@ export class CombatL5r5e extends Combat {
|
|||||||
_sortCombatants(a, b) {
|
_sortCombatants(a, b) {
|
||||||
// if tie, sort by honor, less honorable first
|
// if tie, sort by honor, less honorable first
|
||||||
if (a.initiative === b.initiative) {
|
if (a.initiative === b.initiative) {
|
||||||
|
// if tie, Character > Adversary > Minion
|
||||||
|
if (a.actor.data.data.social.honor === b.actor.data.data.social.honor) {
|
||||||
|
return (
|
||||||
|
CombatL5r5e._getWeightByActorType(a.actor.data) - CombatL5r5e._getWeightByActorType(b.actor.data)
|
||||||
|
);
|
||||||
|
}
|
||||||
return a.actor.data.data.social.honor - b.actor.data.data.social.honor;
|
return a.actor.data.data.social.honor - b.actor.data.data.social.honor;
|
||||||
}
|
}
|
||||||
return b.initiative - a.initiative;
|
return b.initiative - a.initiative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic weight system for sorting Character > Adversary > Minion
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
static _getWeightByActorType(data) {
|
||||||
|
return data.type === "npc" ? (data.data.type === "minion" ? 3 : 2) : 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ export default class HooksL5r5e {
|
|||||||
value = "true";
|
value = "true";
|
||||||
break;
|
break;
|
||||||
case "true":
|
case "true":
|
||||||
value = preparedId === "minion" ? "false" : "null";
|
value = "null";
|
||||||
break;
|
break;
|
||||||
case "null":
|
case "null":
|
||||||
value = "false";
|
value = "false";
|
||||||
|
|||||||
@@ -56,6 +56,6 @@ export const RegisterSettings = function () {
|
|||||||
scope: "world",
|
scope: "world",
|
||||||
config: false,
|
config: false,
|
||||||
type: String,
|
type: String,
|
||||||
default: "true",
|
default: "null",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -22,9 +22,7 @@
|
|||||||
<section class="sheet-body">
|
<section class="sheet-body">
|
||||||
<article>
|
<article>
|
||||||
{{> 'systems/l5r5e/templates/actors/npc/skill.html' }}
|
{{> 'systems/l5r5e/templates/actors/npc/skill.html' }}
|
||||||
{{#ifCond data.type '==' 'adversary'}}
|
{{> 'systems/l5r5e/templates/actors/npc/conflict.html' }}
|
||||||
{{> 'systems/l5r5e/templates/actors/npc/conflict.html' }}
|
|
||||||
{{/ifCond}}
|
|
||||||
</article>
|
</article>
|
||||||
<article>
|
<article>
|
||||||
{{> 'systems/l5r5e/templates/actors/npc/narrative.html' }}
|
{{> 'systems/l5r5e/templates/actors/npc/narrative.html' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user