View Javadoc

1   // %1283121044:hoplugins.trainingExperience.constants%
2   package hoplugins.trainingExperience.constants;
3   
4   import hoplugins.Commons;
5   
6   import plugins.ISpieler;
7   
8   import java.awt.Color;
9   
10  
11  /***
12   * Class that manages all the relation of Skills
13   *
14   * @author <a href=mailto:draghetto@users.sourceforge.net>Massimiliano Amato</a>
15   */
16  public class Skills {
17      //~ Methods ------------------------------------------------------------------------------------
18  
19      /***
20       * TODO Missing Method Documentation
21       *
22       * @param position TODO Missing Method Parameter Documentation
23       *
24       * @return TODO Missing Return Method Documentation
25       */
26      public static int getSkillAtPosition(int position) {
27          switch (position) {
28              case 0:
29                  return ISpieler.SKILL_TORWART;
30  
31              case 1:
32                  return ISpieler.SKILL_SPIELAUFBAU;
33  
34              case 2:
35                  return ISpieler.SKILL_PASSSPIEL;
36  
37              case 3:
38                  return ISpieler.SKILL_FLUEGEL;
39  
40              case 4:
41                  return ISpieler.SKILL_VERTEIDIGUNG;
42  
43              case 5:
44                  return ISpieler.SKILL_TORSCHUSS;
45  
46              case 6:
47                  return ISpieler.SKILL_STANDARDS;
48  
49              case 7:
50                  return ISpieler.SKILL_KONDITION;
51  
52              case 8:
53                  return ISpieler.SKILL_EXPIERIENCE;
54          }
55  
56          return 0;
57      }
58  
59      //    /*** Keeper Skill Constant */
60      //    public static final int KEEPER = 0;
61      //
62      //    /*** Playmaking Skill Constant */
63      //    public static final int PLAYMAKING = 1;
64      //
65      //    /*** Passing Skill Constant */
66      //    public static final int PASSING = 2;
67      //
68      //    /*** Winger Skill Constant */
69      //    public static final int WING = 3;
70      //
71      //    /*** Defense Skill Constant */
72      //    public static final int DEFENSE = 4;
73      //
74      //    /*** Scoring Skill Constant */
75      //    public static final int ATTACK = 5;
76      //
77      //    /*** SetPieces Skill Constant */
78      //    public static final int SETPIECES = 6;
79      //
80      //    /*** Stamina Skill Constant */
81      //    public static final int STAMINA = 7;
82      //
83      //    /*** Stamina Skill Constant */
84      //    public static final int EXPERIENCE = 8;
85  
86      /***
87       * Returns the base training type for that skill
88       *
89       * @param skillIndex skill to train
90       *
91       * @return base training type for that skill
92       */
93      public static Color getSkillColor(int skillIndex) {
94          switch (skillIndex) {
95              case ISpieler.SKILL_TORWART:
96                  return Color.BLACK;
97  
98              case ISpieler.SKILL_SPIELAUFBAU:
99                  return Color.ORANGE.darker();
100 
101             case ISpieler.SKILL_PASSSPIEL:
102                 return Color.GREEN.darker();
103 
104             case ISpieler.SKILL_FLUEGEL:
105                 return Color.MAGENTA;
106 
107             case ISpieler.SKILL_VERTEIDIGUNG:
108                 return Color.BLUE;
109 
110             case ISpieler.SKILL_TORSCHUSS:
111                 return Color.RED;
112 
113             case ISpieler.SKILL_STANDARDS:
114                 return Color.CYAN.darker();
115 
116             case ISpieler.SKILL_KONDITION:
117                 return new Color(85, 26, 139);
118         }
119 
120         return Color.BLACK;
121     }
122 
123     /***
124      * Returns the String description of this skill
125      *
126      * @param skillIndex the skill code
127      *
128      * @return String description of the skill
129      */
130     public static String getSkillDescription(int skillIndex) {
131         // Based on the code returns the proper ho property
132         switch (skillIndex) {
133             case ISpieler.SKILL_TORWART:
134                 return Commons.getModel().getResource().getProperty("Torwart"); //$NON-NLS-1$
135 
136             case ISpieler.SKILL_SPIELAUFBAU:
137                 return Commons.getModel().getResource().getProperty("Spielaufbau"); //$NON-NLS-1$
138 
139             case ISpieler.SKILL_PASSSPIEL:
140                 return Commons.getModel().getResource().getProperty("Passpiel"); //$NON-NLS-1$
141 
142             case ISpieler.SKILL_FLUEGEL:
143                 return Commons.getModel().getResource().getProperty("Fluegelspiel"); //$NON-NLS-1$
144 
145             case ISpieler.SKILL_VERTEIDIGUNG:
146                 return Commons.getModel().getResource().getProperty("Verteidigung"); //$NON-NLS-1$
147 
148             case ISpieler.SKILL_TORSCHUSS:
149                 return Commons.getModel().getResource().getProperty("Chancenverwertung"); //$NON-NLS-1$
150 
151             case ISpieler.SKILL_STANDARDS:
152                 return Commons.getModel().getResource().getProperty("Standards"); //$NON-NLS-1$
153 
154             case ISpieler.SKILL_KONDITION:
155                 return Commons.getModel().getResource().getProperty("Kondition"); //$NON-NLS-1$
156 
157             case ISpieler.SKILL_EXPIERIENCE:
158                 return Commons.getModel().getResource().getProperty("Erfahrung"); //$NON-NLS-1$
159         }
160 
161         return ""; //$NON-NLS-1$
162     }
163 
164     /***
165      * Returns the Skill value for the player
166      *
167      * @param spieler
168      * @param skillIndex constant index value of the skill we want to see
169      *
170      * @return The Skill value or 0 if the index is incorrect
171      */
172     public static int getSkillValue(ISpieler spieler, int skillIndex) {
173         switch (skillIndex) {
174             case ISpieler.SKILL_TORWART:
175                 return spieler.getTorwart();
176 
177             case ISpieler.SKILL_SPIELAUFBAU:
178                 return spieler.getSpielaufbau();
179 
180             case ISpieler.SKILL_PASSSPIEL:
181                 return spieler.getPasspiel();
182 
183             case ISpieler.SKILL_FLUEGEL:
184                 return spieler.getFluegelspiel();
185 
186             case ISpieler.SKILL_VERTEIDIGUNG:
187                 return spieler.getVerteidigung();
188 
189             case ISpieler.SKILL_TORSCHUSS:
190                 return spieler.getTorschuss();
191 
192             case ISpieler.SKILL_STANDARDS:
193                 return spieler.getStandards();
194 
195             case ISpieler.SKILL_KONDITION:
196                 return spieler.getKondition();
197 
198             case ISpieler.SKILL_EXPIERIENCE:
199                 return spieler.getErfahrung();
200         }
201 
202         return 0;
203     }
204 
205     /***
206      * Returns the base training type for that skill
207      *
208      * @param skillIndex skill to train
209      *
210      * @return base training type for that skill
211      */
212     public static int getTrainedSkillCode(int skillIndex) {
213         switch (skillIndex) {
214             case ISpieler.SKILL_TORWART:
215                 return ISpieler.TORWART;
216 
217             case ISpieler.SKILL_SPIELAUFBAU:
218                 return ISpieler.SPIELAUFBAU;
219 
220             case ISpieler.SKILL_PASSSPIEL:
221                 return ISpieler.PASSPIEL;
222 
223             case ISpieler.SKILL_FLUEGEL:
224                 return ISpieler.FLUEGELSPIEL;
225 
226             case ISpieler.SKILL_VERTEIDIGUNG:
227                 return ISpieler.VERTEIDIGUNG;
228 
229             case ISpieler.SKILL_TORSCHUSS:
230                 return ISpieler.CHANCENVERWERTUNG;
231 
232             case ISpieler.SKILL_STANDARDS:
233                 return ISpieler.STANDARDS;
234 
235             case ISpieler.SKILL_KONDITION:
236                 return ISpieler.KONDITION;
237         }
238 
239         return 0;
240     }
241 }