Exemple #1
0
    public void setFromParent(Charm parent)
    {
        owner         = parent.owner;
        useGameObject = false;
        idName        = parent.idName;

        if (owner != null)
        {
            offsetID = owner.Charms.Count;
        }

        isDead        = parent.isDead;
        hasChangedPos = parent.hasChangedPos;

        storedCard = null;

        //protectDuringAISim = false;

        aiGoodCharmPoints = parent.aiGoodCharmPoints;
        aiBadCharmPoints  = parent.aiBadCharmPoints;

        costToAddToDeck = parent.costToAddToDeck;

        name = parent.name;

        className = parent.className;
        type      = parent.type;

        handSizeMod = parent.handSizeMod;

        generalTakeDamageMod = parent.generalTakeDamageMod;

        actionMod         = parent.actionMod;
        damageAtTurnStart = parent.damageAtTurnStart;


        selfDestructsAfterTurns     = parent.selfDestructsAfterTurns;
        turnsLeftBeforeSelfDestruct = parent.turnsLeftBeforeSelfDestruct;

        expiresAfterAttack = parent.expiresAfterAttack;

        sightRangeMod = parent.sightRangeMod;

        //do the charm's own setup
        setFromParentCustom(parent);

        //if a description was specified, overwrite whatever was going on
        description = parent.description;
    }
Exemple #2
0
    public void setup(Unit _owner, bool _useGameObject, string _idName)
    {
        owner         = _owner;
        useGameObject = _useGameObject;
        idName        = _idName;

        if (owner != null)
        {
            offsetID = owner.Charms.Count - 1;
        }

        isDead        = false;
        hasChangedPos = false;

        protectDuringAISim = false;

        storedCard = null;

        costToAddToDeck = 3;

        Debug.Log(idName);
        Debug.Log(node);
        name = node ["name"].InnerText;

        className = CharmClass.Charm;
        type      = CharmType.Equipment;        //default to equipment for no solid reason

        //check general values

        handSizeMod = 0;
        if (node ["hand_size_mod"] != null)
        {
            handSizeMod = int.Parse(node ["hand_size_mod"].InnerText);
        }

        generalTakeDamageMod = 0;
        if (node["general_take_damage_mod"] != null)
        {
            generalTakeDamageMod = int.Parse(node["general_take_damage_mod"].InnerText);
        }


        selfDestructsAfterTurns     = false;
        turnsLeftBeforeSelfDestruct = -1;
        if (node ["turns_to_self_destruct"] != null)
        {
            selfDestructsAfterTurns     = true;
            turnsLeftBeforeSelfDestruct = int.Parse(node ["turns_to_self_destruct"].InnerText);
        }

        expiresAfterAttack = false;
        if (node ["expires_after_attack"] != null)
        {
            expiresAfterAttack = bool.Parse(node ["expires_after_attack"].InnerXml);
        }

        actionMod = 0;
        if (node["action_mod"] != null)
        {
            actionMod = int.Parse(node["action_mod"].InnerText);
        }

        damageAtTurnStart = 0;
        if (node["damage_at_turn_start"] != null)
        {
            damageAtTurnStart = int.Parse(node["damage_at_turn_start"].InnerText);
        }

        sightRangeMod = 0;
        if (node["sight_range_mod"] != null)
        {
            sightRangeMod = float.Parse(node["sight_range_mod"].InnerText);
            //this may change what the unit can see at the moment they get this charm
            if (owner != null)
            {
                Debug.Log("love to do it " + owner.getSightRange());
                owner.setVisibleTiles();
            }
        }

        aiGoodCharmPoints = 0;
        aiBadCharmPoints  = 0;

        //do the charm's own setup
        setupCustom();

        //if a description was specified, overwrite whatever was going on
        if (node ["desc"] != null)
        {
            description = node ["desc"].InnerText;
        }

        //check if an alternate ai value was provided
        if (node ["ai_good_points"] != null)
        {
            aiGoodCharmPoints = float.Parse(node ["ai_good_points"].InnerText);
        }
        if (node ["ai_bad_points"] != null)
        {
            aiBadCharmPoints = float.Parse(node ["ai_bad_points"].InnerText);
        }
    }