コード: 全て選択
(() => {
const parameters = PluginManager.parameters('AuraEffectState');
const stateIds = JSON.parse(parameters['対象ステートID']);
const maxScale = Number(parameters['最大拡大サイズ']);
const speed = Number(parameters['拡大・縮小のスピード']);
const opacity = Number(parameters['エネミー画像の不透明度']);
const color = parameters['背景画像の色相'];
const blendMode = Number(parameters['背景画像のブレンドモード']);
//override
const _Sprite_Battler_update = Sprite_Battler.prototype.update;
Sprite_Battler.prototype.update = function() {
_Sprite_Battler_update.call(this);
this.updateAuraEffect();
};
Sprite_Battler.prototype.updateAuraEffect = function() {
if (this._battler && this.isAffectedAnyState(stateIds)) {
if (!this._auraeffectSprite) {
this._auraeffectSprite = new Sprite(this.bitmap);
this._auraeffectSprite.blendMode = blendMode;
this._auraeffectSprite.opacity = opacity;
this._auraeffectSprite.tint = color;
this.addChild(this._auraeffectSprite);
this._auraeffectSprite.z = -1;
this._scaleDirection = 1;
}
this._auraeffectSprite.scale.x += speed * this._scaleDirection;
this._auraeffectSprite.scale.y += speed * this._scaleDirection;
if (this._auraeffectSprite.scale.x >= maxScale || this._auraeffectSprite.scale.x <= 1) {
this._scaleDirection *= -1;
}
this._auraeffectSprite.x = -this.bitmap.width / 2 - this.bitmap.width * ((this._auraeffectSprite.scale.x - 1) / 2);//位置調整…要修正
this._auraeffectSprite.y = -this.bitmap.height - this.bitmap.height * ((this._auraeffectSprite.scale.y - 1) / 2);//位置調整…要修正
} else if (this._auraeffectSprite) {
this.removeChild(this._auraeffectSprite);
this._auraeffectSprite = null;
}
};
Sprite_Battler.prototype.isAffectedAnyState = function(stateIds) {
return stateIds.some(stateId => this._battler.isStateAffected(Number(stateId)));
};
})();
おそらくクラスの親子関係が原因と推定しているのですが、あいにく戦闘シーンの構造がよくわかっていないため、どのように修正すべきか手も足も出せない状態にあります。
どなたかお力を貸していただけると幸いです。
備考として、類似プラグインにMOG_AuraEffectが既に存在しますが、下記の問題があるため利用していません。
①ステートに応じて表示の可否を設定できない。
②利用クラス(Spriteset_Battle)が他のプラグイン(例えば、TMBattleEx・BattleMist等-Sprite_Enemyを利用するもの)と競合を起こす。