Melee, Spell-casting, Item Use

Published May 08, 2012
Advertisement
SzBQh.jpg

Did some more work on codifying the actions and skills system. I took out the old melee code, and implemented a more general structure for executing an action. All actions are now described by a table of data, and a combatant can be commanded to execute an action. For example, a melee attack currently looks like:



testmelee=
{
movementcost=3,
nocastonblock=true,
needslos=true,
range=1,
animation="Melee",
needstarget=true,
castonself=false,
arearadius=0,
execute=function(self,creator,world,args)
local targetid=world.hex:getObjectID(args.targetx, args.targetz)
if targetid<0 then return end
local target=world.objects:getObject(targetid)
if target==nil then return end
local amount=rnd:getRange(1,20)
world:combatLogMessage("#11 Entity "..creator.guid.." #13 hits #12 Entity "..targetid.." #13 for #10 "..math.abs(amount).." #13 damage.")
target:handleMessage("ModifyLife", {amount=-amount})
end
}


The preliminary data describes how it should be targeted, who it can affect, whether or not it requires an actual target to cast it upon, if it can be cast upon friendlies, how large an area it affects, what the maximum casting range is, movement cost. When the action is actually performed, the execute() function is called.

By contrast, here is the action descriptor for TestFireball:


testspell=
{
movementcost=3,
nocastonblock=true,
needslos=true,
range=-1,
animation="Cast",
needstarget=false,
castonself=false,
arearadius=1,
execute=function(self,creator,world,args)
local target=world.hex:calcTileCenter(args.targetx, args.targetz)
world:spawnTestProjectile(creator, target.x, target.y)
end
}


At this point, it's a simple matter of implementing the various assistant components. Just now I implemented (or re-implemented, I should say, since it's based on the original real-time GC version) the PeriodicAreaHeal component. At the beginning of each round, the periodic entities go first and perform their heartbeat actions. PeriodicAreaHeal pulses a heal out to any friendlies within its radius. In the above screenshot, the area heal has just healed a player unit. PeriodicAreaDamage will operate in a similar fashion. Other components to be re-implemented today include the DirectHeal and DirectDamage components, in order to add an actual damage or heal payload to projectile objects and other types of objects.

I do need to settle down and really put brain to paper on the combat system and character stats. All of that is still the placeholder stuff from the original GC.

I also spent a bit of time working on the ashlands tile set, used for volcanic islands:

rgty6.jpg

Throw some volcanic peaks in there instead of the brown and snow-capped mountains, and render some black, leafless, skeletal tree trunks, and I think it would look pretty good.
0 likes 1 comments

Comments

Giallanon
Where do you find the time to work on this?!?
Since my son was born, I barely have time to sleep and eat...
Anyway, I think you're doing a good job with GC
May 08, 2012 02:11 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement