Files
wsmud/world/obj/book/book.js
2026-05-26 16:41:20 +08:00

48 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
this.inherits(OBJ);
this.set({
unit: "本",
name: "武功秘籍",
desc: "一本武功秘籍",
max_level: 100,
combined: true,
value: 0
});
this.otype = 1;
this.on_create = function (path, par) {
if (!par) return;
par = par.substr(1);
var skill = SKILL.get(par);
if (!skill) return;
this.skill = skill.id;
this.grade = skill.grade;
var cc = this.query_grade_color();
this.name = skill.name + "秘籍";
this.color_name = "<" + cc + ">" + this.name + "</" + cc + ">";
this.desc = "一本武功秘籍,里面记载了" + skill.color_name + "的练习方法。";
var cond = skill.condition_tostring();
if (cond) {
this.desc = this.desc + "\n学习条件\n" + cond;
} else {
this.desc = this.desc + "\n学习条件无" + cond;
}
this.value = WORLD.DATA.book_values[this.grade] * COMBINED[this.grade];
}
this.on_study = function (me, skill, lv) {
if (skill.do_learn && skill.do_learn(me, lv) == false) return false;
return true;
}
//const VALUES = [1, 1000, 5000, 10000, 100000, 500000, 2000000];
const COMBINED = [1, 10, 30, 50, 100, 200, 500];
this.add_action('sbook', '存到技能仓库', function (me) {
WORLD.COMMANDS.sbook.enter(me, this.id);
});
this.add_action('split', '拆分', function (me) {
WORLD.COMMANDS.sbook.split_book(me, this);
});