Possessions dans HUD

Permettre de commencer les possessions V2
This commit is contained in:
2025-12-06 21:12:25 +01:00
parent 98e8c7a10c
commit 05036877ed
7 changed files with 47 additions and 26 deletions
+6
View File
@@ -1,5 +1,11 @@
# 13.0 # 13.0
## 13.0.21 - La folie d'Illysis
- Fenêtre de jet v2
- les possessions sont maintenant gérées avec les fenêtres V2
- on peut choisir sa voie de draconic pour contrer une possession ou conjurer
## 13.0.20 - L'immobilisme d'Illysis ## 13.0.20 - L'immobilisme d'Illysis
- Centrage du logo de pause - Centrage du logo de pause
+2 -2
View File
@@ -121,7 +121,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
getDraconicOuPossession() { getDraconicOuPossession() {
return [ return [
...this.getDraconics(), ...this.getDraconics(),
...this.itemTypes[ITEM_TYPES.competencecreature].filter(it => it.system.ispossession || it.system.categorie == CATEGORIES_COMPETENCES_CREATURES.possession.key), ...this.itemTypes[ITEM_TYPES.competencecreature].filter(it => it.isCompetencePossession()),
this.getConjurationNaturelle() this.getConjurationNaturelle()
].sort(Misc.descending(it => it.system.niveau)); ].sort(Misc.descending(it => it.system.niveau));
} }
@@ -164,7 +164,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
return this.itemTypes[ITEM_TYPES.competencecreature] return this.itemTypes[ITEM_TYPES.competencecreature]
.filter(it => it.isAttaque()) .filter(it => it.isAttaque())
.map(it => it.attaqueCreature()) .map(it => it.attaqueCreature())
.filter(it => it != undefined); .filter(it => it != undefined)
} }
async computeArmure(dmg) { return this.getProtectionNaturelle() } async computeArmure(dmg) { return this.getProtectionNaturelle() }
+2 -5
View File
@@ -220,6 +220,7 @@ export class RdDBaseActor extends Actor {
isEntite() { return false } isEntite() { return false }
isEntiteIncarnee() { return false } isEntiteIncarnee() { return false }
isEntiteNonIncarnee() { return false } isEntiteNonIncarnee() { return false }
isEntiteBlurette() { return false }
isHautRevant() { return false } isHautRevant() { return false }
isVehicule() { return false } isVehicule() { return false }
isPersonnage() { return false } isPersonnage() { return false }
@@ -848,6 +849,7 @@ export class RdDBaseActor extends Actor {
listActionsPossessions() { listActionsPossessions() {
return this.itemTypes[ITEM_TYPES.possession] return this.itemTypes[ITEM_TYPES.possession]
.filter(it => !it.system.possede)
.map(p => { .map(p => {
return { return {
label: p.name, label: p.name,
@@ -856,9 +858,4 @@ export class RdDBaseActor extends Actor {
} }
}) })
} }
listActionsCombat() {
const possessions = this.listActionsPossessions()
return possessions.length > 0 ? possessions : this.listActions({})
}
} }
+11 -2
View File
@@ -19,8 +19,8 @@ export class RdDEntite extends RdDBaseActorReve {
isEntite() { return true } isEntite() { return true }
isEntiteNonIncarnee() { return this.system.definition.typeentite == ENTITE_NONINCARNE } isEntiteNonIncarnee() { return this.system.definition.typeentite == ENTITE_NONINCARNE }
isEntiteIncarnee() { return [ENTITE_INCARNE, ENTITE_BLURETTE].includes(this.system.definition.typeentite) } isEntiteIncarnee() { return !this.isEntiteNonIncarnee() }
isEntiteBlurette() { return this.system.definition.typeentite !== ENTITE_BLURETTE } isEntiteBlurette() { return this.system.definition.typeentite == ENTITE_BLURETTE }
getReveActuel() { getReveActuel() {
return Misc.toInt(this.system.carac.reve?.value) return Misc.toInt(this.system.carac.reve?.value)
@@ -101,6 +101,15 @@ export class RdDEntite extends RdDBaseActorReve {
return true return true
} }
listActionsPossessions() {
if (this.isEntiteNonIncarnee()) {
return this.itemTypes[ITEM_TYPES.competencecreature]
.filter(it => it.system.ispossession)
.map(it => it.attaqueCreature())
.filter(it => it != undefined)
}
return super.listActionsPossessions()
}
/* -------------------------------------------- */ /* -------------------------------------------- */
async setEntiteReveAccordee(actor) { async setEntiteReveAccordee(actor) {
if (this.isEntiteIncarnee()) { if (this.isEntiteIncarnee()) {
+1 -1
View File
@@ -205,7 +205,7 @@ export class RdDItem extends Item {
return this.isCompetence() && ['melee', 'tir', 'lancer'].includes(this.system.categorie) return this.isCompetence() && ['melee', 'tir', 'lancer'].includes(this.system.categorie)
} }
isCompetencePossession() { return ITEM_TYPES.competencecreature == this.type && this.system.categorie == "possession" } isCompetencePossession() { return ITEM_TYPES.competencecreature == this.type && this.system.categorie == CATEGORIES_COMPETENCES_CREATURES.possession.key }
isTemporel() { return typesObjetsTemporels.includes(this.type) } isTemporel() { return typesObjetsTemporels.includes(this.type) }
isOeuvre() { return typesObjetsOeuvres.includes(this.type) } isOeuvre() { return typesObjetsOeuvres.includes(this.type) }
isDraconique() { return RdDItem.getItemTypesDraconiques().includes(this.type) } isDraconique() { return RdDItem.getItemTypesDraconiques().includes(this.type) }
+17 -5
View File
@@ -34,7 +34,7 @@ export class RdDTokenHud {
const actor = RdDCombatManager.getActorCombatant(combatant, { warning: false }) const actor = RdDCombatManager.getActorCombatant(combatant, { warning: false })
if (actor) { if (actor) {
if (OptionsAvancees.isUsing(ROLL_DIALOG_V2)) { if (OptionsAvancees.isUsing(ROLL_DIALOG_V2)) {
await RdDTokenHud.addExtensionHudCombat(html, combatant, actor, token) await RdDTokenHud.addExtensionHudCombatV2(html, combatant, actor, token)
} }
else { else {
const actions = RdDCombatManager.listActionsActorCombatant(actor) const actions = RdDCombatManager.listActionsActorCombatant(actor)
@@ -47,17 +47,28 @@ export class RdDTokenHud {
} }
} }
static async addExtensionHudCombat(html, combatant, actor, token) { static async addExtensionHudCombatV2(html, combatant, actor, token) {
const actionsActor = actor.listActionsCombat(); const isPossession = actor.listActionsPossessions().length > 0;
const actionsCombat = isPossession ? [] : actor.listAttaques()
const ajustements = combatant?.initiative ? const ajustements = combatant?.initiative ?
[ [
{ label: 'Initiative +1', action: 'delta', value: 1 }, { label: 'Initiative +1', action: 'delta', value: 1 },
{ label: 'Initiative -1', action: 'delta', value: -1 } { label: 'Initiative -1', action: 'delta', value: -1 }
] : [] ] : []
const autres = [{ label: "Autre action", action: 'autre' }] const autres = [{ label: "Autre action", action: 'autre' }]
const actions = Misc.indexed(actionsActor.concat(ajustements).concat(autres)) const actions = Misc.indexed([
...actionsCombat,
...ajustements,
...autres
])
const hudData = { combatant, token, actions }; const hudData = {
combatant,
token,
isPossession,
isEntiteNonIncarnee: actor.isEntiteNonIncarnee(),
actions,
};
const hud = $(await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/hud-actor-combat.hbs', hudData)) const hud = $(await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/hud-actor-combat.hbs', hudData))
$(html).find('div.col.left').append(hud) $(html).find('div.col.left').append(hud)
@@ -84,6 +95,7 @@ export class RdDTokenHud {
} }
}) })
list.find('.rdd-attaque-v2').click(event => combatant.actor.rollAttaque(token)) list.find('.rdd-attaque-v2').click(event => combatant.actor.rollAttaque(token))
list.find('.rdd-possession-v2').click(event => combatant.actor.rollPossession())
} }
static async addExtensionHudInit(html, combatant, actions) { static async addExtensionHudInit(html, combatant, actions) {
+8 -11
View File
@@ -1,4 +1,3 @@
{{log this}}
<div class="control-icon rdd-combat "> <div class="control-icon rdd-combat ">
<img class="rdd-hud-togglebutton" <img class="rdd-hud-togglebutton"
src="systems/foundryvtt-reve-de-dragon/icons/heures/hd06.svg" width="36" height="36" src="systems/foundryvtt-reve-de-dragon/icons/heures/hd06.svg" width="36" height="36"
@@ -7,7 +6,6 @@
<div class="control-icon token-hud-icon select-init-v2"> <div class="control-icon token-hud-icon select-init-v2">
<i class="fa-solid fa-dice-d6"></i> <i class="fa-solid fa-dice-d6"></i>
<select name="initiative"> <select name="initiative">
{{log combatant}}
<option value="">{{#if combatant.system.init}} <option value="">{{#if combatant.system.init}}
{{combatant.system.init.value}} {{combatant.system.init.label}} {{combatant.system.init.value}} {{combatant.system.init.label}}
{{else}}Initiative...{{/if}} {{else}}Initiative...{{/if}}
@@ -15,20 +13,19 @@
{{selectOptions actions selected='' valueAttr='index' labelAttr='label'}} {{selectOptions actions selected='' valueAttr='index' labelAttr='label'}}
</select> </select>
</div> </div>
{{#if isPossession}}
{{!-- <div class="control-icon token-hud-icon rdd-init-v2" <div class="control-icon token-hud-icon rdd-possession-v2"
data-combatant-id="{{../combatant.id}}" data-action="possession"
data-action="initiative" data-tooltip="{{#if isEntiteNonIncarnee}}Possession{{else}}Conjuration{{/if}}">
data-tooltip="Choisir l'initiative"> <label><i class="fa-solid fa-sword"></i> {{#if isEntiteNonIncarnee}}Posséder{{else}}Conjurer{{/if}}</label>
<label><i class="fa-solid fa-dice-d6"></i><span> Initiative</span></label> </div>
</div> --}} {{else}}
<div class="control-icon token-hud-icon rdd-attaque-v2" <div class="control-icon token-hud-icon rdd-attaque-v2"
data-combatant-id="{{../combatant.id}}"
data-action="attaque" data-action="attaque"
data-tooltip="Attaquer la cible"> data-tooltip="Attaquer la cible">
<label><i class="fa-solid fa-sword"></i> Attaquer</label> <label><i class="fa-solid fa-sword"></i> Attaquer</label>
</div> </div>
{{/if}}
</div> </div>
</div> </div>