查看: 988|回复: 1

[有事请教] 如何给插件加一个注释开关

[复制链接]

不活君

梦石
0
星屑
1378
在线时间
1234 小时
注册时间
2011-2-16
回帖
646
发表于 2024-2-6 02:00:04 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
//=============================================================================
// 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:>之类的才能作用到这个技能
不知不觉就几百天过去了 经历无数个雨夜 清晨 黎明 先是兴奋 厌倦 释然 会觉得很有趣 然后又会觉得无趣 最后有一种归属感 满足感
梦石
0
星屑
7009
在线时间
1280 小时
注册时间
2016-12-6
回帖
378
发表于 2024-2-6 09:41:25 | 显示全部楼层
  1. (function() {

  2.     var _Window_BattleLog_displayActionResults = Window_BattleLog.prototype.displayActionResults;
  3.     Window_BattleLog.prototype.displayActionResults = function(subject, target) {
  4.         _Window_BattleLog_displayActionResults.call(this, subject, target);

  5.         //追加条件检测
  6.         if (this.shouldDisplayAllResults(subject)) {
  7.             while (this._methods.length > 0) {
  8.                 this.callNextMethod();
  9.             }
  10.         }
  11.     };

  12.     Window_BattleLog.prototype.shouldDisplayAllResults = function(subject) {
  13.         var action = subject.currentAction();
  14.         if (action && action.item()) {
  15.             // 检查技能注释中是否有 <AllResults> 标签
  16.             return !!action.item().meta.AllResults;
  17.         }
  18.         return false;
  19.     };

  20.     BattleManager.updateAction = function() {
  21.         while (this._targets.length > 0) {
  22.             var target = this._targets.shift();
  23.             if (target) {
  24.                 this.invokeAction(this._subject, target);
  25.             }
  26.         }
  27.         this.endAction();
  28.     };

  29. })();
复制代码


试试看,注释格式是<AllResults>
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部