I had chat GPT create a plug in for my game. Its supposed to add a 5% crit and eva bonus for every 10 levels of luk and do so in a way that if a players luk stat drops below a threshold in battle it will update. e.g player has 22 luk and receives a -5 luk debuff their bonus will drop from 10% to 5%
Here is what I have:
/*:
* @plugindesc Adds bonus to crit rate and evasion rate based on LUK stat.
* @Help This plugin gives a 5% bonus to crit rate and evasion rate for every 10 levels of LUK.
*/
(function() {
// Create a function to calculate the bonus
function calculateLukBonus(luk) {
return Math.floor(luk / 10) * 5;
}
// Extend the Game_BattlerBase class to include the LUK-based bonus
var _Game_BattlerBase_cri = Game_BattlerBase.prototype.cri;
Game_BattlerBase.prototype.cri = function() {
var baseCri = _Game_BattlerBase_cri.call(this);
var lukBonus = calculateLukBonus(this.luk);
return baseCri + lukBonus / 100;
};
var _Game_BattlerBase_eva = Game_BattlerBase.prototype.eva;
Game_BattlerBase.prototype.eva = function() {
var baseEva = _Game_BattlerBase_eva.call(this);
var lukBonus = calculateLukBonus(this.luk);
return baseEva + lukBonus / 100;
};
})();
If anyone knows what I'm missing or can help me tweak this for what I need Id really appreciate it.
Here is what I have:
/*:
* @plugindesc Adds bonus to crit rate and evasion rate based on LUK stat.
* @Help This plugin gives a 5% bonus to crit rate and evasion rate for every 10 levels of LUK.
*/
(function() {
// Create a function to calculate the bonus
function calculateLukBonus(luk) {
return Math.floor(luk / 10) * 5;
}
// Extend the Game_BattlerBase class to include the LUK-based bonus
var _Game_BattlerBase_cri = Game_BattlerBase.prototype.cri;
Game_BattlerBase.prototype.cri = function() {
var baseCri = _Game_BattlerBase_cri.call(this);
var lukBonus = calculateLukBonus(this.luk);
return baseCri + lukBonus / 100;
};
var _Game_BattlerBase_eva = Game_BattlerBase.prototype.eva;
Game_BattlerBase.prototype.eva = function() {
var baseEva = _Game_BattlerBase_eva.call(this);
var lukBonus = calculateLukBonus(this.luk);
return baseEva + lukBonus / 100;
};
})();
If anyone knows what I'm missing or can help me tweak this for what I need Id really appreciate it.