This commit is contained in:
Erwan Lemaire
2025-05-02 13:19:49 +02:00
parent 5889a8111d
commit c35e93975b
14 changed files with 111 additions and 94 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+36 -24
View File
@@ -21,10 +21,7 @@ export class VermineActor extends Actor {
// documents or derived data. // documents or derived data.
if (this.type == 'character') { if (this.type == 'character') {
this._setAgeType();
this._setCharacterEffort();
this._setCharacterSelfControl();
this._setCharacterThresholds();
} }
} }
@@ -44,11 +41,41 @@ export class VermineActor extends Actor {
// Make separate methods for each Actor type (character, npc, etc.) to keep // Make separate methods for each Actor type (character, npc, etc.) to keep
// things organized. // things organized.
this._prepareCharacterData(actorData); switch (this.type) {
this._prepareNpcData(actorData); case "character":
this._prepareCharacterData(actorData);
break;
case "npc":
this._prepareNpcData(actorData);
break;
}
}
/**
* Prepare Character type specific data
*/
_prepareCharacterData(actorData) {
if (actorData.type !== 'character') return;
this._setAgeType();
this._setCharacterEffort();
this._setCharacterSelfControl();
this._setCharacterThresholds();
// Make modifications to data here. For example:
const systemData = actorData.system;
// Loop through ability scores, and add their modifiers to our sheet output.
for (let [key, ability] of Object.entries(systemData.abilities)) {
// Calculate the modifier using d20 rules.
ability.mod = Math.floor((ability.value - 10) / 2);
}
this.prepareCombatStatus();
}
prepareCombatStatus() {
//combat initiative reaction difficulty //combat initiative reaction difficulty
console.log(this.system.combatStatus)
switch (parseInt(this.system.combatStatus.difficulty)) { switch (parseInt(this.system.combatStatus.difficulty)) {
case 5: this.system.combatStatus.label = "Offensif"; case 5: this.system.combatStatus.label = "Offensif";
break; break;
@@ -59,26 +86,10 @@ export class VermineActor extends Actor {
default: default:
this.system.combatStatus.label = "Passif"; this.system.combatStatus.label = "Passif";
this.system.combatStatus.difficulty = "9"; this.system.combatStatus.difficulty = "9";
break;
} }
} }
/**
* Prepare Character type specific data
*/
_prepareCharacterData(actorData) {
if (actorData.type !== 'character') return;
// Make modifications to data here. For example:
const systemData = actorData.system;
// Loop through ability scores, and add their modifiers to our sheet output.
for (let [key, ability] of Object.entries(systemData.abilities)) {
// Calculate the modifier using d20 rules.
ability.mod = Math.floor((ability.value - 10) / 2);
}
}
/** /**
* Prepare NPC type specific data. * Prepare NPC type specific data.
*/ */
@@ -88,6 +99,7 @@ export class VermineActor extends Actor {
// Make modifications to data here. For example: // Make modifications to data here. For example:
const systemData = actorData.system; const systemData = actorData.system;
systemData.xp = (systemData.cr * systemData.cr) * 100; systemData.xp = (systemData.cr * systemData.cr) * 100;
this.prepareCombatStatus()
} }
/** /**
+3 -3
View File
@@ -81,13 +81,13 @@ export class VermineItem extends Item {
// If there's no roll data, send a chat message. // If there's no roll data, send a chat message.
let mess = new ChatMessage({ let mess = {
speaker: speaker, speaker: speaker,
rollMode: rollMode, rollMode: rollMode,
flavor: label, flavor: label,
}); };
mess.content = await renderTemplate(`systems/vermine2047/templates/item/chatCards/${this.type}.html`, { item: this, message: mess }) ?? null; mess.content = await renderTemplate(`systems/vermine2047/templates/item/chatCards/${this.type}.html`, { item: this, message: mess }) ?? null;
console.log(mess) ChatMessage.create(mess)
} }
} }
+2 -2
View File
@@ -131,7 +131,7 @@ export class TraitSelector extends Application {
/* -------------------------------------------- */ /* -------------------------------------------- */
static get defaultOptions() { static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, { return foundry.utils.mergeObject(super.defaultOptions, {
id: "TRAITS_SELECTOR", classes: ["vermine2047", "trait-selector"],
title: game.i18n.localize("VERMINE.traits_selector"), title: game.i18n.localize("VERMINE.traits_selector"),
template: 'systems/vermine2047/templates/applications/choose-traits.hbs', template: 'systems/vermine2047/templates/applications/choose-traits.hbs',
popOut: true, popOut: true,
@@ -161,7 +161,7 @@ export class TraitSelector extends Application {
if (inp.type == "checkbox") { if (inp.type == "checkbox") {
inp.checked = true inp.checked = true
} }
} }
} }
await this.render(true) await this.render(true)
} }
+1
View File
@@ -31,6 +31,7 @@ export default class RollDialog extends Dialog {
} }
}, },
close: close, close: close,
} }
return super({ ...conf, ...data }, options); return super({ ...conf, ...data }, options);
}; };
+3
View File
@@ -43,6 +43,8 @@ export const preloadHandlebarsTemplates = async function () {
"systems/vermine2047/templates/item/partials/traits.html", "systems/vermine2047/templates/item/partials/traits.html",
"systems/vermine2047/templates/item/partials/header.hbs", "systems/vermine2047/templates/item/partials/header.hbs",
"systems/vermine2047/templates/item/partials/physicalItems.hbs", "systems/vermine2047/templates/item/partials/physicalItems.hbs",
"systems/vermine2047/templates/item/chatCards/parts/base.html",
]); ]);
}; };
@@ -125,6 +127,7 @@ export const registerHandlebarsHelpers = function () {
}); });
//return damge data //return damge data
Handlebars.registerHelper('getDamagesData', function (damageObject, prop) { Handlebars.registerHelper('getDamagesData', function (damageObject, prop) {
let propObject = damageObject[prop] let propObject = damageObject[prop]
let propValue = propObject[damageObject.value - 1] let propValue = propObject[damageObject.value - 1]
return propValue return propValue
+1 -1
View File
@@ -5,7 +5,7 @@
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"launch_Foundry12": "node /home/rwan/foundry/foundry_software/FoundryVTT-12.331/resources/app/main.js", "launch_Foundry12": "sudo node /home/rwan/foundry/foundry_software/FoundryVTT-12.331/resources/app/main.js",
"watch": "gulp watch", "watch": "gulp watch",
"buildStyle": "gulp buildStyles", "buildStyle": "gulp buildStyles",
"dev": "npm run launch_Foundry12 & xdg-open http://localhost:30000/", "dev": "npm run launch_Foundry12 & xdg-open http://localhost:30000/",
+21
View File
@@ -0,0 +1,21 @@
.app.vermine2047.trait-selector {
.form-group {
box-shadow: 0 0 30px gray;
padding: 0.3rem 0.5rem;
border: 3px solid rgb(142, 144, 16);
&:has(input[type="checkbox"]:checked) {
border: 3px solid green
}
label {
display: inline-flex;
align-items: center;
justify-content: space-around;
width: 100%;
text-align: center;
border-bottom: 2px solid black
}
}
}
+9
View File
@@ -15,6 +15,15 @@
/* Text color for window titles and menu all across Foundry */ /* Text color for window titles and menu all across Foundry */
} }
.vermine2047.sheet.actor {
header.sheet-header,
.windoow-content {
min-height: fit-content
}
}
/* Character and Item Name Titles Text style! */ /* Character and Item Name Titles Text style! */
.sheet .charname input { .sheet .charname input {
color: #191813; color: #191813;
+16 -1
View File
@@ -1,10 +1,25 @@
.window-app.vermineDialog { .window-app.vermineDialog {
max-width: 50vw;
height: fit-content;
.window-content { .window-content {
background: url(/systems/vermine2047/assets/images/ui/box_background.webp) repeat; background: url(/systems/vermine2047/assets/images/ui/box_background.webp) repeat;
color: black; color: black;
} }
.flexrow,
details>summary::after {
content: "▶️";
position: relative;
right: 40%;
}
details[open]>summary::after {
content: "🔽"
}
.grid { .grid {
justify-content: space-around; justify-content: space-around;
box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.555); box-shadow: 0px 1px 10px rgba(0, 0, 0, 0.555);
+1
View File
@@ -7,6 +7,7 @@
@import "special-inputs.scss"; @import "special-inputs.scss";
@import "special-applications.scss"; @import "special-applications.scss";
@import "_flex.scss"; @import "_flex.scss";
@import "_app.scss";
// overwrites variables // overwrites variables
+4 -4
View File
@@ -160,7 +160,7 @@
<!--DIFFICULTY HANDICAP--> <!--DIFFICULTY HANDICAP-->
<h2 class="flexrow"> <h2 class="flexrow difficulties">
<label class="label">{{localize <label class="label">{{localize
'VERMINE.difficulty'}}</label> 'VERMINE.difficulty'}}</label>
<select <select
@@ -220,11 +220,11 @@
<!-- BONUSES --> <!-- BONUSES -->
<details> <details class="flexcol bonuses">
<summary class="flexrow"> <summary class="flexrow">
<h3>Bonuses</h3> <h3 class="flexrow align-center">Bonuses ?</h3>
</summary> </summary>
<div class="grid grid-3col"> <div class="grid grid-2col">
<div class="flexrow row smb"> <div class="flexrow row smb">
+6 -3
View File
@@ -1,8 +1,11 @@
<header class="flexrow align-center"> <header class="flexrow align-center">
<img src="{{img}}" alt="image de {{name}}"> <img
<h3>{{name}}</h3> src="{{item.img}}"
alt="image de {{item.name}}"
>
<h3>{{item.name}}</h3>
</header> </header>
<section class="item-desc"> <section class="item-desc">
<p>{{{ system.description}}}</p> <p>{{{ item.system.description }}}</p>
</section> </section>
+5 -53
View File
@@ -1,55 +1,7 @@
<form class="{{cssClass}}" autocomplete="off"> <form
{{> "systems/vermine2047/templates/item/partials/header.hbs"}} class="{{cssClass}}"
autocomplete="off"
>
<section class="sheet-body"> {{> "systems/vermine2047/templates/item/chatCards/parts/base.html"}}
{{> "systems/vermine2047/templates/item/partials/traits.html"}}
<h4 class="flexrow">
<div class="resource align-center flexcol">
<label class="resource-label">{{ localize "VERMINE.ranges"}}</label>
<div class="flexrow align-center">
<div class="hexa">
<input type="number" name="system.min_range" value="{{system.min_range}}" data-dtype="Number"/>
</div>/
<div class="hexa">
<input type="number" name="system.max_range" value="{{system.max_range}}" data-dtype="Number"/></div>
</div>
</div>
<div class="resource align-center flexcol">
<label class="resource-label">{{ localize "VERMINE.damages"}}</label>
<div class="flexcol align-center">
<div class="flexrow">
<div class="hexa">
<input type="number" name="system.damage.value" value="{{system.damage.value}}" data-dtype="Number"/>
</div>
<span>
<input type="checkbox" data-tooltip="ajouter la vigueur" name="system.damage.addVigor" {{#if system.damage.addVigor}} checked {{/if}}>
</span>
</div>
<select name="system.damage.type">
<option value="0">type</option>
{{#each config.damageTypes as |label index|}}
<option value="{{label}}" {{#ife @root.system.damage.type label}} selected {{/ife}}>
{{label}}
</option>
{{/each}}
</select>
</div>
</div>
<div class="resource align-center flexcol">
<label class="resource-label">{{ localize "VERMINE.ammo"}}</label>
<div class="hexa"><input type="number" name="system.ammo" value="{{system.ammo}}" data-dtype="Number"/></div>
</div>
</h4>
{{> "systems/vermine2047/templates/item/partials/physicalItems.hbs"}}
</section>
</form> </form>