feat: add poc
This commit is contained in:
parent
43d27b04d9
commit
4a4fa05ce4
53 changed files with 6191 additions and 0 deletions
45
src/components/SkillProgress.js
Normal file
45
src/components/SkillProgress.js
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import { Component } from '../core/Component.js';
|
||||
|
||||
/**
|
||||
* Tracks progress toward learning skills
|
||||
* Need to absorb multiple enemies with the same skill to learn it
|
||||
*/
|
||||
export class SkillProgress extends Component {
|
||||
constructor() {
|
||||
super('SkillProgress');
|
||||
this.skillProgress = new Map(); // skillId -> count (how many times absorbed)
|
||||
this.requiredAbsorptions = 5; // Need to absorb 5 enemies with a skill to learn it
|
||||
}
|
||||
|
||||
/**
|
||||
* Add progress toward learning a skill
|
||||
*/
|
||||
addSkillProgress(skillId) {
|
||||
const current = this.skillProgress.get(skillId) || 0;
|
||||
this.skillProgress.set(skillId, current + 1);
|
||||
return this.skillProgress.get(skillId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if skill can be learned
|
||||
*/
|
||||
canLearnSkill(skillId) {
|
||||
const progress = this.skillProgress.get(skillId) || 0;
|
||||
return progress >= this.requiredAbsorptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get progress for a skill
|
||||
*/
|
||||
getSkillProgress(skillId) {
|
||||
return this.skillProgress.get(skillId) || 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all skill progress
|
||||
*/
|
||||
getAllProgress() {
|
||||
return this.skillProgress;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue