Les Heures du vent

An interactive fiction by Eole (2007) - the Inform 7 source text

Home page

Contents
Previous
Next

Complete text
Chapter 6 - Caractéristiques JDR (for glulx only) [todo]

Understand the command "score" as something new.

A die roll is a kind of value. 3d20+9 specifies a die roll with parts dice, sides (without leading zeros), adds (without leading zeros, optional, preamble optional).

To decide which number is roll of (dr - a die roll):
    let the total be the adds part of dr;
    say "[dr]: ";
    repeat with counter running from 1 to the dice part of dr
    begin;
        let the roll be a random number from 1 to the sides part of dr;
        if the counter is not 1, say ",";
        say the roll;
        increase the total by the roll;
    end repeat;
    if the adds part of dr is 0 and the dice part of dr is 1, decide on the total;
    if the adds part of dr is not 0, say "+", adds part of dr;
    say "=", total;
    decide on the total.

Test rolling is an action out of world applying to one die roll. Understand "dice [die roll]" as test rolling. Carry out test rolling: say "For your own amusement, you roll "; let the outcome be the roll of the die roll understood; say ", making [outcome in words]." [1]


A person has a die roll called capacites. The capacites of a person is usually 4d6+7.
A person has a number called realcapacites. The realcapacites of a person is usually 0.

A person has a number called force. The force of a person is usually 5.
A person has a number called dexterite. The dexterite of a person is usually 5.
A person has a number called volonte. The volonte of a person is usually 5.
A person has a number called intelligence. The intelligence of a person is usually 5.

A person has a number called CCombat. The CCombat of a person is usually 5.

A person has a number called CMagie. The CMagie of a person is usually 5.

A person has a number called PdV. The PdV of a person is usually 20.


[Carry out requesting the score:]
When play begins:
        [roll the capacites of the player;]
    let the totalcapacites be the roll of the capacites of the player;
    now the realcapacites of the player is the totalcapacites;
    let the forceplayer be a random number from 1 to realcapacites of the player;
    [say " forceplayer [forceplayer] ;]
    
    if forceplayer is greater than 12
        begin;
        decrease forceplayer by 5;
        [increase the realcapacites of the player by 5;]
    end if;
    if forceplayer is greater than 7
        begin;
        decrease forceplayer by 2;
        [increase the realcapacites of the player by 2;]
    end if;
    if forceplayer is less than 3
        begin;
        increase forceplayer by 2;
        decrease the realcapacites of the player by 2;
    end if;
    
    now the force of the player is the forceplayer;
    now the realcapacites of the player is the realcapacites of the player - forceplayer;
    
    let the dexteriteplayer be a random number from 1 to realcapacites of the player;
    [say " dexteriteplayer [dexteriteplayer] ;]
        if dexteriteplayer is greater than 12
        begin;
        decrease dexteriteplayer by 5;
        [increase the realcapacites of the player by 5;]
    end if;
        if dexteriteplayer is greater than 7
        begin;
        decrease dexteriteplayer by 2;
        [increase the realcapacites of the player by 2;]
    end if;
    if dexteriteplayer is less than 3
        begin;
        increase dexteriteplayer by 2;
        [decrease the realcapacites of the player by 2;]
    end if;
    
    now the dexterite of the player is the dexteriteplayer;
    now the realcapacites of the player is the realcapacites of the player - dexteriteplayer;
    
    let the volonteplayer be a random number from 1 to realcapacites of the player;
    [say " volonteplayer [volonteplayer];]
    if volonteplayer is greater than 12
        begin;
        decrease volonteplayer by 5;
        [increase the realcapacites of the player by 5;]
    end if;
        if volonteplayer is greater than 7
        begin;
        decrease volonteplayer by 2;
        [increase the realcapacites of the player by 2;]
    end if;
    if volonteplayer is less than 3
        begin;
        increase volonteplayer by 2;
        [decrease the realcapacites of the player by 2; ]
    end if;
    
    now the volonte of the player is the volonteplayer;
    now the realcapacites of the player is the realcapacites of the player - volonteplayer;
    
    let the intelligenceplayer be the realcapacites of the player;
    [say " intelligenceplayer [intelligenceplayer];]
        if intelligenceplayer is less than 3
        begin;
        increase intelligenceplayer by 2;
            if force of the player is greater than dexterite of the player and force of the player is greater than volonte of the player
            begin;
            decrease the force of the player by 2;
            otherwise;
            if dexterite of the player is greater than force of the player and dexterite of the player is greater than volonte of the player
                begin;
                decrease the dexterite of the player by 2;
                otherwise;
                decrease the volonte of the player by 2;
                end if;
            end if;
    end if;

        if intelligenceplayer is less than 3
        begin;
        increase intelligenceplayer by 2;
            if force of the player is greater than dexterite of the player and force of the player is greater than volonte of the player
            begin;
            decrease the force of the player by 2;
            otherwise;
            if dexterite of the player is greater than force of the player and dexterite of the player is greater than volonte of the player
                begin;
                decrease the dexterite of the player by 2;
                otherwise;
                decrease the volonte of the player by 2;
                end if;
            end if;
    end if;

    if intelligenceplayer is greater than 9
        begin;
        increase the volonte of the player by 1;
        decrease intelligenceplayer by 3;
            if force of the player is greater than dexterite of the player and force of the player is greater than volonte of the player
            begin;
            increase the force of the player by 2;
            otherwise;
            if dexterite of the player is greater than force of the player and dexterite of the player is greater than volonte of the player
                begin;
                increase the dexterite of the player by 2;
                otherwise;
                increase the volonte of the player by 2;
                end if;
            end if;
    end if;
        

    now the intelligence of the player is the intelligenceplayer;
    now the realcapacites of the player is the realcapacites of the player - intelligence of the player;
    
    now the CCombat of the player is (the force of the player + the dexterite of the player) / 2;
    let moduloCC be the remainder after dividing (the force of the player + the dexterite of the player) by 2;
    if moduloCC is not 0, increase the CCombat of the player by 1;

    now the CMagie of the player is (the volonte of the player + the intelligence of the player) / 2;
    let moduloCM be the remainder after dividing (the volonte of the player + the intelligence of the player) by 2;
    if moduloCM is not 0, increase the CMagie of the player by 1;
    
    now the PdV of the player is force of the player + dexterite of the player + intelligence of the player + volonte of the player;
    say "".
    
Carry out requesting the score:
    [say "[line break]capacités restantes : [realcapacites of the player];]
    say "[line break][line break]Force : [force of the player]";
    say "[line break]Dextérité : [dexterite of the player]";
    say "[line break]Volonté : [volonte of the player]";
    say "[line break]Intelligence : [intelligence of the player]";
    say "[line break][line break]Capacité de Combat : [CCombat of the player]";
    say "[line break]Capacité de Magie : [CMagie of the player]";
    say "[line break]Points de Vie : [PdV of the player][line break]".

Note

[1]. We added the pointless verb "roll" as a harmless convenience for testing that die rolls work: if the player types "ROLL 3D6+2", the game might reply "For your own amusement, you roll 3d6+2: 2,5,4+2=13, making thirteen."