Gestion des paradigmes
This commit is contained in:
parent
b0c59c6104
commit
b6dac470e9
@ -143,22 +143,11 @@ export class Imperium5ActorSheet extends ActorSheet {
|
||||
this.actor.incDecQuantity( li.data("item-id"), +1 );
|
||||
} );
|
||||
|
||||
html.find('.roll-ame').click((event) => {
|
||||
html.find('.roll-ame-button').click((event) => {
|
||||
const ameKey = $(event.currentTarget).data("ame-key")
|
||||
this.actor.rollAme(ameKey)
|
||||
});
|
||||
|
||||
html.find('.roll-spec').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
const specId = li.data("item-id");
|
||||
this.actor.rollSpec(specId);
|
||||
});
|
||||
|
||||
html.find('.weapon-damage-roll').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
const weaponId = li.data("item-id");
|
||||
this.actor.rollWeapon(weaponId, true);
|
||||
});
|
||||
|
||||
html.find('.lock-unlock-sheet').click((event) => {
|
||||
this.options.editScore = !this.options.editScore;
|
||||
|
@ -111,6 +111,17 @@ export class Imperium5Actor extends Actor {
|
||||
let item = duplicate(this.items.filter( it => it.type == "contact") || [] )
|
||||
return item
|
||||
}
|
||||
getUnusedParadigmes() {
|
||||
let paraList = []
|
||||
for(let k in this.system.paradigmes) {
|
||||
let para = this.system.paradigmes[k]
|
||||
if (!para.used) {
|
||||
para.key = k
|
||||
paraList.push(duplicate(para))
|
||||
}
|
||||
}
|
||||
return paraList
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
incDecKarma( value ) {
|
||||
@ -156,10 +167,6 @@ export class Imperium5Actor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getInitiativeScore(combatId, combatantId) {
|
||||
if (this.type == 'character') {
|
||||
this.rollMR(true, combatId, combatantId)
|
||||
}
|
||||
console.log("Init required !!!!")
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -214,6 +221,13 @@ export class Imperium5Actor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
setParadigmeUsed(paraKey) {
|
||||
let para = duplicate(this.system.paradigmes)
|
||||
para[paraKey].used = true
|
||||
this.update( {'system.paradigmes': para} )
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* ROLL SECTION
|
||||
/* -------------------------------------------- */
|
||||
@ -250,6 +264,8 @@ export class Imperium5Actor extends Actor {
|
||||
rollData.actorId = this.id
|
||||
rollData.img = this.img
|
||||
rollData.capacites = this.getUnusedCapacites()
|
||||
rollData.paradigmes = this.getUnusedParadigmes()
|
||||
rollData.selectedParadigme = "none"
|
||||
rollData.karma = this.system.karma.value
|
||||
|
||||
return rollData
|
||||
|
@ -91,9 +91,13 @@ export class Imperium5Utility {
|
||||
/* -------------------------------------------- */
|
||||
static async chatListeners(html) {
|
||||
|
||||
html.on("click", '.view-item-from-chat', event => {
|
||||
game.system.pegasus.creator.openItemView(event)
|
||||
html.on("click", '.button-apply-paradigme', event => {
|
||||
let paraKey = $(event.currentTarget).data("para-key")
|
||||
let rollData = this.getRollDataFromMessage(event)
|
||||
rollData.previousMessageId = Imperium5Utility.findChatMessageId(event.currentTarget)
|
||||
this.applyParadigme(rollData, paraKey)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -152,6 +156,12 @@ export class Imperium5Utility {
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static getRollDataFromMessage(event) {
|
||||
let messageId = Imperium5Utility.findChatMessageId(event.currentTarget)
|
||||
let message = game.messages.get(messageId)
|
||||
return message.getFlag("world", "imperium5-roll-data")
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static createDirectOptionList(min, max) {
|
||||
@ -279,6 +289,16 @@ export class Imperium5Utility {
|
||||
return Math.max(val, 0)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static computeReussites(rollData) {
|
||||
let myRoll = rollData.roll
|
||||
rollData.successPC = myRoll.terms[0].results.filter(res => res.result <= rollData.seuil).length
|
||||
rollData.successGM = myRoll.terms[4].results.filter(res => res.result <= rollData.seuil).length
|
||||
rollData.bonPresage = myRoll.terms[2].results[0].result == 1
|
||||
rollData.mauvaisPresage = myRoll.terms[2].results[0].result == 8
|
||||
rollData.nbUnitesNarration = Math.max( rollData.successPC-1, 0)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async rollImperium5(rollData) {
|
||||
|
||||
@ -308,16 +328,24 @@ export class Imperium5Utility {
|
||||
}
|
||||
|
||||
// Calcul réussites
|
||||
rollData.successPC = myRoll.terms[0].results.filter(res => res.result <= 2).length
|
||||
rollData.successGM = myRoll.terms[4].results.filter(res => res.result <= 2).length
|
||||
rollData.bonPresage = myRoll.terms[2].results[0].result == 1
|
||||
rollData.mauvaisPresage = myRoll.terms[2].results[0].result == 8
|
||||
rollData.nbUnitesNarration = Math.max( rollData.successPC-1, 0)
|
||||
this.computeReussites(rollData)
|
||||
|
||||
let msg = await this.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-imperium5/templates/chat-generic-result.html`, rollData)
|
||||
})
|
||||
msg.setFlag("world", "rolldata", rollData)
|
||||
msg.setFlag("world", "imperium5-roll-data", rollData)
|
||||
}
|
||||
|
||||
/* ------------------------- ------------------- */
|
||||
static async processParadigmeRoll(rollData) {
|
||||
this.computeReussites(rollData)
|
||||
rollData.paradigmes = []
|
||||
let msg = await this.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-imperium5/templates/chat-generic-result.html`, rollData)
|
||||
})
|
||||
msg.setFlag("world", "imperium5-roll-data", rollData)
|
||||
|
||||
this.removeChatMessageId(rollData.previousMessageId)
|
||||
}
|
||||
|
||||
/* ------------------------- ------------------- */
|
||||
@ -445,12 +473,24 @@ export class Imperium5Utility {
|
||||
useArchetype: false,
|
||||
useAide: false,
|
||||
useKarma: false,
|
||||
usedCapacite: "none"
|
||||
usedCapacite: "none",
|
||||
seuil: 2
|
||||
}
|
||||
Imperium5Utility.updateWithTarget(rollData)
|
||||
return rollData
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static applyParadigme(rollData, paraKey) {
|
||||
let actor = game.actors.get(rollData.actorId)
|
||||
let para = actor.system.paradigmes[paraKey]
|
||||
rollData.seuil = para.value
|
||||
rollData.usedParadigme = para.label
|
||||
actor.setParadigmeUsed(paraKey)
|
||||
|
||||
this.processParadigmeRoll(rollData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static updateWithTarget(rollData) {
|
||||
let objectDefender
|
||||
|
@ -60,7 +60,7 @@
|
||||
font-size: 1.0rem;
|
||||
} /* For title, sidebar character and scene */
|
||||
.sheet nav.sheet-tabs {
|
||||
font-size: 0.8rem;
|
||||
font-size: 1.2rem;
|
||||
} /* For nav and title */
|
||||
.window-app input, .foundryvtt-vadentis .item-form, .sheet header.sheet-header .flex-group-center.flex-compteurs, .sheet header.sheet-header .flex-group-center.flex-fatigue, select, button, .item-checkbox, #sidebar, #players, #navigation #nav-toggle {
|
||||
font-size: 0.8rem;
|
||||
@ -78,7 +78,7 @@
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.tabs .item.active, .blessures-list li ul li:first-child:hover, a:hover {
|
||||
.tabs .item.active, a:hover {
|
||||
text-shadow: 1px 0px 0px #ff6600;
|
||||
}
|
||||
|
||||
@ -335,20 +335,21 @@ table {border: 1px solid #7a7971;}
|
||||
}
|
||||
|
||||
.fvtt-imperium5 .tabs {
|
||||
height: 40px;
|
||||
height: 24px;
|
||||
border-top: 1px solid #AAA;
|
||||
border-bottom: 1px solid #AAA;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.fvtt-imperium5 .tabs .item {
|
||||
line-height: 40px;
|
||||
line-height: 24px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.fvtt-imperium5 .tabs .item.active {
|
||||
text-decoration: underline;
|
||||
text-shadow: none;
|
||||
/*text-decoration: underline;*/
|
||||
background: linear-gradient(to bottom, #B8A799F0 5%, #9c6d47f0 100%);
|
||||
/*text-shadow: none;*/
|
||||
}
|
||||
|
||||
.fvtt-imperium5 .items-list {
|
||||
@ -445,29 +446,40 @@ section.sheet-body{padding: 0.25rem 0.5rem;}
|
||||
}
|
||||
|
||||
.sheet nav.sheet-tabs {
|
||||
font-size: 0.70rem;
|
||||
font-size: 1.0rem;
|
||||
font-weight: bold;
|
||||
height: 3rem;
|
||||
height: 2.5rem;
|
||||
flex: 0 0 3rem;
|
||||
margin: 0;
|
||||
padding: 0 0 0 0.25rem;
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
line-height: 1.5rem;
|
||||
border-radius: 8px;
|
||||
border-top: 0 none;
|
||||
border-bottom: 0 none;
|
||||
border-right: 0 none;
|
||||
background-color:#B8A799F0;
|
||||
color:beige;
|
||||
color: #403f3e;
|
||||
}
|
||||
|
||||
/* background: rgb(245,245,240) url("../images/ui/fond4.webp") repeat left top;*/
|
||||
|
||||
nav.sheet-tabs .item {
|
||||
position: relative;
|
||||
padding: 0 0.25rem;
|
||||
}
|
||||
|
||||
.tab-title {
|
||||
background-color:#B8A799F0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.tab-title:hover {
|
||||
background: linear-gradient(to bottom, #B8A799F0 5%, #9c6d47f0 100%);
|
||||
background-color: red;
|
||||
}
|
||||
.tab-title:active {
|
||||
position:relative;
|
||||
top:1px;
|
||||
}
|
||||
|
||||
nav.sheet-tabs .item:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
@ -1150,47 +1162,46 @@ ul, li {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.river-button {
|
||||
.common-button {
|
||||
box-shadow: inset 0px 1px 0px 0px #a6827e;
|
||||
background: linear-gradient(to bottom, #21374afc 5%, #152833ab 100%);
|
||||
background-color: #7d5d3b00;
|
||||
border-radius: 3px;
|
||||
background: linear-gradient(to bottom, #B8A799F0 5%, #80624af0 100%);
|
||||
background-color: #B8A799F0; /*#7d5d3b00;*/
|
||||
border-radius: 4px;
|
||||
opacity: 60%;
|
||||
border: 2px ridge #846109;
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
color: #ffffff;
|
||||
font-size: 0.8rem;
|
||||
padding: 2px 4px 0px 4px;
|
||||
text-decoration: none;
|
||||
text-shadow: 0px 1px 0px #4d3534;
|
||||
position: relative;
|
||||
margin:4px;
|
||||
}
|
||||
|
||||
.common-button:hover {
|
||||
background: linear-gradient(to bottom, #97B5AEFF 5%, rgb(101, 167, 151) 100%);
|
||||
background-color: #97B5AEFF;
|
||||
}
|
||||
.common-button:active {
|
||||
position:relative;
|
||||
top:1px;
|
||||
}
|
||||
|
||||
.roll-ame-button {
|
||||
width: 80px;
|
||||
min-width: 80px;
|
||||
}
|
||||
|
||||
.chat-card-button {
|
||||
box-shadow: inset 0px 1px 0px 0px #a6827e;
|
||||
background: linear-gradient(to bottom, #21374afc 5%, #152833ab 100%);
|
||||
background-color: #7d5d3b00;
|
||||
border-radius: 3px;
|
||||
border: 2px ridge #846109;
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
color: #ffffff;
|
||||
font-size: 0.8rem;
|
||||
padding: 4px 12px 0px 12px;
|
||||
text-decoration: none;
|
||||
text-shadow: 0px 1px 0px #4d3534;
|
||||
position: relative;
|
||||
padding: 2px 2px 0px 2px;
|
||||
margin:2px;
|
||||
}
|
||||
|
||||
.chat-card-button:hover {
|
||||
background: linear-gradient(to bottom, #800000 5%, #3e0101 100%);
|
||||
background-color: red;
|
||||
}
|
||||
.chat-card-button:active {
|
||||
position:relative;
|
||||
top:1px;
|
||||
|
||||
.li-button-paradigme {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.plus-minus-button {
|
||||
@ -1209,9 +1220,7 @@ ul, li {
|
||||
margin:0px;
|
||||
}
|
||||
|
||||
.river-button:hover,
|
||||
.plus-minus-button:hover,
|
||||
.chat-card-button:hover {
|
||||
.plus-minus-button:hover {
|
||||
background: linear-gradient(to bottom, #800000 5%, #3e0101 100%);
|
||||
background-color: red;
|
||||
}
|
||||
@ -1295,7 +1304,7 @@ ul, li {
|
||||
/* =================== 1. ACTOR SHEET FONT STYLES =========== *//*
|
||||
*/
|
||||
.sheet-box {
|
||||
border-radius: 5%;
|
||||
border-radius: 12px;
|
||||
border-width: 1px;
|
||||
padding: 0.4rem;
|
||||
margin: 0.2rem;
|
||||
@ -1451,3 +1460,6 @@ ul, li {
|
||||
.color-text-ame {
|
||||
color: #806B64;
|
||||
}
|
||||
.ame-block {
|
||||
margin-bottom: 24px;
|
||||
}
|
18
system.json
18
system.json
@ -1,9 +1,13 @@
|
||||
{
|
||||
"id": "fvtt-imperium5",
|
||||
"title": "Imperium5 RPG",
|
||||
"authors": [ {"name":"Uberwald"} ],
|
||||
"version": "10.0.3",
|
||||
"compatibleCoreVersion": "9",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Uberwald",
|
||||
"flags": {}
|
||||
}
|
||||
],
|
||||
"version": "10.0.4",
|
||||
"compatibility": {
|
||||
"minimum": "10",
|
||||
"verified": "10",
|
||||
@ -15,12 +19,7 @@
|
||||
],
|
||||
"gridDistance": 5,
|
||||
"gridUnits": "m",
|
||||
"languages": [
|
||||
],
|
||||
"library": false,
|
||||
"license": "LICENSE.txt",
|
||||
"manifestPlusVersion": "1.0.0",
|
||||
"media": [],
|
||||
"packs": [
|
||||
{
|
||||
"type": "Item",
|
||||
@ -65,8 +64,7 @@
|
||||
"styles": [
|
||||
"styles/simple.css"
|
||||
],
|
||||
"templateVersion": 47,
|
||||
"background" : "./images/ui/imperium5_welcome_page.webp",
|
||||
"background": "images/ui/imperium5_welcome_page.webp",
|
||||
"url": "https://www.uberwald.me/gitea/uberwald/fvtt-imperium5",
|
||||
"manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-imperium5/raw/branch/master/system.json",
|
||||
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-imperium5/archive/fvtt-imperium5-v10.0.3.zip"
|
||||
|
@ -1,8 +1,10 @@
|
||||
<div class="ame-block">
|
||||
<span class="flexrow">
|
||||
<h4 class="ame-margin ame-subtitle">{{typedata.label}}</h4>
|
||||
<div class="item-filler"> </div>
|
||||
|
||||
<select class="input-numeric-short padd-right status-small-label color-class-common" type="text" name="system.amestype.{{typeame}}.malus" value="{{typedata.malus}}" data-dtype="Number">
|
||||
<select class="input-numeric-short padd-right status-small-label color-class-common" type="text"
|
||||
name="system.amestype.{{typeame}}.malus" value="{{typedata.malus}}" data-dtype="Number">
|
||||
{{#select typedata.malus}}
|
||||
<option value="0">0</option>
|
||||
<option value="-1">-1</option>
|
||||
@ -20,16 +22,17 @@
|
||||
</span>
|
||||
|
||||
<ul class="ame-margin">
|
||||
<li class="ame-padding item stat flexrow item-ame-roll" data-ame-key="{{key}}">
|
||||
{{#each system.ames as |ame key|}}
|
||||
{{#if (eq ame.type ../typeame)}}
|
||||
<li class="ame-padding item stat flexrow item-ame-roll" data-ame-key="{{key}}">
|
||||
<span class="ame-label ame-margin " name="{{key}}">
|
||||
<button class="common-button roll-ame-button" data-ame-key="{{key}}">{{ame.label}}</button>
|
||||
<input type="text" class="input-numeric-short padd-right status-small-label color-class-common"
|
||||
name="system.ames.{{key}}.value" value="{{ame.value}}" data-dtype="Number" {{#unless
|
||||
@root.editScore}}disabled{{/unless}} />
|
||||
<span class="ame-label ame-margin" name="{{key}}">
|
||||
<a class="roll-ame" data-ame-key="{{key}}">{{ame.label}}</a>
|
||||
</span>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
@ -12,11 +12,11 @@
|
||||
data-dtype="String" {{#unless @root.editScore}}disabled{{/unless}} />
|
||||
</h4>
|
||||
{{else}}
|
||||
<h4 class="ame-margin"><a class="roll-ame ame-margin" data-stat-key="{{key}}">{{para.label}}</a></h4>
|
||||
<h4 class="ame-margin">{{para.label}}</h4>
|
||||
{{/if}}
|
||||
</span>
|
||||
|
||||
<input type="checkbox">
|
||||
<input type="checkbox" name="system.paradigmes.{{key}}.used" {{checked para.used}}>
|
||||
|
||||
</li>
|
||||
{{/each}}
|
@ -8,9 +8,9 @@
|
||||
<h1 class="charname margin-right"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1>
|
||||
{{!-- Sheet Tab Navigation --}}
|
||||
<nav class="sheet-tabs tabs" data-group="primary">
|
||||
<a class="item" data-tab="principal">Principal</a>
|
||||
<a class="item" data-tab="ressources">Ressources</a>
|
||||
<a class="item" data-tab="biodata">Bio</a>
|
||||
<a class="item tab-title" data-tab="principal">Principal</a>
|
||||
<a class="item tab-title" data-tab="ressources">Ressources</a>
|
||||
<a class="item tab-title" data-tab="biodata">Bio</a>
|
||||
</nav>
|
||||
</div>
|
||||
<img class="profile-img" src="{{img}}" data-edit="img" title="{{name}}" />
|
||||
@ -25,7 +25,7 @@
|
||||
<div class="tab principal" data-group="primary" data-tab="principal">
|
||||
|
||||
<div>
|
||||
<div class="sheet-box color-bg-ame color-text-ame">
|
||||
<div class="sheet-box color-bg-ame ">
|
||||
<div class=flexrow>
|
||||
<h4 class="ame-margin title-font">KARMA</h4>
|
||||
<span class="item-name-label flexrow">Karma
|
||||
@ -47,7 +47,7 @@
|
||||
<div class="flexrow">
|
||||
|
||||
<div class="flexrow">
|
||||
<div class="sheet-box color-bg-ame color-text-ame">
|
||||
<div class="sheet-box color-bg-ame ">
|
||||
<span class="flexrow">
|
||||
<img class="ame-icon" src="systems/fvtt-imperium5/images/icons/ame_transparent.webp">
|
||||
<h4 class="ame-margin title-font">AMES</h4>
|
||||
|
@ -13,6 +13,27 @@
|
||||
<div>
|
||||
<ul>
|
||||
<li>Réserve : {{humanFormula}}</li>
|
||||
<li>Score :
|
||||
(
|
||||
{{#each roll.terms.0.results as |r k|}}
|
||||
{{r.result}}
|
||||
{{/each}}
|
||||
)
|
||||
(
|
||||
{{#each roll.terms.2.results as |r k|}}
|
||||
{{r.result}}
|
||||
{{/each}}
|
||||
)
|
||||
(
|
||||
{{#each roll.terms.4.results as |r k|}}
|
||||
{{r.result}}
|
||||
{{/each}}
|
||||
)
|
||||
</li>
|
||||
{{#if usedParadigme}}
|
||||
<li>Paradigme utilisé : {{usedParadigme}}</li>
|
||||
{{/if}}
|
||||
<li>Seuil : {{seuil}}</li>
|
||||
<li>Succés : {{successPC}}</li>
|
||||
<li>Succés de Réalité : {{successGM}}</li>
|
||||
<li>Unités de narration : {{nbUnitesNarration}}</li>
|
||||
@ -27,6 +48,14 @@
|
||||
<li>Mauvais Présage !</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if (count paradigmes)}}
|
||||
<li class="li-button-paradigme">
|
||||
{{#each paradigmes as |para key|}}
|
||||
<button class="common-button chat-card-button button-apply-paradigme" data-para-key="{{para.key}}">Utiliser {{para.label}} ({{para.value}})</button>
|
||||
{{/each}}
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user