Complete roguelike tutorial using C++ and libtcod - part 9: spells and ranged combat
Revision as of 12:02, 16 October 2015 by Joel Pera (talk | contribs) (pasted →The scroll of lightning bolt)
Complete roguelike tutorial using C++ and libtcod -originally written by Jice Text in this tutorial was released under the Creative Commons Attribution-ShareAlike 3.0 Unported and the GNU Free Documentation License (unversioned, with no invariant sections, front-cover texts, or back-cover texts) on 2015-09-21. |
---|
|
In this article, we'll start to add diversity to the gameplay by adding three new spells :
- lightning bolt : deals damages to the closest enemy
- fireball : powerful area effect spell
- confusion : turns the selected enemy into a randomly wandering zombie for a few turns
The scroll of lightning bolt
This dreadful spell will deal 20 damage to the closest monster, up to a distance of 5 tiles. So the first thing we need is some helper functions to get the closest monster within a range.