赞 | 12 |
VIP | 0 |
好人卡 | 9 |
积分 | 13 |
经验 | 3837 |
最后登录 | 2024-7-16 |
在线时间 | 471 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1268
- 在线时间
- 471 小时
- 注册时间
- 2012-4-8
- 帖子
- 320
|
本帖最后由 505681468 于 2024-4-3 11:58 编辑
哦哦,原来是赋值,这样直接赋值确实是不行的
因为它套了一层访问保护
- Object.defineProperties(Game_BattlerBase.prototype, {
- // Hit Points
- hp: { get: function() { return this._hp; }, configurable: true }
- // 其他属性也是保护
- });
复制代码
需要设置 $gameMap.event(5).battler()._hp = 10 来设置底层的数据
或者是 setHp 来设置
- Game_BattlerBase.prototype.setHp = function(hp) {
- this._hp = hp;
- this.refresh();
- };
复制代码
再者就是 hp 会受到 mhp(max hp)限制,不能设定超过 mhp 的部分
而 mhp 也受到限制,他每次通过 mhp 获取都会重新计算数值,不是一个固定的变量,而是多个变量组合
可以通过走原系统的 buff 路线来增加,用 Game_BattlerBase.addParam(0, value) 来设置 mhp
- Object.defineProperties(Game_BattlerBase.prototype, {
- // Maximum Hit Points
- mhp: { get: function() { return this.param(0); }, configurable: true },
- });
- // paramBase 读取配置
- // paramPlus 读取额外数值
- Game_BattlerBase.prototype.param = function(paramId) {
- var value = this.paramBase(paramId) + this.paramPlus(paramId);
- value *= this.paramRate(paramId) * this.paramBuffRate(paramId);
- var maxValue = this.paramMax(paramId);
- var minValue = this.paramMin(paramId);
- return Math.round(value.clamp(minValue, maxValue));
- };
- Game_BattlerBase.prototype.addParam = function(paramId, value) {
- this._paramPlus[paramId] += value;
- this.refresh();
- };
复制代码
事件页自定义的ai是寻路、寻敌、攻击行为还是啥,
粗略瞅了瞅demo,看着都是插件指令说的功能
|
|