The Reliques of Tolti-Aph

An interactive fiction by Graham Nelson (2005) - the Inform 7 source text

Home page

Contents
Previous
Next

Complete text
Section 3(d) - Combat-readiness

To decide whether combat proceeds:
    if a hostile alive monster (called the baddie) is in the location, decide yes;
    decide no.

Before reading a command:
    if combat proceeds, change the command prompt to "Combat> ";
    otherwise change the command prompt to "> ".

After waiting when combat proceeds: stop the action.

Check going (this is the need a saving roll to retreat rule):
    if combat proceeds
    begin;
        if a saving roll of 11 by the player to "disengage from the fight" is made, continue the action;
        say "So you are unable to break away." instead;
    end if.

Check casting (this is the can't cast non-combat spells in combat rule):
    let the warlike nature be the nature of the spell understood;
    if the warlike nature is defensive, let the warlike nature be offensive;
    if combat proceeds and the warlike nature is not offensive
    begin;
        say "The nature of that spell is [nature of the spell understood]: unlike offensive and defensive spells - which are structured for use in combat - [nature of the spell understood] spells need a little peace and calm to be cast." instead;
    end if.

A person can be surprised or ready. A person is usually ready.

Instead of attacking a monster:
    if the noun is hostile, say "You are already locked in combat." instead;
    now the noun is hostile;
    now the noun is surprised;
    now the player is ready;
    say "You make a surprise attack on [the noun]!" instead.

To mount an attack from (bad guy - a monster):
    now the bad guy is hostile;
    now the bad guy is ready;
    now the player is surprised;
    say "[The bad guy] attacks!"

Every turn when a hostile monster is in the location:
    if the player is ready, make the player strike a blow against the scariest hostile monster in the location;[1]
    repeat with the opponent running through hostile monsters in the location
    begin;
        if the player is killed, stop;
        if the opponent is ready
        begin;
            if Zoorl is in the location, make the opponent strike a blow against Zoorl;
            otherwise make the opponent strike a blow against the player;
        end if;
    end repeat;
    now the player is ready;
    now all hostile monsters are ready.

Note

[1]. Recall that "scary" was defined in 3(a) above: "scariest" automatically acquires the meaning of "that which is most scary".