Kitteh6660 / Corruption-of-Champions-Mod

CoC source from fenoxo, modded by Kitteh6660
232 stars 97 forks source link

[WIP] Simplifying ItemType constructor params #1340

Open Stadler76 opened 6 years ago

Stadler76 commented 6 years ago

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-params

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>();