查看: 6169|回复: 9

[原创发布] 冲刺过长时间角色疲惫插件

[复制链接]
梦石
0
星屑
296
在线时间
217 小时
注册时间
2008-12-18
回帖
30
发表于 2018-9-15 00:42:26 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 魏玉龙 于 2018-9-15 09:10 编辑

看到有人需要类似的功能就顺手写了一个插件!
冲刺过长时间,角色会减速。当取消冲刺状态或停止后下来会自动恢复耐力!
冲刺的加速度及减速度会均匀增加,陷入疲惫状态会有气泡提示!

  1. /*:
  2. * Acceleration.js
  3. * @plugindesc 均匀加减速插件
  4. * @author 魏玉龙
  5. * @since 2018.09.15
  6. * @version 1.0
  7. *
  8. * @param speed
  9. * @desc 加速度
  10. * @default 0.01
  11. *
  12. * @param stamina
  13. * @desc 角色冲刺持续帧数,为0时可无限时冲刺。
  14. * @default 600
  15. *
  16. */

  17. (function () {
  18.     var parameters = PluginManager.parameters('Acceleration');
  19.     var speed = Number(parameters['speed'] || 0.01);
  20.     var stamina = Number(parameters['stamina'] || 600);

  21.     var Game_CharacterBase_prototype_initMembers = Game_CharacterBase.prototype.initMembers;
  22.     Game_CharacterBase.prototype.initMembers = function () {
  23.         Game_CharacterBase_prototype_initMembers.call(this);
  24.         this._dashSpeed = 0;
  25.         this._stamina = stamina;
  26.     }

  27.     Game_CharacterBase.prototype.realMoveSpeed = function () {
  28.         return this._moveSpeed + this._dashSpeed;
  29.     }

  30.     var Game_CharacterBase_prototype_updateStop = Game_CharacterBase.prototype.updateStop;
  31.     Game_CharacterBase.prototype.updateStop = function () {
  32.         Game_CharacterBase_prototype_updateStop.call(this);
  33.         if (this._dashSpeed != 0) {
  34.             this._dashSpeed = 0;
  35.         }
  36.         if (this._stamina < stamina) {
  37.             this._stamina++;
  38.         }
  39.     }

  40.     var Game_CharacterBase_prototype_updateMove = Game_CharacterBase.prototype.updateMove;
  41.     Game_CharacterBase.prototype.updateMove = function () {
  42.         Game_CharacterBase_prototype_updateMove.call(this);
  43.         this.updateDashSpeed();
  44.     }

  45.     Game_CharacterBase.prototype.updateDashSpeed = function () {
  46.         if (this.isDashing()) {
  47.             if (this._stamina > 0 || stamina == 0) {
  48.                 this._dashSpeed = Math.min(this._dashSpeed + speed, 1);
  49.                 this._stamina > 0 && this._stamina--;
  50.             } else {
  51.                 if (this._stamina == 0 && this._dashSpeed == 1) {
  52.                     this.requestBalloon(7);
  53.                 }
  54.                 this._dashSpeed = Math.max(this._dashSpeed - speed, -1);
  55.             }
  56.         } else {
  57.             if (this._dashSpeed > 0) {
  58.                 this._dashSpeed = Math.max(this._dashSpeed - speed, 0);
  59.             } else {
  60.                 this._dashSpeed = Math.min(this._dashSpeed + speed, 0);
  61.             }
  62.             if (this._stamina < stamina) {
  63.                 this._stamina++;
  64.             }
  65.         }
  66.     }
  67. })();
复制代码

评分

参与人数 4赞 +4 收起 理由
king + 1 塞糖
wr282828 + 1 塞糖
微笑的迪妮莎 + 1 棒棒的
白嫩白嫩的 + 1 塞糖

查看全部评分

梦石
0
星屑
3074
在线时间
685 小时
注册时间
2018-6-1
回帖
253
发表于 2018-9-15 08:42:23 | 显示全部楼层
是不是地图跑步?
回复

使用道具 举报

梦石
0
星屑
7427
在线时间
948 小时
注册时间
2017-9-27
回帖
566
发表于 2018-9-15 10:51:53 | 显示全部楼层
类似Diablo2里面的耐力,让你不能无限跑步
回复

使用道具 举报

梦石
0
星屑
159
在线时间
13 小时
注册时间
2018-9-23
回帖
36
发表于 2018-9-23 21:41:58 | 显示全部楼层
赞美!
回复

使用道具 举报

梦石
0
星屑
15
在线时间
2 小时
注册时间
2018-9-14
回帖
3
发表于 2018-9-25 10:32:13 | 显示全部楼层
漂亮
回复

使用道具 举报

梦石
0
星屑
54
在线时间
8 小时
注册时间
2018-4-2
回帖
20
发表于 2018-9-27 21:48:40 | 显示全部楼层
可以改气泡吗
回复

使用道具 举报

梦石
0
星屑
296
在线时间
217 小时
注册时间
2008-12-18
回帖
30
 楼主| 发表于 2018-10-3 10:03:26 | 显示全部楼层

第58行
  1. this.requestBalloon(7);
复制代码

这里就是调用气泡
里面的数字你可以看着改
回复

使用道具 举报

梦石
0
星屑
735
在线时间
208 小时
注册时间
2013-9-5
回帖
54
发表于 2018-10-4 21:22:36 | 显示全部楼层
时间可以随等级和使用道具增加吗?可以实现吗?
这5天有点事,不上来,5天后见
回复

使用道具 举报

梦石
0
星屑
60
在线时间
10 小时
注册时间
2021-3-30
回帖
1
发表于 2021-5-29 00:32:04 | 显示全部楼层
感谢,请问可以修改使用吗?正想做一个类似于疲劳值的系统,疲劳达到最大的时候无法冲刺(可能还会联动其他的事件)
回复

使用道具 举报

梦石
0
星屑
964
在线时间
130 小时
注册时间
2021-5-3
回帖
15
发表于 2021-6-14 00:49:21 | 显示全部楼层
感觉做得很棒,如果有前两位说的就更好了,话说有打算弄成插件的格式吗
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部