You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
3.0 KiB
JavaScript

3 years ago
//=============================================================================
// WeaponSkill.js
//=============================================================================
/*:
* @plugindesc Change skill id of attack for each weapon.
* @author Sasuke KANNAZUKI
*
* @help This plugin does not provide plugin commands.
*
* When <skill_id:3> is written in a weapon's note field,
3 years ago
* skill id # 3 is used for the weapon's attack.
* If nothing is written, default id(=1) is used.
*
* Check Points:
* - When multiple weapons are equipped, the skill id of the weapon
* held in the dominant hand (previously defined) is used.
* - It is most favorable for "skill type" to be "none"(=0),
* otherwise you cannot attack when your skill is blocked.
*
* Usage examples of this plugin:
* - to create all-range weapons
* - to create dual-attack or triple-attack weapons
* - If healing skill is set when actor attacks, you can choose a friend to heal.
* - It is possible to make a weapon that functions similar to a guard command.
3 years ago
*/
/*:ja
* @plugindesc 武器ごとに通常攻撃のスキルIDを変更します
* @author 神無月サスケ
*
* @help このプラグインにはプラグインコマンドはありません
*
* 武器のメモ欄に<skill_id:3> と書いた場合
* 通常攻撃の際3番のスキルが発動します
* 特に記述がなければ通常通り1番のスキルが採用されます
*
* チェックポイント:
* - 二刀流の場合利き腕(先に定義された方)に持っているスキルIDが採用されます
* - スキルタイプはなしにするのが望ましいです
* さもなくば技などを封じられたとき攻撃が出来なくなります
*
* 想定される用途:
* - 全体攻撃可能な武器
* - 2回攻撃3回攻撃する武器
* - 回復魔法をスキルに指定した場合
* 攻撃を選んだ際味方の選択が出来その仲間を回復します
* - 防御コマンドなどと同等になる武器も実現可能です
*/
(function () {
//
// set skill id for attack.
//
Game_Actor.prototype.attackSkillId = function () {
var normalId = Game_BattlerBase.prototype.attackSkillId.call(this);
if (this.hasNoWeapons()) {
return normalId;
}
var weapon = this.weapons()[0]; // at plural weapon, one's first skill.
var id = weapon.meta.skill_id;
return id ? Number(id) : normalId;
};
3 years ago
//
// for command at battle
//
var _Scene_Battle_commandAttack = Scene_Battle.prototype.commandAttack;
Scene_Battle.prototype.commandAttack = function () {
BattleManager.inputtingAction().setAttack();
// normal attack weapon (or other single attack weapon)
var action = BattleManager.inputtingAction();
if (action.needsSelection() && action.isForOpponent()) {
_Scene_Battle_commandAttack.call(this);
return;
}
// special skill weapon
this.onSelectAction();
};
3 years ago
})();