ajout item sur cellule + augmentation bonus et difficultés

This commit is contained in:
2024-08-22 14:39:30 +02:00
parent 4eece5aaf4
commit 8a4487c833
71 changed files with 484 additions and 325 deletions

View File

@@ -67,6 +67,10 @@ export class HawkmoonActor extends Actor {
/* -------------------------------------------- */
prepareArme(arme) {
if (this.type == "cellule") {
return arme
}
arme = foundry.utils.duplicate(arme)
let combat = this.getCombatValues()
if (arme.system.typearme == "contact" || arme.system.typearme == "contactjet") {
@@ -202,6 +206,20 @@ export class HawkmoonActor extends Actor {
/* -------------------------------------------- */
getCombatValues() {
if (this.type == "cellule"){
return {
initBase: 0,
initTotal: 0,
bonusDegats: 0,
bonusDegatsTotal: 0,
vitesseBase: 0,
vitesseTotal: 0,
defenseBase: 0,
protection: 0,
defenseTotal: 0
}
}
let combat = {
initBase: this.system.attributs.adr.value,
initTotal: this.system.attributs.adr.value + this.system.combat.initbonus,

View File

@@ -7,7 +7,7 @@ import { HawkmoonUtility } from "./hawkmoon-utility.js";
import { HawkmoonAutomation } from "./hawkmoon-automation.js";
/* -------------------------------------------- */
const __ALLOWED_ITEM_CELLULE = { "talent": 1, "ressource": 1, "contact": 1}
const __ALLOWED_ITEM_CELLULE = { "talent": 1, "ressource": 1, "contact": 1, "equipement": 1, "protection": 1, "artefact": 1, "arme": 1, "monnaie": 1 }
/* -------------------------------------------- */
export class HawkmoonCelluleSheet extends ActorSheet {
@@ -45,6 +45,13 @@ export class HawkmoonCelluleSheet extends ActorSheet {
ressources: foundry.utils.duplicate(this.actor.getRessources()),
contacts: foundry.utils.duplicate(this.actor.getContacts()),
members: this.getMembers(),
equipements: foundry.utils.duplicate(this.actor.getEquipments()),
artefacts: foundry.utils.duplicate(this.actor.getArtefacts()),
armes: foundry.utils.duplicate(this.actor.getWeapons()),
monnaies: foundry.utils.duplicate(this.actor.getMonnaies()),
protections: foundry.utils.duplicate(this.actor.getArmors()),
richesse: this.actor.computeRichesse(),
valeurEquipement: this.actor.computeValeurEquipement(),
description: await TextEditor.enrichHTML(this.object.system.description, { async: true }),
options: this.options,
owner: this.document.isOwner,
@@ -110,15 +117,15 @@ export class HawkmoonCelluleSheet extends ActorSheet {
let value = ev.currentTarget.value
this.actor.editItemField(itemId, itemType, itemField, dataType, value)
})
html.find('.quantity-minus').click(event => {
const li = $(event.currentTarget).parents(".item");
this.actor.incDecQuantity(li.data("item-id"), -1);
});
html.find('.quantity-plus').click(event => {
const li = $(event.currentTarget).parents(".item");
this.actor.incDecQuantity(li.data("item-id"), +1);
});
html.find('.quantity-modify').click(event => {
const li = $(event.currentTarget).parents(".item")
const value = Number($(event.currentTarget).data("quantite-value"))
this.actor.incDecQuantity( li.data("item-id"), value );
})
html.find('.item-add').click((event) => {
const itemType = $(event.currentTarget).data("type")
this.actor.createEmbeddedDocuments('Item', [{ name: `Nouveau ${itemType}`, type: itemType }], { renderSheet: true })
})
html.find('.lock-unlock-sheet').click((event) => {
this.options.editScore = !this.options.editScore;
@@ -149,7 +156,7 @@ export class HawkmoonCelluleSheet extends ActorSheet {
super._onDropItem(event, dragData)
return
}
ui.notifications("Ce type d'item n'est pas autorisé sur une Cellule.")
ui.notification.info("Ce type d'item n'est pas autorisé sur une Cellule.")
}

View File

@@ -3,10 +3,30 @@ export const HAWKMOON_CONFIG = {
optionsDifficulte: [
{ key: "0", label: "Aucune/Inconnue" },
{ key: "5", label: "Facile (5)" },
{ key: "6", label: "(6)" },
{ key: "7", label: "(7)" },
{ key: "8", label: "(8)" },
{ key: "9", label: "(9)" },
{ key: "10", label: "Moyenne (10)" },
{ key: "11", label: "(11)" },
{ key: "12", label: "(12)" },
{ key: "13", label: "(13)" },
{ key: "14", label: "(14)" },
{ key: "15", label: "Ardue (15)" },
{ key: "16", label: "(16)" },
{ key: "17", label: "(17)" },
{ key: "18", label: "(18)" },
{ key: "19", label: "(19)" },
{ key: "20", label: "Hasardeuse (20)" },
{ key: "21", label: "(21)" },
{ key: "22", label: "(22)" },
{ key: "23", label: "(23)" },
{ key: "24", label: "(24)" },
{ key: "25", label: "Insensée (25)" },
{ key: "26", label: "(26)" },
{ key: "27", label: "(27)" },
{ key: "28", label: "(28)" },
{ key: "29", label: "(29)" },
{ key: "30", label: "Pure Folie (30)" }
],
optionsDistanceTir: [
@@ -15,6 +35,12 @@ export const HAWKMOON_CONFIG = {
{ key: "porteelongue", label: "Longue ({protectionDefenseur}+14)" }
],
optionsBonusMalus: [
{ key: "-10", label: "-10" },
{ key: "-9", label: "-9" },
{ key: "-8", label: "-8" },
{ key: "-7", label: "-7" },
{ key: "-6", label: "-6" },
{ key: "-5", label: "-5" },
{ key: "-4", label: "-4" },
{ key: "-3", label: "-3" },
{ key: "-2", label: "-2" },
@@ -23,7 +49,13 @@ export const HAWKMOON_CONFIG = {
{ key: "1", label: "+1" },
{ key: "2", label: "+2" },
{ key: "3", label: "+3" },
{ key: "4", label: "+4" }
{ key: "4", label: "+4" },
{ key: "5", label: "+5" },
{ key: "6", label: "+6" },
{ key: "7", label: "+7" },
{ key: "8", label: "+8" },
{ key: "9", label: "+9" },
{ key: "10", label: "+10" }
],
optionsTailleCible: [
{ key: "normal", label: "Normal (SD+0)" },