setValue refresh
This commit is contained in:
parent
97f8fe5466
commit
ede501e030
@ -486,7 +486,9 @@ value是一个表达式,将通过这个表达式计算出的结果赋值给nam
|
||||
|
||||

|
||||
|
||||
另外注意一点的是,如果hp被设置成了0或以下,将触发lose事件,直接死亡。
|
||||
从V2.6.5开始,默认`addValue`不会刷新状态栏、地图显伤和自动事件,除非设置了`"refresh": true`。
|
||||
|
||||
在刷新的情况下,如果hp被设置成了0或以下,将触发lose事件,直接死亡。
|
||||
|
||||
### addValue:增减勇士的某个属性、道具个数,或某个变量/Flag的值
|
||||
|
||||
@ -507,6 +509,7 @@ value是一个表达式,将通过这个表达式计算出的结果赋值给nam
|
||||
|
||||

|
||||
|
||||
从V2.6.5开始,默认`addValue`不会刷新状态栏、地图显伤和自动事件,除非设置了`"refresh": true`。
|
||||
|
||||
### setEnemy:设置怪物属性
|
||||
|
||||
|
||||
@ -589,26 +589,28 @@ return code;
|
||||
*/;
|
||||
|
||||
setValue_s
|
||||
: '数值操作' ':' '名称' idString_e '值' expression Newline
|
||||
: '数值操作' ':' '名称' idString_e '值' expression '刷新状态栏和显伤' Bool Newline
|
||||
|
||||
|
||||
/* setValue_s
|
||||
tooltip : setValue:设置勇士的某个属性、道具个数, 或某个变量/Flag的值
|
||||
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=setvalue%EF%BC%9A%E8%AE%BE%E7%BD%AE%E5%8B%87%E5%A3%AB%E7%9A%84%E6%9F%90%E4%B8%AA%E5%B1%9E%E6%80%A7%E3%80%81%E9%81%93%E5%85%B7%E4%B8%AA%E6%95%B0%EF%BC%8C%E6%88%96%E6%9F%90%E4%B8%AA%E5%8F%98%E9%87%8Fflag%E7%9A%84%E5%80%BC
|
||||
colour : this.dataColor
|
||||
var code = '{"type": "setValue", "name": "'+idString_e_0+'", "value": "'+expression_0+'"},\n';
|
||||
Bool_0 = Bool_0 ? ', "refresh": true' : '';
|
||||
var code = '{"type": "setValue", "name": "'+idString_e_0+'", "value": "'+expression_0+'"' + Bool_0 + '},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
addValue_s
|
||||
: '数值增减' ':' '名称' idString_e '+=' expression Newline
|
||||
: '数值增减' ':' '名称' idString_e '+=' expression '刷新状态栏和显伤' Bool Newline
|
||||
|
||||
|
||||
/* addValue_s
|
||||
tooltip : addValue:增减勇士的某个属性、道具个数, 或某个变量/Flag的值
|
||||
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=addValue%ef%bc%9a%e5%a2%9e%e5%87%8f%e5%8b%87%e5%a3%ab%e7%9a%84%e6%9f%90%e4%b8%aa%e5%b1%9e%e6%80%a7%e3%80%81%e9%81%93%e5%85%b7%e4%b8%aa%e6%95%b0%ef%bc%8c%e6%88%96%e6%9f%90%e4%b8%aa%e5%8f%98%e9%87%8f%2fFlag%e7%9a%84%e5%80%bc
|
||||
colour : this.dataColor
|
||||
var code = '{"type": "addValue", "name": "'+idString_e_0+'", "value": "'+expression_0+'"},\n';
|
||||
Bool_0 = Bool_0 ? ', "refresh": true' : '';
|
||||
var code = '{"type": "addValue", "name": "'+idString_e_0+'", "value": "'+expression_0+'"' + Bool_0 + '},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
@ -3396,6 +3398,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
this.next = MotaActionBlocks['setValue_s'].xmlText([
|
||||
this.tryToUseEvFlag_e('idString_e', [data.name]),
|
||||
MotaActionBlocks['evalString_e'].xmlText([data.value]),
|
||||
data.refresh || false,
|
||||
this.next]);
|
||||
break;
|
||||
case "setValue2":
|
||||
@ -3403,6 +3406,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
this.next = MotaActionBlocks['addValue_s'].xmlText([
|
||||
this.tryToUseEvFlag_e('idString_e', [data.name]),
|
||||
MotaActionBlocks['evalString_e'].xmlText([data.value]),
|
||||
data.refresh || false,
|
||||
this.next]);
|
||||
break;
|
||||
case "setEnemy":
|
||||
|
||||
@ -100,10 +100,10 @@ editor_blockly = function () {
|
||||
],
|
||||
'数据相关':[
|
||||
MotaActionBlocks['addValue_s'].xmlText([
|
||||
MotaActionBlocks['idString_1_e'].xmlText(['status','生命'])
|
||||
MotaActionBlocks['idString_1_e'].xmlText(['status','生命']), '', false
|
||||
]),
|
||||
MotaActionBlocks['setValue_s'].xmlText([
|
||||
MotaActionBlocks['idString_1_e'].xmlText(['status','生命'])
|
||||
MotaActionBlocks['idString_1_e'].xmlText(['status','生命']), '', false
|
||||
]),
|
||||
MotaActionBlocks['setEnemy_s'].xmlText(),
|
||||
MotaActionBlocks['setFloor_s'].xmlText(),
|
||||
@ -747,7 +747,7 @@ function omitedcheckUpdateFunction(event) {
|
||||
'comment_s',
|
||||
'show_s',
|
||||
'hide_s',
|
||||
'setValue_s',
|
||||
'addValue_s',
|
||||
'if_s',
|
||||
'battle_s',
|
||||
'openDoor_s',
|
||||
|
||||
@ -1574,6 +1574,15 @@ events.prototype._action_setVolume = function (data, x, y, prefix) {
|
||||
|
||||
events.prototype._action_setValue = function (data, x, y, prefix) {
|
||||
this.setValue(data.name, data.value, prefix);
|
||||
if (data.refresh) {
|
||||
if (core.status.hero.hp <= 0) {
|
||||
core.status.hero.hp = 0;
|
||||
core.updateStatusBar();
|
||||
core.events.lose();
|
||||
} else {
|
||||
core.updateStatusBar();
|
||||
}
|
||||
}
|
||||
core.doAction();
|
||||
}
|
||||
|
||||
@ -1583,6 +1592,15 @@ events.prototype._action_setValue2 = function (data, x, y, prefix) {
|
||||
|
||||
events.prototype._action_addValue = function (data, x, y, prefix) {
|
||||
this.addValue(data.name, data.value, prefix);
|
||||
if (data.refresh) {
|
||||
if (core.status.hero.hp <= 0) {
|
||||
core.status.hero.hp = 0;
|
||||
core.updateStatusBar();
|
||||
core.events.lose();
|
||||
} else {
|
||||
core.updateStatusBar();
|
||||
}
|
||||
}
|
||||
core.doAction();
|
||||
}
|
||||
|
||||
@ -2279,17 +2297,11 @@ events.prototype.setValue = function (name, value, prefix, add) {
|
||||
this._setValue_setFlag(name, value);
|
||||
this._setValue_setSwitch(name, value, prefix);
|
||||
this._setValue_setGlobal(name, value);
|
||||
core.updateStatusBar();
|
||||
}
|
||||
|
||||
events.prototype._setValue_setStatus = function (name, value) {
|
||||
if (name.indexOf("status:") !== 0) return;
|
||||
core.setStatus(name.substring(7), value);
|
||||
if (core.status.hero.hp <= 0) {
|
||||
core.status.hero.hp = 0;
|
||||
core.updateStatusBar();
|
||||
core.events.lose();
|
||||
}
|
||||
}
|
||||
|
||||
events.prototype._setValue_setItem = function (name, value) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user