예제 #1
0
 /// <summary>
 /// Use the Ability
 /// </summary>
 /// <param name="Attacker"></param>
 /// <returns></returns>
 public bool UseAbility(EntityInfoModel Attacker)
 {
     BattleMessageModel.ClearMessages();
     BattleMessageModel.TurnMessageSpecial = " Used Ability";
     BattleMessageModel.TurnMessage        = Attacker.Name + BattleMessageModel.TurnMessageSpecial;
     Debug.WriteLine(BattleMessageModel.TurnMessage);
     return(true);
 }
예제 #2
0
        //Sleeping Turn for Hackthon Scenario 7
        public bool FallAsleep(EntityInfoModel Attacker)
        {
            Debug.WriteLine(string.Format(Attacker.Name, " is sleeping"));
            BattleMessageModel.ClearMessages();
            BattleMessageModel.TurnMessage = Attacker.Name + " is sleeping";

            return(true);
        }
예제 #3
0
        /// <summary>
        /// Attack Action Deatil
        /// </summary>
        /// <param name="Attacker"></param>
        /// <param name="Target"></param>
        /// <returns></returns>
        public bool TurnAsAttack(EntityInfoModel Attacker, EntityInfoModel Target)
        {
            if (Attacker == null)
            {
                return(false);
            }

            if (Target == null)
            {
                return(false);
            }

            BattleMessageModel.ClearMessages();

            CalculateAttackStatus(Attacker, Target);

            // Hackathon
            // Hackathon Scenario 2, Bob alwasys misses
            if (Attacker.Name.Equals("Bob"))
            {
                BattleMessageModel.HitStatus   = HitStatusEnum.Miss;
                BattleMessageModel.TurnMessage = "Bob always Misses";
                Debug.WriteLine(BattleMessageModel.TurnMessage);
                return(true);
            }

            if (PrimeNumber)
            {
                if (Attacker.PlayerType == PlayerTypeEnum.Character && IsPrime(Attacker))
                {
                    BattleMessageModel.HitStatus   = HitStatusEnum.Hit;
                    BattleMessageModel.TurnMessage = "Prime always Hit";
                    //Debug.WriteLine(Attacker.TestDamage);
                    BattleMessageModel.DamageAmount = Attacker.GetDamageTotal;
                    Debug.WriteLine(BattleMessageModel.TurnMessage);
                    return(true);
                }
            }


            switch (BattleMessageModel.HitStatus)
            {
            case HitStatusEnum.Miss:
                // It's a Miss

                break;

            case HitStatusEnum.Hit:
                // It's a Hit

                BattleMessageModel.DamageAmount = Attacker.GetDamageRollValue();

                ApplyDamage(Target);

                BattleMessageModel.TurnMessageSpecial = BattleMessageModel.GetCurrentHealthMessage();

                // Check if the target dead. If dead, remove it

                RemoveIfDead(Target);

                // If Attacker is a Character, it should gain experience from Monster

                CalculateExperience(Attacker, Target);

                break;
            }
            BattleMessageModel.TurnMessage = Attacker.Name + BattleMessageModel.AttackStatus + Target.Name + BattleMessageModel.TurnMessageSpecial + BattleMessageModel.ExperienceEarned;
            Debug.WriteLine(BattleMessageModel.TurnMessage);
            if (Target.PlayerType == PlayerTypeEnum.Character)
            {
                UpdatePlayerList(Target);
            }
            return(true);
        }