Hello!
And sorry about the somewhat confusion language. Basically I have a state that is always on the player and whenever the play takes direct HP damage there is a chance of gaining a variety of debuffing statea.
The reasoning for this by the way is Direct HP damage is kinda rare actually since my game makes heavy use of barriers and the player character's barrier refreshes itself in between any fights.
I had gotten one version of the state to work just fine actually, here's the code for that
Basically it checks to see if the PC has any barrier left, and if the last attack that hit them actually did any damage.
If so then it rolls against the PC's Luck stat to determine if they shrug off the injury or get one of the debuffing states.
It works as intended.
But then I tried to make a more completed version, as I meant for there to be tiers to the injuries "yellow" "red" and "black" with red states being more dangerous than yellows and black states being even more detrimental than reds.
Essentially the difference between flesh wounds, open injuries, and a mortal wound.
But when I tried to simply add in a second round of it rolling but this time for the "red" tier states and the whole thing broke. It doesn't even roll for the yellows anymore. Here's the code for that one
The extra bit of code in the condition was to try and make it only apply if the target already has at least 1 of the yellow tier effects going on before rolling.
And as for the Plugins I've got going on, nearly Yanfly's whole suite. The one's that are particularly relevant off of the top of my head are the absorption barrier plugin, Auto Passives States, and Buffs & States core.
So yea, if anyone can help with this multi layered "injury" debuff state that'd be really appreciated!
And sorry about the somewhat confusion language. Basically I have a state that is always on the player and whenever the play takes direct HP damage there is a chance of gaining a variety of debuffing statea.
The reasoning for this by the way is Direct HP damage is kinda rare actually since my game makes heavy use of barriers and the player character's barrier refreshes itself in between any fights.
I had gotten one version of the state to work just fine actually, here's the code for that
JavaScript:
<Custom React Effect>
// Check if the effect dealt HP damage
if (this.isHpEffect() && value > 0 && target.barrierPoints() < 1) {
var yellowStates = [122, 123, 118];
var x = (Math.random() * 100);
var y = (target.luk - 10);
if (x > y) {
// Make an empty pool of states
var currentStates = [];
// Loop through each of the yellow states
for (var i = 0; i < yellowStates.length; ++i) {
// Get the currently looped state
var bonusState = yellowStates[i];
// Check if the target is affected by that state
if (!target.isStateAffected(bonusState)) {
// If it is, add it to the pool of states
currentStates.push(bonusState);
}
}
// Check if the pool of states isn't empty
if (currentStates.length > 0) {
// Get a random state from that pool
var addedState = currentStates[Math.floor(Math.random() * currentStates.length)];
// Remove the random state
target.addState(addedState);
}
} else {
target.addState(132);
}
}
</Custom React Effect>
Basically it checks to see if the PC has any barrier left, and if the last attack that hit them actually did any damage.
If so then it rolls against the PC's Luck stat to determine if they shrug off the injury or get one of the debuffing states.
It works as intended.
But then I tried to make a more completed version, as I meant for there to be tiers to the injuries "yellow" "red" and "black" with red states being more dangerous than yellows and black states being even more detrimental than reds.
Essentially the difference between flesh wounds, open injuries, and a mortal wound.
But when I tried to simply add in a second round of it rolling but this time for the "red" tier states and the whole thing broke. It doesn't even roll for the yellows anymore. Here's the code for that one
JavaScript:
<Custom React Effect>
// Check if the effect dealt HP damage
if (this.isHpEffect() && value > 0 && target.barrierPoints() < 1) {
var yellowStates = [115, 117, 122, 123];
var x = (Math.random() * 100);
var y = (target.luk - 10);
if (x > y) {
// Make an empty pool of states
var currentStates = [];
// Loop through each of the yellow states
for (var i = 0; i < yellowStates.length; ++i) {
// Get the currently looped state
var bonusState = yellowStates[i];
// Check if the target is affected by that state
if (!target.isStateAffected(bonusState)) {
// If it is, add it to the pool of states
currentStates.push(bonusState);
}
}
// Check if the pool of states isn't empty
if (currentStates.length > 0) {
// Get a random state from that pool
var addedState = currentStates[Math.floor(Math.random() * currentStates.length)];
// Remove the random state
target.addState(addedState);
}
} else {
target.addState(132);
}
}
if (this.isHpEffect() && value > 0 && target.barrierPoints() < 1 && target.isStateAffected(115) || target.isStateAffected(117) || target.isStateAffected(122) || target.isStateAffected(123) {
var redStates = [113, 114, 116, 118, 124];
var x = (Math.random() * 100);
var y = (target.luk - 10);
if (x > y) {
// Make an empty pool of states
var currentStates = [];
// Loop through each of the red states
for (var i = 0; i < redStates.length; ++i) {
// Get the currently looped state
var bonusState = redStates[i];
// Check if the target is affected by that state
if (!target.isStateAffected(bonusState)) {
// If it is, add it to the pool of states
currentStates.push(bonusState);
}
}
// Check if the pool of states isn't empty
if (currentStates.length > 0) {
// Get a random state from that pool
var addedState = currentStates[Math.floor(Math.random() * currentStates.length)];
// Remove the random state
target.addState(addedState);
}
} else {
target.addState(132);
}
}
</Custom React Effect>
The extra bit of code in the condition was to try and make it only apply if the target already has at least 1 of the yellow tier effects going on before rolling.
And as for the Plugins I've got going on, nearly Yanfly's whole suite. The one's that are particularly relevant off of the top of my head are the absorption barrier plugin, Auto Passives States, and Buffs & States core.
So yea, if anyone can help with this multi layered "injury" debuff state that'd be really appreciated!