humus-old/server/fixtures/potion.entity.js

49 lines
984 B
JavaScript

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