v10/v11 compat

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

View File

@ -64,12 +64,12 @@ export class SoSActorSheet extends ActorSheet {
formData.gearsRoot = formData.gears.filter(item => item.system.containerid == "");
for ( let container of formData.gearsRoot) {
if ( container.type == 'container') {
container.data.contains = []
container.data.containerEnc = 0;
container.system.contains = []
container.system.containerEnc = 0;
for (let gear of formData.gears) {
console.log("GEAR", gear, container)
if ( gear.system.containerid == container.id) {
container.data.contains.push( gear )
container.system.contains.push( gear )
if ( !gear.system.neg && !gear.system.software ) {
container.system.containerEnc += (gear.system.big > 0) ? gear.system.big : 1;
}

View File

@ -1,24 +0,0 @@
html.find('.item .item-name h4').click(event => this._onItemSummary(event));
/**
* Handle toggling of an item from the Actor sheet
* @private
*/
_onItemSummary(event) {
event.preventDefault();
let li = $(event.currentTarget).parents(".item"),
item = this.actor.getOwnedItem(li.data("item-id"));
// Toggle summary
if (item.data.data.description !== undefined && item.data.data.description !== null){
if ( li.hasClass("expanded") ) {
let summary = li.children(".item-summary");
summary.slideUp(200, () => summary.remove());
} else {
let div = $(`<div class="item-summary">${item.data.data.description}</div>`);
li.append(div.hide());
div.slideDown(200);
}
li.toggleClass("expanded");
}
}

View File

@ -247,7 +247,7 @@ export class SoSCardDeck {
if ( flipData.mode == 'stat' || flipData.mode == 'weapon' ) {
flipData.baseScore = flipData.stat.value + flipData.malusConsequence + flipData.bonusConsequence + flipData.woundMalus;
} else if (flipData.mode == 'skill') {
flipData.baseScore = Math.floor(flipData.stat.value/2) + flipData.skill.data.value + flipData.malusConsequence + flipData.bonusConsequence + flipData.woundMalus;
flipData.baseScore = Math.floor(flipData.stat.value/2) + flipData.skill.system.value + flipData.malusConsequence + flipData.bonusConsequence + flipData.woundMalus;
}
flipData.finalScore = flipData.baseScore + flipData.cardTotal + Number(flipData.modifier);
flipData.magnitude = flipData.finalScore - flipData.tn;
@ -272,10 +272,10 @@ export class SoSCardDeck {
async processWeapon( flipData ) {
flipData.damageCardsuit = flipData.cardSlot[flipData.cardSlotIndex].cardsuit;
let damageKey = 'damage_'+ flipData.damageCardsuit;
flipData.damageString = flipData.weapon.data[damageKey];
flipData.damageString = flipData.weapon.system[damageKey];
if (flipData.damageString.includes('Str') ) {
let damageRegexp = flipData.damageString.match( /Str([\d])?\+?([\d])?([LMSC])/i );
flipData.damageValue = (flipData.actor.data.data.stats.strength.value * Number(damageRegexp[1]?damageRegexp[1]:1)) + Number(damageRegexp[2]?damageRegexp[2]:0);
flipData.damageValue = (flipData.actor.system.stats.strength.value * Number(damageRegexp[1]?damageRegexp[1]:1)) + Number(damageRegexp[2]?damageRegexp[2]:0);
flipData.damageSeverity = damageRegexp[3];
} else {
let damageRegexp = flipData.damageString.match( /(\d*)([LMSC])/i );

View File

@ -16,7 +16,7 @@ export class SoSCombat extends Combat {
this.setInitiative(combatant.id, -1); // Reset init
let uniq = randomID(16)
const name = combatant.actor ? combatant.actor.name : combatant.name;
if (combatant.players && combatant.players[0]) {
if (combatant.players && combatant.players[0] ) {
// A player controls this combatant -> message !
ChatMessage.create({
content: `New round ! Click on the button below to declare the actions of ${name} for round ${this.round} !<br>

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 );

View File

@ -4,7 +4,7 @@
"description": "Shadows over Sol for FoundryVTT",
"url": "https://www.uberwald.me/gitea/public/foundryvtt-shadows-over-sol/",
"license": "LICENSE.txt",
"version": "11.0.0",
"version": "11.0.1",
"compatibility": {
"minimum": "10",
"verified": "10",
@ -109,7 +109,7 @@
],
"socket": true,
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-shadows-over-sol/raw/branch/v10/system.json",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-shadows-over-sol/archive/foundryvtt-shadows-over-sol-11.0.0.zip",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-shadows-over-sol/archive/foundryvtt-shadows-over-sol-11.0.1.zip",
"gridDistance": 5,
"gridUnits": "ft"
}