Skip to content

Commit

Permalink
Merge pull request dmdorman#1620 from phBalance/phBalance/generic-rol…
Browse files Browse the repository at this point in the history
…ler-cleanup

Add 1d6-1 roller
  • Loading branch information
phBalance authored Dec 14, 2024
2 parents 6fc01f2 + 0d60cf7 commit 3f46875
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 28 deletions.
3 changes: 1 addition & 2 deletions module/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7113,11 +7113,10 @@ function addPower(powerDescription6e, powerOverrideFor5e) {
{},
);

//NOTELEPORT
addPower(
{
key: "NOTELEPORT",
costPerLevel: 0.25, //costPerLevelFixedValue(0),
costPerLevel: costPerLevelFixedValue(1 / 4),
xml: ` <MODIFIER XMLID="NOTELEPORT" ID="1733613873292" BASECOST="0.0" LEVELS="1" ALIAS="Cannot Be Escaped With Teleportation" POSITION="-1" MULTIPLIER="1.0" GRAPHIC="Burst" COLOR="255 255 255" SFX="Default" SHOW_ACTIVE_COST="Yes" INCLUDE_NOTES_IN_PRINTOUT="Yes" NAME="" COMMENTS="" PRIVATE="No" FORCEALLOW="No"></MODIFIER>`,
},
{},
Expand Down
14 changes: 8 additions & 6 deletions module/herosystem6e.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -805,12 +805,12 @@ Hooks.on("renderSidebarTab", async (app, html) => {

if (!game.settings.get(HEROSYS.module, "ShowGenericRoller")) return;

let $chat_form = html.find("#chat-form");
const $chat_form = html.find("#chat-form");
const content = await renderTemplate(`systems/${HEROSYS.module}/templates/system/heroRoll-panel.hbs`);
if (content.length === 0) return;

// Add template to chat
let $content = $(content);
const $content = $(content);
$chat_form.after($content);

$content.find("button").on("click", async (event) => {
Expand Down Expand Up @@ -861,7 +861,7 @@ Hooks.on("renderSidebarTab", async (app, html) => {
dice: 1,
dicePlus: {
groupName: "dicePlus",
choices: { ZERO: "0", PLUSHALFDIE: "Plus Half Die", PLUSONEPIP: "Plus One Pip" },
choices: { ZERO: "0", PLUSHALFDIE: "+½d6", PLUSONEPIP: "+1", PLUSDIEMINUSONE: "+1d6-1" },
chosen: "ZERO",
},
damageType: {
Expand Down Expand Up @@ -894,14 +894,16 @@ Hooks.on("renderSidebarTab", async (app, html) => {
//Attacker’s OCV + 11 - 3d6 = the DCV the attacker can hit
const heroRoller = new CONFIG.HERO.heroDice.HeroRoller()
.addDice(options.dice, "DICE")
.addHalfDice(options.dicePlus === "PLUSHALFDIE" ? 1 : 0, "PLUSHALFDIE")
.addDiceMinus1(options.dicePlus === "PLUSDIEMINUSONE" ? 1 : 0, "PLUSDIEMINUSONE")
.addNumber(options.dicePlus === "PLUSONEPIP" ? 1 : 0, "PLUSONEPIP")

.makeNormalRoll(options.damageType === "NORMAL")
.makeKillingRoll(options.damageType === "KILLING")
.makeAdjustmentRoll(options.damageType === "ADJUSTMENT")
.makeEntangleRoll(options.damageType === "ENTANGLE")
.makeFlashRoll(options.damageType === "FLASH")
.makeEffectRoll(options.damageType === "EFFECT")
.addDice(options.dicePlus === "PLUSHALFDIE" ? 0.5 : 0, "PLUSHALFDIE")
.addNumber(options.dicePlus === "PLUSONEPIP" ? 1 : 0, "PLUSONEPIP");
.makeEffectRoll(options.damageType === "EFFECT");

await heroRoller.roll();

Expand Down
20 changes: 10 additions & 10 deletions module/utility/dice.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -394,25 +394,25 @@ export class HeroRoller {
return this;
}

addHalfDice(numDice, description) {
if (!numDice) {
addHalfDice(numHalfDice, description) {
if (!numHalfDice) {
return this;
}

numDice = this.#prefixFormula(numDice);
numHalfDice = this.#prefixFormula(numHalfDice);

this._formulaTerms.push(
new Die({
faces: 6,
number: numDice,
number: numHalfDice,
options: {
_hrQualifier: HeroRoller.QUALIFIER.HALF_DIE,
flavor: description,
_hrTag: !description
? undefined
: {
name: description,
value: numDice,
value: numHalfDice,
},
},
}),
Expand All @@ -421,25 +421,25 @@ export class HeroRoller {
return this;
}

addDiceMinus1(numDice, description) {
if (!numDice) {
addDiceMinus1(numDiceMinusOne, description) {
if (!numDiceMinusOne) {
return this;
}

numDice = this.#prefixFormula(numDice);
numDiceMinusOne = this.#prefixFormula(numDiceMinusOne);

this._formulaTerms.push(
new Die({
faces: 6,
number: numDice,
number: numDiceMinusOne,
options: {
_hrQualifier: HeroRoller.QUALIFIER.FULL_DIE_LESS_ONE,
flavor: description,
_hrTag: !description
? undefined
: {
name: description,
value: numDice,
value: numDiceMinusOne,
},
},
}),
Expand Down
20 changes: 10 additions & 10 deletions scss/components/hero-roll-panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ section.hero-roll-panel {
flex: 0;
border: 1px;
padding: 0 5px;
}

section.hero-roll-panel button {
display: flex;
flex-direction: row;
background: rgb(70 130 180);
border: 1px solid #000;
box-shadow: 0 0 6px inset rgb(141 158 167);
align-items: center;
justify-content: center;
color: rgb(255 255 255);
button {
display: flex;
flex-direction: row;
background: rgb(70 130 180);
border: 1px solid #000;
box-shadow: 0 0 6px inset rgb(141 158 167);
align-items: center;
justify-content: center;
color: rgb(255 255 255);
}
}

0 comments on commit 3f46875

Please sign in to comment.