Category:Combat (Example)

From IFWiki

Premise

This is a simple starting point for implementing a combat system using D&D-style mechanics. It is also an example of writing an extention to the Inform library, but examples in other languages would be welcome.

  • The 'attack' grammar is extended to allow objects used as weapons.
  • A "bare hands" object is added to serve as a default weapon.
  • Two subroutines are provided to calculate an object's armor class and to determine the damage done by a weapon. These do not make any changes to any object.
  • A replacement AttackSub is provided to "roll the dice" and see what happens. It first rolls a virtual 20-sided die; a '1' is an automatic miss, a '20' is an automatic hit. It then prints out the damage that's inflicted. Note that no changes are made to any object. The story author is responsible for actually tracking the player's health.
  • The story author is also responsible for clothing/armor, i.e. preventing players from wearing eveything they can pick up.

Possible improvements:

  • Code could be added to handle fumbles and critical hits for attack rolls of 1 and 20.
  • Implement a 'health' extension that integrates with this one.

Pages in category "Combat (Example)"

This category contains only the following page.