Alright, I did understand what you said there.
I prefer a signle class (PokeBattle_Effects) with different variables that will in the outcome suit every needed situation
and to make it more flexible add a custom_code segment which allows you to evaluate a custom code just for incase there are
some un-defined methods required within the effect
OR
We can do something simmilar to Essentials where we must create a code for every move (which is time more time consuming in
my opinion)
the PokeBattle_Effects class can store any type of effect: Move/Ability/Card and can be activated at selected points:
Turn Started/Turn Ended/Coin Flipped/Coin Heads/Coin Tales/Your Turn/Enemy Turn/ect. using an array you can select multiple
points to activate this at. I also did create a sample of what I mean (I only spent about 5 minutes or so on this so it's
not perfect and may seem a little confusing) but this is what I made:
Spoiler:
Code:
=begin
This is an example of what I would do for Effects, I can make any changes you wish
You can add to this as you wish and or modify it. If you don't like this system,
I can completely reconstruct this to Essential's style.
=end
class PokeBattle_Effects
attr_accessor :type # Integer -- 0 = card, 1 = move, 2 = ability
attr_accessor :activation_type # Integer -- when to activate the effect (0= your turn, 1= enemy's turn, 2= coin flip, 3= before attack, 4= during attack, ect.)
attr_accessor :hold_effect # Integer -- how many turns to hold the effect
attr_accessor :effect # Integer -- 0 = damage, 1 = status, and so forth
attr_accessor :effect_attribute# Integer -- how much damage?, which status?, ect.
attr_accessor :chance # Integer -- Percentage chance of the succes of the effect
attr_accessor :custom_function # String -- A string containing ruby code on what to execute (executes every time called)
attr_accessor :activated # Boolean -- Is this effect active?
attr_accessor :turns # Integer -- Maximum turns to hold the effect (auto selected by hold_effect)
# startup of the class
def initialize(type, activation_type, effect, hold_effect = 1, custom_function = "")
@type = type
@activation_type = activation_type
@effect = effect
@hold_effect = hold_effect
@custom_function = custom_function
@turns = hold_effect
end
# returns wether the ability is avaible to activate
# if it is activatable it reset the activation turns (unless already active)
def activatable?(a_type)
@hold_effect = @turns if @activation_type == a_type && !@activated
@activated = true if @activation_type == a_type && !@activated
return @activation_type == a_type
end
# returns if the effect is currently active
def updatable?
return @activated
end
# updates and returns an array (the length will be 1 if it did not do anything)
def update
@hold_effect -= 1
destroy = @hold_effect > 0
ret = [destroy]
if rand(100-@chance) == 0
ret.push(effect)
ret.push(effect_attributes)
ret.push(eval(@custom_function)) if @custom_function != ""
end
return ret
end
end
also, if you are going to read data ini-style like essentials does I made a small tool for this too:
so if you have a different idea or have improvements for the PokeBattle_Effects class, let me know.