Project1
标题:
求一个主动技能关联被动技能的插件
[打印本页]
作者:
帝卡尔
时间:
2023-10-17 18:53
标题:
求一个主动技能关联被动技能的插件
请问有没有插件可以设置被动技能对主动技能有增幅?比如学习了被动技能a,那么与 a 有关联的主动技能 b 可以增幅30%的伤害。如果没学习被动技能a,那么 b 就只能发挥正常的伤害
作者:
2606358566
时间:
2023-10-18 04:53
我有一套,有偿的,你要不要?
作者:
sundeshuo
时间:
2023-10-18 14:26
很久以前练习时写的,拿去用吧
/*:
* @target MZ
* @author sun
* @plugindesc 战斗效果拓展
* @help
*
* @param Aoe Mode
* @text 分裂效果模式
* @type boolean
* @default false
* @desc 分裂效果是否对群体伤害生效
*
* @help
* ======================================================
* 将一些VS插件未制作常用效果编码,免去使用战斗插入制作的繁琐
* ======================================================
* 增加了一些方法方便在战斗插入中使用:
* 判断是否是id为xx的技能
* Item.isSkillId(xx);
* Action.isSkillId(xx);
* ======================================================
* tag:
*
* 技能伤害 <Skill Damage ID: a%>
* 可以用在装备、技能(当做被动)、状态;
* ID替换为技能id,a替换为提升的值,a必须为整数;
*
* 分裂效果 <Physics Aoe: a%> <Magical Aoe: a%> <Certain Aoe: a%> <Heal Aoe: a%>
* 可以用在装备、技能(当做被动)、状态;
* 使物理、魔法、必中伤害、治疗效果附带分裂效果;
* a替换为分裂伤害倍率,必须为整数;
*
* 治疗加成 <Heal Rate: a%>
* 可以用在装备、技能(当做被动)、状态;
* 增加使用者治疗效果的属性
* a替换为分裂伤害倍率,必须为整数;
* 若要将该属性显示在菜单上,可以使用:
* Battler.showHealRate();
*/
var Imported = Imported || {};
Imported.sun_battleEffectExpand = true;
var sunBattleEffectExpandParam = sunBattleEffectExpandParam || {};
sunBattleEffectExpandParam.parameters = PluginManager.parameters('sun_BattleEffectExpandParam');
sunBattleEffectExpandParam.aoeMode = (sunBattleEffectExpandParam.parameters['Aoe Mode'] === "true");
var _sunBattleEffectInitialize = Scene_Battle.prototype.initialize;
Scene_Battle.prototype.initialize = function () {
_sunBattleEffectInitialize.call(this)
for (let member of $gameParty.battleMembers()) {
member.updateBattleEffect();
}
for (let member of $gameTroop.members()) {
member._battleEffect = {};
member._battleEffect._skillDamage = {};
member._battleEffect._aoeDamage = {};
}
};
Game_Item.prototype.isSkillId = function (id) {
return this._itemId === id && this.isSkill();
};
Game_Action.prototype.isSkillId = function (id) {
return this._item.isSkill() && this._item.isSkillId(id);
};
Game_Battler.prototype.getEquipsTag = function (note) {
if (!this.isActor()) return;
const equips = this.equips().filter(item => item);
for (let equ of equips) {
note.push(equ.note);
}
return note;
};
Game_Battler.prototype.getSkillTag = function (note) {
if (!this.isActor()) return;
const skills = this.skills();
for (let skill of skills) {
note.push(skill.note);
}
return note;
};
Game_Battler.prototype.getStateTag = function () {
const states = this.states();
const note = [];
for (let state of states) {
note.push(state.note);
}
return note;
};
Game_Battler.prototype.updateBattleEffect = function () {
this._battleEffect = {};
let note = [];
note = this.getEquipsTag(note);
note = this.getSkillTag(note);
this.updateSkillDamage(note);
this.updateAoeDamage(note);
this.updateHealRate(note);
};
//技能伤害
Game_Battler.prototype.updateSkillDamage = function (note) {
this._battleEffect._skillDamage = {};
this._battleEffect._skillDamage = { ...this.countSkillDamageTag(note) }
};
Game_Battler.prototype.countSkillDamageTag = function (note) {
const skillDamage = {};
for (let n of note) {
let tag = n.match(/<SKILL DAMAGE (\d+):[ ](\d+)[%%]>/ig) ? n.match(/<SKILL DAMAGE (\d+):[ ](\d+)[%%]>/ig) : [];
for (let sd of tag) {
if (sd.match(/<SKILL DAMAGE (\d+):[ ](\d+)[%%]>/i)) {
let id = parseInt(RegExp.$1);
let dam = parseInt(RegExp.$2) * 0.01;
if (skillDamage[id] === undefined) skillDamage[id] = 0;
skillDamage[id] += dam;
}
}
}
return skillDamage;
};
Game_Action.prototype.getSkillDamage = function () {
const user = this.subject();
const id = this._item._itemId;
let rate = user._battleEffect._skillDamage[id] ? user._battleEffect._skillDamage[id] : 0;
const skillDamage = user.countSkillDamageTag(user.getStateTag());
rate += skillDamage[id] ? skillDamage[id] : 0;
return rate;
};
Game_Action.prototype.applySkillDamage = function (value) {
const user = this.subject();
const id = this._item._itemId;
value *= 1 + this.getSkillDamage();
return value;
};
//分裂效果
Game_Battler.prototype.updateAoeDamage = function (note) {
this._battleEffect._aoeDamage = {};
this._battleEffect._aoeDamage = { ...this.countAoeDamageTag(note) }
};
Game_Battler.prototype.countAoeDamageTag = function (note) {
const aoeDamage = {};
for (let n of note) {
let tag = n.match(/<(\w+) Aoe:[ ](\d+)[%%]>/ig) ? n.match(/<(\w+) Aoe:[ ](\d+)[%%]>/ig) : [];
for (let ad of tag) {
if (ad.match(/<(\w+) Aoe:[ ](\d+)[%%]>/i)) {
let type = RegExp.$1;
let dam = parseInt(RegExp.$2) * 0.01;
if (aoeDamage[type] === undefined) aoeDamage[type] = 0;
aoeDamage[type] += dam;
}
}
}
return aoeDamage;
};
Game_Action.prototype.getAoeDamage = function () {
const user = this.subject();
const id = this._item._itemId;
const aoeDamage = user.countAoeDamageTag(user.getStateTag());
let rate = 0;
if (this.isHpRecover()) {
rate = user._battleEffect._aoeDamage['Heal'] ? user._battleEffect._aoeDamage['Heal'] : 0;
rate += aoeDamage['Heal'] ? aoeDamage['Heal'] : 0;
return rate;
console.log(rate);
}
else if (this.isPhysical()) {
rate = user._battleEffect._aoeDamage['Physics'] ? user._battleEffect._aoeDamage['Physics'] : 0;
rate += aoeDamage['Physics'] ? aoeDamage['Physics'] : 0;
return rate;
}
else if (this.isMagical()) {
rate = user._battleEffect._aoeDamage['Magical'] ? user._battleEffect._aoeDamage['Magical'] : 0;
rate += aoeDamage['PMagical'] ? aoeDamage['Magical'] : 0;
return rate;
}
else if (this.isCertainHit()) {
rate = user._battleEffect._aoeDamage['Certain'] ? user._battleEffect._aoeDamage['Certain'] : 0;
rate += aoeDamage['Certain'] ? aoeDamage['Certain'] : 0;
return rate;
}
return 0;
};
Game_Action.prototype.applyAoeDamage = function (target, value) {
if (!sunBattleEffectExpandParam.aoeMode && !this.isForOne()) return;
const members = target.friendsUnit().aliveMembers();
const dam = Math.floor(value * (this.getAoeDamage()));
if (dam === 0) return;
for (let member of members) {
if (member !== target) {
member.gainHp(-dam);
member.startDamagePopup();
member.clearResult();
if (Imported.sun_battleDamageStat) this.subject().damStat(-dam, this.item().name)
}
}
};
//治疗加成
Game_Battler.prototype.updateHealRate = function (note) {
this._battleEffect._healRate = this.countHealRateTag(note);
};
Game_Battler.prototype.countHealRateTag = function (note) {
let rate = 0;
for (let n of note) {
if (n.match(/<Heal Rate:[ ](\d+)[%%]>/i)) {
rate += parseInt(RegExp.$1) * 0.01;
}
}
return rate;
};
Game_Battler.prototype.showHealRate = function () {
const note = [];
note = this.getEquipsTag(note);
note = this.getSkillTag(note);
let rate = this.countHealRateTag(note);
rate += this.countHealRateTag(user.getStateTag());
return rate;
}
Game_Action.prototype.getHealRate = function () {
const user = this.subject();
const id = this._item._itemId;
let rate = user._battleEffect._healRate ? user._battleEffect._healRate : 0;
rate += user.countHealRateTag(user.getStateTag());
return rate;
};
Game_Action.prototype.applyHealRate = function (value) {
if (this.isRecover()) {
value *= 1 + this.getHealRate();
}
return value;
};
//执行效果
var _sunExecuteDamage = Game_Action.prototype.executeDamage;
Game_Action.prototype.executeDamage = function (target, value) {
value = this.applySkillDamage(value);
value = this.applyHealRate(value);
_sunExecuteDamage.call(this, target, value);
this.applyAoeDamage(target, value);
};
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1