Initial release

This commit is contained in:
LeRatierBretonnien 2023-02-01 21:30:35 +01:00
parent 04909ef841
commit 513e43f169
17 changed files with 91 additions and 69 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

View File

@ -38,7 +38,7 @@ export class MaleficesActorSheet extends ActorSheet {
armes: duplicate(this.actor.getArmes()), armes: duplicate(this.actor.getArmes()),
equipements: duplicate(this.actor.getEquipements()), equipements: duplicate(this.actor.getEquipements()),
subActors: duplicate(this.actor.getSubActors()), subActors: duplicate(this.actor.getSubActors()),
encCurrent: this.actor.encCurrent, phyMalus: this.actor.getPhysiqueMalus(),
options: this.options, options: this.options,
owner: this.document.isOwner, owner: this.document.isOwner,
editScore: this.options.editScore, editScore: this.options.editScore,

View File

@ -268,6 +268,12 @@ export class MaleficesActor extends Actor {
return `systems/fvtt-malefices/images/icons/${attrKey}.webp` return `systems/fvtt-malefices/images/icons/${attrKey}.webp`
} }
/* -------------------------------------------- */
incDecDestin( value) {
let newValue = this.system.pointdestin + value
this.update( {'system.pointdestin': newValue})
}
/* -------------------------------------------- */ /* -------------------------------------------- */
getCommonRollData() { getCommonRollData() {
@ -277,6 +283,8 @@ export class MaleficesActor extends Actor {
rollData.actorId = this.id rollData.actorId = this.id
rollData.img = this.img rollData.img = this.img
rollData.phyMalus = this.getPhysiqueMalus() rollData.phyMalus = this.getPhysiqueMalus()
rollData.destin = this.system.pointdestin
rollData.isReroll = false
console.log("ROLLDATA", rollData) console.log("ROLLDATA", rollData)

View File

@ -1,6 +1,12 @@
export const MALEFICES_CONFIG = { export const MALEFICES_CONFIG = {
tarotType: {
"majeur": "Arcane Majeur",
"mineur": "Arcane Mineur",
"metier": "Arcane de Métier",
},
armeTypes : { armeTypes : {
"fusilchasse": "Fusil de Chasse", "fusilchasse": "Fusil de Chasse",
"fusilguerre": "Fusil de Guerre", "fusilguerre": "Fusil de Guerre",

View File

@ -63,6 +63,7 @@ export class MaleficesItemSheet extends ItemSheet {
options: this.options, options: this.options,
owner: this.document.isOwner, owner: this.document.isOwner,
description: await TextEditor.enrichHTML(this.object.system.description, { async: true }), description: await TextEditor.enrichHTML(this.object.system.description, { async: true }),
notes: await TextEditor.enrichHTML(this.object.system.notes, { async: true }),
isGM: game.user.isGM isGM: game.user.isGM
} }

View File

@ -116,37 +116,29 @@ export class MaleficesUtility {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static isArmorLight(armor) { static getActorFromRollData(rollData) {
if (armor && (armor.system.armortype.includes("light") || armor.system.armortype.includes("clothes"))) { let actor = game.actors.get(rollData.actorId)
return true if (rollData.tokenId) {
let token = canvas.tokens.placeables.find(t => t.id == rollData.tokenId)
if (token) {
actor = token.actor
}
} }
return false return actor
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static async chatListeners(html) { static async chatListeners(html) {
html.on("click", '.view-item-from-chat', event => { html.on("click", '.roll-destin', event => {
game.system.Malefices.creator.openItemView(event) let messageId = MaleficesUtility.findChatMessageId(event.currentTarget)
let message = game.messages.get(messageId)
let rollData = message.getFlag("world", "rolldata")
let actor = this.getActorFromRollData(rollData)
actor.incDecDestin(-1)
rollData.isReroll = true
this.rollMalefices(rollData)
}) })
html.on("click", '.roll-defense-melee', event => {
let rollId = $(event.currentTarget).data("roll-id")
let rollData = MaleficesUtility.getRollData(rollId)
rollData.defenseWeaponId = $(event.currentTarget).data("defense-weapon-id")
let actor = game.canvas.tokens.get(rollData.defenderTokenId).actor
if (actor && (game.user.isGM || actor.isOwner)) {
actor.rollDefenseMelee(rollData)
}
})
html.on("click", '.roll-defense-ranged', event => {
let rollId = $(event.currentTarget).data("roll-id")
let rollData = MaleficesUtility.getRollData(rollId)
let defender = game.canvas.tokens.get(rollData.defenderTokenId).actor
if (defender && (game.user.isGM || defender.isOwner)) {
defender.rollDefenseRanged(rollData)
}
})
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -418,7 +410,7 @@ export class MaleficesUtility {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static getArmorPenalty( item ) { static getArmorPenalty(item) {
if (item && (item.type == "shield" || item.type == "armor")) { if (item && (item.type == "shield" || item.type == "armor")) {
return __armorPenalties[item.system.category] return __armorPenalties[item.system.category]
} }
@ -470,59 +462,38 @@ export class MaleficesUtility {
} }
} }
/* -------------------------------------------- */
static updateSkill(skill) {
skill.system.level = skill.system.background + skill.system.basic + skill.system.class + skill.system.explevel
if (skill.system.level > 7) { skill.system.level = 7 }
skill.system.skilldice = __skillLevel2Dice[skill.system.level]
}
/* -------------------------------------------- */
static getDiceFromCover(cover) {
if (cover == "cover50") return 1
return 0
}
/* -------------------------------------------- */
static getDiceFromSituational(cover) {
if (cover == "prone") return 1
if (cover == "dodge") return 1
if (cover == "moving") return 1
if (cover == "engaged") return 1
return 0
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static async rollMalefices(rollData) { static async rollMalefices(rollData) {
let actor = game.actors.get(rollData.actorId) let actor = game.actors.get(rollData.actorId)
// Build the dice formula // Build the dice formula
let diceFormula = "1d20" let diceFormula = "1d20"
rollData.target = rollData.attr.value + rollData.bonusMalusPerso + rollData.bonusMalusSituation + rollData.bonusMalusDef rollData.target = rollData.attr.value + rollData.bonusMalusPerso + rollData.bonusMalusSituation + rollData.bonusMalusDef
if (rollData.attr.abbrev == "physique") {
rollData.target += rollData.phyMalus
}
rollData.diceFormula = diceFormula rollData.diceFormula = diceFormula
// Performs roll // Performs roll
console.log("Roll formula", diceFormula) console.log("Roll formula", diceFormula)
let myRoll = rollData.roll let myRoll = new Roll(diceFormula).roll({ async: false })
if (!myRoll) { // New rolls only of no rerolls await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
myRoll = new Roll(diceFormula).roll({ async: false })
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
}
rollData.roll = myRoll rollData.roll = myRoll
rollData.isSuccess = false rollData.isSuccess = false
if (myRoll.total <= rollData.target ) { if (myRoll.total <= rollData.target) {
rollData.isSuccess = true rollData.isSuccess = true
} }
if (myRoll.total == 1 ) { if (myRoll.total == 1) {
rollData.isSuccess = true rollData.isSuccess = true
rollData.isCritical = true rollData.isCritical = true
} }
if (myRoll.total == 20 ) { if (myRoll.total == 20) {
rollData.isSuccess = false rollData.isSuccess = false
rollData.isFumble = true rollData.isFumble = true
} }
if (myRoll.total <= Math.floor(rollData.target/3) ) { if (myRoll.total <= Math.floor(rollData.target / 3)) {
rollData.isPart = true rollData.isPart = true
} }
@ -531,7 +502,7 @@ export class MaleficesUtility {
}) })
msg.setFlag("world", "rolldata", rollData) msg.setFlag("world", "rolldata", rollData)
if (rollData.mode == "initiative") { if (rollData.mode == "initiative") {
actor.setFlag("world", "initiative", myRoll.total) actor.setFlag("world", "initiative", myRoll.total)
} }
console.log("Rolldata result", rollData) console.log("Rolldata result", rollData)

View File

@ -1229,7 +1229,7 @@ ul, li {
} }
.items-title-bg { .items-title-bg {
margin-top: 6px; margin-top: 6px;
background: black; background-color:#252525;
color: white; color: white;
} }
.items-title-text { .items-title-text {

View File

@ -37,7 +37,7 @@
], ],
"title": "Maléfices, le Jeu de Rôle", "title": "Maléfices, le Jeu de Rôle",
"url": "https://www.uberwald.me/gitea/public/fvtt-malefices", "url": "https://www.uberwald.me/gitea/public/fvtt-malefices",
"version": "10.0.1", "version": "10.0.2",
"download": "https://www.uberwald.me/gitea/public/fvtt-malefices/archive/fvtt-malefices-v10.0.1.zip", "download": "https://www.uberwald.me/gitea/public/fvtt-malefices/archive/fvtt-malefices-v10.0.2.zip",
"background": "systems/fvtt-malefices/images/ui/malefice_welcome_page.webp" "background": "systems/fvtt-malefices/images/ui/malefice_welcome_page.webp"
} }

View File

@ -97,13 +97,18 @@
"Item": { "Item": {
"types": [ "types": [
"arme", "arme",
"equipement" "equipement",
"tarot"
], ],
"templates": { "templates": {
}, },
"equipement" : { "equipement" : {
"description": "" "description": ""
}, },
"tarot" : {
"tarottype": "",
"description": ""
},
"arme" : { "arme" : {
"armetype": 0, "armetype": 0,
"dommagenormale": 0, "dommagenormale": 0,

View File

@ -15,6 +15,7 @@
</div> </div>
</div> </div>
</div> </div>
</header> </header>
{{!-- Sheet Tab Navigation --}} {{!-- Sheet Tab Navigation --}}
@ -30,6 +31,7 @@
{{!-- Skills Tab --}} {{!-- Skills Tab --}}
<div class="tab main" data-group="primary" data-tab="main"> <div class="tab main" data-group="primary" data-tab="main">
<div class="grid grid-2col"> <div class="grid grid-2col">
<div> <div>
@ -46,8 +48,19 @@
{{#if attr.hasmax}} {{#if attr.hasmax}}
<input type="text" class="item-field-label-short" name="system.attributs.{{key}}.max" value="{{attr.max}}" data-dtype="Number"/> <input type="text" class="item-field-label-short" name="system.attributs.{{key}}.max" value="{{attr.max}}" data-dtype="Number"/>
{{/if}} {{/if}}
{{#if (eq key "physique")}}
{{#if @root.phyMalus}}
({{@root.phyMalus}})
{{/if}}
{{/if}}
</li> </li>
{{/each}} {{/each}}
<li class="item flexrow list-item">
<span class="item-field-label-long">Points de Destin</span>
<input type="text" class="item-field-label-short" name="system.pointdestin" value="{{system.pointdestin}}" data-dtype="Number"/>
</li>
</ul> </ul>
</div> </div>
@ -216,15 +229,19 @@
<div class="tab notes" data-group="primary" data-tab="notes"> <div class="tab notes" data-group="primary" data-tab="notes">
<hr> <hr>
<h3>Background : </h3> <span class="item-name-label-header items-title-bg">
<h3><label class="items-title-text">Background</label></h3>
</span>
<div class="form-group editor"> <div class="form-group editor">
{{editor data.biodata.description target="system.biodata.description" button=true owner=owner {{editor description target="system.biodata.description" button=true owner=owner
editable=editable}} editable=editable}}
</div> </div>
<hr> <hr>
<h3>Notes : </h3> <span class="item-name-label-header items-title-bg">
<h3><label class="items-title-text">Notes</label></h3>
</span>
<div class="form-group editor"> <div class="form-group editor">
{{editor data.biodata.notes target="system.biodata.notes" button=true owner=owner editable=editable}} {{editor notes target="system.biodata.notes" button=true owner=owner editable=editable}}
</div> </div>
<hr> <hr>
</article> </article>

View File

@ -63,6 +63,13 @@
{{/if}} {{/if}}
{{/if}} {{/if}}
{{#if isReroll}}
{{else}}
{{#if destin}}
<button class="chat-card-button roll-destin">Relancer (1 Destin)</button>
{{/if}}
{{/if}}
</ul> </ul>
</div> </div>

View File

@ -11,7 +11,14 @@
{{#if attr}} {{#if attr}}
<div class="flexrow"> <div class="flexrow">
<span class="roll-dialog-label">{{attr.label}} : </span> <span class="roll-dialog-label">{{attr.label}} : </span>
<span class="roll-dialog-label">{{attr.value}}</span> <span class="roll-dialog-label">
{{attr.value}}
{{#if (eq attr.abbrev "physique")}}
{{#if phyMalus}}
({{phyMalus}})
{{/if}}
{{/if}}
</span>
</div> </div>
{{/if}} {{/if}}
@ -58,7 +65,7 @@
</select> </select>
</div> </div>
{{/if}} {{/if}}
</div> </div>
</form> </form>