Beispiel #1
0
        static void AttackRound(Character Attacker, Character Defender)
        {
            IDealsDamage Attack = Attacker.DefaultAttack;
            HitStruct    Hit    = new HitStruct();

            for (int i = 0; i < Attacker.Powers.Count; i++)
            {
                if (Attacker.Powers[i] is IDealsDamage && Attacker.Powers[i].CanUse())
                {
                    Attack = (IDealsDamage)Attacker.Powers[i];
                    break;
                }
            }
            if (Attack != null && (Attack as Power).CanUse())
            {
                Hit = Attack.GetDamage();
                if (Attacker.Attackroll(Defender))
                {
                    Hit = Defender.ApplyDefense(Hit);
                    Console.WriteLine(Attacker + " attacks " + Defender + " with " + Attack + " dealing " + Hit.HealthDamage + "(" + Hit.StunDamage + " Stun) damage!");
                    Defender.GetHit(Hit);
                }
                else
                {
                    Console.WriteLine(Attacker + " attacks " + Defender + " with " + Attack + ", but misses!");
                }
            }
            else
            {
                Console.WriteLine(Attacker + " was too tired to use any abilities this turn and used a recovery instead!");
                Attacker.TakeRecovery();
            }
        }
Beispiel #2
0
        static HitStruct PowerHit(IDealsDamage Power, IHealth Target)
        {
            HitStruct Hit = Power.GetDamage();

            Target.Health -= Hit.HealthDamage;
            IStun StunTarget = Target as IStun;

            if (StunTarget != null)
            {
                StunTarget.Stun -= Hit.StunDamage;
            }
            return(Hit);
        }
Beispiel #3
0
 static HitStruct PowerHit(IDealsDamage Power, IHealth Target)
 {
     HitStruct Hit = Power.GetDamage();
     Target.Health -= Hit.HealthDamage;
     IStun StunTarget = Target as IStun;
     if (StunTarget != null)
     {
         StunTarget.Stun -= Hit.StunDamage;
     }
     return Hit;
 }