Another thing in decorate is Multiple Inheritance, I use inheritance to make 'damagefactors' and 'painchance.<damage type>s'. The problem is, that I sometimes need to inherit both damage factors from one class and certain flags and properties from another. This means instead of making a class which has damage types, etc and another class containing flags and other properties like speed, etc, then inheting them both, I have to make the first class, then a load of the second class inherting from the first class. Heres what I mean:
Instead of:
I have to do this:actor fireelement
{
damagetype "fire"
damagefactor "fire",0.0
damagefactor "water",2.0
}
actor weakmonster
{
speed 8
painchance 200
monster
+nohurtspecies
}
actor strongmonster
{
speed 14
painchance 50
monster
+nohurtspecies
+faster
}actor lavathing : fireelement, weakmonster (or : fireelement : weakmonster)
{
health 95
states
{
...
}
}
Now they make look alike, but when there's more than one 'element' like waterelement, that means I've got to make a weakwatermonster and strongwatermonster class. Should I have 10 elements, that means I need to make an extra 20 subclasses, should I want to make a new subclass, I've got to make 10 of them each. I could just add those subclasses onto all the monsters instead, but, for editing in mass, one mistake, or one thing to change means having to edit all the scripts. I have 16 classes and 3 subclasses so far, a very long script... (my project's a large scale one)actor fireelement
{
damagetype "fire"
damagefactor "fire",0.0
damagefactor "water",2.0
}
actor weakfiremonster : fireelement
{
speed 8
painchance 200
monster
+nohurtspecies
}actor strongfiremonster : fireelement
{
speed 12
painchance 50
monster
+nohurtspecies
+faster
}
actor lavathing : weakfiremonster
{
health 95
states
{
...
}
}