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

Project1

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

[搬运汉化] 人工汉化插件(浮游术)

[复制链接]

Lv4.逐梦者

梦石
0
星屑
7419
在线时间
956 小时
注册时间
2019-5-21
帖子
544

极短24参与极短21参与

跳转到指定楼层
1
发表于 2021-1-18 17:40:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
测试过可以使用的~
还要感谢分享插件本体的坛友们XD
  1. //=============================================================================
  2. // FloatingCharacter.js
  3. // ----------------------------------------------------------------------------
  4. // (C) 2016 Triacontane
  5. // This software is released under the MIT License.
  6. // http://opensource.org/licenses/mit-license.php
  7. // ----------------------------------------------------------------------------
  8. // Version
  9. // 1.5.1 2020/03/24 競合等の理由でメモ欄が取得できない場合に発生するエラーを回避
  10. // 1.5.0 2020/03/13 浮遊速度を変更できる機能を追加
  11. // 1.4.1 2019/06/18 メモ欄の設定を適切に読み込めるように修正(ツミオ)
  12. // 1.4.0 2018/10/08 浮遊イベントの影を非表示にできる機能を追加
  13. // 1.3.0 2018/01/24 イベントを初期状態で浮遊させる機能を追加
  14. // 1.2.0 2018/01/07 プレイヤーの浮遊とフォロワーと連動させるかどうかを選択できる機能を追加
  15. // 1.1.2 2016/07/31 パラメータ名の変換ミス修正(敷居値→閾値)
  16. //                  隊列歩行時のフォロワーの高度がデフォルト値で固定になっていた問題の修正
  17. // 1.1.1 2016/04/06 本プラグインを適用していないセーブデータをロードしたときも、正しく動作するよう修正
  18. // 1.1.0 2016/04/03 一定以上の高度の場合のみ通行可能になる地形タグとリージョンを指定できる機能を追加
  19. //                  着地可能な場合のみ着地する機能を追加、指定されたキャラクターが浮遊中かどうかの判定を追加
  20. // 1.0.2 2016/03/31 隊列歩行でない場合のフォロワーや画像が指定されていないイベントでも影が表示される不具合を修正
  21. // 1.0.1 2016/03/31 浮遊中に強制的に待機アニメが設定される仕様を撤廃
  22. // 1.0.0 2016/03/29 初版
  23. // ----------------------------------------------------------------------------
  24. // [Blog]   : https://triacontane.blogspot.jp/
  25. // [Twitter]: https://twitter.com/triacontane/
  26. // [GitHub] : https://github.com/triacontane/
  27. //=============================================================================

  28. /*:
  29. * @plugindesc Floating character plugin
  30. * @author triacontane
  31. *
  32. * @param TerrainTags
  33. * @desc 浮空时可通行的地形标志,以逗号分隔
  34. * 例:1,2,3
  35. * @default
  36. *
  37. * @param RegionId
  38. * @desc 浮空时可通行的区域编号,以逗号分隔
  39. * 例:1,2,3
  40. * @default
  41. *
  42. * @param HighestTerrainTags
  43. * @desc 在该高度以上的地形,可以浮空通行
  44. * 例:1,2,3
  45. * @default
  46. *
  47. * @param HighestRegionId
  48. * @desc 在该高度以上的区域,可以浮空通行
  49. * 例:1,2,3
  50. * @default
  51. *
  52. * @param HighestThreshold
  53. * @desc 该高度的值
  54. * @default 48
  55. *
  56. * @param FloatFollower
  57. * @desc 浮空时,队员/跟随者也会自动浮空
  58. * @default true
  59. * @type boolean
  60. *
  61. * @help 使角色浮空
  62. * 浮空时有以下效果。
  63. *
  64. * 允许在多个指定的地形标签通行。
  65. * 允许在多个指定的区域通行。
  66. * 禁用图块的梯子、茂密、有害地形。
  67. *
  68. * Script
  69. * 从“指定移动路径”的“脚本”中执行以下操作。
  70. *
  71. * this.float([权重], [高度(省略时为图块尺寸的一半)]);
  72. *  使角色浮空[高度]的像素。
  73. *  如果将[权重]设置为[ture],则在浮空完成前不会转移到下一命令。
  74. *  例:this.float(true, 48);
  75. *
  76. * this.landing([权重]);
  77. *  使角色着陆。
  78. *  如果将[权重]设置为[true],则在着陆完成前不会转移到下一命令。
  79. *  例:this.landing(true);
  80. *
  81. * this.landingIfOk([权重]);
  82. *  在可以着陆的地形上,使角色着陆。
  83. *  是否着陆的条件与飞行船的着陆条件相同。
  84. *  如果将[权重]设置为[true],则在落地完成前不会转移到下一命令。
  85. *  例:this.landingIfOk(true);
  86. *
  87. * this.setFloatSpeed([速度]);
  88. *  设定浮空速度。通常情况下,用[1]指定较大的数字会变快。
  89. *
  90. * Script
  91. * 从“条件分支”的“脚本”中执行以下操作。
  92. *
  93. * this.isFloating([キャラクターID]);
  94. *  指定的角色浮空时在,执行分支。
  95. *  指定角色ID如下。
  96. *
  97. *  -1   : 玩家
  98. *  0    : 本事件
  99. *  1... : 指定ID的事件
  100. *
  101. * 此插件没有插件指令。
  102. *
  103. * 在事件的备注栏中如此输入,则该事件初始即浮空
  104. * <FCAltitude:24> # 以24个像素的高度浮动
  105. * <FC高度:24>     # 同上
  106. *
  107. * 在事件的备注栏中如此输入,则该事件浮空时无阴影
  108. * <FC影なし>
  109. * <FCNoShadow>
  110. *
  111. *
  112. * 利用規約:
  113. *  作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等)
  114. *  についても制限はありません。
  115. *  このプラグインはもうあなたのものです。
  116. */

  117. (function () {
  118.     'use strict';
  119.     var pluginName = 'FloatingCharacter';
  120.     var metaTagPrefix = 'FC';

  121.     var getParamString = function(paramNames) {
  122.         var value = getParamOther(paramNames);
  123.         return value == null ? '' : value;
  124.     };

  125.     var getParamNumber = function(paramNames, min, max) {
  126.         var value = getParamOther(paramNames);
  127.         if (arguments.length < 2) min = -Infinity;
  128.         if (arguments.length < 3) max = Infinity;
  129.         return (parseInt(value, 10) || 0).clamp(min, max);
  130.     };

  131.     var getParamBoolean = function(paramNames) {
  132.         var value = getParamOther(paramNames);
  133.         return (value || '').toUpperCase() === 'ON' || (value || '').toUpperCase() === 'TRUE';
  134.     };

  135.     var getParamOther = function(paramNames) {
  136.         if (!Array.isArray(paramNames)) paramNames = [paramNames];
  137.         for (var i = 0; i < paramNames.length; i++) {
  138.             var name = PluginManager.parameters(pluginName)[paramNames[i]];
  139.             if (name) return name;
  140.         }
  141.         return null;
  142.     };

  143.     var getParamArrayString = function (paramNames) {
  144.         var values = getParamString(paramNames).split(',');
  145.         for (var i = 0; i < values.length; i++) values[i] = values[i].trim();
  146.         return values;
  147.     };

  148.     var getParamArrayNumber = function (paramNames, min, max) {
  149.         var values = getParamArrayString(paramNames);
  150.         if (arguments.length < 2) min = -Infinity;
  151.         if (arguments.length < 3) max = Infinity;
  152.         for (var i = 0; i < values.length; i++) {
  153.             if (!isNaN(parseInt(values[i], 10))) {
  154.                 values[i] = (parseInt(values[i], 10) || 0).clamp(min, max);
  155.             } else {
  156.                 values.splice(i--, 1);
  157.             }
  158.         }
  159.         return values;
  160.     };

  161.     var getMetaValue = function(object, name) {
  162.         var metaTagName = metaTagPrefix + name;
  163.         if (!object.meta) {
  164.             return undefined;
  165.         }
  166.         return object.meta.hasOwnProperty(metaTagName) ? convertEscapeCharacters(object.meta[metaTagName]) : undefined;
  167.     };

  168.     var getMetaValues = function(object, names) {
  169.         for (var i = 0, n = names.length; i < n; i++) {
  170.             var value = getMetaValue(object, names[i]);
  171.             if (value !== undefined) return value;
  172.         }
  173.         return undefined;
  174.     };

  175.     var hasMetaValue = function(object, name) {
  176.         var metaTagName = metaTagPrefix + name;
  177.         if (!object.meta) {
  178.             return false;
  179.         }
  180.         return object.meta.hasOwnProperty(metaTagName);
  181.     };

  182.     var hasMetaValues = function(object, names) {
  183.         return names.some(function(name) {
  184.             return hasMetaValue(object, name);
  185.         });
  186.     };

  187.     var convertEscapeCharacters = function(text) {
  188.         if (String(text) !== text) text = '';
  189.         text = text.replace(/\\/g, '\x1b');
  190.         text = text.replace(/\x1b\x1b/g, '\\');
  191.         text = text.replace(/\x1bV\[(\d+)\]/gi, function() {
  192.             return $gameVariables.value(parseInt(arguments[1]));
  193.         }.bind(this));
  194.         text = text.replace(/\x1bV\[(\d+)\]/gi, function() {
  195.             return $gameVariables.value(parseInt(arguments[1]));
  196.         }.bind(this));
  197.         text = text.replace(/\x1bN\[(\d+)\]/gi, function() {
  198.             var actor = parseInt(arguments[1]) >= 1 ? $gameActors.actor(parseInt(arguments[1])) : null;
  199.             return actor ? actor.name() : '';
  200.         }.bind(this));
  201.         text = text.replace(/\x1bP\[(\d+)\]/gi, function() {
  202.             var actor = parseInt(arguments[1]) >= 1 ? $gameParty.members()[parseInt(arguments[1]) - 1] : null;
  203.             return actor ? actor.name() : '';
  204.         }.bind(this));
  205.         text = text.replace(/\x1bG/gi, TextManager.currencyUnit);
  206.         return text;
  207.     };

  208.     //=============================================================================
  209.     // パラメータの取得と整形
  210.     //=============================================================================
  211.     var paramTerrainTags         = getParamArrayNumber(['通行可能地形タグ', 'TerrainTags']);
  212.     var paramRegionId            = getParamArrayNumber(['通行可能リージョン', 'RegionId']);
  213.     var paramHighestTerrainTags  = getParamArrayNumber(['高度通行地形タグ', 'HighestTerrainTags']);
  214.     var paramHighestRegionId     = getParamArrayNumber(['高度通行リージョン', 'HighestRegionId']);
  215.     var paramHighestThreshold    = getParamNumber(['高度閾値', 'HighestThreshold']);
  216.     var paramFloatFollower       = getParamBoolean(['フォロワー連動', 'FloatFollower']);

  217.     //=============================================================================
  218.     // Game_Interpreter
  219.     //  キャラクターの浮遊判定を追加定義します。
  220.     //=============================================================================
  221.     Game_Interpreter.prototype.isFloating = function(characterId) {
  222.         var character = this.character(characterId);
  223.         if (character !== null) {
  224.             return character.isFloating();
  225.         } else {
  226.             return false;
  227.         }
  228.     };

  229.     //=============================================================================
  230.     // Game_CharacterBase
  231.     //  キャラクターの浮遊関連情報を追加定義します。
  232.     //=============================================================================
  233.     var _Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
  234.     Game_CharacterBase.prototype.initMembers = function() {
  235.         _Game_CharacterBase_initMembers.apply(this, arguments);
  236.         this.initFloatingInfo();
  237.     };
  238.     Game_CharacterBase.prototype.isLowest      = Game_Vehicle.prototype.isLowest;
  239.     Game_CharacterBase.prototype.isHighest     = Game_Vehicle.prototype.isHighest;
  240.     Game_CharacterBase.prototype.shadowOpacity = Game_Vehicle.prototype.shadowOpacity;

  241.     Game_CharacterBase.prototype.initFloatingInfo = function() {
  242.         this._altitude           = 0;
  243.         this._altitudeAnimeCount = 0;
  244.         this._maxAltitude        = 0;
  245.         this._needFloat          = false;
  246.         this._floatSpped         = 1;
  247.     };

  248.     var _Game_CharacterBase_isMapPassable = Game_CharacterBase.prototype.isMapPassable;
  249.     Game_CharacterBase.prototype.isMapPassable = function(x, y, d) {
  250.         if (this.isNeedFloat()) {
  251.             var x2 = $gameMap.roundXWithDirection(x, d);
  252.             var y2 = $gameMap.roundYWithDirection(y, d);
  253.             if (paramRegionId.some(function(id) {
  254.                     return id === $gameMap.regionId(x2, y2);
  255.                 }.bind(this))) return true;
  256.             if (paramTerrainTags.some(function(id) {
  257.                     return id === $gameMap.terrainTag(x2, y2);
  258.                 }.bind(this))) return true;
  259.             if (this._altitude >= paramHighestThreshold) {
  260.                 if (paramHighestRegionId.some(function(id) {
  261.                         return id === $gameMap.regionId(x2, y2);
  262.                     }.bind(this))) return true;
  263.                 if (paramHighestTerrainTags.some(function(id) {
  264.                         return id === $gameMap.terrainTag(x2, y2);
  265.                     }.bind(this))) return true;
  266.             }
  267.         }
  268.         return _Game_CharacterBase_isMapPassable.apply(this, arguments);
  269.     };

  270.     var _Game_CharacterBase_screenY = Game_CharacterBase.prototype.screenY;
  271.     Game_CharacterBase.prototype.screenY = function() {
  272.         return _Game_CharacterBase_screenY.apply(this, arguments) +
  273.             (this.isFloating() ? Math.floor(Math.sin(this._altitudeAnimeCount / 16) * 3) - this._altitude : 0);
  274.     };

  275.     var _Game_CharacterBase_screenZ = Game_CharacterBase.prototype.screenZ;
  276.     Game_CharacterBase.prototype.screenZ = function() {
  277.         return _Game_CharacterBase_screenZ.apply(this, arguments) +
  278.             (this._altitude >= $gameMap.tileHeight() ? 1 : 0);
  279.     };

  280.     Game_CharacterBase.prototype.screenShadowY = function() {
  281.         return _Game_CharacterBase_screenY.apply(this, arguments) - this.screenY();
  282.     };

  283.     var _Game_CharacterBase_isOnLadder = Game_CharacterBase.prototype.isOnLadder;
  284.     Game_CharacterBase.prototype.isOnLadder = function() {
  285.         return this.isFloating() ? false : _Game_CharacterBase_isOnLadder.apply(this, arguments);
  286.     };

  287.     var _Game_CharacterBase_isOnBush = Game_CharacterBase.prototype.isOnBush;
  288.     Game_CharacterBase.prototype.isOnBush = function() {
  289.         return this.isFloating() ? false : _Game_CharacterBase_isOnBush.apply(this, arguments);
  290.     };

  291.     Game_CharacterBase.prototype.maxAltitude = function() {
  292.         return this._maxAltitude;
  293.     };

  294.     Game_CharacterBase.prototype.isFloating = function() {
  295.         return this._altitude > 0;
  296.     };

  297.     Game_CharacterBase.prototype.isShadowVisible = function() {
  298.         return this.isFloating() && (this._characterName || this._tileId) && this.isNeedShadow();
  299.     };

  300.     Game_CharacterBase.prototype.isNeedFloat = function() {
  301.         return this._needFloat;
  302.     };

  303.     Game_CharacterBase.prototype.float = function(waitFlg, max) {
  304.         if (!this.hasOwnProperty('_altitude') || isNaN(this._altitude)) {
  305.             this.initFloatingInfo();
  306.         }
  307.         if (!max) max = $gameMap.tileHeight() / 2;
  308.         this._needFloat   = true;
  309.         this._maxAltitude = max;
  310.         if (waitFlg) {
  311.             this._waitCount = this.getFloatingWaitCount(this.maxAltitude() - this._altitude);
  312.         }
  313.     };

  314.     Game_CharacterBase.prototype.landing = function(waitFlg) {
  315.         this._needFloat = false;
  316.         if (waitFlg) {
  317.             this._waitCount = this.getFloatingWaitCount(this.maxAltitude());
  318.         }
  319.     };

  320.     Game_CharacterBase.prototype.getFloatingWaitCount = function(altitudeDiff) {
  321.         return Math.floor(Math.max(altitudeDiff, 0) / this.getFloatSpeed());
  322.     };

  323.     Game_CharacterBase.prototype.landingIfOk = function(waitFlg) {
  324.         if ($gameMap.isAirshipLandOk(this.x, this.y)) this.landing(waitFlg);
  325.     };

  326.     var _Game_CharacterBase_update = Game_CharacterBase.prototype.update;
  327.     Game_CharacterBase.prototype.update = function() {
  328.         _Game_CharacterBase_update.apply(this, arguments);
  329.         this.updateFloating();
  330.     };

  331.     Game_CharacterBase.prototype.isNeedShadow = function() {
  332.         return false;
  333.     };

  334.     Game_CharacterBase.prototype.getFloatSpeed = function() {
  335.         return this._floatSpped || 1;
  336.     };

  337.     Game_CharacterBase.prototype.setFloatSpeed = function(value) {
  338.         return this._floatSpped = value;
  339.     };

  340.     Game_CharacterBase.prototype.updateFloating = function() {
  341.         this._floatingPrev = this.isFloating();
  342.         if (this.isNeedFloat()) {
  343.             if (this.isHighest()) {
  344.                 this._altitudeAnimeCount++;
  345.             }
  346.             this._altitude = Math.min(this._altitude + this.getFloatSpeed(), this.maxAltitude());
  347.         } else {
  348.             if (this.isHighest()) {
  349.                 this._altitudeAnimeCount = 0;
  350.             }
  351.             this._altitude = Math.max(this._altitude - this.getFloatSpeed(), 0);
  352.         }
  353.         if (this._floatingPrev !== this.isFloating()) {
  354.             this.refreshBushDepth();
  355.         }
  356.     };

  357.     Game_Player.prototype.float = function(waitFlg, max) {
  358.         Game_CharacterBase.prototype.float.apply(this, arguments);
  359.         if (!paramFloatFollower) {
  360.             return;
  361.         }
  362.         this.followers().forEach(function(follower) {
  363.             follower.float(waitFlg, max);
  364.             follower._altitude = -follower._memberIndex * 4;
  365.         }.bind(this));
  366.     };

  367.     var _Game_Player_isOnDamageFloor = Game_Player.prototype.isOnDamageFloor;
  368.     Game_Player.prototype.isOnDamageFloor = function() {
  369.         return this.isFloating() ? false : _Game_Player_isOnDamageFloor.apply(this, arguments);
  370.     };

  371.     Game_Player.prototype.landing = function() {
  372.         Game_CharacterBase.prototype.landing.apply(this, arguments);
  373.         if (!paramFloatFollower) {
  374.             return;
  375.         }
  376.         this.followers().forEach(function(follower) {
  377.             follower.landing();
  378.         }.bind(this));
  379.     };

  380.     Game_Player.prototype.setFloatSpeed = function(value) {
  381.         Game_CharacterBase.prototype.setFloatSpeed.apply(this, arguments);
  382.         if (!paramFloatFollower) {
  383.             return;
  384.         }
  385.         this.followers().forEach(function(follower) {
  386.             follower.setFloatSpeed(value);
  387.         }.bind(this));
  388.     };

  389.     Game_Vehicle.prototype.updateFloating = function() {};
  390.     Game_Vehicle.prototype.isFloating = function() {
  391.         return false;
  392.     };

  393.     var _Game_Event_initialize = Game_Event.prototype.initialize;
  394.     Game_Event.prototype.initialize = function(mapId, eventId) {
  395.         _Game_Event_initialize.apply(this, arguments);
  396.         var altitude = getMetaValues(this.event(), ['高度', 'Altitude']);
  397.         this._noShadow = hasMetaValues(this.event(), ['影なし', 'NoShadow']);
  398.         if (altitude !== undefined) {
  399.             this.setInitAltitude(parseInt(altitude || 24));
  400.         }
  401.     };

  402.     Game_Event.prototype.setInitAltitude = function(altitude) {
  403.         this.float(false, altitude);
  404.         this._altitude = this._maxAltitude;
  405.         this.refreshBushDepth();
  406.     };

  407.     Game_Event.prototype.isNeedShadow = function() {
  408.         return !this._noShadow;
  409.     };

  410.     //=============================================================================
  411.     // Sprite_Character
  412.     //  キャラクターの浮遊関連情報を追加定義します。
  413.     //=============================================================================
  414.     var _Sprite_Character_initMembers = Sprite_Character.prototype.initMembers;
  415.     Sprite_Character.prototype.initMembers = function() {
  416.         _Sprite_Character_initMembers.apply(this, arguments);
  417.         this._shadowSprite = null;
  418.     };

  419.     var _Sprite_Character_update = Sprite_Character.prototype.update;
  420.     Sprite_Character.prototype.update = function() {
  421.         _Sprite_Character_update.apply(this, arguments);
  422.         this.updateFloating();
  423.     };

  424.     Sprite_Character.prototype.updateFloating = function() {
  425.         if (this._character.isShadowVisible()) {
  426.             if (!this._shadowSprite) this.createShadow();
  427.             this._shadowSprite.y = this._character.screenShadowY();
  428.             this._shadowSprite.opacity = this._character.shadowOpacity();
  429.         } else if (this._shadowSprite) {
  430.             this.disposeShadow();
  431.         }
  432.     };

  433.     Sprite_Character.prototype.createShadow = function() {
  434.         this._shadowSprite = new Sprite();
  435.         this._shadowSprite.bitmap = ImageManager.loadSystem('Shadow1');
  436.         this._shadowSprite.anchor.x = 0.5;
  437.         this._shadowSprite.anchor.y = 1;
  438.         this.addChild(this._shadowSprite);
  439.     };

  440.     Sprite_Character.prototype.disposeShadow = function() {
  441.         this.removeChild(this._shadowSprite);
  442.         this._shadowSprite = null;
  443.     };
  444. })();

复制代码

Lv4.逐梦者

梦石
0
星屑
9329
在线时间
1842 小时
注册时间
2020-1-2
帖子
1082
2
发表于 2021-1-18 23:42:50 | 只看该作者
源地址呢

点评

插件说明里有的呀  发表于 2021-1-19 09:17
B站没人气的夏目漠漠,直播间:5378938实用插件教程点击红字传送
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-16 00:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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