Files
Superproject1/js/plugins/JIF_MoveStaling.js
alexpolo1 cb804c8b69 2
2023-04-10 22:08:20 +02:00

103 lines
3.2 KiB
JavaScript

/*:
* @plugindesc (v.1) Adds the move staling mechanic into your game
* @author Jiffy
*
* @param damageDecreaseIncrement
* @desc The increment damage is decreased by (Ex. For a 10% decrease -> .1)| Default:.1
* @default .1
*
* @help
* Jiffy's Move Staling Plugin
* ===========================================================================
* Inspired by the mechanic by the same name from the Super Smash Bros. Series,
* staling will decrease the amount of damage a move does if it is used
* repeatedly. This will discourage the spamming of the same move and will
* add another layer of complexity to your combat system.
* ===========================================================================
* Parameter Explanation
* ===========================================================================
* damageDecreaseIncrement:
* This parameter changes the increment of which your damage is decreased by.
* For example: If I set this to .1, the damage will decrease by 10% each time
* time it is used in a row.
* ===========================================================================
* Thanks for reading! If you have any questions regarding this plugin, feel
* free to DM me on RPGMakerWeb!
*
* Thanks again
* - Jiffy
*/
//Param Setup
var JIF = JIF || {};
var params = PluginManager.parameters('JIF_MoveStaling');
JIF.modifier = String(params['damageDecreaseIncrement']);
//
JIF.arr = [];
JIF.tempCount = 0;
Game_Action.prototype.makeDamageValue = function(target, critical) {
var item = this.item();
var baseValue = this.evalDamageFormula(target);
var value = baseValue * this.calcElementRate(target);
if (this.isPhysical()) {
value *= target.pdr;
}
if (this.isMagical()) {
value *= target.mdr;
}
if (baseValue < 0) {
value *= target.rec;
}
if (critical) {
value = this.applyCritical(value);
}
value = this.applyVariance(value, item.damage.variance);
value = this.applyGuard(value, target);
value = Math.round(value);
if(JIF.arr.length > 2)
{
if(JIF.arr[JIF.arr.length - 2].item().name !== this.item().name)
{
JIF.tempCount = 0;
for(var i = 0; i < JIF.arr.length; i++)
{
if(JIF.arr[i].item().name !== this.item().name) {
JIF.arr = JIF.arr.slice(i, 1);
}
}
}
}
JIF.tempCount = 0;
for(var i = 0; i < JIF.arr.length; i++)
{
if(JIF.arr[i].item().name === this.item().name)
{
JIF.tempCount++;
}
}
//console.log(tempCount);
//console.log(value - (value * (modifier * tempCount)));
JIF.arr.push(this);
return Math.floor(value - (value * (JIF.modifier * JIF.tempCount)));
};
BattleManager.startAction = function() {
var subject = this._subject;
var action = subject.currentAction();
var targets = action.makeTargets();
//console.log(action);
//console.log(subject);
this._phase = 'action';
this._action = action;
this._targets = targets;
subject.useItem(action.item());
this._action.applyGlobal();
this.refreshStatus();
this._logWindow.startAction(subject, action, targets);
};