I'm trying to work MAT and MDF into the success rate of inflicting states on enemies. I'm wondering if I have this logic right, particularly in referencing the target's MAT stat. (I just looked at how luk_effect_rate does it.)
(Yes, it's meant to be the user's MDF against the target's MAT. Because repurposed stats.)
(Yes, it's meant to be the user's MDF against the target's MAT. Because repurposed stats.)
Code:
#-------------------------------------------------------------------------- # * [Add State] Effect: Normal #-------------------------------------------------------------------------- def item_effect_add_state_normal(user, item, effect) chance = effect.value1 chance *= state_rate(effect.data_id) if opposite?(user) chance = [chance * (1.00 + (user.mdf - mat / (user.mdf + mat)), chance * 1.5].min if opposite?(user) && user.mdf > mat chance = [chance * (1.00 + (user.mdf - mat / (user.mdf + mat)), chance * 0.5].max if opposite?(user) && user.mdf < mat if rand < chance add_state(effect.data_id) @result.success = true end end