Good progress on more core infrastructure work; it’s almost a playable game now! Here’s what’s new:

Full attack/defend flow

I’ve fully implemented the meleeAttack action, which support dodging, parrying, blocking, and (if none of those happen) dealing damage.  All of those are hooked into the event/action system, so they fully support buffs (increase to dodge, reduction to parry, etc) and ItemPowers (which are essentially buffs under the covers).  Damage dealt takes the attacker’s wielded weapon into account, and Damage reduction takes the target’s armor into account to determine what %gets through.

The function itself is a bit long; as an example, here’s how Dodging chance is calculated (including Buffs et al)


// First, determine if the target dodges the attack
float dodgeChance = target.Dex * target.Defn.DodgeContributionFromDex / 100f;

// Give the target's dodge modifiers a chance to modify the dodge chance
if (attacker.Events.ContainsKey(EventType.CalculatingDodgeChance))
{
foreach (EventModel evt in attacker.Events[EventType.CalculatingDodgeChance])
{
// The CalculatingDodgeChance Modifier event will modify DodgeChance
evt.ActionInfo.DodgeChance = dodgeChance;
EventMgr.FireEvent(EventType.CalculatingDodgeChance, attacker, attacker, target);
dodgeChance = evt.ActionInfo.DamageAmount;
}
}

// See if the target dodges
if (GameStateRand.Current.NextSingle() < dodgeChance)
{
// Target dodged
target.SetEmote(ObjectEmote.Dodged);
return EventResult.Cancelled;
}

Actor Emotes are in

I’d like to avoid the typical message log found in many roguelikes; one of the challenges is conveying what’s going on without words.  I’m attempting to tackle that in-part with Emotes which appear over Actors.  These are either numbers or bubbled-icons; numbers are used to display damage dealt or healed, and bubbled-icons show a variety of information about the Actor; e.g. they’ve just aggro’ed:

aggro

or Blocked:

block

Parried and dodged have similar icons.  I’ve opted to not put the emote bubble around attack actions, but may change that.  I’m not a huge fan of the visual, but am mostly working to get the infrastructure working right now.  The emote have a nice little bounce effect as well and also fade in/out.

When an actor takes damage or gets healed,  a number emote animates over their head:

num

Basic monster AI

Monsters now have aggro state (binary), and when they see the player they chase and attack.  The mobs’ visibility is correct (e.g. they can’t see the player through walls), and they move intelligently (using A* to get to the player rather than just moving in a straight line).  They aren’t yet smart enough to move around other mobs (just need to figure out how to work that into the algorithm).  The code is prepped for future more intelligent AI as well (using skills to attack, pack AI, etc).

Level-appropriate items

Loot items that are dropped are now level appropriate.  Each ItemDefn defines a min/max level range for the item to drop at; I now precreate a list of items (by rarity)  for each level, and choose from that when picking an item to drop.

Classes now start with equipment

I extended the PlayerClassDefn object to include starting equipment.  I can now specify a comma delimited list of items (by itemId) and they’re automatically given to the player on creation; e.g. this:

startingEquip

… translates into this in the game:

char

All in all, a good day!

 

Advertisements