<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
  <spriteName>&lt;undefined&gt;</spriteName>
  <solid>0</solid>
  <visible>-1</visible>
  <depth>0</depth>
  <persistent>0</persistent>
  <parentName>&lt;undefined&gt;</parentName>
  <maskName>&lt;undefined&gt;</maskName>
  <events>
    <event eventtype="0" enumb="0">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>// 1 -&gt; 2 -&gt; 3 -&gt; 4 -&gt; 7 -&gt; 8 -&gt; 9 -&gt; 0
alarm[1] = 1
levelup = 0
levldup = 0
rounds = 1
first_turn = 0
drop = 0
e = 1
b = 0
oldhp = 0;
oldpp = 0;
oldoff = 0;
olddef = 0;
oldluck = 0;
oldguts = 0;
oldspd = 0;
oldvit = 0;
oldiq = 0;
oldlevel = 0;
lvskill = 0;

write_line("Battle killer created.")
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="11">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>///End the battle 

if instance_exists(objBattleMsg) {
    alarm[11] = 1
} else {
    audio_stop_all()
    global.boss = 0
    instance_create(0,09,objFadeOutBattle)
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="10">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>///Level up

if instance_exists(objBattleMsg) {
    alarm[10] = 1
} else {
    if audio_is_playing(sndwin) || audio_is_playing(sndwinboss) {
        audio_stop_all()
        audio_play_sound(sndlevelup,0,1)
    }
    
    level_up_battle(10)

    alarm[11] = 1;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="9">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>///The battle ends the moment the player dies, else turns start again
if instance_exists(objBattleMsg) {
    alarm[9] = 1
    exit
} else {
    var d = 0;
    switch global.pl_count {
        case 1:
            if global.dead[1] {
                d = 1
            }
            break;
        case 2:
            if global.dead[1] and global.dead[2]{
                d = 1
            }
            break;
        case 3:
            if global.dead[1] and global.dead[2] and global.dead[3] {
                d = 1
            }
            break;
        case 4:
            if global.dead[1] and global.dead[2] and global.dead[3] and global.dead[4] {
                d = 1
            }
            break;
    }
        
    if d {
        with instance_create(0,0,objBattleMsg) {
            strno = 0;
            str[0] = global.s_name[1] + " lost the battle..."
        }
        audio_stop_all()
        play_music(bgmBadDream, 1)
        instance_create(0,0,objFadeToWhite)
        with objPlayer { instance_destroy() }
    } else {
        if !first_turn { with objTurnMaster { event_perform(ev_other,ev_user1) } }
        else { objTurnMaster.alarm[1] = 1; }
        instance_destroy()
    }
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="6">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>///Enemy drops
if instance_exists(objBattleMsg) {
    alarm[6] = 1
    exit
} else {
    if drop = 0 {
        audio_play_sound(sndpresent,0,0)
        with instance_create(0,0,objBattleMsg) {
            strno = 1;
            str[0] = objBattleController.dropenemyname + " dropped a present!";
            str[1] = "Inside the present,#   there was "+global.item[objBattleController.drop,17]+global.item[objBattleController.drop,1]+"!";
        }
        drop = 1
        alarm[6] = 1
    } else {
        var a;
        a = instance_create(0,0,objBattleMsg);
        a.strno = 0
        b = add_item_ext(objBattleController.drop);
        if b = -1 {
            if global.pl_count = 1 {
                a.str[0] = "But "+global.s_name[1]+" was carrying too much stuff already,#   so it was sent to the storage instead."
            } else {
                a.str[0] = "But everyone was carrying too much stuff already,#   so it was sent to the storage instead."
            }
            add_item_storage(objBattleController.drop);
        } else {
            a.str[0] = global.s_name[b+1]+" took it."
            audio_play_sound(snditemget1,0,0)
        }
        alarm[10] = 1
    }
}   
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="5">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>///Kill the players
if instance_exists(objBattleMsg) {
    alarm[5] = 1
    exit
} else {
    
    if rounds &lt; global.pl_count+1 { 
        if global.healthbar[rounds].hp_actual &lt;= 0 and !global.dead[rounds] {
            global.dead[rounds] = 1
            audio_play_sound(snddie,0,0)
            var a = instance_create(0,0,objBattleMsg);
            a.strno = 0;
            a.str[0] = global.s_name[rounds] + " got hurt and collapsed!"
        }
        rounds++
        alarm[5] = 1
    } else {
        alarm[9] = 1
    }
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="4">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>///Win the battle else try to kill the players
if instance_exists(objBattleMsg) or instance_exists(parLastAction) {
    alarm[4] = 1
    exit
} else {
    if global.enemy[1] = 0 and global.enemy[2] = 0 and global.enemy[3] = 0 and global.enemy[4] = 0 and global.enemy[5] = 0 {
        //With no enemies left, there is no one to battle.
        stat_reset()
        audio_stop_all()
        if !global.boss { audio_play_sound(sndwin,1,0) } else { audio_play_sound(sndwinboss,1,0) }
        
        global.s_exp[1] += global.totalexp*!global.dead[1];
        
        if global.pl_count &gt; 1 {
            global.s_exp[2] += global.totalexp*!global.dead[2];
        }
        if global.pl_count &gt; 2 {
            global.s_exp[3] += global.totalexp*!global.dead[3];
        }
        if global.pl_count &gt; 3 {
            global.s_exp[4] += global.totalexp*!global.dead[4];
        }
        
        global.money += ceil(global.totalexp/4);

        with instance_create(0,0,objBattleMsg) {
            strno = 1;
            str[0] = "YOU WONZ"
            if global.totalexp = 0 {
                str[1] = "It was a nice experience."
            } else {
                switch global.pl_count {
                    case 1: 
                        str[1] = global.s_name[1]+" got "+string(global.totalexp)+" EXP."; break;
                    case 2: 
                        if global.dead[1] {
                            str[1] = global.s_name[2]+" got "+string(global.totalexp)+" EXP."; break;
                        } else if global.dead[2] {
                            str[1] = global.s_name[1]+" got "+string(global.totalexp)+" EXP."; break;
                        } else {
                            str[1] = global.s_name[1]+" and "+global.s_name[2]+" got "+string(global.totalexp)+" EXP."; break;
                        }
                    case 3:
                        if global.dead[1] {
                            if global.dead[2] {
                                str[1] = global.s_name[3]+" got "+string(global.totalexp)+" EXP."; break;
                            } else {
                                str[1] = global.s_name[2]+" and "+global.s_name[3]+" got "+string(global.totalexp)+" EXP."; break;
                            }
                        } else if global.dead[2] {
                            if global.dead[1] {
                                str[1] = global.s_name[3]+" got "+string(global.totalexp)+" EXP."; break;
                            } else {
                                str[1] = global.s_name[1]+" and "+global.s_name[3]+" got "+string(global.totalexp)+" EXP."; break;
                            }
                        } else if global.dead[3] {
                            if global.dead[1] {
                                str[1] = global.s_name[2]+" got "+string(global.totalexp)+" EXP."; break;
                            } else {
                                str[1] = global.s_name[1]+" and "+global.s_name[2]+" got "+string(global.totalexp)+" EXP."; break;
                            }
                        } else {
                            str[1] = global.s_name[1]+" and co. got "+string(global.totalexp)+" EXP."; break;
                        }
                    case 4: 
                        str[1] = "The party got "+string(global.totalexp)+" EXP."; break;
                }
            }
        }
        if random(100)&lt;=objBattleController.droprate and objBattleController.drop != 0 {
            alarm[6] = 1
        } else {
            alarm[10] = 1
        }
    } else {
        //Keep the battle going.
        alarm[5] = 1
    }
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="1">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>///Kill the enemies

if instance_exists(objBattleMsg) or instance_exists(parLastAction) {
    alarm[1] = 1
} else {
    if global.enemy[e] != 0 {
        if global.enemy[e].e_hp &lt;= 0 {
            if global.enemy[e].e_last = 0 {
                audio_play_sound(sndedie,0,0)
                var a = instance_create(0,0,objBattleMsg);
                a.strno = 0;
                a.str[0] = global.enemy[e].e_fin
                
                with global.enemy[e] {
                    alarm[0] = 1
                }
                global.enemy[e] = 0
                e++;
                if e &gt; global.en_count {
                    alarm[4] = 1;
                } else {
                    alarm[1] = 1;
                }
            } else {
                //Last action. Burst into flames, explode, etc
                global.enemy[e].e_last = 0 //Gets reset so it can actually die this time.
                enmy = e
                with global.enemy[e] { alarm[1] = 2; event_perform(ev_other,ev_user15); } 
                alarm[1] = 1;
            }
        } else {
            e++
            if e &gt; global.en_count {
                alarm[4] = 1;
            } else {
                alarm[1] = 1;
            }
        }
    } else {
        write_line("enemy up2")
        e++;
        if e &gt; global.en_count {
            alarm[4] = 1;
        } else {
            alarm[1] = 1;
        }
    }
}

</string>
          </argument>
        </arguments>
      </action>
    </event>
  </events>
  <PhysicsObject>0</PhysicsObject>
  <PhysicsObjectSensor>0</PhysicsObjectSensor>
  <PhysicsObjectShape>0</PhysicsObjectShape>
  <PhysicsObjectDensity>0.5</PhysicsObjectDensity>
  <PhysicsObjectRestitution>0.100000001490116</PhysicsObjectRestitution>
  <PhysicsObjectGroup>0</PhysicsObjectGroup>
  <PhysicsObjectLinearDamping>0.100000001490116</PhysicsObjectLinearDamping>
  <PhysicsObjectAngularDamping>0.100000001490116</PhysicsObjectAngularDamping>
  <PhysicsObjectFriction>0.200000002980232</PhysicsObjectFriction>
  <PhysicsObjectAwake>-1</PhysicsObjectAwake>
  <PhysicsObjectKinematic>0</PhysicsObjectKinematic>
  <PhysicsShapePoints/>
</object>
