コード例 #1
0
ファイル: Action1466.cs プロジェクト: jinfei426/Scut
        public override bool TakeAction()
        {
            if (!TrumpHelper.IsLearnProperty(ContextUser))
            {
                ErrorCode = LanguageManager.GetLang().ErrorCode;
                ErrorInfo = LanguageManager.GetLang().St1466_WorshipPropertyNotEnough;
                return false;
            }
            UserTrump userTrump = new GameDataCacheSet<UserTrump>().FindKey(ContextUser.UserID, TrumpInfo.CurrTrumpID);
            if (userTrump == null)
            {
                return false;
            }
            UserItemInfo userItem = null;
            var package = UserItemPackage.Get(ContextUser.UserID);
            if (package != null)
            {
                userItem = package.ItemPackage.Find(m => !m.IsRemove && m.UserItemID == userItemID);
                if (userItem == null || (userItem.ItemType != ItemType.DaoJu && userItem.PropType == 13))
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St1466_ItemPropertyNotEnough;
                    return false;
                }
                ItemBaseInfo itemInfo = new ConfigCacheSet<ItemBaseInfo>().FindKey(userItem.ItemID);
                if (itemInfo != null)
                {
                    GeneralProperty property = null;
                    if (userTrump.PropertyInfo.Count > 0)
                    {
                        property = userTrump.PropertyInfo.Find(m => m.AbilityType == itemInfo.AbilityType);
                        if (property != null)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St1466_ItemPropertyExite;
                            return false;
                        }
                    }
                    else
                    {
                        userTrump.PropertyInfo.Clear();
                    }
                    short baseLv = 1;
                    TrumpPropertyInfo trumpProperty =
                        new ConfigCacheSet<TrumpPropertyInfo>().FindKey(itemInfo.AbilityType, baseLv);
                    if (trumpProperty != null)
                    {
                        property = new GeneralProperty();
                        property.AbilityType = itemInfo.AbilityType;
                        property.AbilityLv = 1;
                        property.AbilityValue = trumpProperty.PropertyNum;
                        userTrump.PropertyInfo.Add(property);
                        TraceProperty(userTrump);
                        UserItemHelper.UseUserItem(ContextUser.UserID, userItem.ItemID, trumpProperty.ItemNum);

                        var usergeneral = UserGeneral.GetMainGeneral(ContextUser.UserID);
                        if (usergeneral != null)
                        {
                            usergeneral.RefreshMaxLife();
                        }

                        ErrorCode = 0;
                        ErrorInfo = LanguageManager.GetLang().St1466_LearningSuccess;
                    }
                }
            }

            return true;
        }
コード例 #2
0
ファイル: TrumpAbilityAttack.cs プロジェクト: kehaoran74/Scut
 /// <summary>
 /// 法宝技能——属性转换
 /// </summary>
 /// <param name="userID"></param>
 /// <returns></returns>
 public static List<GeneralProperty> AttributeConversion(string userID, decimal powerNum, decimal soulNum, decimal intellectNum)
 {
     decimal changeNum = 0;
     List<GeneralProperty> propertyList = new List<GeneralProperty>();
     UserGeneral general = UserGeneral.GetMainGeneral(userID);
     if (general == null)
     {
         return propertyList;
     }
     UserTrump userTrump = new GameDataCacheSet<UserTrump>().FindKey(userID, TrumpInfo.CurrTrumpID);
     if (userTrump != null && userTrump.LiftNum > 0 && userTrump.SkillInfo.Count > 0)
     {
         foreach (SkillInfo skillInfo in userTrump.SkillInfo)
         {
             AbilityInfo abilityInfo = new ConfigCacheSet<AbilityInfo>().FindKey(skillInfo.AbilityID);
             if (abilityInfo != null && abilityInfo.AttackType == AttackType.Change)
             {
                 SkillLvInfo skillLvInfo = new ConfigCacheSet<SkillLvInfo>().FindKey(skillInfo.AbilityID, skillInfo.AbilityLv);
                 if (skillLvInfo == null)
                 {
                     break;
                 }
                 switch (abilityInfo.ChangeAbility)
                 {
                     case AbilityType.PowerNum:
                         changeNum = powerNum;
                         break;
                     case AbilityType.SoulNum:
                         changeNum = soulNum;
                         break;
                     case AbilityType.IntelligenceNum:
                         changeNum = intellectNum;
                         break;
                     default:
                         changeNum = 0;
                         break;
                 }
                 GeneralProperty property = new GeneralProperty();
                 property.AbilityType = abilityInfo.AfterAbility;
                 property.AbilityValue = changeNum * skillLvInfo.Coefficient;
                 propertyList.Add(property);
             }
         }
     }
     return propertyList;
 }
コード例 #3
0
ファイル: GeneralHelper.cs プロジェクト: daneric/Scut-samples
 /// <summary>
 /// 升级加属性
 /// </summary>
 /// <param name="general"></param>
 /// <param name="property"></param>
 public static void UpdateGeneralPro(UserGeneral general, AbilityType type, decimal num)
 {
     if (type == AbilityType.Potential)
     {
         general.Potential = MathUtils.Addition(general.Potential, num).ToInt();
     }
     var property = general.Attribute.Find(s => s.AbilityType == type);
     if (property != null)
     {
         general.Attribute.UpdateNotify(obj =>
         {
             property.AbilityValue = MathUtils.Addition(property.AbilityValue, num);
             return true;
         });
         //property.UpdateNotify(obj =>
         //{
         //    property.AbilityValue = num;
         //    return true;
         //});
     }
     else
     {
         property = new GeneralProperty();
         property.AbilityType = type;
         property.AbilityValue = num;
         general.Attribute.Add(property);
     }
 }
コード例 #4
0
ファイル: CombatHelper.cs プロジェクト: jinfei426/Scut
        /// <summary>
        /// 佣兵属性集合
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="generalID"></param>
        /// <returns></returns>
        public static List<GeneralProperty> GetAbility(string userID, int generalID,UserGeneral userGeneral)
        {
           
            List<GeneralProperty> gPropertyList = new List<GeneralProperty>();
            var cacheSetUserEmbattle = new GameDataCacheSet<UserEmbattle>();
            GeneralProperty generalProperty = new GeneralProperty();
            var userMagic = new GameDataCacheSet<UserMagic>().Find(userID, s => s.IsEnabled);
            CombatGeneral combatGeneral = new CombatGeneral()
            {
                UserID = userID,
                GeneralID = generalID,
                ExtraAttack = new CombatProperty(),
                ExtraDefense = new CombatProperty(),
                LifeNum = userGeneral.LifeNum,
                LifeMaxNum = userGeneral.LifeMaxNum
            };
            
            
            var userEmbattleList = cacheSetUserEmbattle.FindAll(userID,
                                                                s =>
                                                                s.MagicID == (userMagic != null ? userMagic.MagicID : 0));
            UserEmbattleQueue.embattleList = userEmbattleList;
            UserEmbattleQueue.KarmaAddition(userID, combatGeneral);
            userGeneral.TLifeNum = combatGeneral.LifeNum;
            userGeneral.TLifeMaxNun = combatGeneral.LifeMaxNum;
            //int LifeReply = 0; // 生命回复
            //物理攻击
            generalProperty = GetAbilityProperty(userID, generalID, AbilityType.WuLiGongJi);
            generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue*combatGeneral.ExtraAttack.AdditionWuliNum);
            gPropertyList.Add(generalProperty);
            //物理防御
            generalProperty = GetAbilityProperty(userID, generalID, AbilityType.WuLiFangYu);
            generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraDefense.AdditionWuliNum);
            gPropertyList.Add(generalProperty);
            //魂技攻击
            generalProperty = GetAbilityProperty(userID, generalID, AbilityType.HunJiGongJi);
            generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraAttack.AdditionHunjiNum);
            gPropertyList.Add(generalProperty);
            //魂技防御   
            generalProperty = GetAbilityProperty(userID, generalID, AbilityType.HunJiFangYu);
            generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraDefense.AdditionHunjiNum);
            gPropertyList.Add(generalProperty);
            //魔法攻击
            generalProperty = GetAbilityProperty(userID, generalID, AbilityType.MoFaGongJi);
            generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraAttack.AdditionMofaNum);
            gPropertyList.Add(generalProperty);
            //魔法防御
            generalProperty = GetAbilityProperty(userID, generalID, AbilityType.MoFaFangYu);
            generalProperty.AbilityValue = MathUtils.Addition(generalProperty.AbilityValue, generalProperty.AbilityValue * combatGeneral.ExtraDefense.AdditionMofaNum);
            gPropertyList.Add(generalProperty);

            //暴击
            gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.BaoJi));
            //命中
            gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.MingZhong));
            //破击 
            gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.PoJi));
            //韧性
            gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.RenXing));
            //闪避
            gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.ShanBi));
            //格挡
            gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.GeDang));
            //必杀
            gPropertyList.Add(GetAbilityProperty(userID, generalID, AbilityType.BiSha));

            //先攻
            gPropertyList.Add(new GeneralProperty() { AbilityType = AbilityType.FirstStrike, AbilityValue = (decimal)TotalPriorityNum(userID, generalID) });

            return gPropertyList;
        }