add shaken and stunned VAE buttons
This commit is contained in:
parent
3ff3d3f199
commit
8bb82c2aea
@ -255,6 +255,91 @@ export async function deleteToken(sceneId, tokenId) {
|
||||
}
|
||||
|
||||
export function SwadeVAEbuttons(effect, buttons) {
|
||||
if (effect?.name === 'Shaken') {
|
||||
buttons.push({
|
||||
label: game.i18n.localize('SWADE.EffectCallbacks.Shaken.RollSpirit'),
|
||||
callback: async function () {
|
||||
const flavor = game.i18n.localize('SWADE.EffectCallbacks.Shaken.Flavor');
|
||||
const roll = await effect.parent.rollAttribute('spirit', {
|
||||
title: flavor,
|
||||
flavour: flavor,
|
||||
additionalMods: [
|
||||
{
|
||||
label: game.i18n.localize('SWADE.EffectCallbacks.Shaken.UnshakeModifier'),
|
||||
value: effect.parent.system.attributes.spirit.unShakeBonus,
|
||||
},
|
||||
],
|
||||
});
|
||||
if (roll?.successes ?? 0 >= 1) {
|
||||
await effect.delete();
|
||||
ui.notifications.info('SWADE.EffectCallbacks.Shaken.Success', {
|
||||
localize: true,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
buttons.push({
|
||||
label: game.i18n.localize('SWADE.BenniesSpend'),
|
||||
callback: async () => {
|
||||
const parent = effect.parent;
|
||||
await parent?.spendBenny();
|
||||
await effect.delete();
|
||||
},
|
||||
});
|
||||
if (game.user?.isGM) {
|
||||
buttons.push({
|
||||
label: game.i18n.localize('SWADE.BenniesSpendGM'),
|
||||
callback: async () => {
|
||||
const parent = effect.parent;
|
||||
await game.user?.spendBenny();
|
||||
await effect.delete();
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
if (effect?.name === 'Stunned') {
|
||||
buttons.push({
|
||||
label: 'Vigor roll to remove Stunned',
|
||||
callback: async () => {
|
||||
const parent = effect.parent;
|
||||
const flavour = game.i18n.localize('SWADE.EffectCallbacks.Stunned.Title');
|
||||
const roll = await parent.rollAttribute('vigor', {
|
||||
title: flavour,
|
||||
flavour,
|
||||
additionalMods: [
|
||||
{
|
||||
label: game.i18n.localize('SWADE.EffectCallbacks.Stunned.UnStunModifier'),
|
||||
value: parent.system.attributes.vigor.unStunBonus,
|
||||
},
|
||||
],
|
||||
});
|
||||
const result = roll?.successes ?? 0;
|
||||
if (result < 1) {
|
||||
// no roll or failure
|
||||
ui.notifications.info('SWADE.EffectCallbacks.Stunned.Fail', {
|
||||
localize: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
//normal success, still vulnerable
|
||||
if (result === 1) {
|
||||
await effect.delete();
|
||||
ui.notifications.info('SWADE.EffectCallbacks.Stunned.Success', {
|
||||
localize: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (result >= 2) {
|
||||
await effect.delete();
|
||||
ui.notifications.info('SWADE.EffectCallbacks.Stunned.Raise', {
|
||||
localize: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
if (['Bound', 'Entangled'].includes(effect?.name)) {
|
||||
buttons.push({
|
||||
label: 'Break Free (Athletics)',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user