diff --git a/src/module/powers/powers.js b/src/module/powers/powers.js index ad77350..87aa50e 100644 --- a/src/module/powers/powers.js +++ b/src/module/powers/powers.js @@ -71,7 +71,7 @@ import { TelekinesisEffect } from './telekinesis.js'; import { TeleportEffect } from './teleport.js'; import { TimeStopEffect } from './timeStop.js'; import { WallWalkerEffect } from './wallWalker.js'; -import { WarriorsGiftEffect } from './warriorsGift.js'; +import { MartialFlexibilityEffect, WarriorsGiftEffect } from './warriorsGift.js'; import { WishEffect } from './wish.js'; import { ZombieEffect } from './zombie.js'; @@ -129,6 +129,7 @@ const PowerClasses = { 'lock-unlock': LockUnlockEffect, 'lower-trait': BoostLowerTraitEffect, 'magic-jar': MagicJarEffect, + 'martial-flexibility': MartialFlexibilityEffect, 'mind-link': MindLinkEffect, 'mind-reading': MindReadingEffect, 'mind-wipe': MindWipeEffect, diff --git a/src/module/powers/warriorsGift.js b/src/module/powers/warriorsGift.js index a3ef69f..03e589d 100644 --- a/src/module/powers/warriorsGift.js +++ b/src/module/powers/warriorsGift.js @@ -113,7 +113,7 @@ export class WarriorsGiftEffect extends PowerEffect { async sideEffects() { await super.sideEffects(); const candidateEdges = [this.data.appliedEdge]; - if (this.data.powerEdge) { + if (this.data.powerEdge !== 'none') { candidateEdges.push(this.data.powerEdge); } for (const target of this.targets) { @@ -135,3 +135,75 @@ export class WarriorsGiftEffect extends PowerEffect { } } } + +export class MartialFlexibilityEffect extends WarriorsGiftEffect { + constructor(...args) { + super(...args); + this.targets = [this.source]; + } + + get name() { + return 'Martial Flexibility'; + } + + get hasAdditionalRecipients() { + return false; + } + + get basePowerPoints() { + return 0; + } + + get isTargeted() { + return false; + } + + get isRaisable() { + return false; + } + + get usePrimaryEffect() { + return false; + } + + get modifiers() { + const mods = []; + const choices = {}; + const powerChoices = {}; + const effects = {}; + const powerValues = {}; + const values = {}; + for (const edge of this.edges) { + powerChoices[edge.id] = edge.name; + choices[edge.id] = edge.name; + powerValues[edge.id] = 4; + values[edge.id] = 0; + effects[edge.id] = null; + } + powerChoices.none = 'None'; + powerValues.none = 0; + effects.none = null; + mods.push({ + sortOrder: -1, + name: 'Edge', + type: 'select', + id: 'edge', + epic: false, + choices, + values, + effects, + }); + return mods; + } + + async parseValues() { + await super.parseValues(); + this.data.powerEdge = 'none'; + } + + async createMaintainEffect(maintId) { + const doc = await super.createMaintainEffect(maintId); + doc.flags[moduleName].attachedItems = true; + return doc; + } +}