Computer Science Canada

Battle Test!

Author:  Remm [ Tue Aug 15, 2006 7:47 pm ]
Post subject:  Battle Test!

Alright, This is the battle test for a RPG or whatever. The basis is down, even with poison / burn / shielding working (can be seen with the burn, easy to manipulate)
Anyways, Its you, Mr Hack N slash VRS the mage. I will make a second spellcaster class open along with more elaborate skills in due time, but for now, I would like to see what you think of my system.

The wait system is similar to MGA/MGA2 's cost system, where each action adds t your WP (wait points), and such determines the turn order. Do somthing with more WP, and your opponent may be able to get in multiple attacks, and vice versa.
Scan feature is in, so I suggest using it to see your opponents health/wait points, so you can plan your attack accordingly. Not much to plan, seeing as how there is a whopping two skills for the user.
In new version, the screen will be bigger, yes. For now, it is at the MGF seal size.

Feedback wanted.
Oh, and not a process in sight. Wink

(Code on below post)

Edit: Fixxed the Win/loss requirements. Hehe now how'd I miss that...

Edit: Heh. put the v back in the very first var statement. Bad C/P edit >.<

Author:  Remm [ Thu Aug 17, 2006 9:39 am ]
Post subject: 

Seeing as how im getting just soooo much feedback, I feel it is time I updated my code, using ALL of those WONDERFUL ideas you gave me .

Anyways, Changes:
==>New skill choosing system, a grand total of 6 skills(not including scan), one doesnt do anything though, but dont worry, it will in the future.

==> Window size

==> A few minor fixes that I cant really remember...

To come in the near future:

==> More skills

==> More enimies

==> Leveling system

==> mana system (this will mean spells // heal will be buffed, at the expense of being only able to cast when you have sufficient mana)

==> Changing keys from a) b) c) ect.. to 1) 2) 3) for easier use.

-----------
I would have done these before sending out theis version, but regretably I have recieved next to no feedback, so I have yet to know what other people think about it. I would rather not get too in depth if no-one even cares for it. Code has been reposted here.

code:

var p :
    record
        healing : real
        w : real
        dtaken : real
        sdtaken : real % self-damage taken
        hp : int
        wpp : real % Wait point plus
        wi : real % wait Increase
        wd : real % wait Decrease
    end record

var e :
    record
        healing : real
        w : real
        dtaken : real
        hp : int
        wpp : real
        wi : real
        wd : real
    end record

var start, chooser, win1, achance, rchance, fchance : int
var scan, badburn, goodburn, regencheck : boolean
var hpcheck, badburntime, goodburntime, regentime : int
var normal, ranged, frenzy, regen, master, sflame : boolean
procedure STATS
    if (scan = true) then
        locatexy (55, maxy - 10)
        put "Player's WP: ", p.w
        locatexy (55, maxy - 20)
        put "Player's HP: ", p.hp
        locatexy (250, maxy - 10)
        put "Target's WP: ", e.w
        locatexy (250, maxy - 20)
        put "Target's HP: ", e.hp
        color (brightred)
        color (brightred)
        put "=============================================================="
        color (black)
    elsif (scan = false) then
        locatexy (55, maxy - 10)
        put "Player's WP: ", p.w
        locatexy (55, maxy - 20)
        put "Player's HP: ", p.hp
        locatexy (250, maxy - 10)
        put "Target's WP: ??"
        locatexy (250, maxy - 20)
        put "Target's HP: ??"
        color (brightred)
        put "=============================================================="
        Draw.ThickLine (0, 0, maxx, 0, 5, black)
        Draw.ThickLine (0, maxy, maxx, maxy, 5, black)
        color (black)
    end if
end STATS
%=============
procedure PLAYER
    var key : string (1)
    e.dtaken := 0
    p.wpp := 0
    p.sdtaken := 0
    color (black)
    put "a) Scan - 6  WP"
    color (blue)
    put "   Shows target's WP and HP."
    if (normal = true) then
        color (black)
        put ""
        put "b) Normal Attack - 12 WP"
        color (blue)
        put "   Basic, reliable attack. 5-11 DMG"
    elsif (ranged = true) then
        color (black)
        put ""
        put "b) Ranged Attack   - 13 WP"
        color (blue)
        put "   Standard Ranged Attack. 6-14 DMG"
        put "   However, a 20% Chance to Miss"
    elsif (frenzy = true) then
        color (black)
        put ""
        put "b) Frenzied Slash - 25 WP"
        color (blue)
        put "   Attacks with wild speed. 3-6 DMG"
        put "   66% Chance to reduce WP by 20."
    end if

    if (regen = true) then
        color (black)
        put ""
        put "c) Regeneration - 18 WP"
        color (blue)
        put "   Heals you for 2 hp for every 1 wait over"
        put "   a period of 6-14 wait. (Stacks)."
    elsif (master = true) then
        put ""
        color (black)
        put "c) Ice Mastery"
    elsif (sflame = true) then
        put ""
        color (black)
        put "c) Searing Flame - 18 WP"
        color (blue)
        put "   Deals 1-3 damage and " ..
        color (brightred)
        put "burns" ..
        color (blue)
        put " for another"
        put "   4-16 wait."
    end if
    color (red)
    put ""
    put "Choose A Spell \\ Skill"
    color (blue)
    loop
        getch (key)
        if (key = "a") or (key = "A") then
            if (scan = true) then
                put "You have already scanned the Target.."
                getch (key)
                exit
            elsif (scan = false) then
                scan := true
                p.wpp := p.wpp + 6
                put "You scan the Target."
                getch (key)
                exit
            end if
        elsif (key = "b") or (key = "B") then
            if (normal = true) then
                e.dtaken := e.dtaken + Rand.Int (5, 11)
                p.wpp := p.wpp + 12
                put "You hit Target for ", e.dtaken, " Dmg."
                getch (key)
                exit
            elsif (ranged = true) then
                rchance := Rand.Int (1, 10)
                if (rchance = 1) or (rchance = 2) then
                    put "You Miss!"
                    p.wpp := p.wpp + 13
                    getch (key)
                    exit
                else
                    e.dtaken := e.dtaken + Rand.Int (6, 14)
                    p.wpp := p.wpp + 13
                    put "You hit Target for ", e.dtaken, " Dmg."
                    getch (key)
                    exit
                end if
            elsif (frenzy = true) then
                fchance := Rand.Int (1, 3)
                if (fchance = 1) then
                    p.wpp := p.wpp + 25
                    e.dtaken := e.dtaken + Rand.Int (3, 6)
                    put "You hit Target for ", e.dtaken, " Dmg."
                    getch (key)
                    exit
                else
                    p.wpp := p.wpp + 5
                    e.dtaken := e.dtaken + Rand.Int (3, 6)
                    put "You hit Target for ", e.dtaken, " Dmg."
                    put "Your WP has been reducde by 20!"
                    getch (key)
                    exit
                end if
            end if
        elsif (key = "c") or (key = "C") then
            if (regen = true) then
                regentime := regentime + Rand.Int (6, 14)
                regencheck := true
                p.wpp := p.wpp + 18
                put "You Cast Regeneration."
                put "You will regenerate for ", regentime, " WP"
                getch (key)
                exit
            elsif (master = true) then
                p.wpp := p.wpp + 3
                put "This skill is Passive..."
                getch (key)
                exit
            elsif (sflame = true) then
                p.wpp := p.wpp + 18
                goodburn := true
                goodburntime := goodburntime + Rand.Int (4, 16)
                e.dtaken := e.dtaken + Rand.Int (1, 3)
                put "You hit Target for ", e.dtaken, " Dmg."
                put "Target is now burning."
                getch (key)
                exit
            end if
        end if
        color (black)
    end loop
end PLAYER
%=============
procedure TARGET
    e.wpp := 0
    p.dtaken := 0
    p.wi := 0
    e.healing := 0
    hpcheck := e.hp
    var clicky : string (1)
    color (black)
    put "Target's Turn:"
    delay (350)
    achance := Rand.Int (1, 5)
    if (achance = 1) then
        e.wpp := e.wpp + 23
        p.wi := p.wi + 7
        p.dtaken := p.dtaken + Rand.Int (4, 12)
        color (red)
        put "Target Casts Frost Burst."
        getch (clicky)
        put ""
        color (blue)
        put "You take ", p.dtaken, " Dmg."
        put "Your WP increases by ", p.wi
        getch (clicky)
    elsif (achance = 2) or (achance = 3) then
        e.wpp := e.wpp + 12
        p.dtaken := p.dtaken + Rand.Int (2, 6)
        color (red)
        put "Target attacks you normally."
        color (blue)
        put ""
        getch (clicky)
        put "You take ", p.dtaken, " Dmg."
        getch (clicky)
    elsif (achance = 4) then
        if (hpcheck < 60) then
            e.healing := e.healing + Rand.Int (1, 40)
            e.wpp := 32
            color (red)
            put "Target Casts Chance Heal."
            getch (clicky)
            put ""
            color (blue)
            put "Target is healed for ", e.healing, " Dmg."
            getch (clicky)
        else
            e.wpp := e.wpp + 12
            p.dtaken := p.dtaken + Rand.Int (2, 6)
            color (red)
            put "Target attacks you normally."
            color (blue)
            getch (clicky)
            put ""
            put "You take ", p.dtaken, " Dmg."
            getch (clicky)
        end if
    elsif (achance = 5) then
        p.dtaken := p.dtaken + Rand.Int (2, 5)
        badburn := true
        badburntime := Rand.Int (5, 15)
        e.wpp := e.wpp + 19
        color (red)
        put "Target Casts Enflame."
        getch (clicky)
        color (blue)
        put "You take ", p.dtaken, " Dmg."
        put "You are now on fire for"
        put badburntime, " Wait."
        getch (clicky)
    end if
end TARGET
%=============
procedure BATTLE

    p.sdtaken := 0
    e.dtaken := 0
    p.dtaken := 0
    p.healing := 0
    e.healing := 0
    p.hp := 100
    e.hp := 100
    scan := false
    e.wpp := 0
    p.wpp := 0
    p.wd := 0
    e.wd := 0
    p.wi := 0
    e.wi := 0
    badburntime := 0
    badburn := false
    goodburntime := 0
    goodburn := false
    regentime := 0
    regencheck := false
    start := Rand.Int (1, 4)
    if (start = 1) or (start = 2) or (start = 3) then
        p.w := 0
        e.w := 1
    elsif (start = 4) then
        p.w := 1
        e.w := 0
    end if

    %Continue battle until one is victorious.
    loop

        if (p.w = 0) and (e.w = 0) then
            chooser := Rand.Int (1, 2)
            if (chooser = 1) then
                cls
                STATS
                PLAYER
                cls
                STATS
                TARGET

            elsif (chooser = 2) then
                cls
                STATS
                TARGET
                cls
                STATS
                PLAYER

            end if
        elsif (e.w = 0) then
            cls
            STATS
            TARGET
        elsif (p.w = 0) then
            cls
            STATS
            PLAYER
        end if
        %add / subtract damage taken and amount healed.
        %then see if someone dies. +/- regen // burns // poisons
        if (badburntime = 0) then
            badburn := false
        end if

        if (badburn = true) then
            badburntime := badburntime - 1
            p.dtaken := p.dtaken + 1
        end if

        if (goodburntime = 0) then
            goodburn := false
        end if

        if (goodburn = true) then
            goodburntime := goodburntime - 1
            e.dtaken := e.dtaken + 1
        end if

        if (regentime = 0) then
            regencheck := false
        end if

        if (regencheck = true) then
            regentime := regentime - 1
            p.healing := p.healing + 2
        end if

        p.hp := round (p.hp - p.dtaken - p.sdtaken + p.healing)
        e.hp := round (e.hp - e.dtaken + e.healing)
        p.w := p.w + p.wpp + p.wi - p.wd
        e.w := e.w + e.wpp + e.wi - e.wd


        p.w := p.w - 1
        e.w := e.w - 1


        p.dtaken := 0
        p.sdtaken := 0
        e.dtaken := 0

        p.healing := 0
        e.healing := 0

        p.wpp := 0
        e.wpp := 0

        p.wi := 0
        e.wi := 0

        p.wd := 0
        e.wi := 0

        %Falesafe...
        if (p.w <= 0) then
            p.w := 0
        end if
        if (e.w <= 0) then
            e.w := 0
        end if
       
        if (p.hp > 100) then
        p.hp := 100
        end if
       
       
        cls
        STATS
        put "           Wait Decay..."
        delay (150)
        exit when (e.hp <= 0)
        exit when (p.hp <= 0)
    end loop
    %===============

end BATTLE
%============
procedure SELECTOR
    %Choose your two starting skills.
    cls
    var nxt : string (1)
    put "    Skill selector and Skill information:"
    put skip
    color (blue)
    put "This feature allows you to mix and match different skills to"
    put "make your own character. It is suggested that you get"
    put "yourself a healing spell from the secondary or tertiary skill"
    put "selectors. At level one, only your primary and secondary"
    put "skills are avaliable, but once you reach level 2, you"
    put "gain your third, and fourth at level 5."
    color (red)
    put "At level 8, you will be presented with the oportunity to"
    put "change your primary skill to a stronger version of itself,"
    put "or a completely different trait alltogether. This goes for"
    put "all skills at different intervals."
    put ""
    color (blue)
    put "Notice: Some of this stuff might not be implimented yet."
    put ""
    color (red)
    put "Note: Do not click the chosen key multiple times,"
    put "for it will cause your next skills to be chosen as well."
    put ""
    color (blue)
    put "When you see a black blinking rectangle, it means to either"
    put "input either input somthing, or Click to continue."
    put "That is.. click on keyboard."
    getch (nxt)
    color (black)
    cls
    put "    Skill Selector"
    put skip
    color (red)
    put "Choose a Primary Skill"
    put ""
    put "a) Normal Attack"
    color (blue)
    put "   Hits target with a Basic Attack."
    put "   5-11 DMG 12 WP"
    put ""
    color (red)
    put "b) Ranged Normal Attack"
    color (blue)
    put "   Fires an Arrow at target."
    put "   6-14 DMG 15 WP 20% Chance to Miss"
    put ""
    color (red)
    put "c) Frenzied Slash"
    color (blue)
    put "   Attacks with quick percision."
    put "   3-6 DMG 25 WP 50% Chance to reduce"
    put "   WP by 20."
    put ""
    color (red)
    put "Please, choose one."
    loop
        getch (nxt)
        if (nxt = "a") or (nxt = "A") then
            normal := true
            ranged := false
            frenzy := false
            exit when (normal = true)
        elsif (nxt = "b") or (nxt = "B") then
            ranged := true
            normal := false
            frenzy := false
            exit when (ranged = true)
        elsif (nxt = "c") or (nxt = "C") then
            frenzy := true
            normal := false
            ranged := false
            exit when (frenzy = true)
        end if
    end loop
    cls
    color (black)
    put "Skill Selector"
    put skip
    color (blue)
    if (normal = true) then
        put "Normal Attack Chosen."
    elsif (ranged = true) then
        put "Ranged Attack Chosen."
    elsif (frenzy = true) then
        put "Frenzied Slash Chosen."
    end if
    getch (nxt)
    cls
    color (black)
    put "Skill Selector"
    put skip
    put "Choose secondary Skill."
    color (red)
    put "a)Regeneration"
    color (blue)
    put "   Heals you for 2 hp for every 1 wait over"
    put "   a period of 6-12 wait. 12 WP"
    put ""
    color (red)
    put "b)Ice Mastery"
    color (blue)
    put "   Leads to extremely powerful ice spells in"
    put "   secondary tier 2 skills. Not suggested"
    put "   for beginners. (NOT A SPELL)"
    put "   (Don't use, not implimented)"
    color (red)
    put ""
    put "c)Searing Flame"
    color (blue)
    put "   Sends a burning sheet of fire at the target"
    put "   dealing 1-3 damage and burns for another"
    put "   4-16 wait. 18 wait."
    color (black)
    put ""
    put "Please, Choose One."
    put ""
    loop
        getch (nxt)
        if (nxt = "a") or (nxt = "A") then
            regen := true
            master := false
            sflame := false
            cls
            color (black)
            put "Skill selector"
            put skip
            color (blue)
            put "Regeneration Chosen."
            getch (nxt)
            exit when (regen = true)
        elsif (nxt = "b") or (nxt = "B") then
            master := true
            regen := false
            sflame := false
            cls
            color (black)
            put "Skill selector"
            put skip
            color (blue)
            put "Ice Mastery Chosen."
            getch (nxt)
            exit when (master = true)
        elsif (nxt = "c") or (nxt = "C") then
            sflame := true
            regen := false
            master := false
            cls
            color (black)
            put "Skill selector"
            put skip
            color (blue)
            put "Searing Flame Chosen."
            getch (nxt)
            exit when (sflame = true)
        end if
    end loop
    BATTLE
end SELECTOR

procedure BATTLESTARTUP
    win1 := Window.Open ("title:MGF:RMRPG;graphics:500;450;position:center;top")
    var poke : string (1)
    var font1, font2 : int
    font1 := Font.New ("Papyrus:35:Bold")
    font2 := Font.New ("Comic Sans MS:12")
    colorback (96)
    cls
    Font.Draw ("Remm's Mini RPG", 20, maxy - 60, font1, black)
    Font.Draw ("=", 206, 350, font1, brightred)
    Font.Draw ("_", 206, 330, font1, brightred)
    Font.Draw ("|", 206, 330, font1, brightred)
    font1 := Font.New ("Papyrus:21")
    Font.Draw ("M.F", 188, 332, font1, green)
    Font.Draw ("Click to Continue.", 155, 300, font2, brightred)
    color (red)
    color (black)
    getch (poke)
    SELECTOR
end BATTLESTARTUP

procedure MSSEAL
    var poka : string (1)
    var font1, font2 : int
    win1 := Window.Open ("title:Mini-Game Frenzy;graphics:300;300;position:center;top")

    font1 := Font.New ("Papyrus:35:Bold")
    font2 := Font.New ("Comic Sans MS:12")
    colorback (black)
    cls
    color (white)
    put "             Welcome to..."
    Draw.ThickLine (0, maxy, maxx, 0, 10, green)
    Draw.ThickLine (maxx, maxy, 0, 0, 10, red)
    Draw.ThickLine (0, maxy, maxx, 0, 5, red)
    Draw.ThickLine (maxx, maxy, 0, 0, 5, green)
    Font.Draw ("Mini-Game", 28, 240, font1, white)
    Font.Draw ("FRENZY", 23, 170, font1, brightgreen)
    color (brightred)
    font1 := Font.New ("Papyrus:35:Bold")
    Font.Draw ("Click to Continue.", 83, 130, font2, brightred)
    Font.Draw ("=", 136, 90, font1, brightred)
    Font.Draw ("_", 136, 70, font1, brightred)
    Font.Draw ("|", 136, 70, font1, brightred)
    font1 := Font.New ("Papyrus:21")
    Font.Draw ("M.F", 118, 72, font1, brightgreen)
    getch (poka)

    BATTLESTARTUP
end MSSEAL

MSSEAL
cls
STATS
put skip
if (p.hp <= 0) then
    put "You lose..."
elsif (e.hp <= 0) then
    put "Victory! Hurrah!"
end if


NEXT TIME I POST THIS, BECAUSE OF ITS SIZE, I WILL PUT PUTTING IT AS A ATTACHMENT

Author:  Clayton [ Thu Aug 17, 2006 2:37 pm ]
Post subject: 

first thing: LEARN CLASSES!! without them you will have an extremely hard time in later stages of the game (not to mention extremely messy code) trying to add new things in. that being said, not bad for a start, although you definitely need to tell the user to press a key on the keyboard instead of telling them to "click to continue"

Author:  [Gandalf] [ Thu Aug 17, 2006 7:15 pm ]
Post subject: 

You know, as great as classes are, I don't think they should be a pre-requisite for everything.

In a program like this, there are more fundamental things to learn before OOP, like arrays and functions. Of course, in the end classes would be extremely beneficial to your program, but there are other things which should come first.

Author:  TokenHerbz [ Sun Aug 20, 2006 4:28 am ]
Post subject: 

holly hobbles of goblins, Cervantes read my mind!

Author:  [Gandalf] [ Sun Aug 20, 2006 4:53 am ]
Post subject: 

Wait... Cervantes... What?! TokenHerbz, what on earth are you talking about?

Thinking

Author:  TokenHerbz [ Sun Aug 20, 2006 6:59 pm ]
Post subject: 

Err, i dont know look how early that was,

i was, err, under the influence?


EDIT:::

ok im pretty sure i seen cervantes post about mine, thats trippy,

Anyways i looked at your game, and its a good attempt, though there is so much more you must do.

Make it neater, i cant hardl'y follow your code/variables, so make a neater structure, and use better variable names. that would be a big help for me to analize your game, as i dont have the time to sort threw it to look at what your asking for.

Author:  Cervantes [ Sun Aug 20, 2006 7:36 pm ]
Post subject: 

I suspect he meant to post that in a different thread. Congratulations TokenHerbz, not many people manage that. Wink

Author:  TokenHerbz [ Mon Aug 21, 2006 1:00 am ]
Post subject: 

Thanks, i try...

But really, are you sure it wasn't this one?


: