Some automatisations on advancements
Added xp cost for technique
This commit is contained in:
@@ -250,6 +250,7 @@
|
|||||||
"title": "Advancements",
|
"title": "Advancements",
|
||||||
"title_new": "New advancement",
|
"title_new": "New advancement",
|
||||||
"total": "Total",
|
"total": "Total",
|
||||||
|
"cost": "Cost",
|
||||||
"spent": "Used",
|
"spent": "Used",
|
||||||
"saved": "Saved",
|
"saved": "Saved",
|
||||||
"rank": "Rank Total Xp",
|
"rank": "Rank Total Xp",
|
||||||
|
|||||||
@@ -250,6 +250,7 @@
|
|||||||
"title": "Advancements",
|
"title": "Advancements",
|
||||||
"title_new": "New advancement",
|
"title_new": "New advancement",
|
||||||
"total": "Total",
|
"total": "Total",
|
||||||
|
"cost": "Cost",
|
||||||
"spent": "Usada",
|
"spent": "Usada",
|
||||||
"saved": "Restante",
|
"saved": "Restante",
|
||||||
"rank": "Rank Total Xp",
|
"rank": "Rank Total Xp",
|
||||||
|
|||||||
@@ -250,6 +250,7 @@
|
|||||||
"title": "Progressions",
|
"title": "Progressions",
|
||||||
"title_new": "Nouvelle progression",
|
"title_new": "Nouvelle progression",
|
||||||
"total": "Totale",
|
"total": "Totale",
|
||||||
|
"cost": "Coût",
|
||||||
"spent": "Dépensée",
|
"spent": "Dépensée",
|
||||||
"saved": "Restante",
|
"saved": "Restante",
|
||||||
"total_xp_rank": "Xp Total du rang",
|
"total_xp_rank": "Xp Total du rang",
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"I18N.MAINTAINERS": [ "Innocenti" ],
|
|
||||||
|
|
||||||
"HEXA.COLOR": "Digite uma cor hexadecimal (ex. #FFFFFF).",
|
|
||||||
"IC.BG.COLOR": "IC Cor de Fundo",
|
|
||||||
"IC.TEXT.COLOR": "IC Cor do Texto",
|
|
||||||
"EMOTE.BG.COLOR": "Cor de fundo do Emote",
|
|
||||||
"EMOTE.TEXT.COLOR": "Cor de texto do Emote",
|
|
||||||
"ROLL.BG.COLOR": "Cor de fundo das Rolagens",
|
|
||||||
"ROLL.TEXT.COLOR": "Cor de texto das Rolagens",
|
|
||||||
"OTHER.BG.COLOR": "Outra Cor de Fundo",
|
|
||||||
"OTHER.TEXT.COLOR": "Outra Cor de Texto",
|
|
||||||
"DEF.CHAT.PREF": "Prefixo padrão do bate-papo",
|
|
||||||
"SPE.CHAT.PREF": "Se especificada, essa sequência será prefixada para todas as mensagens de bate-papo que ainda não são comandos (como / emote.)"
|
|
||||||
}
|
|
||||||
@@ -199,8 +199,9 @@ export class BaseSheetL5r5e extends ActorSheet {
|
|||||||
});
|
});
|
||||||
const item = this.actor.getOwnedItem(created._id);
|
const item = this.actor.getOwnedItem(created._id);
|
||||||
|
|
||||||
// assign current school rank to the new tech
|
// assign current school rank to the new adv/tech
|
||||||
if (item.data.type === "advancement") {
|
if (["advancement", "technique"].includes(item.data.type)) {
|
||||||
|
item.data.data.rank = this.actor.data.data.identity.school_rank;
|
||||||
item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank;
|
item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,6 +231,25 @@ export class BaseSheetL5r5e extends ActorSheet {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Specific advancements, remove 1 to selected ring/skill
|
||||||
|
if (tmpItem.type === "advancement") {
|
||||||
|
const actor = duplicate(this.actor.data.data);
|
||||||
|
const itmData = tmpItem.data.data;
|
||||||
|
if (itmData.advancement_type === "ring") {
|
||||||
|
// Ring
|
||||||
|
actor.rings[itmData.ring] = Math.max(1, actor.rings[itmData.ring] - 1);
|
||||||
|
} else {
|
||||||
|
// Skill
|
||||||
|
const skillCatId = CONFIG.l5r5e.skills.get(itmData.skill);
|
||||||
|
actor.skills[skillCatId][itmData.skill] = Math.max(0, actor.skills[skillCatId][itmData.skill] - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update Actor
|
||||||
|
this.actor.update({
|
||||||
|
data: diffObject(this.actor.data.data, actor),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return this.actor.deleteOwnedItem(itemId);
|
return this.actor.deleteOwnedItem(itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export class CharacterSheetL5r5e extends BaseSheetL5r5e {
|
|||||||
sheetData.data.xp_spent_rank = totalXp.rank;
|
sheetData.data.xp_spent_rank = totalXp.rank;
|
||||||
sheetData.data.xp_spent = totalXp.total;
|
sheetData.data.xp_spent = totalXp.total;
|
||||||
sheetData.data.xp_saved = sheetData.data.xp_total - sheetData.data.xp_spent;
|
sheetData.data.xp_saved = sheetData.data.xp_total - sheetData.data.xp_spent;
|
||||||
sheetData.data.xp_goal = CONFIG.l5r5e.xpPerRank[this.actor.data.data.identity.school_rank - 1] || null;
|
sheetData.data.xp_goal = CONFIG.l5r5e.xp.costPerRank[this.actor.data.data.identity.school_rank - 1] || null;
|
||||||
|
|
||||||
return sheetData;
|
return sheetData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ export class TwentyQuestionsDialog extends FormApplication {
|
|||||||
}
|
}
|
||||||
const stepKey = $(event.target).data("step");
|
const stepKey = $(event.target).data("step");
|
||||||
if (!stepKey) {
|
if (!stepKey) {
|
||||||
console.log("event stepKey is undefined");
|
console.warn("event stepKey is undefined");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ export class TwentyQuestionsDialog extends FormApplication {
|
|||||||
(type !== "item" && item.data.type !== type) ||
|
(type !== "item" && item.data.type !== type) ||
|
||||||
(type === "item" && !["item", "weapon", "armor"].includes(item.data.type))
|
(type === "item" && !["item", "weapon", "armor"].includes(item.data.type))
|
||||||
) {
|
) {
|
||||||
console.log("forbidden item for this drop zone", type, item.data.type);
|
console.warn("forbidden item for this drop zone", type, item.data.type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Add the item (step and cache)
|
// Add the item (step and cache)
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ export class TwentyQuestions {
|
|||||||
* Fill a actor data from this object
|
* Fill a actor data from this object
|
||||||
*/
|
*/
|
||||||
async toActor(actor, itemsCache) {
|
async toActor(actor, itemsCache) {
|
||||||
const actorDatas = actor.data.data;
|
const actorDatas = duplicate(actor.data.data);
|
||||||
const formData = this.data;
|
const formData = this.data;
|
||||||
|
|
||||||
// Update the actor real datas
|
// Update the actor real datas
|
||||||
@@ -280,7 +280,7 @@ export class TwentyQuestions {
|
|||||||
// Update actor
|
// Update actor
|
||||||
actor.update({
|
actor.update({
|
||||||
name: (formData.step2.family + " " + formData.step19.firstname).trim(),
|
name: (formData.step2.family + " " + formData.step19.firstname).trim(),
|
||||||
data: actorDatas,
|
data: diffObject(actor.data.data, actorDatas),
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO Tmp
|
// TODO Tmp
|
||||||
|
|||||||
@@ -7,7 +7,12 @@ L5R5E.paths = {
|
|||||||
|
|
||||||
L5R5E.stances = ["earth", "air", "water", "fire", "void"];
|
L5R5E.stances = ["earth", "air", "water", "fire", "void"];
|
||||||
L5R5E.techniques = ["kata", "kiho", "invocation", "ritual", "shuji", "maho", "ninjutsu"];
|
L5R5E.techniques = ["kata", "kiho", "invocation", "ritual", "shuji", "maho", "ninjutsu"];
|
||||||
L5R5E.xpPerRank = [20, 24, 32, 44, 60];
|
L5R5E.xp = {
|
||||||
|
costPerRank: [20, 24, 32, 44, 60],
|
||||||
|
ringCostMultiplier: 3,
|
||||||
|
skillCostMultiplier: 2,
|
||||||
|
techniqueCost: 3,
|
||||||
|
};
|
||||||
|
|
||||||
// Map SkillId - CategoryId
|
// Map SkillId - CategoryId
|
||||||
L5R5E.skills = new Map();
|
L5R5E.skills = new Map();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export class AdvancementSheetL5r5e extends ItemSheetL5r5e {
|
|||||||
/**
|
/**
|
||||||
* Sub Types of advancements
|
* Sub Types of advancements
|
||||||
*/
|
*/
|
||||||
static types = ["ring", "skill"]; // "advantage" and "technique" have theirs own xp count
|
static types = ["ring", "skill"]; // "peculiarity" and "technique" have theirs own xp count
|
||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
static get defaultOptions() {
|
static get defaultOptions() {
|
||||||
@@ -28,4 +28,110 @@ export class AdvancementSheetL5r5e extends ItemSheetL5r5e {
|
|||||||
|
|
||||||
return sheetData;
|
return sheetData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subscribe to events from the sheet.
|
||||||
|
* @param html HTML content of the sheet.
|
||||||
|
*/
|
||||||
|
activateListeners(html) {
|
||||||
|
super.activateListeners(html);
|
||||||
|
|
||||||
|
// Everything below here is only needed if the sheet is editable
|
||||||
|
if (!this.options.editable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// const currentType = this.object.data.data.advancement_type;
|
||||||
|
const currentRing = this.object.data.data.ring;
|
||||||
|
const currentSkill = this.object.data.data.skill;
|
||||||
|
|
||||||
|
html.find("#advancement_type").on("change", (event) => {
|
||||||
|
if ($(event.target).val() === "skill") {
|
||||||
|
this._updateChoice(
|
||||||
|
{
|
||||||
|
ring: currentRing,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skill: currentSkill,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this._updateChoice(
|
||||||
|
{
|
||||||
|
skill: currentSkill,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ring: currentRing,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
html.find("#advancement_ring").on("change", (event) => {
|
||||||
|
this._updateChoice(
|
||||||
|
{
|
||||||
|
ring: currentRing,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ring: $(event.target).val(),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
html.find("#advancement_skill").on("change", (event) => {
|
||||||
|
this._updateChoice(
|
||||||
|
{
|
||||||
|
skill: currentSkill,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
skill: $(event.target).val(),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update Actor and Object to the current choice
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
_updateChoice(oldChoice, newChoice) {
|
||||||
|
let skillCatId = null;
|
||||||
|
const actor = duplicate(this.actor.data.data);
|
||||||
|
let xp_used = this.object.data.data.xp_used;
|
||||||
|
|
||||||
|
// Old choices
|
||||||
|
if (oldChoice.ring) {
|
||||||
|
actor.rings[oldChoice.ring] = Math.max(1, actor.rings[oldChoice.ring] - 1);
|
||||||
|
}
|
||||||
|
if (oldChoice.skill) {
|
||||||
|
skillCatId = CONFIG.l5r5e.skills.get(oldChoice.skill);
|
||||||
|
actor.skills[skillCatId][oldChoice.skill] = Math.max(0, actor.skills[skillCatId][oldChoice.skill] - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// new choices
|
||||||
|
if (newChoice.ring) {
|
||||||
|
actor.rings[newChoice.ring] = actor.rings[newChoice.ring] + 1;
|
||||||
|
xp_used = actor.rings[newChoice.ring] * CONFIG.l5r5e.xp.ringCostMultiplier;
|
||||||
|
}
|
||||||
|
if (newChoice.skill) {
|
||||||
|
skillCatId = CONFIG.l5r5e.skills.get(newChoice.skill);
|
||||||
|
actor.skills[skillCatId][newChoice.skill] = actor.skills[skillCatId][newChoice.skill] + 1;
|
||||||
|
xp_used = actor.skills[skillCatId][newChoice.skill] * CONFIG.l5r5e.xp.skillCostMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update Actor
|
||||||
|
this.actor.update({
|
||||||
|
data: diffObject(this.actor.data.data, actor),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update object
|
||||||
|
this.object.update({
|
||||||
|
data: {
|
||||||
|
xp_used: xp_used,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Re render
|
||||||
|
this.render(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,45 @@
|
|||||||
"entity": "Item"
|
"entity": "Item"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "core-techniques",
|
"name": "core-techniques-kata",
|
||||||
"label": "Techniques",
|
"label": "Techniques Kata",
|
||||||
"path": "packs/core-techniques.db",
|
"path": "packs/core-techniques-kata.db",
|
||||||
|
"entity": "Item"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "core-techniques-kiho",
|
||||||
|
"label": "Techniques Kihõ",
|
||||||
|
"path": "packs/core-techniques-kiho.db",
|
||||||
|
"entity": "Item"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "core-techniques-invocation",
|
||||||
|
"label": "Techniques Invocations",
|
||||||
|
"path": "packs/core-techniques-invocations.db",
|
||||||
|
"entity": "Item"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "core-techniques-ritual",
|
||||||
|
"label": "Techniques Rituals",
|
||||||
|
"path": "packs/core-techniques-rituals.db",
|
||||||
|
"entity": "Item"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "core-techniques-shuji",
|
||||||
|
"label": "Techniques Shuji",
|
||||||
|
"path": "packs/core-techniques-shuji.db",
|
||||||
|
"entity": "Item"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "core-techniques-maho",
|
||||||
|
"label": "Techniques Mahõ",
|
||||||
|
"path": "packs/core-techniques-maho.db",
|
||||||
|
"entity": "Item"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "core-techniques-ninjutsu",
|
||||||
|
"label": "Techniques Ninjutsu",
|
||||||
|
"path": "packs/core-techniques-ninjutsu.db",
|
||||||
"entity": "Item"
|
"entity": "Item"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -42,27 +78,27 @@
|
|||||||
"entity": "Item"
|
"entity": "Item"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "core-distinctions",
|
"name": "core-peculiarities-distinctions",
|
||||||
"label": "Distinctions",
|
"label": "Distinctions",
|
||||||
"path": "packs/core-distinctions.db",
|
"path": "packs/core-peculiarities-distinctions.db",
|
||||||
"entity": "Item"
|
"entity": "Item"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "core-passions",
|
"name": "core-peculiarities-passions",
|
||||||
"label": "Passions",
|
"label": "Passions",
|
||||||
"path": "packs/core-passions.db",
|
"path": "packs/core-peculiarities-passions.db",
|
||||||
"entity": "Item"
|
"entity": "Item"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "core-adversities",
|
"name": "core-peculiarities-adversities",
|
||||||
"label": "Adversities",
|
"label": "Adversities",
|
||||||
"path": "packs/core-adversities.db",
|
"path": "packs/core-peculiarities-adversities.db",
|
||||||
"entity": "Item"
|
"entity": "Item"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "core-anxieties",
|
"name": "core-peculiarities-anxieties",
|
||||||
"label": "Anxieties",
|
"label": "Anxieties",
|
||||||
"path": "packs/core-anxieties.db",
|
"path": "packs/core-peculiarities-anxieties.db",
|
||||||
"entity": "Item"
|
"entity": "Item"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -186,7 +186,8 @@
|
|||||||
"technique": {
|
"technique": {
|
||||||
"templates": ["basics", "advancement"],
|
"templates": ["basics", "advancement"],
|
||||||
"technique_type": "kata",
|
"technique_type": "kata",
|
||||||
"effects": ""
|
"effects": "",
|
||||||
|
"xp_cost": 3
|
||||||
},
|
},
|
||||||
"property": {
|
"property": {
|
||||||
"templates": ["basics"]
|
"templates": ["basics"]
|
||||||
@@ -198,7 +199,7 @@
|
|||||||
},
|
},
|
||||||
"advancement": {
|
"advancement": {
|
||||||
"templates": ["basics", "advancement"],
|
"templates": ["basics", "advancement"],
|
||||||
"advancement_type": "",
|
"advancement_type": "skill",
|
||||||
"skill": ""
|
"skill": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
{{!-- Attributes Tab --}}
|
{{!-- Attributes Tab --}}
|
||||||
<article class="attributes" data-group="primary" data-tab="attributes">
|
<article class="attributes" data-group="primary" data-tab="attributes">
|
||||||
<!-- TODO j'ai mis tous les attributs en vrac, à réorganiser -->
|
<!-- TODO j'ai mis tous les attributs en vrac, à réorganiser -->
|
||||||
<select name="data.advancement_type">
|
<select name="data.advancement_type" id="advancement_type">
|
||||||
{{#select item.data.advancement_type}}
|
{{#select item.data.advancement_type}}
|
||||||
{{#each item.data.subTypesList as |type|}}
|
{{#each item.data.subTypesList as |type|}}
|
||||||
<option value="{{type}}">{{type}}</option>
|
<option value="{{type}}">{{type}}</option>
|
||||||
@@ -16,12 +16,8 @@
|
|||||||
{{/select}}
|
{{/select}}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
{{#ifCond item.data.advancement_type '==' 'advantage' }}
|
|
||||||
<!-- TODO zone de drag n drop de l'item sélectionné ? -->
|
|
||||||
{{/ifCond}}
|
|
||||||
|
|
||||||
{{#ifCond item.data.advancement_type '==' 'ring' }}
|
{{#ifCond item.data.advancement_type '==' 'ring' }}
|
||||||
<select name="data.ring">
|
<select name="data.ring" id="advancement_ring">
|
||||||
{{#select item.data.ring}}
|
{{#select item.data.ring}}
|
||||||
{{#each item.data.ringsList as |obj|}}
|
{{#each item.data.ringsList as |obj|}}
|
||||||
<option value="{{obj.id}}">{{obj.label}}</option>
|
<option value="{{obj.id}}">{{obj.label}}</option>
|
||||||
@@ -31,7 +27,7 @@
|
|||||||
{{/ifCond}}
|
{{/ifCond}}
|
||||||
|
|
||||||
{{#ifCond item.data.advancement_type '==' 'skill' }}
|
{{#ifCond item.data.advancement_type '==' 'skill' }}
|
||||||
<select name="data.skill">
|
<select name="data.skill" id="advancement_skill">
|
||||||
<option value="none">{{localize 'l5r5e.twenty_questions.choosef'}}</option>
|
<option value="none">{{localize 'l5r5e.twenty_questions.choosef'}}</option>
|
||||||
{{#select item.data.skill}}
|
{{#select item.data.skill}}
|
||||||
{{#each item.data.skillsList as |skills catId|}}
|
{{#each item.data.skillsList as |skills catId|}}
|
||||||
|
|||||||
@@ -26,6 +26,10 @@
|
|||||||
<input type="checkbox" name="data.in_curriculum" {{checked item.data.in_curriculum}} />
|
<input type="checkbox" name="data.in_curriculum" {{checked item.data.in_curriculum}} />
|
||||||
{{ localize 'l5r5e.advancements.curriculum' }}
|
{{ localize 'l5r5e.advancements.curriculum' }}
|
||||||
</label>
|
</label>
|
||||||
|
<label class="attribute">
|
||||||
|
{{ localize 'l5r5e.advancements.cost' }}
|
||||||
|
<input type="text" name="data.xp_cost" value="{{item.data.xp_cost}}" data-dtype="Number" placeholder="0"/>
|
||||||
|
</label>
|
||||||
<label class="attribute">
|
<label class="attribute">
|
||||||
{{ localize 'l5r5e.advancements.spent' }}
|
{{ localize 'l5r5e.advancements.spent' }}
|
||||||
<input type="text" name="data.xp_used" value="{{item.data.xp_used}}" data-dtype="Number" placeholder="0"/>
|
<input type="text" name="data.xp_used" value="{{item.data.xp_used}}" data-dtype="Number" placeholder="0"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user