Damage formulae are evaluated ruby code and as such you can add anything there. There might be a faster way of doing it but I don't have access to the code right now so I cannot check it. If I remember correctly you should be able to access enemies using
and battling party members using
Code:
$game_party.members #only if used in battle. It is battle_members otherwise
Then you have to increase a variable for each member having the poison state. I am assuming you didn't change the ID of poison state so I'll use state 2 in my example.
Code:
mult = 0; $game_troop.members.each do |e|; mult += 1 if enemy.state?(2); end; $game_party.members.each do |actor|; mult += 1 if actor.state?(2); end; your_damage_formula_goes_here * mult
I am almost 100% sure that this won't fit in your damage formula so you can try this:
Code:
m = 0; bm = $game_troop.members + $game_party.members; bm.each do |i|; m+=1 if i.state?(2); end; your_famage_formula_goes_here * m
I am still not sure if this fits or not but if it doesn't you can give this other one a try
Code:
m=0; SceneManager.scene.members.each do |i|; m+=1 if i.state?(2); end; your_famage_formula_goes_here * m
Theoretically "SceneManager.scene" is Scene_Battle if called inside a battle and "member" is a method of Scene_Battle that returns "$game_party.members + $game_troop.members". I listed these possibilities in what I think being a "safety priority". Since I cannot test it right now you should give it a try.
If it doesn't work you can just type this in your script:
Code:
class Game_Battler < Game_BattlerBase
def state_scaling(val, id)
mult = 0
$game_troop.members.each do |enemy|
mult += 1 if enemy.state?(id)
end
$game_party.members.each do |actor|
mult += 1 if actor.state?(id)
end
return (val * mult)
end
end
Once you do this you can call it in your damage formula using
Code:
a.state_scaling(your_damage_formula_goes_here, your_state_id)
This has the advantage of being usable regardless of the state you are looking for. You can just change the value of "your_state_id" in your damage formula and it scales based on that state.
EDIT: do not forget that when you write your formula instead of "your_damage_formula" in the code I provided you have to use parenthesis.
Code:
a.atk*4 - b.def*2 * mult # this just multiplies enemies defense!
(a.atk*4 - b.def*2) * mult # this works as intended