clear exp in levelUp

This commit is contained in:
oc 2018-12-11 01:44:01 +08:00
parent 553db5d1da
commit a6260d9edd
2 changed files with 10 additions and 8 deletions

View File

@ -50,15 +50,16 @@ return code;
*/;
levelCase
: '需求' expression '称号' EvalString? BGNL? Newline action+
: '需求' expression '称号' EvalString? '是否扣除经验' Bool BGNL? Newline action+
/* levelCase
tooltip : 升级设定
helpUrl : https://h5mota.com/games/template/docs/#/event?id=%e7%bb%8f%e9%aa%8c%e5%8d%87%e7%ba%a7%ef%bc%88%e8%bf%9b%e9%98%b6%2f%e5%a2%83%e7%95%8c%e5%a1%94%ef%bc%89
default : [0,"",null]
default : [0,"",false,null]
colour : this.subColor
var code = '{"need": "'+expression_0+'", "title": "'+EvalString_0+'", "action": [\n'+action_0+']},\n';
Bool_0 = Bool_0?', "clear": true':'';
var code = '{"need": "'+expression_0+'", "title": "'+EvalString_0+'"'+Bool_0+', "action": [\n'+action_0+']},\n';
return code;
*/;
@ -1832,7 +1833,7 @@ ActionParser.prototype.parse = function (obj,type) {
var text_choices = null;
for(var ii=obj.length-1,choice;choice=obj[ii];ii--) {
text_choices=MotaActionBlocks['levelCase'].xmlText([
MotaActionBlocks['evalString_e'].xmlText([choice.need]),choice.title,this.parseList(choice.action),text_choices]);
MotaActionBlocks['evalString_e'].xmlText([choice.need]),choice.title,choice.clear||false,this.parseList(choice.action),text_choices]);
}
return MotaActionBlocks['level_m'].xmlText([text_choices]);

View File

@ -1822,14 +1822,15 @@ events.prototype.checkLvUp = function () {
if (!core.flags.enableLevelUp || !core.isset(core.firstData.levelUp)
|| core.status.hero.lv>=core.firstData.levelUp.length) return;
// 计算下一个所需要的数值
var need=core.calValue((core.firstData.levelUp[core.status.hero.lv]||{}).need);
var next = (core.firstData.levelUp[core.status.hero.lv]||{});
var need = core.calValue(next.need);
if (!core.isset(need)) return;
if (core.status.hero.experience>=need) {
// 升级
core.status.hero.lv++;
core.insertAction(core.firstData.levelUp[core.status.hero.lv-1].action, null, null, function() {
core.events.checkLvUp();
});
if (next.clear) core.status.hero.experience -= need;
core.insertAction(next.action);
this.checkLvUp();
}
}