public void DisembraceShield() { DisembraceCurrent(); embracedShield = null; CharacterSheets.ForEach((sheet) => sheet.NotifyShield(EmbracedShield)); CharacterSheets.ForEach((sheet) => sheet.NotifyDefences(CA, CASpecial)); }
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 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()); }
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)); } }
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]); } }); }
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 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)); } }
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 UnhandleWeapon() { UnhandleCurrent(); handledWeapon = null; CharacterSheets.ForEach((sheet) => sheet.NotifyWeapon(HandledWepon)); }
public void RemoveArmor() { RemoveCurrent(); wornArmor = null; CharacterSheets.ForEach((sheet) => sheet.NotifyArmor(WornArmor)); }
public void IncreaseStat(StatsType stat, int delta) { this.stats.IncreaseStat(stat, delta); CharacterSheets.ForEach((sheet) => sheet.NotifyStat(stat, stats[stat])); }
public void IncreaseMaxHp(int deltaHp) { hp[(int)HpType.Max] += deltaHp; CharacterSheets.ForEach((sheet) => sheet.NotifyHp(Hp, MaxHp)); }