2024-05-29 20:47:19 -04:00
|
|
|
class Stats {
|
2024-06-02 09:42:35 -04:00
|
|
|
/**
|
|
|
|
* Physical attack damage + Equipment Load
|
|
|
|
*/
|
2024-05-29 20:47:19 -04:00
|
|
|
get Strength() {
|
|
|
|
return this._data.getUint8(0, true);
|
|
|
|
}
|
|
|
|
set Strength(v) {
|
|
|
|
return this._data.setUint8(0, v, true);
|
|
|
|
}
|
2024-06-02 09:42:35 -04:00
|
|
|
/**
|
|
|
|
* HP + Dmg mitigation for physical damage, how much stamina you have
|
|
|
|
*/
|
2024-05-29 20:47:19 -04:00
|
|
|
get Endurance() {
|
|
|
|
return this._data.getUint8(1, true);
|
|
|
|
}
|
|
|
|
set Endurance(v) {
|
|
|
|
return this._data.setUint8(1, v, true);
|
|
|
|
}
|
2024-06-02 09:42:35 -04:00
|
|
|
/**
|
|
|
|
* Use/build steampunk gadgets + be able to read specific logical papers
|
|
|
|
*/
|
2024-05-29 20:47:19 -04:00
|
|
|
get Intelligence() {
|
|
|
|
return this._data.getUint8(2, true);
|
|
|
|
}
|
|
|
|
set Intelligence(v) {
|
|
|
|
return this._data.setUint8(2, v, true);
|
|
|
|
}
|
2024-06-02 09:42:35 -04:00
|
|
|
/**
|
|
|
|
* Number of magic / special attack / skills you can remember at one time.
|
|
|
|
*/
|
2024-05-29 20:47:19 -04:00
|
|
|
get Wisdom() {
|
|
|
|
return this._data.getUint8(3, true);
|
|
|
|
}
|
|
|
|
set Wisdom(v) {
|
|
|
|
return this._data.setUint8(3, v, true);
|
|
|
|
}
|
2024-06-02 09:42:35 -04:00
|
|
|
/**
|
|
|
|
* how good you can talk, persuade, etc.
|
|
|
|
*/
|
2024-05-29 20:47:19 -04:00
|
|
|
get Charisma() {
|
|
|
|
return this._data.getUint8(4, true);
|
|
|
|
}
|
|
|
|
set Charisma(v) {
|
|
|
|
return this._data.setUint8(4, v, true);
|
|
|
|
}
|
2024-06-02 09:42:35 -04:00
|
|
|
/**
|
|
|
|
* get the struct representation of the object
|
|
|
|
*/
|
2024-05-29 20:47:19 -04:00
|
|
|
get bytes() {
|
|
|
|
return new Uint8Array(this._ptr);
|
|
|
|
}
|
2024-06-02 09:42:35 -04:00
|
|
|
/**
|
|
|
|
* constructor
|
|
|
|
*/
|
2024-05-29 20:47:19 -04:00
|
|
|
constructor(init = {}, ptr = undefined) {
|
2024-06-02 09:42:35 -04:00
|
|
|
this._size = 5;
|
2024-05-29 20:47:19 -04:00
|
|
|
this._ptr = ptr.buffer || new ArrayBuffer(this._size);
|
|
|
|
this._data = new DataView(this._ptr);
|
|
|
|
|
|
|
|
for (const key of Object.keys(init)) {
|
|
|
|
this[key] = init[key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Stats
|