50 lines
1.0 KiB
JavaScript
50 lines
1.0 KiB
JavaScript
|
import {buildInvoke, buildTraversal} from '@avocado/behavior';
|
||
|
|
||
|
import {AFFINITY_NONE} from '../../common/combat/constants';
|
||
|
|
||
|
// Healing potion.
|
||
|
export function potionJSON() {
|
||
|
const causeHealing = buildInvoke(['user', 'takeDamageFrom'], [
|
||
|
buildTraversal(['item']),
|
||
|
]);
|
||
|
const decrement = buildInvoke(
|
||
|
['item', 'decrementQuantity'],
|
||
|
);
|
||
|
const cooldown = buildInvoke(
|
||
|
['global', 'wait'],
|
||
|
[0.5],
|
||
|
);
|
||
|
return {
|
||
|
traits: {
|
||
|
damaging: {
|
||
|
params: {
|
||
|
damageSpecs: [
|
||
|
{
|
||
|
affinity: AFFINITY_NONE,
|
||
|
lock: 0,
|
||
|
power: -50,
|
||
|
variance: 0.1,
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
},
|
||
|
existent: {},
|
||
|
item: {
|
||
|
params: {
|
||
|
itemActions: {
|
||
|
type: 'actions',
|
||
|
traversals: [
|
||
|
causeHealing,
|
||
|
decrement,
|
||
|
cooldown,
|
||
|
],
|
||
|
},
|
||
|
slotImages: {
|
||
|
default: '/potion.png',
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
}
|