Initiative : Ring now limit the success
This commit is contained in:
@@ -105,9 +105,9 @@ export class CombatL5r5e extends Combat {
|
||||
|
||||
// if the character succeeded on their Initiative check, they add 1 to their base initiative value,
|
||||
// plus an additional amount equal to their bonus successes.
|
||||
if (roll.l5r5e.summary.success >= roll.l5r5e.summary.difficulty) {
|
||||
initiative =
|
||||
initiative + 1 + Math.max(roll.l5r5e.summary.success - roll.l5r5e.summary.difficulty, 0);
|
||||
const successes = Math.min(roll.l5r5e.summary.ringsUsed, roll.l5r5e.summary.success);
|
||||
if (successes >= roll.l5r5e.summary.difficulty) {
|
||||
initiative = initiative + 1 + Math.max(successes - roll.l5r5e.summary.difficulty, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
import { L5rBaseDie } from "./dietype/l5r-base-die.js";
|
||||
import { ActorL5r5e } from "../actor.js";
|
||||
|
||||
/**
|
||||
* Roll for L5R5e
|
||||
*/
|
||||
@@ -24,6 +21,7 @@ export class RollL5r5e extends Roll {
|
||||
difficulty: 2,
|
||||
difficultyHidden: false,
|
||||
voidPointUsed: false,
|
||||
ringsUsed: 0,
|
||||
success: 0,
|
||||
explosive: 0,
|
||||
opportunity: 0,
|
||||
@@ -79,8 +77,14 @@ export class RollL5r5e extends Roll {
|
||||
|
||||
// Store final outputs
|
||||
this._rolled = true;
|
||||
this.l5r5e.dicesTypes.std = this.dice.some((term) => term instanceof DiceTerm && !(term instanceof L5rBaseDie)); // ignore math symbols
|
||||
this.l5r5e.dicesTypes.l5r = this.dice.some((term) => term instanceof L5rBaseDie);
|
||||
this.l5r5e.dicesTypes.std = this.dice.some(
|
||||
(term) => term instanceof DiceTerm && !(term instanceof game.l5r5e.L5rBaseDie)
|
||||
); // ignore math symbols
|
||||
this.l5r5e.dicesTypes.l5r = this.dice.some((term) => term instanceof game.l5r5e.L5rBaseDie);
|
||||
this.l5r5e.summary.ringsUsed = this.dice.reduce(
|
||||
(acc, term) => (term instanceof game.l5r5e.RingDie ? acc + term.number : acc),
|
||||
0
|
||||
);
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -92,7 +96,7 @@ export class RollL5r5e extends Roll {
|
||||
* @private
|
||||
*/
|
||||
_l5rSummary(term) {
|
||||
if (!(term instanceof L5rBaseDie)) {
|
||||
if (!(term instanceof game.l5r5e.L5rBaseDie)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -140,7 +144,7 @@ export class RollL5r5e extends Roll {
|
||||
getTooltip(contexte = null) {
|
||||
const parts = this.dice.map((term) => {
|
||||
const cls = term.constructor;
|
||||
const isL5rDie = term instanceof L5rBaseDie;
|
||||
const isL5rDie = term instanceof game.l5r5e.L5rBaseDie;
|
||||
|
||||
return {
|
||||
formula: term.formula,
|
||||
@@ -223,7 +227,7 @@ export class RollL5r5e extends Roll {
|
||||
canRnK: canRnK,
|
||||
dices: this.dice.map((d) => {
|
||||
return {
|
||||
diceTypeL5r: d instanceof L5rBaseDie,
|
||||
diceTypeL5r: d instanceof game.l5r5e.L5rBaseDie,
|
||||
rolls: d.results.map((r) => {
|
||||
return {
|
||||
result: d.constructor.getResultLabel(r.result),
|
||||
@@ -290,7 +294,7 @@ export class RollL5r5e extends Roll {
|
||||
roll.l5r5e = duplicate(data.l5r5e);
|
||||
|
||||
// get real Actor object
|
||||
if (data.l5r5e.actor && !(data.l5r5e.actor instanceof ActorL5r5e)) {
|
||||
if (data.l5r5e.actor && !(data.l5r5e.actor instanceof game.l5r5e.ActorL5r5e)) {
|
||||
const actor = game.actors.get(data.l5r5e.actor.id);
|
||||
if (actor) {
|
||||
roll.l5r5e.actor = actor;
|
||||
|
||||
@@ -11,6 +11,7 @@ import { ActorL5r5e } from "./actor.js";
|
||||
import { CharacterSheetL5r5e } from "./actors/character-sheet.js";
|
||||
import { NpcSheetL5r5e } from "./actors/npc-sheet.js";
|
||||
// Dice and rolls
|
||||
import { L5rBaseDie } from "./dice/dietype/l5r-base-die.js";
|
||||
import { AbilityDie } from "./dice/dietype/ability-die.js";
|
||||
import { RingDie } from "./dice/dietype/ring-die.js";
|
||||
import { RollL5r5e } from "./dice/roll.js";
|
||||
@@ -67,6 +68,7 @@ Hooks.once("init", async function () {
|
||||
|
||||
// Add some classes in game
|
||||
game.l5r5e = {
|
||||
L5rBaseDie,
|
||||
RingDie,
|
||||
AbilityDie,
|
||||
HelpersL5r5e,
|
||||
@@ -74,6 +76,7 @@ Hooks.once("init", async function () {
|
||||
DicePickerDialog,
|
||||
RollnKeepDialog,
|
||||
GmToolsDialog,
|
||||
ActorL5r5e,
|
||||
HelpDialog,
|
||||
sockets: new SocketHandlerL5r5e(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user