This commit is contained in:
ckcz123 2021-07-30 11:56:25 +08:00
parent b278306b3e
commit ded1c33189
4 changed files with 19 additions and 5 deletions

View File

@ -4052,12 +4052,12 @@ IdString
;
FixedId_List
: '生命'|'生命上限'|'攻击'|'防御'|'护盾'|'黄钥匙'|'蓝钥匙'|'红钥匙'|'金币'|'经验'|'魔力'|'魔力上限'
/*FixedId_List ['status:hp','status:hpmax','status:atk','status:def','status:mdef','item:yellowKey','item:blueKey','item:redKey','status:money','status:exp','status:mana','status:manamax']*/;
: '生命'|'生命上限'|'攻击'|'防御'|'护盾'|'黄钥匙'|'蓝钥匙'|'红钥匙'|'金币'|'经验'|'魔力'|'魔力上限'|'生命增益'|'攻击增益'|'防御增益'|'护盾增益'
/*FixedId_List ['status:hp','status:hpmax','status:atk','status:def','status:mdef','item:yellowKey','item:blueKey','item:redKey','status:money','status:exp','status:mana','status:manamax','buff:hp','buff:atk','buff:def','buff:mdef']*/;
Id_List
: '变量' | '状态' | '物品' | '独立开关' | '临时变量' |'全局存储'
/*Id_List ['flag','status','item', 'switch', 'temp', 'global']*/;
: '变量' | '状态' | '物品' | '增益' | '独立开关' | '临时变量' |'全局存储'
/*Id_List ['flag','status','item', 'buff', 'switch', 'temp', 'global']*/;
EnemyId_List
: '生命'|'攻击'|'防御'|'金币'|'经验'|'加点'|'属性'|'名称'|'映射名'|'属性值'|'退化扣攻'|'退化扣防'|'不可炸'|'九宫格领域'|'领域范围'|'连击数'|'吸血到自身'|'固伤值'

View File

@ -1195,7 +1195,7 @@ ActionParser.prototype.matchId = function(args) {
var Id_List = MotaActionBlocks['Id_List'].options; // [["变量", "flag"], ...]
match=new RegExp('^('+Id_List.map(function(v){return v[1]}).join('|')+'):([a-zA-Z0-9_\\u4E00-\\u9FCC\\u3040-\\u30FF\\u2160-\\u216B\\u0391-\\u03C9]+)$').exec(args[0])
if(match){
if (match[1] == 'status' || match[1] == 'item') {
if (match[1] == 'status' || match[1] == 'item' || match[1] == 'buff') {
match[2] = MotaActionFunctions.replaceToName_token(match[2]);
}
args=[match[1],match[2]]
@ -1576,6 +1576,9 @@ MotaActionFunctions.replaceToName = function (str) {
str = str.replace(new RegExp("status:(" + list.join("|") + ")\\b", "g"), function (a, b) {
return map[b] ? ("状态:" + map[b]) : b;
}).replace(/status:/g, "状态:");
str = str.replace(new RegExp("buff:(" + list.join("|") + ")\\b", "g"), function (a, b) {
return map[b] ? ("增益:" + map[b]) : b;
}).replace(/buff:/g, "增益:");
map = {}; list = [];
MotaActionFunctions.pattern.replaceItemList.forEach(function (v) {
map[v[0]] = v[1]; list.push(v[0]);
@ -1614,6 +1617,9 @@ MotaActionFunctions.replaceFromName = function (str) {
str = str.replace(new RegExp("状态[:](" + list.join("|") + ")(?:$|(?=[^a-zA-Z0-9_\\u4E00-\\u9FCC\\u3040-\\u30FF\\u2160-\\u216B\\u0391-\\u03C9]))", "g"), function (a, b) {
return map[b] ? ("status:" + map[b]) : b;
}).replace(/状态[:]/g, "status:");
str = str.replace(new RegExp("增益[:](" + list.join("|") + ")(?:$|(?=[^a-zA-Z0-9_\\u4E00-\\u9FCC\\u3040-\\u30FF\\u2160-\\u216B\\u0391-\\u03C9]))", "g"), function (a, b) {
return map[b] ? ("buff:" + map[b]) : b;
}).replace(/增益[:]/g, "buff:");
map = {}; list = [];
MotaActionFunctions.pattern.replaceItemList.forEach(function (v) {
map[v[1]] = v[0]; list.push(v[1]);

View File

@ -2800,6 +2800,7 @@ events.prototype._updateValueByOperator = function (value, originValue, operator
events.prototype.setValue = function (name, operator, value, prefix) {
value = this._updateValueByOperator(core.calValue(value, prefix), core.calValue(name, prefix), operator);
this._setValue_setStatus(name, value);
this._setValue_setBuff(name, value);
this._setValue_setItem(name, value);
this._setValue_setFlag(name, value);
this._setValue_setSwitch(name, value, prefix);
@ -2812,6 +2813,11 @@ events.prototype._setValue_setStatus = function (name, value) {
core.setStatus(name.substring(7), value);
}
events.prototype._setValue_setBuff = function (name, value) {
if (name.indexOf('buff:') !== 0) return;
core.setBuff(name.substring(5), value);
}
events.prototype._setValue_setItem = function (name, value) {
if (name.indexOf("item:") !== 0) return;
var itemId = name.substring(5), count = core.itemCount(itemId);

View File

@ -105,6 +105,8 @@ utils.prototype.replaceValue = function (value) {
if (typeof value == "string" && (value.indexOf(":") >= 0 || value.indexOf("flag") >= 0 || value.indexOf('global') >= 0)) {
if (value.indexOf('status:') >= 0)
value = value.replace(/status:([a-zA-Z0-9_]+)/g, "core.getStatus('$1')");
if (value.indexOf('buff:') >= 0)
value = value.replace(/buff:([a-zA-Z0-9_]+)/g, "core.getBuff('$1')");
if (value.indexOf('item:') >= 0)
value = value.replace(/item:([a-zA-Z0-9_]+)/g, "core.itemCount('$1')");
if (value.indexOf('flag:') >= 0 || value.indexOf('flag') >= 0)