Wednesday, August 19, 2009

Dungeon Combat System: 33% Complete!

Hazzah! I have completed the hardest part of the system: Determining who attacks first, collecting a large script together from each combatant to determine the damage dealt and other such effects, and displaying the output for the player to read.

Zombah! strikes voodooKobra with his fist for 2 damage.
Zombah! strikes voodooKobra with his fist for 1 damage.
Generic Cohort strikes Zombah! with his fist for 4 damage.


<?php
$GCHAR["d_data"]->player->hp -= 2;
$GCHAR["d_data"]->player->hp -= 1;
$GCHAR["d_data"]->cohort[0]->hp -= 4;
?>


Both of the above are generated by the server and executed in a single battle turn. You wouldn't believe how difficult I've made the process by which the server generates this in the name of flexibility, and the entire thing only clocks in at about 32 KB so far, but that's still a lot of code. And I'm not an efficient programmer, either.

Still to do:

  • Attack rolls, AC, etc.
  • Saving throws
  • Display the combat interface
  • Interpret player input
  • Specify -1 as the flag for "attack all enemies" and make it work
  • Spell effects
  • Appending to $COMBAT["script"]


Then, I'll move on to leveling up and character development, and FINALLY begin the dungeon itself. You guys are gonna love it!

2 comments: