Exemple #1
0
    //受到伤害(以后名字要改下)
    virtual public void Damage(int dDamage, Character source)
    {
        //反甲Buff_reflectdmg判定
        if (hasBuff <Buff_reflectdmg>())
        {
            if (!source.hasBuff <Buff_reflectdmg>())
            {
                source.Damage(dDamage, this);
                //break;
            }
        }

        //触发被打断效果
        if (isBreakable)
        {
            Broken();
        }


        //getHit = true;
        if (Hp >= dDamage)
        {
            Hp -= dDamage;
            Bubble.AddBubble(BubbleSprType.hp, "-" + dDamage.ToString(), this);
        }
        else
        {
            if (Hp > 0)
            {
                Bubble.AddBubble(BubbleSprType.hp, "-" + Hp.ToString(), this);
            }

            int lifeDamage = dDamage - Hp;
            if (lifeDamage > 0)
            {
                Bubble.AddBubble(BubbleSprType.life, "-" + lifeDamage.ToString(), this);
            }

            Hp = 0;

            life -= lifeDamage;
            if (life <= 0)
            {
                life = 0;
            }
            // Die();
        }

        List <Buff> tempbuffs = new List <Buff>();

        tempbuffs.AddRange(buffs);
        foreach (Buff b in tempbuffs)
        {
            b.AfterAttacked(this);
        }
    }
Exemple #2
0
 virtual public void HealLife(int dHeal)
 {
     life = life + dHeal;
     if (life > maxLife)
     {
         life = maxLife;
     }
     if (dHeal > 0)
     {
         Bubble.AddBubble(BubbleSprType.life, "+" + dHeal.ToString(), this, true);
     }
 }
Exemple #3
0
 virtual public void Heal(int dHeal)
 {
     Hp = Hp + dHeal;
     if (Hp > maxHp)
     {
         Hp = maxHp;
     }
     if (dHeal > 0)
     {
         Bubble.AddBubble(BubbleSprType.hp, "+" + dHeal.ToString(), this, true);
     }
 }
Exemple #4
0
 public void AddMoney(int dM)
 {
     money += dM;
     Bubble.AddBubble(BubbleSprType.money, "+" + dM.ToString(), this, true);
 }