public override AtkResist GetResistBP(AtkResist origin, BehaviourDetail detail)
 {
     if (detail == BehaviourDetail.Penetrate)
     {
         return(AtkResist.Endure);
     }
     return(base.GetResistHP(origin, detail));
 }
 public override AtkResist GetResistBP(AtkResist origin, BehaviourDetail detail)
 {
     if (detail == BehaviourDetail.Slash)
     {
         return(AtkResist.Normal);
     }
     return(base.GetResistHP(origin, detail));
 }
示例#3
0
 public override AtkResist GetResistHP(AtkResist origin, BehaviourDetail detail)
 {
     if (detail == immuneDetail)
     {
         return(AtkResist.Immune);
     }
     return(base.GetResistHP(origin, detail));
 }
 public override AtkResist GetResistBP(AtkResist origin, BehaviourDetail detail)
 {
     if (this._owner.faction == Faction.Player && this.count < 3)
     {
         return(AtkResist.Immune);
     }
     return(base.GetResistBP(origin, detail));
 }
 public override AtkResist GetResistHP(AtkResist origin, BehaviourDetail detail)
 {
     if (base.GetResistHP(origin, detail) == AtkResist.Endure)
     {
         return(AtkResist.Vulnerable);
     }
     return(base.GetResistHP(origin, detail) == AtkResist.Resist ? AtkResist.Weak : base.GetResistHP(origin, detail));
 }
            public override AtkResist GetResistBP(AtkResist origin, BehaviourDetail detail)
            {
                switch (level)
                {
                case 1:
                    return(AtkResist.Vulnerable);

                case 2:
                    return(AtkResist.Normal);

                case 3:
                    return(AtkResist.Endure);
                }
                return(AtkResist.Weak);
            }
        public void GiveDamage(BattleUnitModel target)
        {
            if (target == null)
            {
                return;
            }
            this.abilityList.ForEach((Action <DiceCardAbilityBase>)(x => x.BeforeGiveDamage()));
            this.abilityList.ForEach((Action <DiceCardAbilityBase>)(x => x.BeforeGiveDamage(target)));
            this.owner.BeforeGiveDamage(OriginalDice);
            if (OriginalDice.IsBlocked)
            {
                this.RefreshStatBonus();
                this.owner.battleCardResultLog.SetIsBlocked(true);
                return;
            }
            double num1 = ((double)(_diceFinalResultValue - this._damageReductionByGuard + this._statBonus.dmg + this.owner.UnitData.unitData.giftInventory.GetStatBonus_Dmg(this.behaviourInCard.Detail)) - (double)target.GetDamageReduction(OriginalDice)) * (double)Mathf.Max((1.0f + (float)(this._statBonus.dmgRate + target.GetDamageIncreaseRate()) / 100.0f), 0.0f) * (double)target.GetDamageRate();
            double num2 = ((double)(_diceFinalResultValue - this._damageReductionByGuard + this._statBonus.breakDmg) - (double)target.GetBreakDamageReduction(OriginalDice)) * (double)Mathf.Max((1.0f + (float)(this._statBonus.breakRate + target.GetBreakDamageIncreaseRate()) / 100.0f), 0f) * (double)target.GetBreakDamageRate();

            if (target.emotionDetail.IsTakeDamageDouble())
            {
                num1 *= 2.0;
            }
            if (this.owner.emotionDetail.IsGiveDamageDouble())
            {
                num1 *= 2.0;
            }
            AtkResist resistHp = target.GetResistHP(this.behaviourInCard.Detail);
            AtkResist resistBp = target.GetResistBP(this.behaviourInCard.Detail);
            bool      flag     = false;

            foreach (DiceCardAbilityBase ability in this.abilityList)
            {
                if (ability.IsPercentDmg)
                {
                    flag = true;
                    break;
                }
            }
            double dmg;
            double breakdmg;

            if (flag)
            {
                int num3 = int.MaxValue;
                foreach (DiceCardAbilityBase ability in this.abilityList)
                {
                    int maximumPercentDmg = ability.GetMaximumPercentDmg();
                    if (maximumPercentDmg < num3)
                    {
                        num3 = maximumPercentDmg;
                    }
                }
                dmg = (int)((double)target.MaxHp * (num1 / 100.0));
                if (dmg >= target.MaxHp)
                {
                    dmg = target.MaxHp;
                }
                dmg = dmg * 2;
                if (dmg > num3)
                {
                    dmg = num3;
                }
            }
            else
            {
                dmg = (int)(num1 * (double)BookModel.GetResistRate(resistHp));
            }
            breakdmg = (int)(num2 * (double)BookModel.GetResistRate(resistBp));
            dmg      = (int)target.ChangeDamage(this.owner, (double)dmg);
            if (this.card != null && this.card.cardAbility != null && this.card.cardAbility.IsTrueDamage())
            {
                dmg      = _diceFinalResultValue;
                breakdmg = _diceFinalResultValue;
            }
            if (dmg < 1)
            {
                dmg = 0;
            }
            if (breakdmg < 1)
            {
                breakdmg = 0;
            }
            if (this.card.card.GetSpec().Ranged == CardRange.Far && target.passiveDetail.IsImmuneByFarAtk())
            {
                dmg      = 0;
                breakdmg = 0;
            }
            if (this.abilityList.Exists((Predicate <DiceCardAbilityBase>)(x => x.Invalidity)))
            {
                dmg      = 0;
                breakdmg = 0;
            }
            if (target.passiveDetail.IsInvincible())
            {
                dmg      = 0;
                breakdmg = 0;
            }
            int damage = target.TakeDamage((int)dmg, attacker: this.owner);

            this.owner.emotionDetail.CheckDmg(damage, target);
            this.owner.passiveDetail.AfterGiveDamage(damage);
            target.TakeBreakDamage((int)breakdmg, attacker: this.owner, atkResist: resistBp);
            this.owner.battleCardResultLog.SetDamageGiven(damage);
            this.owner.battleCardResultLog.SetBreakDmgGiven((int)breakdmg);
            target.battleCardResultLog.SetDeathState(target.IsDead());
            this.owner.history.damageAtOneRoundByDice += damage;
            if (target.faction == Faction.Player)
            {
                if (this.owner.UnitData.unitData.EnemyUnitId == 20003 || this.owner.UnitData.unitData.EnemyUnitId == 20002)
                {
                    ++target.UnitData.historyInStage.damagedByIsadoraJulia;
                }
                if (target.Book.GetBookClassInfoId() == 200004)
                {
                    ++target.UnitData.unitData.history.damagedFinnBook;
                }
            }
            this.RefreshStatBonus();
        }