====== Ballistica Mechanic ====== **Ballistica** is the line-of-sight and ranged attack calculation system used in Remixed Dungeon for determining if ranged attacks, spells, and other line-based interactions can reach their targets. ==== Overview ==== Ballistica is the fundamental system that calculates straight-line paths between two points in the dungeon grid, accounting for walls and other blocking terrain features. ==== Mechanics ==== * **Line Calculation**: Determines a direct path between source and target positions * **Obstacle Detection**: Identifies which cells in the path are passable or blocked * **Target Validation**: Ensures that ranged attacks and spells can reach their intended targets * **Distance Calculation**: Used for range limits of various abilities ==== Applications ==== * **Ranged Attacks**: Validates if thrown weapons can reach targets * **Spell Targeting**: Determines if spells can reach their targets * **Sight Detection**: Used by enemies to detect the hero when unobstructed * **Special Abilities**: Powers abilities that work in straight lines ==== Technical Details ==== * Implementation: [[https://github.com/NYRDS/remixed-dungeon/blob/master/RemixedDungeon/src/main/java/com/watabou/pixeldungeon/mechanics/Ballistica.java|Ballistica.java]] * Class: Core mechanics class for line calculations * Algorithm: Calculates the path using line-of-sight algorithms that consider dungeon geometry ==== Usage in Tengu Combat ==== * **Ranged Attacks**: Tengu uses Ballistica to determine if it can attack the hero from a distance * **Combat Strategy**: Uses line-of-sight checks to position itself strategically * **Distance Management**: Evaluates line-of-sight to know if it needs to use teleportation ==== Code References ==== * [[https://github.com/NYRDS/remixed-dungeon/blob/master/RemixedDungeon/src/main/java/com/watabou/pixeldungeon/mechanics/Ballistica.java|Ballistica.java]] - Ballistica implementation * [[https://github.com/NYRDS/remixed-dungeon/blob/master/RemixedDungeon/src/main/java/com/watabou/pixeldungeon/actors/mobs/Tengu.java#L91|Tengu.java#L91]] - Example usage of Ballistica for ranged attacks * [[https://github.com/NYRDS/remixed-dungeon/blob/master/RemixedDungeon/src/main/java/com/watabou/pixeldungeon/actors/mobs/Shaman.java#L41|Shaman.java#L41]] - Shaman usage of Ballistica for lightning zaps ==== JSON Configuration ==== * Configurations for ranged combat mechanics and LOS calculations can be found in various JSON files in ''RemixedDungeon/src/main/assets/'' ==== String Resources ==== * Ballistica-related strings are generally defined in connection with ranged combat and spell systems ==== See Also ==== * [[rpd:combat|Combat]] * [[rpd:ranged_combat|Ranged Combat]] * [[rpd:mechanics|Game Mechanics]] {{tag> rpd mechanics combat ranged }}