public void SaveLuke(JediKnight jediKnight)
 {
     jediKnight.CurrentDamageLevel = JediKnight.DamageLevel.Healthy;
     jediKnight.FightLog.FightEvents.Add(Name + " has blessed " + jediKnight.Name + ". " + Encouragement);
 }
Esempio n. 2
0
 public void SecondWind(JediKnight jediKnight)
 {
     jediKnight.CurrentDamageLevel = JediKnight.DamageLevel.Healthy;
     jediKnight.FightLog.FightEvents.Add(Name + " has blessed " + jediKnight.Name + " with a second wind. " + "GOGO DARKBOY");
 }
        // attack another jedi knight with the help of magic random numbers
        public void AttackEnemy(JediKnight jediKnight, JediKnight opponent)
        {
            try
            {
                // set up an attack using a standard lightsaber action, registering opponent's resulting damage level, and slandering him
                if (opponent.CurrentDamageLevel == DamageLevel.Wasted)
                {
                    // He's already finito.. see if we can make him join the game again!
                    jediKnight.FightLog.FightEvents.Add(jediKnight.Name + " takes a poke trying to off " + opponent.Name + " who is already at the Rigor Mortis stage. Tsk, tsk.. a bit necro-phixated, are we?");
                    // Rescusiate..
                    jediKnight.FightLog.FightEvents.Add(jediKnight.Name + " gets all squishy-feely at seeing " + opponent.Name + " so horribly pale, and takes him - ok, drags him.. along to the Jawa sandcrawler for recycling.");
                    opponent.CurrentDamageLevel = DamageLevel.Critical;
                    opponent.Deceased           = false;
                    jediKnight.FightLog.FightEvents.Add(opponent.Name + " didn't bring in much of a recycle fee for " + jediKnight.Name + " - but the Jawas were real nice. Our hero was kicked out in the desert again alive, minus only a few insignificant internal body parts and sporting a damage level of: "
                                                        + opponent.CurrentDamageLevel);
                }
                else
                {
                    int randomInt = RandomGenerator.Rand.Next(11);
                    // record which lightsaber maneouver was randomly chosen
                    CurrentLightSaberAction = (LightSaberAction)randomInt;
                    jediKnight.FightLog.FightEvents.Add(jediKnight.Name + " attacks " + opponent.Name
                                                        + " by deftly applying the Light Saber Academy approved maneouver "
                                                        + CurrentLightSaberAction);

                    // Make a stab using the current DamageLevel cast to an int. Record which new damage level resulted from the attack.
                    randomInt = RandomGenerator.Rand.Next((int)(opponent.CurrentDamageLevel));
                    // Series of if statements, to determine which damage level is closest to the generated number
                    if (randomInt >= 50)
                    {
                        opponent.CurrentDamageLevel = DamageLevel.Healthy;
                    }
                    else if (randomInt < 50 && randomInt > 25)
                    {
                        opponent.CurrentDamageLevel = DamageLevel.Challenged;
                    }
                    else if (randomInt <= 25 && randomInt > 10)
                    {
                        opponent.CurrentDamageLevel = DamageLevel.Critical;
                    }
                    else // less than or equal to 10, we's long gone dude
                    {
                        opponent.CurrentDamageLevel = DamageLevel.Wasted;
                        opponent.Deceased           = true;
                    }

                    jediKnight.FightLog.FightEvents.Add(opponent.Name + " now has a damage level of: " + opponent.CurrentDamageLevel + " based on a randomInt of " + randomInt);

                    // Pick a random slander expression for posterity, except if he is dead as a result of that last attack of yours.
                    if (opponent.CurrentDamageLevel > DamageLevel.Wasted)
                    {
                        randomInt = RandomGenerator.Rand.Next(0, enemySlanders.Length);
                        string slander = enemySlanders[randomInt];
                        jediKnight.FightLog.FightEvents.Add(jediKnight.Name + " says: " + slander);
                    }
                    else if (opponent.CurrentDamageLevel == DamageLevel.Wasted)
                    {
                        jediKnight.FightLog.FightEvents.Add(opponent.Name + " hoarsely whispers: " + opponent.LastWords);
                        jediKnight.FightLog.FightEvents.Add(jediKnight.Name + " says: Rest in pieces, " + opponent.Name + ".");
                        jediKnight.FightLog.FightEvents.Add(opponent.Name + " has bought the big farm in the sky.");
                    }
                }
            }
            catch (Exception e)
            {
                // TODO: log the exception
                string msg = e.Message;
                ErrorLogger.SaveMsg(msg);
            }
        }