Ejemplo n.º 1
0
        public async void DiscardEncounter(EncounterTemplate encounterTemplate)
        {
            try
            {
                var result = await _dialogService.ConfirmAction("Are you sure ?", "Delete this Encounter");

                if (result)
                {
                    if (_dashboardService.CanRemoveEncounter(encounterTemplate.Id, Client.Id,
                                                             encounterTemplate.EncounterTypeId))
                    {
                        // validate Encounter
                        _dashboardService.RemoveEncounter(encounterTemplate.Id);
                        Parent.Modules = _dashboardService.LoadModules();
                    }
                    else
                    {
                        if (Terms.PreTest == encounterTemplate.EncounterTypeId)
                        {
                            _dialogService.Alert("Please Delete Testing Encounters first", "Encounter");
                        }
                        if (Terms.Testing == encounterTemplate.EncounterTypeId)
                        {
                            _dialogService.Alert("Please Delete Referral and Linkage Encounters first", "Encounter");
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MvxTrace.Error(e.Message);
                _dialogService.Alert(e.Message, "Delete this Encounter");
            }
        }
Ejemplo n.º 2
0
        static void build_template_commander_and_troops()
        {
            EncounterTemplateGroup group = new EncounterTemplateGroup("Commander and Troops", "Entire Party");

            EncounterTemplate ct1 = new EncounterTemplate(Difficulty.Easy);

            ct1.Slots.Add(new EncounterTemplateSlot(1, 0, new RoleType[] { RoleType.Controller, RoleType.Soldier, RoleType.Lurker, RoleType.Skirmisher }));
            ct1.Slots.Add(new EncounterTemplateSlot(4, -3, new RoleType[] { RoleType.Brute, RoleType.Soldier }));
            group.Templates.Add(ct1);

            EncounterTemplate ct2 = new EncounterTemplate(Difficulty.Moderate);

            ct2.Slots.Add(new EncounterTemplateSlot(1, 3, new RoleType[] { RoleType.Controller, RoleType.Soldier, RoleType.Lurker, RoleType.Skirmisher }));
            ct2.Slots.Add(new EncounterTemplateSlot(5, -2, new RoleType[] { RoleType.Brute, RoleType.Soldier }));
            group.Templates.Add(ct2);

            EncounterTemplate ct3 = new EncounterTemplate(Difficulty.Hard);

            ct3.Slots.Add(new EncounterTemplateSlot(1, 5, new RoleType[] { RoleType.Controller, RoleType.Soldier, RoleType.Lurker, RoleType.Skirmisher }));
            ct3.Slots.Add(new EncounterTemplateSlot(3, 1, new RoleType[] { RoleType.Brute, RoleType.Soldier }));
            ct3.Slots.Add(new EncounterTemplateSlot(2, 1, new RoleType[] { RoleType.Artillery }));
            group.Templates.Add(ct3);

            fTemplateGroups.Add(group);
        }
Ejemplo n.º 3
0
        static void build_template_dragons_den()
        {
            EncounterTemplateGroup group = new EncounterTemplateGroup("Dragon's Den", "Entire Party");

            EncounterTemplate dd1 = new EncounterTemplate(Difficulty.Easy);

            dd1.Slots.Add(new EncounterTemplateSlot(1, -2, RoleFlag.Solo));
            group.Templates.Add(dd1);

            EncounterTemplate dd2 = new EncounterTemplate(Difficulty.Moderate);

            dd2.Slots.Add(new EncounterTemplateSlot(1, 0, RoleFlag.Solo));
            group.Templates.Add(dd2);

            EncounterTemplate dd3 = new EncounterTemplate(Difficulty.Moderate);

            dd3.Slots.Add(new EncounterTemplateSlot(1, 1, RoleFlag.Solo));
            group.Templates.Add(dd3);

            EncounterTemplate dd4 = new EncounterTemplate(Difficulty.Hard);

            dd4.Slots.Add(new EncounterTemplateSlot(1, 3, RoleFlag.Solo));
            group.Templates.Add(dd4);

            EncounterTemplate dd5 = new EncounterTemplate(Difficulty.Hard);

            dd5.Slots.Add(new EncounterTemplateSlot(1, 1, RoleFlag.Solo));
            dd5.Slots.Add(new EncounterTemplateSlot(1, 0, RoleFlag.Elite));
            group.Templates.Add(dd5);

            fTemplateGroups.Add(group);
        }
Ejemplo n.º 4
0
    public void LoadEncounter()
    {
        EncounterTemplate template = Resources.Load <EncounterTemplate>("EncounterTemplates/" + templateName);

        if (template is EncounterTemplate)
        {
            ClearMap();

            foreach (Hex pos in template.terrainPieces)
            {
                MakeTerrainMarker(pos);
            }

            foreach (Hex pos in template.enemySpawnPoints)
            {
                MakeEnemySpawn(pos);
            }

            foreach (Hex pos in template.playerSpawnPoints)
            {
                MakePlayerSpawn(pos);
            }

            currentTemplate = template;
        }
        else
        {
            Debug.LogWarning("unable to load template '" + templateName + "'");
        }
    }
Ejemplo n.º 5
0
        private static void build_template_wolf_pack()
        {
            EncounterTemplateGroup encounterTemplateGroup = new EncounterTemplateGroup("Wolf Pack", "Entire Party");
            EncounterTemplate      encounterTemplate      = new EncounterTemplate(Difficulty.Easy);

            encounterTemplate.Slots.Add(new EncounterTemplateSlot(7, -4, RoleType.Skirmisher));
            encounterTemplateGroup.Templates.Add(encounterTemplate);
            EncounterTemplate encounterTemplate1 = new EncounterTemplate(Difficulty.Moderate);

            encounterTemplate1.Slots.Add(new EncounterTemplateSlot(7, -2, RoleType.Skirmisher));
            encounterTemplateGroup.Templates.Add(encounterTemplate1);
            EncounterTemplate encounterTemplate2 = new EncounterTemplate(Difficulty.Moderate);

            encounterTemplate2.Slots.Add(new EncounterTemplateSlot(5, 0, RoleType.Skirmisher));
            encounterTemplateGroup.Templates.Add(encounterTemplate2);
            EncounterTemplate encounterTemplate3 = new EncounterTemplate(Difficulty.Hard);

            encounterTemplate3.Slots.Add(new EncounterTemplateSlot(3, 5, RoleType.Skirmisher));
            encounterTemplateGroup.Templates.Add(encounterTemplate3);
            EncounterTemplate encounterTemplate4 = new EncounterTemplate(Difficulty.Hard);

            encounterTemplate4.Slots.Add(new EncounterTemplateSlot(4, 5, RoleType.Skirmisher));
            encounterTemplateGroup.Templates.Add(encounterTemplate4);
            EncounterTemplate encounterTemplate5 = new EncounterTemplate(Difficulty.Hard);

            encounterTemplate5.Slots.Add(new EncounterTemplateSlot(6, 2, RoleType.Skirmisher));
            encounterTemplateGroup.Templates.Add(encounterTemplate5);
            EncounterBuilder.fTemplateGroups.Add(encounterTemplateGroup);
        }
Ejemplo n.º 6
0
        private static void build_template_dragons_den()
        {
            EncounterTemplateGroup encounterTemplateGroup = new EncounterTemplateGroup("Dragon's Den", "Entire Party");
            EncounterTemplate      encounterTemplate      = new EncounterTemplate(Difficulty.Easy);

            encounterTemplate.Slots.Add(new EncounterTemplateSlot(1, -2, RoleFlag.Solo));
            encounterTemplateGroup.Templates.Add(encounterTemplate);
            EncounterTemplate encounterTemplate1 = new EncounterTemplate(Difficulty.Moderate);

            encounterTemplate1.Slots.Add(new EncounterTemplateSlot(1, 0, RoleFlag.Solo));
            encounterTemplateGroup.Templates.Add(encounterTemplate1);
            EncounterTemplate encounterTemplate2 = new EncounterTemplate(Difficulty.Moderate);

            encounterTemplate2.Slots.Add(new EncounterTemplateSlot(1, 1, RoleFlag.Solo));
            encounterTemplateGroup.Templates.Add(encounterTemplate2);
            EncounterTemplate encounterTemplate3 = new EncounterTemplate(Difficulty.Hard);

            encounterTemplate3.Slots.Add(new EncounterTemplateSlot(1, 3, RoleFlag.Solo));
            encounterTemplateGroup.Templates.Add(encounterTemplate3);
            EncounterTemplate encounterTemplate4 = new EncounterTemplate(Difficulty.Hard);

            encounterTemplate4.Slots.Add(new EncounterTemplateSlot(1, 1, RoleFlag.Solo));
            encounterTemplate4.Slots.Add(new EncounterTemplateSlot(1, 0, RoleFlag.Elite));
            encounterTemplateGroup.Templates.Add(encounterTemplate4);
            EncounterBuilder.fTemplateGroups.Add(encounterTemplateGroup);
        }
Ejemplo n.º 7
0
        static void build_template_grand_melee()
        {
            EncounterTemplateGroup group = new EncounterTemplateGroup("Grand Melee", "Entire Party");

            EncounterTemplate gm1 = new EncounterTemplate(Difficulty.Easy);

            gm1.Slots.Add(new EncounterTemplateSlot(4, -2, RoleType.Brute));
            gm1.Slots.Add(new EncounterTemplateSlot(11, -4, true));
            group.Templates.Add(gm1);

            EncounterTemplate gm2 = new EncounterTemplate(Difficulty.Moderate);

            gm2.Slots.Add(new EncounterTemplateSlot(2, -1, RoleType.Soldier));
            gm2.Slots.Add(new EncounterTemplateSlot(4, -2, RoleType.Brute));
            gm2.Slots.Add(new EncounterTemplateSlot(12, -4, true));
            group.Templates.Add(gm2);

            EncounterTemplate gm3 = new EncounterTemplate(Difficulty.Hard);

            gm3.Slots.Add(new EncounterTemplateSlot(2, 0, RoleType.Soldier));
            gm3.Slots.Add(new EncounterTemplateSlot(4, -1, RoleType.Brute));
            gm3.Slots.Add(new EncounterTemplateSlot(17, -2, true));
            group.Templates.Add(gm3);

            fTemplateGroups.Add(group);
        }
Ejemplo n.º 8
0
    public EncounterTemplate GenerateWithoutSaving()
    {
        EncounterTemplate template = ScriptableObject.CreateInstance <EncounterTemplate>();

        //terrain
        foreach (KeyValuePair <Hex, GameObject> pair in terrainPositions)
        {
            template.AddTerrain(pair.Key);
        }

        //enemies
        template.minEnemies = enemySpawns.Count;
        template.maxEnemies = enemySpawns.Count;
        foreach (KeyValuePair <Hex, GameObject> pair in enemySpawns)
        {
            template.AddEnemySpawn(pair.Key);
        }

        //playerspawns
        foreach (KeyValuePair <Hex, GameObject> pair in playerSpawns)
        {
            template.AddPlayerSpawn(pair.Key);
        }
        return(template);
    }
 public static ClientEncounterDTO Create(Guid clientId, EncounterTemplate encounterTemplate)
 {
     return(new ClientEncounterDTO(
                clientId,
                encounterTemplate.FormId,
                encounterTemplate.FormDisplay,
                encounterTemplate.EncounterTypeId
                ));
 }
 public bool OnNext()
 {
     if (this.fData.SelectedTemplate != this.SelectedTemplate)
     {
         this.fData.SelectedTemplate = this.SelectedTemplate;
         this.fData.FilledSlots.Clear();
     }
     return(true);
 }
Ejemplo n.º 11
0
    public void SaveEncounter()
    {
        EncounterTemplate template = GenerateWithoutSaving();

        AssetDatabase.CreateAsset(template, "Assets/Resources/EncounterTemplates/" + templateName + ".asset");

        AssetDatabase.SaveAssets();

        currentTemplate = template;
    }
Ejemplo n.º 12
0
        private static void build_template_double_line()
        {
            EncounterTemplateGroup       encounterTemplateGroup = new EncounterTemplateGroup("Double Line", "Entire Party");
            EncounterTemplate            encounterTemplate      = new EncounterTemplate(Difficulty.Easy);
            List <EncounterTemplateSlot> slots = encounterTemplate.Slots;

            RoleType[] roleTypeArray = new RoleType[] { RoleType.Brute, RoleType.Soldier };
            slots.Add(new EncounterTemplateSlot(3, -4, roleTypeArray));
            List <EncounterTemplateSlot> encounterTemplateSlots = encounterTemplate.Slots;

            RoleType[] roleTypeArray1 = new RoleType[] { RoleType.Artillery, RoleType.Controller };
            encounterTemplateSlots.Add(new EncounterTemplateSlot(2, -2, roleTypeArray1));
            encounterTemplateGroup.Templates.Add(encounterTemplate);
            EncounterTemplate            encounterTemplate1 = new EncounterTemplate(Difficulty.Moderate);
            List <EncounterTemplateSlot> slots1             = encounterTemplate1.Slots;

            RoleType[] roleTypeArray2 = new RoleType[] { RoleType.Brute, RoleType.Soldier };
            slots1.Add(new EncounterTemplateSlot(3, 0, roleTypeArray2));
            List <EncounterTemplateSlot> encounterTemplateSlots1 = encounterTemplate1.Slots;

            RoleType[] roleTypeArray3 = new RoleType[] { RoleType.Artillery, RoleType.Controller };
            encounterTemplateSlots1.Add(new EncounterTemplateSlot(2, 0, roleTypeArray3));
            encounterTemplateGroup.Templates.Add(encounterTemplate1);
            EncounterTemplate            encounterTemplate2 = new EncounterTemplate(Difficulty.Moderate);
            List <EncounterTemplateSlot> slots2             = encounterTemplate2.Slots;

            RoleType[] roleTypeArray4 = new RoleType[] { RoleType.Brute, RoleType.Soldier };
            slots2.Add(new EncounterTemplateSlot(3, -2, roleTypeArray4));
            List <EncounterTemplateSlot> encounterTemplateSlots2 = encounterTemplate2.Slots;

            RoleType[] roleTypeArray5 = new RoleType[] { RoleType.Artillery, RoleType.Controller };
            encounterTemplateSlots2.Add(new EncounterTemplateSlot(2, 3, roleTypeArray5));
            encounterTemplateGroup.Templates.Add(encounterTemplate2);
            EncounterTemplate            encounterTemplate3 = new EncounterTemplate(Difficulty.Hard);
            List <EncounterTemplateSlot> slots3             = encounterTemplate3.Slots;

            RoleType[] roleTypeArray6 = new RoleType[] { RoleType.Brute, RoleType.Soldier };
            slots3.Add(new EncounterTemplateSlot(3, 2, roleTypeArray6));
            encounterTemplate3.Slots.Add(new EncounterTemplateSlot(1, 4, RoleType.Controller));
            List <EncounterTemplateSlot> encounterTemplateSlots3 = encounterTemplate3.Slots;

            RoleType[] roleTypeArray7 = new RoleType[] { RoleType.Artillery, RoleType.Lurker };
            encounterTemplateSlots3.Add(new EncounterTemplateSlot(1, 4, roleTypeArray7));
            encounterTemplateGroup.Templates.Add(encounterTemplate3);
            EncounterTemplate            encounterTemplate4 = new EncounterTemplate(Difficulty.Hard);
            List <EncounterTemplateSlot> slots4             = encounterTemplate4.Slots;

            RoleType[] roleTypeArray8 = new RoleType[] { RoleType.Brute, RoleType.Soldier };
            slots4.Add(new EncounterTemplateSlot(3, 0, roleTypeArray8));
            encounterTemplate4.Slots.Add(new EncounterTemplateSlot(2, 1, RoleType.Artillery));
            encounterTemplate4.Slots.Add(new EncounterTemplateSlot(1, 2, RoleType.Controller));
            encounterTemplate4.Slots.Add(new EncounterTemplateSlot(1, 2, RoleType.Lurker));
            encounterTemplateGroup.Templates.Add(encounterTemplate4);
            EncounterBuilder.fTemplateGroups.Add(encounterTemplateGroup);
        }
        public void ResumeEncounter(EncounterTemplate encounterTemplate)
        {
            var clientEncounterDTO     = ClientEncounterDTO.Create(Client.Id, encounterTemplate);
            var clientEncounterDTOJson = JsonConvert.SerializeObject(clientEncounterDTO);

            _settings.AddOrUpdateValue("client.encounter.dto", clientEncounterDTOJson);

            ShowViewModel <ClientEncounterViewModel>(new
            {
                formId      = encounterTemplate.FormId.ToString(),
                mode        = "open",
                encounterId = encounterTemplate.Id.ToString()
            });
        }
        public async void DiscardEncounter(EncounterTemplate encounterTemplate)
        {
            try
            {
                var result = await _dialogService.ConfirmAction("Are you sure ?", "Delete this Encounter");

                if (result)
                {
                    _dashboardService.RemoveEncounter(encounterTemplate.Id);
                    Module = _dashboardService.LoadModule();
                }
            }
            catch (Exception e)
            {
                MvxTrace.Error(e.Message);
                _dialogService.Alert(e.Message, "Delete this Encounter");
            }
        }
Ejemplo n.º 15
0
	public void Init (EncounterTemplate encounterTemplate)
	{
		this.encounterTemplate = encounterTemplate;
		//init unit
		unitList = new List<GameUnit> ();
		for (int i = 0; i < this.encounterTemplate.UnitList.Count; i++) {
			EncounterUnitData data = this.encounterTemplate.UnitList [i];
			//map token
			GameUnit unit = new GameUnit ();
			unit.Template = GameWorld.Instance.UnitTemplateManager.GetTemplateById (data.TemplateId);
			GameWorld.Instance.gameMap.AddGameUnit (unit);
			unit.X = data.Pos.X;
			unit.Y = data.Pos.Y;
			unit.UnitSide = data.UnitSide;
			unitList.Add (unit);
		}
		GameWorld.Instance.message.ShowMessage ("战斗开始", delegate () {
			GameWorld.Instance.message.ShowMessage ("投先攻", RollInitiative);
		});
	}
Ejemplo n.º 16
0
        private static void build_template_battlefield_control()
        {
            EncounterTemplateGroup encounterTemplateGroup = new EncounterTemplateGroup("Battlefield Control", "Entire Party");
            EncounterTemplate      encounterTemplate      = new EncounterTemplate(Difficulty.Easy);

            encounterTemplate.Slots.Add(new EncounterTemplateSlot(1, -2, RoleType.Controller));
            encounterTemplate.Slots.Add(new EncounterTemplateSlot(6, -4, RoleType.Skirmisher));
            encounterTemplateGroup.Templates.Add(encounterTemplate);
            EncounterTemplate encounterTemplate1 = new EncounterTemplate(Difficulty.Moderate);

            encounterTemplate1.Slots.Add(new EncounterTemplateSlot(1, 1, RoleType.Controller));
            encounterTemplate1.Slots.Add(new EncounterTemplateSlot(6, -2, RoleType.Skirmisher));
            encounterTemplateGroup.Templates.Add(encounterTemplate1);
            EncounterTemplate encounterTemplate2 = new EncounterTemplate(Difficulty.Hard);

            encounterTemplate2.Slots.Add(new EncounterTemplateSlot(1, 5, RoleType.Controller));
            encounterTemplate2.Slots.Add(new EncounterTemplateSlot(5, 1, RoleType.Skirmisher));
            encounterTemplateGroup.Templates.Add(encounterTemplate2);
            EncounterBuilder.fTemplateGroups.Add(encounterTemplateGroup);
        }
Ejemplo n.º 17
0
        static void build_template_double_line()
        {
            EncounterTemplateGroup group = new EncounterTemplateGroup("Double Line", "Entire Party");

            EncounterTemplate dl1 = new EncounterTemplate(Difficulty.Easy);

            dl1.Slots.Add(new EncounterTemplateSlot(3, -4, new RoleType[] { RoleType.Brute, RoleType.Soldier }));
            dl1.Slots.Add(new EncounterTemplateSlot(2, -2, new RoleType[] { RoleType.Artillery, RoleType.Controller }));
            group.Templates.Add(dl1);

            EncounterTemplate dl2 = new EncounterTemplate(Difficulty.Moderate);

            dl2.Slots.Add(new EncounterTemplateSlot(3, 0, new RoleType[] { RoleType.Brute, RoleType.Soldier }));
            dl2.Slots.Add(new EncounterTemplateSlot(2, 0, new RoleType[] { RoleType.Artillery, RoleType.Controller }));
            group.Templates.Add(dl2);

            EncounterTemplate dl3 = new EncounterTemplate(Difficulty.Moderate);

            dl3.Slots.Add(new EncounterTemplateSlot(3, -2, new RoleType[] { RoleType.Brute, RoleType.Soldier }));
            dl3.Slots.Add(new EncounterTemplateSlot(2, 3, new RoleType[] { RoleType.Artillery, RoleType.Controller }));
            group.Templates.Add(dl3);

            EncounterTemplate dl4 = new EncounterTemplate(Difficulty.Hard);

            dl4.Slots.Add(new EncounterTemplateSlot(3, 2, new RoleType[] { RoleType.Brute, RoleType.Soldier }));
            dl4.Slots.Add(new EncounterTemplateSlot(1, 4, RoleType.Controller));
            dl4.Slots.Add(new EncounterTemplateSlot(1, 4, new RoleType[] { RoleType.Artillery, RoleType.Lurker }));
            group.Templates.Add(dl4);

            EncounterTemplate dl5 = new EncounterTemplate(Difficulty.Hard);

            dl5.Slots.Add(new EncounterTemplateSlot(3, 0, new RoleType[] { RoleType.Brute, RoleType.Soldier }));
            dl5.Slots.Add(new EncounterTemplateSlot(2, 1, RoleType.Artillery));
            dl5.Slots.Add(new EncounterTemplateSlot(1, 2, RoleType.Controller));
            dl5.Slots.Add(new EncounterTemplateSlot(1, 2, RoleType.Lurker));
            group.Templates.Add(dl5);

            fTemplateGroups.Add(group);
        }
Ejemplo n.º 18
0
        private static void build_template_grand_melee()
        {
            EncounterTemplateGroup encounterTemplateGroup = new EncounterTemplateGroup("Grand Melee", "Entire Party");
            EncounterTemplate      encounterTemplate      = new EncounterTemplate(Difficulty.Easy);

            encounterTemplate.Slots.Add(new EncounterTemplateSlot(4, -2, RoleType.Brute));
            encounterTemplate.Slots.Add(new EncounterTemplateSlot(11, -4, true));
            encounterTemplateGroup.Templates.Add(encounterTemplate);
            EncounterTemplate encounterTemplate1 = new EncounterTemplate(Difficulty.Moderate);

            encounterTemplate1.Slots.Add(new EncounterTemplateSlot(2, -1, RoleType.Soldier));
            encounterTemplate1.Slots.Add(new EncounterTemplateSlot(4, -2, RoleType.Brute));
            encounterTemplate1.Slots.Add(new EncounterTemplateSlot(12, -4, true));
            encounterTemplateGroup.Templates.Add(encounterTemplate1);
            EncounterTemplate encounterTemplate2 = new EncounterTemplate(Difficulty.Hard);

            encounterTemplate2.Slots.Add(new EncounterTemplateSlot(2, 0, RoleType.Soldier));
            encounterTemplate2.Slots.Add(new EncounterTemplateSlot(4, -1, RoleType.Brute));
            encounterTemplate2.Slots.Add(new EncounterTemplateSlot(17, -2, true));
            encounterTemplateGroup.Templates.Add(encounterTemplate2);
            EncounterBuilder.fTemplateGroups.Add(encounterTemplateGroup);
        }
Ejemplo n.º 19
0
        static void build_template_wolf_pack()
        {
            EncounterTemplateGroup group = new EncounterTemplateGroup("Wolf Pack", "Entire Party");

            EncounterTemplate wp1 = new EncounterTemplate(Difficulty.Easy);

            wp1.Slots.Add(new EncounterTemplateSlot(7, -4, RoleType.Skirmisher));
            group.Templates.Add(wp1);

            EncounterTemplate wp2 = new EncounterTemplate(Difficulty.Moderate);

            wp2.Slots.Add(new EncounterTemplateSlot(7, -2, RoleType.Skirmisher));
            group.Templates.Add(wp2);

            EncounterTemplate wp3 = new EncounterTemplate(Difficulty.Moderate);

            wp3.Slots.Add(new EncounterTemplateSlot(5, 0, RoleType.Skirmisher));
            group.Templates.Add(wp3);

            EncounterTemplate wp4 = new EncounterTemplate(Difficulty.Hard);

            wp4.Slots.Add(new EncounterTemplateSlot(3, 5, RoleType.Skirmisher));
            group.Templates.Add(wp4);

            EncounterTemplate wp5 = new EncounterTemplate(Difficulty.Hard);

            wp5.Slots.Add(new EncounterTemplateSlot(4, 5, RoleType.Skirmisher));
            group.Templates.Add(wp5);

            EncounterTemplate wp6 = new EncounterTemplate(Difficulty.Hard);

            wp6.Slots.Add(new EncounterTemplateSlot(6, 2, RoleType.Skirmisher));
            group.Templates.Add(wp6);

            fTemplateGroups.Add(group);
        }
Ejemplo n.º 20
0
        private static void build_template_commander_and_troops()
        {
            EncounterTemplateGroup       encounterTemplateGroup = new EncounterTemplateGroup("Commander and Troops", "Entire Party");
            EncounterTemplate            encounterTemplate      = new EncounterTemplate(Difficulty.Easy);
            List <EncounterTemplateSlot> slots = encounterTemplate.Slots;

            RoleType[] roleTypeArray = new RoleType[] { RoleType.Controller, RoleType.Soldier, RoleType.Lurker, RoleType.Skirmisher };
            slots.Add(new EncounterTemplateSlot(1, 0, roleTypeArray));
            List <EncounterTemplateSlot> encounterTemplateSlots = encounterTemplate.Slots;

            RoleType[] roleTypeArray1 = new RoleType[] { RoleType.Brute, RoleType.Soldier };
            encounterTemplateSlots.Add(new EncounterTemplateSlot(4, -3, roleTypeArray1));
            encounterTemplateGroup.Templates.Add(encounterTemplate);
            EncounterTemplate            encounterTemplate1 = new EncounterTemplate(Difficulty.Moderate);
            List <EncounterTemplateSlot> slots1             = encounterTemplate1.Slots;

            RoleType[] roleTypeArray2 = new RoleType[] { RoleType.Controller, RoleType.Soldier, RoleType.Lurker, RoleType.Skirmisher };
            slots1.Add(new EncounterTemplateSlot(1, 3, roleTypeArray2));
            List <EncounterTemplateSlot> encounterTemplateSlots1 = encounterTemplate1.Slots;

            RoleType[] roleTypeArray3 = new RoleType[] { RoleType.Brute, RoleType.Soldier };
            encounterTemplateSlots1.Add(new EncounterTemplateSlot(5, -2, roleTypeArray3));
            encounterTemplateGroup.Templates.Add(encounterTemplate1);
            EncounterTemplate            encounterTemplate2 = new EncounterTemplate(Difficulty.Hard);
            List <EncounterTemplateSlot> slots2             = encounterTemplate2.Slots;

            RoleType[] roleTypeArray4 = new RoleType[] { RoleType.Controller, RoleType.Soldier, RoleType.Lurker, RoleType.Skirmisher };
            slots2.Add(new EncounterTemplateSlot(1, 5, roleTypeArray4));
            List <EncounterTemplateSlot> encounterTemplateSlots2 = encounterTemplate2.Slots;

            RoleType[] roleTypeArray5 = new RoleType[] { RoleType.Brute, RoleType.Soldier };
            encounterTemplateSlots2.Add(new EncounterTemplateSlot(3, 1, roleTypeArray5));
            encounterTemplate2.Slots.Add(new EncounterTemplateSlot(2, 1, new RoleType[1]));
            encounterTemplateGroup.Templates.Add(encounterTemplate2);
            EncounterBuilder.fTemplateGroups.Add(encounterTemplateGroup);
        }
Ejemplo n.º 21
0
        static void build_template_battlefield_control()
        {
            EncounterTemplateGroup group = new EncounterTemplateGroup("Battlefield Control", "Entire Party");

            EncounterTemplate bc1 = new EncounterTemplate(Difficulty.Easy);

            bc1.Slots.Add(new EncounterTemplateSlot(1, -2, RoleType.Controller));
            bc1.Slots.Add(new EncounterTemplateSlot(6, -4, RoleType.Skirmisher));
            group.Templates.Add(bc1);

            EncounterTemplate bc2 = new EncounterTemplate(Difficulty.Moderate);

            bc2.Slots.Add(new EncounterTemplateSlot(1, 1, RoleType.Controller));
            bc2.Slots.Add(new EncounterTemplateSlot(6, -2, RoleType.Skirmisher));
            group.Templates.Add(bc2);

            EncounterTemplate bc3 = new EncounterTemplate(Difficulty.Hard);

            bc3.Slots.Add(new EncounterTemplateSlot(1, 5, RoleType.Controller));
            bc3.Slots.Add(new EncounterTemplateSlot(5, 1, RoleType.Skirmisher));
            group.Templates.Add(bc3);

            fTemplateGroups.Add(group);
        }
Ejemplo n.º 22
0
        private static void build_template_duel()
        {
            EncounterTemplateGroup encounterTemplateGroup = new EncounterTemplateGroup("Duel vs Controller", "Individual PC");
            EncounterTemplate      encounterTemplate      = new EncounterTemplate(Difficulty.Easy);

            encounterTemplate.Slots.Add(new EncounterTemplateSlot(1, 0, RoleType.Artillery));
            encounterTemplateGroup.Templates.Add(encounterTemplate);
            EncounterTemplate            encounterTemplate1 = new EncounterTemplate(Difficulty.Easy);
            List <EncounterTemplateSlot> slots = encounterTemplate1.Slots;

            RoleType[] roleTypeArray = new RoleType[] { RoleType.Controller, RoleType.Skirmisher };
            slots.Add(new EncounterTemplateSlot(1, -1, roleTypeArray));
            encounterTemplateGroup.Templates.Add(encounterTemplate1);
            EncounterTemplate encounterTemplate2 = new EncounterTemplate(Difficulty.Moderate);

            encounterTemplate2.Slots.Add(new EncounterTemplateSlot(1, 2, RoleType.Artillery));
            encounterTemplateGroup.Templates.Add(encounterTemplate2);
            EncounterTemplate            encounterTemplate3     = new EncounterTemplate(Difficulty.Moderate);
            List <EncounterTemplateSlot> encounterTemplateSlots = encounterTemplate3.Slots;

            RoleType[] roleTypeArray1 = new RoleType[] { RoleType.Controller, RoleType.Skirmisher };
            encounterTemplateSlots.Add(new EncounterTemplateSlot(1, 1, roleTypeArray1));
            encounterTemplateGroup.Templates.Add(encounterTemplate3);
            EncounterTemplate encounterTemplate4 = new EncounterTemplate(Difficulty.Hard);

            encounterTemplate4.Slots.Add(new EncounterTemplateSlot(1, 4, RoleType.Artillery));
            encounterTemplateGroup.Templates.Add(encounterTemplate4);
            EncounterTemplate            encounterTemplate5 = new EncounterTemplate(Difficulty.Hard);
            List <EncounterTemplateSlot> slots1             = encounterTemplate5.Slots;

            RoleType[] roleTypeArray2 = new RoleType[] { RoleType.Controller, RoleType.Skirmisher };
            slots1.Add(new EncounterTemplateSlot(1, 3, roleTypeArray2));
            encounterTemplateGroup.Templates.Add(encounterTemplate5);
            EncounterBuilder.fTemplateGroups.Add(encounterTemplateGroup);
            EncounterTemplateGroup encounterTemplateGroup1 = new EncounterTemplateGroup("Duel vs Defender", "Individual PC");
            EncounterTemplate      encounterTemplate6      = new EncounterTemplate(Difficulty.Easy);

            encounterTemplate6.Slots.Add(new EncounterTemplateSlot(1, 0, RoleType.Skirmisher));
            encounterTemplateGroup1.Templates.Add(encounterTemplate6);
            EncounterTemplate            encounterTemplate7      = new EncounterTemplate(Difficulty.Easy);
            List <EncounterTemplateSlot> encounterTemplateSlots1 = encounterTemplate7.Slots;

            RoleType[] roleTypeArray3 = new RoleType[] { RoleType.Brute, RoleType.Soldier };
            encounterTemplateSlots1.Add(new EncounterTemplateSlot(1, -1, roleTypeArray3));
            encounterTemplateGroup1.Templates.Add(encounterTemplate7);
            EncounterTemplate encounterTemplate8 = new EncounterTemplate(Difficulty.Moderate);

            encounterTemplate8.Slots.Add(new EncounterTemplateSlot(1, 2, RoleType.Skirmisher));
            encounterTemplateGroup1.Templates.Add(encounterTemplate8);
            EncounterTemplate            encounterTemplate9 = new EncounterTemplate(Difficulty.Moderate);
            List <EncounterTemplateSlot> slots2             = encounterTemplate9.Slots;

            RoleType[] roleTypeArray4 = new RoleType[] { RoleType.Brute, RoleType.Soldier };
            slots2.Add(new EncounterTemplateSlot(1, 1, roleTypeArray4));
            encounterTemplateGroup1.Templates.Add(encounterTemplate9);
            EncounterTemplate encounterTemplate10 = new EncounterTemplate(Difficulty.Hard);

            encounterTemplate10.Slots.Add(new EncounterTemplateSlot(1, 4, RoleType.Skirmisher));
            encounterTemplateGroup1.Templates.Add(encounterTemplate10);
            EncounterTemplate            encounterTemplate11     = new EncounterTemplate(Difficulty.Hard);
            List <EncounterTemplateSlot> encounterTemplateSlots2 = encounterTemplate11.Slots;

            RoleType[] roleTypeArray5 = new RoleType[] { RoleType.Controller, RoleType.Skirmisher };
            encounterTemplateSlots2.Add(new EncounterTemplateSlot(1, 3, roleTypeArray5));
            encounterTemplateGroup1.Templates.Add(encounterTemplate11);
            EncounterBuilder.fTemplateGroups.Add(encounterTemplateGroup1);
            EncounterTemplateGroup encounterTemplateGroup2 = new EncounterTemplateGroup("Duel vs Leader", "Individual PC");
            EncounterTemplate      encounterTemplate12     = new EncounterTemplate(Difficulty.Easy);

            encounterTemplate12.Slots.Add(new EncounterTemplateSlot(1, 0, RoleType.Skirmisher));
            encounterTemplateGroup2.Templates.Add(encounterTemplate12);
            EncounterTemplate            encounterTemplate13 = new EncounterTemplate(Difficulty.Easy);
            List <EncounterTemplateSlot> slots3 = encounterTemplate13.Slots;

            RoleType[] roleTypeArray6 = new RoleType[] { RoleType.Controller, RoleType.Soldier };
            slots3.Add(new EncounterTemplateSlot(1, -1, roleTypeArray6));
            encounterTemplateGroup2.Templates.Add(encounterTemplate13);
            EncounterTemplate encounterTemplate14 = new EncounterTemplate(Difficulty.Moderate);

            encounterTemplate14.Slots.Add(new EncounterTemplateSlot(1, 2, RoleType.Skirmisher));
            encounterTemplateGroup2.Templates.Add(encounterTemplate14);
            EncounterTemplate            encounterTemplate15     = new EncounterTemplate(Difficulty.Moderate);
            List <EncounterTemplateSlot> encounterTemplateSlots3 = encounterTemplate15.Slots;

            RoleType[] roleTypeArray7 = new RoleType[] { RoleType.Controller, RoleType.Soldier };
            encounterTemplateSlots3.Add(new EncounterTemplateSlot(1, 1, roleTypeArray7));
            encounterTemplateGroup2.Templates.Add(encounterTemplate15);
            EncounterTemplate encounterTemplate16 = new EncounterTemplate(Difficulty.Hard);

            encounterTemplate16.Slots.Add(new EncounterTemplateSlot(1, 4, RoleType.Skirmisher));
            encounterTemplateGroup2.Templates.Add(encounterTemplate16);
            EncounterTemplate            encounterTemplate17 = new EncounterTemplate(Difficulty.Hard);
            List <EncounterTemplateSlot> slots4 = encounterTemplate17.Slots;

            RoleType[] roleTypeArray8 = new RoleType[] { RoleType.Controller, RoleType.Soldier };
            slots4.Add(new EncounterTemplateSlot(1, 3, roleTypeArray8));
            encounterTemplateGroup2.Templates.Add(encounterTemplate17);
            EncounterBuilder.fTemplateGroups.Add(encounterTemplateGroup2);
            EncounterTemplateGroup encounterTemplateGroup3 = new EncounterTemplateGroup("Duel vs Striker", "Individual PC");
            EncounterTemplate      encounterTemplate18     = new EncounterTemplate(Difficulty.Easy);

            encounterTemplate18.Slots.Add(new EncounterTemplateSlot(1, 0, RoleType.Skirmisher));
            encounterTemplateGroup3.Templates.Add(encounterTemplate18);
            EncounterTemplate            encounterTemplate19     = new EncounterTemplate(Difficulty.Easy);
            List <EncounterTemplateSlot> encounterTemplateSlots4 = encounterTemplate19.Slots;

            RoleType[] roleTypeArray9 = new RoleType[] { RoleType.Brute, RoleType.Soldier };
            encounterTemplateSlots4.Add(new EncounterTemplateSlot(1, -1, roleTypeArray9));
            encounterTemplateGroup3.Templates.Add(encounterTemplate19);
            EncounterTemplate encounterTemplate20 = new EncounterTemplate(Difficulty.Moderate);

            encounterTemplate20.Slots.Add(new EncounterTemplateSlot(1, 2, RoleType.Skirmisher));
            encounterTemplateGroup3.Templates.Add(encounterTemplate20);
            EncounterTemplate            encounterTemplate21 = new EncounterTemplate(Difficulty.Moderate);
            List <EncounterTemplateSlot> slots5 = encounterTemplate21.Slots;

            RoleType[] roleTypeArray10 = new RoleType[] { RoleType.Brute, RoleType.Soldier };
            slots5.Add(new EncounterTemplateSlot(1, 1, roleTypeArray10));
            encounterTemplateGroup3.Templates.Add(encounterTemplate21);
            EncounterTemplate encounterTemplate22 = new EncounterTemplate(Difficulty.Hard);

            encounterTemplate22.Slots.Add(new EncounterTemplateSlot(1, 4, RoleType.Skirmisher));
            encounterTemplateGroup3.Templates.Add(encounterTemplate22);
            EncounterTemplate            encounterTemplate23     = new EncounterTemplate(Difficulty.Hard);
            List <EncounterTemplateSlot> encounterTemplateSlots5 = encounterTemplate23.Slots;

            RoleType[] roleTypeArray11 = new RoleType[] { RoleType.Brute, RoleType.Soldier };
            encounterTemplateSlots5.Add(new EncounterTemplateSlot(1, 3, roleTypeArray11));
            encounterTemplateGroup3.Templates.Add(encounterTemplate23);
            EncounterBuilder.fTemplateGroups.Add(encounterTemplateGroup3);
        }
Ejemplo n.º 23
0
    private void GenerateEncounter(EncounterTemplate template)
    {
        //spawn terrain
        foreach (Hex rockpos in template.terrainPieces)
        {
            Entity rock = entFactory.CreateTerrain(rockTerrain);
            rock.AddToGrid(worldGrid, rockpos);
            allEntities.Add(rock);
        }

        //spawn player
        Hex playerspawn = template.playerSpawnPoints.GetRandom();

        player = entFactory.CreateEntity(40);
        player.AddToGrid(worldGrid, playerspawn);
        player.EnableStatusEffects(true);
        player.entityName = "Player";
        if (GameplayContext.LastPlayerHealth > -1)
        {
            player.Health.SetHealth(GameplayContext.LastPlayerHealth);
        }
        player.appearance.sprite       = Resources.Load <Sprite>("Sprites/PlayerArt");
        player.OnStatusEffectsChanged += UpdatePlayerStatusEffectPanel;
        ColorUtility.TryParseHtmlString("#46537d", out Color col);
        playerHealthBar.Colour   = col;
        playerHealthBar.MaxValue = player.Health.MaxHealth;


        //select enemygroup, ignoring difficulty when in debug mode
        EnemyGroup enemyGroup;

        if (GameplayContext.InDebugMode)
        {
            enemyGroup = entFactory.GetEnemyGroup(template.minEnemies, template.maxEnemies);
        }
        else
        {
            int maxDif = GameplayContext.CurrentDifficulty;
            int minDif = Math.Max(1, maxDif - difficultyThreshold);
            enemyGroup = entFactory.GetEnemyGroup(template.minEnemies, template.maxEnemies, minDif, maxDif);
            Debug.Log("making encounter using " + GameplayContext.CurrentDifficulty);
        }

        List <PODHex> enemySpots = new List <PODHex>(template.enemySpawnPoints);

        //spawn enemies
        foreach (string enemyType in enemyGroup.enemies)
        {
            if (enemySpots.Count == 0)
            {
                break;
            }

            Hex    spawnpoint = enemySpots.PopRandom();
            Entity e          = entFactory.CreateEntity(10);

            e.AddToGrid(worldGrid, spawnpoint);
            e.EnableStatusEffects(true);
            entFactory.AddAIController(e, enemyType);
            e.Health.OnDeath += () => { CleanupEntity(e); };
            Debug.Log("spawned: " + e.entityName);
            allEntities.Add(e);
            allEnemies.Add(e);
        }
        //
    }
Ejemplo n.º 24
0
        public void ResumeEncounter(EncounterTemplate encounterTemplate)
        {
            if (!CheckEligibility())
            {
                return;
            }

            var clientEncounterDTO     = ClientEncounterDTO.Create(Client.Id, encounterTemplate);
            var clientEncounterDTOJson = JsonConvert.SerializeObject(clientEncounterDTO);

            _settings.AddOrUpdateValue("client.encounter.dto", clientEncounterDTOJson);



            if (encounterTemplate.FormDisplay.ToLower().Contains("Test Form".ToLower()))
            {
                ShowViewModel <TestingViewModel>(new
                {
                    formId          = encounterTemplate.FormId.ToString(),
                    encounterTypeId = encounterTemplate.EncounterTypeId.ToString(),
                    mode            = "open",
                    clientId        = Client.Id.ToString(),
                    encounterId     = encounterTemplate.Id.ToString()
                });
                return;
            }
            //Linkage
            if (encounterTemplate.FormDisplay.ToLower().Contains("Linkage".ToLower()))
            {
                ShowViewModel <LinkageViewModel>(new
                {
                    formId          = encounterTemplate.FormId.ToString(),
                    encounterTypeId = encounterTemplate.EncounterTypeId.ToString(),
                    mode            = "open",
                    clientId        = Client.Id.ToString(),
                    encounterId     = encounterTemplate.Id.ToString()
                });
                return;
            }

            //Member Screening
            if (encounterTemplate.FormDisplay.ToLower().Contains("Member Screening".ToLower()))
            {
                ShowViewModel <MemberScreeningViewModel>(new
                {
                    formId          = encounterTemplate.FormId.ToString(),
                    encounterTypeId = encounterTemplate.EncounterTypeId.ToString(),
                    mode            = "open",
                    clientId        = Client.Id.ToString(),
                    encounterId     = encounterTemplate.Id.ToString(),
                    indexclient     = null != IndexClient ? IndexClient.Id.ToString() : ""
                });
                return;
            }

            //Member Tracing
            if (encounterTemplate.FormDisplay.ToLower().Contains("Member Tracing".ToLower()))
            {
                ShowViewModel <MemberTracingViewModel>(new
                {
                    formId          = encounterTemplate.FormId.ToString(),
                    encounterTypeId = encounterTemplate.EncounterTypeId.ToString(),
                    mode            = "open",
                    clientId        = Client.Id.ToString(),
                    encounterId     = encounterTemplate.Id.ToString(),
                    indexclient     = null != IndexClient ? IndexClient.Id.ToString() : ""
                });
                return;
            }


            //Partner Screening
            if (encounterTemplate.FormDisplay.ToLower().Contains("Partner Screening".ToLower()))
            {
                ShowViewModel <PartnerScreeningViewModel>(new
                {
                    formId          = encounterTemplate.FormId.ToString(),
                    encounterTypeId = encounterTemplate.EncounterTypeId.ToString(),
                    mode            = "open",
                    clientId        = Client.Id.ToString(),
                    encounterId     = encounterTemplate.Id.ToString(),
                    indexclient     = null != IndexClient ? IndexClient.Id.ToString() : ""
                });
                return;
            }

            //Partner Screening
            if (encounterTemplate.FormDisplay.ToLower().Contains("Partner Tracing".ToLower()))
            {
                ShowViewModel <PartnerTracingViewModel>(new
                {
                    formId          = encounterTemplate.FormId.ToString(),
                    encounterTypeId = encounterTemplate.EncounterTypeId.ToString(),
                    mode            = "open",
                    clientId        = Client.Id.ToString(),
                    encounterId     = encounterTemplate.Id.ToString(),
                    indexclient     = null != IndexClient ? IndexClient.Id.ToString() : ""
                });
                return;
            }
            ShowViewModel <ClientEncounterViewModel>(new
            {
                formId          = encounterTemplate.FormId.ToString(),
                encounterTypeId = encounterTemplate.EncounterTypeId.ToString(),
                mode            = "open",
                encounterId     = encounterTemplate.Id.ToString()
            });
        }
Ejemplo n.º 25
0
        public static List <Pair <EncounterTemplateGroup, EncounterTemplate> > FindTemplates(Encounter enc, int level, bool include_individual)
        {
            EncounterBuilder.build_template_list("", Difficulty.Random, level, include_individual);
            List <Pair <EncounterTemplateGroup, EncounterTemplate> > pairs = new List <Pair <EncounterTemplateGroup, EncounterTemplate> >();

            foreach (EncounterTemplateGroup fTemplateGroup in EncounterBuilder.fTemplateGroups)
            {
                foreach (EncounterTemplate template in fTemplateGroup.Templates)
                {
                    EncounterTemplate encounterTemplate = template.Copy();
                    bool flag = true;
                    foreach (EncounterSlot slot in enc.Slots)
                    {
                        EncounterTemplateSlot encounterTemplateSlot = encounterTemplate.FindSlot(slot, level);
                        if (encounterTemplateSlot == null)
                        {
                            flag = false;
                            break;
                        }
                        else
                        {
                            EncounterTemplateSlot count = encounterTemplateSlot;
                            count.Count = count.Count - slot.CombatData.Count;
                            if (encounterTemplateSlot.Count > 0)
                            {
                                continue;
                            }
                            encounterTemplate.Slots.Remove(encounterTemplateSlot);
                        }
                    }
                    if (!flag)
                    {
                        continue;
                    }
                    bool flag1 = true;
                    foreach (EncounterTemplateSlot slot1 in encounterTemplate.Slots)
                    {
                        bool flag2 = false;
                        int  num   = level + slot1.LevelAdjustment;
                        EncounterBuilder.build_creature_list(num, num, null, null, true);
                        foreach (EncounterCard fCreature in EncounterBuilder.fCreatures)
                        {
                            if (!slot1.Match(fCreature, level))
                            {
                                continue;
                            }
                            flag2 = true;
                            break;
                        }
                        if (flag2)
                        {
                            continue;
                        }
                        flag1 = false;
                        break;
                    }
                    if (!flag1)
                    {
                        continue;
                    }
                    pairs.Add(new Pair <EncounterTemplateGroup, EncounterTemplate>(fTemplateGroup, encounterTemplate));
                }
            }
            return(pairs);
        }
 public EncounterTemplateWrap(IEncounterViewModel encounterViewModel, EncounterTemplate encounterTemplate)
 {
     _encounterTemplate  = encounterTemplate;
     _encounterViewModel = encounterViewModel;
 }
 public EncounterTemplateWrap(ClientDashboardViewModel parent, EncounterTemplate encounterTemplate)
 {
     _parent            = parent;
     _encounterTemplate = encounterTemplate;
 }
Ejemplo n.º 28
0
	public void Init ()
	{
		EncounterTemplate template = new EncounterTemplate ();
		template.Id = 1;
		templateDic [template.Id] = template;

		EncounterUnitData data = new EncounterUnitData ();
		data.TemplateId = 4;
		data.UnitSide = UnitSide.RED;
		data.Pos = new VectorInt2 (0, 5);
		template.UnitList.Add (data);

		data = new EncounterUnitData ();
		data.TemplateId = 5;
		data.UnitSide = UnitSide.RED;
		data.Pos = new VectorInt2 (0, 6);
		template.UnitList.Add (data);

		data = new EncounterUnitData ();
		data.TemplateId = 6;
		data.UnitSide = UnitSide.RED;
		data.Pos = new VectorInt2 (0, 7);
		template.UnitList.Add (data);

		data = new EncounterUnitData ();
		data.TemplateId = 7;
		data.UnitSide = UnitSide.RED;
		data.Pos = new VectorInt2 (1, 5);
		template.UnitList.Add (data);

		data = new EncounterUnitData ();
		data.TemplateId = 8;
		data.UnitSide = UnitSide.RED;
		data.Pos = new VectorInt2 (1, 7);
		template.UnitList.Add (data);

		data = new EncounterUnitData ();
		data.TemplateId = 3;
		data.UnitSide = UnitSide.BLUE;
		data.Pos = new VectorInt2 (11, 8);
		template.UnitList.Add (data);

		data = new EncounterUnitData ();
		data.TemplateId = 3;
		data.UnitSide = UnitSide.BLUE;
		data.Pos = new VectorInt2 (11, 9);
		template.UnitList.Add (data);

		data = new EncounterUnitData ();
		data.TemplateId = 2;
		data.UnitSide = UnitSide.BLUE;
		data.Pos = new VectorInt2 (14, 10);
		template.UnitList.Add (data);

		data = new EncounterUnitData ();
		data.TemplateId = 2;
		data.UnitSide = UnitSide.BLUE;
		data.Pos = new VectorInt2 (11, 16);
		template.UnitList.Add (data);

		data = new EncounterUnitData ();
		data.TemplateId = 2;
		data.UnitSide = UnitSide.BLUE;
		data.Pos = new VectorInt2 (12, 17);
		template.UnitList.Add (data);

		data = new EncounterUnitData ();
		data.TemplateId = 2;
		data.UnitSide = UnitSide.BLUE;
		data.Pos = new VectorInt2 (13, 17);
		template.UnitList.Add (data);

		data = new EncounterUnitData ();
		data.TemplateId = 2;
		data.UnitSide = UnitSide.BLUE;
		data.Pos = new VectorInt2 (8, 17);
		template.UnitList.Add (data);

		data = new EncounterUnitData ();
		data.TemplateId = 1;
		data.UnitSide = UnitSide.BLUE;
		data.Pos = new VectorInt2 (9, 16);
		template.UnitList.Add (data);
	}
 public void ReviewEncounter(EncounterTemplate encounterTemplate)
 {
     ResumeEncounter(encounterTemplate);
 }
Ejemplo n.º 30
0
        public static bool Build(AutoBuildData data, Encounter enc, bool include_individual)
        {
            int min_level = Math.Max(data.Level - 4, 1);
            int max_level = data.Level + 5;

            build_creature_list(min_level, max_level, data.Categories, data.Keywords, true);

            if (fCreatures.Count == 0)
            {
                return(false);
            }

            build_template_list(data.Type, data.Difficulty, data.Level, include_individual);
            if (fTemplateGroups.Count == 0)
            {
                return(false);
            }

            build_trap_list(data.Level);
            build_challenge_list(data.Level);

            int attempts = 0;

            while (attempts < TRIES)
            {
                attempts += 1;

                // Pick a template
                int group_index = Session.Random.Next() % fTemplateGroups.Count;
                EncounterTemplateGroup group = fTemplateGroups[group_index];
                int template_index           = Session.Random.Next() % group.Templates.Count;
                EncounterTemplate template   = group.Templates[template_index];

                bool ok = true;
                List <EncounterSlot> slots = new List <EncounterSlot>();
                foreach (EncounterTemplateSlot template_slot in template.Slots)
                {
                    // Attempt to populate the slot
                    List <EncounterCard> candidates = new List <EncounterCard>();
                    foreach (EncounterCard card in fCreatures)
                    {
                        if (template_slot.Match(card, data.Level))
                        {
                            candidates.Add(card);
                        }
                    }

                    if (candidates.Count == 0)
                    {
                        ok = false;
                        break;
                    }

                    // Choose a candidate
                    int           creature_index = Session.Random.Next() % candidates.Count;
                    EncounterCard candidate      = candidates[creature_index];

                    // Build the slot
                    EncounterSlot slot = new EncounterSlot();
                    slot.Card = candidate;
                    for (int n = 0; n != template_slot.Count; ++n)
                    {
                        CombatData ccd = new CombatData();
                        slot.CombatData.Add(ccd);
                    }

                    slots.Add(slot);
                }

                if (ok)
                {
                    enc.Slots = slots;
                    enc.Traps.Clear();
                    enc.SkillChallenges.Clear();

                    // Random modification
                    switch (Session.Random.Next(12))
                    {
                    case 4:
                    case 5:
                    {
                        // Replace a creature with a trap / hazard
                        if (add_trap(enc))
                        {
                            remove_creature(enc);
                        }
                    }
                    break;

                    case 6:
                    {
                        // Replace a creature with a skill challenge
                        if (add_challenge(enc))
                        {
                            remove_creature(enc);
                        }
                    }
                    break;

                    case 7:
                    {
                        // Replace a creature with a lurker
                        if (add_lurker(enc))
                        {
                            remove_creature(enc);
                        }
                    }
                    break;

                    case 8:
                    case 9:
                    {
                        // Add a trap / hazard
                        add_trap(enc);
                        Difficulty diff = enc.GetDifficulty(data.Level, data.Size);
                        if ((diff == Difficulty.Hard) || (diff == Difficulty.Extreme))
                        {
                            remove_creature(enc);
                        }
                    }
                    break;

                    case 10:
                    {
                        // Add a skill challenge
                        Difficulty diff = enc.GetDifficulty(data.Level, data.Size);
                        if ((diff == Difficulty.Hard) || (diff == Difficulty.Extreme))
                        {
                            remove_creature(enc);
                        }
                        add_challenge(enc);
                    }
                    break;

                    case 11:
                    {
                        // Add a lurker
                        add_lurker(enc);
                        Difficulty diff = enc.GetDifficulty(data.Level, data.Size);
                        if ((diff == Difficulty.Hard) || (diff == Difficulty.Extreme))
                        {
                            remove_creature(enc);
                        }
                    }
                    break;
                    }

                    while ((enc.GetDifficulty(data.Level, data.Size) == Difficulty.Extreme) && (enc.Count > 1))
                    {
                        remove_creature(enc);
                    }

                    foreach (EncounterSlot slot in enc.Slots)
                    {
                        slot.SetDefaultDisplayNames();
                    }

                    return(true);
                }
            }

            // We were unable to build the encounter
            return(false);
        }
Ejemplo n.º 31
0
        public static List <Pair <EncounterTemplateGroup, EncounterTemplate> > FindTemplates(Encounter enc, int level, bool include_individual)
        {
            build_template_list("", Difficulty.Random, level, include_individual);

            List <Pair <EncounterTemplateGroup, EncounterTemplate> > templates = new List <Pair <EncounterTemplateGroup, EncounterTemplate> >();

            foreach (EncounterTemplateGroup group in fTemplateGroups)
            {
                foreach (EncounterTemplate template in group.Templates)
                {
                    EncounterTemplate tmpl = template.Copy();

                    // Does this template fit what we've already got?
                    bool match = true;
                    foreach (EncounterSlot enc_slot in enc.Slots)
                    {
                        EncounterTemplateSlot template_slot = tmpl.FindSlot(enc_slot, level);

                        if (template_slot != null)
                        {
                            template_slot.Count -= enc_slot.CombatData.Count;
                            if (template_slot.Count <= 0)
                            {
                                tmpl.Slots.Remove(template_slot);
                            }
                        }
                        else
                        {
                            match = false;
                            break;
                        }
                    }
                    if (!match)
                    {
                        continue;
                    }

                    // Make sure there's at least one possible creature for each remaining slot
                    bool has_creatures = true;
                    foreach (EncounterTemplateSlot ets in tmpl.Slots)
                    {
                        bool found_creature = false;

                        int creature_level = level + ets.LevelAdjustment;
                        build_creature_list(creature_level, creature_level, null, null, true);
                        foreach (EncounterCard card in fCreatures)
                        {
                            if (ets.Match(card, level))
                            {
                                found_creature = true;
                                break;
                            }
                        }

                        if (!found_creature)
                        {
                            has_creatures = false;
                            break;
                        }
                    }
                    if (!has_creatures)
                    {
                        continue;
                    }

                    templates.Add(new Pair <EncounterTemplateGroup, EncounterTemplate>(group, tmpl));
                }
            }

            return(templates);
        }
Ejemplo n.º 32
0
        static void build_template_duel()
        {
            #region Controller

            EncounterTemplateGroup group_controller = new EncounterTemplateGroup("Duel vs Controller", "Individual PC");

            EncounterTemplate c1 = new EncounterTemplate(Difficulty.Easy);
            c1.Slots.Add(new EncounterTemplateSlot(1, 0, RoleType.Artillery));
            group_controller.Templates.Add(c1);

            EncounterTemplate c2 = new EncounterTemplate(Difficulty.Easy);
            c2.Slots.Add(new EncounterTemplateSlot(1, -1, new RoleType[] { RoleType.Controller, RoleType.Skirmisher }));
            group_controller.Templates.Add(c2);

            EncounterTemplate c3 = new EncounterTemplate(Difficulty.Moderate);
            c3.Slots.Add(new EncounterTemplateSlot(1, 2, RoleType.Artillery));
            group_controller.Templates.Add(c3);

            EncounterTemplate c4 = new EncounterTemplate(Difficulty.Moderate);
            c4.Slots.Add(new EncounterTemplateSlot(1, 1, new RoleType[] { RoleType.Controller, RoleType.Skirmisher }));
            group_controller.Templates.Add(c4);

            EncounterTemplate c5 = new EncounterTemplate(Difficulty.Hard);
            c5.Slots.Add(new EncounterTemplateSlot(1, 4, RoleType.Artillery));
            group_controller.Templates.Add(c5);

            EncounterTemplate c6 = new EncounterTemplate(Difficulty.Hard);
            c6.Slots.Add(new EncounterTemplateSlot(1, 3, new RoleType[] { RoleType.Controller, RoleType.Skirmisher }));
            group_controller.Templates.Add(c6);

            fTemplateGroups.Add(group_controller);

            #endregion

            #region Defender

            EncounterTemplateGroup group_defender = new EncounterTemplateGroup("Duel vs Defender", "Individual PC");

            EncounterTemplate d1 = new EncounterTemplate(Difficulty.Easy);
            d1.Slots.Add(new EncounterTemplateSlot(1, 0, RoleType.Skirmisher));
            group_defender.Templates.Add(d1);

            EncounterTemplate d2 = new EncounterTemplate(Difficulty.Easy);
            d2.Slots.Add(new EncounterTemplateSlot(1, -1, new RoleType[] { RoleType.Brute, RoleType.Soldier }));
            group_defender.Templates.Add(d2);

            EncounterTemplate d3 = new EncounterTemplate(Difficulty.Moderate);
            d3.Slots.Add(new EncounterTemplateSlot(1, 2, RoleType.Skirmisher));
            group_defender.Templates.Add(d3);

            EncounterTemplate d4 = new EncounterTemplate(Difficulty.Moderate);
            d4.Slots.Add(new EncounterTemplateSlot(1, 1, new RoleType[] { RoleType.Brute, RoleType.Soldier }));
            group_defender.Templates.Add(d4);

            EncounterTemplate d5 = new EncounterTemplate(Difficulty.Hard);
            d5.Slots.Add(new EncounterTemplateSlot(1, 4, RoleType.Skirmisher));
            group_defender.Templates.Add(d5);

            EncounterTemplate d6 = new EncounterTemplate(Difficulty.Hard);
            d6.Slots.Add(new EncounterTemplateSlot(1, 3, new RoleType[] { RoleType.Controller, RoleType.Skirmisher }));
            group_defender.Templates.Add(d6);

            fTemplateGroups.Add(group_defender);

            #endregion

            #region Leader

            EncounterTemplateGroup group_leader = new EncounterTemplateGroup("Duel vs Leader", "Individual PC");

            EncounterTemplate l1 = new EncounterTemplate(Difficulty.Easy);
            l1.Slots.Add(new EncounterTemplateSlot(1, 0, RoleType.Skirmisher));
            group_leader.Templates.Add(l1);

            EncounterTemplate l2 = new EncounterTemplate(Difficulty.Easy);
            l2.Slots.Add(new EncounterTemplateSlot(1, -1, new RoleType[] { RoleType.Controller, RoleType.Soldier }));
            group_leader.Templates.Add(l2);

            EncounterTemplate l3 = new EncounterTemplate(Difficulty.Moderate);
            l3.Slots.Add(new EncounterTemplateSlot(1, 2, RoleType.Skirmisher));
            group_leader.Templates.Add(l3);

            EncounterTemplate l4 = new EncounterTemplate(Difficulty.Moderate);
            l4.Slots.Add(new EncounterTemplateSlot(1, 1, new RoleType[] { RoleType.Controller, RoleType.Soldier }));
            group_leader.Templates.Add(l4);

            EncounterTemplate l5 = new EncounterTemplate(Difficulty.Hard);
            l5.Slots.Add(new EncounterTemplateSlot(1, 4, RoleType.Skirmisher));
            group_leader.Templates.Add(l5);

            EncounterTemplate l6 = new EncounterTemplate(Difficulty.Hard);
            l6.Slots.Add(new EncounterTemplateSlot(1, 3, new RoleType[] { RoleType.Controller, RoleType.Soldier }));
            group_leader.Templates.Add(l6);

            fTemplateGroups.Add(group_leader);

            #endregion

            #region Striker

            EncounterTemplateGroup group_striker = new EncounterTemplateGroup("Duel vs Striker", "Individual PC");

            EncounterTemplate s1 = new EncounterTemplate(Difficulty.Easy);
            s1.Slots.Add(new EncounterTemplateSlot(1, 0, RoleType.Skirmisher));
            group_striker.Templates.Add(s1);

            EncounterTemplate s2 = new EncounterTemplate(Difficulty.Easy);
            s2.Slots.Add(new EncounterTemplateSlot(1, -1, new RoleType[] { RoleType.Brute, RoleType.Soldier }));
            group_striker.Templates.Add(s2);

            EncounterTemplate s3 = new EncounterTemplate(Difficulty.Moderate);
            s3.Slots.Add(new EncounterTemplateSlot(1, 2, RoleType.Skirmisher));
            group_striker.Templates.Add(s3);

            EncounterTemplate s4 = new EncounterTemplate(Difficulty.Moderate);
            s4.Slots.Add(new EncounterTemplateSlot(1, 1, new RoleType[] { RoleType.Brute, RoleType.Soldier }));
            group_striker.Templates.Add(s4);

            EncounterTemplate s5 = new EncounterTemplate(Difficulty.Hard);
            s5.Slots.Add(new EncounterTemplateSlot(1, 4, RoleType.Skirmisher));
            group_striker.Templates.Add(s5);

            EncounterTemplate s6 = new EncounterTemplate(Difficulty.Hard);
            s6.Slots.Add(new EncounterTemplateSlot(1, 3, new RoleType[] { RoleType.Brute, RoleType.Soldier }));
            group_striker.Templates.Add(s6);

            fTemplateGroups.Add(group_striker);

            #endregion
        }