66 lines
1.3 KiB
JavaScript
66 lines
1.3 KiB
JavaScript
import {buildInvoke, buildTraversal} from '@avocado/behavior';
|
|
|
|
import {AFFINITY_NONE} from '../../common/combat/constants';
|
|
|
|
// Healing potion.
|
|
export function rockJSON() {
|
|
const spawnProjectile = buildInvoke(
|
|
['item', 'spawn'],
|
|
[
|
|
'rock'
|
|
],
|
|
)
|
|
const setProjectileIntoContext = buildInvoke(
|
|
['context', 'set'],
|
|
[
|
|
'projectile',
|
|
spawnProjectile,
|
|
],
|
|
)
|
|
const setWielderIntoProjectile = buildInvoke(
|
|
['projectile', 'context', 'set'],
|
|
[
|
|
'wielder',
|
|
buildTraversal(['wielder']),
|
|
],
|
|
);
|
|
const setProjectileBehaving = buildTraversal(
|
|
['projectile', 'isBehaving'],
|
|
true,
|
|
);
|
|
return {
|
|
traits: {
|
|
existent: {
|
|
state: {
|
|
name: 'Rock',
|
|
},
|
|
},
|
|
item: {
|
|
params: {
|
|
cooldown: 0.33,
|
|
itemActions: {
|
|
type: 'actions',
|
|
traversals: [
|
|
setProjectileIntoContext,
|
|
setWielderIntoProjectile,
|
|
setProjectileBehaving,
|
|
],
|
|
},
|
|
slotImages: {
|
|
default: '/rock.png',
|
|
},
|
|
},
|
|
},
|
|
spawner: {
|
|
params: {
|
|
spawns: {
|
|
rock: {
|
|
uri: '/rock-projectile.entity.json',
|
|
},
|
|
},
|
|
},
|
|
}
|
|
},
|
|
};
|
|
}
|