Skip to content

Adding an Ability to MUDServer

Jeremy Harton edited this page Sep 29, 2013 · 1 revision

modify 'Abilities.java': Add a new Enum value (all caps) for the desired ability

ex. To add an ability called Luck, add 'LUCK' to the inside of the Enum declaration

modify 'Skill.java': Add an entry in the 'abilityMap' field consisting of a short, all caps, form of the ability name (use the whole name if it's less than five characters).

ex. include the line 'put("LUCK", Abilities.LUCK);' in the instantiation of the
'abilityMap' HashMap

modify 'Skills.java': Change any skills ability field in the static instance of the Skill constructor for whichever skill you want to have the new ability as it's key ability

ex. change the following:
'public static final Skill BLUFF = new Skill("Bluff", 2, "CHA", new PClass[] { Classes.BARD, Classes.ROGUE, Classes.SORCERER });'
to
'public static final Skill BLUFF = new Skill("Bluff", 2, "LUCK", new PClass[] { Classes.BARD, Classes.ROGUE, Classes.SORCERER });'

modify 'Player.java': Increase the size of the '_STATS' variable (an array of base values for abilities) to include space for the new ability and assign a pre-defined default value. Next, modify the constructors to assign the player a value for that ability in their 'stats' HashMap. Last, modify the statMod array in a like manner to the first, excepting that it doesn't need to be manually initialized.


Now that you're done doing that, customize the rest of code to use the new ability, as you see fit.

Clone this wiki locally