Modify Substitute Chcek Logical

修改掩护的逻辑:下面条件同时满足时,才触发掩护
- 对面的行动(以行动来源为准)
- 非必中的行动
- 存在伤害类型的技能或物品
- 目标为血量和护盾的和最低的成员

未测试
main
xian18 2 years ago
parent bfd821572a
commit 0c47602ee6
Signed by: SaltedFish
GPG Key ID: B0C26448E9EF40CA

@ -25,24 +25,24 @@ var SF_Plugins = SF_Plugins || {};
//============================================================================= //=============================================================================
ImageManager.loadSceneActor = function (filename) { ImageManager.loadSceneActor = function (filename) {
return this.loadBitmap('img/scene_ui/scene_actor/', filename, 0, true); return this.loadBitmap("img/scene_ui/scene_actor/", filename, 0, true);
}; };
ImageManager.loadSceneActorSelect = function (filename) { ImageManager.loadSceneActorSelect = function (filename) {
return this.loadBitmap('img/scene_ui/scene_actor_select/', filename, 0, true); return this.loadBitmap("img/scene_ui/scene_actor_select/", filename, 0, true);
} };
ImageManager.loadSceneTitle = function (filename) { ImageManager.loadSceneTitle = function (filename) {
return this.loadBitmap("img/scene_ui/scene_title/", filename, 0, true); return this.loadBitmap("img/scene_ui/scene_title/", filename, 0, true);
} };
ImageManager.loadSceneMenu = function (filename) { ImageManager.loadSceneMenu = function (filename) {
return this.loadBitmap('img/scene_ui/scene_menu/', filename, 0, true); return this.loadBitmap("img/scene_ui/scene_menu/", filename, 0, true);
}; };
ImageManager.loadSceneSplash = function (filename) { ImageManager.loadSceneSplash = function (filename) {
return this.loadBitmap('img/scene_ui/scene_splash/', filename, 0, true); return this.loadBitmap("img/scene_ui/scene_splash/", filename, 0, true);
} };
//============================================================================= //=============================================================================
// SceneManager // SceneManager
@ -62,7 +62,8 @@ var SF_Plugins = SF_Plugins || {};
if (this._sceneBeforeClasses[sceneClass]) { if (this._sceneBeforeClasses[sceneClass]) {
var beforeSceneList = this._sceneBeforeClasses[sceneClass]; var beforeSceneList = this._sceneBeforeClasses[sceneClass];
var index = beforeSceneList.indexOf(this._scene.constructor); var index = beforeSceneList.indexOf(this._scene.constructor);
if (index == -1) { // if the scene is not in the array if (index == -1) {
// if the scene is not in the array
this._stack.push(sceneClass); this._stack.push(sceneClass);
SF_Managers.SceneManager_goto.call(this, beforeSceneList[0]); SF_Managers.SceneManager_goto.call(this, beforeSceneList[0]);
} else if (index === beforeSceneList.length - 1) { } else if (index === beforeSceneList.length - 1) {
@ -74,7 +75,7 @@ var SF_Plugins = SF_Plugins || {};
} else { } else {
SF_Managers.SceneManager_goto.call(this, sceneClass); SF_Managers.SceneManager_goto.call(this, sceneClass);
} }
} };
SceneManager.addSceneBefore = function (beforeSceneClass, sceneClass) { SceneManager.addSceneBefore = function (beforeSceneClass, sceneClass) {
if (this._sceneBeforeClasses[sceneClass]) { if (this._sceneBeforeClasses[sceneClass]) {
@ -82,10 +83,48 @@ var SF_Plugins = SF_Plugins || {};
} else { } else {
this._sceneBeforeClasses[sceneClass] = [beforeSceneClass]; this._sceneBeforeClasses[sceneClass] = [beforeSceneClass];
} }
} };
SceneManager.initCallBack = function () { SceneManager.initCallBack = function () {
CallBack.initialize(); CallBack.initialize();
};
//=============================================================================
// BattleManager
//=============================================================================
BattleManager.invokeNormalAction = function (subject, target) {
var realTarget = this.applySubstitute(target, subject);
this._action.apply(realTarget);
this._logWindow.displayActionResults(subject, realTarget);
};
BattleManager.applySubstitute = function (target, subject) {
if (this.checkSubstitute(target, subject)) {
var substitute = target.friendsUnit().substituteBattler();
if (substitute && target !== substitute) {
this._logWindow.displaySubstitute(substitute, target);
return substitute;
}
} }
return target;
};
SF_Managers.BattleManager_checkSubstitute = BattleManager.checkSubstitute;
BattleManager.checkSubstitute = function (target, subject) {
if (!subject && !this._action.isForOpponent()) return false;
if (subject && target.friendsUnit() === subject.friendsUnit()) return false;
if (!(this._action.isHpEffect() || this._action.isMpEffect())) return false;
if (this._action.isCertainHit()) return false;
// 只有 hp 和 bp 最低的对象才能触发替身
var targetHpBp = target.hp + target.barrierPoints();
var lowestMember = target
.friendsUnit()
.members()
.reduce(function (a, b) {
var bHpBp = b.hp + b.barrierPoints();
return a && a.hp + a.barrierPoints() < bHpBp ? a : b;
}, target);
return targetHpBp === lowestMember.hp + lowestMember.barrierPoints();
};
})(); })();
Loading…
Cancel
Save