raylib-wasm-transpiler/server/components/DerivedStats.js

94 lines
2.4 KiB
JavaScript

class DerivedStats {
/**
* how many hits you can take, if it reaches 0 you ded!
*/
get Hitpoints() {
return this._data.getUint8(0, true);
}
set Hitpoints(v) {
return this._data.setUint8(0, v, true);
}
/**
* How many strenuous actions you can take, i.e. swinging a hammer, attacking, fishing, etc.
*/
get Stamina() {
return this._data.getUint8(1, true);
}
set Stamina(v) {
return this._data.setUint8(1, v, true);
}
/**
* being able to observe some objects
*/
get Perception() {
return this._data.getUint8(2, true);
}
set Perception(v) {
return this._data.setUint8(2, v, true);
}
/**
* Get better probability rolls for things that matter for rolls
*/
get Luck() {
return this._data.getUint8(3, true);
}
set Luck(v) {
return this._data.setUint8(3, v, true);
}
/**
* Probability of being discovered when hiding
*/
get Stealth() {
return this._data.getUint8(4, true);
}
set Stealth(v) {
return this._data.setUint8(4, v, true);
}
/**
* based on your character you make in the creator. more attractive will have better outcomes with aristocracy and more 'ugly' will have better outcomes with working class.
*/
get Attractiveness() {
return this._data.getUint8(5, true);
}
set Attractiveness(v) {
return this._data.setUint8(5, v, true);
}
/**
* same as attractiveness but can change with money
*/
get Affluence() {
return this._data.getUint8(6, true);
}
set Affluence(v) {
return this._data.setUint8(6, v, true);
}
/**
* how attuned to the vision of Eru
*/
get Holyness() {
return this._data.getInt8(7, true);
}
set Holyness(v) {
return this._data.setInt8(7, v, true);
}
/**
* get the struct representation of the object
*/
get bytes() {
return new Uint8Array(this._ptr);
}
/**
* constructor
*/
constructor(init = {}, ptr = undefined) {
this._size = 8;
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 DerivedStats