349 lines
No EOL
14 KiB
JavaScript
349 lines
No EOL
14 KiB
JavaScript
//=============================================================================
|
|
// MW_BattleLogIcon
|
|
//=============================================================================
|
|
/*:
|
|
* @plugindesc バトルログにアイコンを追加するプラグイン
|
|
* @author 銀河
|
|
* @help
|
|
* バトルログにアイコンを追加するプラグインです。
|
|
*
|
|
* @param HelpHypno
|
|
* @type text
|
|
* @desc 忘却催眠時にヘルプ文に表示する文字列
|
|
* @default 催眠の効果によってスキルの詳細が分からなくなってしまっている!
|
|
*
|
|
*/
|
|
|
|
(function() {
|
|
var MW_BattleLogIcon = { params: PluginManager.parameters('MW_BattleLogIcon') };
|
|
MW_BattleLogIcon.HelpHypno = MW_BattleLogIcon.params['HelpHypno'];
|
|
|
|
var _Window_SkillList_prototype_drawItem = Window_SkillList.prototype.drawItem;
|
|
Window_SkillList.prototype.drawItem = function(index) {
|
|
var skill = this._data[index];
|
|
if (skill) {
|
|
var costWidth = this.costWidth();
|
|
var rect = this.itemRect(index);
|
|
rect.width -= this.textPadding();
|
|
this.changePaintOpacity(this.isEnabled(skill));
|
|
if(skill.iconIndex != 878){
|
|
skill.orginalName = skill.name;
|
|
skill.orginalIconIndex = skill.iconIndex;
|
|
skill.orginalDescription = skill.description;
|
|
}
|
|
if($gameActors.actor(1).isStateAffected(24) && skill.stypeId!=3){
|
|
var count = skill.name.length
|
|
skill.name = ""
|
|
for(var i= 0;i<count;i++){
|
|
skill.name += "?"
|
|
}
|
|
skill.iconIndex = 878;
|
|
skill.description = MW_BattleLogIcon.HelpHypno;
|
|
}else{
|
|
skill.name = skill.orginalName;
|
|
skill.iconIndex = skill.orginalIconIndex;
|
|
skill.description = skill.orginalDescription;
|
|
}
|
|
this.drawItemName(skill, rect.x, rect.y, rect.width - costWidth);
|
|
this.drawSkillCost(skill, rect.x, rect.y, rect.width);
|
|
this.changePaintOpacity(1);
|
|
}
|
|
};
|
|
|
|
var _Window_SkillList_prototype_updateHelp = Window_SkillList.prototype.updateHelp;
|
|
Window_SkillList.prototype.updateHelp = function() {
|
|
if($gameActors.actor(1).isStateAffected(24) && !!this.item() && this.item().stypeId!=3){
|
|
this._helpWindow.setText(MW_BattleLogIcon.HelpHypno);
|
|
}else{
|
|
this.setHelpWindowItem(this.item());
|
|
}
|
|
};
|
|
|
|
|
|
var _Window_BattleLog_prototype_displayAction = Window_BattleLog.prototype.displayAction;
|
|
Window_BattleLog.prototype.displayAction = function(subject, item) {
|
|
var numMethods = this._methods.length;
|
|
if (DataManager.isSkill(item)) {
|
|
if (item.message1) {
|
|
iconNum = Make_Icon_text(item.battleDisplayIcon);
|
|
var log = item.message1.format(item.name);
|
|
|
|
if(subject.constructor === Game_Actor){
|
|
var target = BattleManager._targets[0]._enemyId;
|
|
if($dataEnemies[target] != undefined){
|
|
var EnemyName = $dataEnemies[target].name
|
|
this.push('addText',iconNum + subject.name() + log.replace(/\[EnemyName\]/g, EnemyName));
|
|
}else{
|
|
this.push('addText',iconNum + subject.name() + item.message1.format(item.name)); //エラー回避
|
|
}
|
|
}else{
|
|
this.push('addText',iconNum + subject.name() + item.message1.format(item.name)); //エラー回避
|
|
}
|
|
}
|
|
if (item.message2) {
|
|
this.push('addText', item.message2.format(item.name));
|
|
}
|
|
} else {
|
|
iconNum = Make_Icon_text(item.battleDisplayIcon); //戦闘で使用したアイテムのアイコン
|
|
this.push('addText', iconNum + TextManager.useItem.format(subject.name(), item.name));
|
|
}
|
|
if (this._methods.length === numMethods) {
|
|
this.push('wait');
|
|
}
|
|
};
|
|
|
|
var _Window_BattleLog_prototype_displayHpDamage = Window_BattleLog.prototype.displayHpDamage;
|
|
Window_BattleLog.prototype.displayHpDamage = function(target) {
|
|
if (target.result().hpAffected) {
|
|
var drainRate = 50;
|
|
iconNum = Make_Icon_text(1023); //1023=実行結果アイコン
|
|
iconNumHeal = Make_Icon_text(2449);
|
|
if (target.result().hpDamage > 0) {
|
|
if(!target.result().drain){
|
|
this.push('performDamage', target);
|
|
this.push('addText', iconNum + this.makeHpDamageText(target));
|
|
}else{
|
|
target._result.drain = false
|
|
this.push('performDamage', target);
|
|
this.push('addText', iconNum + this.makeHpDamageText(target));
|
|
target._result.drain = true
|
|
target._result.hpDamage = Math.floor(target._result.hpDamage * ( drainRate / 100));
|
|
this.push('performDamage', target);
|
|
this.push('addText', iconNumHeal + "\\C[1]" + this.makeHpDamageText(target));
|
|
}
|
|
}else if (target.result().hpDamage < 0) {
|
|
this.push('performRecovery', target);
|
|
this.push('addText', iconNum + this.makeHpDamageText(target));
|
|
}else{
|
|
this.push('performDamage', target);
|
|
this.push('addText', iconNum + "\\C[7]" + this.makeHpDamageText(target));
|
|
}
|
|
}
|
|
};
|
|
|
|
var _Window_BattleLog_prototype_displayMpDamage = Window_BattleLog.prototype.displayMpDamage;
|
|
Window_BattleLog.prototype.displayMpDamage = function(target) {
|
|
if (target.isAlive() && target.result().mpDamage !== 0) {
|
|
iconNum = Make_Icon_text(1023); //1023=実行結果アイコン
|
|
if (target.result().mpDamage < 0) {
|
|
this.push('performRecovery', target);
|
|
}
|
|
this.push('addText', iconNum + this.makeMpDamageText(target));
|
|
}
|
|
};
|
|
|
|
var Window_BattleLog_prototype_displayMiss=Window_BattleLog.prototype.displayMiss;
|
|
Window_BattleLog.prototype.displayMiss = function(target) {
|
|
var fmt;
|
|
if (target.result().physical) {
|
|
fmt = target.isActor() ? TextManager.actorNoHit : TextManager.enemyNoHit;
|
|
this.push('performMiss', target);
|
|
} else {
|
|
fmt = TextManager.actionFailure;
|
|
}
|
|
iconNum = Make_Icon_text(2475); //2475=回避アイコン
|
|
this.push('addText', "\\C[7]" + iconNum + fmt.format(target.name()) + "\\C[0]");
|
|
};
|
|
|
|
var Window_BattleLog_prototype_displayEvasion=Window_BattleLog.prototype.displayEvasion;
|
|
Window_BattleLog.prototype.displayEvasion = function(target) {
|
|
var fmt;
|
|
if (target.result().physical) {
|
|
fmt = TextManager.evasion;
|
|
this.push('performEvasion', target);
|
|
} else {
|
|
fmt = TextManager.magicEvasion;
|
|
this.push('performMagicEvasion', target);
|
|
}
|
|
iconNum = Make_Icon_text(2475); //2475=回避アイコン
|
|
this.push('addText',"\\C[7]" + iconNum + fmt.format(target.name()) + "\\C[0]");
|
|
};
|
|
|
|
var Window_BattleLog_prototype_displayFailure=Window_BattleLog.prototype.displayFailure;
|
|
Window_BattleLog.prototype.displayFailure = function(target) {
|
|
if (target.result().isHit() && !target.result().success) {
|
|
var action = BattleManager._subject ? BattleManager._subject._lastAction : null;
|
|
if (action && action._appliedStates && action._appliedStates.length > 0) {
|
|
console.log("付与しようとしていたステートID:", action._appliedStates);
|
|
|
|
// 耐性を持っていないステートがあるか確認
|
|
var hasValidState = action._appliedStates.some(stateId => !target.isStateResist(stateId));
|
|
|
|
if (hasValidState) {
|
|
this.push('addText', "\\I[1023]\\C[7]" + TextManager.actionFailure.format(target.name()));
|
|
}
|
|
}
|
|
$gameTemp.reserveCommonEvent(144);
|
|
}
|
|
};
|
|
|
|
// 付与しようとしたステートを記録
|
|
var _Game_Action_itemEffectAddState = Game_Action.prototype.itemEffectAddState;
|
|
Game_Action.prototype.itemEffectAddState = function(target, effect) {
|
|
if (!this._appliedStates) this._appliedStates = [];
|
|
this._appliedStates.push(effect.dataId);
|
|
// 元の処理を呼び出す
|
|
_Game_Action_itemEffectAddState.call(this, target, effect);
|
|
};
|
|
|
|
var _BattleManager_startAction = BattleManager.startAction;
|
|
BattleManager.startAction = function() {
|
|
if (this._subject) {
|
|
this._subject._lastAction = this._subject.currentAction();
|
|
}
|
|
_BattleManager_startAction.call(this);
|
|
};
|
|
|
|
var Window_BattleLog_prototype_displayAddedStates=Window_BattleLog.prototype.displayAddedStates;
|
|
Window_BattleLog.prototype.displayAddedStates = function(target) {
|
|
target.result().addedStateObjects().forEach(function(state) {
|
|
var stateMsg = target.isActor() ? state.message1 : state.message2;
|
|
if (state.id === target.deathStateId()) {
|
|
this.push('performCollapse', target);
|
|
}
|
|
if (stateMsg) {
|
|
this.push('popBaseLine');
|
|
this.push('pushBaseLine');
|
|
this.push('addText', "\\I[1023]\\C[31]" + target.name() + stateMsg);
|
|
this.push('waitForEffect');
|
|
$gameTemp.reserveCommonEvent(144);
|
|
}
|
|
}, this);
|
|
};
|
|
|
|
var Window_BattleLog_prototype_displayBuffs = Window_BattleLog.prototype.displayBuffs;
|
|
Window_BattleLog.prototype.displayBuffs = function(target, buffs, fmt,iconId) {
|
|
buffs.forEach(function(paramId) {
|
|
this.push('popBaseLine');
|
|
this.push('pushBaseLine');
|
|
var id = 2480 + paramId + iconId;
|
|
if(iconId==2454)id = 2454
|
|
iconNum = Make_Icon_text(id); //2480=デバフアイコン
|
|
this.push('addText', fmt.format(iconNum + target.name(), TextManager.param(paramId)));
|
|
}, this);
|
|
};
|
|
|
|
var Window_BattleLog_prototype_displayCritical = Window_BattleLog.prototype.displayCritical;
|
|
Window_BattleLog.prototype.displayCritical = function(target) {
|
|
if (target.result().critical) {
|
|
if (target.isActor()) {
|
|
this.push('addText', "\\I[2527]\\C[18]" + TextManager.criticalToActor + "\\C[0]");
|
|
} else {
|
|
this.push('addText', "\\I[2526]\\C[18]" + TextManager.criticalToEnemy + "\\C[0]");
|
|
}
|
|
}
|
|
};
|
|
|
|
Game_BattlerBase.prototype.mostImportantStateIcon = function() {
|
|
var states = this.states();
|
|
for (var i = 0; i < states.length; i++) {
|
|
if (states[i]) {
|
|
return states[i].iconIndex;
|
|
}
|
|
}
|
|
return '';
|
|
};
|
|
|
|
var Window_BattleLog_prototype_displayCurrentState = Window_BattleLog.prototype.displayCurrentState;
|
|
Window_BattleLog.prototype.displayCurrentState = function(subject) {
|
|
var stateText = subject.mostImportantStateText();
|
|
var stateIcon = subject.mostImportantStateIcon();
|
|
if (stateText) {
|
|
if(stateIcon >=1){
|
|
if(stateIcon == 2584){
|
|
this.push('addText',"\\C[27]\\I[" + stateIcon + "]" + subject.name() + stateText);
|
|
}else{
|
|
this.push('addText',"\\I[" + stateIcon + "]" + subject.name() + stateText);
|
|
}
|
|
}else{
|
|
this.push('addText',subject.name() + stateText);
|
|
}
|
|
this.push('wait');
|
|
this.push('clear');
|
|
}
|
|
};
|
|
|
|
var Window_BattleLog_prototype_displayRemovedStates = Window_BattleLog.prototype.displayRemovedStates;
|
|
Window_BattleLog.prototype.displayRemovedStates = function(target) {
|
|
target.result().removedStateObjects().forEach(function(state) {
|
|
if (state.message4) {
|
|
var iconId = state.iconIndex;
|
|
this.push('popBaseLine');
|
|
this.push('pushBaseLine');
|
|
this.push('addText', "\\I[" + iconId + "]\\C[1]" + target.name() + state.message4);
|
|
$gameTemp.reserveCommonEvent(144);
|
|
}
|
|
}, this);
|
|
};
|
|
|
|
//アイテムやスキルの番号:バトルログで表示する番号
|
|
|
|
Make_Icon_text = function(num){
|
|
const smallIcons = {
|
|
/* スキル・特技 */
|
|
1098:2530,//様子を見る
|
|
1048:2502,//ダークオーラ系統
|
|
909:908,//魅惑の瞳
|
|
895:2505,//マナボルト系統
|
|
651:2506,//シェイド系統
|
|
436:2507,//ダークヒール系統
|
|
526:2568,//バックスタブ
|
|
510:2569,//被虐の血槍
|
|
786:2576,//微睡みの瞳
|
|
817:922,//心頭滅却
|
|
936:2577,//ダブルアタック
|
|
1052:2503,//潜影
|
|
1012:2508,//クイックアタック
|
|
1053:2504,//フェイタルスピア
|
|
1049:2509,//スイープショット
|
|
1050:2510,//トリプルラッシュ
|
|
1051:2575,//誘惑の瞳
|
|
1054:905,//色仕掛け
|
|
2624:2567,//疾風刃
|
|
2625:2570,//旋風乱舞
|
|
1041:2571,//サキュバスフィナーレ
|
|
2626:2572,//思考読み
|
|
2628:2573,//ファントムスピア
|
|
2629:2574,//バックスタブ
|
|
|
|
/* 勝利者スキル */
|
|
952:2609,//ウォークライ
|
|
|
|
/* 必殺技 */
|
|
2630:2578,//チャームショック
|
|
2631:2579,//ドレインタッチ
|
|
2632:2580,//インビジブル
|
|
2633:2581,//エビルショット
|
|
2634:2582,//デモンズ・スラスト
|
|
|
|
/* 獲得スキル */
|
|
1198:2547,//自己催眠
|
|
1199:2548,//弱体催眠
|
|
|
|
/* 戦闘用アイテム(通常) */
|
|
64:80,65:81,66:82,67:83,68:84,69:85,70:86,71:87,72:88,73:89,74:90,75:91,76:92,77:93,78:94,79:95,
|
|
|
|
/* 戦闘用アイテム(露天商) */
|
|
176:192,177:193,178:194,
|
|
|
|
/* 戦闘用アイテム(パン) */
|
|
128:144,129:145,130:146,131:147,132:148,133:149,134:150,135:151,136:152,137:153,138:154,139:155,140:156,141:157,142:158,143:159,140:156,
|
|
|
|
/* 戦闘用アイテム(保田区くん) */
|
|
2352:2690,2353:2689,2354:2690,2355:2691,2356:2692,2357:2693,2358:2694,2359:2695,2360:2696,2361:2697,
|
|
2362:2698,2363:2699,2364:2700,2365:2701,2366:2702,2367:2703,2368:2704,2369:2705,2370:2706,2371:2707,
|
|
2372:2708,2373:2709,2374:2710,
|
|
|
|
/* 戦闘用アイテム(コンビニ) */
|
|
1236:2549,1237:2550,1238:2551,1239:2552,1240:2553,1241:2554,1242:2555,1243:2556,1244:2557,1245:2623,
|
|
|
|
/* 戦闘用アイテム(イベント系) */
|
|
2376:2711//結奈の聖水
|
|
};
|
|
if(num in smallIcons){
|
|
return "\\I[" + smallIcons[num] + "]";
|
|
}else{
|
|
return "\\I[" + num + "]";
|
|
}
|
|
}
|
|
})(); |