Exemple #1
0
        // TODO: 吸血技能.
        // 吸取敌人攻击力,转换其中一部分变成自己的攻击力
        // /num 吸取敌人血的百分比
        // /type 0:固定值 1:比例
        // /convert 吸取血之后加到自己身上的百分比
        // /angryCost 怒气
        // /selfInc 0:convert吸取血之后加到自己身上的百分比 1:自身攻击力增加convert
        private void castSuckSkill(float num, int type, float convert, int angryCost = 0, int selfInc = 0)
        {
            BT_Logical     war      = owner._war;
            BT_Monster     enemy    = war.enemy(owner);
            BT_MonsterTeam selfTeam = owner.ownerTeam;

            if (selfTeam.curAngry >= angryCost)
            {
                if (enemy.alive)
                {
                    float suck = num;
                    if (type == 1)
                    {
                        suck = num * Consts.oneHundred * enemy.curAtt;
                    }

                    if (suck > enemy.curAtt)
                    {
                        suck = enemy.curAtt;
                    }

                    if (angryCost > 0)   // 扣怒气...
                    {
                        selfTeam.costAngry(angryCost);
                    }

                    CMsgSkillSuckAttack msg = new CMsgSkillSuckAttack(this, enemy.pveId, MathHelper.MidpointRounding(suck));
                    war.addMsgToRecorder(msg);

                    // 减敌方血,加给自己.
                    BT_Hurt hurt = new BT_Hurt()
                    {
                        damageVal = suck,
                        hurtType  = BT_Hurt_Type.HURT_SKILL,
                    };

                    int   finalSuck = enemy.sufferAttack(hurt, owner);
                    float addAtt    = 0f;
                    if (selfInc == 0)
                    {
                        addAtt = convert * Consts.oneHundred * finalSuck;
                    }
                    else
                    {
                        addAtt = convert * Consts.oneHundred * owner.curAtt;
                    }

                    owner.curAttAdd(addAtt);
                    msg.convertAttack = MathHelper.MidpointRounding(addAtt);
                    msg.finalSuckAtt  = finalSuck;
                    msg.sufferCurAtt  = enemy.curAtt;
                    msg.casterCurAtt  = owner.curAtt;
                    msg.curAngry      = selfTeam.curAngry;
                }
            }
        }
Exemple #2
0
        // TODO: 变更当前攻击力技能
        // 增加 自己/对手 当前战斗力X% type:0---百分比 1---固定值
        private void castChangeAttackSkill(bool beOwner, float addRate, int type = 0, int angryCost = 0)
        {
            BT_Logical war   = owner._war;
            BT_Monster enemy = war.enemy(owner);

            BT_Monster target = beOwner ? owner : enemy;

            if (target.alive)
            {
                if (angryCost > 0)   // 扣怒气...
                {
                    BT_MonsterTeam selfTeam = owner.ownerTeam;
                    selfTeam.costAngry(angryCost);
                }

                CMsgSkillChangeAttack msg = new CMsgSkillChangeAttack(this, target.pveId);
                int beforeAtt             = target.curAtt;
                if (0 == type)
                {
                    if (beOwner)
                    {
                        target.curAttEnhance(1 + addRate * 0.01f);
                    }
                    else
                    {
                        int   hp     = target.curAtt;
                        float damage = hp * addRate * 0.01f;
                        damage = returnDamage(owner, enemy, damage);

                        if (false == target.canSufferSkillDamage())
                        {
                            damage = 0;
                        }

                        target.curAttAdd(-damage);
                        // target.curAttEnhance ( 1 - addRate / 100 );
                    }
                }
                else
                {
                    target.curAttAdd(addRate);
                }

                int afterAtt = target.curAtt;
                msg.curAtt = afterAtt;
                msg.addAtt = afterAtt - beforeAtt;
                war.addMsgToRecorder(msg);
            }
        }
Exemple #3
0
        // TODO: 自损技能
        // type 0:固定值 1:比例
        private void castChangeAttBothSKill(int snum, int stype, int senum, int etype, int angryCost = 0)
        {
            BT_Logical war   = owner._war;
            BT_Monster enemy = war.enemy(owner);

            if (enemy.alive)
            {
                if (angryCost > 0)   // 扣怒气...
                {
                    BT_MonsterTeam selfTeam = owner.ownerTeam;
                    selfTeam.costAngry(angryCost);
                }

                float sAdd = snum;
                if (stype == 1)
                {
                    sAdd = snum * Consts.oneHundred * owner.curAtt;
                }

                float eAdd = senum;
                if (etype == 1)
                {
                    eAdd = senum * Consts.oneHundred * enemy.curAtt;
                }

                sAdd = -sAdd;
                eAdd = -eAdd;

                CMsgSkillChangeCurAttackBoth msg = new CMsgSkillChangeCurAttackBoth(this);
                war.addMsgToRecorder(msg);

                owner.curAttAdd(sAdd);

                if (enemy.canSufferSkillDamage())
                {
                    enemy.curAttAdd(eAdd);
                }

                msg.selfAttChange  = MathHelper.MidpointRounding(sAdd);
                msg.enemyAttChange = MathHelper.MidpointRounding(eAdd);
                msg.selfCurAtt     = owner.curAtt;
                msg.enemyCurAtt    = enemy.curAtt;
            }
        }
Exemple #4
0
        // TODO: 以下ok
        // TODO:群体增益
        // 增加自己后rate名队友num%的初始战斗力。 0--固定值 1--百分比.
        private void castChangeAttackAllSkill(float addRate, int sufferCnt, bool beOwnerTeam = true, int type = 1, int angryCost = 0)
        {
            BT_Logical war = owner._war;
            CMsgSkillChangeCurAttackAll msg = new CMsgSkillChangeCurAttackAll(this);

            war.addMsgToRecorder(msg);

            BT_MonsterTeam selfTeam  = owner.ownerTeam;
            BT_MonsterTeam enemyTeam = owner.vsTeam;

            if (angryCost > 0)   // 扣怒气...
            {
                selfTeam.costAngry(angryCost);
            }
            BT_MonsterTeam armTeam = beOwnerTeam ? selfTeam : enemyTeam;

            int teamLen   = armTeam._team.Count;
            int sufferNum = 0;
            List <CMsgSkillChangeAttack> tmp = new List <CMsgSkillChangeAttack>();

            for (int i = armTeam.curPetTeamIndex + 1; i < teamLen && sufferNum < sufferCnt; i++, sufferNum++)
            {
                BT_Monster enemy = armTeam._team [i];

                float addAtt = addRate;
                if (1 == type)
                {
                    addAtt = enemy.initAtt * addRate * Consts.oneHundred;
                }

                CMsgSkillChangeAttack msgtmp = new CMsgSkillChangeAttack(this, enemy.pveId);
                int beforeAtt = enemy.curAtt;
                enemy.curAttAdd(addAtt);
                int afterAtt = enemy.curAtt;
                msgtmp.curAtt = afterAtt;
                msgtmp.addAtt = afterAtt - beforeAtt;

                tmp.Add(msgtmp);
            }

            msg.sufferArr = tmp.ToArray();
        }