Example #1
0
        public Battle(EncounterType encounter, params Puppet[] puppets)
        {
            if (puppets.Length < 1)
            {
                throw new Exception("Can't start a battle without a party!");
            }
            else if (puppets.Length > PARTY_SIZE)
            {
                throw new Exception($"Can't start battle w/ {puppets.Length} puppets - larger than {PARTY_SIZE}");
            }
            foreach (var p in puppets)
            {
                if (p.State == PuppetState.New)
                {
                    throw new Exception("Shouldn't be starting a battle w/ a new puppet");
                }
                // don't ask why this exception is here or what dumb, dumb things happened that make this an error
                // we're explicitly looking for
                Party.Add(p);
            }
            Encounter = encounter;
            var enemies = EncounterTable.Get(Encounter).Enemies;

            Enemies = new Enemy[enemies.Length];
            for (int i = 0; i < Enemies.Length; i++)
            {
                Enemies[i] = EnemyTable.Get(enemies[i]).Instantiate();
            }
        }
Example #2
0
    void CreateEncounter()
    {
        Encounter encounter = new Reclaim();

        encounter.permanent = true;
        encounter.GetReferences();
        FindLocation(encounter);
        //Will need to change this formula if I want to get 3 by 3 arenas, but for now we're just making arenasizes 4 (2 b 2) and 6 (2 b 3).
        encounter.arenaSize    = (((int)UnityEngine.Random.Range(1, 3)) * 2) + 2;
        encounter.difficulty   = UnityEngine.Random.Range(0, 2);
        encounter.enemyCompany = EncounterTable.CreateEnemyCompany(encounter);
        RostaInfo.encounters.Add(encounter);
    }
Example #3
0
    private void Awake()
    {
        if (RostaInfo.encounter == true || encounterSettings == EncounterSettings.Test)
        {
            RostaInfo.encounter = true;
            rosta                  = GameObject.Find("PlayerData" + "(Clone)").GetComponent <RostaInfo>();
            encounterManager       = this;
            staticEncounterPanel   = encounterEndPanel;
            staticEncounterEndtext = encounterEndtext;
            StartCoroutine(PositioningUnits());
        }

        if (RostaInfo.currentEncounter == null)
        {
            Encounter encounter = new Reclaim();
            encounter.permanent = true;
            //encounter.GetReferences();
            //Will need to change this formula if I want to get 3 by 3 arenas, but for now we're just making arenasizes 4 (2 b 2) and 6 (2 b 3).
            encounter.arenaSize        = (((int)UnityEngine.Random.Range(1, 3)) * 2) + 2;
            encounter.difficulty       = UnityEngine.Random.Range(0, 2);
            encounter.enemyCompany     = EncounterTable.CreateEnemyCompany(encounter);
            RostaInfo.currentEncounter = encounter;
        }
    }
 void Start()
 {
     encounters = new EncounterTable();
     //encounters.load_from_file (Application.dataPath + "/Encounter Texts/encounters.txt"); //EDITOR
     encounters.load_from_file(Application.dataPath + "/../encounters.txt");   //BUILD
 }
Example #5
0
        private void updatePanel(object sender, EventArgs e)
        {
            if (loadingdata)
                return;
            loadingdata = true;
            var Map = Areas[CB_LocationID.SelectedIndex];
            GB_Encounters.Enabled = Map.HasTables;
            if (!Map.HasTables)
            {
                loadingdata = false;
                return;
            }
            CurrentTable = new EncounterTable(Map.Tables[CB_TableID.SelectedIndex].Data);
            NUP_Min.Value = CurrentTable.MinLevel;
            NUP_Max.Minimum = CurrentTable.MinLevel;
            NUP_Max.Value = CurrentTable.MaxLevel;
            for (int slot = 0; slot < CurrentTable.Encounters.Length; slot++)
            for (int i = 0; i < CurrentTable.Encounters[slot].Length; i++)
            {
                var sl = CurrentTable.Encounters[slot];
                if (slot == 8)
                    sl = CurrentTable.AdditionalSOS;
                rate_spec[i].Text = $"{CurrentTable.Rates[i]}%";
                cb_spec[slot][i].SelectedIndex = (int)sl[i].Species;
                nup_spec[slot][i].Value = (int)sl[i].Forme;
            }
            loadingdata = false;

            int base_id = CB_TableID.SelectedIndex/2;
            base_id *= 2;
            PB_DayTable.Image = Map.Tables[base_id].GetTableImg();
            PB_NightTable.Image = Map.Tables[base_id + 1].GetTableImg();
        }
 public EncounterGroup(EndianBinaryReader r)
 {
     Type  = r.ReadEnum <EncounterType>();
     Table = EncounterTable.LoadOrGet(r.ReadInt32());
 }