private static List<EffectivePoint> CalculateAndFilterTargetablePoints(Weapon weapon, Point wielderPosition, int wielderVision) { List<EffectivePoint> pointList = weapon.CalculateTargetablePoints(wielderPosition); CoreGameEngine.Instance.FilterNotTargetablePointsFromList(pointList, wielderPosition, wielderVision, true); CoreGameEngine.Instance.FilterNotVisibleBothWaysFromList(wielderPosition, pointList, Point.Invalid); return pointList; }
private static bool IsPositionInTargetablePoints(Weapon weapon, Point wielderPosition, int wielderVision, Point pointOfInterest) { foreach (EffectivePoint e in CalculateAndFilterTargetablePoints(weapon, wielderPosition, wielderVision)) { if (e.Position == pointOfInterest) return true; } return false; }
private static float EffectiveStrengthAtPoint(Weapon weapon, Point wielderPosition, int wielderVision, Point pointOfInterest) { foreach (EffectivePoint e in CalculateAndFilterTargetablePoints(weapon, wielderPosition, wielderVision)) { if (e.Position == pointOfInterest) return e.EffectiveStrength; } return 0; }
private void WriteWeaponToSave(XmlWriter writer, Weapon weapon) { Item.WriteXmlEntireNode(weapon, "EquipedWeapon", writer); }
public static List<EffectivePoint> CalculateTargetablePointsForEquippedWeapon(Weapon weapon, Point wielderPosition, int wielderVision) { return CalculateAndFilterTargetablePoints(weapon, wielderPosition, wielderVision); }
public override void ReadXml(XmlReader reader) { reader.ReadStartElement(); base.ReadXml(reader); m_equipedWeapon = ReadWeaponFromSave(reader); m_secondaryWeapon = ReadWeaponFromSave(reader); m_currentHealth = reader.ReadElementContentAsInt(); m_baseMaxHealth = reader.ReadElementContentAsInt(); m_currentStamina = reader.ReadElementContentAsInt(); m_baseMaxStamina = reader.ReadElementContentAsInt(); m_baseCurrentMP = reader.ReadElementContentAsInt(); m_baseMaxMP = reader.ReadElementContentAsInt(); SkillPoints = reader.ReadElementContentAsInt(); LastTurnSeenAMonster = reader.ReadElementContentAsInt(); ChestArmor = (IArmor)Item.ReadXmlEntireNode(reader); Headpiece = (IArmor)Item.ReadXmlEntireNode(reader); Gloves = (IArmor)Item.ReadXmlEntireNode(reader); Boots = (IArmor)Item.ReadXmlEntireNode(reader); m_itemList = new List<Item>(); ReadListFromXMLCore readItemDelegate = new ReadListFromXMLCore(delegate { string typeString = reader.ReadElementContentAsString(); Item newItem = ItemFactory.Instance.CreateBaseItem(typeString); newItem.ReadXml(reader); m_itemList.Add(newItem); }); ListSerialization.ReadListFromXML(reader, readItemDelegate); m_skills = new List<Skill>(); ReadListFromXMLCore readSkillDelegate = new ReadListFromXMLCore(delegate { string skillName = reader.ReadElementContentAsString(); m_skills.Add(SkillFactory.Instance.CreateSkill(skillName)); }); ListSerialization.ReadListFromXML(reader, readSkillDelegate); reader.ReadEndElement(); }
public IWeapon UnequipSecondaryWeapon() { if (m_secondaryWeapon == null) return null; Weapon oldWeapon = (Weapon)m_secondaryWeapon; m_secondaryWeapon = null; return oldWeapon; }
internal IWeapon EquipSecondaryWeapon(IWeapon weapon) { if (weapon == null) throw new System.ArgumentException("EquipSecondaryWeapon - Null weapon"); IWeapon oldWeapon = UnequipSecondaryWeapon(); m_secondaryWeapon = (Weapon)weapon; if (m_secondaryWeapon.IsRanged) m_secondaryWeapon.LoadWeapon(); return oldWeapon; }
private Weapon UnequipWeapon() { if (m_equipedWeapon == null) return null; Weapon oldWeapon = (Weapon)m_equipedWeapon; m_equipedWeapon = null; return oldWeapon; }
private IWeapon EquipWeapon(IWeapon weapon) { if (weapon == null) throw new System.ArgumentException("EquipWeapon - Null weapon"); Weapon oldWeapon = UnequipWeapon(); m_equipedWeapon = (Weapon)weapon; if (m_equipedWeapon.IsRanged) m_equipedWeapon.LoadWeapon(); return oldWeapon; }