/// <summary> /// Have the damage taken be reflected in the Character or Monster List /// </summary> /// <param name="Target"></param> /// <param name="damage"></param> /// <returns></returns> public bool TakeDamage(BattleEntityModel Target, int damage) { if (Target == null) { return(false); } Target.TakeDamage(damage); switch (Target.EntityType) { case (EntityTypeEnum.Character): var character = CharacterList.First(a => a.Id == Target.Id); character.TakeDamage(damage); // Hackathon scenario 9 - Miracle Max if (!character.Alive && character.MiracleMax) { EntityList.First(a => a.Id == Target.Id).CurrentHealth = character.MaxHealth; // it's a miracle! character.CurrentHealth = character.MaxHealth; character.MiracleMax = false; EntityList.First(a => a.Id == Target.Id).Alive = true; EntityList.First(a => a.Id == Target.Id).CurrentHealth = character.MaxHealth; character.Alive = true; BattleMessages.TurnMessageSpecial = character.Name + " has been miraculously revived by Miracle Max!\nSee Miracle Max for all of your miraculous needs~"; Debug.WriteLine(BattleMessages.TurnMessageSpecial); } return(true); case (EntityTypeEnum.Monster): default: MonsterList.First(a => a.Id == Target.Id).TakeDamage(damage); return(true); } }
/// <summary> /// Handle the Critical Miss event (if enabled) /// </summary> /// <param name="attacker"></param> /// <returns></returns> public bool CriticalMiss(BattleEntityModel attacker) { switch (attacker.EntityType) { case EntityTypeEnum.Monster: return(MonsterCriticalMiss(MonsterList.First(a => a.Id == attacker.Id))); case EntityTypeEnum.Character: return(CharacterCriticalMiss(CharacterList.First(a => a.Id == attacker.Id))); default: return(false); } }