コード例 #1
0
        private void RefreshEnemyBuff(int instId)
        {
            EnemyInstance enemyInst = _battleModel.GetEnemy(instId);

            if (enemyInst != null)
            {
                ftEnemy.SetBuffInstList(enemyInst.lstBuffInst);
            }
        }
コード例 #2
0
ファイル: BattleTool.cs プロジェクト: tiance7/XianCard
    /// <summary>
    /// 获取战斗者的BUFF实例列表
    /// </summary>
    /// <param name="fighterInstId"></param>
    /// <returns></returns>
    internal static List <BuffInst> GetFighterBuff(int fighterInstId)
    {
        BattleModel battleModel = BattleModel.Inst;

        if (fighterInstId == battleModel.selfData.instId)
        {
            return(battleModel.selfData.lstBuffInst);
        }

        EnemyInstance enemy = battleModel.GetEnemy(fighterInstId);

        if (enemy == null)
        {
            Debug.LogError("can't find fighter:" + fighterInstId);
            return(null);
        }
        return(enemy.lstBuffInst);
    }
コード例 #3
0
    public override void DoEffect(BattleManager battlemgr, CardInstance cardInstance, CardEffectTemplate effectTplt, int targetInstId)
    {
        int         iCount      = BattleTool.GetCardEffectCount(effectTplt);
        BattleModel battleModel = BattleModel.Inst;

        if (effectTplt.nTarget == CardEffectTargetType.ONE_ENEMY)
        {
            battleModel.AddBuff(battleModel.selfData, battleModel.GetEnemy(targetInstId), (uint)effectTplt.iEffectValue, iCount);
        }
        else if (effectTplt.nTarget == CardEffectTargetType.ALL_ENEMY)
        {
            foreach (KeyValuePair <int, EnemyInstance> pair in battleModel.GetEnemys())
            {
                battleModel.AddBuff(battleModel.selfData, pair.Value, (uint)effectTplt.iEffectValue, iCount);
            }
        }
        else if (effectTplt.nTarget == CardEffectTargetType.SELF)
        {
            battleModel.AddBuff(battleModel.selfData, battleModel.selfData, (uint)effectTplt.iEffectValue, iCount);
        }
        return;
    }
コード例 #4
0
ファイル: BattleManager.cs プロジェクト: tiance7/XianCard
    /// <summary>
    /// 对目标造成伤害
    /// </summary>
    /// <param name="instId"></param>
    /// <param name="iEffectValue"></param>
    internal void DamageEnemy(int instId, int iEffectValue, bool ignoreArmor)
    {
        EnemyInstance enemyInstance = _battleModel.GetEnemy(instId);

        if (enemyInstance == null)
        {
            return;
        }

        iEffectValue = BattleTool.AdjustAttackVal(_battleModel.selfData, enemyInstance, iEffectValue);

        if (false == ignoreArmor)
        {
            if (enemyInstance.armor >= iEffectValue)
            {
                _battleModel.ReduceEnemyArmor(instId, iEffectValue);

                _battleModel.effectStat.damageArmor += (uint)iEffectValue;
                _battleModel.roundStat.damageArmor  += (uint)iEffectValue;
            }
            else
            {
                int iReduceHp    = iEffectValue - enemyInstance.armor;
                int iReduceArmor = enemyInstance.armor;
                _battleModel.effectStat.damageArmor += (uint)iReduceArmor;
                _battleModel.roundStat.damageArmor  += (uint)iReduceArmor;
                _battleModel.ReduceEnemyArmor(instId, enemyInstance.armor);

                _battleModel.ReduceEnemyHp(instId, iReduceHp);
                OnObjectHitted(_battleModel.selfData, enemyInstance, iReduceHp, iReduceArmor);
            }
        }
        else
        {
            _battleModel.ReduceEnemyHp(instId, iEffectValue);
            OnObjectHitted(_battleModel.selfData, enemyInstance, iEffectValue, 0);
        }
        SoundTool.inst.PlaySoundEffect(ResPath.SFX_SPEAR);  //todo 根据模板表 以及是否格挡 播放不同的音效
    }