example game in inform 7, a simple rpg - gladiator

this is a little game in inform 7 that I created in a few days. The only thing that I did not do is the ice bolt. See if you can figure out how to complete the ice bolt in your way, and we'll then see what everyone comes up with!
And now, here is the code.
"the gladiator" by rory michie

dmg is a number variable.
wins is a number variable.
hp is a number variable.
ehp is a number variable.
The arena is a room. "This is the arena, where you can embark on an endless amount of battles, enjoy!".
Understand "won" as checking the amount of wins.
Checking the amount of wins is an action applying to nothing.
[it applies to nothing because it is directed at nothing for those people who don't have good english]
carry out checking the amount of wins:
    say "you have [wins] wins.".
understand "start" as starting.
starting is an action applying to nothing.
carry out starting:
    now ehp is 20;
    say "Duel started! you got put with an enemy with [ehp] hit points. To do a round of the duel, use the duel command.".
understand "duel" as dueling.
Dueling is an action applying to nothing.
[again, applying to nothing means directed at nothing]
Carry out dueling:
    let your damage be a random number between 1 and 5;
    say "You do your attack, and it deals [your damage] damage!";
    decrease ehp by your damage;
    if ehp is less than 1:
        say "you won the battle!";
        increment wins;
        stop the action;
    let edmg be a random number between 1 and 10;
    decrease hp by edmg;
    say "your enemy did their attack and you suffered [edmg] damage!";
    if hp is less than 1:
        say "Your gladiator story is over for now.";
        end the story;
    say "now you have [hp] hit points and the enemy has [ehp].".
instead of dueling when ehp is less than 1, say "There is no enemy for you to kill right now. Use the help command to find out how to play the game.".
understand "help" as wanting help.
Wanting help is an action applying to nothing.
[see above sourcetext]
carry out wanting help:
    say "The only commands necesary in this game are start, to start a duel, duel to take a round of said duel, and of course won to see how many rights to brag you've earned as of yet. And the spells, you get 5 opportunities to use these, are highg for healing, lobie, for lightning bolt, and icaey, for ice bolt.".
understand "lobie" as lb.
Lb is an action applying to nothing.
mana is a number variable.
understand "mana" as checking mana.
Checking mana is an action applying to nothing.
Carry out checking mana:
    Say "You have [mana] mana left.".
mana is 5.
carry out lb:
    decrement mana;
    say "You cast lightning bolt with an arcane word!";
    decrease ehp by 5;
    say "You did 5 damage with the lightning bolt!";
    if ehp is less than 2:
        say "your enemy sizzles from the lightning bolt before falling on the floor - you are victorious!";
        increment wins.
       
        Instead of lb when mana is less than 1, say "You have no mana!".
Instead of lb when ehp is less than 1, say "There is no duel running right now, so this spell would be pointless to cast.".
hp is 100.
understand "highg" as healspell.
healspell is an action applying to nothing.
carry out healspell:
    increase hp by 15;
    decrement mana;
    say "you cast a healing spell with a word of light, and your hp is increased by 15, leaving you with [hp]!".
Instead of healspell when mana is less than 1, say "you have no mana!".
Instead of healspell when ehp is greater than 0, say "You cannot heal yourself in the middle of combat!".
to unlockchecker:
    if wins is 3:
        say "you have unlocked the icaey (ice bolt) spell!".
Admittedly, it's not very clean. But it's just my first real thing in inform 7 and I thought someone might get a use out of it, as well as be able to tell me some better ways I might've been able to do things. I have tested all of the features built in so far and they work without a single flaw.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Reply via email to