Example #1
0
    public CastedCard(AvatarModel castingBy, AvatarModel castingOn, Card c)
    {
        Card = c;

        if (c.Params.ContainsKey(ParamType.DealDamage))
        {
            Params.Add(CastedCardParamType.DealDamage, c.Params[ParamType.DealDamage]);
        }

        if (c.Params.ContainsKey(ParamType.Heal))
        {
            Params.Add(CastedCardParamType.Heal, c.Params[ParamType.Heal]);
        }

        if (c.Params.ContainsKey(ParamType.HeroDrawsCard))
        {
            Params.Add(CastedCardParamType.HeroDrawsCard, c.Params[ParamType.HeroDrawsCard]);
        }

        if (c.Params.ContainsKey(ParamType.AttackAdd))
        {
            Params.Add(CastedCardParamType.AttackAdd, c.Params[ParamType.AttackAdd]);
        }

        if (c.Params.ContainsKey(ParamType.HealthAdd))
        {
            Params.Add(CastedCardParamType.HealthAdd, c.Params[ParamType.HealthAdd]);
        }
        if (c.Params.ContainsKey(ParamType.HealthAddOfOtherFriendlyMinionNumber))
        {
            Params.Add(CastedCardParamType.HealthAdd, AvatarModel.MyMinionsNumber(castingOn.GetMyHero()) - 1);           //because itself doesn't count and its already casted
        }

        if (c.Params.ContainsKey(ParamType.AttackAddOfOtherFriendlyMinionNumber))
        {
            Params.Add(CastedCardParamType.AttackAdd, AvatarModel.MyMinionsNumber(castingOn.GetMyHero()) - 1);             //because itself doesn't count and its already casted
        }

        if (c.Params.ContainsKey(ParamType.Taunt))
        {
            Params.Add(CastedCardParamType.Taunt, c.Params[ParamType.Taunt]);
        }

        if (c.Params.ContainsKey(ParamType.Sticky))
        {
            Params.Add(CastedCardParamType.Sticky, 1);
        }
        if (c.Params.ContainsKey(ParamType.Destroy))
        {
            Params.Add(CastedCardParamType.Destroy, 1);
        }

        if (c.Params.ContainsKey(ParamType.SpellDamageAdd))
        {
            Params.Add(CastedCardParamType.SpellDamageAdd, c.Params[ParamType.SpellDamageAdd]);
        }

        if (c.Params.ContainsKey(ParamType.DealDamageSpell))
        {
            Params.Add(CastedCardParamType.DealDamageSpell, c.Params[ParamType.DealDamageSpell] + castingBy.SpellDamageAdd());
        }

        if (c.Params.ContainsKey(ParamType.HealFull))
        {
            Params.Add(CastedCardParamType.HealFull, 1);
        }

        if (c.Params.ContainsKey(ParamType.ManaCrystalAdd))
        {
            Params.Add(CastedCardParamType.ManaCrystalAdd, c.Params[ParamType.ManaCrystalAdd]);
        }

        if (c.Params.ContainsKey(ParamType.ManaCrystalEmptyAdd))
        {
            Params.Add(CastedCardParamType.ManaCrystalEmptyAdd, c.Params[ParamType.ManaCrystalEmptyAdd]);
        }

        if (c.Params.ContainsKey(ParamType.ArmorAdd))
        {
            Params.Add(CastedCardParamType.ArmorAdd, c.Params[ParamType.ArmorAdd]);
        }
        if (c.Params.ContainsKey(ParamType.TakeControl))
        {
            castingOn.GetMyHero().Minions.Remove(castingOn);
            castingOn.Creator = castingBy.GetMyHero();
            castingBy.Minions.Add(castingOn);
            castingOn.MovesLeft = castingOn.Card.Params.ContainsKey(ParamType.Charge)?castingOn.Card.Params[ParamType.Speed]:0;
        }
        if (c.Params.ContainsKey(ParamType.Charge))
        {
            castingOn.RefillMovements();
        }
    }