Guest User

Untitled

a guest
Aug 22nd, 2018
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.71 KB | None | 0 0
  1. /*--------------------------------------------------------------------------
  2.  
  3. //--------------------------------------------------------
  4. // バスター系武器をカスタムで作れるスクリプト改
  5. // 相性強化武器もカスタムで作れます
  6. //
  7. // ※バスター系同士をぶつけた場合、本来の相性が適用されます
  8. // (例)自分:ランスバスター(剣)、相手:ソードバスター(斧)の場合、
  9. // 普通に剣と斧の相性を比較します
  10. // (改じゃない方のスクリプトではソードバスターが有利になります)
  11.  
  12. //--------------------------------------------------------
  13.  
  14. ■概要
  15.  【バスター系武器】
  16.   武器のカスタムパラメータに {buster:1} を入れると、相性をひっくり返します。
  17.  
  18.   ひっくり返し方は以下の感じ(槍が剣に有利な場合)
  19.    普通の剣:修正なし   槍:修正値
  20.    槍バス :槍の修正値※ 槍:修正なし
  21.  
  22.    ※ようは槍バスの場合、槍が有利になる場合の修正値を槍バスがひったくって使うということ。
  23.  
  24.   ちなみに、{buster:2} にすると、槍バスの修正値は槍の修正値*2になります(数値がそのまま係数になってます)
  25.   (未検証ですが、槍は剣と弓に有利などと複数の相性がついてる場合は全部ひっくり返る筈)
  26.  
  27.  【相性強化系武器】
  28.   武器のカスタムパラメータに {coefficient:2}を入れると、相性の修正値を2倍します(3だと3倍になります)
  29.   (なお、coefficientに1以下の数字を入れた場合、無視されます)
  30.  
  31.   相性の修正値は、アクティブ側とパッシブ側の武器のうちより大きい係数が採用されます。
  32.   (例.アクティブ側が{coefficient:2}、パッシブ側が通常武器の場合、アクティブ側の係数の方が大きい為係数は2倍として計算されます)
  33.  
  34.  【注意事項】
  35.   バスター系武器({buster:?}をつけた武器)に相性強化({coefficient:?})はつけないでください。
  36.   武器の相性を2倍する武器は{coefficient:2}をつけるようにし、
  37.   ソードキラーのように武器の相性を反転して2倍する武器には{buster:2}をつけるようにしてください。
  38.  
  39.   相性強化の係数とバスター系の係数は別々に乗算して計算されるので、係数がとんでもない事になります。
  40.   ({buster:2}と{coefficient:2}を同時につけた武器は係数が4倍(2*2)、{buster:5}と{coefficient:5}を同時につけた武器は係数が25倍(5*5)になります)
  41.  
  42.  
  43. 修正内容
  44. 16/12/22 新規作成
  45.  
  46. ■対応バージョン
  47.  SRPG Studio Version:1.108
  48.  
  49.  
  50. ■規約
  51. ・利用はSRPG Studioを使ったゲームに限ります。
  52. ・商用・非商用問いません。フリーです。
  53. ・加工等、問題ありません。どんどん改造してください。
  54. ・クレジット明記無し OK
  55. ・再配布、転載 OK
  56. ・SRPG Studio利用規約は遵守してください。
  57.  
  58. --------------------------------------------------------------------------*/
  59.  
  60. (function() {
  61.  
  62.  
  63.  
  64.  
  65. //--------------------------------------
  66. // CompatibleCalculatorクラス
  67. //--------------------------------------
  68. CompatibleCalculator._getCompatible= function(active, passive, weapon) {
  69. var i, count, compatible, weaponTypeActive, weaponTypePassive;
  70. var weaponPassive = ItemControl.getEquippedWeapon(passive);
  71.  
  72. if (weaponPassive === null || weapon === null) {
  73. return null;
  74. }
  75.  
  76. var active_buster = weapon.custom.buster;
  77. var passive_buster = weaponPassive.custom.buster;
  78.  
  79. weaponTypeActive = weapon.getWeaponType();
  80. weaponTypePassive = weaponPassive.getWeaponType();
  81.  
  82. // アクティブ側が相性が良い武器かのチェック
  83. count = weaponTypeActive.getCompatibleCount();
  84. for (i = 0; i < count; i++) {
  85. compatible = weaponTypeActive.getCompatibleData(i);
  86. if (compatible.getSrcObject() === weaponTypePassive) {
  87. // お互いがバスター武器でないor両方がバスター、の場合のみ相性が発生する
  88. if ( (active_buster == null && passive_buster == null) || (active_buster != null && passive_buster != null) ) {
  89. return compatible.getSupportStatus();
  90. }
  91. break;
  92. }
  93. }
  94.  
  95. // パッシブ側が相性が良い武器かのチェック
  96. var compatible_passive;
  97. count = weaponTypePassive.getCompatibleCount();
  98. for (i = 0; i < count; i++) {
  99. compatible_passive = weaponTypePassive.getCompatibleData(i);
  100. if (compatible_passive.getSrcObject() === weaponTypeActive) {
  101. // 『お互いがバスター武器でないor両方がバスター』以外のケースで相性が発生する
  102. if ( !((active_buster == null && passive_buster == null) || (active_buster != null && passive_buster != null)) ) {
  103. return compatible.getSupportStatus(); // 返す相性値はアクティブ側の値
  104. // return compatible_passive.getSupportStatus();
  105. }
  106. break;
  107. }
  108. }
  109.  
  110. return null;
  111. };
  112.  
  113.  
  114. // バスター武器による相性値(力)の補正(補正不要の場合、本関数をコメントアウトしてください)
  115. CompatibleCalculator.getPower= function(active, passive, weapon) {
  116. var compatible = this._getCompatible(active, passive, weapon);
  117.  
  118. if (compatible === null) {
  119. return 0;
  120. }
  121.  
  122. return this._cnvBuster( passive, weapon, compatible.getPower() );
  123. // return compatible.getPower();
  124. };
  125.  
  126.  
  127. // バスター武器による相性値(守)の補正(補正不要の場合、本関数をコメントアウトしてください)
  128. CompatibleCalculator.getDefense= function(active, passive, weapon) {
  129. var compatible = this._getCompatible(active, passive, weapon);
  130.  
  131. if (compatible === null) {
  132. return 0;
  133. }
  134.  
  135. return this._cnvBuster( passive, weapon, compatible.getDefense() );
  136. // return compatible.getDefense();
  137. };
  138.  
  139.  
  140. // バスター武器による相性値(命中)の補正(補正不要の場合、本関数をコメントアウトしてください)
  141. CompatibleCalculator.getHit= function(active, passive, weapon) {
  142. var compatible = this._getCompatible(active, passive, weapon);
  143.  
  144. if (compatible === null) {
  145. return 0;
  146. }
  147.  
  148. return this._cnvBuster( passive, weapon, compatible.getHit() );
  149. // return compatible.getHit();
  150. };
  151.  
  152.  
  153. // バスター武器による相性値(回避)の補正(補正不要の場合、本関数をコメントアウトしてください)
  154. CompatibleCalculator.getAvoid= function(active, passive, weapon) {
  155. var compatible = this._getCompatible(active, passive, weapon);
  156.  
  157. if (compatible === null) {
  158. return 0;
  159. }
  160.  
  161. return this._cnvBuster( passive, weapon, compatible.getAvoid() );
  162. // return compatible.getAvoid();
  163. };
  164.  
  165.  
  166. // バスター武器による相性値(クリティカル)の補正(補正不要の場合、本関数をコメントアウトしてください)
  167. CompatibleCalculator.getCritical= function(active, passive, weapon) {
  168. var compatible = this._getCompatible(active, passive, weapon);
  169.  
  170. if (compatible === null) {
  171. return 0;
  172. }
  173.  
  174. return this._cnvBuster( passive, weapon, compatible.getCritical() );
  175. // return compatible.getCritical();
  176. };
  177.  
  178.  
  179. // バスター武器による相性値(クリティカル回避)の補正(補正不要の場合、本関数をコメントアウトしてください)
  180. CompatibleCalculator.getCriticalAvoid= function(active, passive, weapon) {
  181. var compatible = this._getCompatible(active, passive, weapon);
  182.  
  183. if (compatible === null) {
  184. return 0;
  185. }
  186.  
  187. return this._cnvBuster( passive, weapon, compatible.getCriticalAvoid() );
  188. // return compatible.getCriticalAvoid();
  189. };
  190.  
  191.  
  192. // バスター武器による相性値補正処理
  193. CompatibleCalculator._cnvBuster= function(passive, weapon, value) {
  194. var buster = weapon.custom.buster;
  195. var weaponPassive = ItemControl.getEquippedWeapon(passive);
  196. var passive_buster = weaponPassive.custom.buster;
  197.  
  198.  
  199. //------------------------
  200. // 相性に対する係数処理
  201. //------------------------
  202. var coefficient = 1; // 通常は1倍
  203.  
  204. // アクティブ側武器のカスパラにcoefficientがあり、1より大きいなら変数coefficientにセット
  205. if( typeof weapon.custom.coefficient === 'number' && coefficient < weapon.custom.coefficient ) {
  206. coefficient = weapon.custom.coefficient;
  207. }
  208.  
  209. // パッシブ側武器のカスパラにcoefficientがあり、変数coefficientの値より大きいなら変数coefficientにセット
  210. if( typeof weaponPassive.custom.coefficient === 'number' && coefficient < weaponPassive.custom.coefficient ) {
  211. coefficient = weaponPassive.custom.coefficient;
  212. }
  213.  
  214. // 相性値を係数分増加(カスパラに小数点付きの値が指定された場合に備えて小数点以下を切り捨てている)
  215. value = Math.floor(coefficient * value);
  216. //------------------------
  217.  
  218.  
  219. // お互いがバスター武器でない場合、または両方がバスター武器の場合は相性値をそのまま返す
  220. if ( (buster == null && passive_buster == null) ||
  221. (buster != null && passive_buster != null) ) {
  222. return value;
  223. }
  224.  
  225. // どちらかがバスター武器の場合は、相性値にバスター系武器の係数で補正を行う
  226.  
  227. // Active側がバスター武器の場合、Active側の係数で補正を行う(係数が1.5などの場合、小数点以下は切り捨てる)
  228. if( buster != null ) {
  229. return (Math.floor(value * buster));
  230. }
  231.  
  232. // Active側が通常武器の場合、Passive側の係数で補正を行う(係数が1.5などの場合、小数点以下は切り捨てる)
  233. return (Math.floor(value * passive_buster));
  234. };
  235.  
  236.  
  237. })();
Add Comment
Please, Sign In to add comment