I've started with ArmorWithPerk since I stumbled over it, when pretty-printing and fixing a few bugs in BimboSkirt.as. ArmorWithPerk had 22 params and BimboSkirt-constructor skipped 7 params just to set the last one to false. I wanted to make the whole thing more intuitive and less 'count commas to get to the correct param'. I've designed the 'ParamBuilder' (=ArmorWithPerkBuilder) as per @aimozg's suggestion.
Note, that I'm starting this discussion here, so we have an equivalent variant for all CoC-Mods for better intermod-portability so discuss (and PR?) away :-)
At some point I plan to merge ArmorWithPerk and Armor and move the perk list directly into the parent class (either Armor or to avoid copy&paste, since WeaponWithPerk also exists directly to ItemType), e. G. (As per @Oxdeception's suggestion):
protected var _itemPerks:Vector.<PerkClass> = new Vector.<PerkClass>();
I intend to simplify constructor params for
ItemType
-classes. Current state: https://github.com/Kitteh6660/Corruption-of-Champions-Mod/compare/master...Stadler76:simplify-itemtype-constructor-paramsI've started with
ArmorWithPerk
since I stumbled over it, when pretty-printing and fixing a few bugs inBimboSkirt.as
.ArmorWithPerk
had 22 params andBimboSkirt
-constructor skipped 7 params just to set the last one tofalse
. I wanted to make the whole thing more intuitive and less 'count commas to get to the correct param'. I've designed the 'ParamBuilder' (=ArmorWithPerkBuilder
) as per @aimozg's suggestion.Note, that I'm starting this discussion here, so we have an equivalent variant for all CoC-Mods for better intermod-portability so discuss (and PR?) away :-)
At some point I plan to merge
ArmorWithPerk
andArmor
and move the perk list directly into the parent class (eitherArmor
or to avoid copy&paste, sinceWeaponWithPerk
also exists directly toItemType
), e. G. (As per @Oxdeception's suggestion):