设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 565|回复: 10
打印 上一主题 下一主题

[有事请教] 如何禁用补血道具?【已解决】

[复制链接]

Lv4.逐梦者

梦石
2
星屑
7533
在线时间
460 小时
注册时间
2021-12-4
帖子
492

MZ评测员

1
发表于 2024-5-5 20:59:39 | 显示全部楼层
rpg_objects.js 第 2774 行:
Game_BattlerBase.prototype.isOccasionOk = function(item) {
    if ($gameParty.inBattle()) {
        return item.occasion === 0 || item.occasion === 1;
    } else {
        return item.occasion === 0 || item.occasion === 2;
    }
};

Game_BattlerBase.prototype.meetsUsableItemConditions = function(item) {
    return this.canMove() && this.isOccasionOk(item);
};

Game_BattlerBase.prototype.meetsSkillConditions = function(skill) {
    return (this.meetsUsableItemConditions(skill) &&
            this.isSkillWtypeOk(skill) && this.canPaySkillCost(skill) &&
            !this.isSkillSealed(skill.id) && !this.isSkillTypeSealed(skill.stypeId));
};

Game_BattlerBase.prototype.meetsItemConditions = function(item) {
    return this.meetsUsableItemConditions(item) && $gameParty.hasItem(item);
};

Game_BattlerBase.prototype.canUse = function(item) {
    if (!item) {
        return false;
    } else if (DataManager.isSkill(item)) {
        return this.meetsSkillConditions(item);
    } else if (DataManager.isItem(item)) {
        return this.meetsItemConditions(item);
    } else {
        return false;
    }
};
你总是可以通过判断 item.id 或 skill.id 的取值范围以及各种条件(变量、开关、地图ID、队员等级、主角坐标……)来改变这个函数的执行结果,occasion为0、1、2默认表示【随时、战斗、战斗外】三种场合可用。
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
2
星屑
7533
在线时间
460 小时
注册时间
2021-12-4
帖子
492

MZ评测员

2
发表于 2024-5-6 10:54:08 | 显示全部楼层
Game_BattlerBase.prototype.canUse = function(item) {
    if ($gameSwitches.value(1355) === false) return false; // 本行为新增内容,但是你确定不再判断一下item.id什么的?
    if (!item) {
        return false;
    } else if (DataManager.isSkill(item)) {
        return this.meetsSkillConditions(item);
    } else if (DataManager.isItem(item)) {
        return this.meetsItemConditions(item);
    } else {
        return false;
    }
};
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-9-24 03:13

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表