KajiTetsushi / HomeworldSDL

Other
4 stars 1 forks source link

Generic volley fire and ammunition behaviors #22

Open KajiTetsushi opened 4 years ago

KajiTetsushi commented 4 years ago

To create a common module which can be reused by any ship carrying missile launching weapons, including volley fire.

Found out while implementing #19 that the MissileDestroyer and P1MissileCorvette actually have very, very similar behaviors. The only difference lies in the common attack methods and, in particular, the special attack target method. Perhaps it's possible to combine these items into one common module which can be reused.

KajiTetsushi commented 3 years ago

carrying missile launching weapons

After some reviewing, the associated behaviors are just a collection of two abstract features: volley fire special ability and ammunition management. Then these two features are combined with missile launchers to make up the full volley fire missiles logic.

Those two features should be written as isolated modules for very good reasons:

  1. The volley fire ability, as is, is actually limited to GUN_MissileLauncher via an if-else filter. If the user decides to assign this to a kinetic weapon, then the ability can't work. This could be liberated, with the choice of enabling the ability given to the user to decide.
  2. The ammunition management is shared by GUN_MissileLauncher and GUN_MineLauncher, which means that ammunition is weapons-agnostic in the first place.