virtual public float dealDamage(IFightableObject target, float multiplicator = 1)
        {
            float effectiveDamage = Math.Max(0, multiplicator * (minDamage + maxDamage) / 2);

            Console.WriteLine($"{name} attacks opponent for {effectiveDamage} potential damage.");
            float damageDealt = target.receiveDamage(effectiveDamage);

            return(damageDealt);
        }
Beispiel #2
0
        virtual public float receiveDamage(float baseDamage)
        {
            EffectDecorator godMode = getRole(this, "godmode");

            if (godMode != null && godMode is InvulnerabilityDecorator)
            {
                ((InvulnerabilityDecorator)godMode).nullifyHit(baseDamage);
                Console.WriteLine("Target receives 0 damage");
                return(0);
            }
            return(fighter.receiveDamage(baseDamage));
        }