Exemplo n.º 1
0
 public void DisembraceShield()
 {
     DisembraceCurrent();
     embracedShield = null;
     CharacterSheets.ForEach((sheet) => sheet.NotifyShield(EmbracedShield));
     CharacterSheets.ForEach((sheet) => sheet.NotifyDefences(CA, CASpecial));
 }
Exemplo n.º 2
0
 public override void GainExperience(int xp)
 {
     XP += xp;
     CheckLevelUp();
     NotifyListeners(String.Format("Gained {0} xp", xp));
     CharacterSheets.ForEach((sheet) => sheet.NotifyXp(XP, NextXP));
 }
Exemplo 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());
        }
Exemplo n.º 4
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));
            }
        }
Exemplo n.º 5
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));
            }
        }
Exemplo n.º 6
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]);
         }
     });
 }
Exemplo n.º 7
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));
            }
        }
Exemplo n.º 8
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());
        }
Exemplo n.º 9
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));
     }
 }
Exemplo n.º 10
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));
 }
Exemplo n.º 11
0
 public override void EffectOfTurn()
 {
     base.EffectOfTurn();
     // Hunger, etc
     CharacterSheets.ForEach((sheet) => sheet.NotifyHunger(Hunger));
 }
Exemplo n.º 12
0
 private void LevelUp()
 {
     currentLevel = currentLevel.Next();
     CharacterSheets.ForEach((sheet) => sheet.NotifyLevel(currentLevel, God));
     NextXP = Pg.XpForLevel(currentLevel.Next());
 }
Exemplo n.º 13
0
 public void UnhandleWeapon()
 {
     UnhandleCurrent();
     handledWeapon = null;
     CharacterSheets.ForEach((sheet) => sheet.NotifyWeapon(HandledWepon));
 }
Exemplo n.º 14
0
 public void RemoveArmor()
 {
     RemoveCurrent();
     wornArmor = null;
     CharacterSheets.ForEach((sheet) => sheet.NotifyArmor(WornArmor));
 }
Exemplo n.º 15
0
 public void IncreaseStat(StatsType stat, int delta)
 {
     this.stats.IncreaseStat(stat, delta);
     CharacterSheets.ForEach((sheet) => sheet.NotifyStat(stat, stats[stat]));
 }
Exemplo n.º 16
0
 public void IncreaseMaxHp(int deltaHp)
 {
     hp[(int)HpType.Max] += deltaHp;
     CharacterSheets.ForEach((sheet) => sheet.NotifyHp(Hp, MaxHp));
 }