コード例 #1
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 };
        }
コード例 #2
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;
 }
コード例 #3
0
ファイル: BT_Monster.cs プロジェクト: mengtest/DragonBallNew
        //进入下个回合
        /// <summary>
        /// 目前Buff和Debuff只有特定的两个而且还都是Buff,就是 CMsgHeader.BUFF_DEBUFF_IMMUNITY 和 CMsgHeader.BUFF_DEBUFF_REDUCE_HP
        /// </summary>
        public void enterNextLun()
        {
            _lastLun++;
            //一些buff debuff 更新...
            BT_BuffOrDebuff immunityBuff = getBuffOrDebuff(CMsgHeader.BUFF_DEBUFF_IMMUNITY);

            if (immunityBuff != null)
            {
                immunityBuff.round--;
                if (immunityBuff.round < 0)
                {
                    immunityBuff.round = 0;
                }
                _buffArr[CMsgHeader.BUFF_DEBUFF_IMMUNITY] = immunityBuff;
            }

            BT_BuffOrDebuff ReduceHpDebuff = getBuffOrDebuff(CMsgHeader.BUFF_DEBUFF_REDUCE_HP);

            if (ReduceHpDebuff != null)
            {
                ReduceHpDebuff.round--;
                if (ReduceHpDebuff.round < 0)
                {
                    ReduceHpDebuff.round = 0;
                }
                _buffArr[CMsgHeader.BUFF_DEBUFF_REDUCE_HP] = ReduceHpDebuff;
            }
        }
コード例 #4
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 };
        }
コード例 #5
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 };
        }
コード例 #6
0
ファイル: BT_Monster.cs プロジェクト: mengtest/DragonBallNew
        //受到BufforDebuff
        public void castBufforDebuff()
        {
            BT_BuffOrDebuff ReduceHpDebuff = getBuffOrDebuff(CMsgHeader.BUFF_DEBUFF_REDUCE_HP);

            if (ReduceHpDebuff != null && ReduceHpDebuff.round > 0)
            {
                BT_Skill skill = ReduceHpDebuff.skill;
                if (skill != null)
                {
                    skill.castDecSkill(skill.param.num);
                }
            }
        }
コード例 #7
0
ファイル: BT_Monster.cs プロジェクト: mengtest/DragonBallNew
        public BT_BuffOrDebuff getBuffOrDebuff(short type, bool beBuff = true)
        {
            Dictionary <short, BT_BuffOrDebuff> worked = beBuff ? _buffArr : _debuffArr;

            BT_BuffOrDebuff buf = null;

            if (!worked.TryGetValue(type, out buf))
            {
                buf = null;
            }

            return(buf);
        }
コード例 #8
0
ファイル: BT_Monster.cs プロジェクト: mengtest/DragonBallNew
        //能否遭受技能的攻击
        public bool canSufferSkillDamage()
        {
            bool            shouldSuffer = true;
            BT_BuffOrDebuff immunityBuff = getBuffOrDebuff(CMsgHeader.BUFF_DEBUFF_IMMUNITY);

            if (immunityBuff != null && immunityBuff.round > 0)
            {
                shouldSuffer = false;
            }
            if (!shouldSuffer)
            {
                CMsgSkillBuffDebuffEffect msg = new CMsgSkillBuffDebuffEffect(this, immunityBuff);
                _war.addMsgToRecorder(msg);
            }
            return(shouldSuffer);
        }
コード例 #9
0
ファイル: BT_Monster.cs プロジェクト: mengtest/DragonBallNew
        //如果宠物死亡,则要清除BuffOrDebuff状态
        public void clearBuffOrDebuff()
        {
            BT_BuffOrDebuff immunityBuff = getBuffOrDebuff(CMsgHeader.BUFF_DEBUFF_IMMUNITY);

            if (immunityBuff != null)
            {
                _buffArr.Remove(CMsgHeader.BUFF_DEBUFF_IMMUNITY);
            }

            BT_BuffOrDebuff ReduceHpDebuff = getBuffOrDebuff(CMsgHeader.BUFF_DEBUFF_REDUCE_HP);

            if (ReduceHpDebuff != null)
            {
                _buffArr.Remove(CMsgHeader.BUFF_DEBUFF_REDUCE_HP);
            }
        }
コード例 #10
0
ファイル: BT_Monster.cs プロジェクト: mengtest/DragonBallNew
        //能否释放技能 -- 根据Debuff的状态来决定
        public bool canCastSkillAcc2BuffOrDebuff(BT_Skill sk, int skType)
        {
            bool canCast = true;

            if (skType == SkillOpData.Common_Skill)
            {
                BT_BuffOrDebuff sealDebuff = getBuffOrDebuff(CMsgHeader.BUFF_DEBUFF_SEAL, false);
                if (sealDebuff != null && _lastLun == 0)
                {
                    canCast = false;

                    CMsgSkillBuffDebuffEffect msg = new CMsgSkillBuffDebuffEffect(this, sealDebuff);
                    msg.arg1 = sk.id;
                    _war.addMsgToRecorder(msg);
                }
            }
            return(canCast);
        }
コード例 #11
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);
        }
コード例 #12
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();
        }
コード例 #13
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;
        }
コード例 #14
0
ファイル: BT_Monster.cs プロジェクト: mengtest/DragonBallNew
        //返回实现伤害值
        public int sufferAttack(BT_Hurt damage, BT_Monster enemy)
        {
            int finalDamage = MathHelper.MidpointRounding(damage.damageVal);

            //技能来的攻击
            if ((damage.hurtType == BT_Hurt_Type.HURT_SKILL || damage.hurtType == BT_Hurt_Type.HURT_ANGRY_SKILL) && canSufferSkillDamage() == false)
            {
                finalDamage = 0;
            }

            #region 各种buff or defbuff处理...

            //伤害全部防御技能
            short           bufDebuffType = CMsgHeader.BUFF_DEBUFF_GOLDDEFENSE;
            BT_BuffOrDebuff goldShieldBuf = getBuffOrDebuff(bufDebuffType);
            if (goldShieldBuf != null && --goldShieldBuf.round >= 0)
            {
                finalDamage = 0;

                CMsgSkillBuffDebuffEffect msg = new CMsgSkillBuffDebuffEffect(this, goldShieldBuf);
                _war.addMsgToRecorder(msg);

                _buffArr[bufDebuffType] = goldShieldBuf;
            }

            //伤害加深
            bufDebuffType = CMsgHeader.BUFF_DEBUFF_HURTUP;
            BT_BuffOrDebuff hurtUpDebuff = getBuffOrDebuff(bufDebuffType, false);
            if (hurtUpDebuff != null && --hurtUpDebuff.round >= 0)
            {
                int rDamage = MathHelper.MidpointRounding(damage.damageVal * (1 + hurtUpDebuff.rate * Consts.oneHundred));

                CMsgSkillBuffDebuffEffect msg = new CMsgSkillBuffDebuffEffect(this, hurtUpDebuff);
                msg.arg1 = MathHelper.MidpointRounding(damage.damageVal);
                msg.arg2 = rDamage;
                _war.addMsgToRecorder(msg);
                _debuffArr[bufDebuffType] = hurtUpDebuff;

                finalDamage = rDamage;
            }

            //反弹部分伤害到敌人...
            bufDebuffType = CMsgHeader.BUFF_DEBUFF_REBOUND;
            BT_BuffOrDebuff reboundBuff = getBuffOrDebuff(bufDebuffType);
            if (reboundBuff != null && --reboundBuff.round >= 0 && enemy.alive)
            {
                float rebound = damage.damageVal * reboundBuff.rate * Consts.oneHundred;
                damage.damageVal -= rebound;

                enemy.sufferNormalAttack(MathHelper.MidpointRounding(rebound), this, true);
                _buffArr[bufDebuffType] = reboundBuff;

                finalDamage = MathHelper.MidpointRounding(damage.damageVal);
            }

            //护盾技能...
            bufDebuffType = CMsgHeader.BUFF_DEBUFF_DEFENSE;
            BT_BuffOrDebuff shieldBuff = getBuffOrDebuff(bufDebuffType);
            if (shieldBuff != null && shieldBuff.suckDmg > 0)
            {
                int beforeShield = shieldBuff.suckDmg;
                if (beforeShield > damage.damageVal)
                {
                    shieldBuff.suckDmg -= MathHelper.MidpointRounding(damage.damageVal);
                    finalDamage         = 0;
                }
                else
                {
                    damage.damageVal  -= beforeShield;
                    shieldBuff.suckDmg = 0;
                    finalDamage        = MathHelper.MidpointRounding(damage.damageVal);
                }

                CMsgSkillBuffDebuffEffect msg = new CMsgSkillBuffDebuffEffect(this, shieldBuff);
                msg.arg1 = beforeShield;
                msg.arg2 = shieldBuff.suckDmg;
                _war.addMsgToRecorder(msg);

                _buffArr[bufDebuffType] = shieldBuff;
            }

            #endregion

            setCurAtt(_curAtt - finalDamage);

            return(finalDamage);
        }
コード例 #15
0
ファイル: BT_Monster.cs プロジェクト: mengtest/DragonBallNew
        public void addBuffOrDebuff(BT_BuffOrDebuff bufOrDebuff, bool beBuff = true)
        {
            Dictionary <short, BT_BuffOrDebuff> worked = beBuff ? _buffArr : _debuffArr;

            worked[bufOrDebuff.type] = bufOrDebuff;
        }