mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2026-03-25 08:34:16 +08:00
update data add talent exclusive
This commit is contained in:
14
src/app.js
14
src/app.js
@@ -89,6 +89,20 @@ class App{
|
||||
this.hint('只能选3个天赋');
|
||||
return;
|
||||
}
|
||||
|
||||
const exclusive = this.#life.exclusive(
|
||||
Array.from(this.#talentSelected).map(({id})=>id),
|
||||
talent.id
|
||||
);
|
||||
if(exclusive != null) {
|
||||
for(const { name, id } of this.#talentSelected) {
|
||||
if(id == exclusive) {
|
||||
this.hint(`与已选择的天赋【${name}】冲突`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
li.addClass('selected');
|
||||
this.#talentSelected.add(talent);
|
||||
}
|
||||
|
||||
@@ -109,6 +109,10 @@ class Life {
|
||||
getRecord() {
|
||||
return this.#property.getRecord();
|
||||
}
|
||||
|
||||
exclusive(talents, exclusive) {
|
||||
return this.#talent.exclusive(talents, exclusive);
|
||||
}
|
||||
}
|
||||
|
||||
export default Life;
|
||||
|
||||
@@ -31,6 +31,17 @@ class Talent {
|
||||
return { grade, name, description };
|
||||
}
|
||||
|
||||
exclusive(talends, exclusiveId) {
|
||||
const { exclusive } = this.get(exclusiveId);
|
||||
if(!exclusive) return null;
|
||||
for(const talent of talends) {
|
||||
for(const e of exclusive) {
|
||||
if(talent == e) return talent;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
talentRandom(include) {
|
||||
// 1000, 100, 10, 1
|
||||
const talentList = {};
|
||||
|
||||
Reference in New Issue
Block a user