// TODO: Translate expansion traits, translate base monster names.

    public EditorComponentCustomMonster(string nameIn) : base()

    {
        Game game = Game.Get();

        monsterComponent = game.quest.qd.components[nameIn] as QuestData.CustomMonster;
        component        = monsterComponent;
        name             = component.sectionName;
        Update();
    }
Exemplo n.º 2
0
    // Construct with quest data
    public QuestMonster(QuestData.CustomMonster qm) : base()
    {
        Game game = Game.Get();

        cMonster = qm;

        // Get base derived monster type
        MonsterData baseObject = null;

        // Check for content data monster defined as base
        if (game.cd.monsters.ContainsKey(qm.baseMonster))
        {
            // Set base monster type
            derivedType = qm.baseMonster;
            baseObject  = game.cd.monsters[qm.baseMonster];
        }

        // If name not set use base type
        if (!qm.monsterName.KeyExists() && baseObject != null)
        {
            name = baseObject.name;
        }
        else
        {
            name = qm.monsterName;
        }

        // Initialise sets
        sets = new List <string>();

        // define data
        sectionName = qm.sectionName;
        priority    = 0;

        // Read traits from quest data or base type
        traits = qm.traits;
        if (traits.Length == 0 && baseObject != null)
        {
            traits = baseObject.traits;
        }

        // Read info from quest data or base type
        info = new StringKey(null, EventManager.OutputSymbolReplace(qm.info.Translate()), false);
        if (!qm.info.KeyExists() && baseObject != null)
        {
            info = baseObject.info;
        }

        image = qm.GetImagePath();
        if (image.Length == 0)
        {
            if (baseObject != null)
            {
                image = baseObject.image;
            }
        }
        else
        {
            image = Path.GetDirectoryName(game.quest.qd.questPath) + Path.DirectorySeparatorChar + image;
        }

        // Read placement image from quest data or base type
        imagePlace = qm.GetImagePlacePath();
        if (imagePlace.Length == 0)
        {
            if (baseObject != null)
            {
                imagePlace = baseObject.image;
            }
            else
            {
                imagePlace = image;
            }
        }
        else
        {
            imagePlace = Path.GetDirectoryName(game.quest.qd.questPath) + Path.DirectorySeparatorChar + imagePlace;
        }

        // Read activations  from quest data or base type
        activations = qm.activations;
        if (activations.Length == 0 && baseObject != null)
        {
            useMonsterTypeActivations = true;
        }

        healthBase    = qm.healthBase;
        healthPerHero = qm.healthPerHero;
        if (!qm.healthDefined && baseObject != null)
        {
            healthBase    = baseObject.healthBase;
            healthPerHero = baseObject.healthPerHero;
        }

        horror = qm.horror;
        if (!qm.horrorDefined && baseObject != null)
        {
            horror = baseObject.horror;
        }
        awareness = qm.awareness;
        if (!qm.awarenessDefined && baseObject != null)
        {
            awareness = baseObject.awareness;
        }
    }
 override protected void RefreshReference()
 {
     base.RefreshReference();
     monsterComponent = component as QuestData.CustomMonster;
 }
Exemplo n.º 4
0
    // Construct with quest data
    public QuestMonster(QuestData.CustomMonster qm) : base()
    {
        Game game = Game.Get();

        // Get base derived monster type
        MonsterData baseObject = null;

        // Check for content data monster defined as base
        if (game.cd.monsters.ContainsKey(qm.baseMonster))
        {
            // Set base monster type
            derivedType = qm.baseMonster;
            baseObject  = game.cd.monsters[qm.baseMonster];
        }

        // TODO: We get only the name inherited from fixed
        // monsters. It can be edited in next Pull Request
        // when Valkyrie is translated
        // Set name
        name = new StringKey(qm.monsterName, false);
        // If name not set use base type
        if (name.key.Length == 0 && baseObject != null)
        {
            name = baseObject.name;
        }

        // Initialise sets
        sets = new List <string>();

        // define data
        sectionName = qm.sectionName;
        priority    = 0;

        // Read traits from quest data or base type
        traits = qm.traits;
        if (traits.Length == 0 && baseObject != null)
        {
            traits = baseObject.traits;
        }

        // Read info from quest data or base type
        info = new StringKey(EventManager.SymbolReplace(qm.info.key), false);
        if (info.key.Length == 0 && baseObject != null)
        {
            info = baseObject.info;
        }

        // Read image from quest data or base type
        image = qm.GetImagePath();
        if (image.Length == 0 && baseObject != null)
        {
            image = baseObject.image;
        }

        // Read placement image from quest data or base type
        imagePlace = qm.GetImagePlacePath();
        if (imagePlace.Length == 0 && baseObject != null)
        {
            imagePlace = baseObject.image;
        }
        if (imagePlace.Length == 0)
        {
            imagePlace = image;
        }

        // Read activations  from quest data or base type
        activations = qm.activations;
        if (activations.Length == 0 && baseObject != null)
        {
            useMonsterTypeActivations = true;
        }

        // Read activations  from quest data or base type
        activations = qm.activations;
        if (activations.Length == 0 && baseObject != null)
        {
            useMonsterTypeActivations = true;
        }

        health = qm.health;
        if (!qm.healthDefined && baseObject != null)
        {
            health = baseObject.health;
        }
    }