コード例 #1
0
        /// <summary>
        /// 防守武将进攻
        /// </summary>
        /// <param name="defrole"></param>
        /// <param name="attrole"></param>
        /// <param name="rolevo"></param>
        /// <returns></returns>
        private void DefenseRoleAttack(DefenseRoles defrole, AttackRoles attrole, WarFightRoleVo rolevo)
        {
            //  attrole.SoldierCount -= 10;//测试数据
            var type = GetHurt(defrole, attrole);

            WarFightRoleVoAddEffect(rolevo, attrole.RoleId, (int)EffectFaceTo.Rival,
                                    type, defrole.SoldierCount, attrole.SoldierCount, 0, 0, 0);
        }
コード例 #2
0
ファイル: FightProcess.Attack.cs プロジェクト: Lantnr/MyTest
        /// <summary>
        /// 进攻武将进攻
        /// </summary>
        /// <param name="defrole"></param>
        /// <param name="attrole"></param>
        /// <param name="rolevo"></param>
        /// <returns></returns>
        private void AttackRoleAttack(AttackRoles attrole, DefenseRoles defrole, WarFightRoleVo rolevo)
        {
            // defrole.SoldierCount -= 10;//测试数据
            var type = GetHurt(attrole, defrole);

            //var type = (int)WarFightEffectType.普通攻击;
            WarFightRoleVoAddEffect(rolevo, defrole.RoleId, (int)EffectFaceTo.Rival, type, attrole.SoldierCount, defrole.SoldierCount, 0, 0, 0);
        }
コード例 #3
0
ファイル: FightProcess.cs プロジェクト: Lantnr/MyTest
        /// <summary>
        /// 武将添加新buff
        /// </summary>
        /// <param name="vo"></param>
        /// <param name="rid"></param>
        /// <param name="type"></param>
        /// <param name="value"></param>
        private void WarFightRoleVoAddBuff(WarFightRoleVo vo, Int64 rid, int type, int value)
        {
            if (vo.newBuff == null)
            {
                vo.newBuff = new List <WarBuffVo>();
            }
            var buff = new WarBuffVo()
            {
                rid   = rid,
                type  = type,
                value = value,
            };

            vo.newBuff.Add(buff);
        }
コード例 #4
0
ファイル: FightProcess.cs プロジェクト: Lantnr/MyTest
        /// <summary>
        /// 武将添加技能效果
        /// </summary>
        /// <param name="vo"></param>
        /// <param name="rid"></param>
        /// <param name="faceto"></param>
        /// <param name="type"></param>
        /// <param name="leftblood">我方剩余血量</param>
        /// <param name="rivalleft">敌方剩余血量</param>
        /// <param name="baseid">技能基表id</param>
        /// <param name="effecttype"></param>
        /// <param name="effectvalue"></param>
        private void WarFightRoleVoAddEffect(WarFightRoleVo vo, Int64 rid, int faceto, int type, int leftblood, int rivalleft, Int32 baseid, int effecttype, int effectvalue)
        {
            var effect = new WarEffectVo()
            {
                baseId          = baseid,
                faceTo          = faceto,
                rids            = rid,
                myLeftBlood     = leftblood,
                rivalLeftBlood  = rivalleft,
                type            = type,
                skillEffectType = effecttype,
                effectValue     = effectvalue
            };

            vo.effects.Add(effect);
        }
コード例 #5
0
        /// <summary>
        /// 防守武将技能触发
        /// </summary>
        /// <param name="role">防守武将</param>
        /// <param name="effects">技能实体</param>
        /// <param name="attackrole">进攻武将</param>
        /// <param name="rolevo">武将vo</param>
        /// <param name="skilltype"></param>
        private void DefenseRoleEffectsAdd(DefenseRoles role, List <WarSkillEffect> effects, AttackRoles attackrole, WarFightRoleVo rolevo, int skilltype)
        {
            foreach (var effect in effects)
            {
                if (effect.Probability > 0 && !new RandomSingle().IsTrue(effect.Probability))
                {
                    continue;                                                                           //效果触发概率
                }
                if (effect.effectSoldier != "0")
                {
                    if (effect.effectSoldier != role.SoldierId.ToString())
                    {
                        return;                                                    //地形效果兵种
                    }
                }
                var target = effect.target;
                switch (effect.effectType)
                {
                    #region 增加攻击力
                case (int)WarFightEffectType.AddAttack:
                {
                    if (effect.target == (int)EffectFaceTo.Me)
                    {
                        if (effect.times > 1)
                        {
                            DefenseRoleAddNewBuff(role, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    else
                    {
                        if (effect.times > 1)
                        {
                            AttackRoleAddNewBuff(attackrole, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    break;
                }
                    #endregion

                    #region 增加防御力
                case (int)WarFightEffectType.AddDefense:
                {
                    if (effect.target == (int)EffectFaceTo.Me)
                    {
                        if (effect.times > 1)
                        {
                            DefenseRoleAddNewBuff(role, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    else
                    {
                        if (effect.times > 1)
                        {
                            AttackRoleAddNewBuff(attackrole, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    break;
                }
                    #endregion

                    #region 增加命中
                case (int)WarFightEffectType.Hits:
                {
                    if (effect.target == (int)EffectFaceTo.Me)
                    {
                        if (effect.times > 1)
                        {
                            DefenseRoleAddNewBuff(role, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    else
                    {
                        if (effect.times > 1)
                        {
                            AttackRoleAddNewBuff(attackrole, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    break;
                }
                    #endregion

                    #region 增加气力
                case (int)WarFightEffectType.QiLi:
                {
                    if (effect.target == (int)EffectFaceTo.Me)
                    {
                        if (effect.times > 1)
                        {
                            DefenseRoleAddNewBuff(role, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    else
                    {
                        if (effect.times > 1)
                        {
                            AttackRoleAddNewBuff(attackrole, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    break;
                }
                    #endregion

                    #region 增加兵力
                case (int)WarFightEffectType.SoldierCount:
                {
                    if (effect.target == (int)EffectFaceTo.Me)
                    {
                        role.SoldierCount += effect.effectValue;
                        if (role.SoldierCount > role.bloodMax)
                        {
                            role.SoldierCount = role.bloodMax;
                        }
                        if (effect.times > 1)
                        {
                            DefenseRoleAddNewBuff(role, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    else
                    {
                        if (attackrole.SoldierCount > role.bloodMax)
                        {
                            attackrole.SoldierCount = attackrole.bloodMax;
                        }
                        if (effect.times > 1)
                        {
                            AttackRoleAddNewBuff(attackrole, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    break;
                }
                    #endregion

                    #region 增加先手值
                case (int)WarFightEffectType.FirstAttack:
                {
                    if (effect.target == (int)EffectFaceTo.Me)
                    {
                        if (effect.times > 1)
                        {
                            DefenseRoleAddNewBuff(role, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    else
                    {
                        if (effect.times > 1)
                        {
                            AttackRoleAddNewBuff(attackrole, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    break;
                }
                    #endregion

                    #region 增加暴击率
                case (int)WarFightEffectType.BaoJi:
                {
                    if (effect.target == (int)EffectFaceTo.Me)
                    {
                        if (effect.times > 1)
                        {
                            DefenseRoleAddNewBuff(role, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    else
                    {
                        if (effect.times > 1)
                        {
                            AttackRoleAddNewBuff(attackrole, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    break;
                }
                    #endregion

                    #region 增加躲避率
                case (int)WarFightEffectType.Dodge:
                {
                    if (effect.target == (int)EffectFaceTo.Me)
                    {
                        if (effect.times > 1)
                        {
                            DefenseRoleAddNewBuff(role, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    else
                    {
                        if (effect.times > 1)
                        {
                            AttackRoleAddNewBuff(attackrole, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    break;
                }
                    #endregion

                    #region 增加士气
                case (int)WarFightEffectType.ShiQi:
                {
                    if (effect.target == (int)EffectFaceTo.Me)
                    {
                        if (effect.times > 1)
                        {
                            DefenseRoleAddNewBuff(role, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    else
                    {
                        if (effect.times > 1)
                        {
                            AttackRoleAddNewBuff(attackrole, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    break;
                }
                    #endregion

                    #region 免疫僧兵兵种特性
                case (int)WarFightEffectType.CanceCheatroles:
                {
                    if (effect.target == (int)EffectFaceTo.Me)
                    {
                        DefenseRoleAddNewBuff(role, effect.effectType, effect.effectValue, skilltype, effect.times);
                    }
                    else
                    {
                        if (effect.times > 1)
                        {
                            AttackRoleAddNewBuff(attackrole, effect.effectType, effect.effectValue, skilltype, effect.times);
                        }
                    }
                    break;
                }
                    #endregion

                    #region 停止释放奥义
                case (int)WarFightEffectType.StopKatha:
                {
                    AttackRoleAddNewBuff(attackrole, effect.effectType, effect.effectValue, skilltype, effect.times);
                    break;
                }
                    #endregion

                    #region 立即释放奥义
                case (int)WarFightEffectType.StartKatha:
                {
                    DefenseRoleAddNewBuff(role, effect.effectType, effect.effectValue, skilltype, effect.times);

                    break;
                }
                    #endregion
                }
                if (skilltype != (int)WarFightSkillType.Area)
                {
                    //vo添加状态
                    if (effect.target == (int)EffectFaceTo.Me) //对自己
                    {
                        if (effect.times == 1)
                        {
                            WarFightRoleVoAddEffect(rolevo, role.RoleId, target,
                                                    SkillTypeToEffectType(skilltype), role.SoldierCount, attackrole.SoldierCount, effect.id, effect.effectType, effect.effectValue);
                        }
                        else
                        {
                            //添加buff
                            WarFightRoleVoAddBuff(rolevo, role.RoleId, effect.effectType, effect.effectValue);
                        }
                    }
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// 检测防守武将,武将特性是否触发
        /// </summary>
        /// <returns></returns>
        private bool CheckSkill(DefenseRoles role, List <int> nowcondition, WarFight fight, AttackRoles attackrole, WarFightRoleVo rolevo, WarFightSkillType type)
        {
            var skills = role.skills.Where(q => q.type == type).ToList();

            foreach (var skill in skills)
            {
                var ismatch = CheckDefenseRoleCondition(role, nowcondition, fight, attackrole, skill.Condition);
                if (!ismatch)
                {
                    continue;
                }
                if (type == WarFightSkillType.Katha && role.buffs.Any(q => q.type == (int)WarFightEffectType.StartKatha) &&
                    attackrole.buffs.All(q => q.type != (int)WarFightEffectType.StopKatha))  //是否立即释放奥义
                {
                    DefenseRoleEffectsAdd(role, skill.FightSkillEffects, attackrole, rolevo, (int)type);
                }

                DefenseRoleEffectsAdd(role, skill.FightSkillEffects, attackrole, rolevo, (int)type);
                return(true);
            }
            return(false);
        }
コード例 #7
0
        ///  <summary>
        /// 验证是否出发地形效果
        ///  </summary>
        ///  <param name="fight"></param>
        ///  <param name="attackrole"></param>
        ///  <param name="rolevo"></param>
        /// <param name="role"></param>
        /// <returns></returns>
        private bool CheckArea(DefenseRoles role, WarFight fight, AttackRoles attackrole, WarFightRoleVo rolevo)
        {
            var type = (int)WarFightSkillType.Area;
            var area = fight.Area.FirstOrDefault(q => q.X == role.X && q.Y == role.Y);

            if (area == null)
            {
                return(false);
            }
            var effectstring = fight.Weather == (int)WeatherType.Rain ? area.raineffect : area.suneffect;

            if (effectstring == "")
            {
                return(false);
            }

            var effects = WarSkillEffect.GetEffectStringInit(effectstring, true);

            if (area.type == (int)AreaType.陷阱)
            {
                type = (int)WarFightSkillType.Trap;
            }
            DefenseRoleEffectsAdd(role, effects, attackrole, rolevo, type);
            fight.Area.Remove(area);
            return(true);
        }
コード例 #8
0
ファイル: FightProcess.Attack.cs プロジェクト: Lantnr/MyTest
        /// <summary>
        /// 进攻武将技能触发
        /// </summary>
        /// <param name="attackrole">进攻武将</param>
        /// <param name="effects">技能实体</param>
        /// <param name="defenserole">防守武将</param>
        /// <param name="rolevo">武将vo</param>
        /// <param name="skilltype"></param>
        private void AttackRoleEffectsAdd(AttackRoles attackrole, List <WarSkillEffect> effects, DefenseRoles defenserole, WarFightRoleVo rolevo, int skilltype)
        {
            //WarFightRoleVoAddEffect(rolevo, attackrole.RoleId, 0, SkillTypeToEffectType(skilltype), attackrole.SoldierCount, defenserole.SoldierCount,
            //    effects[0].id, 0, 0);   //vo增加效果
            foreach (var effect in effects)
            {
                if (effect.Probability > 0 && !new RandomSingle().IsTrue(effect.Probability))
                {
                    continue;          //效果触发概率
                }
                if (effect.times == 0) //永久增加
                {
                    #region 永久效果

                    switch (effect.effectType)
                    {
                        #region 增加攻击力

                    case (int)WarFightEffectType.AddAttack:
                    {
                        if (effect.target == (int)EffectFaceTo.Me)
                        {
                            attackrole.attack += effect.effectValue;
                        }
                        else
                        {
                            defenserole.attack += effect.effectValue;
                        }
                        break;
                    }

                        #endregion

                        #region 增加防御力

                    case (int)WarFightEffectType.AddDefense:
                    {
                        if (effect.target == (int)EffectFaceTo.Me)
                        {
                            attackrole.defense += effect.effectValue;
                        }
                        else
                        {
                            defenserole.defense += effect.effectValue;
                        }
                        break;
                    }

                        #endregion

                        #region 增加命中

                    case (int)WarFightEffectType.Hits:
                    {
                        if (effect.target == (int)EffectFaceTo.Me)
                        {
                            attackrole.hits += effect.effectValue;
                        }
                        else
                        {
                            defenserole.hits += effect.effectValue;
                        }
                        break;
                    }

                        #endregion

                        #region 增加气力

                    case (int)WarFightEffectType.QiLi:
                    {
                        if (effect.target == (int)EffectFaceTo.Me)
                        {
                            attackrole.qili += effect.effectValue;
                        }
                        else
                        {
                            defenserole.qili += effect.effectValue;
                        }
                        break;
                    }

                        #endregion

                        #region 增加兵力

                    case (int)WarFightEffectType.SoldierCount:
                    {
                        if (effect.target == (int)EffectFaceTo.Me)
                        {
                            attackrole.SoldierCount += effect.effectValue;
                            if (attackrole.SoldierCount > attackrole.bloodMax)
                            {
                                attackrole.SoldierCount = attackrole.bloodMax;
                            }
                        }
                        else
                        {
                            if (attackrole.SoldierCount > attackrole.bloodMax)
                            {
                                attackrole.SoldierCount = attackrole.bloodMax;
                            }
                            if (effect.times > 1)
                            {
                                DefenseRoleAddNewBuff(defenserole, effect.effectType, effect.effectValue, skilltype,
                                                      effect.times);
                            }
                        }
                        break;
                    }

                        #endregion

                        #region 增加先手值

                    case (int)WarFightEffectType.FirstAttack:
                    {
                        if (effect.target == (int)EffectFaceTo.Me)
                        {
                            attackrole.AttackSort += effect.effectValue;
                        }
                        else
                        {
                            defenserole.AttackSort += effect.effectValue;
                        }
                        break;
                    }

                        #endregion

                        #region 增加暴击率

                    case (int)WarFightEffectType.BaoJi:
                    {
                        if (effect.target == (int)EffectFaceTo.Me)
                        {
                            attackrole.crit += effect.effectValue;
                        }
                        else
                        {
                            defenserole.crit += effect.effectValue;
                        }
                        break;
                    }

                        #endregion

                        #region 增加躲避率

                    case (int)WarFightEffectType.Dodge:
                    {
                        if (effect.target == (int)EffectFaceTo.Me)
                        {
                            attackrole.dodge += effect.effectValue;
                        }
                        else
                        {
                            defenserole.dodge += effect.effectValue;
                        }
                        break;
                    }

                        #endregion

                        #region 增加士气

                    case (int)WarFightEffectType.ShiQi:
                    {
                        if (effect.target == (int)EffectFaceTo.Me)
                        {
                            attackrole.morale += effect.effectValue;
                        }
                        else
                        {
                            defenserole.morale += effect.effectValue;
                        }
                        break;
                    }

                        #endregion
                    }

                    #endregion

                    WarFightRoleVoAddEffect(rolevo, attackrole.RoleId, effect.target, SkillTypeToEffectType(skilltype),
                                            attackrole.SoldierCount, defenserole.SoldierCount, 0, effect.effectType, effect.effectValue); //vo增加效果
                    continue;
                }
                if (effect.target == (int)EffectFaceTo.Me)
                {
                    AttackRoleAddNewBuff(attackrole, effect.effectType, effect.effectValue, skilltype, effect.times); //实体增加效果数值数据

                    WarFightRoleVoAddEffect(rolevo, attackrole.RoleId, effect.target, SkillTypeToEffectType(skilltype),
                                            attackrole.SoldierCount, defenserole.SoldierCount, 0, effect.effectType, effect.effectValue); //vo增加效果

                    if (effect.times > 1)                                                                                                 //持续超过1回合
                    //添加buff
                    {
                        WarFightRoleVoAddBuff(rolevo, attackrole.RoleId, effect.effectType, effect.effectValue);
                    }
                }
                else
                {
                    DefenseRoleAddNewBuff(defenserole, effect.effectType, effect.effectValue, skilltype, effect.times);                   //实体添加buff
                    WarFightRoleVoAddEffect(rolevo, defenserole.RoleId, effect.target, SkillTypeToEffectType(skilltype),
                                            attackrole.SoldierCount, defenserole.SoldierCount, 0, effect.effectType, effect.effectValue); //vo增加效果
                    if (effect.times > 1)                                                                                                 //
                    //添加buff
                    {
                        WarFightRoleVoAddBuff(rolevo, defenserole.RoleId, effect.effectType, effect.effectValue);
                    }
                }
            }
        }