查看: 2410|回复: 9

[已经解决] 请问口袋妖怪的四技能怎么做?SRD的插件有BUG

[复制链接]
梦石
0
星屑
230
在线时间
174 小时
注册时间
2016-2-24
回帖
83
发表于 2016-9-17 13:38:59 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
角色最多四个技能,习得新技能后如果超出四个则选择一个删除,那么问题来了
SRD_PKM_4MovesOnly这个插件其他的都正常,但是战斗经验会结算两次,这就很尴尬了,一是提示技能满的时候结算了一次,二是删除技能时又结算一次,请高手帮忙看看怎么回事?[pre lang="javascript"]/*:
* @plugindesc Pokemon Plugin: Restricts the maximum amount of skills an Actor can learn to 4.
* @author SumRndmDde
*
* @param == Forget Window ==
* @default
*
* @param Max Columns
* @desc This will be the maximum amount of columns in the Skill Forget Window's list of Skills.
* @default 1
*
* @param Spacing
* @desc This will be the spacing of the choices in the Skill Forget Window's list of Skills.
* @default 48
*
* @param Message Background
* @desc This is the message background used for Show Text alerts.
* '0' = normal, '1' = dim, '2' = none
* @default 0
*
* @param == Alert Lines ==
* @default
*
* @param Alert Line 1
* @desc The first line for the alert dialogue when an Actor has learned too many Skills. \actor = Specific Actor Name
* @default \actor has too many moves!
*
* @param Alert Line 2
* @desc The second line for the alert dialogue when an Actor has learned too many Skills. \actor = Specific Actor Name
* @default \!Please select one to remove.
*
* @param Alert Line 3
* @desc The third line for the alert dialogue when an Actor has learned too many Skills. \actor = Specific Actor Name
* @default
*
* @param Alert Line 4
* @desc The fourth line for the alert dialogue when an Actor has learned too many Skills. \actor = Specific Actor Name
* @default
*
* @param == End Lines ==
* @default
*
* @param End Line 1
* @desc The first line for the forgotten Skill dialogue.
* \actor = Actor Name       \skill = Forgoten Skill Name
* @default 1\..\..\..2\..\..\..and poof!
*
* @param End Line 2
* @desc The second line for the forgotten Skill dialogue.
* \actor = Actor Name       \skill = Forgoten Skill Name
* @default \!\actor has forgotten \skill!
*
* @param End Line 3
* @desc The third line for the forgotten Skill dialogue.
* \actor = Actor Name       \skill = Forgoten Skill Name
* @default
*
* @param End Line 4
* @desc The fourth line for the forgotten Skill dialogue.
* \actor = Actor Name       \skill = Forgoten Skill Name
* @default
*
* @help
*
*
*
* Pokemon 4 Moves Only
* Version 1.00
* SumRndmDde
*
*
* The name says it all.
* This is a Plugin that restricts the maximum amount of Skills an Actor
* can learn to 4.
*
* If the actor learns more than 4, then a screen will display, and the
* Actor must select one Skill to delete.
*
* This is based off of the system used in Pokemon.
*
* Other things you may want to note are:
*  - When initializing Actors, they're given their 4 most recent Skills
*  - This Plugin does not affect Enemies
*  - You can manipulate the dialogue surrounding the Skill deletion
*  - You can set certain Skills to be un-deleteable
*  - An Actor's most recently learned Skill can always be deleted
*
* If you wish to implement a system to delete un-deleteable Skills,
* use the extension Plugin: SRD_PKM_MoveDeleter
*
* ==========================================================================
* How to Use
* ==========================================================================
*
* This Plugin is plug-in and play for the most part.
*
* However, there are a few things you may wish to customize:
*
*
* ==========================================================================
* Parameters
* ==========================================================================
*
* You can manipulate the Parameters to change how the Skill Deletion
* choices look, along with the dialogue used to inform the Player a Skill
* must be deleted.
*
* Change "Message Background" to change the dialogue background to
* normal, dim, etc.
*
* For the "Alert Lines" and the "End Lines", each line referes to a line
* on the Show Text event that is displayed.
*
* ==========================================================================
* Skill Notetags
* ==========================================================================
*
* <Cannot Forget>
*
* If you input this Notetag into a Skill's notebox, then that Skill cannot
* be deleted during the Skill deletion process.
*
* There are two exceptions:
*  - If the Skill is the 5th Skill to be learned, then it will ALWAYS be
*    deleteable.
*  - If you use the SRD_PKM_MoveDeleter extension Plugin, then you can
*    call upon a screen to force any Actor to delete any Skill.
*
*
* ==========================================================================
*  End of Help File
* ==========================================================================
*
* Welcome to the bottom of the Help file.
*
*
* Thanks for reading!
* If you have questions, or if you enjoyed this Plugin, please check
* out my YouTube channel!
*
* https://www.youtube.com/c/SumRndmDde
*
*
* Until next time,
*   ~ SumRndmDde
*/

//Ugh, I think I'm gonna have to start actually making this
//an extendable Plugin or somethin... :/

var SRD = SRD || {};
SRD.PKM = SRD.PKM || {};
SRD.PKM.FourMovesOnly = {};

var Imported = Imported || {};
Imported.SRD_PKM_4MovesOnly = true;

SRD.PKM.FourMovesOnly.maxColumns = Number(PluginManager.parameters('SRD_PKM_4MovesOnly')['Max Columns']);
SRD.PKM.FourMovesOnly.spacing = Number(PluginManager.parameters('SRD_PKM_4MovesOnly')['Spacing']);
SRD.PKM.FourMovesOnly.background = Number(PluginManager.parameters('SRD_PKM_4MovesOnly')['Message Background']);

SRD.PKM.FourMovesOnly.alertLinesCount = 4;
SRD.PKM.FourMovesOnly.alertLines = [];
for(var i = 1; i <= SRD.PKM.FourMovesOnly.alertLinesCount; i++) {
        SRD.PKM.FourMovesOnly.alertLines[i-1] = String(PluginManager.parameters('SRD_PKM_4MovesOnly')['Alert Line ' + i]);
}

SRD.PKM.FourMovesOnly.endLinesCount = 4;
SRD.PKM.FourMovesOnly.endLines = [];
for(var i = 1; i <= SRD.PKM.FourMovesOnly.endLinesCount; i++) {
        SRD.PKM.FourMovesOnly.endLines[i-1] = String(PluginManager.parameters('SRD_PKM_4MovesOnly')['End Line ' + i]);
}

//-----------------------------------------------------------------------------
// DataManager
//-----------------------------------------------------------------------------

SRD.PKM.FourMovesOnly.areNotetagsLoaded = false;
SRD.PKM.FourMovesOnly._DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
    if(!SRD.PKM.FourMovesOnly._DataManager_isDatabaseLoaded.call(this)) return false;
    if(!SRD.PKM.FourMovesOnly.areNotetagsLoaded) {
            for(var i = 1; i < $dataSkills.length; i++) {
                    if($dataSkills.note.match(/<\s*Cannot\s*Forget\s*>/im)) {
                            $dataSkills.pkm_cannotDelete = true;
                    } else {
                            $dataSkills.pkm_cannotDelete = false;
                    }
            }
            SRD.PKM.FourMovesOnly.areNotetagsLoaded = true;
    }
    return true;
};

//-----------------------------------------------------------------------------
// Game_Actor
//-----------------------------------------------------------------------------

SRD.PKM.FourMovesOnly._Game_Actor_initMembers = Game_Actor.prototype.initMembers;
Game_Actor.prototype.initMembers = function() {
    SRD.PKM.FourMovesOnly._Game_Actor_initMembers.call(this);
    this._mostRecentSkillId = 0;
};

SRD.PKM.FourMovesOnly._Game_Actor_initSkills = Game_Actor.prototype.initSkills;
Game_Actor.prototype.initSkills = function() {
    SRD.PKM.FourMovesOnly._Game_Actor_initSkills.call(this);
    while(this._skills.length > 4) {
            this._skills.splice(0, 1);
    }
};

Game_Actor.prototype.setMostRecentSkillId = function(id) {
        this._mostRecentSkillId = id;
}

Game_Actor.prototype.mostRecentSkillId = function() {
        return this._mostRecentSkillId;
}

SRD.PKM.FourMovesOnly._Game_Actor_learnSkill = Game_Actor.prototype.learnSkill;
Game_Actor.prototype.learnSkill = function(skillId) {
        if (!this.isLearnedSkill(skillId)) {
            this.setMostRecentSkillId(skillId);
    }
    SRD.PKM.FourMovesOnly._Game_Actor_learnSkill.call(this, skillId);
    if(this._skills.length > 4) {
            if($gameParty.forgetSkillReadyActorId() === 0) {
                    var lines = [];
                    for(var i = 0; i < SRD.PKM.FourMovesOnly.alertLinesCount; i++) {
                            lines = SRD.PKM.FourMovesOnly.alertLines.replace(/\\actor/im, this._name);
                    }
                    for(var i = 0; i < SRD.PKM.FourMovesOnly.alertLinesCount; i++) {
                            if(lines.trim().length > 0) {
                                    $gameMessage.setBackground(SRD.PKM.FourMovesOnly.background);
                                    $gameMessage.add(lines);
                            }
                    }
                    $gameParty.setForgetSkillReady(1);
                    $gameParty.setForgetSkillReadyActorId(this._actorId);
            } else {
                    $gameParty.addForgetSkillReadyActorIds(this._actorId);
            }
    }
};

//-----------------------------------------------------------------------------
// Game_Party
//-----------------------------------------------------------------------------

SRD.PKM.FourMovesOnly._Game_Party_initialize = Game_Party.prototype.initialize;
Game_Party.prototype.initialize = function() {
    SRD.PKM.FourMovesOnly._Game_Party_initialize.call(this);
    this._skillForgetReady = 0;
    this._skillForgetReadyActorId = 0;
    this._skillForgetReadyActorIds = [];
    this._canRemoveHMMoves = false;
};

Game_Party.prototype.forgetSkillReady = function() {
    return this._skillForgetReady;
};

Game_Party.prototype.forgetSkillReadyActorId = function() {
    return this._skillForgetReadyActorId;
};

Game_Party.prototype.setForgetSkillReady = function(isReady) {
    this._skillForgetReady = isReady;
};

Game_Party.prototype.getForgetSkillReady = function() {
    return this._skillForgetReady;
};

Game_Party.prototype.setForgetSkillReadyActorId = function(actorId) {
    this._skillForgetReadyActorId = actorId;
};

Game_Party.prototype.addForgetSkillReadyActorIds = function(actorId) {
    this._skillForgetReadyActorIds.push(actorId);
};

Game_Party.prototype.getNextForgetSkillReadyActorId = function() {
    var result = this._skillForgetReadyActorIds[0];
    this._skillForgetReadyActorIds.splice(0, 1);
    return result;
};

Game_Party.prototype.checkForgetSkillReadyActorId = function() {
        return this._skillForgetReadyActorIds.length !== 0;
};

Game_Party.prototype.canRemoveHMMoves = function() {
    return this._canRemoveHMMoves;
};

Game_Party.prototype.setCanRemoveHMMoves = function(canHM) {
    this._canRemoveHMMoves = canHM;
};

//-----------------------------------------------------------------------------
// Scene_Base
//-----------------------------------------------------------------------------

SRD.PKM.FourMovesOnly._Scene_Base_update = Scene_Base.prototype.update;
Scene_Base.prototype.update = function() {
    SRD.PKM.FourMovesOnly._Scene_Base_update.call(this);
    if($gameParty.forgetSkillReady() > 0 && !$gameMessage.isBusy()) {
            if($gameParty.forgetSkillReady() === 1) {
                    $gameParty.setForgetSkillReady(0);
                        SceneManager.push(Scene_ForgetSkill);
            }
            if($gameParty.forgetSkillReady() === 2) {
                    $gameMessage.clear();
                        var id = $gameParty.getNextForgetSkillReadyActorId();
                    var actor = $gameActors.actor(id);
                    var lines = [];
                    for(var i = 0; i < SRD.PKM.FourMovesOnly.alertLinesCount; i++) {
                            lines = SRD.PKM.FourMovesOnly.alertLines.replace(/\\actor/im, actor.name());
                    }
                    for(var i = 0; i < SRD.PKM.FourMovesOnly.alertLinesCount; i++) {
                            if(lines.trim().length > 0) {
                                    $gameMessage.setBackground(SRD.PKM.FourMovesOnly.background);
                                    $gameMessage.add(lines);
                            }
                    }
                    $gameParty.setForgetSkillReady(1);
                    $gameParty.setForgetSkillReadyActorId(actor.actorId());
            }
        }
};

//-----------------------------------------------------------------------------
// Scene_ForgetSkill
//-----------------------------------------------------------------------------

function Scene_ForgetSkill() {
    this.initialize.apply(this, arguments);
}

Scene_ForgetSkill.prototype = Object.create(Scene_ItemBase.prototype);
Scene_ForgetSkill.prototype.constructor = Scene_ForgetSkill;

Scene_ForgetSkill.prototype.initialize = function() {
    Scene_ItemBase.prototype.initialize.call(this);
};

Scene_ForgetSkill.prototype.create = function() {
    Scene_ItemBase.prototype.create.call(this);
    this.createStatusWindow2();
    this.createHelpWindow();
    this.createStatusWindow();
    this.createItemWindow();
    this.refreshActor();
    this.commandSkill();
};

Scene_ForgetSkill.prototype.createStatusWindow2 = function() {
    this._statusWindow2 = new Window_ForgetSkillStatus2(0, 0, Graphics.boxWidth, 70);
    this.addWindow(this._statusWindow2);
    this._statusWindow2.refresh();
}

Scene_ForgetSkill.prototype.createHelpWindow = function() {
        this._helpWindow = new Window_Help();
    this._helpWindow.y = this._statusWindow2.y + this._statusWindow2.height;
    this.addWindow(this._helpWindow);
}

Scene_ForgetSkill.prototype.createStatusWindow = function() {
        var wx = 0;
    var wy = this._helpWindow.y + this._helpWindow.height;
    var ww = Graphics.boxWidth - wx;
    var wh = 70;
    this._statusWindow = new Window_ForgetSkillStatus(wx, wy, ww, wh);
    this.addWindow(this._statusWindow);
    this._statusWindow.refresh();
};

Scene_ForgetSkill.prototype.createItemWindow = function() {
    var wx = 0;
    var wy = this._statusWindow.y + this._statusWindow.height;
    var ww = Graphics.boxWidth;
    var wh = Graphics.boxHeight - wy;
    this._itemWindow = new Window_ForgetSkillList(wx, wy, ww, wh);
    this._itemWindow.setHelpWindow(this._helpWindow);
    this._itemWindow.setHandler('ok', this.onItemOk.bind(this));
    if($gameParty.canRemoveHMMoves()) {
            this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this));
    }
    this.addWindow(this._itemWindow);
};

Scene_ForgetSkill.prototype.actor = function() {
    return $gameActors.actor($gameParty.forgetSkillReadyActorId());
};

Scene_ForgetSkill.prototype.user = function() {
    return this.actor();
};

Scene_Skill.prototype.playSeForItem = function() {
};

Scene_ForgetSkill.prototype.refreshActor = function() {
    var actor = this.actor();
    this._statusWindow.setActor(actor);
    this._itemWindow.setActor(actor);
};

Scene_ForgetSkill.prototype.commandSkill = function() {
    this._itemWindow.activate();
    this._itemWindow.selectLast();
};

Scene_ForgetSkill.prototype.onItemOk = function() {
    this.actor().forgetSkill(this.item().id);
    var name = this.actor().name();
    var itemName = this.item().name;
    $gameParty.setForgetSkillReadyActorId(0);
    $gameParty.setCanRemoveHMMoves(false);
    this.popScene();
    var lines = [];
    for(var i = 0; i < SRD.PKM.FourMovesOnly.endLinesCount; i++) {
            lines = SRD.PKM.FourMovesOnly.endLines.replace(/\\actor/im, name);
            lines = lines.replace(/\\skill/im, itemName);
    }
    for(var i = 0; i < SRD.PKM.FourMovesOnly.endLinesCount; i++) {
            if(lines.trim().length > 0) {
                    $gameMessage.setBackground(SRD.PKM.FourMovesOnly.background);
                    $gameMessage.add(lines);
            }
    }

    if($gameParty.checkForgetSkillReadyActorId()) {
            $gameParty.setForgetSkillReady(2);
    }
};

Scene_ForgetSkill.prototype.onItemCancel = function() {
    $gameParty.setForgetSkillReadyActorId(0);
    $gameParty.setCanRemoveHMMoves(false);
    this.popScene();
};

//-----------------------------------------------------------------------------
// Window_ForgetSkillList
//-----------------------------------------------------------------------------

function Window_ForgetSkillList() {
    this.initialize.apply(this, arguments);
}

Window_ForgetSkillList.prototype = Object.create(Window_SkillList.prototype);
Window_ForgetSkillList.prototype.constructor = Window_ForgetSkillList;

Window_ForgetSkillList.prototype.initialize = function(x, y, width, height) {
    Window_SkillList.prototype.initialize.call(this, x, y, width, height);
    this._actor = null;
    this._data = [];
};

Window_ForgetSkillList.prototype.setActor = function(actor) {
    if (this._actor !== actor) {
        this._actor = actor;
        this.refresh();
        this.resetScroll();
    }
};

Window_ForgetSkillList.prototype.maxCols = function() {
    return SRD.PKM.FourMovesOnly.maxColumns;
};

Window_ForgetSkillList.prototype.spacing = function() {
    return SRD.PKM.FourMovesOnly.spacing;
};

Window_ForgetSkillList.prototype.maxItems = function() {
    return this._data ? this._data.length : 1;
};

Window_ForgetSkillList.prototype.item = function() {
    return this._data && this.index() >= 0 ? this._data[this.index()] : null;
};

Window_ForgetSkillList.prototype.isCurrentItemEnabled = function() {
    return this.isEnabled(this._data[this.index()]);
};

Window_ForgetSkillList.prototype.isEnabled = function(item) {
    return !item.pkm_cannotDelete || item.id === this._actor.mostRecentSkillId() || $gameParty.canRemoveHMMoves();
};

Window_ForgetSkillList.prototype.makeItemList = function() {
    if (this._actor) {
        this._data = this._actor.skills();
    } else {
        this._data = [];
    }
};

Window_ForgetSkillList.prototype.selectLast = function() {
    this.select(0);
};

Window_ForgetSkillList.prototype.updateHelp = function() {
    this.setHelpWindowItem(this.item());
};

Window_ForgetSkillList.prototype.refresh = function() {
    this.makeItemList();
    this.createContents();
    this.drawAllItems();
};

//-----------------------------------------------------------------------------
// Window_ForgetSkillStatus
//-----------------------------------------------------------------------------

function Window_ForgetSkillStatus() {
    this.initialize.apply(this, arguments);
}

Window_ForgetSkillStatus.prototype = Object.create(Window_Base.prototype);
Window_ForgetSkillStatus.prototype.constructor = Window_ForgetSkillStatus;

Window_ForgetSkillStatus.prototype.initialize = function(x, y, width, height) {
    Window_Base.prototype.initialize.call(this, x, y, width, height);
    this._actor = null;
};

Window_ForgetSkillStatus.prototype.setActor = function(actor) {
    if (this._actor !== actor) {
        this._actor = actor;
        this.refresh();
    }
};

Window_ForgetSkillStatus.prototype.refresh = function() {
    this.contents.clear();
    if (this._actor) {
            var x = 0;
            var x2 = x + 280;
            var x3 = x2 + 280;
            var y = 0;
        var actor = this._actor;
            this.drawActorName(actor, x, y);
            this.drawActorLevel(actor, x2, y);
            this.drawActorClass(actor, x3, y);
    }
};

//-----------------------------------------------------------------------------
// Window_ForgetSkillStatus2
//-----------------------------------------------------------------------------

function Window_ForgetSkillStatus2() {
    this.initialize.apply(this, arguments);
}

Window_ForgetSkillStatus2.prototype = Object.create(Window_Base.prototype);
Window_ForgetSkillStatus2.prototype.constructor = Window_ForgetSkillStatus;

Window_ForgetSkillStatus2.prototype.initialize = function(x, y, width, height) {
    Window_Base.prototype.initialize.call(this, x, y, width, height);
};

Window_ForgetSkillStatus2.prototype.refresh = function() {
    this.contents.clear();
    this.drawText("请您选择一招武功废掉。。。。", 0, 0, (Graphics.boxWidth), 'center');
};[/pre]

点评

YEP.90 – Equip Battle Skills(技能装备)  发表于 2016-9-18 07:27
梦石
0
星屑
230
在线时间
174 小时
注册时间
2016-2-24
回帖
83
 楼主| 发表于 2016-9-18 20:39:57 | 显示全部楼层
@邪月长啸
谢谢,这个只能装备,不能超过4个然后删除有点遗憾

点评

非常感谢  发表于 2016-9-20 13:39
不过要手动替换,我在敌群事件里设置公共事件,判定死亡角色自己离队,战后在入队  发表于 2016-9-19 12:51
YEP.29 – Party System(队伍系统)和YEP.108 – Actor Party Switch(队伍角色切换)  发表于 2016-9-19 12:50
@邪月长啸 谢谢,顺便问一下大神知道哪个插件可以让战斗角色死亡后替补队员出战的吗?  发表于 2016-9-18 22:06
插件设置可以扩大  发表于 2016-9-18 21:03
回复

使用道具 举报

梦石
0
星屑
230
在线时间
174 小时
注册时间
2016-2-24
回帖
83
 楼主| 发表于 2016-9-18 22:19:10 | 显示全部楼层
@邪月长啸
谢谢,顺便问一下大神知道哪个插件可以让战斗角色死亡后替补队员出战的吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部