示例#1
0
        //这个函数已不再使用
        private int startOneRound()
        {
            _battleStatus = CMsgHeader.STATUS_ROUND_BEGIN;
            _curAtter     = _attTeam.curPet;
            _curDefer     = _defTeam.curPet;

            //------------ 可能因为自爆技能导致,后续队员的死亡 -------
            if (_curDefer.alive && _curAtter.alive)
            {
                //重置一个回合奥义释放的次数
                _AoYiCastCount_Att = 0;
                _AoYiCastCount_Def = 0;
                fullFateOneAngry();

                CMsgRoundBegin msg = new CMsgRoundBegin(_curAtter.pveId, _curDefer.pveId,
                                                        _curAtter.curAtt, _curDefer.curAtt,
                                                        _attTeam.curAngry, _defTeam.curAngry);
                addMsgToRecorder(msg);

                addAngryByAoYi();
                bufOrDebufSkill();
                propertyChg();
                propertyKill();
                castAngrySkill();
                castNormalSkill();
                fighting();
                castEndSkill();
            }

            checkToNextOrOver();
            return(_attTeam.over ? 2 : 1);
        }
示例#2
0
 // --- 提供给外部调用的方法 ---
 public void enHanceSkillPossibility(BT_Monster Pet)
 {
     if (Pet != null && _AoYiItem._type == BT_AoYi.ImproveSkill)
     {
         changeSkillPossibility(Pet, true);
     }
 }
示例#3
0
        // 是否增加某类属性的技能,和概率没关系
        // 这个函数在实例化CPet的时候调用,可以在初始化的时候就决定好奥义的功用
        public void improveAttribute(BT_Monster Pet)
        {
            int PetAttri = (int)Pet._property;

            if (PetAttri == _AoYiItem._type || PetAttri == (_AoYiItem._type + 10))
            {
                foreach (BT_Skill sk in Pet.get_NormalSkillArr)
                {
                    SkillOpData op       = sk.opObj;
                    string[]    enhanced = op.enhanced;

                    if (enhanced != null)
                    {
                        foreach (string oneEnHanced in enhanced)
                        {
                            int param = getParam(sk, oneEnHanced);
                            if (param != -1)
                            {
                                param = Formular(param);
                                setParam(sk, oneEnHanced, param);
                            }
                        }
                    }
                }
            }
        }
示例#4
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;
        }
示例#5
0
 // --- 提供给外部调用的方法 ---
 public void reduceSkillPossibility(BT_Monster Pet)
 {
     if (Pet != null && _AoYiItem._type == BT_AoYi.ReduceEnemySkill)
     {
         changeSkillPossibility(Pet, false);
     }
 }
示例#6
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;
        }
示例#7
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;
        }
示例#8
0
 //减少敌人的技能概率
 public void reduceSkillPossibility(BT_Monster Pet)
 {
     foreach (CAoYi item in _AoYi.Values)
     {
         item.reduceSkillPossibility(Pet);
     }
 }
示例#9
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 };
        }
示例#10
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;
        }
示例#11
0
        public BT_Skill(int skillNum, int lv, SkillManager skillMgr, BT_Monster ownerBy)
        {
            if (skillMgr == null)
            {
                throw new DragonException("Skill manager is null.");
            }
            if (ownerBy == null)
            {
                throw new DragonException("Owner is null");
            }

            SkillData skCfg = skillMgr.getSkillDataConfig(skillNum);

            if (skCfg == null)
            {
                throw new DragonException("Skill configure is null." + skillNum);
            }

            //默认一定能释放一次
            RdCast = 1;
            id     = skillNum;
            curLv  = lv;
            name   = skCfg.name;
            mark   = skCfg.mark;
            level  = skCfg.level;
            param  = skillMgr.GetSkParamData(skillNum, lv);
            op     = skCfg.op;
            opObj  = skillMgr.getSkillOpDataConfig(op);

            real = 0;
            AoYi = null;

            owner = ownerBy;
        }
示例#12
0
 public CMsgSkillBuffDebuffEffect(BT_Monster pet, BT_BuffOrDebuff bufOrDebuff, short status = CMsgSkillCast.STATUS_BUFF_DEBUFF)
 {
     this.status = status;
     this.suffer = pet.pveId;
     this.type   = bufOrDebuff.type;
     this.round  = bufOrDebuff.round;
 }
示例#13
0
 //增加一个杀死敌人的数量
 public void addKillCount(BT_Monster Enemy)
 {
     _killCount++;
     if (Enemy != null)
     {
         _killEnemyId.Add(Enemy._num);
     }
 }
示例#14
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);
        }
示例#15
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;
                }
            }
        }
示例#16
0
        public BT_Monster enemy(BT_Monster self)
        {
            if (self.pveId != this._curAtter.pveId &&
                self.pveId != this._curDefer.pveId)
            {
                throw new DragonException("Current Monster is not atter nor defer");
            }

            return(self == _curAtter ? _curDefer : _curAtter);
        }
示例#17
0
        BT_Monster array_shift(List <BT_Monster> monList)
        {
            BT_Monster first = null;

            if (monList != null && monList.Count > 0)
            {
                first = monList[0];
                monList.RemoveAt(0);
            }
            return(first);
        }
示例#18
0
        BT_Monster array_pop(List <BT_Monster> monList)
        {
            BT_Monster last = null;

            if (monList != null && monList.Count > 0)
            {
                int count = monList.Count;
                last = monList[count - 1];
                monList.RemoveAt(count - 1);
            }
            return(last);
        }
示例#19
0
 public void improveAttribute(BT_Monster Pet)
 {
     if (_AoYi.Count > 0)
     {
         foreach (CAoYi item in _AoYi.Values)
         {
             if (item != null)
             {
                 item.improveAttribute(Pet);
             }
         }
     }
 }
示例#20
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);
            }
        }
示例#21
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);
        }
示例#22
0
        // TODO: 直接攻击型技能
        // 对对方造成damage的伤害...
        private CMsgSkillAttack makeAttackMsg(BT_Monster enemy, float damage)
        {
            BT_Hurt hurt = new BT_Hurt()
            {
                damageVal = damage,
                hurtType  = BT_Hurt_Type.HURT_SKILL,
            };

            CMsgSkillAttack msg         = new CMsgSkillAttack(this, enemy.pveId, MathHelper.MidpointRounding(damage));
            int             finalDamage = enemy.sufferAttack(hurt, owner);

            msg.finalAtt = finalDamage;
            msg.curAtt   = enemy.curAtt;
            msg.curAngry = enemy.ownerTeam.curAngry;
            return(msg);
        }
示例#23
0
        //受到普通伤害.
        public void sufferNormalAttack(int att, BT_Monster enemy, bool beReBound = false)
        {
            CMsgNormalAttack msg = new CMsgNormalAttack(_pveIndex, att, beReBound ? CMsgHeader.STATUS_REBOUND_ATT : CMsgHeader.STATUS_ATTACK);

            _war.addMsgToRecorder(msg);

            BT_Hurt hurt = new BT_Hurt()
            {
                hurtType  = BT_Hurt_Type.HURT_COMMON,
                damageVal = att
            };

            int finalDamage = sufferAttack(hurt, enemy);

            msg.finalAtt = finalDamage;
            msg.curAtt   = curAtt;
        }
示例#24
0
 //敌人释放全部的怒气
 //客户端计算战斗逻辑的时候只能敌人释放
 private void CastAllAngry(List <BT_Skill> angryArr, BT_Monster mon)
 {
     if (angryArr != null && angryArr.Count > 0 && mon != null)
     {
         foreach (BT_Skill sk in angryArr)
         {
             bool can = sk.param.nuqi <= mon._selfTeam.curAngry;
             can = can && sk.real == 0;
             can = can && sk.isSkillByType(SkillOpData.Anger_Skill);
             if (can)
             {
                 int Count = mon._selfTeam.curAngry / sk.param.nuqi;
                 sk.RdCast = Count;
             }
         }
     }
 }
示例#25
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;
            }
        }
示例#26
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);
            }
        }
示例#27
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();
        }
示例#28
0
        // --------- 反弹伤害 ---------
        private float returnDamage(BT_Monster Pet, BT_Monster enemy, float damage)
        {
            short           bufDebuffType = CMsgHeader.BUFF_DEBUFF_REBOUND;
            BT_BuffOrDebuff reboundBuff   = Pet.getBuffOrDebuff(bufDebuffType);

            if (reboundBuff != null && --reboundBuff.round >= 0 && enemy.alive)
            {
                //
                float rebound = damage * reboundBuff.rate * Consts.oneHundred;
                damage -= rebound;
                if (damage < 0)
                {
                    damage = 0;
                }
                // 反弹部分伤害到敌人...
                enemy.sufferNormalAttack(MathHelper.MidpointRounding(rebound), Pet, true);
            }

            return(damage);
        }
示例#29
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();
        }
示例#30
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);
        }