Added "extra" damage type
Takes on the same damage type as the last damage applied during the same action, otherwise deals "extra" damage
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { EJSON } from 'meteor/ejson';
|
||||
import createGraph from 'ngraph.graph';
|
||||
import getEffectivePropTags from '/imports/api/engine/computation/utility/getEffectivePropTags.js';
|
||||
|
||||
export default class CreatureComputation {
|
||||
constructor(properties, creature, variables){
|
||||
@@ -22,28 +23,15 @@ export default class CreatureComputation {
|
||||
// Store by id
|
||||
this.propsById[prop._id] = prop;
|
||||
|
||||
// Store tags
|
||||
const storePropOnTag = (prop, tag) => {
|
||||
// Store sets of ids in each tag
|
||||
getEffectivePropTags(prop).forEach(tag => {
|
||||
if (!tag) return;
|
||||
if (this.propsWithTag[tag]){
|
||||
if (this.propsWithTag[tag]) {
|
||||
this.propsWithTag[tag].push(prop._id);
|
||||
} else {
|
||||
this.propsWithTag[tag] = [prop._id];
|
||||
}
|
||||
}
|
||||
// Store sets of ids in each tag
|
||||
if (prop.tags){
|
||||
prop.tags.forEach(tag => {
|
||||
storePropOnTag(prop, tag);
|
||||
});
|
||||
}
|
||||
// Store tags for the property type
|
||||
storePropOnTag(prop, `#${prop.type}`);
|
||||
// Store tags for some string properties
|
||||
storePropOnTag(prop, prop.damageType);
|
||||
storePropOnTag(prop, prop.skillType);
|
||||
storePropOnTag(prop, prop.attributeType);
|
||||
storePropOnTag(prop, prop.reset);
|
||||
});
|
||||
|
||||
// Store the prop in the dependency graph
|
||||
this.dependencyGraph.addNode(prop._id, prop);
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
export default function getEffectivePropTags(prop) {
|
||||
if (!prop.tags) return [];
|
||||
const tags = [...prop.tags];
|
||||
// Tags for the property type, separate #damage from #healing
|
||||
if (prop.type === 'damage' && prop.damageType === 'healing') {
|
||||
tags.push('#healing');
|
||||
} else {
|
||||
tags.push(`#${prop.type}`);
|
||||
}
|
||||
|
||||
// Tags for some string properties
|
||||
if (prop.damageType) tags.push(prop.damageType);
|
||||
if (prop.skillType) tags.push(prop.skillType);
|
||||
if (prop.attributeType) tags.push(prop.attributeType);
|
||||
if (prop.reset) tags.push(prop.reset);
|
||||
return tags;
|
||||
}
|
||||
Reference in New Issue
Block a user