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

Project1

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

[已经解决] 魔法盾效果

[复制链接]

Lv2.观梦者

梦石
0
星屑
350
在线时间
109 小时
注册时间
2016-1-17
帖子
93
跳转到指定楼层
1
发表于 2016-1-23 12:35:37 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我想知道MV如何设置魔法盾技能, 我想让某个人物被动开启魔法盾技能,求教

Lv2.观梦者

梦石
0
星屑
350
在线时间
109 小时
注册时间
2016-1-17
帖子
93
2
 楼主| 发表于 2016-1-24 04:57:58 | 只看该作者
http://www.rpgbbs.com/forum.php?mod=viewthread&tid=3
这里有个帖子,不会下载、、
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
帖子
1516
3
发表于 2016-1-24 10:49:21 | 只看该作者
不知道什么是魔法盾(很多技能都叫魔法盾吧.......)
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
350
在线时间
109 小时
注册时间
2016-1-17
帖子
93
4
 楼主| 发表于 2016-1-24 11:27:27 | 只看该作者
汪汪 发表于 2016-1-24 10:49
不知道什么是魔法盾(很多技能都叫魔法盾吧.......)

就是要弄一个状态,当人物有mp的时候,按一定百分比用mp替代hp伤害
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
350
在线时间
109 小时
注册时间
2016-1-17
帖子
93
5
 楼主| 发表于 2016-1-25 21:25:12 | 只看该作者
翻了下墙,终于把上面的脚本下载下来了,分享一下
经测试,能用,但是现在又有一个问题困扰着我,如何设置一个技能可以
无视魔法盾状态给予HP的直接打击呢
  1. //=============================================================================
  2. // Alistair Plugins - Mana Shield
  3. // AP_ManaShield.js
  4. //=============================================================================
  5. var Imported = Imported || {};
  6. Imported.AP_ManaShield = true;
  7. //=============================================================================
  8. /*:
  9. * @plugindesc v1.081 Allows you to create Mana Shield Weapons/Armours/States
  10. * @author Alistair Plugins
  11. *
  12. * @param Allow Healing
  13. * @desc In some cases, a mana shield may reduce the damage too much and thus heal the user. Default: false
  14. * @default false
  15. *
  16. * @param Cap Notetag Values
  17. * @desc Some Notetags may return strange behaviour if they use Numbers greater than 100. Cap Values at 100? Default: true
  18. * @default true
  19. *
  20. * @param Show MP Popups
  21. * @desc This will show MP Popups. Default: true
  22. * @default true
  23. *
  24. * @param Default MP Ratio
  25. * @desc Each point of MP absorbs x Points of Damage. Default: 1
  26. * @default 1
  27. *
  28. * @param Default TP Ratio
  29. * @desc Each point of TP absorbs x Points of Damage. Default: 1
  30. * @default 1
  31. *
  32. * @help
  33. * ============================================================================
  34. * Alistair Plugins - Mana Shield
  35. * ============================================================================
  36. *
  37. * Here is my remake of my Mana Shield script.
  38. * Mana Shields are pretty common these days since they allow squishy battlers
  39. * like Mages or Priests to become somewhat tanky since they have so much Mana
  40. * to use as a second HP bar.
  41. * This Plugin will allow Weapons, Armours and States to act as Mana Shields.
  42. *
  43. * Place this below all of Yanfly's Battle Scripts or it WON'T work.
  44. * ============================================================================
  45. * Notetags
  46. * ============================================================================
  47. * These only work for: Weapons, Armours, States
  48. *
  49. * <ms_absorb:x>
  50. * Will reduce incoming damage by x%.
  51. * Example: <ms_absorb:20>. 100 Damage will be reduced by 20% => 80 Damage.
  52. *
  53. * <ms_reduce:x>
  54. * Will reduce incoming damage by x.
  55. * Example: <ms_reduce:30>. 160 Damage will be reduced by 30 => 130 Damage.
  56. *
  57. * <ms_split_x:y>
  58. * Will split incoming damage between HP and x (x being either MP or TP) by y%.
  59. * Example: <ms_split_MP:50>. 140 Damage will be split to 70 HP Damage and 70 MP
  60. * Damage.
  61. *
  62. * <ms_replenish_x:y>
  63. * Will replenish x (x being either HP, MP or TP) by y% of the damage.
  64. * Example: <ms_replenish_TP:50>. 100 Damage will recover 50% TP.
  65. *
  66. * <ms_ignore:x>
  67. * Will ignore all incoming damage with a probability of x%.
  68. * Example: <ms_ignore:100>. Will certainly ignore any damage.
  69. *
  70. * <ms_dissolve_x:y>
  71. * Will delete the state with the Mana Shield property if the afflicted battler
  72. * has y or less x (x being either HP, MP or TP)
  73. * Example: <ms_dissolve_MP:0>. Will remove the Mana Shield State if the battler
  74. * has 0 MP (or less) left.
  75. *
  76. * <ms_TP_ratio:x>
  77. * 1 TP will drain x Points of Damage. If there's no Tag present, it will just
  78. * revert to what's set in the "Default TP Ratio" parameter.
  79. * Example: <ms_TP_ratio:5>. 1 TP will absorb 5 Points of Damage.
  80. *
  81. * <ms_MP_ratio:x>
  82. * 1 MP will drain x Points of Damage. If there's no Tag present, it will just
  83. * revert to what's set in the "Default MP Ratio" parameter.
  84. * Example: <ms_MP_ratio:2>. 1 MP will absorb 2 Points of Damage.
  85. *
  86. *
  87. * Please note: This is the exact way these notetags have to be written down.
  88. * No white spaces!
  89. * ============================================================================
  90. * Update History
  91. * ============================================================================
  92. * V1.081
  93. * - Fixed rounding error with Replenish
  94. *
  95. * V1.08
  96. * - Fixed missing MP Popups
  97. *
  98. * V1.07
  99. * - You may now use formulas instead of fixed numbers in notetags.
  100. *
  101. * V1.06
  102. * - Rewrote some parts of the Plugin to make it easier to combine it
  103. *   with other Plugins of mine
  104. *
  105. * V1.05
  106. * - Fixed value rounding
  107. * - Compatibility with YEP_DamageCore
  108. *
  109. * V1.04
  110. * - Added the Default MP Ratio Parameter
  111. * - Added the Default TP Ratio Parameter
  112. * - Added Notetags to change the MP/TP Ratio
  113. * - Recovery Rate (rec) will now be considered when using Replenish HP
  114. * - Recovery Rate (rec) will now be considered when using Replenish MP
  115. * - TP Charge Rate (tcr) will now be considered when using Replenish TP
  116. * - If an ignore tag applies in battle, TP damage will now be ignored as well
  117. *
  118. * V1.03
  119. * - Added the Cap Notetag Values Parameter
  120. * - Added the Hide MP Popups Parameter
  121. * - Fixed Parameter Handling
  122. * - You may now use split to split damage between HP and TP.
  123. * - You may now use the new notetag <ms_dissolve_x:y> to make a state disappear
  124. *   if the battler afflicted with it has y x
  125. *   (y being any number, x being HP, MP or TP) or less
  126. * - Fixed unneccessary MP Damage Popups
  127. *
  128. * V1.02
  129. * - Using Replenish will now show popups too
  130. * - Healing Skills are now unaffected by Mana Shields
  131. *
  132. * V1.01
  133. * - Fixed a bug that made multiple split notetags result in huge damage values
  134. * - The value entered for a split notetag will now determine how much percent
  135. *   of the damage goes to MP instead of HP.
  136. * - Fixed the handling of negative numbers
  137. * - If an ignore tag applies in battle, MP damage will now be ignored as well
  138. *
  139. * V1.0
  140. * - First version
  141. */
  142. //=============================================================================

  143. (function() {

  144. var parameters = PluginManager.parameters('AP_ManaShield');
  145. var AllowHealing = String(parameters['Allow Healing']);
  146. var CapNotetagValues = String(parameters['Cap Notetag Values']);
  147. var ShowMPPopups = String(parameters['Show MP Popups']);
  148. var DefaultMPRatio = Number(parameters['Default MP Ratio']);
  149. var DefaultTPRatio = Number(parameters['Default TP Ratio']);

  150. // Default Function Overwritten
  151. Game_Action.prototype.makeDamageValue = function(target, critical) {
  152.     var item = this.item();
  153.     // Begin of Imported
  154.     if (Imported.YEP_DamageCore) {
  155.     var a = this.subject();
  156.     var b = target;
  157.     var user = this.subject();
  158.     var s = $gameSwitches._data;
  159.     var v = $gameVariables._data;
  160.     var baseDamage = this.evalDamageFormula(target);
  161.     var value = baseDamage;
  162.     eval(Yanfly.DMG.DamageFlow);
  163.     //
  164.     } else {
  165.     //
  166.     var baseValue = this.evalDamageFormula(target);
  167.     var value = baseValue * this.calcElementRate(target);
  168.     if (this.isPhysical()) {
  169.         value *= target.pdr;
  170.     }
  171.     if (this.isMagical()) {
  172.         value *= target.mdr;
  173.     }
  174.     if (baseValue < 0) {
  175.         value *= target.rec;
  176.     }
  177.     if (critical) {
  178.         value = this.applyCritical(value);
  179.     }
  180.     value = this.applyVariance(value, item.damage.variance);
  181.     value = this.applyGuard(value, target);
  182.     };
  183.     // End of Imported
  184.     // Mana Shield
  185.     value = this.makeManaShield(value, target, critical);
  186.     return Math.round(value);
  187. };

  188. // New Function to provide better Compatibility
  189. Game_Action.prototype.makeManaShield = function(value, target, critical) {
  190.     // var msRatio
  191.     // Stores the rates of damage absorption for both MP[0] and TP[1]
  192.     // Will revert to default unless the ratio has been altered by a notetag.
  193.     var a = this.subject();
  194.     var b = target;
  195.     var s = $gameSwitches._data;
  196.     var v = $gameVariables._data;
  197.     var msRatio = [DefaultMPRatio, DefaultTPRatio];
  198.     if (target.manaShield("ratio", a,b,s,v)[0] !== 0 || target.manaShield("ratio", a,b,s,v)[0] !== 0) {
  199.     var msRatio = target.manaShield("ratio", a,b,s,v);
  200.     };
  201.     // var ms_mpDamage
  202.     // Stores MP Damage done to the target by Mana Shields
  203.     var ms_mpDamage = 0;
  204.     // var ms_tpDamage
  205.     // Stores TP Damage done to the target by Mana Shields
  206.     var ms_tpDamage = 0;
  207.     // Leave Healing Skills and MP Damage unaffected
  208.     if (value > 0 && !this.isMpEffect()) {
  209.     // msAbsorb
  210.     var msAbsorb = Math.max(0, target.manaShield("absorb", a,b,s,v));
  211.     value = value * (100 - msAbsorb) / 100;
  212.     // msReduce
  213.     var msReduce = Math.max(0, target.manaShield("reduce", a,b,s,v));
  214.     value = value - msReduce;
  215.     if (eval(AllowHealing) === false) {
  216.     value = Math.max(value, 0);
  217.     };
  218.     // msSplit
  219.     var msSplit = target.manaShield("split", a,b,s,v);
  220.     msSplit[0] = Math.max(0, msSplit[0]);
  221.     if (msSplit[1]) {
  222.     switch (msSplit[2]) {
  223.     case 1:
  224.     var ms_mpDamage = value * msSplit[0] / 100;
  225.     ms_mpDamage = parseInt(ms_mpDamage / msRatio[0])
  226.     value = value * (100 - msSplit[0]) / 100;
  227.     if (target.mp < ms_mpDamage) {
  228.     value = value + (ms_mpDamage - target.mp);
  229.     ms_mpDamage = target.mp;
  230.     };
  231.     break;
  232.     case 2:
  233.     var ms_tpDamage = value * msSplit[0] / 100;
  234.     ms_tpDamage = parseInt(ms_tpDamage / msRatio[1])
  235.     value = value * (100 - msSplit[0]) / 100;
  236.     if (target.tp < ms_tpDamage) {
  237.     value = value + (ms_tpDamage - target.tp);
  238.     ms_tpDamage = target.tp;
  239.     };
  240.     // target.setTp(Math.round(target.tp - ms_tpDamage));
  241.     break;
  242.     default:
  243.     return value;
  244.     };
  245.     };
  246.     // msReplenish
  247.     var msReplenish = target.manaShield("replenish", a,b,s,v);
  248.     msReplenish[1] = Math.max(0, msReplenish[1]);
  249.     var msHeal = Math.floor(value * msReplenish[1] / 100);
  250.     switch (msReplenish[0]) {
  251.     case 0:
  252.     value = value - (msHeal * target.rec);
  253.     break;
  254.     case 1:
  255.     break;
  256.     case 2:
  257.     msHeal = msHeal * target.tcr;
  258.     target.setTp(Math.round(target.tp + msHeal));
  259.     break;
  260.     default:
  261.     break;
  262.     };
  263.     // msIgnore
  264.     var msIgnore = target.manaShield("ignore", a,b,s,v) / 100;
  265.     msIgnore = Math.max(0, msIgnore);
  266.     if (msIgnore > Math.random()) {
  267.     value = 0;
  268.     var ms_mpDamage = 0;
  269.     var ms_tpDamage = 0;
  270.     };
  271.     ms_mpDamage = parseInt(ms_mpDamage);
  272.     // MP Regeneration and Popups are managed down here
  273.     if (msReplenish[0] === 1 && eval(ShowMPPopups)) {
  274.     target._result.mpDamage = ms_mpDamage - msHeal;
  275.     };
  276.     if (msReplenish[0] === 2) {
  277.     target._result.tpDamage = -msHeal
  278.     };
  279.     if (msReplenish[0] !== 1 && eval(ShowMPPopups)) {
  280.     target._result.mpDamage = ms_mpDamage;
  281.     };
  282.     if (msReplenish[0] === 1) {
  283.     target.setMp(Math.round(target.mp - ms_mpDamage + (msHeal * target.rec)));
  284.     } else {
  285.     target.setMp(Math.round(target.mp - ms_mpDamage));
  286.     };
  287.     target.setTp(Math.round(target.tp - ms_tpDamage));
  288.     value = Math.round(value);
  289.     // Erase a State
  290.     var msDissolve = target.manaShield("dissolve", a,b,s,v);
  291.     if (msDissolve[0] !== 0) {
  292.     switch (msDissolve[1]) {
  293.     case 1:
  294.     if ((target.hp - value) <= msDissolve[2]) {
  295.     target.removeState(msDissolve[0]);
  296.     };
  297.     break;
  298.     case 2:
  299.     if (target.mp <= msDissolve[2]) {
  300.     target.removeState(msDissolve[0]);
  301.     };
  302.     break;
  303.     case 3:
  304.     if (target.tp <= msDissolve[2]) {
  305.     target.removeState(msDissolve[0]);
  306.     };
  307.     break;
  308.     default:
  309.     return value;
  310.     };
  311.     };
  312.     };
  313.     return value;
  314. };
  315.      
  316. // Default Function Overwritten
  317. Game_Battler.prototype.gainMp = function(value) {
  318.     if (eval(ShowMPPopups)) {
  319.     this._result.mpDamage = -value;
  320.     };
  321.     this.setMp(this.mp + value);
  322. };

  323. // New function Game_BattlerBase.prototype.manaShield(arg)
  324. // arg determines which Mana Shield property will be returned.
  325. // arg accepts strings.
  326. Game_BattlerBase.prototype.manaShield = function(arg, a, b, s, v) {
  327. var a = a;
  328. var b = b;
  329. var s = s;
  330. var v = v;
  331. var arg = arg;
  332. var msAbsorb = 0;
  333. var msReduce = 0;
  334. var msSplit = [0, false, 0];
  335. var msReplenish = [0, 0];
  336. var msIgnore = 0;
  337. var msDissolve = [0, 0, 0];
  338. var msRatio = [0, 0];

  339. if (this.isActor()) {
  340. var equip = this.equips()
  341. for (var i = 0; i < equip.length; i++) {
  342. var item = equip[i]
  343. if (item && item.meta.ms_absorb !== undefined) {
  344. msAbsorb += eval(item.meta.ms_absorb);
  345. };
  346. if (item && item.meta.ms_reduce !== undefined) {
  347. msReduce += eval(item.meta.ms_reduce);
  348. };
  349. if (item && item.meta.ms_split_MP !== undefined) {
  350. msSplit[0] += Number(eval(item.meta.ms_split_MP));
  351. msSplit[1] = true;
  352. msSplit[2] = 1;
  353. };
  354. if (item && item.meta.ms_split_TP !== undefined) {
  355. msSplit[0] += Number(eval(item.meta.ms_split_TP));
  356. msSplit[1] = true;
  357. msSplit[2] = 2;
  358. };
  359. if (item && item.meta.ms_replenish_HP !== undefined) {
  360. msReplenish[0] = 0;
  361. msReplenish[1] = eval(item.meta.ms_replenish_HP);
  362. };
  363. if (item && item.meta.ms_replenish_MP !== undefined) {
  364. msReplenish[0] = 1;
  365. msReplenish[1] = eval(item.meta.ms_replenish_MP);
  366. };
  367. if (item && item.meta.ms_replenish_TP !== undefined) {
  368. msReplenish[0] = 2;
  369. msReplenish[1] = eval(item.meta.ms_replenish_TP);
  370. };
  371. if (item && item.meta.ms_ignore !== undefined) {
  372. msIgnore += eval(item.meta.ms_ignore);
  373. };
  374. if (item && item.meta.ms_MP_ratio !== undefined) {
  375. msRatio[0] += parseInt(item.meta.ms_MP_ratio);
  376. };
  377. if (item && item.meta.ms_TP_ratio !== undefined) {
  378. msRatio[1] += parseInt(item.meta.ms_TP_ratio);
  379. };
  380. };
  381. };

  382. var state = this.states()
  383. for (var i = 0; i < state.length; i++) {
  384. var item = state[i]
  385. if (item && item.meta.ms_absorb !== undefined) {
  386. msAbsorb += eval(item.meta.ms_absorb);
  387. };
  388. if (item && item.meta.ms_reduce !== undefined) {
  389. msReduce += eval(item.meta.ms_reduce);
  390. };
  391. if (item && item.meta.ms_split_MP !== undefined) {
  392. msSplit[0] += Number(eval(item.meta.ms_split_MP));
  393. msSplit[1] = true;
  394. msSplit[2] = 1;
  395. };
  396. if (item && item.meta.ms_split_TP !== undefined) {
  397. msSplit[0] += Number(eval(item.meta.ms_split_TP));
  398. msSplit[1] = true;
  399. msSplit[2] = 2;
  400. };
  401. if (item && item.meta.ms_replenish_HP !== undefined) {
  402. msReplenish[0] = 0;
  403. msReplenish[1] = eval(item.meta.ms_replenish_HP);
  404. };
  405. if (item && item.meta.ms_replenish_MP !== undefined) {
  406. msReplenish[0] = 1;
  407. msReplenish[1] = eval(item.meta.ms_replenish_MP);
  408. };
  409. if (item && item.meta.ms_replenish_TP !== undefined) {
  410. msReplenish[0] = 2;
  411. msReplenish[1] = eval(item.meta.ms_replenish_TP);
  412. };
  413. if (item && item.meta.ms_ignore !== undefined) {
  414. msIgnore += eval(item.meta.ms_ignore);
  415. };
  416. if (item && item.meta.ms_dissolve_HP !== undefined) {
  417. msDissolve = [item.id, 1, eval(item.meta.ms_dissolve_HP)];
  418. };
  419. if (item && item.meta.ms_dissolve_MP !== undefined) {
  420. msDissolve = [item.id, 2, eval(item.meta.ms_dissolve_MP)];
  421. };
  422. if (item && item.meta.ms_dissolve_TP !== undefined) {
  423. msDissolve = [item.id, 3, eval(item.meta.ms_dissolve_TP)];
  424. };
  425. if (item && item.meta.ms_MP_ratio !== undefined) {
  426. msRatio[0] += parseInt(item.meta.ms_MP_ratio);
  427. };
  428. if (item && item.meta.ms_TP_ratio !== undefined) {
  429. msRatio[1] += parseInt(item.meta.ms_TP_ratio);
  430. };
  431. };

  432. if (eval(CapNotetagValues)) {
  433. msAbsorb = Math.min(100, msAbsorb);
  434. msSplit[0] = Math.min(100, msSplit[0]);
  435. msReplenish[1] = Math.min(100, msReplenish[1]);
  436. msIgnore = Math.min(100, msIgnore);
  437. };

  438. switch (arg) {
  439. // Mana Shield Propertys
  440. case "absorb": return msAbsorb;
  441. case "reduce": return msReduce;
  442. case "split" : return msSplit ;
  443. case "replenish": return msReplenish;
  444. case "ignore": return msIgnore;
  445. // Dissolve Property
  446. case 'dissolve':
  447. msDissolve[2] = parseInt(msDissolve[2]);
  448. return msDissolve;
  449. // Ratio Property
  450. case 'ratio': return msRatio;
  451. // Default
  452. default: return 0
  453. };
  454. };

  455. })();
  456. //=============================================================================
  457. // End of Plugin
  458. //=============================================================================
复制代码

点评

http://yun.baidu.com/s/1o6ZmEfw  发表于 2016-2-10 23:28
楼主求个Yanfly's Battle Scripts插件  发表于 2016-2-8 01:43
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-12-23 16:33

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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