Adding Items has caused this domino effect of changes, culminating in a re-think of the Event/Action system.  I think I’ve finally wrapped my head around how to do it and I’m hoping to get that coded up in the next couple of days.  Once that’s in, I should be able to get back to a rhythm of more granular daily code drops.  That’s the goal, anyways :).

With the Event/Action system, I want to be able to create a set of codified Actions such as “OpenDoor”, “Heal”, “Teleport”, “Identify”, “Move”, etc, and I then want those Actions to both fire Events (“Action foo was performed”) and to themselves be fired by Events. Here are some examples:

Weapon action:

      <Weapon Id="Mace2H10" Name="Slotted Sledge" Subclass="Mace (2h)" WeaponPower="192" Rarity="Uncommon" ItemLevel="33" Level="28-35" Tile="Hammer02" Description="" >
        <Event EventName="TargetHit" OddsOfFiring="0.1" Description="Cracks appear in {Targets} armor">
          <ApplyBuff Buff="DecreaseStat" Name="Sundered" Tile="XXX" Duration="10" Stat="AC" Amount="15%"/>
        </Event>
      </Weapon>

Skill action:

    <Skill Id="PriestB" Level="1" Name="Teleport Monster" Description="teleport 'em" Tile="Scroll0001"  >
      <Event EventName="SkillUsed">
        <Teleport Target="AreaOfEffect" Duration="3" AoeRadius="2" Start="Delayed" Range="4" />
      </Event>
    </Skill>

Complex action:
The following gives Mages a level 8 skill called “Ice Floor” that, when used, adds a “CellEntered” event handler to nearby Cells that, when entered, adds a debuff to the Actor that entered the Cell that slows them down.

  <Mage>
    <Skill Id="Mage15" Level="8" Name="Ice Floor" Tile="Scroll0013" Description="Bzzap!">
      <Event EventName="SkillUsed">
        <ApplyCellEffect Duration="5" AoeRadius="3">
          <CellEffect Tile="L1_Terrain054" Description="Icy slow zone">
            <Event EventName="CellEntered">
              <ApplyBuff Buff="DecreaseStat" Name="Icy" Tile="Buff_Held" Duration="9" Stat="Movement" Amount="-50" Description="{Performer} {isare} slowed!" />
            </Event>
          </CellEffect>
        </ApplyCellEffect>
      </Event>
    </Skill>
  </Warrior>

In my old codebase I had separated the concepts of Events, Actions (“open door”), and Abilities (“heal”). This time around I’m merging those latter two concepts, as I want Events to be able to work with both. For example: I could have an engineered “maze” level where certain Cells have CellEntered event handlers that trigger OpenDoor Events on other Cells.

Random side notes:

  • Have special engineered “puzzle” subdungeons that have rare/unique items. These subdungeons rarely appear, but when they do the player can enter them to try to get the reward; when they die in these subdungeons, they don’t lose the entire dungeon, just pop back out of the subdungeon. Subdungeons disappear after being tried once.
  • In an ideal world, have a separate “puzzle rogue” mode that’s made up of a bunch of puzzles to try. Even better: enable other folks to create and share their own puzzles. Given a fairly small number of Actions, the Event/Action system will be flexible enough to enable people to create things I couldn’t think of myself…

Still no code today as I’m working through all that infrastructure. Hopefully tomorrow!

Advertisements