changes for swade 5.2.2
This commit is contained in:
parent
f05465ef36
commit
93767cd0bb
11
CHANGELOG.md
11
CHANGELOG.md
@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [4.2.3]
|
||||
|
||||
### Changed
|
||||
|
||||
- Changed Deflection and Glow/Shroud target handling to use existing system
|
||||
modifiers (`system.stats.globalMods.targetAttack` and friends.
|
||||
- BREAKING CHANGE: removed special handling for Environmental Weakness and
|
||||
Environmental Resistance. Use an active effect with a change to
|
||||
`system.stats.globalMods.targetDamage` instead.
|
||||
- Updated minimum SWADE version to 5.2.2
|
||||
|
||||
## [4.2.2]
|
||||
|
||||
### Added
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
}
|
||||
],
|
||||
"url": "https://git.bloy.org/foundryvtt/swade-mb-helpers",
|
||||
"version": "4.2.2",
|
||||
"version": "4.2.3",
|
||||
"compatibility": {
|
||||
"minimum": "13",
|
||||
"verified": "13"
|
||||
@ -111,8 +111,8 @@
|
||||
"type": "system",
|
||||
"manifest": "https://gitlab.com/api/v4/projects/16269883/packages/generic/swade/latest/system.json",
|
||||
"compatibility": {
|
||||
"minimum": "5.2.0",
|
||||
"verified": "5.2.0"
|
||||
"minimum": "5.2.2",
|
||||
"verified": "5.2.2"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@ -344,7 +344,7 @@ export class PowerEffect {
|
||||
effects: {
|
||||
none: null,
|
||||
glow: {
|
||||
name: 'Glow',
|
||||
name: 'Glow (illumination bonus)',
|
||||
icon: 'icons/magic/light/orb-shadow-blue.webp',
|
||||
changes: [
|
||||
{
|
||||
@ -353,6 +353,12 @@ export class PowerEffect {
|
||||
priority: 0,
|
||||
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
|
||||
},
|
||||
{
|
||||
key: 'system.stats.globalMods.targetAttack',
|
||||
value: 1,
|
||||
priority: 0,
|
||||
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
|
||||
},
|
||||
],
|
||||
},
|
||||
shroud: {
|
||||
@ -365,6 +371,12 @@ export class PowerEffect {
|
||||
priority: 0,
|
||||
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
|
||||
},
|
||||
{
|
||||
key: 'system.stats.globalMods.targetAttack',
|
||||
value: -1,
|
||||
priority: 0,
|
||||
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
@ -44,6 +44,27 @@ export class DeflectionEffect extends PowerEffect {
|
||||
this.data.affects = this.data.button === 'raise' ? 'all' : this.data.button;
|
||||
}
|
||||
|
||||
getPrimaryEffectChanges() {
|
||||
const changes = super.getPrimaryEffectChanges();
|
||||
if (this.data.button === 'raise' || this.data.button === 'melee') {
|
||||
changes.push({
|
||||
key: 'system.stats.globalMods.targetAttackMelee',
|
||||
value: -2,
|
||||
priority: 0,
|
||||
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
|
||||
});
|
||||
}
|
||||
if (this.data.button === 'raise' || this.data.button === 'ranged') {
|
||||
changes.push({
|
||||
key: 'system.stats.globalMods.targetAttackRanged',
|
||||
value: -2,
|
||||
priority: 0,
|
||||
mode: foundry.CONST.ACTIVE_EFFECT_MODES.ADD,
|
||||
});
|
||||
}
|
||||
return changes;
|
||||
}
|
||||
|
||||
get effectName() {
|
||||
return `Deflection (${this.data.affects})`;
|
||||
}
|
||||
|
||||
@ -109,33 +109,6 @@ export async function preAttackRollModifiers(
|
||||
return;
|
||||
}
|
||||
|
||||
// Deflection
|
||||
if (isMeleeAttack && hasDeflection(targetToken, 'melee')) {
|
||||
additionalMods.push({ label: 'Target has melee deflection', value: -2 });
|
||||
}
|
||||
if (isMeleeAttack && hasDeflection(targetToken, 'range')) {
|
||||
additionalMods.push({ label: 'Target has ranged deflection', value: -2 });
|
||||
}
|
||||
if (hasDeflection(targetToken, 'all')) {
|
||||
additionalMods.push({ label: 'Target has deflection', value: -2 });
|
||||
}
|
||||
|
||||
// Glow/Shroud
|
||||
if (targetHasEffect(targetToken, 'glow')) {
|
||||
additionalMods.push({
|
||||
label: 'Glowing target (negate 1 point of illumination penalty)',
|
||||
value: 1,
|
||||
ignore: true,
|
||||
});
|
||||
}
|
||||
if (targetHasEffect(targetToken, 'shroud')) {
|
||||
additionalMods.push({
|
||||
label: 'Shrouded target',
|
||||
value: '-1',
|
||||
ignore: false,
|
||||
});
|
||||
}
|
||||
|
||||
// Swat correction
|
||||
const scaleMod = additionalMods.find((m) => m.label === 'SWADE.ScaleDifference');
|
||||
if (scaleMod && scaleMod.value < 0 && sourceToken.actor.getSingleItemBySwid('swat', 'ability')) {
|
||||
@ -172,6 +145,7 @@ function removeDuplicateMods(additionalMods, replacementModTitles) {
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
export async function preTraitRollModifiers(actor, trait, roll, modifiers, options) {
|
||||
console.log('PRE TRAIT ROLL', actor, trait, roll, modifiers, options);
|
||||
const targets = Array.from(game.user.targets);
|
||||
const token = game.canvas.tokens.controlled.length > 0 ? game.canvas.tokens.controlled[0]?.document : null;
|
||||
if (targets.length === 1 && token) {
|
||||
@ -187,26 +161,6 @@ export async function preDamageRollModifiers(actor, item, roll, modifiers, optio
|
||||
if (targets.length === 1 && token) {
|
||||
const target = targets[0].scene.tokens.get(targets[0].id);
|
||||
_addArcaneModifiers(target, modifiers);
|
||||
const weaknesses = target.actor.items.filter(
|
||||
(i) => i.type === 'ability' && i.system.swid.toLowerCase().includes('environmental-weakness'),
|
||||
);
|
||||
if (weaknesses.length > 0) {
|
||||
modifiers.push(
|
||||
...weaknesses.map((i) => {
|
||||
return { label: i.name, value: '+4', ignore: true };
|
||||
}),
|
||||
);
|
||||
}
|
||||
const resistances = target.actor.items.filter(
|
||||
(i) => i.type === 'ability' && i.system.swid.toLowerCase().includes('environmental-resistance'),
|
||||
);
|
||||
if (resistances.length > 0) {
|
||||
modifiers.push(
|
||||
...resistances.map((i) => {
|
||||
return { label: i.name, value: '-4', ignore: true };
|
||||
}),
|
||||
);
|
||||
}
|
||||
if (
|
||||
item.isMeleeWeapon &&
|
||||
'stats' in token.actor.system &&
|
||||
|
||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user