feat: add poc
This commit is contained in:
parent
43d27b04d9
commit
4a4fa05ce4
53 changed files with 6191 additions and 0 deletions
48
src/components/Stealth.js
Normal file
48
src/components/Stealth.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import { Component } from '../core/Component.js';
|
||||
|
||||
export class Stealth extends Component {
|
||||
constructor() {
|
||||
super('Stealth');
|
||||
this.visibility = 1.0; // 0 = fully hidden, 1 = fully visible
|
||||
this.stealthType = 'slime'; // 'slime', 'beast', 'human'
|
||||
this.isStealthed = false;
|
||||
this.stealthLevel = 0; // 0-100
|
||||
this.detectionRadius = 100; // How far others can detect this entity
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter stealth mode
|
||||
*/
|
||||
enterStealth(type) {
|
||||
this.stealthType = type;
|
||||
this.isStealthed = true;
|
||||
this.visibility = 0.3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exit stealth mode
|
||||
*/
|
||||
exitStealth() {
|
||||
this.isStealthed = false;
|
||||
this.visibility = 1.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update stealth based on movement and actions
|
||||
*/
|
||||
updateStealth(isMoving, isInCombat) {
|
||||
if (isInCombat) {
|
||||
this.exitStealth();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.isStealthed) {
|
||||
if (isMoving) {
|
||||
this.visibility = Math.min(1.0, this.visibility + 0.1);
|
||||
} else {
|
||||
this.visibility = Math.max(0.1, this.visibility - 0.05);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue