public bool HasAttackedWithOtherThisRound(Guid ownedItemId, List <OwnedItem> items) { var weapoinsIds = UsedActions.Where(x => x.ActionUsedBy == ownedItemId).Select(x => x.ActionUsedBy.GetValueOrDefault()); var hasAttackedWithOtherWeapon = items.Count(x => x.IsEquipped.GetValueOrDefault() && x.Item.Type == ItemType.Weapon && weapoinsIds.Contains(x.ID)) > 0; return(hasAttackedWithOtherWeapon); }
public void TakeAction(RoundAction action, Guid?optionWeaponKey = null) { if (UsedActions == null) { UsedActions = new List <RoundActionTaken>(); } UsedActions.Add(new RoundActionTaken { Action = action, ActionUsedBy = optionWeaponKey, }); }
public int?GetBaseAttackWithWeapon(Guid ownedItemId, List <int> baseAttack, Guid?primaryWeaponId, Guid?offHandWeapon) { var actionToUse = GetActionToUseWeapon(ownedItemId, baseAttack.Count, primaryWeaponId, offHandWeapon); if (actionToUse == null) { return(null); } var usedCount = UsedActions.Count(x => x.ActionUsedBy == ownedItemId); if (usedCount < baseAttack.Count) { return(baseAttack[usedCount]); } return(null); }
public RoundAction?GetActionToUseWeapon(Guid?itemKey, int numberOfAttacks, Guid?primaryWeaponId, Guid?offHandWeapon) { var usedCount = UsedActions.Count(x => x.ActionUsedBy == itemKey); if (usedCount == 0 && !UsedActions.Any(x => x.Action == RoundAction.Standard || x.Action == RoundAction.FullRound)) { return(RoundAction.Standard); } else if (usedCount == 1 || (itemKey.HasValue && (itemKey == primaryWeaponId || itemKey == offHandWeapon))) { return(RoundAction.Move); } else if (usedCount > 1 && usedCount < numberOfAttacks) { return(RoundAction.Free); } else { return(null); } }
public int GetAttacksTaken() { return(UsedActions.Count(x => x.ActionUsedBy != null)); }