Exemple #1
0
        internal static UserArenaAttr CalcPartnerAttr(UserArenaAttr owner, ArkCrossEngine.PartnerInfo partner)
        {
            UserArenaAttr result = new UserArenaAttr();

            if (partner == null || owner == null)
            {
                return(result);
            }
            AppendAttributeConfig aac = AppendAttributeConfigProvider.Instance.GetDataById(partner.GetAppendAttrConfigId());

            if (aac == null)
            {
                return(result);
            }
            float inheritDefenceAttrPercent = partner.GetInheritDefenceAttrPercent();

            result.HpMax     = (int)(owner.HpMax * inheritDefenceAttrPercent);
            result.HpRecover = 0;
            return(result);
        }
        private void SummonPartner(int key_code, int what)
        {
            RoleInfo roleself = LobbyClient.Instance.CurrentRole;

            if (null == roleself)
            {
                return;
            }
            UserInfo playerself = WorldSystem.Instance.GetPlayerSelf();

            if (null == playerself)
            {
                return;
            }
            ///
            if ((int)Keyboard.Event.Up == what)
            {
                // summonpartner
                PartnerInfo partnerInfo = roleself.PartnerStateInfo.GetActivePartner();
                if (null != partnerInfo)
                {
                    Data_Unit data = new Data_Unit();
                    data.m_Id         = -1;
                    data.m_LinkId     = partnerInfo.LinkId;
                    data.m_CampId     = playerself.GetCampId();
                    data.m_Pos        = playerself.GetMovementStateInfo().GetPosition3D();
                    data.m_RotAngle   = 0;
                    data.m_AiLogic    = partnerInfo.GetAiLogic();
                    data.m_AiParam[0] = "";
                    data.m_AiParam[1] = "";
                    data.m_AiParam[2] = partnerInfo.GetAiParam().ToString();
                    data.m_IsEnable   = true;
                    NpcInfo npc = WorldSystem.Instance.NpcManager.AddNpc(data);
                    if (null != npc)
                    {
                        AppendAttributeConfig aac       = AppendAttributeConfigProvider.Instance.GetDataById(partnerInfo.GetAppendAttrConfigId());
                        float inheritAttackAttrPercent  = partnerInfo.GetInheritAttackAttrPercent();
                        float inheritDefenceAttrPercent = partnerInfo.GetInheritDefenceAttrPercent();
                        if (null != aac)
                        {
                            // attack
                            npc.GetBaseProperty().SetAttackBase(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().AttackBase *inheritAttackAttrPercent));
                            npc.GetBaseProperty().SetFireDamage(Operate_Type.OT_Absolute, playerself.GetActualProperty().FireDamage *inheritAttackAttrPercent);
                            npc.GetBaseProperty().SetIceDamage(Operate_Type.OT_Absolute, playerself.GetActualProperty().IceDamage *inheritAttackAttrPercent);
                            npc.GetBaseProperty().SetPoisonDamage(Operate_Type.OT_Absolute, playerself.GetActualProperty().PoisonDamage *inheritAttackAttrPercent);
                            // defence
                            npc.GetBaseProperty().SetHpMax(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().HpMax *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetEnergyMax(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().EnergyMax *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetADefenceBase(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().ADefenceBase *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetMDefenceBase(Operate_Type.OT_Absolute, (int)(playerself.GetActualProperty().MDefenceBase *inheritDefenceAttrPercent));
                            npc.GetBaseProperty().SetFireERD(Operate_Type.OT_Absolute, playerself.GetActualProperty().FireERD *inheritDefenceAttrPercent);
                            npc.GetBaseProperty().SetIceERD(Operate_Type.OT_Absolute, playerself.GetActualProperty().IceERD *inheritDefenceAttrPercent);
                            npc.GetBaseProperty().SetPoisonERD(Operate_Type.OT_Absolute, playerself.GetActualProperty().PoisonERD *inheritDefenceAttrPercent);
                            // reset hp & energy
                            npc.SetHp(Operate_Type.OT_Absolute, npc.GetActualProperty().HpMax);
                            npc.SetEnergy(Operate_Type.OT_Absolute, npc.GetActualProperty().EnergyMax);
                        }
                        npc.SetAIEnable(true);
                        npc.GetSkillStateInfo().RemoveAllSkill();
                        npc.BornTime = TimeUtility.GetServerMilliseconds();
                        List <int> skillList = partnerInfo.GetSkillList();
                        if (null != skillList)
                        {
                            for (int i = 0; i < skillList.Count; ++i)
                            {
                                SkillInfo skillInfo = new SkillInfo(skillList[i]);
                                npc.GetSkillStateInfo().AddSkill(skillInfo);
                            }
                        }
                        npc.SkillController  = new SwordManSkillController(npc, GfxModule.Skill.GfxSkillSystem.Instance);
                        npc.OwnerId          = playerself.GetId();
                        playerself.PartnerId = npc.GetId();
                        EntityManager.Instance.CreateNpcView(npc.GetId());
                        if (partnerInfo.BornSkill > 0)
                        {
                            SkillInfo skillInfo = new SkillInfo(partnerInfo.BornSkill);
                            npc.GetSkillStateInfo().AddSkill(skillInfo);
                            npc.SkillController.ForceStartSkill(partnerInfo.BornSkill);
                        }
                        CharacterView view = EntityManager.Instance.GetCharacterViewById(npc.GetId());
                        if (null != view)
                        {
                            GfxSystem.SetLayer(view.Actor, "PhysicObj");
                        }
                    }
                }
            }
        }
Exemple #3
0
        internal static UserArenaAttr CalcPartnerAddAttr(UserArenaAttr base_attr, ArkCrossEngine.PartnerInfo pi)
        {
            UserArenaAttr added = new UserArenaAttr();

            if (pi == null)
            {
                return(added);
            }
            AppendAttributeConfig info = AppendAttributeConfigProvider.Instance.GetDataById(pi.GetAppendAttrConfigId());

            if (info != null)
            {
                added.HpMax     = (int)info.GetAddHpMax(base_attr.HpMax, base_attr.level);
                added.HpRecover = (int)info.GetAddHpRecover(base_attr.HpRecover, base_attr.level);
            }
            return(added);
        }
        /// <summary>
        /// calculate attr by partner
        /// </summary>
        /// <param name="obj"></param>
        public static void RefixAttrByPartner(UserInfo obj)
        {
            PartnerInfo pi = obj.GetPartnerInfo();

            if (null != pi)
            {
                AppendAttributeConfig info = AppendAttributeConfigProvider.Instance.GetDataById(pi.GetAppendAttrConfigId());
                if (null != info)
                {
                    float aMoveSpeed          = obj.GetActualProperty().MoveSpeed;
                    int   aHpMax              = obj.GetActualProperty().HpMax;
                    int   aEnergyMax          = obj.GetActualProperty().EnergyMax;
                    float aHpRecover          = obj.GetActualProperty().HpRecover;
                    float aEnergyRecover      = obj.GetActualProperty().EnergyRecover;
                    int   aAttackBase         = obj.GetActualProperty().AttackBase;
                    int   aADefenceBase       = obj.GetActualProperty().ADefenceBase;
                    int   aMDefenceBase       = obj.GetActualProperty().MDefenceBase;
                    float aCritical           = obj.GetActualProperty().Critical;
                    float aCriticalPow        = obj.GetActualProperty().CriticalPow;
                    float aCriticalBackHitPow = obj.GetActualProperty().CriticalBackHitPow;
                    float aCriticalCrackPow   = obj.GetActualProperty().CriticalCrackPow;
                    float aFireDamage         = obj.GetActualProperty().FireDamage;
                    float aFireERD            = obj.GetActualProperty().FireERD;
                    float aIceDamage          = obj.GetActualProperty().IceDamage;
                    float aIceERD             = obj.GetActualProperty().IceERD;
                    float aPoisonDamage       = obj.GetActualProperty().PoisonDamage;
                    float aPoisonERD          = obj.GetActualProperty().PoisonERD;
                    float aWeight             = obj.GetActualProperty().Weight;
                    float aRps         = obj.GetActualProperty().Rps;
                    float aAttackRange = obj.GetActualProperty().AttackRange;
                    obj.GetActualProperty().SetMoveSpeed(Operate_Type.OT_Relative, info.GetAddSpd(aMoveSpeed, obj.GetLevel()));
                    obj.GetActualProperty().SetHpMax(Operate_Type.OT_Relative, (int)info.GetAddHpMax(aHpMax, obj.GetLevel()));
                    obj.GetActualProperty().SetEnergyMax(Operate_Type.OT_Relative, (int)info.GetAddEpMax(aEnergyMax, obj.GetLevel()));
                    obj.GetActualProperty().SetHpRecover(Operate_Type.OT_Relative, info.GetAddHpRecover(aHpRecover, obj.GetLevel()));
                    obj.GetActualProperty().SetEnergyRecover(Operate_Type.OT_Relative, info.GetAddEpRecover(aEnergyRecover, obj.GetLevel()));
                    obj.GetActualProperty().SetAttackBase(Operate_Type.OT_Relative, (int)info.GetAddAd(aAttackBase, obj.GetLevel()));
                    obj.GetActualProperty().SetADefenceBase(Operate_Type.OT_Relative, (int)info.GetAddADp(aADefenceBase, obj.GetLevel()));
                    obj.GetActualProperty().SetMDefenceBase(Operate_Type.OT_Relative, (int)info.GetAddMDp(aMDefenceBase, obj.GetLevel()));
                    obj.GetActualProperty().SetCritical(Operate_Type.OT_Relative, info.GetAddCri(aCritical, obj.GetLevel()));
                    obj.GetActualProperty().SetCriticalPow(Operate_Type.OT_Relative, info.GetAddPow(aCriticalPow, obj.GetLevel()));
                    obj.GetActualProperty().SetCriticalBackHitPow(Operate_Type.OT_Relative, info.GetAddBackHitPow(aCriticalBackHitPow, obj.GetLevel()));
                    obj.GetActualProperty().SetCriticalCrackPow(Operate_Type.OT_Relative, info.GetAddCrackPow(aCriticalCrackPow, obj.GetLevel()));
                    obj.GetActualProperty().SetFireDamage(Operate_Type.OT_Relative, info.GetAddFireDam(aFireDamage, obj.GetLevel()));
                    obj.GetActualProperty().SetFireERD(Operate_Type.OT_Relative, info.GetAddFireErd(aFireERD, obj.GetLevel()));
                    obj.GetActualProperty().SetIceDamage(Operate_Type.OT_Relative, info.GetAddIceDam(aIceDamage, obj.GetLevel()));
                    obj.GetActualProperty().SetIceERD(Operate_Type.OT_Relative, info.GetAddIceErd(aIceERD, obj.GetLevel()));
                    obj.GetActualProperty().SetPoisonDamage(Operate_Type.OT_Relative, info.GetAddPoisonDam(aPoisonDamage, obj.GetLevel()));
                    obj.GetActualProperty().SetPoisonERD(Operate_Type.OT_Relative, info.GetAddPoisonErd(aPoisonERD, obj.GetLevel()));
                    obj.GetActualProperty().SetWeight(Operate_Type.OT_Relative, info.GetAddWeight(aWeight, obj.GetLevel()));
                    obj.GetActualProperty().SetRps(Operate_Type.OT_Relative, info.GetAddRps(aRps, obj.GetLevel()));
                    obj.GetActualProperty().SetAttackRange(Operate_Type.OT_Relative, info.GetAddAttackRange(aAttackRange, obj.GetLevel()));
                }
            }
        }