Files
optolith-client/js/stores/data/Attribute.js
T
Lukas Obermann e1927227bf Changed data objects to ES6 classes
Additionally changed folder structure to components and views
2016-11-14 00:18:09 +01:00

32 lines
767 B
JavaScript

import Increasable from './Increasable';
import AttributeStore from '../AttributeStore';
import ELStore from '../ELStore';
import PhaseStore from '../PhaseStore';
import Categories from '../../constants/Categories';
export default class Attribute extends Increasable {
constructor(args) {
super(args);
let { short } = args;
this.short = short;
this.value = 8;
this.mod = 0;
this.ic = 5;
this.category = Categories.ATTRIBUTES;
}
get isIncreasable() {
if (PhaseStore.get() < 3) {
let max = AttributeStore.getSum() >= ELStore.getStart().max_attrsum ? 0 : ELStore.getStart().max_attr + this.mod;
return this.value < max;
} else {
return true;
}
}
get isDecreasable() {
return this.value > Math.max(8, ...(this.dependencies));
}
}