Started work on character log for rolls to be stored

This commit is contained in:
Stefan Zermatten
2020-09-29 22:34:30 +02:00
parent 75ab43da00
commit a6a96fc19f
12 changed files with 190 additions and 45 deletions

View File

@@ -1,5 +1,10 @@
import spendResources from '/imports/api/creature/actions/spendResources.js'
import {insertCreatureLog} from '/imports/api/creature/log/CreatureLogs.js';
export default function applyAction({prop}){
export default function applyAction({prop, creature}){
spendResources(prop);
insertCreatureLog({
log: prop.name,
creature,
});
}

View File

@@ -1,7 +1,5 @@
import math from '/imports/math.js';
//if (Meteor.isServer){
// var sendWebhook = require('/imports/server/discord/webhook.js').default;
//}
import {insertCreatureLog} from '/imports/api/creature/log/CreatureLogs.js';
export default function applyAttack({
prop,
@@ -11,11 +9,8 @@ export default function applyAttack({
//actionContext
}){
let result = math.roll(1, 20) + prop.rollBonusResult;
if (Meteor.isClient){
console.log(`${creature.name} makes a ${prop.name} attack! Rolls ${result} to hit`);
}
//if (Meteor.isServer) sendWebhook({
// webhook: creature.webhook,
// message: `${creature.name} makes a ${prop.name} attack! Rolls ${result} to hit`,
//});
insertCreatureLog({
log: `${prop.name} attack. ${result} to hit`,
creature,
});
}

View File

@@ -19,8 +19,8 @@ function applyProperty(options){
applyAction(options);
return true;
case 'attack':
applyAttack(options);
applyAction(options);
applyAttack(options);
return true;
case 'damage':
applyDamage(options);