forked from public/foundryvtt-reve-de-dragon
Continue fight tests
This commit is contained in:
@ -19,6 +19,7 @@ export class RdDActor extends Actor {
|
||||
* @param {Object} options (Unused) Additional options which customize the creation workflow.
|
||||
*
|
||||
*/
|
||||
|
||||
static async create(data, options) {
|
||||
// If the created actor has items (only applicable to duplicated actors) bypass the new actor creation logic
|
||||
if (data.items) {
|
||||
@ -26,8 +27,6 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
super.create(data, options);
|
||||
|
||||
// Create flags data
|
||||
await this.setFlag("foundryvtt-reve-de-dragon", "rollData", {} );
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -72,24 +71,30 @@ export class RdDActor extends Actor {
|
||||
xpmsg = "<br>Points d'expérience gagné ! " + xpcarac + " - " + xpcomp;
|
||||
}
|
||||
rollData.pointsDeTache = 4;
|
||||
rollData.qualite = 2;
|
||||
} else if (result <= (rollData.rollTarget.score /2) ) {
|
||||
quality = "Réussite Significative";
|
||||
rollData.pointsDeTache = 2;
|
||||
rollData.qualite = 1;
|
||||
} else if (result <= (rollData.rollTarget.score) ) {
|
||||
quality = "Réussite Normale";
|
||||
rollData.pointsDeTache = 1;
|
||||
rollData.qualite = 0;
|
||||
} else if (result < (rollData.rollTarget.epart) ) {
|
||||
quality = "Echec Normal";
|
||||
rollData.pointsDeTache = 0;
|
||||
rollData.qualite = -2;
|
||||
} else if (result < (rollData.rollTarget.etotal) ) {
|
||||
quality = "Echec Particulier";
|
||||
rollData.pointsDeTache = -2;
|
||||
rollData.qualite = -4;
|
||||
} else if (result >= (rollData.rollTarget.etotal) ) {
|
||||
quality = "Echec Total";
|
||||
rollData.pointsDeTache = -4;
|
||||
rollData.qualite = -6;
|
||||
}
|
||||
|
||||
// Weapon management
|
||||
// Fight management !
|
||||
let defenseMsg;
|
||||
let specialStr = "<br>Points de taches : " + rollData.pointsDeTache; // Per default
|
||||
if ( rollData.arme ) { // In case of fight, replace the "tache" per dommages + localization. "tache" indicates if result is OK or not
|
||||
@ -99,12 +104,8 @@ export class RdDActor extends Actor {
|
||||
rollData.degats = parseInt(myroll.result) + parseInt(rollData.arme.data.dommages) + parseInt(this.data.data.attributs.plusdom.value);
|
||||
rollData.loc = RdDUtility.getLocalisation();
|
||||
for (let target of game.user.targets) {
|
||||
console.log("Target", target);
|
||||
defenseMsg = RdDutility.buildDefenseChatCard(this, target, rollData );
|
||||
specialStr = "<br><strong>Cible</strong> : " + target.actor.data.name;
|
||||
defenseMsg = { title: "Défense en combat",
|
||||
content: "Action de défense en combat!<br><span class='chat-card-button-area'><a class='chat-card-button' id='encaisser-button' data-attackerid='"+
|
||||
this.data._id + "' data-defenderid='" + target.actor.data._id + "'>Encaisser !</a></span>",
|
||||
whisper: ChatMessage.getWhisperRecipients(target.actor.data.name) };
|
||||
}
|
||||
specialStr += "<br>Dommages : " + rollData.degats + "<br>Localisation : " + rollData.loc.label;
|
||||
} else {
|
||||
@ -115,7 +116,6 @@ export class RdDActor extends Actor {
|
||||
// Save it for fight
|
||||
await this.setFlag( "foundryvtt-reve-de-dragon", "rollData", undefined );
|
||||
await this.setFlag( "foundryvtt-reve-de-dragon", "rollData", rollData );
|
||||
console.log("MINE:", this);
|
||||
|
||||
let chatOptions = { content: "<strong>Test : " + rollData.selectedCarac.label + " / " + rollData.competence.name + "</strong><br>Jet : " +
|
||||
rollData.selectedCarac.value + " / " + rollData.finalLevelStr + " - " + rollData.rollTarget.score + "%<br><strong>Résutat : </strong>" + myroll.total + "<br>" +
|
||||
@ -255,14 +255,19 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollArme( armeName ) {
|
||||
rollArme( armeName )
|
||||
{
|
||||
let armeItem = RdDUtility.findCompetence( this.data.items, armeName );
|
||||
this.rollCompetence( armeItem.data.competence, armeItem );
|
||||
if ( armeItem && armeItem.data.competence )
|
||||
this.rollCompetence( armeItem.data.competence, armeItem );
|
||||
else
|
||||
this.rollCompetence( armeName ); //Bypass mode!
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollCompetence( compName, armeItem ) {
|
||||
|
||||
async rollCompetence( compName, armeItem )
|
||||
{
|
||||
console.log("!!!!!!", compName, armeItem);
|
||||
let compItem = RdDUtility.findCompetence( this.data.items, compName);
|
||||
let rollData = {
|
||||
"competence": compItem,
|
||||
@ -311,6 +316,12 @@ export class RdDActor extends Actor {
|
||||
this.sheet.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
parerAttaque( attackerActor, armeId )
|
||||
{
|
||||
console.log("Going to PARY !!!!!!!!!");
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
getRollData() {
|
||||
|
Reference in New Issue
Block a user