public void BuildArenaFloor(int width) { ArenaFloor = new ArenaFloorTile[width, width]; for (var i = 0; i < width; i++) { for (var j = 0; j < width; j++) { ArenaFloor[i,j] = new ArenaFloorTile(i,j); } } }
public void UntargetTile() { TargettedTile = null; CurrentAvailableActions = null; }
public List<IAction> TargetTileAndSelectActions(ArenaFloorTile tile) { TargetTile(tile); CurrentAvailableActions = GetActions(true); return CurrentAvailableActions; }
public void TargetTile(ArenaFloorTile tile) { TargettedTile = tile; }
public void SetEntityLocation(ArenaFloorTile tile) { ArenaLocation = tile; }
private IAction ChooseAction(Type actionType, ICharacter c, ArenaFloorTile opponentTile) { if (!_actionChoosersByType.ContainsKey(actionType)) { throw new Exception("Error - you can't choose an action for that action type!"); } return _actionChoosersByType[actionType].Invoke(c, opponentTile); }
private void BotPerformMove(ICharacter c, ArenaFloorTile tile) { // Get movement with most distance. var moveAction = c.GetActions(false) .Where(a => a is MoveBase) .OrderByDescending(a => ((MoveBase)a).Distance) .FirstOrDefault() as MoveBase; if (moveAction == null) return; // Get as close to player as possible - find movement that does this. var d = moveAction.Distance; var newPosition = ArenaHelper.GetClosestMovablePosition(c.ArenaLocation.GetTileLocation(), tile.GetTileLocation(), d); var newTile = CurrentBattleDetails.Arena.ArenaFloor[newPosition.XCoord, newPosition.YCoord]; //TODO: Implement logic for bot moving around obstacles? For now don't allow movement onto tiles that have entities var actions = c.TargetTileAndSelectActions(newTile); if (actions.Exists(i => i.Name == moveAction.Name)) { if (EnableLogging) { Logger.WriteBattleTurnEntry(c.SkillTree.Get() .Where(s => s.IsActive) .OrderByDescending(s => s.Level) .First() .Path + " (" + c.Name + " " + c.Health + "/" + c.Mana + ") " + "performed " + moveAction.Name); } CurrentBattleDetails.TurnDetails.Add(moveAction.Perform((Character)c)); } }