public void getDamageOrHeal(int dmg, Playfield p, bool isMinionAttack, bool dontCalcLostDmg) { if (this.Hp <= 0) return; if (this.immune && dmg > 0) return; if (this.isHero) { int copy = this.Hp; if (dmg < 0 || this.armor <= 0) { //if (dmg < 0) return; //heal this.Hp = Math.Min(30, this.Hp - dmg); if (copy < this.Hp) { p.tempTrigger.charsGotHealed++; } if (copy - this.Hp >= 1) { p.secretTrigger_HeroGotDmg(this.own, copy - this.Hp); } } else { if (this.armor > 0 && dmg > 0) { int rest = this.armor - dmg; if (rest < 0) { this.Hp += rest; p.secretTrigger_HeroGotDmg(this.own, rest); } this.armor = Math.Max(0, this.armor - dmg); } } if (this.cantLowerHPbelowONE && this.Hp <= 0) this.Hp = 1; if (this.Hp < copy) { this.anzGotDmg++; } return; } //its a Minion-------------------------------------------------------------- int damage = dmg; int heal = 0; if (dmg < 0) heal = -dmg; bool woundedbefore = this.wounded; if (heal < 0) // heal was shifted in damage { damage = -1 * heal; heal = 0; } if (damage >= 1) this.allreadyAttacked = true; if (damage >= 1 && this.divineshild) { this.divineshild = false; if (!own && !dontCalcLostDmg && p.turnCounter == 0) { if (isMinionAttack) { p.playerFirst.lostDamage += damage - 1; } else { p.playerFirst.lostDamage += (damage - 1) * (damage - 1); } } return; } if (this.cantLowerHPbelowONE && damage >= 1 && damage >= this.Hp) damage = this.Hp - 1; if (!own && !dontCalcLostDmg && this.Hp < damage && p.turnCounter == 0) { if (isMinionAttack) { p.playerFirst.lostDamage += (damage - this.Hp); } else { p.playerFirst.lostDamage += (damage - this.Hp) * (damage - this.Hp); } } int hpcopy = this.Hp; if (damage >= 1) { this.Hp = this.Hp - damage; } if (heal >= 1) { if (own && !dontCalcLostDmg && heal <= 999 && this.Hp + heal > this.maxHp) p.playerFirst.lostHeal += this.Hp + heal - this.maxHp; this.Hp = this.Hp + Math.Min(heal, this.maxHp - this.Hp); } if (this.Hp > hpcopy) { //minionWasHealed p.tempTrigger.minionsGotHealed++; p.tempTrigger.charsGotHealed++; } if (this.Hp < hpcopy) { if (this.own) { p.tempTrigger.ownMinionsGotDmg++; } else { p.tempTrigger.enemyMinionsGotDmg++; } this.anzGotDmg++; } if (this.maxHp == this.Hp) { this.wounded = false; } else { this.wounded = true; } if (this.name == CardDB.cardName.lightspawn && !this.silenced) { this.Angr = this.Hp; } if (woundedbefore && !this.wounded) { this.handcard.card.sim_card.onEnrageStop(p, this); } if (!woundedbefore && this.wounded) { this.handcard.card.sim_card.onEnrageStart(p, this); } if (this.Hp <= 0) { this.minionDied(p); } }