67 lines
No EOL
2.2 KiB
JavaScript
67 lines
No EOL
2.2 KiB
JavaScript
//=============================================================================
|
||
// RPG Maker MZ - HitCounterActor1.js
|
||
//=============================================================================
|
||
|
||
/*:
|
||
* @target MZ
|
||
* @Counting atack hits by Acotr1
|
||
* @author UM
|
||
*
|
||
* @help I don't well English sory
|
||
*
|
||
* This plugin has no plugin command
|
||
*
|
||
*/
|
||
|
||
/*:ja
|
||
* @target MZ
|
||
* @plugindesc アクター1の攻撃回数をカウントする
|
||
* @author 温州みかん
|
||
*
|
||
* @help
|
||
* このプラグインにプラグインコマンドはありません
|
||
*
|
||
* ゲーム内スイッチ248がオンの時ヒット回数を数えます
|
||
* ヒット回数はゲーム内変数248に反映されます
|
||
*/
|
||
|
||
|
||
(() => {
|
||
'use strict';
|
||
const pluginName = "HitCounterActor1";
|
||
|
||
|
||
const _Game_Action_apply = Game_Action.prototype.apply;
|
||
Game_Action.prototype.apply = function(target){
|
||
_Game_Action_apply.apply(this, arguments);
|
||
const subject = this.subject();
|
||
const result = target.result();
|
||
if(subject.isActor() && target.isEnemy()){
|
||
if(subject.actorId() === 1){
|
||
|
||
if($gameSwitches.value(248)){
|
||
$gameVariables.setValue(248,$gameVariables.value(248)+1)
|
||
}
|
||
else if ($gameSwitches.value(261)) {
|
||
if (target === $gameTroop.members()[1]) {
|
||
$gameVariables.setValue(248, $gameVariables.value(248) + 1)
|
||
}
|
||
}
|
||
}
|
||
else if (subject.actorId() === 2) {
|
||
if ($gameSwitches.value(248)) {
|
||
$gameVariables.setValue(248, $gameVariables.value(248) + 1)
|
||
}
|
||
else if ($gameSwitches.value(261)) {
|
||
if (target === $gameTroop.members()[1]) {
|
||
$gameVariables.setValue(248, $gameVariables.value(248) + 1)
|
||
}
|
||
}
|
||
}
|
||
} else if (subject.isEnemy() && target.isActor()) {
|
||
if ($gameSwitches.value(250)) {
|
||
$gameVariables.setValue(250, $gameVariables.value(250) + 1)
|
||
}
|
||
}
|
||
};
|
||
})(); |