
-----------------------------------
Planet_Fall
Sat Dec 28, 2013 11:11 pm

Battle Test
-----------------------------------
What is it you are trying to achieve?
I'm trying to achieve a fighting system where the one with the highest SPD moves first and damage is calculated like this.
- To You: Enemy Attack - Your Defense (If < 0 it does 0 damage)
- To Enemy: Your Attack - Enemy Defense  (If < 0 it does 0 damage)
- Where if you a Wizard you can cast magic
- If your not a Wizard you can't use magic
- And a RUN procedure with a 50/50 chance

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)



%   Call Variables
var E_name, name, p_class, choice : string
var enemy_names : array 0 .. 9 of string := init ("THEIF", "ZOMBIE", "SLIME", "ORC", "DEMON", "GHOST", "VAMPIRE", "BARBARIAN WARRIOR", "BARBARIAN ARCHER", "BARBARIAN LEADER")
var HP, ATK, DEF, M_ATK, M_DEF, SPD, EXP, LV, TEMP_HP : int := 0 % Player Stats Initiation
var HP_E, ATK_E, DEF_E, M_DEF_E, SPD_E : int := 0 % Enemy Stats Initiation
var wizard_class, battle_victory : boolean := false %For magic attacks
% var random_enemy :int := Rand.Int(0,9)

%   Call Procedure
procedure player_stats
    HP := Rand.Int (200, 500)
    TEMP_HP := HP
    ATK := Rand.Int (10, 25)
    DEF := Rand.Int (10, 25)
    M_ATK := Rand.Int (10, 25)
    M_DEF := Rand.Int (10, 25)
    SPD := Rand.Int (10, 25)
    LV := 1
end player_stats

procedure enemy_stats
    HP_E := Rand.Int (200, 500)
    ATK_E := Rand.Int (10, 25)
    DEF_E := Rand.Int (10, 25)
    SPD_E := Rand.Int (10, 25)
    M_DEF_E := Rand.Int (10, 25)
end enemy_stats

procedure show_stats
    put "Name: ", name : 7
    put "Class: Lv.", LV, " ", p_class : 7
    put "HP: ", HP
    put "ATK: ", ATK, "  ", "M.ATK: ", M_ATK, "  ", "SPD: ", SPD
    put "DEF: ", DEF, "  ", "M.DEF: ", M_DEF
    put "EXP : ", EXP
end show_stats

procedure show_stats_E
    put "Name: ", E_name : 7
    put "HP: ", HP_E
    put "ATK: ", ATK_E, "  ", "SPD: ", SPD_E
    put "DEF: ", DEF_E, "  ", "M.DEF: ", M_DEF_E
end show_stats_E

procedure get_class
    loop
        put "What Class are you? (FIGHTER/WIZARD/DEFENDER) ----> " ..
        get p_class
        if p_class = "FIGHTER" then
            player_stats
            ATK += M_ATK
            DEF += M_DEF
            exit
        elsif p_class = "WIZARD" then
            player_stats
            M_ATK += ATK
            M_DEF += DEF
            wizard_class := true
            exit
        elsif p_class = "DEFENDER" then
            player_stats
            M_DEF += ATK
            DEF += M_ATK
            exit
        else
            put "Please enter the choice EXACTLY like it shows."
        end if
    end loop
end get_class

procedure check_enemy_death
    if HP_E  SPD then
                    damage := ATK_E - DEF
                    if damage  SPD then
                    damage := ATK_E - DEF
                    if damage 