Ejemplo n.º 1
0
 public override void GainExperience(int xp)
 {
     XP += xp;
     CheckLevelUp();
     NotifyListeners(String.Format("Gained {0} xp", xp));
     CharacterSheets.ForEach((sheet) => sheet.NotifyXp(XP, NextXP));
 }
Ejemplo n.º 2
0
 public void DisembraceShield()
 {
     DisembraceCurrent();
     embracedShield = null;
     CharacterSheets.ForEach((sheet) => sheet.NotifyShield(EmbracedShield));
     CharacterSheets.ForEach((sheet) => sheet.NotifyDefences(CA, CASpecial));
 }
Ejemplo n.º 3
0
        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());
        }
Ejemplo n.º 4
0
        private void AddCharacter(object sender, RoutedEventArgs e)
        {
            string         name      = CharacterToAddNameTextBox.Text;
            CharacterSheet character = new CharacterSheet(name);

            character.RefreshStats();
            CharacterSheets.Add(character);
        }
Ejemplo n.º 5
0
 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();
 }
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 7
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));
            }
        }
Ejemplo n.º 8
0
        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));
            }
        }
Ejemplo n.º 9
0
        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
            });
        }
Ejemplo n.º 10
0
        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));
            }
        }
Ejemplo n.º 11
0
        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);
            }
        }
Ejemplo n.º 12
0
 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]);
         }
     });
 }
Ejemplo n.º 13
0
 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;
     }
 }
Ejemplo n.º 14
0
        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());
        }
Ejemplo n.º 15
0
 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));
     }
 }
Ejemplo n.º 16
0
 public void UnhandleWeapon()
 {
     UnhandleCurrent();
     handledWeapon = null;
     CharacterSheets.ForEach((sheet) => sheet.NotifyWeapon(HandledWepon));
 }
Ejemplo n.º 17
0
 protected override void NotifyAll()
 {
     base.NotifyAll();
     CharacterSheets.ForEach((sheet) => sheet.NotifyLevel(this.currentLevel, this.God));
     CharacterSheets.ForEach((sheet) => sheet.NotifyXp(this.XP, this.NextXP));
 }
Ejemplo n.º 18
0
 public override void EffectOfTurn()
 {
     base.EffectOfTurn();
     // Hunger, etc
     CharacterSheets.ForEach((sheet) => sheet.NotifyHunger(Hunger));
 }
Ejemplo n.º 19
0
 private void LevelUp()
 {
     currentLevel = currentLevel.Next();
     CharacterSheets.ForEach((sheet) => sheet.NotifyLevel(currentLevel, God));
     NextXP = Pg.XpForLevel(currentLevel.Next());
 }
Ejemplo n.º 20
0
 public void IncreaseMaxHp(int deltaHp)
 {
     hp[(int)HpType.Max] += deltaHp;
     CharacterSheets.ForEach((sheet) => sheet.NotifyHp(Hp, MaxHp));
 }
Ejemplo n.º 21
0
 public void IncreaseStat(StatsType stat, int delta)
 {
     this.stats.IncreaseStat(stat, delta);
     CharacterSheets.ForEach((sheet) => sheet.NotifyStat(stat, stats[stat]));
 }
Ejemplo n.º 22
0
 public void RemoveArmor()
 {
     RemoveCurrent();
     wornArmor = null;
     CharacterSheets.ForEach((sheet) => sheet.NotifyArmor(WornArmor));
 }
Ejemplo n.º 23
0
 public virtual void RegisterView(ISheetViewer sheet)
 {
     CharacterSheets.AddOnce(sheet);
 }