v10/v11 compat

This commit is contained in:
2023-05-25 16:22:02 +02:00
parent 29ff86f4bd
commit 6e5bb5da32
6 changed files with 27 additions and 51 deletions

View File

@@ -122,7 +122,7 @@ export class SoSUtility {
let trappings = items.filter( item => item.type == 'gear' || item.type == 'armor' || item.type == 'weapon' );
let sumEnc = 0;
for (let object of trappings) {
if ( (!object.data.worn) && (!object.data.neg) && (!object.data.software) && (!object.data.implant) && (!object.data.containerid || object.data.containerid == "") ) {
if ( (!object.system.worn) && (!object.system.neg) && (!object.system.software) && (!object.system.implant) && (!object.system.containerid || object.system.containerid == "") ) {
sumEnc += (object.big > 0) ? object.big : 1;
}
}
@@ -275,20 +275,20 @@ export class SoSUtility {
}
// DR management
let armor = flipData.target.actor.data.items.find( item => item.type == 'armor' && item.data.worn);
flipData.armorDR = armor ? armor.data.dr : 0;
flipData.armorGel = armor ?armor.data.gel : 0;
flipData.armorReflect = armor ? armor.data.reflect : 0;
let dr = flipData.target.actor.data.data.scores.dr.value + flipData.armorDR;
if (flipData.weapon.data.category == 'ballistic') {
let armor = flipData.target.actor.system.items.find( item => item.type == 'armor' && item.system.worn);
flipData.armorDR = armor ? armor.system.dr : 0;
flipData.armorGel = armor ?armor.system.gel : 0;
flipData.armorReflect = armor ? armor.system.reflect : 0;
let dr = flipData.target.actor.system.scores.dr.value + flipData.armorDR;
if (flipData.weapon.system.category == 'ballistic') {
dr += flipData.armorGel;
}
if (flipData.weapon.data.category == 'laser') {
if (flipData.weapon.system.category == 'laser') {
dr += flipData.armorReflect;
}
let shock = flipData.target.actor.data.data.scores.shock.value || 1;
let defenseCritical = flipData.target.actor.data.data.scores.defense.critical;
let shock = flipData.target.actor.system.scores.shock.value || 1;
let defenseCritical = flipData.target.actor.system.scores.defense.critical;
flipData.damageStatus = 'apply_damage';
flipData.targetShock = shock;
@@ -341,17 +341,17 @@ export class SoSUtility {
// Is target able to dodge ??
let defender = game.actors.get( flipData.target.actor._id);
flipData.coverConsequence = defender.data.items.find( item => item.type == 'consequence' && item.name == 'Cover');
flipData.APavailable = game.combat.getAPFromActor( defender.data._id );
flipData.coverConsequence = defender.items.find( item => item.type == 'consequence' && item.name == 'Cover');
flipData.APavailable = game.combat.getAPFromActor( defender._id );
console.log("FLIPDATE : ", flipData);
if ( !flipData.isReaction && flipData.APavailable > 0) {
if ( (flipData.weapon.data.category == 'melee' ) || ( (flipData.weapon.data.category == 'laser' || flipData.weapon.data.category == 'ballistic') &&
flipData.coverConsequence.data.severity != 'none') ) {
flipData.coverSeverityLevel = this.getConsequenceSeverityLevel( flipData.coverConsequence.data.severity ) * 2;
if ( (flipData.weapon.system.category == 'melee' ) || ( (flipData.weapon.system.category == 'laser' || flipData.weapon.system.category == 'ballistic') &&
flipData.coverConsequence.system.severity != 'none') ) {
flipData.coverSeverityLevel = this.getConsequenceSeverityLevel( flipData.coverConsequence.system.severity ) * 2;
flipData.coverSeverityFlag = (flipData.coverSeverityLevel > 0);
flipData.isMelee = (flipData.weapon.data.category == 'melee' );
let melee = defender.data.items.find( item => item.type == 'skill' && item.name == 'Melee');
flipData.defenderMelee = melee.data.value;
flipData.isMelee = (flipData.weapon.system.category == 'melee' );
let melee = defender.items.find( item => item.type == 'skill' && item.name == 'Melee');
flipData.defenderMelee = melee.system.value;
flipData.uniqId = randomID(16);
this.registry[flipData.uniqId] = flipData;
let html = await renderTemplate('systems/foundryvtt-shadows-over-sol/templates/chat-damage-request-dodge.html', flipData );