![]() |
The Reliques of Tolti-AphAn interactive fiction by Graham Nelson (2005) - the Inform 7 source text |
| Home page Contents Previous Next Complete text | Section 3(e) - Damage
The damage incurred is a number that varies. Calculating damage modifiers of something is an activity. For calculating damage modifiers of a person (called the defender): if the defender is wearing armour (called the protector) and the damage incurred is greater than 1 begin; say ": [the protector] absorbs "; let the absorbency be the armour class of the protector; if the absorbency >= the damage incurred begin; let the absorbency be the damage incurred; decrease the absorbency by 1; end if; decrease the damage incurred by the absorbency; say the absorbency; end if; continue the activity. For calculating damage modifiers of a person (called the defender): if the defender is affected by ironbones and the damage incurred is greater than 1 begin; say ": the ironbones spell halves the damage"; change the damage incurred to the damage incurred divided by 2; end if; continue the activity. Dead body disposal of something is an activity.[1] To make (defender - a person) take (hits - a number) points of damage: let the original hits be the hits; change the damage incurred to the hits; carry out the calculating damage modifiers activity with the defender; let the hits be the damage incurred; if the hits <= 0 begin; say " - so no damage is done."; stop; end if; if the original hits are not the hits, say ", leaving [hits] to take"; decrease the strength of the defender by the hits; if the defender is killed begin; say " - a fatal blow!"; if the player is the defender begin; end the game saying "You have been killed in combat"; stop; end if; carry out the dead body disposal activity with the defender; if the defender is in the location, remove the defender from play; award the permanent strength of the defender points; repeat with the item running through things which are had by the defender begin; move the item to the location; end repeat; otherwise; if the player is the defender, say ", reducing your strength to [strength of the player]."; otherwise say ", wounding [the defender] to a strength of [strength of the defender]."; end if. |