CellEffects were previously created in code similar to this:

<pre><span style="font-family: Menlo;"> // Add poisonpit
 CellEffectTriggerEventDefn eventDefn = new CellEffectTriggerEventDefn(true);
 ActionInfo effectAction = Action_TakeDamageModel.GenerateActionInfo(1);
 GameDefinition.CellEffectDefns["poisonpit1"] = new CellEffectDefn("poisonpit1", eventDefn, effectAction);

 // Add firepit
 eventDefn = new CellEffectTriggerEventDefn(true);
 GameDefinition.BuffDefns["burning1"] =new BuffDefn()
     ActionInfo = Action_TakeDamageModel.GenerateActionInfo(2),
     InitialDuration = 4,
     HasLimitedLifetime = true,
     Name = "Burning",
     Id = "burning1",
     BuffTileId = "burningbuff",
 effectAction = Action_ApplyBuffModel.GenerateActionInfo(GameDefinition.BuffDefns["burning1"]);

 GameDefinition.CellEffectDefns["firepit1"] = new CellEffectDefn("firepit1", eventDefn, effectAction);</span>

Now, those are read from the xlsx like this:


The code reads in the text and parses it using XmlReader to generate the event/action pairs which are attached to an OnCellEntered event on the Cell with the CellEffect.  The parsing was a little challenging because the event/actions can be recursive; the “evilGodShrine” cellEffect above demonstrates that: when an actor enters a cell with that effect, it generates an ApplyBuff action (“Evil Blessing”) which lasts 20 turns and when the actor has moved (event OnMoved), there’s a 5% chance that it will ApplyBuff another buff called “healing” that lasts for 3 turns and every turn (event OnWorldTurn) performs a Heal action on the actor for 10 HP.

Here’s what it looks like after the sub-buff has fired – both buffs are in the buff bar and counting down:


Holy cow, it worked!

This will enable me to add a ton of different CellEffects without touching code.  The same infrastructure will be used for other game features such as Skills and Item powers (e.g. giving the player a buff on equip).  I’m cautiously optimistic that it’ll be fairly easy to add those…