public Battlefield(RendezvousFighting plugin) { Plugin = plugin; WindowController = new WindowController(); Fighters = new List <Fighter>(); Stage = PickStage(); InGrabRange = false; DisplayGrabbed = true; IsActive = false; }
public void InitialSetup(Fighter firstFighter, Fighter secondFighter) { Fighters.Clear(); Fighters.Add(firstFighter); Fighters.Add(secondFighter); PickInitialActor(); WindowController.Hit.Add("Game started!"); WindowController.Hit.Add("FIGHTING STAGE: " + Stage + " - " + GetActor().Name + " goes first!"); OutputFighterStatus(); // Creates the fighter status blocks (HP/Mana/Stamina) OutputFighterStats(); // Creates the fighter stat blocks (STR/DEX/END/INT/WIL) WindowController.Info.Add("[url=http://www.f-list.net/c/rendezvous%20fight/]Visit this page for game information[/url]"); IsActive = true; WindowController.UpdateOutput(this); }
public void TakeAction(string actionMade) { var action = actionMade; var actor = GetActor(); var roll = Utils.RollDice(20); while (actor.LastRolls.IndexOf(roll) != -1) { roll = Utils.RollDice(20); } actor.LastRolls.Add(roll); if (actor.LastRolls.Count > 5) { actor.LastRolls.RemoveAt(0); } Console.WriteLine(actor.LastRolls); var luck = 0; //Actor's average roll of the fight. WindowController.Action.Add(action); // Update tracked sum of all rolls and number of rolls the actor has made. Then calculate average value of actor's rolls in this fight. actor.RollTotal += roll; actor.RollsMade += 1; if (actor.RollsMade > 0) { luck = (int)Math.Round((double)actor.RollTotal / actor.RollsMade); } Type fighterType = actor.GetType(); MethodInfo theMethod = fighterType.GetMethod("Action" + action); theMethod.Invoke(actor, new object[] { roll }); WindowController.Info.Add("Raw Dice Roll: " + roll); WindowController.Info.Add(actor.Name + "'s Average Dice Roll: " + luck); if (roll == 20) { WindowController.Info.Add("\n" + "[eicon]d20crit[/eicon]" + "\n"); //Test to see if this works. Might add more graphics in the future. } TurnUpKeep(); //End of turn upkeep (Stamina regen, check for being stunned/knocked out, etc.) OutputFighterStatus(); // Creates the fighter status blocks (HP/Mana/Stamina) //Battlefield.outputFighterStats(); WindowController.UpdateOutput(this); //Tells the window controller to format and dump all the queued up messages to the results screen. }