- implement the getEffectiveness method on the Move class.
- how a type of a Move affects a type of a Pokemon see this chart: http://bulbapedia.bulbagarden.net/wiki/Type/Type_chart (Attack types are on the left and defending types are on the top.) Use whatever generation you see fit.
- design this in various ways. free to choose any design best fits. Below are some of possible ways to implement the method.
Design 1 – Hard-coding the Type relationship
write a giant chain of if else statements. For example, since normal type of attack has multiplier of 1 against normal type of pokemon, the method would contain a if statement checking if move and pokemon both have “NORMAL” type and return 1. And there would be such statement for all possible combinations
Design 2 – Pokemon Type interface
Similar to the Rock Paper Scissors example, instead of using Enumeration to represent Types, create a Type interface and 15 different Type classes the inherit from the Type interface, e.g. Normal would be a class that implements Type interface. And have those individual classes have a method that determine its effectiveness against other Types. And the getEffectiveness method would use the Type classes do the work of determining the effectiveness.
Design 3 – Pokemon Type Chart datatype
Create a set of lookup tables (HashMap) that returns the effectiveness between two types. For example: Map normalAttack = new HashMap<>();
Design 4: free choice