Exemplo n.º 1
0
        public virtual void UpdateCurAttribute(bool init = false)
        {
            ActorAttribute      bfAttr = new ActorAttribute();
            ActorAttribute      bpAttr = new ActorAttribute();
            Map <int, BuffBase> buffs  = m_ActorBuff.GetAllBuff();

            for (buffs.Begin(); buffs.Next();)
            {
                for (int i = 0; i < buffs.Value.AttrList.Count; i++)
                {
                    BuffAttrData attrData = buffs.Value.AttrList[i];
                    switch (attrData.ValueType)
                    {
                    case DataValueType.Fix:
                        bfAttr.UpdateValue(attrData.AttrType, attrData.Value);
                        break;

                    case DataValueType.Per:
                        bpAttr.UpdateValue(attrData.AttrType, attrData.Value);
                        break;
                    }
                }
            }

            int maxHp = m_BaseAttribute.MaxHp;//(m_BaseAttribute.MaxHp + bfAttr.MaxHp) * (1 + bpAttr.MaxHp / Constant.Define.PerBase);

            m_CurAttribute.UpdateValue(AttributeType.MaxHp, maxHp);

            int maxMp = (m_BaseAttribute.MaxMp + bfAttr.MaxMp) * (1 + bpAttr.MaxMp / Constant.Define.PerBase);

            m_CurAttribute.UpdateValue(AttributeType.MaxMp, maxMp);

            int attack = (m_BaseAttribute.Attack + bfAttr.Attack) * (1 + bpAttr.Attack / Constant.Define.PerBase);

            m_CurAttribute.UpdateValue(AttributeType.Attack, attack);

            int defense = (m_BaseAttribute.Defense + bfAttr.Defense) * (1 + bpAttr.Defense / Constant.Define.PerBase);

            m_CurAttribute.UpdateValue(AttributeType.Defense, defense);

            int absorb = (m_BaseAttribute.Absorb + bfAttr.Absorb) * (1 + bpAttr.Absorb / Constant.Define.PerBase);

            m_CurAttribute.UpdateValue(AttributeType.Absorb, absorb);

            int speed = (m_BaseAttribute.Speed + bfAttr.Speed) * (1 + bpAttr.Speed / Constant.Define.PerBase);

            m_CurAttribute.UpdateValue(AttributeType.Speed, speed);

            int reflex = (m_BaseAttribute.Reflex + bfAttr.Reflex) * (1 + bpAttr.Reflex / Constant.Define.PerBase);

            m_CurAttribute.UpdateValue(AttributeType.Reflex, reflex);

            int suckBlood = (m_BaseAttribute.SuckBlood + bfAttr.SuckBlood) * (1 + bpAttr.SuckBlood / Constant.Define.PerBase);

            m_CurAttribute.UpdateValue(AttributeType.SuckBlood, suckBlood);

            int crit = (m_BaseAttribute.Crit + bfAttr.Crit) * (1 + bpAttr.Crit / Constant.Define.PerBase);

            m_CurAttribute.UpdateValue(AttributeType.Crit, crit);

            int critDamage = (int)((m_BaseAttribute.CritDamage + bfAttr.CritDamage) * (1 + bpAttr.CritDamage / Constant.Define.PerBase));

            m_CurAttribute.UpdateValue(AttributeType.CritDamage, critDamage);

            int dodge = (m_BaseAttribute.Dodge + bfAttr.Dodge) * (1 + bpAttr.Dodge / Constant.Define.PerBase);

            m_CurAttribute.UpdateValue(AttributeType.Dodge, dodge);

            int hit = (m_BaseAttribute.Hit + bfAttr.Hit) * (1 + bpAttr.Hit / Constant.Define.PerBase);

            m_CurAttribute.UpdateValue(AttributeType.Hit, hit);

            int mpRecover = (m_BaseAttribute.MpRecover + bfAttr.MpRecover) * (1 + bpAttr.MpRecover / Constant.Define.PerBase);

            m_CurAttribute.UpdateValue(AttributeType.MpRecover, mpRecover);

            int hpRecover = (m_BaseAttribute.HpRecover + bfAttr.HpRecover) * (1 + bpAttr.HpRecover / Constant.Define.PerBase);

            m_CurAttribute.UpdateValue(AttributeType.MpRecover, hpRecover);

            if (init)
            {
                m_CurAttribute.UpdateValue(AttributeType.Hp, m_BaseAttribute.Hp);
                m_CurAttribute.UpdateValue(AttributeType.Mp, m_BaseAttribute.Mp);
            }
            else
            {
                int hp = m_CurAttribute.Hp > m_BaseAttribute.MaxHp ? m_BaseAttribute.MaxHp : m_CurAttribute.Hp;
                int mp = m_CurAttribute.Mp > m_BaseAttribute.MaxMp ? m_BaseAttribute.MaxMp : m_CurAttribute.Mp;

                m_CurAttribute.UpdateValue(AttributeType.MaxHp, hp);
                m_CurAttribute.UpdateValue(AttributeType.MaxMp, mp);
            }
        }
Exemplo n.º 2
0
        protected virtual void InitAttribute(bool init = false)
        {
            m_BaseAttribute = new ActorAttribute();
            m_CurAttribute  = new ActorAttribute();

            m_BaseAttribute.UpdateValue(AttributeType.Hp, m_ActorData.LHP);
            m_BaseAttribute.UpdateValue(AttributeType.MaxHp, m_ActorData.LHP);
            m_BaseAttribute.UpdateValue(AttributeType.Attack, m_ActorData.ATK);
            m_BaseAttribute.UpdateValue(AttributeType.Defense, m_ActorData.DEF);
            m_BaseAttribute.UpdateValue(AttributeType.Crit, m_ActorData.CRI);
            m_BaseAttribute.UpdateValue(AttributeType.CritDamage, m_ActorData.BUR);
            m_BaseAttribute.UpdateValue(AttributeType.Mp, m_ActorData.LMP);
            m_BaseAttribute.UpdateValue(AttributeType.MaxMp, m_ActorData.LMP);
            m_BaseAttribute.UpdateValue(AttributeType.SuckBlood, m_ActorData.VAM);
            m_BaseAttribute.UpdateValue(AttributeType.Hit, m_ActorData.HIT);
            m_BaseAttribute.UpdateValue(AttributeType.Dodge, m_ActorData.DOG);
            m_BaseAttribute.UpdateValue(AttributeType.Absorb, m_ActorData.BAF);
            m_BaseAttribute.UpdateValue(AttributeType.Speed, (int)m_ActorData.Speed);

            UpdateCurAttribute(init);
        }
Exemplo n.º 3
0
 protected override void InitAttribute(bool init = false)
 {
     m_CurAttribute = new ActorAttribute();
     m_CurAttribute.UpdateValue(AttributeType.Speed, (int)m_ActorData.Speed);
 }