protected void tryAddAbility(AbilityCommand command) { if (queueActive && abilities.Count < maxAbilities) { abilities.Add(new AbilityProgress(command)); queueView.updateView(abilities); } }
public void HighlightAttackRange(AbilityCommand command) { gm.tileManager.RemoveFlags(Tile.Flag.HighlightedForAttack); foreach (Tile tile in command.GetTilesWithinReach(dungeonGen.grid, gm.combatManager.CurrentActor.Tile)) { tile.AddFlag(Tile.Flag.HighlightedForAttack); } }
private void addAbilityBtn(AbilityCommand command, Vector3 pos, string iconPath) { GameObject abilityBtn = GameObject.Instantiate(AbilityBtnObj); abilityBtn.transform.SetParent(transform); abilityBtn.transform.localScale = Vector3.one; abilityBtn.transform.localPosition = pos; abilityBtn.GetComponent <AbilityButton>().initButton(command, iconPath); }
public AbilityDetails(AbilityCommand command, Combatant performer) { this.command = command; this.performer = performer; targets = new List <GridObject>(); if (command.scope == AbilityCommand.Scope.Self) { targets.Add(performer); } }
public bool CanPerformAbility(AbilityCommand command) { foreach (AbilityCommand.AbilityPool compatibleAbilityPool in compatibleAbilityPools) { if (command.compatibleWeaponTypes.Contains(compatibleAbilityPool)) { return true; } } return false; }
public bool ContainsItemWithAbility(AbilityCommand command) { foreach (Item item in items) { if (item is Consumable c && c.containedAbilities.Contains(command)) { return(true); } } return(false); }
private void RemoveAbilityItemLock() { AbilityCommand ability = Gm.combatManager.CurrentAbilityDetails.command; if (ability.utilityEffects.Any(effect => effect is UseItemEffect)) { UseItemEffect useItemEffect = (UseItemEffect)ability.utilityEffects.First(effect => effect is UseItemEffect); useItemEffect.item.isQueued = false; } else if (ability.utilityEffects.Any(effect => effect is DiscardItemEffect)) { DiscardItemEffect discardItemEffect = (DiscardItemEffect)ability.utilityEffects.First(effect => effect is DiscardItemEffect); discardItemEffect.item.isQueued = false; } }
private void SetCurrentAbility(AbilityCommand command) { _currentCommand = command; if (_currentCommand.scope != AbilityCommand.Scope.Self) { _potentialTargetTiles = _currentCommand.GetTilesWithinReach(Gm.tileManager.dungeonGen.grid, CurrentActor.Tile); SetPrimaryTarget(_potentialTargetTiles[0]); } else { _potentialTargetTiles = new List <Tile> { CurrentActor.Tile }; SetPrimaryTarget(CurrentActor.Tile); } }
public override void processInput(CombatManager mgr) { //Targeter targeter = CombatManager.currentUnit.currentAbility.targeter; if (Input.GetMouseButtonDown(0) && !EventSystem.current.IsPointerOverGameObject()) { HexTile hitTile = UIManager.GetClickedTile(); if (hitTile == null) { return; } if (hitTile.selectable) { command = (AbilityCommand)targeter.ChooseTarget(hitTile, true); UIManager.setHexCursor(hitTile, true); UIManager.button(ButtonName.CONFIRM).gameObject.SetActive(true); } } }
public List <ICommand> ChooseAbility(BoardState boardState, List <ICommand> movement) { float score = Mathf.NegativeInfinity; MoveCommand bestMove = (MoveCommand)movement[0]; AbilityCommand bestSkill = new AbilityCommand(); List <ICommand> bestAction = new List <ICommand>(); foreach (ICommand move in movement) { move.Execute(true); foreach (Ability ability in Unit.current.data.abilities) { HexCoords position = ((MoveCommand)move).path.end.coords; Targeter targeter = ability.Targeter(position, Unit.current); List <HexCoords> targets = targeter.FindTargets(position); foreach (HexCoords t in targets) { HexTile tile = Map.current.TileAt(t); AbilityCommand testMove = (AbilityCommand)targeter.ChooseTarget(tile); testMove.Execute(true); float testScore = boardState.TeamHealth(Unit.current.data.team); testScore -= boardState.TeamHealth(Team.PLAYER); if (testScore > score) { score = testScore; bestSkill = testMove; bestMove = (MoveCommand)move; } testMove.Undo(true); } } move.Undo(true); } bestAction.Add(bestMove); bestAction.Add(bestSkill); return(bestAction); }
// Change ability // useless atm public void switchPlayer(PlayerAbil newAbli) { switch (playerEnum) { case PlayerAbil.roll: ability = GetComponent <RollAbility>(); break; case PlayerAbil.invisible: ability = GetComponent <InvisAbility>(); break; case PlayerAbil.teleport: ability = GetComponent <TeleportAbility>(); break; case PlayerAbil.hook: ability = GetComponent <HookAbility>(); break; } }
public void AbilitiesInitialized(List <Ability> abilities) { if (maxAllowedAbilityNumber < abilities.Count) { Debug.Log("Error in ability count!"); } abilityCommands = new Command[maxAllowedAbilityNumber]; for (int i = 0; i < maxAllowedAbilityNumber; i++) { if (i >= abilities.Count) { abilityCommands[i] = new EmptyCommand(); } else { abilityCommands[i] = new AbilityCommand(abilities[i].abilityData.abilityName); } } }
public async Task <AbilityCommand> UdateAbilityCommand(AbilityCommand abilityCommand) { var ac = _context.AbilityCommands.Find(abilityCommand.AbilityCommandId); if (ac == null) { return(abilityCommand); } try { ac.Command = abilityCommand.Command; ac.Name = abilityCommand.Name; _context.SaveChanges(); } catch (Exception ex) { throw ex; } return(ac); }
public void initButton(AbilityCommand command, string iconPath) { icon.sprite = Resources.Load <Sprite>(iconPath); this.command = command; }
public AbilityProgress(AbilityCommand command) { this.command = command; progressInS = 0f; }
public AbilityDetails(AbilityCommand command, Combatant performer, List <GridObject> targets) { this.command = command; this.performer = performer; this.targets = targets; }
public AbilityAssociatedRecords SP_GetAbilityCommands_Old(int abilityId, int RuleSetID) { AbilityAssociatedRecords result = new AbilityAssociatedRecords(); List <AbilityCommand> _abilityCommand = new List <AbilityCommand>(); List <BuffAndEffect> _BuffAndEffects = new List <BuffAndEffect>(); List <BuffAndEffect> _selectedBuffAndEffects = new List <BuffAndEffect>(); string connectionString = _configuration.GetSection("ConnectionStrings").GetSection("DefaultConnection").Value; // string qry = "EXEC Ability_GetAbilityCommands @AbilityId = '" + abilityId + "'"; SqlConnection connection = new SqlConnection(connectionString); SqlCommand command = new SqlCommand(); SqlDataAdapter adapter = new SqlDataAdapter(); DataSet ds = new DataSet(); try { connection.Open(); command = new SqlCommand("Ability_GetAbilityCommands", connection); // Add the parameters for the SelectCommand. command.Parameters.AddWithValue("@AbilityId", abilityId); command.Parameters.AddWithValue("@RulesetID", RuleSetID); command.CommandType = CommandType.StoredProcedure; adapter.SelectCommand = command; adapter.Fill(ds); command.Dispose(); connection.Close(); } catch (Exception ex) { command.Dispose(); connection.Close(); } if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow row in ds.Tables[0].Rows) { AbilityCommand _cmd = new AbilityCommand(); _cmd.Command = row["Command"] == DBNull.Value ? null : row["Command"].ToString(); _cmd.AbilityId = row["AbilityId"] == DBNull.Value ? 0 : Convert.ToInt32(row["AbilityId"].ToString()); _cmd.AbilityCommandId = row["AbilityCommandId"] == DBNull.Value ? 0 : Convert.ToInt32(row["AbilityCommandId"].ToString()); _cmd.IsDeleted = row["IsDeleted"] == DBNull.Value ? false : Convert.ToBoolean(row["IsDeleted"]); _cmd.Name = row["Name"] == DBNull.Value ? null : row["Name"].ToString(); _abilityCommand.Add(_cmd); } } if (ds.Tables[1].Rows.Count > 0) { foreach (DataRow row in ds.Tables[1].Rows) { BuffAndEffect i = new BuffAndEffect(); i.BuffAndEffectId = row["BuffAndEffectId"] == DBNull.Value ? 0 : Convert.ToInt32(row["BuffAndEffectId"]); i.RuleSetId = row["RuleSetId"] == DBNull.Value ? 0 : Convert.ToInt32(row["RuleSetId"]); i.Name = row["Name"] == DBNull.Value ? null : row["Name"].ToString(); i.ImageUrl = row["ImageUrl"] == DBNull.Value ? null : row["ImageUrl"].ToString(); _BuffAndEffects.Add(i);///////// } } if (ds.Tables[2].Rows.Count > 0) { foreach (DataRow row in ds.Tables[2].Rows) { BuffAndEffect i = new BuffAndEffect(); i.BuffAndEffectId = row["BuffAndEffectId"] == DBNull.Value ? 0 : Convert.ToInt32(row["BuffAndEffectId"]); i.RuleSetId = row["RuleSetId"] == DBNull.Value ? 0 : Convert.ToInt32(row["RuleSetId"]); i.Name = row["Name"] == DBNull.Value ? null : row["Name"].ToString(); i.ImageUrl = row["ImageUrl"] == DBNull.Value ? null : row["ImageUrl"].ToString(); _selectedBuffAndEffects.Add(i);/////// } } result.AbilityCommands = _abilityCommand; result.BuffAndEffectsList = _BuffAndEffects; result.SelectedBuffAndEffects = _selectedBuffAndEffects; return(result); // return _abilityCommand; }
public async Task <AbilityCommand> InsertAbilityCommand(AbilityCommand abilityCommand) { return(await _repo.Add(abilityCommand)); }