//=============================================================================
// SkillMimic.js
//=============================================================================
var Imported = Imported || {};
Imported.Kanna_SkillMimic = true;
var Kanna = Kanna || {};
Kanna.SM = Kanna.SM || {};
/*:
* @plugindesc 复制目标怪物使用过的上一个技能。
* @author alexncf125
*
* @help 在技能的备注栏写上:
* <SKILL MIMIC>
*
* 对目标怪物使用该技能后,
* 会习得该怪物使用过的上一个技能。
*
* 注:习得的技能不会在战斗结束后消失。
*/
(function() {
Kanna.SM.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
if (!Kanna.SM.DataManager_isDatabaseLoaded.call(this)) return false;
if (!Kanna._loaded_SkillMimic) {
this.processSkillMimicNotetags($dataSkills);
Kanna._loaded_SkillMimic = true;
};
return true;
};
DataManager.processSkillMimicNotetags = function(group) {
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj._isSkillMimic = false;
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(/<(?:SKILL MIMIC)>/i)) {
obj._isSkillMimic = true;
};
};
};
};
Kanna.SM.BattleManager_invokeAction = BattleManager.invokeAction;
BattleManager.invokeAction = function(subject, target) {
Kanna.SM.BattleManager_invokeAction.call(this, subject, target);
subject.setSkillMimicId(this._action);
};
var _Game_Action_applyItemUserEffect = Game_Action.prototype.applyItemUserEffect;
Game_Action.prototype.applyItemUserEffect = function(target) {
_Game_Action_applyItemUserEffect.call(this, target);
if (this.item()._isSkillMimic && target._idSkillMimic > 0) {
if (this.subject().isActor() && !this.subject().isLearnedSkill(target._idSkillMimic)) {
this.subject().learnSkill(target._idSkillMimic);
this.makeSuccess(this.subject());
};
};
};
var _Game_Battler_initMembers = Game_Battler.prototype.initMembers;
Game_Battler.prototype.initMembers = function() {
_Game_Battler_initMembers.call(this);
this._idSkillMimic = 0;
};
Game_Battler.prototype.setSkillMimicId = function(action) {
if (action.isSkill()) {
this._idSkillMimic = action.item().id;
};
};
})();