Пример #1
0
        public virtual void TakeDamage(IActor attacker, int damage, bool strike = false)
        {
            AttackResultType result = AttributeTools.CalcAttackResult(attacker.Attrbute, this.Attrbute);

            if (result == AttackResultType.Parry)
            {
                ShowFlyword(FlyWordType.Parry, 0);
                return;
            }
            else if (result == AttackResultType.Miss)
            {
                ShowFlyword(FlyWordType.Miss, 0);
                return;
            }

            ShowFlyword(strike ? FlyWordType.CritHurt : FlyWordType.NormalHurt, damage);

            int curHp = Attrbute.GetValue(AttributeType.Hp);

            if (curHp > damage)
            {
                Attrbute.UpdateValue(AttributeType.Hp, curHp - damage);
            }
            else
            {
                Attrbute.UpdateValue(AttributeType.Hp, 0);
            }
            UpdateHealth();
            if (curHp <= 0)
            {
                ExecuteCommand(new DeadCommand(ActorDeadType.Normal));
            }
        }
Пример #2
0
        protected override void InitAttribute(bool init = false)
        {
            m_BaseAttribute = new ActorAttribute();
            m_CurAttribute  = new ActorAttribute();
            Dictionary <PropertyType, int> propertys = AttributeTools.GetPlayerPropertys(m_PlayerData);

            m_BaseAttribute.CopyFrom(propertys);
            UpdateCurAttribute(init);

            ActorCard.SetName(m_PlayerData.Name);
            ActorCard.SetLevel(m_PlayerData.Level);
            ActorCard.SetMount(m_PlayerData.MountId);
            ActorCard.SetPartnerByPos(2, m_PlayerData.Partner1Id);
            ActorCard.SetPartnerByPos(3, m_PlayerData.Partner2Id);
        }