Project1
标题:
如何给插件加一个注释开关
[打印本页]
作者:
fangqing9
时间:
2024-2-6 02:00
标题:
如何给插件加一个注释开关
//=============================================================================
// DisplayAllResults.js
//=============================================================================
/*:
* @plugindesc 全体范围技能一次性展示所有结果
* @author Siabo
*
* @help
*/
(function() {
var _Window_BattleLog_displayActionResults = Window_BattleLog.prototype.displayActionResults;
Window_BattleLog.prototype.displayActionResults = function(subject, target) {
_Window_BattleLog_displayActionResults.call(this, subject, target)
while (this._methods.length > 0) {
this.callNextMethod();
}
};
BattleManager.updateAction = function() {
while (this._targets.length > 0) {
var target = this._targets.shift();
if (target) {
this.invokeAction(this._subject, target);
}
}
this.endAction();
};
})();
上面的插件是让MV技能全体攻击逐个触发伤害变成一次性攻击全部敌人触发伤害 如何做个开关 比如在我想要变成一次性触发伤害的技能的注释里写上<XXXX:>之类的才能作用到这个技能
作者:
shiroin
时间:
2024-2-6 09:41
(function() {
var _Window_BattleLog_displayActionResults = Window_BattleLog.prototype.displayActionResults;
Window_BattleLog.prototype.displayActionResults = function(subject, target) {
_Window_BattleLog_displayActionResults.call(this, subject, target);
//追加条件检测
if (this.shouldDisplayAllResults(subject)) {
while (this._methods.length > 0) {
this.callNextMethod();
}
}
};
Window_BattleLog.prototype.shouldDisplayAllResults = function(subject) {
var action = subject.currentAction();
if (action && action.item()) {
// 检查技能注释中是否有 <AllResults> 标签
return !!action.item().meta.AllResults;
}
return false;
};
BattleManager.updateAction = function() {
while (this._targets.length > 0) {
var target = this._targets.shift();
if (target) {
this.invokeAction(this._subject, target);
}
}
this.endAction();
};
})();
复制代码
试试看,注释格式是<AllResults>
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1