Пример #1
0
    public static AbstractAbilityEffect getEffect(XmlNode xmlEffect, object obj)
    {
        AbstractAbilityEffect effect = null;

        switch (xmlEffect["type"].InnerText)
        {
        case "DamageAbilityEffect":
            effect = new DamageAbilityEffect();
            break;

        case "AddBuffEffect":
        {
            var buffEffect = new AddBuffEffect {
                buff = (Buff)obj
            };
            effect = buffEffect;
            break;
        }

        case "RowAddBuffEffect":
        {
            AddBuffEffect buffEffect = new RowAddBuffEffect();
            buffEffect.buff = (Buff)obj;
            effect          = buffEffect;
            break;
        }

        case "HealAbilityEffect":
            effect = new HealAbilityEffect();
            break;

        case "SummonEffect":
            var sumEffect = new SummonEffect();
            sumEffect.person = ((SummonAbility)obj).person;
            effect           = sumEffect;
            break;

        case "UseItemEffect":
            effect = new UseItemEffect();
            break;

        case "AddShieldAbilityEffect":
            effect = new AddShieldAbilityEffect();
            break;

        case "RowAddShieldAbilityEffect":
            effect = new RowAddShieldAbilityEffect();
            break;
        }

        effect.targetsNumber = int.Parse(xmlEffect["targetsNumber"].InnerText);
        foreach (XmlNode attribute in xmlEffect["attributes"])
        {
            effect.attribures.Add(getEffectAttribures(attribute.InnerText));
        }

        effect.valueGenerator = getValueGenerator(xmlEffect["valueGenerator"]);

        return(effect);
    }
Пример #2
0
    public AbstractAbilityEffect getUseItem()
    {
        var useItem = new UseItemEffect {
            item = this
        };

        return(useItem);
    }
Пример #3
0
    public void OnUseFromInventory(GameManager gm)
    {
        AbilityDetails details = new AbilityDetails(gm.combatManager.useItemAbility, gm.combatManager.CurrentActor, new List <GridObject> {
            gm.combatManager.CurrentActor
        });

        details.command.sprite = sprite;
        UseItemEffect effect = (UseItemEffect)details.command.utilityEffects.First(e => e is UseItemEffect);

        effect.item = this;

        gm.combatManager.EnqueueCommand(details);
        isQueued = true;
    }
    private void RemoveAbilityItemLock()
    {
        AbilityCommand ability = Gm.combatManager.CurrentAbilityDetails.command;

        if (ability.utilityEffects.Any(effect => effect is UseItemEffect))
        {
            UseItemEffect useItemEffect = (UseItemEffect)ability.utilityEffects.First(effect => effect is UseItemEffect);
            useItemEffect.item.isQueued = false;
        }
        else if (ability.utilityEffects.Any(effect => effect is DiscardItemEffect))
        {
            DiscardItemEffect discardItemEffect = (DiscardItemEffect)ability.utilityEffects.First(effect => effect is DiscardItemEffect);
            discardItemEffect.item.isQueued = false;
        }
    }