Kain Nobel
Member
Good day everybody!
I think I might have a sort of tricky question, if anybody is up for it. First of all, the classes we're dealing with is Game_Battler, and its inheritant classes Game_Actor and Game_Enemy, with such methods as 'attack_effect' and 'skill_effect'. As we know, these two methods are only called in Game_Battler by default, so first thing I should do is a simple singleton_methods check like so, before I bother aliasing...
Now, that tells me if these methods have been redefined in anyway within the inheritant Game_Actor class (which only inherits these methods from Game_Battler). By nature, there is two possibilities which are entirely random, and is really dependant on not just the writter of the script, but every unique user of the script as well.
With that in mind, we'll never know for sure if it is super called or overwritten, meaning we might not know wether to super call it this time around... but if we super call it, and it wasn't previously super called, then it might mess up the script above this one and make it not work right, especially if somebody else had a special damage formula specific to Actors or Enemies only.
So, on that note, how do I write my script so it knows how to work around these things? I never know what kind of scripts a user can be using, so I want to be sure that it is compatible with whatever style they might've used this method in, super or not... defined as a singleton or not...
Can anybody help me out with this question?
Also, with the very first check up top, it only aliases the method if it is a singleton... how do I tell from within the new method definition that this method was aliased up top?
I think I might have a sort of tricky question, if anybody is up for it. First of all, the classes we're dealing with is Game_Battler, and its inheritant classes Game_Actor and Game_Enemy, with such methods as 'attack_effect' and 'skill_effect'. As we know, these two methods are only called in Game_Battler by default, so first thing I should do is a simple singleton_methods check like so, before I bother aliasing...
Code:
class Game_Actor < Game_Battler
 #-----------------------------------------------------------------------------
 # * Alias Listing
 #-----------------------------------------------------------------------------
 if self.singleton_methods.include?(:attack_effect_damage)
  p "attack_effect_damage"
  alias_method :steal_actor_atk_eff_damage, :attack_effect_damage
 end
 if self.singleton_methods.include?(:skill_effect_damage)
  p "skill_effect_damage"
  alias_method :steal_actor_skl_eff_damage, :skill_effect_damage
 end
end
Now, that tells me if these methods have been redefined in anyway within the inheritant Game_Actor class (which only inherits these methods from Game_Battler). By nature, there is two possibilities which are entirely random, and is really dependant on not just the writter of the script, but every unique user of the script as well.
[#] Possability 1: A random previous script super calls this method.
[#] Possability 2: A random previous script overwrites this method.
With that in mind, we'll never know for sure if it is super called or overwritten, meaning we might not know wether to super call it this time around... but if we super call it, and it wasn't previously super called, then it might mess up the script above this one and make it not work right, especially if somebody else had a special damage formula specific to Actors or Enemies only.
So, on that note, how do I write my script so it knows how to work around these things? I never know what kind of scripts a user can be using, so I want to be sure that it is compatible with whatever style they might've used this method in, super or not... defined as a singleton or not...
Can anybody help me out with this question?
Also, with the very first check up top, it only aliases the method if it is a singleton... how do I tell from within the new method definition that this method was aliased up top?