public override void GainExperience(int xp) { XP += xp; CheckLevelUp(); NotifyListeners(String.Format("Gained {0} xp", xp)); CharacterSheets.ForEach((sheet) => sheet.NotifyXp(XP, NextXP)); }
public void DisembraceShield() { DisembraceCurrent(); embracedShield = null; CharacterSheets.ForEach((sheet) => sheet.NotifyShield(EmbracedShield)); CharacterSheets.ForEach((sheet) => sheet.NotifyDefences(CA, CASpecial)); }
public void HealDamage(Damage dmg) { var msg = new StringBuilder(); if (Hp == MaxHp) { msg.Append("Already at full Health"); } else { var totalDmg = dmg.TotalDamage; hp[(int)HpType.Current] = Math.Min(Hp + totalDmg, MaxHp); CharacterSheets.ForEach((sheet) => sheet.NotifyHp(Hp, MaxHp)); msg.AppendFormat("Heals {0} damage{1} ", totalDmg, totalDmg == 1 ? "" : "s"); var dmgString = dmg.ToHorString(); var show = dmgString.Length > 0; msg.AppendFormat("{0}{1}{2}", show ? "(" : "", dmgString, show ? ")" : ""); } NotifyListeners(msg.ToString()); }
private void AddCharacter(object sender, RoutedEventArgs e) { string name = CharacterToAddNameTextBox.Text; CharacterSheet character = new CharacterSheet(name); character.RefreshStats(); CharacterSheets.Add(character); }
private void RunSim(object sender, RoutedEventArgs e) { if (CharacterSheets.Count() == 0) { TextBoxOutputWindow.Text += "Please Create a Character to run simulation."; } else if (CharacterSheets.Count() < 2 && SimSettings.SimulationType > 0) { TextBoxOutputWindow.Text += "Please Create 2 Characters to run simulation."; } Sim.DiceRoller diceRoller = new Sim.DiceRoller(CharacterSheets, SimSettings, textBoxOutputWindow: ref TextBoxOutputWindow); diceRoller.RunSimulation(); }
public MainPage() { this.InitializeComponent(); this.SimSettings = new SimSettings(); this.SelectedCharacter = new SelectedCharacter(); this.CharacterSheets = new ObservableCollection <CharacterSheet>(); this.SkillList = new Skills.SkillList(); this.SkilledStats = new ActionStatsSelectedSkill(); CharacterSheets.Add(new CharacterSheet("Fulkan")); CharacterSheets[0].NameOfCurrentSkill = "Un-skilled"; CharactersListView.SelectedIndex = 0; SkillSelect_ListBox.SelectedIndex = 0; }
public void HandleWeapon(Item weapon) { var canHandle = weapon.GetType().IsSubclassOf(typeof(Weapon)); if (canHandle) { UnhandleCurrent(); handledWeapon = (Weapon)this.Backpack.Remove(weapon); NotifyListeners(String.Format("Handles {0}", HandledWepon.Name)); CharacterSheets.ForEach((sheet) => sheet.NotifyWeapon(HandledWepon)); } else { NotifyListeners(String.Format("Can't handle {0}", weapon.Name)); } }
public void WearArmor(Item armor) { var canWear = armor.GetType().IsSubclassOf(typeof(Armor)); if (canWear) { RemoveCurrent(); NotifyListeners(String.Format("Put on {0}", armor.Name)); wornArmor = (Armor)this.Backpack.Remove(armor); CharacterSheets.ForEach((sheet) => sheet.NotifyArmor(WornArmor)); } else { NotifyListeners(String.Format("Can't put on {0}", armor.Name)); } }
public JsonResult GetCharacters() { List <string> chars = CharacterSheets.GetCharacters(); List <Character> characters = new List <Character>(); foreach (string characterFile in chars) { characters.Add(CharacterSheets.LoadCharacter(characterFile)); } return(new JsonResult() { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = characters }); }
public void EmbraceShield(Item shield) { var canEmbrace = shield.GetType().IsSubclassOf(typeof(Shield)); if (canEmbrace) { DisembraceCurrent(); embracedShield = (Shield)this.Backpack.Remove(shield); NotifyListeners(String.Format("Embrace {0}", shield.Name)); CharacterSheets.ForEach((sheet) => sheet.NotifyShield(EmbracedShield)); CharacterSheets.ForEach((sheet) => sheet.NotifyDefences(CA, CASpecial)); } else { NotifyListeners(String.Format("Can't embrace {0}", shield.Name)); } }
public void PostDeathOperation() { var path = Path.Combine(Game.NeededFolders[Game.Folder.Saves], String.Format("{0}.story", Name)); using (var w = new StreamWriter(path)) { var sheet = CharacterSheets.FirstOrDefault(); if (sheet == null) { throw new Exception("Unexpected missing Sheet"); } w.Write(this.ToString()); Game.Current.SaveLog(w); } }
protected virtual void NotifyAll() { CharacterSheets.ForEach((sheet) => sheet.NotifyName(this.Name)); CharacterSheets.ForEach((sheet) => sheet.NotifyGold(this.MyGold)); CharacterSheets.ForEach((sheet) => sheet.NotifyHp(this.Hp, this.MaxHp)); CharacterSheets.ForEach((sheet) => sheet.NotifyHunger(this.Hunger)); CharacterSheets.ForEach((sheet) => sheet.NotifyDefences(this.CA, this.CASpecial)); CharacterSheets.ForEach((sheet) => sheet.NotifyArmor(this.WornArmor)); CharacterSheets.ForEach((sheet) => sheet.NotifyShield(this.EmbracedShield)); CharacterSheets.ForEach((sheet) => sheet.NotifyWeapon(this.HandledWepon)); CharacterSheets.ForEach((sheet) => { foreach (var stat in Stats.AllStats) { sheet.NotifyStat(stat, this.Stats[stat]); } }); }
private void Remove_Character_Button_Click(object sender, RoutedEventArgs e) { if (CharacterSheets.Count == 1 || CharactersListView.SelectedIndex <= 0) { CharacterSheets.RemoveAt(CharactersListView.SelectedIndex); SelectedCharacter.CurentCharacter = null; PlayerStatsPannelContentControl.IsEnabled = false; } else if (CharacterSheets.Count > 1 && CharactersListView.SelectedIndex <= 0) { CharacterSheets.RemoveAt(CharactersListView.SelectedIndex); SelectedCharacter.CurentCharacter = CharacterSheets[0]; PlayerStatsPannelContentControl.IsEnabled = true; } else { SelectedCharacter.CurentCharacter = null; PlayerStatsPannelContentControl.IsEnabled = false; } }
public void SufferDamage(Damage dmg) { var msg = new StringBuilder(); var effectiveDmg = dmg - WornArmor.DamageReduction; var totalDmg = effectiveDmg.TotalDamage; hp[(int)HpType.Current] -= totalDmg; CharacterSheets.ForEach((sheet) => sheet.NotifyHp(Hp, MaxHp)); msg.AppendFormat("Takes {0} damage{1} ", totalDmg, totalDmg == 1 ? "" : "s"); var dmgString = effectiveDmg.ToHorString(); var show = dmgString.Length > 0; msg.AppendFormat("{0}{1}{2}", show ? "(" : "", dmgString, show ? ")" : ""); NotifyListeners(msg.ToString()); }
public void ActivateSpecialAttack() { if (HandledWepon.HasSpecialAttack) { if (HandledWepon.SpecialAttackActivated) { HandledWepon.DectivateSpecialAttack(); NotifyListeners(String.Format("Dectivated {0}'s special power", HandledWepon.Name)); } else { HandledWepon.ActivateSpecialAttack(); NotifyListeners(String.Format("Activated {0}'s special power", HandledWepon.Name)); } CharacterSheets.ForEach((sheet) => sheet.NotifyWeapon(HandledWepon)); } else { NotifyListeners(String.Format("{0} has no special attacks", HandledWepon.Name)); } }
public void UnhandleWeapon() { UnhandleCurrent(); handledWeapon = null; CharacterSheets.ForEach((sheet) => sheet.NotifyWeapon(HandledWepon)); }
protected override void NotifyAll() { base.NotifyAll(); CharacterSheets.ForEach((sheet) => sheet.NotifyLevel(this.currentLevel, this.God)); CharacterSheets.ForEach((sheet) => sheet.NotifyXp(this.XP, this.NextXP)); }
public override void EffectOfTurn() { base.EffectOfTurn(); // Hunger, etc CharacterSheets.ForEach((sheet) => sheet.NotifyHunger(Hunger)); }
private void LevelUp() { currentLevel = currentLevel.Next(); CharacterSheets.ForEach((sheet) => sheet.NotifyLevel(currentLevel, God)); NextXP = Pg.XpForLevel(currentLevel.Next()); }
public void IncreaseMaxHp(int deltaHp) { hp[(int)HpType.Max] += deltaHp; CharacterSheets.ForEach((sheet) => sheet.NotifyHp(Hp, MaxHp)); }
public void IncreaseStat(StatsType stat, int delta) { this.stats.IncreaseStat(stat, delta); CharacterSheets.ForEach((sheet) => sheet.NotifyStat(stat, stats[stat])); }
public void RemoveArmor() { RemoveCurrent(); wornArmor = null; CharacterSheets.ForEach((sheet) => sheet.NotifyArmor(WornArmor)); }
public virtual void RegisterView(ISheetViewer sheet) { CharacterSheets.AddOnce(sheet); }