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

Project1

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

[有事请教] 有没有战斗结束自动触发公共事件的办法?

[复制链接]

Lv2.观梦者

梦石
0
星屑
479
在线时间
53 小时
注册时间
2018-12-18
帖子
40
跳转到指定楼层
1
发表于 2019-5-2 04:51:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
10星屑
想做召唤技能,召唤效果可以用公共事件完成但是召唤兽没法收回去,有没有战斗结束自动触发公共事件的办法?YEP只有每场战斗时都触发同一公共事件的插件,没有战斗后的。

Lv4.逐梦者

梦石
0
星屑
17970
在线时间
2165 小时
注册时间
2015-7-4
帖子
919
2
发表于 2019-5-2 09:49:44 | 只看该作者
你是不是用的暗雷啊?明雷的战斗处理不就可以执行公共事件咯?
回复

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7126
在线时间
1364 小时
注册时间
2018-12-16
帖子
1948
3
发表于 2019-5-2 11:11:19 | 只看该作者
请问 什么是 暗雷 明雷 ???

点评

明雷是在事件里写的战斗,主角与事件接触时触发。暗雷是在地图上设置的战斗,走一定的回合数后遇敌。  发表于 2019-5-2 16:43
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
479
在线时间
53 小时
注册时间
2018-12-18
帖子
40
4
 楼主| 发表于 2019-5-2 21:54:50 | 只看该作者
Fan723 发表于 2019-5-2 09:49
你是不是用的暗雷啊?明雷的战斗处理不就可以执行公共事件咯?

暗雷也行,只要每个地图都放个并行处理的事件就行,就是太麻烦...想用插件解决
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
479
在线时间
53 小时
注册时间
2018-12-18
帖子
40
5
 楼主| 发表于 2019-5-2 21:56:12 | 只看该作者
play337 发表于 2019-5-2 11:11
请问 什么是 暗雷 明雷 ???

暗雷是走路达到一定步数遇怪,明雷是和NPC对话触发战斗

点评

THANK YOU.  发表于 2019-5-4 08:14
回复

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5591
在线时间
956 小时
注册时间
2015-2-6
帖子
160

开拓者

6
发表于 2019-5-2 23:01:20 | 只看该作者
用这个
JAVASCRIPT 代码复制下载
  1. //=============================================================================
  2. // バトルイベントを拡張するプラグイン
  3. // FTKR_ExBattleEvent.js
  4. // プラグインNo : 40
  5. // 作成者     : フトコロ
  6. // 作成日     : 2017/05/25
  7. // 最終更新日 : 2018/02/19
  8. // バージョン : v1.3.3
  9. //=============================================================================
  10.  
  11. var Imported = Imported || {};
  12. Imported.FTKR_EBE = true;
  13.  
  14. var FTKR = FTKR || {};
  15. FTKR.EBE = FTKR.EBE || {};
  16.  
  17. /*:
  18.  * @plugindesc v1.3.3 バトルイベントを拡張するプラグイン
  19.  * @author フトコロ
  20.  *
  21.  * @param Battle Event
  22.  * @desc 戦闘中に実行するコモンイベントID
  23.  * 0 - 実行しない、カンマ(,)で区切って複数設定できます
  24.  * @default
  25.  *
  26.  * @param --勝利時イベント--
  27.  * @desc
  28.  *
  29.  * @param Custom Victory Event
  30.  * @desc 戦闘勝利時の処理を変更できるようにするか
  31.  * 0 - 変更しない, 1 - 変更する
  32.  * @default 0
  33.  *
  34.  * @param Victory Event
  35.  * @desc 戦闘勝利時に実行するコモンイベントID
  36.  * 0 - 実行しない
  37.  * @default
  38.  *
  39.  * @param --敗北時イベント--
  40.  * @desc
  41.  *
  42.  * @param Custom Defeat Event
  43.  * @desc 戦闘敗北時の処理を変更できるようにするか
  44.  * 0 - 変更しない, 1 - 変更する
  45.  * @default 0
  46.  *
  47.  * @param Defeat Event
  48.  * @desc 戦闘敗北時に実行するコモンイベントID
  49.  * 0 - 実行しない
  50.  * @default
  51.  *
  52.  * @help
  53.  *-----------------------------------------------------------------------------
  54.  * 概要
  55.  *-----------------------------------------------------------------------------
  56.  * 本プラグインを実装することで、バトルイベントを拡張します。
  57.  *
  58.  * 1.戦闘勝利時の処理(*1)の前に、コモンイベントまたは敵グループに
  59.  *   設定したイベントを実行します。
  60.  *
  61.  * 2.戦闘敗北時の処理(*1)の前に、コモンイベントまたは敵グループに
  62.  *   設定したイベントを実行します。
  63.  *
  64.  * 3.バトル中に、バトルイベントとしてコモンイベントを実行します。
  65.  *
  66.  * (*1)戦闘終了時のステートの解除から、勝利等のメッセージ、戦闘報酬の処理など
  67.  *
  68.  *
  69.  * 戦闘終了時のイベントの処理が終了すると、バトル画面が終了します。
  70.  *
  71.  *
  72.  *-----------------------------------------------------------------------------
  73.  * 設定方法
  74.  *-----------------------------------------------------------------------------
  75.  * 1.「プラグインマネージャー(プラグイン管理)」に、本プラグインを追加して
  76.  *    ください。
  77.  *
  78.  *
  79.  *-----------------------------------------------------------------------------
  80.  * 戦闘勝利時のイベントの設定
  81.  *-----------------------------------------------------------------------------
  82.  * 戦闘勝利時の処理の前に、コモンイベントまたは敵グループに
  83.  * 設定したイベントを実行します。
  84.  *
  85.  * 実行するイベントは以下のいずれかです。
  86.  * 1.プラグインパラメータ<Victory Event>に設定したIDのコモンイベント
  87.  * 2.敵グループのバトルイベントで、注釈で<EBE_戦闘勝利時>と記入したページ
  88.  *
  89.  * 1と2どちらもある場合は、バトルイベントを実行します。
  90.  *
  91.  * バトルイベント内では、this._eventId で敵グループIdを取得できます。
  92.  *
  93.  *-----------------------------------------------------------------------------
  94.  * 戦闘勝利時の処理について
  95.  *-----------------------------------------------------------------------------
  96.  * プラグインパラメータ<Custom Victory Event>を 1 に設定していると
  97.  * 戦闘終了時の処理を独自に設定することができます。
  98.  *
  99.  * 通常、戦闘勝利時には以下の処理を実行しています。
  100.  * 独自処理にする場合、これらの処理が必要な場合はイベント内で実行しなくては
  101.  * いけません。
  102.  *
  103.  * 1.戦闘終了時のステート解除
  104.  * パーティー内に、戦闘終了時に解除されるステートを受けている場合に
  105.  * それを解除します。
  106.  *
  107.  * プラグインコマンド
  108.  *  EBE_戦闘終了時ステート解除
  109.  *  EBE_REMOVE_BATTLE_STATES
  110.  *
  111.  *
  112.  * 2.勝利モーションの実行
  113.  * パーティーメンバーが、戦闘勝利モーションを実行します。
  114.  *
  115.  * プラグインコマンド
  116.  *  EBE_勝利モーション実行
  117.  *  EBE_PREFORM_VICTORY
  118.  *
  119.  *
  120.  * 3.勝利MEの演奏
  121.  * データベースの[システム]-[音楽]で設定した勝利MEを演奏します。
  122.  *
  123.  * プラグインコマンド
  124.  *  EBE_勝利ME演奏
  125.  *  EBE_PLAY_VICTORY_ME
  126.  *
  127.  *
  128.  * 4.BGMBGSの再開
  129.  * 戦闘前のBGMとBGSを再開します。
  130.  *
  131.  * プラグインコマンド
  132.  *  EBE_BGMBGS再開
  133.  *  EBE_REPLAY_BGM_AND_BGS
  134.  *
  135.  *
  136.  * 5.戦闘報酬の計算
  137.  * 経験値やお金、アイテムの計算を行います。
  138.  * 入手するアイテムはこのコマンドで選定されます。
  139.  *
  140.  * プラグインコマンド
  141.  *  EBE_戦闘報酬計算
  142.  *  EBE_MAKE_REWARDS
  143.  *
  144.  *
  145.  * 6.勝利メッセージの表示
  146.  * データベースの[用語]-[メッセージ]で設定した勝利メッセージを表示します。
  147.  * 半角スペースを空けて"-s"を付けると、メッセージを閉じるまでイベント処理を
  148.  * 止めます。
  149.  *
  150.  * プラグインコマンド
  151.  *  EBE_勝利メッセージ表示 (-s)
  152.  *  EBE_DISPLAY_VICTORY_MESSAGE (-s)
  153.  *
  154.  *
  155.  * 7.戦闘報酬の表示
  156.  * 戦闘報酬の計算結果に合わせて、データベースの[用語]-[メッセージ]で設定した
  157.  * メッセージを表示します。
  158.  * 半角スペースを空けて"-s"を付けると、メッセージを閉じるまでイベント処理を
  159.  * 止めます。
  160.  *
  161.  * プラグインコマンド
  162.  *  EBE_戦闘報酬表示 (-s)
  163.  *  EBE_DISPLAY_REWARDS (-s)
  164.  *
  165.  *  
  166.  * 8.戦闘報酬の入手
  167.  * 戦闘報酬の計算結果をパーティーメンバーに反映します。
  168.  * このコマンドを実行しないと、経験値やお金アイテムは実際に入手できません。
  169.  *
  170.  * プラグインコマンド
  171.  *  EBE_戦闘報酬入手
  172.  *  EBE_GAIN_REWARDS
  173.  *
  174.  *
  175.  *-----------------------------------------------------------------------------
  176.  * 戦闘敗北時のイベントの設定
  177.  *-----------------------------------------------------------------------------
  178.  * 戦闘敗北時の処理の前に、コモンイベントまたは敵グループに
  179.  * 設定したイベントを実行します。
  180.  *
  181.  * 実行するイベントは以下のいずれかです。
  182.  * 1.プラグインパラメータ<Defeat Event>に設定したIDのコモンイベント
  183.  * 2.敵グループのバトルイベントで、注釈で<EBE_戦闘敗北時>と記入したページ
  184.  *
  185.  * 1と2どちらもある場合は、バトルイベントを実行します。
  186.  *
  187.  * バトルイベント内では、this._eventId で敵グループIdを取得できます。
  188.  *
  189.  *-----------------------------------------------------------------------------
  190.  * 戦闘敗北時の処理について
  191.  *-----------------------------------------------------------------------------
  192.  * プラグインパラメータ<Custom Defeat Event>を 1 に設定していると
  193.  * 戦闘終了時の処理を独自に設定することができます。
  194.  *
  195.  * 通常、戦闘敗北時には以下の処理を実行しています。
  196.  * 独自処理にする場合、これらの処理が必要な場合はイベント内で実行しなくては
  197.  * いけません。
  198.  *
  199.  * 1.敗北メッセージの表示
  200.  * データベースの[用語]-[メッセージ]で設定した敗北メッセージを表示します。
  201.  * 半角スペースを空けて"-s"を付けると、メッセージを閉じるまでイベント処理を
  202.  * 止めます。
  203.  *
  204.  * プラグインコマンド
  205.  *  EBE_敗北メッセージ表示 (-s)
  206.  *  EBE_DISPLAY_DEFEAT_MESSAGE (-s)
  207.  *
  208.  *
  209.  * 2.敗北MEの演奏
  210.  * データベースの[システム]-[音楽]で設定した敗北MEを演奏します。
  211.  *
  212.  * プラグインコマンド
  213.  *  EBE_敗北ME演奏
  214.  *  EBE_PLAY_DEFEAT_ME
  215.  *
  216.  *
  217.  * 3.BGMBGSの再開 または BGMの停止
  218.  * 戦闘前のBGMとBGSを再開するか、またはBGMを停止します。
  219.  * マップイベントで戦闘の敗北を許可しているかどうかで条件分岐します。
  220.  *
  221.  * 戦闘の敗北フラグ
  222.  *  BattleManager._canLose
  223.  *
  224.  * BGMBGSの再開のプラグインコマンド
  225.  *  EBE_BGMBGS再開
  226.  *  EBE_REPLAY_BGM_AND_BGS
  227.  *
  228.  * BGMの停止のプラグインコマンド
  229.  *  EBE_BGM停止
  230.  *  EBE_STOP_BGM
  231.  *
  232.  *
  233.  *-----------------------------------------------------------------------------
  234.  * バトル中のコモンイベントについて
  235.  *-----------------------------------------------------------------------------
  236.  * 敵グループに設定するバトルイベントの替わりに、コモンイベントを実行します。
  237.  *
  238.  * 実行するイベントは以下のとおりです。
  239.  * 1.プラグインパラメータ<Battle Event>に設定したIDのコモンイベントの中で
  240.  *   実行条件を満たすイベント。
  241.  *
  242.  * プラグインパラメータ<Battle Event>にはカンマ(,)とハイフン(-)を使うことで
  243.  * 複数のコモンイベントIDを設定できます。
  244.  * ハイフン(-)は、繋げた前後のIDの間のすべてのIDを登録します。
  245.  *
  246.  * 入力例)
  247.  *  1, 4, 5, 10-15
  248.  *
  249.  * 複数のイベントIDを入力した場合、入力した順番(左から)に実行条件を
  250.  * 判定して、条件を満たしていればそのイベントを実行します。
  251.  *
  252.  *
  253.  *-----------------------------------------------------------------------------
  254.  * バトル中のコモンイベントの実行条件の設定
  255.  *-----------------------------------------------------------------------------
  256.  * コモンイベントに以下の注釈を入力することで、実行条件を設定できます。
  257.  *
  258.  * <スパン: [タイミング]>
  259.  * <SPAN: [TIMING]>
  260.  * 実行回数に関する条件を設定します。
  261.  * スパンを指定しない場合は、この設定を適用します。
  262.  * [タイミング] には以下を入力してください。
  263.  *  バトル or BATTLE   - 戦闘中に1回だけ実行します。
  264.  *  ターン or TURN     - ターン中に1回だけ実行します。
  265.  *  モーメント or MOMENT - 条件を満たす度に実行します。
  266.  *
  267.  *
  268.  * <ターン終了>
  269.  * <TURNEND>
  270.  * ターン終了時に実行します。
  271.  *
  272.  * <ターン:a + b *X>
  273.  * <TURN:a + b *X>
  274.  * 指定したターンに実行します。
  275.  * a と b に数値を入力してください。(* と X は半角, XはそのままXと入力)
  276.  *  a - 最初に実行するターン数
  277.  *  b - 次に何ターン後に実行するか(以降この値のターンが経過する毎に実行)
  278.  *  例)
  279.  *   <ターン:1 + 2 *X>
  280.  *   <TURN:2 + 4 *X>
  281.  *
  282.  * <敵キャラHP: #a b %以下>
  283.  * <ENEMY_HP: #a LESS THAN b %>
  284.  * 指定した敵キャラのHP残量によって実行します。
  285.  * a と b に数値を入力してください。(# と % は半角)
  286.  * a と b の間には必ず半角スペースを入れてください。
  287.  *  a - 敵キャラの番号(グループに追加した順番)
  288.  *  b - 残りHPの割合値
  289.  *  例)
  290.  *   <敵キャラHP: #1 50 %以下>
  291.  *   <ENEMY_HP: #2 LESS THAN 70 %>
  292.  *
  293.  * <アクターHP: #a b %以下>
  294.  * <ACTOR_HP: #a LESS THAN b %>
  295.  * 指定したアクターのHP残量によって実行します。
  296.  * a と b に数値を入力してください。
  297.  * a と b の間には必ず半角スペースを入れてください。
  298.  *  a - アクターID
  299.  *  b - 残りHPの割合値
  300.  *  例)
  301.  *   <アクターHP: #1 50 %以下>
  302.  *   <ACTOR_HP: #2 LESS THAN 70 %>
  303.  *
  304.  * <スイッチ: a>
  305.  * <SWITCH: a>
  306.  * 指定したスイッチがONの時に実行します。
  307.  * a に数値を入力してください。
  308.  *  a - スイッチID
  309.  *
  310.  * <実行条件>
  311.  * 条件式
  312.  * </実行条件>
  313.  * または
  314.  * <Conditions>
  315.  * code
  316.  * </Conditions>
  317.  * 条件式(code)で記述したJavaScript計算式を判定して実行します。
  318.  *
  319.  *
  320.  *-----------------------------------------------------------------------------
  321.  * プラグインコマンド
  322.  *-----------------------------------------------------------------------------
  323.  * バトルイベント用に以下のプラグインコマンドが使用できます。
  324.  *
  325.  * 1.パーティーメンバーに指定のモーションをとらせる
  326.  *  EBE_モーション実行 [モーション名] [対象メンバー]
  327.  *  EBE_REQUEST_MOTION [MOTION NAME] [TARGET MEMBER]
  328.  *
  329.  * モーション名(MOTION NAME)には以下を入力してください。(要小文字)
  330.  *  walk, wait, chant, guard, damage, evade, thrust, swing,
  331.  *  missile, skill, spell, item, escape, victory, dying,
  332.  *  abnormal, sleep, dead,
  333.  * 対象メンバーには以下を入力してください。
  334.  * 空欄の場合は、すべてのメンバーを対象にします。
  335.  *  0~ - 先頭を 0番としたときの隊列順
  336.  *  全員 or ALL - すべてのメンバー
  337.  *
  338.  * 例)
  339.  *  EBE_モーション実行 victory 1
  340.  *  EBE_REQUEST_MOTION wait ALL
  341.  *
  342.  *
  343.  * 2.戦闘を再開する
  344.  *  EBE_戦闘再開
  345.  *  EBE_RESTART_BATTLE
  346.  *
  347.  * 勝利イベントや敗北イベントはイベント終了時にバトルが終了しますが
  348.  * このコマンドを実行することで、バトルを再開します。
  349.  * ただし、エネミーが何もいない場合や、アクターが全員戦闘不能な場合は
  350.  * バトルを再開しても、すぐに勝利イベントや敗北イベントを再度実行します。
  351.  *
  352.  * このコマンドがイベント中常に実行する場合はバトルが終わりません。
  353.  * バトルを終わらせる時に、条件分岐等で再開コマンドを実行しないように
  354.  * イベントを組んでください。
  355.  *
  356.  *
  357.  * 3.画面に数字をポップアップさせる
  358.  *  EBE_数字ポップアップ [スプライト番号] [設定内容]
  359.  *  EBE_POPUP_NUMBER [SPRITE_NUMBER] [SETTING]
  360.  *
  361.  * 画面に数字をポップアップさせます。
  362.  * スプライト番号を変えることで、複数の数字を表示できます。
  363.  * 設定内容には以下を入力してください。(順不同)
  364.  * なお、数値には \V[x] でゲーム内変数を指定できます。
  365.  *  
  366.  *  画像番号 [数値]
  367.  *  IMAGENUM [Number]
  368.  *  - 使用する画像は ダメージポップアップ用の img/system/damage.png です。
  369.  *   上から 0番として、指定した列の数字スプライトを使用します。
  370.  *   指定しない場合は、0番(白)を使用します。
  371.  *
  372.  *  表示内容 [数値]
  373.  *  VALUE [Number]
  374.  *  - 入力した数値を画面に表示します。
  375.  *
  376.  *  ポップアップ高さ [高さ] [差分]
  377.  *  POPUP_HEIGHT [Number] [Offset]
  378.  *  - ポップアップする高さを指定します。
  379.  *   高さで、基準の高さを指定します。(デフォルト 40)
  380.  *   差分で、桁毎の高さの差を指定します。(デフォルト 0.5)
  381.  *   差分は変えたい場合にのみ指定してください。
  382.  *
  383.  *  表示時間 [数値]
  384.  *  DURATION [Number]
  385.  *  - スプライトを表示している時間を指定します。(デフォルト 30)
  386.  *   実際の表示時間は、この値と表示する数字の桁数を掛けた値です。
  387.  *   残り時間が10未満になると、画像の透明度が上がり、0で透明になります。
  388.  *
  389.  *  表示差 [数値]
  390.  *  DIFF_COUNT [Number]
  391.  *  - 数字の桁毎の表示タイミングのずれを指定します。(デフォルト 0)
  392.  *
  393.  *  表示座標 [X] [Y]
  394.  *  POSITION [X] [Y]
  395.  *  - スプライト画像を表示する位置を指定します。
  396.  *   x座標とy座標両方を指定してください。
  397.  *  
  398.  *  消去しない
  399.  *  REMAIN
  400.  *  - この引数を入力すると透明度が変化せず、画面に表示しつづけます。
  401.  *
  402.  *  消去
  403.  *  ERASE
  404.  *  - この引数を入力すると、指定したスプライト番号の画像を消します。
  405.  *  
  406.  *  例)
  407.  *   EBE_数字ポップアップ 1 表示内容 1234 表示座標 100 100
  408.  *   EBE_POPUP_NUMBER 1 VALUE 1234 POSITION 100 100
  409.  *
  410.  *   EBE_数字ポップアップ 2 画像番号 1 表示内容 12345 表示座標 100 100 消去しない
  411.  *   EBE_POPUP_NUMBER 2 IMAGENUM 1 VALUE 12345 POSITION 100 100 REMAIN
  412.  *
  413.  *   EBE_数字ポップアップ 1 消去
  414.  *   EBE_POPUP_NUMBER 1 ERASE
  415.  *
  416.  *
  417.  * 4.戦闘行動の設定
  418.  *  EBE_敵キャラの戦闘行動の設定 [メンバーID]
  419.  *  EBE_BATTLE_ENEMY_ACTION [MEMBERID]
  420.  *
  421.  *  指定の敵キャラの戦闘行動を再設定します。
  422.  *  敵キャラがターン開始時に行動を設定してからターン中に行動する間に
  423.  *  このコマンドを実行することで、行動を変えることができます。
  424.  *
  425.  *  [メンバーID]の入力内容
  426.  *  0~ - 最初を 0番として、敵グループに追加した順番で敵キャラを指定します
  427.  *
  428.  *  (参考)
  429.  *  指定の敵キャラが行動済みかどうかを調べるスクリプト
  430.  *  BattleManager.isActedEnemy(メンバーID)
  431.  *
  432.  *
  433.  *-----------------------------------------------------------------------------
  434.  * 本プラグインのライセンスについて(License)
  435.  *-----------------------------------------------------------------------------
  436.  * 本プラグインはMITライセンスのもとで公開しています。
  437.  * This plugin is released under the MIT License.
  438.  *
  439.  * Copyright (c) 2017,2018 Futokoro
  440.  * [url]http://opensource.org/licenses/mit-license.php[/url]
  441.  *
  442.  *
  443.  * プラグイン公開元
  444.  * [url]https://github.com/futokoro/RPGMaker/blob/master/README.md[/url]
  445.  *
  446.  *
  447.  *-----------------------------------------------------------------------------
  448.  * 変更来歴
  449.  *-----------------------------------------------------------------------------
  450.  *
  451.  * v1.3.3 - 2018/02/19 : 不具合修正
  452.  *    1. Custom Victory Eventが0の時に、戦闘勝利イベントを実行すると
  453.  *       戦闘勝利回数が2回増加してしまう不具合を修正。
  454.  *
  455.  * v1.3.2 - 2018/01/13 : 機能追加
  456.  *    1. メッセージ表示関係のプラグインコマンドに、イベント処理を止める機能を追加。
  457.  *
  458.  * v1.3.1 - 2018/01/12 : 不具合修正
  459.  *    1. 戦闘終了時イベント中にウェイトコマンドを実行すると、アクターの
  460.  *       モーションが正常に再生されない不具合を修正。
  461.  *
  462.  * v1.3.0 - 2017/06/30 : 機能追加
  463.  *    1. 戦闘終了時のイベントの後に、MVデフォルトの戦闘終了処理を実行する
  464.  *       機能を追加。
  465.  *
  466.  * v1.2.0 - 2017/06/01 : 機能追加
  467.  *    1. 敵キャラの戦闘行動を再設定するプラグインコマンドを追加。
  468.  *
  469.  * v1.1.0 - 2017/05/26 : 機能追加
  470.  *    1. バトル中にコモンイベントを実行できる機能を追加。
  471.  *    2. モーション実行コマンドにアクターを対象にできる機能を追加。
  472.  *    3. 画面に数字をポップアップさせるプラグインコマンドを追加。
  473.  *
  474.  * v1.0.0 - 2017/05/25 : 初版作成
  475.  *
  476.  *-----------------------------------------------------------------------------
  477. */
  478. //=============================================================================
  479.  
  480. var matchTextToRegs = function(test, regs) {
  481.     return regs.some( function(reg){
  482.         return test.match(reg);
  483.     });
  484. };
  485.  
  486. var readCommentMeta = function(comment, metacodes) {
  487.     if (!comment) return false;
  488.     return metacodes.some(function(metacode){
  489.         var metaReg = new RegExp('<' + metacode + '>', 'i');
  490.         return metaReg.test(comment);
  491.     });
  492. };
  493.  
  494. var splitConvertNumber = function(param) {
  495.     var results = [];
  496.     (param + '').split(',').forEach( function(split){
  497.         match = /[ ]*(\d+)[ ]*-[ ]*(\d+)/.exec(split);
  498.         if (match) {
  499.             for (var i = Number(match[1]); i <= Number(match[2]); i++) {
  500.                 results.push(i);
  501.             }
  502.         } else {
  503.             if(!isNaN(split)) results.push(Number(split));
  504.         }
  505.     });
  506.     return results;
  507. };
  508.  
  509. // textを条件式に使える状態に変換する
  510. var convertTextToConditions = function(text) {
  511.     var result = '';
  512.     if (text) {
  513.         var datas = text.split(';');
  514.         datas.forEach(function(data, i) {
  515.             result += data;
  516.             if (datas[i+1]) result += ')&&(';
  517.         });
  518.         result = '(' + result + ')';
  519.     }
  520.     return result;
  521. };
  522.  
  523. var convertEscapeCharacters = function(text) {
  524.     if (text == null) text = '';
  525.     var window = SceneManager._scene._windowLayer.children[0];
  526.     return window ? window.convertEscapeCharacters(text) : text;
  527. };
  528.  
  529. //=============================================================================
  530. // 自作関数(グローバル)
  531. //=============================================================================
  532.  
  533. FTKR.gameData = FTKR.gameData || {
  534.     user   :null,
  535.     target :null,
  536.     item   :null,
  537.     number :0,
  538. };
  539.  
  540. if (!FTKR.setGameData) {
  541. FTKR.setGameData = function(user, target, item, number) {
  542.     FTKR.gameData = {
  543.         user   :user || null,
  544.         target :target || null,
  545.         item   :item || null,
  546.         number :number || 0
  547.     };
  548. };
  549. }
  550.  
  551. if (!FTKR.evalFormula) {
  552. FTKR.evalFormula = function(formula) {
  553.     var datas = FTKR.gameData;
  554.     try {
  555.         var s = $gameSwitches._data;
  556.         var v = $gameVariables._data;
  557.         var a = datas.user;
  558.         var b = datas.target;
  559.         var item   = datas.item;
  560.         var number = datas.number;
  561.         if (b) var result = b.result();
  562.         var value = eval(formula);
  563.         if (isNaN(value)) value = 0;
  564.         return value;
  565.     } catch (e) {
  566.         console.error(e);
  567.         return 0;
  568.     }
  569. };
  570. }
  571.  
  572. //=============================================================================
  573. // プラグイン パラメータ
  574. //=============================================================================
  575. var parameters = PluginManager.parameters('FTKR_ExBattleEvent');
  576.  
  577. FTKR.EBE.battleEvents = splitConvertNumber(parameters['Battle Event']);
  578. FTKR.EBE.battleEnd = {
  579.     customV : Number(parameters['Custom Victory Event'] || 0),
  580.     customD : Number(parameters['Custom Defeat Event'] || 0),
  581.     victory : Number(parameters['Victory Event'] || 0),
  582.     defeat  : Number(parameters['Defeat Event'] || 0),
  583. };
  584.  
  585. //=============================================================================
  586. // プラグインコマンド
  587. //=============================================================================
  588.  
  589. Game_Interpreter.prototype.setArgNumber = function(arg) {
  590.     try {
  591.         var arg = convertEscapeCharacters(arg);
  592.         return Number(eval(arg));
  593.     } catch (e) {
  594.         console.error(e);
  595.         return 0;
  596.     }
  597. };
  598.  
  599. var _EBE_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  600. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  601.     _EBE_Game_Interpreter_pluginCommand.call(this, command, args);
  602.     if (!command.match(/EBE_(.+)/i)) return;
  603.     command = (RegExp.$1 + '').toUpperCase();
  604.     switch (command) {
  605.         case '戦闘終了時ステート解除':
  606.         case 'REMOVE_BATTLE_STATES':
  607.             $gameParty.removeBattleStates();
  608.             break;
  609.         case '勝利モーション実行':
  610.         case 'PREFORM_VICTORY':
  611.             $gameParty.performVictory();
  612.             break;
  613.         case 'モーション実行':
  614.         case 'REQUEST_MOTION':
  615.             if(!args[1] || args[1] === '全員' || args[1].toUpperCase() === 'ALL') {
  616.                 $gameParty.requestMotion(args[0]);
  617.             } else if (Number(args[1]) >= 0) {
  618.                 var actor = $gameActors.actor(Number(args[1]));
  619.                 if (actor) actor.requestMotion(args[0]);
  620.             }
  621.             break;
  622.         case '勝利ME演奏':
  623.         case 'PLAY_VICTORY_ME':
  624.             BattleManager.playVictoryMe();
  625.             break;
  626.         case '敗北ME演奏':
  627.         case 'PLAY_DEFEAT_ME':
  628.             BattleManager.playDefeatMe();
  629.             break;
  630.         case 'BGMBGS再開':
  631.         case 'REPLAY_BGM_AND_BGS':
  632.             BattleManager.replayBgmAndBgs();
  633.             break;
  634.         case 'BGM停止':
  635.         case 'STOP_BGM':
  636.             AudioManager.stopBgm();
  637.             break;
  638.         case '戦闘報酬計算':
  639.         case 'MAKE_REWARDS':
  640.             BattleManager.makeRewards();
  641.             break;
  642.         case '勝利メッセージ表示':
  643.         case 'DISPLAY_VICTORY_MESSAGE':
  644.             BattleManager.displayVictoryMessage();
  645.             if (args[0] === '-s')this.setWaitMode('message');
  646.             break;
  647.         case '敗北メッセージ表示':
  648.         case 'DISPLAY_DEFEAT_MESSAGE':
  649.             BattleManager.displayDefeatMessage();
  650.             if (args[0] === '-s')this.setWaitMode('message');
  651.             break;
  652.         case '戦闘報酬表示':
  653.         case 'DISPLAY_REWARDS':
  654.             BattleManager.displayRewards();
  655.             if (args[0] === '-s')this.setWaitMode('message');
  656.             break;
  657.         case '戦闘報酬入手':
  658.         case 'GAIN_REWARDS':
  659.             BattleManager.gainRewards();
  660.             break;
  661.         case '戦闘再開':
  662.         case 'RESTART_BATTLE':
  663.             BattleManager._isBattleEndEvent = false;
  664.             BattleManager._checkEbeBattleEvent = false;
  665.             break;
  666.         case '数字ポップアップ':
  667.         case 'POPUP_NUMBER':
  668.             this.setupNumberPopup(args);
  669.             break;
  670.         case '敵キャラの戦闘行動の設定':
  671.         case 'SET_BATTLE_ENEMY_ACTION':
  672.             var memberId = this.setArgNumber(args[0]);
  673.             $gameTroop.members()[memberId].makeActions();
  674.             break;
  675.     }
  676. };
  677.  
  678. Game_Interpreter.prototype.setupNumberPopup = function(args) {
  679.     var index = this.setArgNumber(args[0]);
  680.     for (var i = 1; i < args.length; i++) {
  681.         var arg = (args[i] + '').toUpperCase();
  682.         switch (arg) {
  683.             case '画像番号':
  684.             case 'IMAGENUM':
  685.                 i++;
  686.                 var baseRow = this.setArgNumber(args[i]);
  687.                 break;
  688.             case '表示内容':
  689.             case 'VALUE':
  690.                 i++;
  691.                 var value = this.setArgNumber(args[i]);
  692.                 break;
  693.             case 'ポップアップ高さ':
  694.             case 'POPUP_HEIGHT':
  695.                 i++;
  696.                 var height = this.setArgNumber(args[i]);
  697.                 if (!isNaN(args[i+1])) {
  698.                     i++;
  699.                     var offsetY = this.setArgNumber(args[i]);
  700.                 }
  701.                 break;
  702.             case '表示時間':
  703.             case 'DURATION':
  704.                 i++;
  705.                 var duration = this.setArgNumber(args[i]);
  706.                 break;
  707.             case '表示差':
  708.             case 'DIFF_COUNT':
  709.                 i++;
  710.                 var maxcount = this.setArgNumber(args[i]);
  711.                 break;
  712.             case '表示座標':
  713.             case 'POSITION':
  714.                 i++;
  715.                 var x = this.setArgNumber(args[i]);
  716.                 i++;
  717.                 var y = this.setArgNumber(args[i]);
  718.                 break;
  719.             case '消去しない':
  720.             case 'REMAIN':
  721.                 var remain = true;
  722.                 break;
  723.             case '消去':
  724.             case 'ERASE':
  725.                 BattleManager.eraseNumberPopup(index);
  726.                 return ;
  727.         }
  728.     }
  729.     var sprite = BattleManager.setupNumberPopup(index);
  730.     if (!isNaN(baseRow)) sprite.setBaseRow(baseRow);
  731.     if (!isNaN(height)) sprite.setPopupHeight(height, offsetY);
  732.     if (!isNaN(duration)) sprite.setDuration(duration);
  733.     if (!isNaN(maxcount)) sprite.setMaxcount(maxcount);
  734.     if (!isNaN(x) && !isNaN(y))sprite.setPosition(x, y);
  735.     if (remain) sprite.setRemain();
  736.     if (!isNaN(value)) sprite.setValue(value);
  737. };
  738.  
  739. //=============================================================================
  740. // BattleManager
  741. //=============================================================================
  742.  
  743. FTKR.EBE.BattleManager_initMembers = BattleManager.initMembers;
  744. BattleManager.initMembers = function() {
  745.     FTKR.EBE.BattleManager_initMembers.call(this);
  746.     this._checkEbeBattleEvent = false;
  747.     this._battleEndPattern = 0;
  748.     this._numberSprite = [];
  749.     this._isBattleEndEvent = false;
  750. };
  751.  
  752. var _EBE_Game_Party_requestMotionRefresh = Game_Party.prototype.requestMotionRefresh;
  753. Game_Party.prototype.requestMotionRefresh = function() {
  754.     if (!BattleManager.isBattleEndEvent()) {
  755.         _EBE_Game_Party_requestMotionRefresh.call(this);
  756.     }
  757. };
  758.  
  759. BattleManager.isBattleEndEvent = function() {
  760.     return $gameParty.inBattle() && this._isBattleEndEvent;
  761. };
  762.  
  763. FTKR.EBE.BattleManager_checkBattleEnd = BattleManager.checkBattleEnd;
  764. BattleManager.checkBattleEnd = function() {
  765.     if (this._phase) {
  766.         if (this._checkEbeBattleEvent) {
  767.             switch(this._battleEndPattern) {
  768.                 case 0:
  769.                     if (FTKR.EBE.battleEnd.customV) break;
  770.                     FTKR.EBE.BattleManager_processVictory.call(this);
  771.                     return true;
  772.                 case 2:
  773.                     if (FTKR.EBE.battleEnd.customD) break;
  774.                     FTKR.EBE.BattleManager_processDefeat.call(this);
  775.                     return true;
  776.             }
  777.             this.endBattle(this._battleEndPattern);
  778.             return true;
  779.         }
  780.     }
  781.     return FTKR.EBE.BattleManager_checkBattleEnd.call(this);
  782. };
  783.  
  784. FTKR.EBE.BattleManager_processVictory = BattleManager.processVictory;
  785. BattleManager.processVictory = function() {
  786.     if (FTKR.EBE.battleEnd.victory && !this._checkEbeBattleEvent) {
  787.         if ($gameTroop.setupEbeBattleEvent('victory', ['EBE_戦闘勝利時'])) {
  788.             this._checkEbeBattleEvent = true;
  789.             this._battleEndPattern = 0;
  790.         }
  791.         return true;
  792.     }
  793.     FTKR.EBE.BattleManager_processVictory.call(this);
  794. };
  795.  
  796. FTKR.EBE.BattleManager_processDefeat = BattleManager.processDefeat;
  797. BattleManager.processDefeat = function() {
  798.     if (FTKR.EBE.battleEnd.defeat && !this._checkEbeBattleEvent) {
  799.         if ($gameTroop.setupEbeBattleEvent('defeat', ['EBE_戦闘敗北時'])) {
  800.             this._checkEbeBattleEvent = true;
  801.             this._battleEndPattern = 2;
  802.         }
  803.         return true;
  804.     }
  805.     FTKR.EBE.BattleManager_processDefeat.call(this);
  806. };
  807.  
  808. BattleManager.setupNumberPopup = function(index) {
  809.     if (!this._numberSprite[index]) {
  810.         var sprite = new Sprite_Number();
  811.         this._numberSprite[index] = sprite;
  812.         this._spriteset._battleField.addChild(this._numberSprite[index]);
  813.     }
  814.     return this._numberSprite[index];
  815. };
  816.  
  817. BattleManager.eraseNumberPopup = function(index) {
  818.     this._spriteset._battleField.removeChild(this._numberSprite[index]);
  819.     this._numberSprite[index] = {};
  820. };
  821.  
  822. BattleManager.isActed = function(battler) {
  823.     return !this._actionBattlers.contains(battler);
  824. };
  825.  
  826. BattleManager.isActedEnemy = function(battlerId) {
  827.     return !this.isActed($gameTroop.members()[battlerId]);
  828. };
  829.  
  830. BattleManager.isActedActor = function(battlerId) {
  831.     return !this.isActed($gameParty.members()[battlerId]);
  832. };
  833.  
  834. //=============================================================================
  835. // Game_Party
  836. //=============================================================================
  837.  
  838. Game_Party.prototype.requestMotion = function(motionName) {
  839.     this.members().forEach(function(actor) {
  840.         if (actor.canMove()) actor.requestMotion(motionName);
  841.     });
  842. };
  843.  
  844. //=============================================================================
  845. // Game_Troop
  846. //=============================================================================
  847.  
  848. FTKR.EBE.Game_Troop_clear = Game_Troop.prototype.clear;
  849. Game_Troop.prototype.clear = function() {
  850.     FTKR.EBE.Game_Troop_clear.call(this);
  851.     this._commonEventFlags = [];
  852. };
  853.  
  854. FTKR.EBE.Game_Troop_setupBattleEvent = Game_Troop.prototype.setupBattleEvent;
  855. Game_Troop.prototype.setupBattleEvent = function() {
  856.     FTKR.EBE.Game_Troop_setupBattleEvent.call(this);
  857.     if (!this._interpreter.isRunning()) {
  858.         if (this._interpreter.setupReservedCommonEvent()) {
  859.             return;
  860.         }
  861.         var eventIds = FTKR.EBE.battleEvents;
  862.         for (var i = 0; i < eventIds.length; i++) {
  863.             if (eventIds[i]) {
  864.                 var event = $dataCommonEvents[eventIds[i]];
  865.                 if (this.meetsCommonEventCommentConditions(event) && !this._commonEventFlags[i]) {
  866.                     this._interpreter.setup(event.list, this.troop().id);
  867.                     if (this.commonEventSpan(event) <= 1) {
  868.                         this._commonEventFlags[i] = true;
  869.                     }
  870.                     break;
  871.                 }
  872.             }
  873.         }
  874.     }
  875. };
  876.  
  877. FTKR.EBE.Game_Troop_increaseTurn = Game_Troop.prototype.increaseTurn;
  878. Game_Troop.prototype.increaseTurn = function() {
  879.     var eventIds = FTKR.EBE.battleEvents;
  880.     for (var i = 0; i < eventIds.length; i++) {
  881.         if (eventIds[i]) {
  882.             var event = $dataCommonEvents[eventIds[i]];
  883.             if (this.commonEventSpan(event) === 1) {
  884.                 this._commonEventFlags[i] = false;
  885.             }
  886.         }
  887.     }
  888.     FTKR.EBE.Game_Troop_increaseTurn.call(this);
  889. };
  890.  
  891. Game_Troop.prototype.setupEbeBattleEvent = function(condition, metacodes) {
  892.     if (!this._interpreter.isRunning()) {
  893.         if (this._interpreter.setupReservedCommonEvent()) {
  894.             return false;
  895.         }
  896.         var pages = this.troop().pages;
  897.         for (var i = 0; i < pages.length; i++) {
  898.             var page = pages[i];
  899.             if (this.meetsPagesCommentConditions(page, metacodes) && !this._eventFlags[i]) {
  900.                 this._interpreter.setup(page.list, this.troop().id);
  901.                 this._eventFlags[i] = true;
  902.                 return true;
  903.             }
  904.         }
  905.         var event = $dataCommonEvents[FTKR.EBE.battleEnd[condition]];
  906.         BattleManager._isBattleEndEvent = true;
  907.         this._interpreter.setup(event.list, this.troop().id);
  908.         return true;
  909.     }
  910.     return false;
  911. };
  912.  
  913. Game_Troop.prototype.meetsPagesCommentConditions = function(page, metacodes) {
  914.     for (var v = 0; v < page.list.length; v++) {
  915.         var list = page.list[v];
  916.         if (list && ([108, 408].contains(list.code))) {
  917.             return readCommentMeta(list.parameters[0], metacodes);
  918.         }
  919.     }
  920. };
  921.  
  922. Game_Troop.prototype.commonEventSpan = function(event) {
  923.     for (var v = 0; v < event.list.length; v++) {
  924.         var list = event.list[v];
  925.         if (list && ([108, 408].contains(list.code))) {
  926.             var match = /<([^<>:]+)(:?)([^>]*)>/g.exec(list.parameters[0]);
  927.             switch((match[1] + '').toUpperCase()) {
  928.                 case 'スパン':
  929.                 case 'SPAN':
  930.                     switch((match[3] + '').toUpperCase()) {
  931.                         case 'バトル':
  932.                         case 'BATTLE':
  933.                             return 0;
  934.                         case 'ターン':
  935.                         case 'TURN':
  936.                             return 1;
  937.                         case 'モーメント':
  938.                         case 'MOMENT':
  939.                             return 2;
  940.                     }
  941.             }
  942.         }
  943.     }
  944.     return 0;
  945. };
  946.  
  947. Game_Troop.prototype.meetsCommonEventCommentConditions = function(event) {
  948.     return this.meetsConditions(this.convertCommonEventConditions(event));
  949. };
  950.  
  951. Game_Troop.prototype.convertCommonEventConditions = function(event) {
  952.     var conditions = {};
  953.     var code = false;
  954.     for (var i = 0; i < event.list.length; i++) {
  955.         var list = event.list[i];
  956.         if (list && ([108, 408].contains(list.code))) {
  957.             var match = /<([^<>:]+)(:?)([^>]*)>/g.exec(list.parameters[0]);
  958.             if (match) {
  959.                 switch((match[1] + '').toUpperCase()){
  960.                     case 'ターン終了':
  961.                     case 'TURNEND':
  962.                         conditions.turnEnding = true;
  963.                         break;
  964.                     case 'ターン':
  965.                     case 'TURN':
  966.                         if (match[2] === ':') {
  967.                             var turn = /(\d+)[ ]*\+[ ]*(\d+)[ ]*\*X/i.exec(match[3]);
  968.                             if (turn) {
  969.                                 conditions.turnValid = true;
  970.                                 conditions.turnA = Number(turn[1]);
  971.                                 conditions.turnB = Number(turn[2]);
  972.                             }
  973.                         }
  974.                         break;
  975.                     case '敵キャラHP':
  976.                     case 'ENEMY_HP':
  977.                         if (match[2] === ':') {
  978.                             var value = /#(\d+)[ ]*(\d+)[ ]*\%以下/i.exec(match[3]);
  979.                             if (!value) value = /#(\d+)[ ]*less[ ]than[ ]*(\d+)[ ]*\%/i.exec(match[3]);
  980.                             if (value) {
  981.                                 conditions.enemyValid = true;
  982.                                 conditions.enemyIndex = Number(value[1]);
  983.                                 conditions.enemyHp = Number(value[2]);
  984.                             }
  985.                         }
  986.                         break;
  987.                     case 'アクターHP':
  988.                     case 'ACTOR_HP':
  989.                         if (match[2] === ':') {
  990.                             var value = /#(\d+)[ ]*(\d+)[ ]*\%以下/i.exec(match[3]);
  991.                             if (!value) value = /#(\d+)[ ]*less[ ]than[ ]*(\d+)[ ]*\%/i.exec(match[3]);
  992.                             if (value) {
  993.                                 conditions.actorValid = true;
  994.                                 conditions.actorId = Number(value[1]);
  995.                                 conditions.actorHp = Number(value[2]);
  996.                             }
  997.                         }
  998.                         break;
  999.                     case 'スイッチ':
  1000.                     case 'SWITCH':
  1001.                         if (match[2] === ':') {
  1002.                             conditions.switchValid = true;
  1003.                             conditions.switchId = Number(match[3]);
  1004.                         }
  1005.                         break;
  1006.                     case '/実行条件':
  1007.                     case '/CONDITIONS':
  1008.                         code = false;
  1009.                         break;
  1010.                     case '実行条件':
  1011.                     case 'CONDITIONS':
  1012.                         conditions.customValid = true;
  1013.                         conditions.custom = '';
  1014.                         code = true;
  1015.                         break;
  1016.                 }
  1017.             } else {
  1018.                  if (code) conditions.custom += list.parameters[0] + ';';
  1019.             }
  1020.         }
  1021.     }
  1022.     var page = {conditions:conditions};
  1023.     return page;
  1024. };
  1025.  
  1026. Game_Troop.prototype.evalConditionsFormula = function(text) {
  1027.     var formula = convertTextToConditions(text);
  1028.     if (!formula) return true;
  1029.     return FTKR.evalFormula(formula);
  1030. };
  1031.  
  1032. FTKR.EBE.Game_Troop_meetsConditions = Game_Troop.prototype.meetsConditions;
  1033. Game_Troop.prototype.meetsConditions = function(page) {
  1034.     var c = page.conditions;
  1035.     var result = FTKR.EBE.Game_Troop_meetsConditions.call(this, page);
  1036.     if (!c.turnEnding && !result) {
  1037.         return false;
  1038.     }
  1039.     if ((c.turnEnding || c.turnValid || c.enemyValid ||
  1040.             c.actorValid || c.switchValid) && !result) {
  1041.         return false;
  1042.     }
  1043.     if (c.customValid && !this.evalConditionsFormula(c.custom)) {
  1044.         return false;
  1045.     }
  1046.     return true;
  1047. };
  1048.  
  1049. //=============================================================================
  1050. // Sprite_Number
  1051. // 数字をスプライトで表示する
  1052. //=============================================================================
  1053.  
  1054. function Sprite_Number() {
  1055.     this.initialize.apply(this, arguments);
  1056. }
  1057.  
  1058. Sprite_Number.prototype = Object.create(Sprite.prototype);
  1059. Sprite_Number.prototype.constructor = Sprite_Number;
  1060.  
  1061. Sprite_Number.prototype.initialize = function() {
  1062.     Sprite.prototype.initialize.call(this);
  1063.     this._flashColor = [0, 0, 0, 0];
  1064.     this._flashDuration = 0;
  1065.     this._damageBitmap = ImageManager.loadSystem('Damage');
  1066.     this._remain = false;
  1067.     this._duration = 30;
  1068.     this._maxcount = 0;
  1069.     this._count = 0;
  1070.     this._baseRow = 0;
  1071.     this._value = 0;
  1072.     this._index = 0;
  1073.     this._popupHeight = 40;
  1074.     this._popupOffsetY = 0.5;
  1075.     this._fullDuration = this._duration;
  1076. };
  1077.  
  1078. Sprite_Number.prototype.setupCriticalEffect = function() {
  1079.     this._flashColor = [255, 0, 0, 160];
  1080.     this._flashDuration = 60;
  1081. };
  1082.  
  1083. Sprite_Number.prototype.digitWidth = function() {
  1084.     return this._damageBitmap ? this._damageBitmap.width / 10 : 0;
  1085. };
  1086.  
  1087. Sprite_Number.prototype.digitHeight = function() {
  1088.     return this._damageBitmap ? this._damageBitmap.height / 5 : 0;
  1089. };
  1090.  
  1091. Sprite_Number.prototype.setBaseRow = function(baseRow) {
  1092.     this._baseRow = baseRow;
  1093. };
  1094.  
  1095. Sprite_Number.prototype.setDuration = function(duration) {
  1096.     this._duration = duration;
  1097. };
  1098.  
  1099. Sprite_Number.prototype.setValue = function(value) {
  1100.     this._value = value;
  1101.     this.resetFullDuration();
  1102. };
  1103.  
  1104. Sprite_Number.prototype.setMaxcount = function(maxcount) {
  1105.     this._maxcount = maxcount;
  1106.     this._count = this._maxcount;
  1107. };
  1108.  
  1109. Sprite_Number.prototype.setPosition = function(x, y) {
  1110.     this.x = x;
  1111.     this.y = y;
  1112. };
  1113.  
  1114. Sprite_Number.prototype.setRemain = function() {
  1115.     this._remain = true;
  1116. };
  1117.  
  1118. Sprite_Number.prototype.setPopupHeight = function(popupHeight, popupOffsetY) {
  1119.     this._popupHeight = popupHeight;
  1120.     if(!isNaN(popupOffsetY)) this._popupOffsetY = popupOffsetY;
  1121. };
  1122.  
  1123. Sprite_Number.prototype.resetFullDuration = function() {
  1124.     var string = Math.abs(this._value).toString();
  1125.     this._fullDuration = this._duration * string.length;
  1126. };
  1127.  
  1128. Sprite_Number.prototype.updateOpacity = function() {
  1129.     if (this._remain) return;
  1130.     if (this._fullDuration < 10) {
  1131.         this.opacity = 255 * this._fullDuration / 10;
  1132.     }
  1133. };
  1134.  
  1135. Sprite_Number.prototype.update = function() {
  1136.     Sprite.prototype.update.call(this);
  1137.     if (this._count >= this._maxcount) {
  1138.         this.createDigit(this._index);
  1139.         this._index++;
  1140.         this._count = 0;
  1141.     } else {
  1142.         this._count++;
  1143.     }
  1144.     if (this._fullDuration > 0) {
  1145.         this._fullDuration--;
  1146.         for (var i = 0; i < this.children.length; i++) {
  1147.             this.updateChild(this.children[i]);
  1148.         }
  1149.     }
  1150.     this.updateFlash();
  1151.     this.updateOpacity();
  1152. };
  1153.  
  1154. Sprite_Number.prototype.createChildSprite = function() {
  1155.     var sprite = new Sprite();
  1156.     sprite.bitmap = this._damageBitmap;
  1157.     sprite.anchor.x = 0.5;
  1158.     sprite.anchor.y = 1;
  1159.     sprite.y = -this._popupHeight;
  1160.     sprite.ry = sprite.y;
  1161.     this.addChild(sprite);
  1162.     return sprite;
  1163. };
  1164.  
  1165. Sprite_Number.prototype.createDigit = function(index) {
  1166.     var value = this._value;
  1167.     var baseRow = this._baseRow;
  1168.     var string = Math.abs(value).toString();
  1169.     if (index >= string.length) return;
  1170.     var row = baseRow + (value < 0 ? 1 : 0);
  1171.     var w = this.digitWidth();
  1172.     var h = this.digitHeight();
  1173.     var sprite = this.createChildSprite();
  1174.     var n = Number(string[index]);
  1175.     sprite.setFrame(n * w, row * h, w, h);
  1176.     sprite.x = (index - (string.length - 1) / 2) * w;
  1177.     sprite.dy = -this._popupOffsetY * 2 * index;
  1178. };
  1179.  
  1180. Sprite_Number.prototype.updateChild = function(sprite) {
  1181.     sprite.dy += this._popupOffsetY;
  1182.     sprite.ry += sprite.dy;
  1183.     if (sprite.ry >= 0) {
  1184.         sprite.ry = 0;
  1185.         sprite.dy *= -0.6;
  1186.     }
  1187.     sprite.y = Math.round(sprite.ry);
  1188.     sprite.setBlendColor(this._flashColor);
  1189. };
  1190.  
  1191. Sprite_Number.prototype.updateFlash = function() {
  1192.     if (this._flashDuration > 0) {
  1193.         var d = this._flashDuration--;
  1194.         this._flashColor[3] *= (d - 1) / d;
  1195.     }
  1196. };
  1197.  
  1198. Sprite_Number.prototype.isPlaying = function() {
  1199.     return this._duration > 0;
  1200. };



用法自己看帮助说明,看不懂的话就百度翻译
此书生之言,可言而不可用也 ↑-_-||

仓管610早晚班,没多余精力做别的了 →_→
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
377
在线时间
38 小时
注册时间
2021-3-30
帖子
43
7
发表于 2021-4-1 21:03:06 | 只看该作者
我靠竟然有一样的功能,不过这样坏处就是没法培养啊。。。。。每次都离队。
To be a better man.
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-14 20:51

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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