Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*--------------------------------------------------------------------------
- //--------------------------------------------------------
- // バスター系武器をカスタムで作れるスクリプト改
- // 相性強化武器もカスタムで作れます
- //
- // ※バスター系同士をぶつけた場合、本来の相性が適用されます
- // (例)自分:ランスバスター(剣)、相手:ソードバスター(斧)の場合、
- // 普通に剣と斧の相性を比較します
- // (改じゃない方のスクリプトではソードバスターが有利になります)
- //--------------------------------------------------------
- ■概要
- 【バスター系武器】
- 武器のカスタムパラメータに {buster:1} を入れると、相性をひっくり返します。
- ひっくり返し方は以下の感じ(槍が剣に有利な場合)
- 普通の剣:修正なし 槍:修正値
- 槍バス :槍の修正値※ 槍:修正なし
- ※ようは槍バスの場合、槍が有利になる場合の修正値を槍バスがひったくって使うということ。
- ちなみに、{buster:2} にすると、槍バスの修正値は槍の修正値*2になります(数値がそのまま係数になってます)
- (未検証ですが、槍は剣と弓に有利などと複数の相性がついてる場合は全部ひっくり返る筈)
- 【相性強化系武器】
- 武器のカスタムパラメータに {coefficient:2}を入れると、相性の修正値を2倍します(3だと3倍になります)
- (なお、coefficientに1以下の数字を入れた場合、無視されます)
- 相性の修正値は、アクティブ側とパッシブ側の武器のうちより大きい係数が採用されます。
- (例.アクティブ側が{coefficient:2}、パッシブ側が通常武器の場合、アクティブ側の係数の方が大きい為係数は2倍として計算されます)
- 【注意事項】
- バスター系武器({buster:?}をつけた武器)に相性強化({coefficient:?})はつけないでください。
- 武器の相性を2倍する武器は{coefficient:2}をつけるようにし、
- ソードキラーのように武器の相性を反転して2倍する武器には{buster:2}をつけるようにしてください。
- 相性強化の係数とバスター系の係数は別々に乗算して計算されるので、係数がとんでもない事になります。
- ({buster:2}と{coefficient:2}を同時につけた武器は係数が4倍(2*2)、{buster:5}と{coefficient:5}を同時につけた武器は係数が25倍(5*5)になります)
- 修正内容
- 16/12/22 新規作成
- ■対応バージョン
- SRPG Studio Version:1.108
- ■規約
- ・利用はSRPG Studioを使ったゲームに限ります。
- ・商用・非商用問いません。フリーです。
- ・加工等、問題ありません。どんどん改造してください。
- ・クレジット明記無し OK
- ・再配布、転載 OK
- ・SRPG Studio利用規約は遵守してください。
- --------------------------------------------------------------------------*/
- (function() {
- //--------------------------------------
- // CompatibleCalculatorクラス
- //--------------------------------------
- CompatibleCalculator._getCompatible= function(active, passive, weapon) {
- var i, count, compatible, weaponTypeActive, weaponTypePassive;
- var weaponPassive = ItemControl.getEquippedWeapon(passive);
- if (weaponPassive === null || weapon === null) {
- return null;
- }
- var active_buster = weapon.custom.buster;
- var passive_buster = weaponPassive.custom.buster;
- weaponTypeActive = weapon.getWeaponType();
- weaponTypePassive = weaponPassive.getWeaponType();
- // アクティブ側が相性が良い武器かのチェック
- count = weaponTypeActive.getCompatibleCount();
- for (i = 0; i < count; i++) {
- compatible = weaponTypeActive.getCompatibleData(i);
- if (compatible.getSrcObject() === weaponTypePassive) {
- // お互いがバスター武器でないor両方がバスター、の場合のみ相性が発生する
- if ( (active_buster == null && passive_buster == null) || (active_buster != null && passive_buster != null) ) {
- return compatible.getSupportStatus();
- }
- break;
- }
- }
- // パッシブ側が相性が良い武器かのチェック
- var compatible_passive;
- count = weaponTypePassive.getCompatibleCount();
- for (i = 0; i < count; i++) {
- compatible_passive = weaponTypePassive.getCompatibleData(i);
- if (compatible_passive.getSrcObject() === weaponTypeActive) {
- // 『お互いがバスター武器でないor両方がバスター』以外のケースで相性が発生する
- if ( !((active_buster == null && passive_buster == null) || (active_buster != null && passive_buster != null)) ) {
- return compatible.getSupportStatus(); // 返す相性値はアクティブ側の値
- // return compatible_passive.getSupportStatus();
- }
- break;
- }
- }
- return null;
- };
- // バスター武器による相性値(力)の補正(補正不要の場合、本関数をコメントアウトしてください)
- CompatibleCalculator.getPower= function(active, passive, weapon) {
- var compatible = this._getCompatible(active, passive, weapon);
- if (compatible === null) {
- return 0;
- }
- return this._cnvBuster( passive, weapon, compatible.getPower() );
- // return compatible.getPower();
- };
- // バスター武器による相性値(守)の補正(補正不要の場合、本関数をコメントアウトしてください)
- CompatibleCalculator.getDefense= function(active, passive, weapon) {
- var compatible = this._getCompatible(active, passive, weapon);
- if (compatible === null) {
- return 0;
- }
- return this._cnvBuster( passive, weapon, compatible.getDefense() );
- // return compatible.getDefense();
- };
- // バスター武器による相性値(命中)の補正(補正不要の場合、本関数をコメントアウトしてください)
- CompatibleCalculator.getHit= function(active, passive, weapon) {
- var compatible = this._getCompatible(active, passive, weapon);
- if (compatible === null) {
- return 0;
- }
- return this._cnvBuster( passive, weapon, compatible.getHit() );
- // return compatible.getHit();
- };
- // バスター武器による相性値(回避)の補正(補正不要の場合、本関数をコメントアウトしてください)
- CompatibleCalculator.getAvoid= function(active, passive, weapon) {
- var compatible = this._getCompatible(active, passive, weapon);
- if (compatible === null) {
- return 0;
- }
- return this._cnvBuster( passive, weapon, compatible.getAvoid() );
- // return compatible.getAvoid();
- };
- // バスター武器による相性値(クリティカル)の補正(補正不要の場合、本関数をコメントアウトしてください)
- CompatibleCalculator.getCritical= function(active, passive, weapon) {
- var compatible = this._getCompatible(active, passive, weapon);
- if (compatible === null) {
- return 0;
- }
- return this._cnvBuster( passive, weapon, compatible.getCritical() );
- // return compatible.getCritical();
- };
- // バスター武器による相性値(クリティカル回避)の補正(補正不要の場合、本関数をコメントアウトしてください)
- CompatibleCalculator.getCriticalAvoid= function(active, passive, weapon) {
- var compatible = this._getCompatible(active, passive, weapon);
- if (compatible === null) {
- return 0;
- }
- return this._cnvBuster( passive, weapon, compatible.getCriticalAvoid() );
- // return compatible.getCriticalAvoid();
- };
- // バスター武器による相性値補正処理
- CompatibleCalculator._cnvBuster= function(passive, weapon, value) {
- var buster = weapon.custom.buster;
- var weaponPassive = ItemControl.getEquippedWeapon(passive);
- var passive_buster = weaponPassive.custom.buster;
- //------------------------
- // 相性に対する係数処理
- //------------------------
- var coefficient = 1; // 通常は1倍
- // アクティブ側武器のカスパラにcoefficientがあり、1より大きいなら変数coefficientにセット
- if( typeof weapon.custom.coefficient === 'number' && coefficient < weapon.custom.coefficient ) {
- coefficient = weapon.custom.coefficient;
- }
- // パッシブ側武器のカスパラにcoefficientがあり、変数coefficientの値より大きいなら変数coefficientにセット
- if( typeof weaponPassive.custom.coefficient === 'number' && coefficient < weaponPassive.custom.coefficient ) {
- coefficient = weaponPassive.custom.coefficient;
- }
- // 相性値を係数分増加(カスパラに小数点付きの値が指定された場合に備えて小数点以下を切り捨てている)
- value = Math.floor(coefficient * value);
- //------------------------
- // お互いがバスター武器でない場合、または両方がバスター武器の場合は相性値をそのまま返す
- if ( (buster == null && passive_buster == null) ||
- (buster != null && passive_buster != null) ) {
- return value;
- }
- // どちらかがバスター武器の場合は、相性値にバスター系武器の係数で補正を行う
- // Active側がバスター武器の場合、Active側の係数で補正を行う(係数が1.5などの場合、小数点以下は切り捨てる)
- if( buster != null ) {
- return (Math.floor(value * buster));
- }
- // Active側が通常武器の場合、Passive側の係数で補正を行う(係数が1.5などの場合、小数点以下は切り捨てる)
- return (Math.floor(value * passive_buster));
- };
- })();
Add Comment
Please, Sign In to add comment