Flesh out New Dice structure - Not complete

add structure for Hull, Shield, and Power Dice to allow for recharge, refitting, and regeneration.  Not complete.
This commit is contained in:
supervj 2021-05-20 03:45:18 -04:00
parent 0607152f51
commit cacc43740e
8 changed files with 546 additions and 88 deletions

View file

@ -197,7 +197,6 @@
"SW5E.ChatContextHalfDamage": "Apply Half Damage",
"SW5E.ChatContextHealing": "Apply Healing",
"SW5E.ChatFlavor": "Chat Message Flavor",
"SW5E.ClassCasterType": "Class Caster Type",
"SW5E.ClassLevels": "Class Levels",
"SW5E.ClassName": "Class Name",
"SW5E.ClassSkillsChosen": "Chosen Class Skills",
@ -497,6 +496,9 @@
"SW5E.HP": "Health",
"SW5E.HPFormula": "Health Formula",
"SW5E.HullDice": "Hull Dice",
"SW5E.HullDiceRoll": "Roll Hull Dice",
"SW5E.HullDiceUsed": "Hull Dice Used",
"SW5E.HullDiceWarn": "{name} has no available {formula} Hull Dice remaining!",
"SW5E.HullPoints": "Hull Points",
"SW5E.HullPointsFormula": "Hull Points Formula",
"SW5E.HyperdriveClass": "Hyperdrive Class",
@ -739,6 +741,7 @@
"SW5E.MovementFly": "Fly",
"SW5E.MovementHover": "Hover",
"SW5E.MovementRoll": "Roll",
"SW5E.MovementSpace": "Space Flight",
"SW5E.MovementSwim": "Swim",
"SW5E.MovementTurn": "Turning",
"SW5E.MovementUnits": "Units",
@ -796,7 +799,9 @@
"SW5E.PowerCreate": "Create Power",
"SW5E.PowerDC": "Power DC",
"SW5E.PowerDetails": "Power Details",
"SW5E.PowerDice": "Power Dice",
"SW5E.PowerDie": "Power Die",
"SW5E.PowerDiePl": "Power Dice",
"SW5E.PowerDieAlloc": "Power Die Allocation",
"SW5E.PowerDiceRecovery": "Power Dice Recovery",
"SW5E.PowerEffects": "Power Effects",
"SW5E.PowerLevel": "Power Level",
@ -846,7 +851,23 @@
"SW5E.Reaction": "Reaction",
"SW5E.ReactionPl": "Reactions",
"SW5E.Recharge": "Recharge",
"SW5E.RechargeRestHint": "Take a recharge rest? On a recharge rest you may spend remaining Hull Dice and recover Shields.",
"SW5E.RechargetRestNoHD": "No Hull Dice remaining",
"SW5E.RechargeRestNormal": "Recharge Rest (1 hour)",
"SW5E.RechargeRestOvernight": "Recharge Rest (New Day)",
"SW5E.RechargeRestResult": "{name} takes a recharge rest spending {dice} Hull Dice to recover {health} Hull Points.",
"SW5E.RechargeRestResultShort": "{name} takes a recharge rest.",
"SW5E.RechargeRestSelect": "Select Dice to Roll",
"SW5E.Refitting": "Refitting",
"SW5E.RefittingRest": "Refitting Rest",
"SW5E.RefittingRestEpic": "Refitting Rest (1 hour)",
"SW5E.RefittingRestGritty": "Refitting Rest (7 days)",
"SW5E.RefittingRestNormal": "Refitting Rest (8 hours)",
"SW5E.RefittingRestOvernight": "Refitting Rest (New Day)",
"SW5E.RefittingRestResult": "{name} takes a refitting rest.",
"SW5E.RefittingRestResultHD": "{name} takes a refitting rest and recovers {dice} Hull Dice.",
"SW5E.RefittingRestResultHP": "{name} takes a refitting rest and recovers {health} Hull Points.",
"SW5E.RefittingRestResultHPHD": "{name} takes a refitting rest and recovers {health} Hull Points and {dice} Hull Dice.",
"SW5E.RegenerationRateCoefficient": "Regeneration Rate Coefficient",
"SW5E.RequiredMaterials": "Required Materials",
"SW5E.Requirements": "Requirements",
@ -892,8 +913,12 @@
"SW5E.SheetClassNPCOld": "Old NPC Sheet",
"SW5E.SheetClassVehicle": "Default Vehicle Sheet",
"SW5E.ShieldDice": "Shield Dice",
"SW5E.ShieldDiceRoll": "Roll Shield Dice",
"SW5E.ShieldDiceUsed": "Shield Dice Used",
"SW5E.ShieldDiceWarn": "{name} has no available {formula} Shield Dice remaining!",
"SW5E.ShieldPoints": "Shield Points",
"SW5E.ShieldPointsFormula": "Shield Points Formula",
"SW5E.ShieldRegen": "Regen",
"SW5E.ShortRest": "Short Rest",
"SW5E.ShortRestEpic": "Short Rest (5 minutes)",
"SW5E.ShortRestGritty": "Short Rest (8 hours)",

View file

@ -317,13 +317,13 @@ export default class Actor5e extends Actor {
const data = actorData.data;
// Proficiency
data.attributes.prof = Math.floor((Math.max(data.details.tier, 1) + 7) / 4);
data.attributes.prof = Math.floor((Math.max(data.details.tier, 1) + 7) / 4);
// Link hull to hp and shields to temp hp
data.attributes.hull.value = data.attributes.hp.value;
data.attributes.hull.max = data.attributes.hp.max;
data.attributes.shld.value = data.attributes.hp.temp;
data.attributes.shld.max = data.attributes.hp.tempmax;
//data.attributes.hull.value = data.attributes.hp.value;
//data.attributes.hull.max = data.attributes.hp.max;
//data.attributes.shld.value = data.attributes.hp.temp;
//data.attributes.shld.max = data.attributes.hp.tempmax;
}
/* -------------------------------------------- */
@ -1147,6 +1147,196 @@ export default class Actor5e extends Actor {
/* -------------------------------------------- */
/**
* Roll a hull die of the appropriate type, gaining hull points equal to the die roll plus your CON modifier
* @param {string} [denomination] The hit denomination of hull die to roll. Example "d8".
* If no denomination is provided, the first available HD will be used
* @param {string} [numDice] How many damage dice to roll?
* @param {string} [keep] Which dice to keep? Example "kh1".
* @param {boolean} [dialog] Show a dialog prompt for configuring the hull die roll?
* @return {Promise<Roll|null>} The created Roll instance, or null if no hull die was rolled
*/
async rollHullDie(denomination, numDice="1", keep="",{dialog=true}={}) {
// If no denomination was provided, choose the first available
let sship = null;
if ( !denomination ) {
sship = this.itemTypes.class.find(s => s.data.data.hullDiceUsed < (s.data.data.tier + s.data.data.hullDiceStart));
if ( !sship ) return null;
denomination = sship.data.data.hullDice;
}
// Otherwise locate a starship (if any) which has an available hit die of the requested denomination
else {
sship = this.items.find(i => {
const d = i.data.data;
return (d.hullDice === denomination) && ((d.hitDiceUsed || 0) < ((d.tier || 0) + d.hullDiceStart));
});
}
// If no class is available, display an error notification
if ( !sship ) {
ui.notifications.error(game.i18n.format("SW5E.HullDiceWarn", {name: this.name, formula: denomination}));
return null;
}
// Prepare roll data
const parts = [`${numDice}${denomination}${keep}`, "@abilities.con.mod"];
const title = game.i18n.localize("SW5E.HullDiceRoll");
const rollData = duplicate(this.data.data);
// Call the roll helper utility
const roll = await damageRoll({
event: new Event("hitDie"),
parts: parts,
data: rollData,
title: title,
speaker: ChatMessage.getSpeaker({actor: this}),
allowcritical: false,
fastForward: !dialog,
dialogOptions: {width: 350},
messageData: {"flags.sw5e.roll": {type: "hullDie"}}
});
if ( !roll ) return null;
// Adjust actor data
await sship.update({"data.hullDiceUsed": sship.data.data.hullDiceUsed + 1});
const hp = this.data.data.attributes.hp;
const dhp = Math.min(hp.max - hp.value, roll.total);
await this.update({"data.attributes.hp.value": hp.value + dhp});
return roll;
}
/* -------------------------------------------- */
/**
* Roll a hull die of the appropriate type, gaining hull points equal to the die roll plus your CON modifier
* @return {Promise<Roll|null>} The created Roll instance, or null if no hull die was rolled
*/
async rollHullDieCheck() {
// If no denomination was provided, choose the first available
let sship = null;
if ( !denomination ) {
sship = this.itemTypes.class.find(s => s.data.data.hullDiceUsed < (s.data.data.tier + s.data.data.hullDiceStart));
if ( !sship ) return null;
denomination = sship.data.data.hullDice;
}
// Otherwise locate a starship (if any) which has an available hit die of the requested denomination
else {
sship = this.items.find(i => {
const d = i.data.data;
return (d.hullDice === denomination) && ((d.hitDiceUsed || 0) < ((d.tier || 0) + d.hullDiceStart));
});
}
// If no class is available, display an error notification
if ( !sship ) {
ui.notifications.error(game.i18n.format("SW5E.HullDiceWarn", {name: this.name, formula: denomination}));
return null;
}
// Prepare roll data
const parts = [`${numDice}${denomination}${keep}`, "@abilities.con.mod"];
const title = game.i18n.localize("SW5E.HullDiceRoll");
const rollData = duplicate(this.data.data);
// Call the roll helper utility
const roll = await damageRoll({
event: new Event("hitDie"),
parts: parts,
data: rollData,
title: title,
speaker: ChatMessage.getSpeaker({actor: this}),
allowcritical: false,
fastForward: !dialog,
dialogOptions: {width: 350},
messageData: {"flags.sw5e.roll": {type: "hullDie"}}
});
if ( !roll ) return null;
// Adjust actor data
await sship.update({"data.hullDiceUsed": sship.data.data.hullDiceUsed + 1});
const hp = this.data.data.attributes.hp;
const dhp = Math.min(hp.max - hp.value, roll.total);
await this.update({"data.attributes.hp.value": hp.value + dhp});
return roll;
}
/* -------------------------------------------- */
/**
* Roll a shield die of the appropriate type, gaining shield points equal to the die roll
* multiplied by the shield regeneration coefficient
* @param {string} [denomination] The denomination of shield die to roll. Example "d8".
* If no denomination is provided, the first available SD will be used
* @param {boolean} [natural] Natural ship shield regeneration (true) or user action (false)?
* @param {string} [numDice] How many damage dice to roll?
* @param {string} [keep] Which dice to keep? Example "kh1".
* @param {boolean} [dialog] Show a dialog prompt for configuring the shield die roll?
* @return {Promise<Roll|null>} The created Roll instance, or null if no shield die was rolled
*/
async rollShieldDie(denomination, natural=false, numDice="1", keep="", {dialog=true}={}) {
// If no denomination was provided, choose the first available
let sship = null;
if ( !denomination ) {
sship = this.itemTypes.class.find(s => s.data.data.shldDiceUsed < (s.data.data.tier + s.data.data.shldDiceStart));
if ( !sship ) return null;
denomination = sship.data.data.shldDice;
}
// Otherwise locate a starship (if any) which has an available hit die of the requested denomination
else {
sship = this.items.find(i => {
const d = i.data.data;
return (d.shldDice === denomination) && ((d.shldDiceUsed || 0) < ((d.tier || 0) + d.shldDiceStart));
});
}
// If no starship is available, display an error notification
if ( !sship ) {
ui.notifications.error(game.i18n.format("SW5E.ShldDiceWarn", {name: this.name, formula: denomination}));
return null;
}
// if natural regeneration roll max
if (natural) {
numdice = denomination.substring(1);
denomination = "";
keep = "";
}
// Prepare roll data
const parts = [`${numDice}${denomination}${keep} * @attributes.regenRate`];
const title = game.i18n.localize("SW5E.ShieldDiceRoll");
const rollData = duplicate(this.data.data);
// Call the roll helper utility
roll = await damageRoll({
event: new Event("shldDie"),
parts: parts,
data: rollData,
title: title,
speaker: ChatMessage.getSpeaker({actor: this}),
allowcritical: false,
fastForward: !dialog,
dialogOptions: {width: 350},
messageData: {"flags.sw5e.roll": {type: "shldDie"}}
});
if ( !roll ) return null;
// Adjust actor data
await sship.update({"data.shldDiceUsed": sship.data.data.shldDiceUsed + 1});
const hp = this.data.data.attributes.hp;
const dhp = Math.min(hp.tempmax - hp.temp, roll.total);
await this.update({"data.attributes.hp.temp": hp.temp + dhp});
return roll;
}
/* -------------------------------------------- */
/**
* Cause this Actor to take a Short Rest and regain all Tech Points
* During a Short Rest resources and limited item uses may be recovered

View file

@ -0,0 +1,117 @@
/**
* A helper Dialog subclass for rolling Hit Dice on a recharge rest
* @extends {Dialog}
*/
export default class RechargeRestDialog extends Dialog {
constructor(actor, dialogData={}, options={}) {
super(dialogData, options);
/**
* Store a reference to the Actor entity which is resting
* @type {Actor}
*/
this.actor = actor;
/**
* Track the most recently used HD denomination for re-rendering the form
* @type {string}
*/
this._denom = null;
}
/* -------------------------------------------- */
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
template: "systems/sw5e/templates/apps/recharge-rest.html",
classes: ["sw5e", "dialog"]
});
}
/* -------------------------------------------- */
/** @override */
getData() {
const data = super.getData();
// Determine Hull Dice
data.availableHD = this.actor.data.items.reduce((hd, item) => {
if ( item.type === "starship" ) {
const d = item.data;
const denom = d.hullDice || "d6";
const available = parseInt(d.hullDiceStart || 1) + parseInt(d.tier || 0) - parseInt(d.hullDiceUsed || 0);
hd[denom] = denom in hd ? hd[denom] + available : available;
}
return hd;
}, {});
data.canRoll = this.actor.data.data.attributes.hull.dice > 0;
data.denomination = this._denom;
// Determine rest type
const variant = game.settings.get("sw5e", "restVariant");
data.promptNewDay = variant !== "epic"; // It's never a new day when only resting 1 minute
data.newDay = false; // It may be a new day, but not by default
return data;
}
/* -------------------------------------------- */
/** @override */
activateListeners(html) {
super.activateListeners(html);
let btn = html.find("#roll-hulld");
btn.click(this._onRollHullDie.bind(this));
}
/* -------------------------------------------- */
/**
* Handle rolling a Hull Die as part of a Recharge Rest action
* @param {Event} event The triggering click event
* @private
*/
async _onRollHullDie(event) {
event.preventDefault();
const btn = event.currentTarget;
this._denom = btn.form.hulld.value;
await this.actor.rollHullDie(this._denom);
this.render();
}
/* -------------------------------------------- */
/**
* A helper constructor function which displays the Short Rest dialog and returns a Promise once it's workflow has
* been resolved.
* @param {Actor5e} actor
* @return {Promise}
*/
static async rechargeRestDialog({actor}={}) {
return new Promise((resolve, reject) => {
const dlg = new this(actor, {
title: "Recharge Rest",
buttons: {
rest: {
icon: '<i class="fas fa-bed"></i>',
label: "Rest",
callback: html => {
let newDay = false;
if (game.settings.get("sw5e", "restVariant") === "gritty")
newDay = html.find('input[name="newDay"]')[0].checked;
resolve(newDay);
}
},
cancel: {
icon: '<i class="fas fa-times"></i>',
label: "Cancel",
callback: reject
}
},
close: reject
});
dlg.render(true);
});
}
}

View file

@ -0,0 +1,69 @@
/**
* A helper Dialog subclass for completing a refitting rest
* @extends {Dialog}
*/
export default class RefittingRestDialog extends Dialog {
constructor(actor, dialogData = {}, options = {}) {
super(dialogData, options);
this.actor = actor;
}
/* -------------------------------------------- */
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
template: "systems/sw5e/templates/apps/refitting-rest.html",
classes: ["sw5e", "dialog"]
});
}
/* -------------------------------------------- */
/** @override */
getData() {
const data = super.getData();
const variant = game.settings.get("sw5e", "restVariant");
data.promptNewDay = variant !== "gritty"; // It's always a new day when resting 1 week
data.newDay = variant === "normal"; // It's probably a new day when resting normally (8 hours)
return data;
}
/* -------------------------------------------- */
/**
* A helper constructor function which displays the Refitting Rest confirmation dialog and returns a Promise once it's
* workflow has been resolved.
* @param {Actor5e} actor
* @return {Promise}
*/
static async refittingRestDialog({ actor } = {}) {
return new Promise((resolve, reject) => {
const dlg = new this(actor, {
title: "Refitting Rest",
buttons: {
rest: {
icon: '<i class="fas fa-bed"></i>',
label: "Rest",
callback: html => {
let newDay = false;
if (game.settings.get("sw5e", "restVariant") === "normal")
newDay = html.find('input[name="newDay"]')[0].checked;
else if(game.settings.get("sw5e", "restVariant") === "gritty")
newDay = true;
resolve(newDay);
}
},
cancel: {
icon: '<i class="fas fa-times"></i>',
label: "Cancel",
callback: reject
}
},
default: 'rest',
close: reject
});
dlg.render(true);
});
}
}

View file

@ -417,6 +417,26 @@
"failure": 0,
"success": 0
},
"deployment": {
"coord": {
"uuid": null
},
"gunner": {
"uuid": null
},
"mechanic": {
"uuid": null
},
"operator": {
"uuid": null
},
"pilot": {
"uuid": null
},
"technician": {
"uuid": null
}
},
"dr": 0,
"engpow": 1,
"exhaustion": 0,
@ -424,6 +444,7 @@
"hull": {
"die": "",
"dice": 0,
"dicemax": 0,
"formula":"",
"value": null,
"max": null
@ -433,7 +454,7 @@
"max": 10
},
"pwrdice": {
"pwrdie": "",
"die": "",
"recovery": 1,
"central": {
"value": 0,
@ -463,7 +484,11 @@
"shld": {
"die": "",
"dice": 0,
"dicemax": 0,
"depleted": false,
"formula":"",
"regenRate": 1,
"capMod": 1,
"value": null,
"max": null
},
@ -501,7 +526,7 @@
"value": 0,
"ability": "cha"
},
"int": {
"inf": {
"value": 0,
"ability": "cha"
},

View file

@ -14,14 +14,8 @@
</div>
<div class="summary">
<!-- <input type="text" name="data.traits.size" value="{{data.traits.size}}"
placeholder="{{lookup config.actorSizes data.traits.size}}" style="text-transform: capitalize;" /> -->
<span class="summary-input" style="text-transform: capitalize;font-family: 'Russo One';display: inline; height: auto; font-size: 17px; font-weight: 400; letter-spacing: 0.5px; line-height: 24px; color: #4f4f4f;">{{lookup config.actorSizes data.traits.size}}</span>
<!-- <input type="text" name="data.details.role" value="{{data.details.role}}"
placeholder="{{ localize 'SW5E.Role' }}" /> -->
<span class="summary-input" style="text-transform: capitalize;font-family: 'Russo One';display: inline; height: auto; font-size: 17px; font-weight: 400; letter-spacing: 0.5px; line-height: 24px; color: #4f4f4f;">{{lookup config.starshipRolessm data.details.role}}</span>
<input type="text" name="data.details.source" value="{{data.details.source}}"
placeholder="{{ localize 'SW5E.Source' }}" />
<input type="text" name="data.details.source" value="{{data.details.source}}" placeholder="{{ localize 'SW5E.Source' }}" />
</div>
<div class="attributes">
{{!-- ARMOR CLASS --}}
@ -31,10 +25,11 @@
<input class="ac-display" name="data.attributes.ac.value" type="text"
value="{{data.attributes.ac.value}}" data-dtype="Number" placeholder="10" />
</div>
<footer class="attribute-footer proficiency">
{{ localize "SW5E.Proficiency" }}
{{numberFormat data.attributes.prof decimals=0 sign=true}}
</footer>
<footer class="attribute-footer hit-dice" style="grid-template-columns: 1fr 1fr 1fr; column-gap: 4px;">
<button type="button" class="rest short-rest">{{ localize "SW5E.Recharge" }}</button>
<button type="button" class="rest long-rest">{{ localize "SW5E.Refitting" }}</button>
<button type="button" class="rest long-rest">{{ localize "SW5E.ShieldRegen" }}</button>
</footer>
</section>
{{!-- HULL POINTS --}}
@ -42,14 +37,15 @@
<h1 class="attribute-name rollable">{{ localize "SW5E.HullPoints" }}</h1>
<div class="attribute-value multiple">
<input name="data.attributes.hp.value" type="text" value="{{data.attributes.hp.value}}"
data-dtype="Number" placeholder="0" class="value-number" />
data-dtype="Number" class="value-number" />
<span class="value-separator">/</span>
<input name="data.attributes.hp.max" type="text" value="{{data.attributes.hp.max}}"
data-dtype="Number" placeholder="0" class="value-number" />
data-dtype="Number" class="value-number" />
</div>
<footer class="attribute-footer hit-points">
<input name="data.attributes.hull.formula" class="hpformula" type="text"
placeholder="{{ localize 'SW5E.HullPointsFormula' }}" value="{{data.attributes.hull.formula}}" style="min-width: 150px;" />
<footer class="attribute-footer" style="line-height: 12px; height: 12px; text-align: center; font-family: 'Russo One';">
<!-- <input name="data.attributes.hull.formula" class="hpformula" type="text"
placeholder="{{ localize 'SW5E.HullPointsFormula' }}" value="{{data.attributes.hull.formula}}" style="min-width: 150px;" /> -->
<strong>{{localize "SW5E.HullDice"}}:</strong> {{data.attributes.hull.dice}}{{data.attributes.hull.die}}
</footer>
</section>
@ -63,14 +59,13 @@
<input name="data.attributes.hp.tempmax" type="text" value="{{data.attributes.hp.tempmax}}"
data-dtype="Number" placeholder="0" class="value-number" />
</div>
<footer class="attribute-footer hit-points">
<input name="data.attributes.shld.Formula" class="hpformula" type="text"
placeholder="{{ localize 'SW5E.ShieldPointsFormula' }}" value="{{data.attributes.shld.formula}}" style="min-width: 150px;" />
<footer class="attribute-footer" style="line-height: 12px; height: 12px; text-align: center; font-family: 'Russo One';">
<!-- <input name="data.attributes.shld.formula" class="hpformula" type="text"
placeholder="{{ localize 'SW5E.ShieldPointsFormula' }}" value="{{data.attributes.shld.formula}}" style="min-width: 150px;" /> -->
<strong>{{localize "SW5E.ShieldDice"}}: </strong> {{data.attributes.shld.dice}}{{data.attributes.shld.die}}
</footer>
</section>
{{!-- SPEED / MOVEMENT TYPES --}}
<section style="box-sizing: border-box; width: 150px;">
<h1>{{ localize "SW5E.Movement" }}
<a class="config-button" data-action="movement" title="{{localize 'SW5E.MovementConfig'}}"><i class="fas fa-cog"></i></a>
@ -94,7 +89,7 @@
<button class="item" data-tab="effects">{{ localize "SW5E.Effects" }}</button>
</nav>
{{!-- Starship Sheet Body --}}
{{!-- NPC Sheet Body --}}
<section class="sheet-body">
<section class="tab attributes core" data-group="primary" data-tab="attributes">
<section class="panel abilities">
@ -145,7 +140,7 @@
<section class="panel resources">
<h1>Resources and Traits</h1>
<div class="traits">
<label>
<!-- <label>
{{localize "SW5E.Size"}}
<select class="actor-size" name="data.traits.size">
{{#select data.traits.size}}
@ -161,75 +156,30 @@
<select class="actor-size" name="data.details.role">
{{#select data.details.role}}
<option value=""> </option>
{{#if isTiny}}
{{#each config.starshipRolestiny as |label role|}}
<option value="{{role}}">{{label}}</option>
{{/each}}
{{/if}}
{{#if isSmall}}
{{#each config.starshipRolessm as |label role|}}
<option value="{{role}}">{{label}}</option>
{{/each}}
{{/if}}
{{#if isMedium}}
{{#each config.starshipRolesmed as |label role|}}
<option value="{{role}}">{{label}}</option>
{{/each}}
{{/if}}
{{#if isLarge}}
{{#each config.starshipRoleslg as |label role|}}
<option value="{{role}}">{{label}}</option>
{{/each}}
{{/if}}
{{#if isHuge}}
{{#each config.starshipRoleshuge as |label role|}}
<option value="{{role}}">{{label}}</option>
{{/each}}
{{/if}}
{{#if isGargantuan}}
{{#each config.starshipRolesgrg as |label role|}}
<option value="{{role}}">{{label}}</option>
{{/each}}
{{/if}}
{{#each config.starshipRolessm as |label role|}}
<option value="{{role}}">{{label}}</option>
{{/each}}
{{/select}}
</select>
</label>
<br />
<label>
{{localize "SW5E.HullDice"}}: <input class="hpformula" style="max-width:50px;" name="data.attributes.hd" value="{{data.attributes.hd}}" placeholder="{{data.attributes.hd}}" />
</label>
<label>
{{localize "SW5E.ShieldDice"}}: <input class="hpformula" style="max-width:50px;" name="data.attributes.sd" value="{{data.attributes.sd}}" placeholder="{{data.attributes.sd}}" />
</label>
<label>
{{localize "SW5E.PowerDice"}}:
<select class="actor-size" name="data.attributes.pd">
{{#select data.attributes.pd}}
<option value=""> </option>
{{#each config.powerDieTypes as |pd|}}
<option value="{{pd}}">{{pd}}</option>
{{/each}}
{{/select}}
</select>
</label>
<br />
<br /> -->
<label>
{{localize "SW5E.DmgRed"}}: <input class="hpformula" style="max-width:30px;" name="data.attributes.dr" value="{{data.attributes.dr}}" placeholder="0" />
</label>
<label>
{{localize "SW5E.VehicleCargoCapacity"}}: <input class="hpformula" style="max-width:60px;" name="data.attributes.cargcap" value="{{data.attributes.cargcap}}" placeholder="0" /> tons
{{localize "SW5E.VehicleCargoCapacity"}}: {{data.attributes.cargcap}} tons
</label>
<br />
<label>
{{localize "SW5E.CrewCap"}}: <input class="hpformula" style="max-width:60px;" name="data.attributes.crewcap" value="{{data.attributes.crewcap}}" placeholder="0" />
{{localize "SW5E.CrewCap"}}: {{data.attributes.crewcap}}
</label>
<br />
<label>
<!-- <label>
{{localize "SW5E.CentStorageCapacity"}}: <input class="hpformula" style="max-width:30px;" name="data.attributes.cscap" value="{{data.attributes.cscap}}" placeholder="0" />
</label>
<label>
{{localize "SW5E.SysStorageCapacity"}}: <input class="hpformula" style="max-width:30px;" name="data.attributes.sscap" value="{{data.attributes.sscap}}" placeholder="0" />
</label>
</label> -->
</div>
<h1>{{localize "SW5E.PowerRouting"}}</h1>
<div class="traits">
@ -263,6 +213,30 @@
{{/select}}
</select>
</label>
<br />
<table style="border: none; width: 400px;">
<tr><th colspan=3 align="left">{{localize "SW5E.PowerDieAlloc"}}</th><th colspan=3 align="right">
{{localize "SW5E.PowerDie"}}:
<select class="actor-size" name="data.attributes.pd">
{{#select data.attributes.pd}}
<option value=""> </option>
{{#each config.powerDieTypes as |pd|}}
<option value="{{pd}}">{{pd}}</option>
{{/each}}
{{/select}}
</select></th>
</tr>
<tr><th style="border-top: 2px solid #0d99cc; border-left: 2px solid #0d99cc; border-right: 2px solid #0d99cc;">Central</th><th style="border-top: 2px solid #0d99cc; border-left: 2px solid #0d99cc; border-right: 2px solid #0d99cc;">Comms</th><th style="border-top: 2px solid #0d99cc; border-left: 2px solid #0d99cc; border-right: 2px solid #0d99cc;">Engines</th><th style="border-top: 2px solid #0d99cc; border-left: 2px solid #0d99cc; border-right: 2px solid #0d99cc;">Sensors</th><th style="border-top: 2px solid #0d99cc; border-left: 2px solid #0d99cc; border-right: 2px solid #0d99cc;">Shields</th><th style="border-top: 2px solid #0d99cc; border-left: 2px solid #0d99cc; border-right: 2px solid #0d99cc;">Weapons</th>
<tr>
<td style="border-bottom: 2px solid #0d99cc; border-left: 2px solid #0d99cc; border-right: 2px solid #0d99cc;"><input class="hpformula" style="max-width:25px;" name="data.attributes.pwrdice.central.value" value="{{data.attributes.pwrdice.central.value}}" placeholder="{{data.attributes.pwrdice.central.value}}" /> / {{data.attributes.cscap}}</td>
<td style="border-bottom: 2px solid #0d99cc; border-left: 2px solid #0d99cc; border-right: 2px solid #0d99cc;"><input class="hpformula" style="max-width:25px;" name="data.attributes.pwrdice.comms.value" value="{{data.attributes.pwrdice.comms.value}}" placeholder="{{data.attributes.pwrdice.comms.value}}" /> / {{data.attributes.sscap}}</td>
<td style="border-bottom: 2px solid #0d99cc; border-left: 2px solid #0d99cc; border-right: 2px solid #0d99cc;"><input class="hpformula" style="max-width:25px;" name="data.attributes.pwrdice.engines.value" value="{{data.attributes.pwrdice.engines.value}}" placeholder="{{data.attributes.pwrdice.engines.value}}" /> / {{data.attributes.sscap}}</td>
<td style="border-bottom: 2px solid #0d99cc; border-left: 2px solid #0d99cc; border-right: 2px solid #0d99cc;"><input class="hpformula" style="max-width:25px;" name="data.attributes.pwrdice.sensors.value" value="{{data.attributes.pwrdice.sensors.value}}" placeholder="{{data.attributes.pwrdice.sensors.value}}" /> / {{data.attributes.sscap}}</td>
<td style="border-bottom: 2px solid #0d99cc; border-left: 2px solid #0d99cc; border-right: 2px solid #0d99cc;"><input class="hpformula" style="max-width:25px;" name="data.attributes.pwrdice.shields.value" value="{{data.attributes.pwrdice.shields.value}}" placeholder="{{data.attributes.pwrdice.shields.value}}" /> / {{data.attributes.sscap}}</td>
<td style="border-bottom: 2px solid #0d99cc; border-left: 2px solid #0d99cc; border-right: 2px solid #0d99cc;"><input class="hpformula" style="max-width:25px;" name="data.attributes.pwrdice.weapons.value" value="{{data.attributes.pwrdice.weapons.value}}" placeholder="{{data.attributes.pwrdice.weapons.value}}" /> / {{data.attributes.sscap}}</td>
</tr>
</table>
</label>
</div>
<section class="counters" style="border: none; margin: 8px 0; display: grid; grid-template-columns: repeat(2, 1fr);">
<div class="counter">
@ -290,14 +264,14 @@
<h1>{{localize "SW5E.StarshipmodPl"}}</h1>
<div class="traits">
<label>
{{localize "SW5E.ModCap"}}: <input class="hpformula" style="max-width:30px;" name="data.attributes.mods.open" value="{{data.attributes.mods.open}}" placeholder="10" />/<input class="hpformula" style="max-width:30px;" name="data.attributes.mods.max" value="{{data.attributes.mods.max}}" placeholder="10" />
{{localize "SW5E.ModCap"}}: <input class="hpformula" style="max-width:30px;" name="data.attributes.mods.open" value="{{data.attributes.mods.open}}" placeholder="10" />/ {{data.attributes.mods.max}}
</label>
<label>
{{localize "SW5E.SuiteCap"}}: <input class="hpformula" style="max-width:30px;" name="data.attributes.suites.open" value="{{data.attributes.suites.open}}" placeholder="0" />/<input class="hpformula" style="max-width:30px;" name="data.attributes.suites.max" value="{{data.attributes.suites.max}}" placeholder="0" />
{{localize "SW5E.SuiteCap"}}: <input class="hpformula" style="max-width:30px;" name="data.attributes.suites.open" value="{{data.attributes.suites.open}}" placeholder="0" />/ {{data.attributes.suites.max}}
</label>
<br />
<label>
{{localize "SW5E.HardpointSizeMod"}}: <input class="hpformula" style="max-width:30px;" name="data.attributes.hsm" value="{{data.attributes.hsm}}" placeholder="0" />
{{localize "SW5E.HardpointSizeMod"}}: {{data.attributes.hsm}}
</label>
</div>
</section>

View file

@ -0,0 +1,38 @@
<form id="recharge-rest-hd" class="dialog-content" onsubmit="event.preventDefault();">
<p>{{ localize "SW5E.RechargeRestHint" }}</p>
<div class="form-group">
<label>{{ localize "SW5E.RechargeRestSelect" }}</label>
<div class="form-fields">
<select name="hd">
{{#select denomination}}
{{#each availableHD as |num denom|}}
<option value="{{denom}}">{{denom}} ({{num}} {{ localize "SW5E.available" }})</option>
{{/each}}
{{/select}}
</select>
<button id="roll-hulld" {{#unless canRoll}}disabled{{/unless}}>
<i class="fas fa-dice-d20"></i> {{ localize "Roll" }}
</button>
</div>
{{#unless canRoll}}
<p class="notes">{{ localize "SW5E.RechargeRestNoHullD" }}</p>
{{/unless}}
</div>
{{#if promptNewDay}}
<div class="form-group">
<label>Is New Day?</label>
<input type="checkbox" name="newDay" {{checked newDay}}/>
<p class="hint">Recover limited use abilities which recharge "per day"?</p>
</div>
{{/if}}
<div class="dialog-buttons">
{{#each buttons as |button id|}}
<button class="dialog-button" data-button="{{id}}">
{{{button.icon}}}
{{{button.label}}}
</button>
{{/each}}
</div>
</form>

View file

@ -0,0 +1,20 @@
<form id="refitting-rest" class="dialog-content" onsubmit="event.preventDefault();">
<p>Take a refitting rest? On a refitting rest you will recover hull points, your hull dice, and shields.</p>
{{#if promptNewDay}}
<div class="form-group">
<label>Is New Day?</label>
<input type="checkbox" name="newDay" {{checked newDay}}/>
<p class="hint">Recover limited use abilities which recharge "per day"?</p>
</div>
{{/if}}
<div class="dialog-buttons">
{{#each buttons as |button id|}}
<button class="dialog-button" data-button="{{id}}">
{{{button.icon}}}
{{{button.label}}}
</button>
{{/each}}
</div>
</form>