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