enicia-contract-mark/js/plugins/InitialState.js

84 lines
3.3 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//=============================================================================
// InitialState.js
// ----------------------------------------------------------------------------
// (C)2017 Triacontane
// This software is released under the MIT License.
// http://opensource.org/licenses/mit-license.php
// ----------------------------------------------------------------------------
// Version
// 1.2.0 2022/01/07 MZで動作するよう修正
// 1.1.0 2018/07/08 複数の初期ステートを設定できる機能を追加
// 1.0.1 2017/02/07 端末依存の記述を削除
// 1.0.0 2017/01/12 初版
// ----------------------------------------------------------------------------
// [Blog] : https://triacontane.blogspot.jp/
// [Twitter]: https://twitter.com/triacontane/
// [GitHub] : https://github.com/triacontane/
//=============================================================================
/*:
* @plugindesc 初期ステートプラグイン
* @target MZ
* @url https://github.com/triacontane/RPGMakerMV/tree/mz_master/InitialState.js
* @base PluginCommonBase
* @orderAfter PluginCommonBase
* @author トリアコンタン
*
* @help InitialState.js
*
* 敵キャラに初期状態でステートを付与します。
* 敵キャラのメモ欄に以下の通り記述してください。
*
* <初期ステート:3> # 戦闘開始時にステートID[3]が自動で付与されます。
* <InitialState:3> # 同上
*
* 複数のステートを設定したい場合は、カンマ区切りでIDを指定してください。
* 例:<InitialState:3,4,5>
*
* このプラグインにはプラグインコマンドはありません。
*
* 利用規約:
* 作者に無断で改変、再配布が可能で、利用形態商用、18禁利用等
* についても制限はありません。
* このプラグインはもうあなたのものです。
*/
(() => {
'use strict';
const _Game_Enemy_setup = Game_Enemy.prototype.setup;
Game_Enemy.prototype.setup = function (enemyId, x, y) {
_Game_Enemy_setup.apply(this, arguments);
this.setupInitialState();
};
Game_Enemy.prototype.setupInitialState = function () {
const race = PluginManagerEx.findMetaValue(this.enemy(), ['種族', 'race']);
if (race) {
let raceStateId = SH_raceStateId(race)
String(raceStateId).split(',').forEach(state => this.addState(parseInt(state)));
}
//強制戦闘マスでのみボスステート配布
const boss = PluginManagerEx.findMetaValue(this.enemy(), ['ボス', 'boss']);
if (boss && $gameSwitches.value(922)) {
let BossStateId = 422
String(BossStateId).split(',').forEach(state => this.addState(parseInt(state)));
}
const strong = PluginManagerEx.findMetaValue(this.enemy(), ['強敵', 'strong']);
if (strong && $gameSwitches.value(922)) {
let BossStateId = 421
String(BossStateId).split(',').forEach(state => this.addState(parseInt(state)));
}
const stateList = PluginManagerEx.findMetaValue(this.enemy(), ['初期ステート', 'InitialState']);
if (!stateList) {
return;
}
String(stateList).split(',').forEach(state => this.addState(parseInt(state)));
};
})();