Adding Plays/Skills to the System

Adding a Play:

Once a play is created, there are three things that must be done to add it to the system:

  1. You must include your header file into PlayIncludes.h
  2. You must create your play, by calling its constructor in playbook.cpp
  3. You must initialize the playNum integer in RegisterPlays.cpp

As you can see, the process for adding new plays is identical to that of adding new skills, it just involves different files.  One difference to be aware of, however, is that there are different categories of plays (2001, 2002, skill plays, etc).  So you must make sure you are adding your play to the correct category.  The actual order only matters in RegisterPlays.cpp, when the play numbers are handed out, but it's good to be consistent.
Using the example of StupidSkillTest (a skill test play), we will walk through each of these steps.
First, add the include line into PlayIncludes.h:

#include "skillPlays/InterceptBallSkill_Test.h"
#include "skillPlays/TightDefenseSpecialOpDSkill_Test.h"
#include "skillPlays/StupidSkill_Test.h"
//-----

Next, add the constructor into playbook.cpp:

playbook[TurnAndKickSkillTest::playNum] = new TurnAndKickSkillTest(vision);
playbook[TightDefenseSpecialOpDSkillTest::playNum] = new TightDefenseSpecialOpDSkillTest(vision);
playbook[StupidSkillTest::playNum] = new StupidSkillTest(vision);

Finally, add the playNum initialization into RegisterPlays.cpp:

TurnAndKickSkillTest::playNum=numPlays++;
TightDefenseSpecialOpDSkillTest::playNum=numPlays++;
StupidSkillTest::playNum=numPlays++;
END_JOEL_SKILL_TEST_PLAYS=numPlays++;
//----

Now your play is present in the system.  When you run the AI, it should show up under the plays menu.

Adding a Skill:

Once your skill is created, there are three things that must be done to add it to the system:

  1. You must include your header file into SkillSetIncludes.h
  2. You must create your skill, by calling its constructor in SkillSet.cpp
  3. You must initialize the skillNum integer in RegisterSkillz.cpp

Using the example of StupidSkill, we will walk through each of these steps.
First, add the include line into SkillSetIncludes.h:

#include "CreatorCreateSkill.h"
#include "SpecialOpBlockSkill.h"
#include "StupidSkill.h"
//-----

Next, add the constructor into SkillSet.cpp:

skillArray[CreatorCreateSkill::skillNum] = new CreatorCreateSkill(rp, vm, strategy, id, this);
skillArray[SpecialOpBlockSkill::skillNum] = new SpecialOpBlockSkill(rp, vm, strategy, id, this);
skillArray[StupidSkill::skillNum] = new StupidSkill(rp, vm, strategy, id, this);
//-----

Finally, add the skillNum initialization into RegisterSkillz.cpp:

PassBlockSkill::skillNum = numSkillz++;
ShotBlockSkill::skillNum = numSkillz++;
StupidSkill::skillNum = numSkillz++;
//--

Now your skill is present in the system and can be called by other skills and plays.