// Second overload method used for checking abilities that target tiles (Move for example) public static bool IsAbilityUseValid(LivingEntity caster, Ability abilityUsed, Tile targetTile) { // Ability must pass both checks to be a valid move bool passedApCheck = false; bool passedInRangeCheck = false; // Check if caster actually has enough action points to pay for the ability if (HasEnoughActionPoints(caster, abilityUsed)) { passedApCheck = true; } // Check that the target location is in range if (WorldController.IsTileAInRangeOfTileB(caster.Position, targetTile, abilityUsed.Range)) { passedInRangeCheck = true; } // both checks succesful? if so, return true if (passedApCheck && passedInRangeCheck) { return(true); } else { return(false); } // TO DO: implement code that checks if the targetTile is unoccupied when using 'Move' }
public static void CreateItemsOnTurnCycleStart(int itemsToCreate) { for (int i = 0; i < itemsToCreate; i++) { // Get a random valid spawn location for the item Tile spawnLocation = WorldController.GetAllValidNewItemLocationTiles(WorldController.currentWorld) [new Random().Next(0, WorldController.GetAllValidNewItemLocationTiles(WorldController.currentWorld).Count)]; // Was a valid spawning tile actually found? if (spawnLocation != null) { // Create a new random item Item newRandomItem = ItemController.CreateItemFromItemData(ItemLibrary.GetRandomItemData()); // Place item at the spawn location ItemController.PlaceItemOnTile(spawnLocation, newRandomItem); } } }
public static bool IsTargetInRangeOfCaster(LivingEntity target, LivingEntity caster, int range) { return(WorldController.IsTileAInRangeOfTileB(target.Position, caster.Position, range)); }