feat: add poc
This commit is contained in:
parent
43d27b04d9
commit
4a4fa05ce4
53 changed files with 6191 additions and 0 deletions
54
src/components/Absorbable.js
Normal file
54
src/components/Absorbable.js
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
import { Component } from '../core/Component.js';
|
||||
|
||||
export class Absorbable extends Component {
|
||||
constructor() {
|
||||
super('Absorbable');
|
||||
this.evolutionData = {
|
||||
human: 0,
|
||||
beast: 0,
|
||||
slime: 0
|
||||
};
|
||||
this.skillsGranted = []; // Array of skill IDs that can be absorbed
|
||||
this.skillAbsorptionChance = 0.3; // 30% chance to absorb a skill
|
||||
this.mutationChance = 0.1; // 10% chance for mutation
|
||||
this.absorbed = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set evolution data
|
||||
*/
|
||||
setEvolutionData(human, beast, slime) {
|
||||
this.evolutionData = { human, beast, slime };
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a skill that can be absorbed
|
||||
*/
|
||||
addSkill(skillId, chance = null) {
|
||||
this.skillsGranted.push({
|
||||
id: skillId,
|
||||
chance: chance || this.skillAbsorptionChance
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get skills that were successfully absorbed (rolls for each)
|
||||
*/
|
||||
getAbsorbedSkills() {
|
||||
const absorbed = [];
|
||||
for (const skill of this.skillsGranted) {
|
||||
if (Math.random() < skill.chance) {
|
||||
absorbed.push(skill.id);
|
||||
}
|
||||
}
|
||||
return absorbed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if should mutate
|
||||
*/
|
||||
shouldMutate() {
|
||||
return Math.random() < this.mutationChance;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue