Пример #1
0
        public Monster(Dictionary <string, string> data)
        {
            bool.TryParse(data["activated"], out activated);
            bool.TryParse(data["minionStarted"], out minionStarted);
            bool.TryParse(data["masterStarted"], out masterStarted);
            bool.TryParse(data["unique"], out unique);
            uniqueText  = data["uniqueText"];
            uniqueTitle = data["uniqueTitle"];

            Game game = Game.Get();

            if (game.cd.monsters.ContainsKey(data["type"]))
            {
                monsterData = game.cd.monsters[data["type"]];
            }
            if (game.quest.qd.components.ContainsKey(data["type"]) && game.quest.qd.components[data["type"]] is QuestData.UniqueMonster)
            {
                monsterData = new QuestMonster(game.quest.qd.components[data["type"]] as QuestData.UniqueMonster);
            }

            if (data.ContainsKey("activation"))
            {
                ActivationData saveActivation = null;
                if (game.cd.activations.ContainsKey(data["activation"]))
                {
                    saveActivation = game.cd.activations[data["activation"]];
                }
                if (game.quest.qd.components.ContainsKey(data["activation"]))
                {
                    saveActivation = new QuestActivation(game.quest.qd.components[data["activation"]] as QuestData.Activation);
                }
                currentActivation = new ActivationInstance(saveActivation, monsterData.name);
            }
        }
Пример #2
0
        // Construct from save data
        public Monster(Dictionary <string, string> data)
        {
            bool.TryParse(data["activated"], out activated);
            bool.TryParse(data["minionStarted"], out minionStarted);
            bool.TryParse(data["masterStarted"], out masterStarted);
            bool.TryParse(data["unique"], out unique);
            int.TryParse(data["damage"], out damage);
            int.TryParse(data["duplicate"], out duplicate);
            uniqueText  = data["uniqueText"];
            uniqueTitle = data["uniqueTitle"];

            // Support old saves (deprectiated)
            if (data["type"].IndexOf("UniqueMonster") == 0)
            {
                data["type"] = "CustomMonster" + data["type"].Substring("UniqueMonster".Length);
            }

            // Find base type
            Game game = Game.Get();

            if (game.cd.monsters.ContainsKey(data["type"]))
            {
                monsterData = game.cd.monsters[data["type"]];
            }
            // Check if type is a special quest specific type
            if (game.quest.qd.components.ContainsKey(data["type"]) && game.quest.qd.components[data["type"]] is QuestData.CustomMonster)
            {
                monsterData = new QuestMonster(game.quest.qd.components[data["type"]] as QuestData.CustomMonster);
            }

            // If we have already selected an activation find it
            if (data.ContainsKey("activation"))
            {
                ActivationData saveActivation = null;
                if (game.cd.activations.ContainsKey(data["activation"]))
                {
                    saveActivation = game.cd.activations[data["activation"]];
                }
                // Activations can be specific to the quest
                if (game.quest.qd.components.ContainsKey(data["activation"]))
                {
                    saveActivation = new QuestActivation(game.quest.qd.components[data["activation"]] as QuestData.Activation);
                }
                currentActivation = new ActivationInstance(saveActivation, monsterData.name.Translate());
            }
        }
Пример #3
0
 // Create new activation
 public void NewActivation(ActivationData contentActivation)
 {
     currentActivation = new ActivationInstance(contentActivation, monsterData.name);
 }