示例#1
0
        // TODO: 夺取差值
        private void castSkillAttDelta(float rate, int angryCost = 0)
        {
            BT_Logical     war      = owner._war;
            BT_MonsterTeam selfTeam = owner.ownerTeam;

            if (angryCost > 0)   // 扣怒气...
            {
                selfTeam.costAngry(angryCost);
            }
            BT_Monster enemy = war.enemy(owner);

            if (owner.curAtt >= enemy.curAtt)
            {
                return;
            }

            float attDistance = Math.Abs(enemy.curAtt - owner.curAtt);

            attDistance = attDistance * rate * Consts.oneHundred;
            attDistance = enemy.sufferAttack(new BT_Hurt()
            {
                hurtType  = BT_Hurt_Type.HURT_SKILL,
                damageVal = attDistance,
            }, owner);

            CMsgSkillAttDelta msg = new CMsgSkillAttDelta(this, MathHelper.MidpointRounding(attDistance));

            war.addMsgToRecorder(msg);
            msg.beforeAtt = owner.curAtt;
            owner.curAttAdd(attDistance);
            msg.curAtt   = owner.curAtt;
            msg.enemyAtt = enemy.curAtt;
        }
示例#2
0
        public BT_MonsterTeam(Battle_Data data, BT_Logical war, int pveIndexStart, string tName, BattleAoYi attAoyi, BattleAoYi defAoyi)
        {
            _tName = tName;
            if (!string.IsNullOrEmpty(data.roleId))
            {
                _usrId = Convert.ToInt32(data.roleId);
            }
            _team = new List <BT_Monster>();

            foreach (Battle_Monster mon in data.team)
            {
                if (mon != null)
                {
                    BT_Monster pet = new BT_Monster(mon, pveIndexStart + _team.Count, war, this, null);
                    //计算神龙奥义的加成
                    attAoyi.improveAttribute(pet);
                    attAoyi.enHanceSkillPossibility(pet);
                    attAoyi.improveAoYiPossibility();
                    defAoyi.reduceSkillPossibility(pet);

                    _team.Add(pet);
                }
            }
            //加入奥义的技能
            attAoyi.trickAoYiToSkill(_team);
            this.teamLenChanged();
            this._curPet = 0;
        }
示例#3
0
        // TODO: 斩杀
        private void castCutSkill(float damage, float rate, int angryCost = 0)
        {
            BT_Logical     war      = owner._war;
            BT_MonsterTeam selfTeam = owner.ownerTeam;

            if (angryCost > 0)   // 扣怒气...
            {
                selfTeam.costAngry(angryCost);
            }
            BT_Monster enemy = war.enemy(owner);

            CMsgSkillCut msg = new CMsgSkillCut(this, enemy.pveId);

            msg.startAtt = MathHelper.MidpointRounding(damage);
            war.addMsgToRecorder(msg);

            int   beforeAtt = enemy.curAtt;
            float cutAtt    = enemy.initAtt * rate * Consts.oneHundred;

            enemy.sufferAttack(new BT_Hurt()
            {
                damageVal = damage,
                hurtType  = BT_Hurt_Type.HURT_SKILL,
            }, owner);

            if (enemy.alive && enemy.curAtt < cutAtt)
            {
                enemy.setCurAtt(0);
            }
            msg.finalAtt = enemy.curAtt - beforeAtt;
            msg.curAtt   = enemy.curAtt;
        }
示例#4
0
        // TODO: 自爆
        private void castBombSkill(float rate, int angryCost = 0)
        {
            BT_Logical     war      = owner._war;
            BT_MonsterTeam selfTeam = owner.ownerTeam;

            if (angryCost > 0)   // 扣怒气...
            {
                selfTeam.costAngry(angryCost);
            }
            BT_Monster enemy = war.enemy(owner);

            owner.setCurAtt(0, true);
            float damage = enemy.curAtt * rate * Consts.oneHundred;

            CMsgSkillBomb msg = new CMsgSkillBomb(this, enemy.pveId, MathHelper.MidpointRounding(damage));

            war.addMsgToRecorder(msg);
            int finalDamage = enemy.sufferAttack(new BT_Hurt()
            {
                hurtType  = BT_Hurt_Type.HURT_SKILL,
                damageVal = damage,
            }, owner);

            msg.finalAtt    = finalDamage;
            msg.enemyCurAtt = enemy.curAtt;
            msg.selfCurAtt  = owner.curAtt;
        }
示例#5
0
        // TODO: 伤害加倍
        private void castHurtUpSkill(float rate, int round, int angryCost = 0)
        {
            BT_Logical     war      = owner._war;
            BT_MonsterTeam selfTeam = owner.ownerTeam;

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

            short bufType  = CMsgHeader.BUFF_DEBUFF_HURTUP;
            int   bufRound = round;

            CMsgSkillBuffDebuff msg = new CMsgSkillBuffDebuff(this);

            msg.type  = bufType;
            msg.round = bufRound;
            war.addMsgToRecorder(msg);

            BT_Monster enemy = war.enemy(owner);

            BT_BuffOrDebuff debuf = new BT_BuffOrDebuff()
            {
                type  = bufType,
                round = bufRound,
                rate  = rate,
            };

            enemy.addBuffOrDebuff(debuf, false);
            msg.sufferArr = new int[] { enemy.pveId };
        }
示例#6
0
        // TODO: 金钟罩
        private void castGoldShieldSkill(int round = 1, int angryCost = 0)
        {
            BT_Logical     war      = owner._war;
            BT_MonsterTeam selfTeam = owner.ownerTeam;

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

            short bufType  = CMsgHeader.BUFF_DEBUFF_GOLDDEFENSE;
            int   bufRound = round;

            CMsgSkillBuffDebuff msg = new CMsgSkillBuffDebuff(this);

            msg.type  = bufType;
            msg.round = bufRound;
            war.addMsgToRecorder(msg);

            BT_BuffOrDebuff buf = new BT_BuffOrDebuff()
            {
                type  = bufType,
                round = bufRound,
            };

            owner.addBuffOrDebuff(buf);
            msg.sufferArr = new int[] { owner.pveId };
        }
示例#7
0
        // 后减
        public void castDecSkill(float rate, int angryCost = 0)
        {
            BT_Logical     war      = owner._war;
            BT_MonsterTeam selfTeam = owner.ownerTeam;

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

            // 减血
            CMsgSkillRecovery msg = new CMsgSkillRecovery(this);

            msg.startAtt = owner.curAtt;

            war.addMsgToRecorder(msg);
            float finalAtt = owner.curAtt * (1 - rate * Consts.oneHundred);

            if (finalAtt < 1)
            {
                finalAtt = 1;
            }
            // 减血
            owner.setCurAtt(finalAtt);

            msg.finalAtt = MathHelper.MidpointRounding(finalAtt);
            msg.suffer   = owner.pveId;
        }
示例#8
0
        // TODO: 护盾 0---固定值 1---百分比
        private void castShieldSkill(float addRate, int type = 0, int angryCost = 0)
        {
            BT_Logical     war      = owner._war;
            BT_MonsterTeam selfTeam = owner.ownerTeam;

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

            float suckDmg = addRate;

            if (1 == type)
            {
                suckDmg = owner.curAtt * addRate * Consts.oneHundred;
            }

            short bufType = CMsgHeader.BUFF_DEBUFF_DEFENSE;

            CMsgSkillBuffDebuff msg = new CMsgSkillBuffDebuff(this);

            msg.type = bufType;
            msg.arg1 = MathHelper.MidpointRounding(suckDmg);
            war.addMsgToRecorder(msg);

            BT_BuffOrDebuff buf = new BT_BuffOrDebuff()
            {
                type    = bufType,
                suckDmg = MathHelper.MidpointRounding(suckDmg),
            };

            owner.addBuffOrDebuff(buf);
            msg.sufferArr = new int[] { owner.pveId };
        }
示例#9
0
        // TODO: 变为全属性 (ok)
        public bool castPropertyChangeToAll(MonsterAttribute curPro)
        {
            BT_Logical war = owner._war;

            bool change = false;

            if (opObj.ID == 29 && canCastSkillOpDefault())
            {
                if (curPro != MonsterAttribute.ALL)
                {
                    change = true;

                    BT_MonsterTeam selfTeam = owner.ownerTeam;
                    if (selfTeam.getTeamName == "Att")
                    {
                        war._AoYiCastCount_Att = 1;
                    }
                    else
                    {
                        war._AoYiCastCount_Def = 1;
                    }

                    CMsgSkillCast msg = new CMsgSkillCast(this, CMsgSkillCast.categoryPropertyChangeToAll);
                    war.addMsgToRecorder(msg);
                }
                else
                {
                    if (real == 1)
                    {
                        war.resetAoYi(this, owner.ownerTeam);
                    }
                }
            }
            return(change);
        }
示例#10
0
        private void castSkillOp117()
        {
            BT_Logical war   = owner._war;
            BT_Monster enemy = war.enemy(owner);

            int damage = MathHelper.MidpointRounding(param.rate * Consts.oneHundred * enemy.curAtt * RdCast);

            castAttackSkill(damage, param.nuqi * RdCast, param.num * RdCast);
        }
示例#11
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;
                }
            }
        }
示例#12
0
        // 加气的技能-目前是只有神龙奥义在使用
        private void AddAngryCount(int num)
        {
            BT_Logical     war      = owner._war;
            BT_MonsterTeam selfTeam = owner.ownerTeam;

            selfTeam.addAngry(num);

            CMsgSkillCast msg = new CMsgSkillCast(this, CMsgSkillCast.categoryAddAngryPoint);

            msg.curAngry = selfTeam.curAngry;
            war.addMsgToRecorder(msg);
        }
示例#13
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);
            }
        }
示例#14
0
        private ForcastSk preCastSkOp111()
        {
            BT_Logical war   = owner._war;
            BT_Monster enemy = war.enemy(owner);

            int damage = MathHelper.MidpointRounding(param.rate * Consts.oneHundred * enemy.curAtt);

            ForcastSk forcast = new ForcastSk()
            {
                target   = -1,
                dmgOrRec = damage,
            };

            return(forcast);
        }
示例#15
0
        // TODO: 怒气回复
        private void castAngryRecoverSkill(int addAngry, int angryCost = 0)
        {
            BT_Logical     war      = owner._war;
            BT_MonsterTeam selfTeam = owner.ownerTeam;

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

            selfTeam.costAngry(-addAngry);
            CMsgSkillAngryExchange msg = new CMsgSkillAngryExchange(this);

            war.addMsgToRecorder(msg);

            msg.costAngry = angryCost;
            msg.addAngry  = addAngry;
        }
示例#16
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;
            }
        }
示例#17
0
        // damage 伤害
        // angryCost 怒气的消耗
        // angryRecover 怒气的恢复
        private void castAttackSkill(int damage, int angryCost = 0, int angryRecover = 0)
        {
            BT_Logical war   = owner._war;
            BT_Monster enemy = war.enemy(owner);

            if (enemy.alive)
            {
                // 扣怒气...
                owner.ownerTeam.costAngry(angryCost);
                int angry = owner.ownerTeam.curAngry;
                owner.ownerTeam.addAngry(angryRecover);

                CMsgSkillAttack msg = makeAttackMsg(enemy, damage);
                msg.recoverAngry = angryRecover;
                msg.costAngry    = angryCost;
                msg.preAngry     = angry;
                war.addMsgToRecorder(msg);
            }
        }
示例#18
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();
        }
示例#19
0
        public BT_Monster(Battle_Monster value, int pveIndex, BT_Logical war, BT_MonsterTeam selfTeam, BT_MonsterTeam enemyTeam)
        {
            //初始化 技能
            _nSkill    = new List <SkillObj>();
            _aSkill    = new List <SkillObj>();
            _nskillArr = new List <BT_Skill>();
            _askillArr = new List <BT_Skill>();

            //初始化 敌人ID
            _killEnemyId = new List <int>();
            //初始化 Buff & Debuff
            _buffArr   = new Dictionary <short, BT_BuffOrDebuff>();
            _debuffArr = new Dictionary <short, BT_BuffOrDebuff>();

            //初始化底层依赖
            skillMgr = Core.Data.skillManager;

            this._id       = value.petId;
            this._num      = value.petNum;
            this._property = (MonsterAttribute)value.property;
            _initProperty  = _property; //记住默认初始的属性,部分宠物可能会属性转换
            this._level    = value.lvl;
            this._finalAtt = value.finalAtt;
            _killCount     = 0;
            //缘配齐
            _fullFated = value.fullfated;
            _fateNuqi  = value.nuqi;
            float skillup = value.skillUp;    // 技能概率的提升

            this._isBoss = value.isBoss;      // 是否是boss
            //取出技能1,2,3
            //初始化宠物的技能信息
            parseSkill(value, skillup);

            _pveIndex  = pveIndex;
            _war       = war;
            _selfTeam  = selfTeam;
            _enemyTeam = enemyTeam;

            this.setCurAtt(_finalAtt);
        }
示例#20
0
        // TODO: 假死
        private void castDeathSkill(float rate, int angryCost = 0)
        {
            BT_Logical     war      = owner._war;
            BT_MonsterTeam selfTeam = owner.ownerTeam;

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

            CMsgSkillDeath msg = new CMsgSkillDeath(this);

            msg.suffer = owner.pveId;
            war.addMsgToRecorder(msg);

            float leftAtt = owner.initAtt * rate * Consts.oneHundred;

            owner.setCurAtt(leftAtt);
            owner.setAlive();
            msg.curAtt = owner.curAtt;
        }
示例#21
0
        private ForcastSk preCastSkOp104()
        {
            BT_Logical war   = owner._war;
            BT_Monster enemy = war.enemy(owner);

            int   beforeAtt = enemy.curAtt;
            float cutAtt    = enemy.initAtt * param.rate * Consts.oneHundred;
            int   damage    = param.damage;

            if ((beforeAtt - damage) < cutAtt)
            {
                damage = beforeAtt;
            }

            ForcastSk forcast = new ForcastSk()
            {
                target   = -1,
                dmgOrRec = damage,
            };

            return(forcast);
        }
示例#22
0
        // TODO: 自爆技能
        // type 0:固定值 1:自身初始战斗比例 2:对方当前战斗比例
        private void castBlastSkill(float damage, int type, int sufferCnt = 1, int angryCost = 0)
        {
            BT_Logical     war       = owner._war;
            BT_MonsterTeam enemyTeam = owner.vsTeam;

            CMsgSkillBlast msg = new CMsgSkillBlast(this);

            war.addMsgToRecorder(msg);

            if (1 == type)
            {
                damage = owner.initAtt * damage * Consts.oneHundred;
            }

            int teamLen   = enemyTeam._team.Count;
            int sufferNum = 0;

            List <CMsgSkillAttack> temp = new List <CMsgSkillAttack>();

            for (int i = enemyTeam.curPetTeamIndex; i < teamLen && sufferNum < sufferCnt; i++, sufferNum++)
            {
                BT_Monster enemy = enemyTeam._team [i];
                if (2 == type)
                {
                    if (war.fightDiff != 0)
                    {
                        damage = war.fightDiff * damage * Consts.oneHundred;
                    }
                    else
                    {
                        damage = enemy.curAtt * damage * Consts.oneHundred;
                    }
                }

                CMsgSkillAttack attackMsg = makeAttackMsg(enemy, damage);
                temp.Add(attackMsg);
            }
            msg.sufferArr = temp.ToArray();
        }
示例#23
0
        // TODO: 避免死亡,有几率回复生命
        private void castAngryAvoidDie(float rate, int angryCost = 0)
        {
            BT_Logical     war      = owner._war;
            BT_MonsterTeam selfTeam = owner.ownerTeam;

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

                CMsgSkillReviveSelf msg = new CMsgSkillReviveSelf(this);
                msg.suffer   = owner.pveId;
                msg.startAtt = owner.curAtt;
                war.addMsgToRecorder(msg);

                float addAtt = owner.initAtt * rate * Consts.oneHundred;
                owner.curAttAdd(addAtt);
                msg.finalAtt = owner.curAtt;
            }
        }
示例#24
0
        // TODO: 封印实现 ---效果呆实现... [here]
        private void castSealSkill(int sealCnt, int angryCost = 0)
        {
            BT_Logical     war       = owner._war;
            BT_MonsterTeam selfTeam  = owner.ownerTeam;
            BT_MonsterTeam enemyTeam = owner.vsTeam;

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

            short bufType  = CMsgHeader.BUFF_DEBUFF_SEAL;
            int   bufRound = 1;

            CMsgSkillBuffDebuff msg = new CMsgSkillBuffDebuff(this);

            msg.type  = bufType;
            msg.round = bufRound;
            war.addMsgToRecorder(msg);

            int teamLen   = enemyTeam._team.Count;
            int sufferNum = 0;

            List <int> sufferList = new List <int>();

            for (int i = enemyTeam.curPetTeamIndex; i < teamLen && sufferNum < sealCnt; i++, sufferNum++)
            {
                BT_Monster      enemy = enemyTeam._team [i];
                BT_BuffOrDebuff buf   = new BT_BuffOrDebuff()
                {
                    type  = bufType,
                    round = bufRound,
                };
                enemy.addBuffOrDebuff(buf, false);
                sufferList.Add(enemy.pveId);
            }
            msg.sufferArr = sufferList.ToArray();
        }
示例#25
0
        // TODO: 连击技能...
        // 对对方造成damage的伤害 并且可能有额外几次的伤害...
        private void castAttackComboSkill(float damage, int extra, int angryCost = 0)
        {
            BT_Logical war   = owner._war;
            BT_Monster enemy = war.enemy(owner);

            if (enemy.alive)
            {
                CMsgSkillAttackCombo msg = new CMsgSkillAttackCombo(this);

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

                // 返回当前的怒气值
                msg.curAngry  = selfTeam.curAngry;
                msg.attackArr = null;

                List <CMsgSkillAttack> realArr = new List <CMsgSkillAttack>();

                for (int i = 0; i < extra + 1; i++)
                {
                    if (enemy.alive)
                    {
                        CMsgSkillAttack attackMsg = makeAttackMsg(enemy, damage);
                        realArr.Add(attackMsg);
                    }
                }

                if (realArr.Count > 0)
                {
                    msg.attackArr = realArr.ToArray();
                }
            }
        }
示例#26
0
        // 先增后减
        private void castIncDecSkill(float rate, int num, int angryCost = 0)
        {
            BT_Logical     war      = owner._war;
            BT_MonsterTeam selfTeam = owner.ownerTeam;

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

            short bufType  = CMsgHeader.BUFF_DEBUFF_REDUCE_HP;
            int   bufRound = 2;

            // 加血
            CMsgSkillRecovery msg = new CMsgSkillRecovery(this);

            msg.startAtt = owner.curAtt;

            war.addMsgToRecorder(msg);

            BT_BuffOrDebuff buf = new BT_BuffOrDebuff()
            {
                type  = bufType,
                round = bufRound,
                skill = this,
            };

            owner.addBuffOrDebuff(buf);

            float finalAtt = owner.curAtt * (1 + rate * Consts.oneHundred);

            owner.setCurAtt(finalAtt);

            msg.curAngry = selfTeam.curAngry;
            msg.finalAtt = MathHelper.MidpointRounding(finalAtt);
            msg.suffer   = owner.pveId;
        }
示例#27
0
        // TODO: 战后回复
        private void castRecoverySkill(float rate, int angryCost = 0)
        {
            BT_Logical     war      = owner._war;
            BT_MonsterTeam selfTeam = owner.ownerTeam;
            BT_Monster     enemy    = war.enemy(owner);

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

            CMsgSkillAfterRecovery msg = new CMsgSkillAfterRecovery(this);

            msg.suffer   = owner.pveId;
            msg.startAtt = owner.curAtt;
            msg.enemyAtt = enemy.curAtt;

            war.addMsgToRecorder(msg);

            float addAtt = owner.initAtt * rate * Consts.oneHundred;

            owner.curAttAdd(addAtt);
            msg.finalAtt = owner.curAtt;
        }
示例#28
0
        // TODO: 无视属性克制
        public bool castIgnorePropertyKill()
        {
            BT_Logical war    = owner._war;
            bool       ignore = false;

            if (opObj.ID == 27 && canCastSkillOpDefault())
            {
                ignore = true;

                BT_MonsterTeam selfTeam = owner.ownerTeam;
                if (selfTeam.getTeamName == "Att")
                {
                    war._AoYiCastCount_Att = 1;
                }
                else
                {
                    war._AoYiCastCount_Def = 1;
                }

                CMsgSkillCast msg = new CMsgSkillCast(this, CMsgSkillCast.categoryIgnorePropertyKill);
                war.addMsgToRecorder(msg);
            }
            return(ignore);
        }
示例#29
0
        // TODO: 复活技能.
        // type: 0--随机复活 1--从前向后 2--从后到前
        private void castReviveSkill(int num, int type, int angryCost = 0)
        {
            BT_MonsterTeam selfTeam = owner.ownerTeam;

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

            List <BT_Monster> dieArr      = new List <BT_Monster>();
            List <BT_Monster> sortDieArry = new List <BT_Monster>();

            foreach (BT_Monster pet in selfTeam._team)
            {
                if (pet == owner)
                {
                    break;
                }
                if (!pet.alive)
                {
                    dieArr.Add(pet);
                }
            }

            int tataoDieCount = dieArr.Count;

            if (tataoDieCount >= 1)
            {
                if (0 == type)
                {
                    BT_WarUtils.Shuffle(dieArr);
                    type = 1;
                }

                int minCount = tataoDieCount > num ? num : tataoDieCount;

                for (int j = 0; j < minCount; j++)
                {
                    sortDieArry.Add(dieArr [j]);
                }

                sortDieArry.Sort(my_sort);

                BT_Logical      war = owner._war;
                CMsgSkillRevive msg = new CMsgSkillRevive(this);
                war.addMsgToRecorder(msg);
                msg.reviveArr = new int[minCount];

                for (int i = 0; i < minCount; i++)
                {
                    BT_Monster pet = type == 1 ? array_shift(sortDieArry) : array_pop(sortDieArry);
                    if (pet != null)
                    {
                        pet.revive();
                        selfTeam._team.Add(pet);
                        msg.reviveArr [i] = pet.pveId;
                    }
                }
                selfTeam.teamLenChanged();
            }
            else
            {
                //如果没有人死亡,则奥义的技能就算没触发过
                if (real == 1)
                {
                    BT_Logical war = owner._war;
                    war.resetAoYi(this, selfTeam);
                }
            }
        }
示例#30
0
        // 技能能否释放默认实现... 每次战斗有X%概率...
        private bool canCastSkillOpDefault()
        {
            //检测释放为奥义伪造的技能,如果是则判定 奥义是否触发过
            BT_Logical     war      = owner._war;
            BT_MonsterTeam selfTeam = owner.ownerTeam;

            if (real == 1)
            {
                //如果不能释放,则直接跳过。如果可以释放,则再判定概率的问题
                bool can = war.canCastAoYi(this, selfTeam);
                if (can == false)
                {
                    return(can);
                }
            }

            //再次判定概率的问题
            bool probility   = false;
            int  possibility = 0;

            if (opObj.type == SkillOpData.Anger_Skill)
            {
                int curTeamAngry = selfTeam.curAngry;
                int needNuqi     = param.nuqi;
                if (needNuqi == 0)
                {
                    throw new DragonException("调用canCastSkillOpDefault时,不存在怒气配置. id:" + id);
                }
                probility = curTeamAngry >= needNuqi;
            }
            else if (opObj.type == SkillOpData.Death_Closed_Skill)
            {
                possibility = param.gailv;
                // 如果有概率的话,则考虑概率触发,否则一定触发
                if (possibility > 0)
                {
                    probility = BT_WarUtils.happen(possibility);
                }
                else
                {
                    // 默认触发
                    probility = owner._almostDie;
                }
            }
            else
            {
                possibility = param.gailv;
                if (possibility == 0)
                {
                    throw new DragonException("调用canCastSkillOpDefault时,不存在概率配置. id:" + id);
                }
                probility = BT_WarUtils.happen(possibility);
            }

            //如果概率Ok,则奥义默认释放
            if (probility)
            {
                if (real == 1)
                {
                    //设定奥义
                    war.setCastAoYi(this, selfTeam);
                }
            }

            return(probility);
        }