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

Project1

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

[已经解决] 请问谁有mog_chaincommand的代码?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
216
在线时间
154 小时
注册时间
2017-2-27
帖子
167

开拓者

1
发表于 2017-5-24 19:46:58 | 显示全部楼层
  1. //=============================================================================
  2. // MOG_ChainCommands.js
  3. //=============================================================================

  4. /*:
  5. * @plugindesc (v1.3) Skill Chain Combos.
  6. * @author Moghunter
  7. *
  8. * @param X-Axis
  9. * @desc General X-axis definition.
  10. * @default 0
  11. *
  12. * @param Y-Axis
  13. * @desc General Y-axis definition.
  14. * @default 0
  15. *
  16. * @param Key X-Axis
  17. * @desc Definition of the X-axis of the button.
  18. * @default 16
  19. *
  20. * @param Key Y-Axis
  21. * @desc Y-axis definition of the button.
  22. * @default -32
  23. *
  24. * @param Gauge X-Axis
  25. * @desc X-axis definition of the time meter.
  26. * @default 17
  27. *
  28. * @param Gauge Y-Axis
  29. * @desc Y-axis definition of the time meter.
  30. * @default 1
  31. *
  32. * @param Name X-Axis
  33. * @desc X-axis definition of the skill name.
  34. * @default 15
  35. *
  36. * @param Name Y-Axis
  37. * @desc Y-axis definition of the skill name.
  38. * @default 18
  39. *
  40. * @help
  41. * ================================================================= ============================
  42. * +++ MOG - Chain Commands (v1.3) +++
  43. * By Moghunter
  44. * https://atelierrgss.wordpress.com/
  45. * ================================================================= ============================
  46. * The system allows you to execute combos by executing the sequence of buttons.
  47. * The files will be needed. (img/system/)
  48. *
  49. * Chain_A.png
  50. * Chain_B.png
  51. * Chain_B.png
  52. *
  53. * ================================================================= ============================
  54. * USE
  55. * ================================================================= ============================
  56. * Use the comment below in the skill notes box.
  57. *
  58. * Chain Action: SKILL_ID: NUMBER_OF_INPUTS: INPUT_TIME
  59. *
  60. * SKILL_ID - Skill ID.
  61. * NUMBER_OF_INPUTS - Number of times to push the button.
  62. * INPUT_TIME - Time to press the buttons.
  63. *
  64. * (Example)
  65. *
  66. * Chain Action: 10: 5: 60
  67. * ================================================================= ============================
  68. * HITÓRICO
  69. * ================================================================= ============================
  70. * (1.3) - Fixed the error of activating the command at the end of the battle.
  71. * (1.2) - Fixed the compatibility code.
  72. * (1.1) - Fixed the error of allowing input during the collapse of the enemy.
  73. *
  74. */

  75. //=============================================================================
  76. // ** PLUGIN PARAMETERS
  77. //=============================================================================
  78.   var Imported = Imported || {};
  79.   Imported.MOG_ChainCommands = true;
  80.   var Moghunter = Moghunter || {};

  81.    Moghunter.parameters = PluginManager.parameters('MOG_ChainCommands');
  82.         Moghunter.chainCom_x = Number(Moghunter.parameters['X-Axis'] || 0);
  83.         Moghunter.chainCom_y = Number(Moghunter.parameters['Y-Axis'] || 0);
  84.         Moghunter.chainCom_Key_x = Number(Moghunter.parameters['Key X-Axis'] || 16);
  85.         Moghunter.chainCom_Key_y = Number(Moghunter.parameters['Key Y-Axis'] || -32);
  86.         Moghunter.chainCom_Meter_x = Number(Moghunter.parameters['Gauge X-Axis'] || 17);
  87.         Moghunter.chainCom_Meter_y = Number(Moghunter.parameters['Gauge Y-Axis'] || 1);
  88.         Moghunter.chainCom_Name_x = Number(Moghunter.parameters['Name X-Axis'] || 15);
  89.         Moghunter.chainCom_Name_y = Number(Moghunter.parameters['Name Y-Axis'] || 18);
  90.        
  91. //=============================================================================
  92. // ** Game Temp
  93. //=============================================================================

  94. //==============================
  95. // * Initialize
  96. //==============================
  97. var _alias_mog_bchain_gtemp_initialize = Game_Temp.prototype.initialize;
  98. Game_Temp.prototype.initialize = function() {
  99.         _alias_mog_bchain_gtemp_initialize.call(this);
  100.         this._bchainTemp = false;
  101.         this.clearBchain();
  102. };

  103. //==============================
  104. // * Clear Bchain
  105. //==============================
  106. Game_Temp.prototype.clearBchain = function() {
  107.     this._bchainData = [false,null,null,null,null,0,0,null,false,false,false,false];
  108. };

  109. //=============================================================================
  110. // ** Game Action
  111. //=============================================================================

  112. //==============================
  113. // * applyItemUserEffect
  114. //==============================
  115. var _mog_bchain_gaction_applyItemUserEffect = Game_Action.prototype.applyItemUserEffect;
  116. Game_Action.prototype.applyItemUserEffect = function(target) {
  117.         $gameTemp._bchainData[11] = true;
  118.         _mog_bchain_gaction_applyItemUserEffect.call(this,target)
  119. };

  120. //=============================================================================
  121. // ** Battle Manager
  122. //=============================================================================

  123. //==============================
  124. // * Start Action
  125. //==============================
  126. var _mog_bchain_bmngr_startAction = BattleManager.startAction;
  127. BattleManager.startAction = function() {
  128.          $gameTemp.clearBchain();
  129.          if (this.canCheckChainCommands()) {this.checkChainAction()};
  130.         _mog_bchain_bmngr_startAction.call(this);
  131. };

  132. //==============================
  133. // * Can Check Chain Commands
  134. //==============================
  135. BattleManager.canCheckChainCommands = function() {
  136.         if (this._subject.isEnemy()) {return false};
  137.     if (!this._subject.currentAction()) {return false};
  138.         if (!this._subject.currentAction().item()) {return false};
  139.         return true;
  140. };

  141. //==============================
  142. // * Check Chain Action
  143. //==============================
  144. BattleManager.checkChainAction = function() {       
  145.         var item = this._subject.currentAction().item();
  146.         var item_notes = item.note.split(/[\r\n]+/);
  147.     item_notes.forEach(function(note) {
  148.          var note_data = note.split(': ')
  149.                  if (note_data[0].toLowerCase() == "chain action"){                         
  150.                          var par = note_data[1].split(':');
  151.                          var action = $dataSkills[Number(par[0])];
  152.                       var times = Math.min(Math.max(Number(par[1]),1),999);
  153.                          var duration = Math.min(Math.max(Number(par[2]),10),999);                         
  154.                          if (action) {
  155.                             $gameTemp._bchainData[1] = action;
  156.                                 $gameTemp._bchainData[6] = times;
  157.                                 $gameTemp._bchainData[7] = duration;
  158.                          };
  159.          };
  160.         },this);
  161. };

  162. //==============================
  163. // * Invoke Action
  164. //==============================
  165. var _mog_bchain_bmngr_invokeAction = BattleManager.invokeAction;
  166. BattleManager.invokeAction = function(subject, target) {
  167.     if ($gameTemp._bchainData[1]) {BattleManager.setBchainPosition(subject, target)};
  168.         _mog_bchain_bmngr_invokeAction.call(this,subject, target);       
  169. };

  170. //==============================
  171. // * set Bchain Position
  172. //==============================
  173. BattleManager.setBchainPosition = function(subject, target) {
  174.         if (this._subject.isActor()) {
  175.                 $gameTemp._bchainData[8] = target;
  176.                 if ($gameTemp._bchainData[1].scope === 1 ||
  177.                     $gameTemp._bchainData[1].scope === 7 ||
  178.                         $gameTemp._bchainData[1].scope === 9) {
  179.                         $gameTemp._bchainData[4] = target;
  180.                 } else {
  181.                 if ($gameSystem.isSideView()) {
  182.                             $gameTemp._bchainData[4] = this._subject;
  183.                         } else {
  184.                                 $gameTemp._bchainData[2] = Graphics.boxWidth / 2;
  185.                                 $gameTemp._bchainData[3] = Graphics.boxHeight / 2;               
  186.                         };       
  187.                 };
  188.         };
  189. };       
  190.        
  191. //==============================
  192. // * End Action
  193. //==============================
  194. var _mog_bchain_bmngr_endAction = BattleManager.endAction;
  195. BattleManager.endAction = function() {
  196.         if (BattleManager.canUseChainAction()) {
  197.                 $gameTemp._bchainData[0] = true;
  198.                 $gameTemp._bchainTemp = true;
  199.                 if ($gameTemp._bchainData[9]) {this.executeChainAction()};
  200.                 return;
  201.           };
  202.          _mog_bchain_bmngr_endAction.call(this);
  203.          $gameTemp.clearBchain();
  204.          $gameTemp._bchainTemp = false;
  205. };

  206. //==============================
  207. // * can Use Chain Action
  208. //==============================
  209. BattleManager.canUseChainAction = function() {
  210.         if (!$gameTemp._bchainData[1]) {return false};
  211.         if (!$gameTemp._bchainData[11]) {return false};
  212.         if (!this._subject) {return false};
  213.         if (!this._subject.canInput()) {return false};
  214.         if (this._subject.isDead()) {return false};
  215.         if ($gameParty.isAllDead()) {return false};
  216.         if ($gameTroop.isAllDead()) {return false};
  217.         if (!this._subject.canUse($gameTemp._bchainData[1])) {return false};
  218.         if ($gameTemp._bchainData[1].scope === 1 ||
  219.                  $gameTemp._bchainData[1].scope === 7 ||
  220.                  $gameTemp._bchainData[1].scope === 9) {
  221.              if (!$gameTemp._bchainData[8]) {return false};
  222.                  if ($gameTemp._bchainData[8].isDead()) {return false};
  223.     }
  224.         return true;
  225. };

  226. //==============================
  227. // * execute Chain Action
  228. //==============================
  229. BattleManager.executeChainAction = function() {
  230.         if ($gameTemp._bchainData[10]) {
  231.             this._subject.forceAction($gameTemp._bchainData[1].id, -2);               
  232.                 $gameTemp.clearBchain();
  233.             BattleManager.processTurn();
  234.         } else {
  235.                 $gameTemp.clearBchain();
  236.         };
  237. };

  238. //=============================================================================
  239. // ** Sprite Battler
  240. //=============================================================================

  241. //==============================
  242. // * update Main
  243. //==============================
  244. var _mog_bchain_sprbattler_updateMain = Sprite_Battler.prototype.updateMain;
  245. Sprite_Battler.prototype.updateMain = function() {
  246.         _mog_bchain_sprbattler_updateMain.call(this);
  247.         if (this.needUpdateBchainPosition()) {this.updateBchainPosition()};
  248. };

  249. //==============================
  250. // * need Update Bchain Pos
  251. //==============================
  252. Sprite_Battler.prototype.needUpdateBchainPosition = function() {
  253.    if (!$gameTemp._bchainData[4]) {return false};
  254.    if ($gameTemp._bchainData[4] != this._battler) {return false};
  255.    return true;       
  256. };

  257. //==============================
  258. // * update B Chain Position
  259. //==============================
  260. Sprite_Battler.prototype.updateBchainPosition = function() {
  261.         $gameTemp._bchainData[2] = this.x;
  262.         $gameTemp._bchainData[3] = this.y;
  263.         if (this._mainSprite) {
  264.         $gameTemp._bchainData[3] -= this._mainSprite.height;
  265.         } else if (this._bitmap) {       
  266.             $gameTemp._bchainData[3] -= this._bitmap.height / 2;
  267.         };
  268. };

  269. //=============================================================================
  270. // ** Spriteset Battle
  271. //=============================================================================

  272. //==============================
  273. // * create Upper Layer
  274. //==============================
  275. var _mog_bchain_sprset_createUpperLayer = Spriteset_Battle.prototype.createUpperLayer;
  276. Spriteset_Battle.prototype.createUpperLayer = function() {
  277.         _mog_bchain_sprset_createUpperLayer.call(this);
  278.     this.createBchain();       
  279. };

  280. //==============================
  281. // * create B Chain
  282. //==============================
  283. Spriteset_Battle.prototype.createBchain = function() {
  284.     this._bchain = new BattleChainSprite();
  285.         this._bchain.z = 25;
  286.         this.addChild(this._bchain);
  287. };

  288. //==============================
  289. // * Update
  290. //==============================
  291. var _mog_bchain_sprtbat_update = Spriteset_Battle.prototype.update;
  292. Spriteset_Battle.prototype.update = function() {
  293.     _mog_bchain_sprtbat_update.call(this)
  294.         if (this._bchain && Imported.MOG_BattleCamera) {
  295.            this._bchain.x = this._battleField.x;
  296.            this._bchain.y = this._battleField.y;
  297.         };
  298. };

  299. if (Imported.MOG_BattleCamera) {
  300.         //==============================
  301.         // * Update Focus
  302.         //==============================
  303.         var _mog_bchaincom_sprbat_updateFocus = Spriteset_Battle.prototype.updateFocus;
  304.         Spriteset_Battle.prototype.updateFocus = function() {
  305.                 if ($gameTemp._bchainTemp) {$gameTemp._bcam_user[2] = 0};
  306.                 _mog_bchaincom_sprbat_updateFocus.call(this);
  307.         };
  308. };

  309. //=============================================================================
  310. // * Battle Chain Sprite
  311. //=============================================================================
  312. function BattleChainSprite() {
  313.     this.initialize.apply(this, arguments);
  314. };

  315. BattleChainSprite.prototype = Object.create(Sprite.prototype);
  316. BattleChainSprite.prototype.constructor = BattleChainSprite;

  317. //==============================
  318. // * Initialize
  319. //==============================
  320. BattleChainSprite.prototype.initialize = function() {
  321.     Sprite.prototype.initialize.call(this);       
  322.         this.z = 25;
  323.         this._data = [-1,-1,false];
  324.         this._keyIndex = 0;
  325.         this._duration = 0;
  326.     this.loadImages();
  327.         this.createLayout();
  328.         this.createMeter();       
  329.         this.createKeys();
  330.         this.createName();
  331. };

  332. //==============================
  333. // * Load Images
  334. //==============================
  335. BattleChainSprite.prototype.loadImages = function() {
  336.         this._keysImg = ImageManager.loadSystem("Chain_A");
  337.         this._layoutImg = ImageManager.loadSystem("Chain_B");
  338.         this._meterImg = ImageManager.loadSystem("Chain_C");
  339. };

  340. //==============================
  341. // * getData
  342. //==============================
  343. BattleChainSprite.prototype.getData = function() {       
  344.     this._data[0] = Math.floor(this._keysImg.width / 6);
  345.         this._data[1] = this._keysImg.height;
  346. };

  347. //==============================
  348. // * create Layout
  349. //==============================
  350. BattleChainSprite.prototype.createLayout = function() {       
  351.         this._layout = new Sprite(this._layoutImg);
  352.         this._layout.opacity = 0;
  353.         this._layout.anchor.x = 0.5;
  354.         this._layout.anchor.y = 0.5;
  355.         this.addChild(this._layout);
  356. };

  357. //==============================
  358. // * create Name
  359. //==============================
  360. BattleChainSprite.prototype.createName = function() {
  361.         this._name = new Sprite(new Bitmap(100,32));
  362.         this._name.opacity = 0;
  363.         this._name.anchor.x = 0.5;
  364.         this._name.anchor.y = 0.5;
  365.         this._name.bitmap.fontSize = 20;
  366.         this.addChild(this._name);
  367. };

  368. //==============================
  369. // * create Keys
  370. //==============================
  371. BattleChainSprite.prototype.createKeys = function() {
  372.         this._keys = new Sprite(this._keysImg);
  373.         this._keys.opacity = 0;
  374.         this._keys.anchor.x = 0.5;
  375.         this._keys.anchor.y = 0.5;       
  376.         this.addChild(this._keys);
  377. };

  378. //==============================
  379. // * create Meter
  380. //==============================
  381. BattleChainSprite.prototype.createMeter = function() {
  382.         this._meter = new Sprite(this._meterImg);
  383.         this._meter.opacity = 0;
  384.         this._meter.anchor.x = 0;
  385.         this._meter.anchor.y = 0.5;       
  386.         this.addChild(this._meter);       
  387. };

  388. //==============================
  389. // * Need Refresh
  390. //==============================
  391. BattleChainSprite.prototype.needRefresh = function() {
  392.         if ($gameTemp._bchainData[0] == this._data[2]) {return false};
  393.         if (!this.item()) {return false};
  394.         if (!this.posX()) {return false};
  395.         return true;
  396. };

  397. //==============================
  398. // * Item
  399. //==============================
  400. BattleChainSprite.prototype.item = function() {
  401.    return $gameTemp._bchainData[1];
  402. };

  403. //==============================
  404. // * posX
  405. //==============================
  406. BattleChainSprite.prototype.posX = function() {
  407.    return $gameTemp._bchainData[2] + Moghunter.chainCom_x;
  408. };

  409. //==============================
  410. // * posY
  411. //==============================
  412. BattleChainSprite.prototype.posY = function() {
  413.    return $gameTemp._bchainData[3] + Moghunter.chainCom_y;
  414. };

  415. //==============================
  416. // * Times
  417. //==============================
  418. BattleChainSprite.prototype.times = function() {
  419.    return $gameTemp._bchainData[6];
  420. };

  421. //==============================
  422. // * Duration
  423. //==============================
  424. BattleChainSprite.prototype.duration = function() {
  425.    return $gameTemp._bchainData[7];
  426. };

  427. //==============================
  428. // * Refresh
  429. //==============================
  430. BattleChainSprite.prototype.refresh = function() {       
  431.         this._data[2] = $gameTemp._bchainData[0];
  432.         this._duration = this.duration();
  433.         this._layout.opacity = 255;
  434.         this._keys.opacity = 255;
  435.         this._keys.scale.x = 2.0;
  436.         this._keys.scale.y = 2.0;
  437.         this._meter.opacity = 255;
  438.         this._name.opacity = 255;
  439.         this._name.bitmap.clear();
  440.         this._name.bitmap.drawText(this.item().name,0,0,100,32,"center");
  441.         this._keys.setFrame(this._data[0] * this._keyIndex,0,this._data[0],this._data[1]);
  442. };

  443. //==============================
  444. // * need Update Action
  445. //==============================
  446. BattleChainSprite.prototype.needUpdateAction = function() {
  447.         if (!this.item()) {return false};
  448.         if (!this.posX()) {return false};
  449.         if (this._layout.opacity == 0) {return false};
  450.         return true;
  451. };

  452. //==============================
  453. // * Update Action
  454. //==============================
  455. BattleChainSprite.prototype.updateAction = function() {
  456.      this.updatePosition();
  457.          this.updateCommands();
  458.          if (this._duration > 0) {this.updateTime()};
  459. };

  460. //==============================
  461. // * Update Action
  462. //==============================
  463. BattleChainSprite.prototype.updateTime = function() {
  464.       this._duration --
  465.       this.updateMeter();
  466.           if (this._duration <= 0) {this.setWrong();};
  467. };

  468. //==============================
  469. // * Update Meter
  470. //==============================
  471. BattleChainSprite.prototype.updateMeter = function() {
  472.           var rate = this._duration * this._meterImg.width / this.duration();
  473.           this._meter.setFrame(0,0,rate,this._meterImg.height)
  474. };

  475. //==============================
  476. // * Update Action
  477. //==============================
  478. BattleChainSprite.prototype.check_key = function(value) {
  479.     if (value == this._keyIndex) {               
  480.             this.nextKey();
  481.         } else {
  482.         this.setWrong();
  483.         };
  484. };

  485. //==============================
  486. // * set Wrong
  487. //==============================
  488. BattleChainSprite.prototype.setWrong = function(value) {
  489.         SoundManager.playBuzzer();
  490.         this.clearCommands();
  491. };

  492. //==============================
  493. // * Next Key
  494. //==============================
  495. BattleChainSprite.prototype.nextKey = function(value) {
  496.         if (this.times() <= 0) {this.enableAction();return};       
  497.         SoundManager.playCursor();
  498.     this._keyIndex = Math.randomInt(6);
  499.         $gameTemp._bchainData[6] -= 1;
  500.         this.refresh();
  501. };

  502. //==============================
  503. // * enable Action
  504. //==============================
  505. BattleChainSprite.prototype.enableAction = function(value) {
  506.         SoundManager.playUseSkill();
  507.         $gameTemp._bchainData[10] = true;
  508.         this.clearCommands();
  509. };

  510. //==============================
  511. // * Set Wrong
  512. //==============================
  513. BattleChainSprite.prototype.clearCommands = function() {
  514.         this._layout.opacity = 0;
  515.         this._keys.opacity = 0;
  516.         this._meter.opacity = 0;
  517.         this._name.opacity = 0;       
  518.         this._duration = 0;
  519.         this._data[2] = false;
  520.         $gameTemp._bchainData[9] = true;
  521. };

  522. //==============================
  523. // * Update Commands
  524. //==============================
  525. BattleChainSprite.prototype.updateCommands = function() {
  526.         if (Input.isTriggered("right")) {this.check_key(0)}
  527.         else if (Input.isTriggered("left")) {this.check_key(1)}
  528.         else if (Input.isTriggered("down")) {this.check_key(2)}
  529.         else if (Input.isTriggered("up")) {this.check_key(3)}
  530.         else if (Input.isTriggered("ok")) {this.check_key(4)}
  531.         else if (Input.isTriggered("cancel")) {this.check_key(5)}        ;
  532. };

  533. //==============================
  534. // * Update Position
  535. //==============================
  536. BattleChainSprite.prototype.updatePosition = function() {
  537.         this._layout.x = this.posX();
  538.         this._layout.y = this.posY();
  539.         this._keys.x = this.posX() + Moghunter.chainCom_Key_x;
  540.         this._keys.y = this.posY() + Moghunter.chainCom_Key_y;       
  541.         this._meter.x = this.posX() - (this._meterImg.width / 2) + Moghunter.chainCom_Meter_x;
  542.         this._meter.y = this.posY() + Moghunter.chainCom_Meter_y;                
  543.     this._name.x = this.posX() + Moghunter.chainCom_Name_x;
  544.     this._name.y = this.posY() + Moghunter.chainCom_Name_y;
  545. };

  546. //==============================
  547. // * Update
  548. //==============================
  549. BattleChainSprite.prototype.update = function() {
  550.     Sprite.prototype.update.call(this);       
  551.         if (this._data[0] === -1) {
  552.            if (this._keysImg.isReady() && this._meterImg.isReady()) {this.getData()};
  553.            return;
  554.     };
  555.         if (this.needRefresh()) {this.nextKey()};
  556.         if (this.needUpdateAction()) {this.updateAction()};
  557.         if (this._keys.scale.x > 1.00) {this._keys.scale.x -= 0.1};
  558.         this._keys.scale.y = this._keys.scale.x
  559. };
复制代码

是这个吗

点评

不是这个啊……RGSS3 – Chain Commands m  发表于 2017-5-24 20:29
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-14 08:46

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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