forked from foundryvtt/dnd5e
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request foundryvtt#3934 from foundryvtt/activity/damage
[foundryvtt#3912] Add `DamageActivity` & `HealingActivity` data & sheets
- Loading branch information
Showing
27 changed files
with
377 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import ActivitySheet from "./activity-sheet.mjs"; | ||
|
||
/** | ||
* Sheet for the damage activity. | ||
*/ | ||
export default class DamageSheet extends ActivitySheet { | ||
|
||
/** @inheritDoc */ | ||
static DEFAULT_OPTIONS = { | ||
classes: ["damage-activity"] | ||
}; | ||
|
||
/* -------------------------------------------- */ | ||
|
||
/** @inheritDoc */ | ||
static PARTS = { | ||
...super.PARTS, | ||
effect: { | ||
template: "systems/dnd5e/templates/activity/damage-effect.hbs", | ||
templates: [ | ||
...super.PARTS.effect.templates, | ||
"systems/dnd5e/templates/activity/parts/damage-damage.hbs", | ||
"systems/dnd5e/templates/activity/parts/damage-part.hbs", | ||
"systems/dnd5e/templates/activity/parts/damage-parts.hbs" | ||
] | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import ActivitySheet from "./activity-sheet.mjs"; | ||
|
||
/** | ||
* Sheet for the healing activity. | ||
*/ | ||
export default class HealingSheet extends ActivitySheet { | ||
|
||
/** @inheritDoc */ | ||
static DEFAULT_OPTIONS = { | ||
classes: ["healing-activity"] | ||
}; | ||
|
||
/* -------------------------------------------- */ | ||
|
||
/** @inheritDoc */ | ||
static PARTS = { | ||
...super.PARTS, | ||
effect: { | ||
template: "systems/dnd5e/templates/activity/healing-effect.hbs", | ||
templates: [ | ||
...super.PARTS.effect.templates, | ||
"systems/dnd5e/templates/activity/parts/damage-part.hbs", | ||
"systems/dnd5e/templates/activity/parts/healing-damage.hbs" | ||
] | ||
} | ||
}; | ||
|
||
/* -------------------------------------------- */ | ||
/* Rendering */ | ||
/* -------------------------------------------- */ | ||
|
||
/** @inheritDoc */ | ||
async _prepareEffectContext(context) { | ||
context = await super._prepareEffectContext(context); | ||
context.typeOptions = Object.entries(CONFIG.DND5E.healingTypes).map(([value, config]) => ({ | ||
value, label: config.label, selected: context.activity.healing.types.has(value) | ||
})); | ||
return context; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import DamageField from "../shared/damage-field.mjs"; | ||
import BaseActivityData from "./base-activity.mjs"; | ||
|
||
const { ArrayField, BooleanField, SchemaField } = foundry.data.fields; | ||
|
||
/** | ||
* Data model for an damage activity. | ||
* | ||
* @property {object} damage | ||
* @property {boolean} damage.allowCritical Can this damage be critical? | ||
* @property {DamageData[]} damage.parts Parts of damage to inflict. | ||
*/ | ||
export default class DamageActivityData extends BaseActivityData { | ||
/** @inheritDoc */ | ||
static defineSchema() { | ||
return { | ||
...super.defineSchema(), | ||
damage: new SchemaField({ | ||
allowCritical: new BooleanField(), | ||
parts: new ArrayField(new DamageField()) | ||
}) | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import DamageField from "../shared/damage-field.mjs"; | ||
import BaseActivityData from "./base-activity.mjs"; | ||
|
||
/** | ||
* Data model for an healing activity. | ||
* | ||
* @property {DamageData} healing | ||
*/ | ||
export default class HealingActivityData extends BaseActivityData { | ||
/** @inheritDoc */ | ||
static defineSchema() { | ||
return { | ||
...super.defineSchema(), | ||
healing: new DamageField() | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.