Example #1
0
    public override void DoEffect(BattleManager battlemgr, CardInstance cardInstance, CardEffectTemplate effectTplt, int targetInstId)
    {
        BattleModel battleModel = BattleModel.Inst;
        // 如果有脆弱,减少增加的护甲值
        int iAddArmor = effectTplt.iEffectValue;

        iAddArmor = BattleTool.AdjustArmorVal(battleModel.selfData, iAddArmor);

        battleModel.AddArmor(battleModel.selfData, iAddArmor);
        return;
    }
Example #2
0
        //获取卡牌描述
        private string GetCardDesc(string orignDesc)
        {
            //处理攻击
            FighterData selfData = BattleModel.Inst.selfData;

            foreach (Match match in Regex.Matches(orignDesc, PAT_ATTACK))
            {
                int damage;
                int.TryParse(Regex.Match(match.Value, @"\d+").Value, out damage);
                int    newDamage   = BattleTool.AdjustAttackVal(selfData, null, damage);
                string colorDamage = newDamage.ToString();
                if (newDamage > damage)
                {
                    colorDamage = TextTool.FormatUBBColor(colorDamage, "#00FF00");
                }
                else if (newDamage < damage)
                {
                    colorDamage = TextTool.FormatUBBColor(colorDamage, "#FF0000");
                }

                orignDesc = orignDesc.Replace(match.Value, string.Format(GameText.CARD_DAMAGE, colorDamage));
            }

            //处理防御
            foreach (Match match in Regex.Matches(orignDesc, PAT_DEFENCE))
            {
                int defence;
                int.TryParse(Regex.Match(match.Value, @"\d+").Value, out defence);
                int    newDefence   = BattleTool.AdjustArmorVal(selfData, defence);
                string colorDefence = newDefence.ToString();
                if (newDefence > defence)
                {
                    colorDefence = TextTool.FormatUBBColor(colorDefence, "#00FF00");
                }
                else if (newDefence < defence)
                {
                    colorDefence = TextTool.FormatUBBColor(colorDefence, "#FF0000");
                }
                orignDesc = orignDesc.Replace(match.Value, string.Format(GameText.CARD_DEFENCE, colorDefence));
            }

            return(orignDesc);
        }