Initial commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
class EquipmentLimiter {
|
||||
constructor(info) {
|
||||
this.quantity = {
|
||||
current: 0,
|
||||
maximum: info.maximum
|
||||
};
|
||||
};
|
||||
|
||||
count(quantity) {
|
||||
|
||||
if (!quantity) return false;
|
||||
if (this.quantity.current + quantity > this.quantity.maximum || this.quantity.current + quantity < 0) return false;
|
||||
|
||||
this.quantity.current += quantity;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = EquipmentLimiter;
|
||||
Reference in New Issue
Block a user