Advertisement
PT_

Untitled

PT_
Apr 27th, 2017
633
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 98.42 KB | None | 0 0
  1. *******************************************************************************
  2. * *
  3. * Dragon Warrior (NES) Formulas v1.0 *
  4. * By Ryan8bit *
  5. * generalkillt@yahoo.com *
  6. * 01/07/11 *
  7. * *
  8. *******************************************************************************
  9.  
  10. Table of Contents
  11. -------------------
  12.  
  13. I. Introduction
  14. II. Simplified Formulas
  15. A. Journeying
  16. B. Combat
  17. C. Chests
  18. D. Name choice and stats
  19. III. Precise Formulas and Code
  20. A. Common algorithms
  21. B. Journeying
  22. C. Combat
  23. D. Chests
  24. E. Name choice and stats
  25. IV. Frequently Asked Questions
  26.  
  27.  
  28.  
  29. *******************************************************************************
  30. * I. Introduction *
  31. *******************************************************************************
  32.  
  33. I had often been curious about the formulas used to calculate damage and all
  34. sorts of other things in Dragon Warrior. Mostly I wanted to make games based
  35. on it, but I also wanted to use them to build a simulator of the game that
  36. could crank out data that could be analyzed. I have since learned the assembly
  37. language of the NES in order to learn all I could about the game's mechanics.
  38. With that knowledge, I have programmed my simulator which I will have a FAQ
  39. like this one for at a later date.
  40.  
  41. So for whatever purpose you may have, I hope you get usage out of these
  42. formulas.
  43.  
  44. I've broken down the sections into simple and complex, so that if you just want
  45. to get the general idea you want section II. If you're more into exact
  46. formulas and some actual code, you want section III.
  47.  
  48.  
  49.  
  50. *******************************************************************************
  51. * II. Simplified Formulas *
  52. *******************************************************************************
  53.  
  54. These formulas are simplified and as a result may not be exact when it comes to
  55. rounding. For more advanced assembly code formulas, see section III.
  56.  
  57. *************************
  58. A. Journeying
  59. *************************
  60.  
  61. -= Items and Spells =-
  62.  
  63. Herb: +23-30 HP
  64. HEAL: +10-17 HP
  65. HEALMORE: +85-100 HP
  66.  
  67. Torch: Unlimited
  68. Radiant: 200 total steps
  69. Radius of 3 squares: 80 steps
  70. Radius of 2 squares: 60 steps
  71. Radius of 1 square : 60 steps
  72.  
  73. REPEL: 128 total steps
  74. Only works against enemies who have strength that is less than the
  75. hero's defense.
  76. Fairy Water has the exact same effect.
  77.  
  78. The Silver Harp summons a Slime, Red Slime, Drakee, Ghost, Magician, or
  79. Scorpion, all with roughly equal chance.
  80.  
  81.  
  82. -= Encounters =-
  83.  
  84. The chances for an encounter on the overworld vary by terrain type, and by
  85. location. For every step you take, you have a random chance to enter combat.
  86.  
  87. In the zones where you fight only Slimes and Red Slimes around Tantegel (which
  88. I call Zone 0), the encounter rates are significantly lower.
  89.  
  90. Zone 0
  91. Grasslands: 1/48
  92. Bridge: 1/48
  93. Forest: 1/32
  94. Hills: 1/32
  95. Desert: 1/16 (There is only one square of desert in this region)
  96.  
  97. Every other zone, including dungeons
  98. Grasslands: 1/24
  99. Swamp: 1/16
  100. Forest: 1/16
  101. Hills: 1/8
  102. Desert: 1/8
  103.  
  104. Stairs: 1/24
  105. Chest: 1/24
  106. Barrier: 1/16
  107. Brick: 1/16
  108.  
  109.  
  110. -= Monster Sets =-
  111.  
  112. The entire world map is broken down into an 8x8 grid. Each cell of the grid
  113. has a different zone, or set of enemies. This is a representation of the grids
  114. corresponding to zone number:
  115.  
  116.  
  117. 3 3 2 2 3 5 4 5
  118.  
  119. 3 2 1 2 3 3 4 5
  120.  
  121. 4 1 0 0 1 3 4 5
  122.  
  123. 5 1 1 12 9 6 6 6
  124.  
  125. 5 5 4 12 12 7 7 7
  126.  
  127. 10 9 8 12 12 12 8 7
  128.  
  129. 10 10 11 12 13 13 9 8
  130.  
  131. 11 11 12 13 13 12 9 9
  132.  
  133.  
  134. So for instance, the top left corner represents the 15x15 tile area surrounding
  135. Garinham. http://www.gamefaqs.com/console/nes/file/563408/55534 is a good
  136. example of this visually.
  137.  
  138.  
  139. Every zone has five possible enemies in them, and some are duplicates. The
  140. chances of encountering each one is roughly equal.
  141.  
  142. Zone 0: Slime, Red Slime, Slime, Red Slime, Slime
  143. Zone 1: Red Slime, Slime, Red Slime, Drakee, Red Slime
  144. Zone 2: Slime, Ghost, Drakee, Ghost, Red Slime
  145. Zone 3: Red Slime, Red Slime, Drakee, Ghost, Magician
  146. Zone 4: Ghost, Magician, Magidrakee, Magidrakee, Scorpion
  147. Zone 5: Ghost, Magician, Magidrakee, Scorpion, Skeleton
  148. Zone 6: Magidrakee, Scorpion, Skeleton, Warlock, Wolf
  149. Zone 7: Skeleton, Warlock, Metal Scorpion, Wolf, Wolf
  150. Zone 8: Metal Scorpion, Wraith, Wolflord, Wolflord, Goldman
  151. Zone 9: Wraith, Wyvern, Wolflord, Wyvern, Goldman
  152. Zone 10: Wyvern, Rogue Scorpion, Wraith Knight, Knight, Demon Knight
  153. Zone 11: Wraith Knight, Knight, Magiwyvern, Demon Knight, Metal Slime
  154. Zone 12: Knight, Magiwyvern, Demon Knight, Werewolf, Starwyvern
  155. Zone 13: Werewolf, Green Dragon, Starwyvern, Starwyvern, Wizard
  156. Zone 14: Poltergeist, Droll, Drakeema, Skeleton, Warlock
  157. Zone 15: Specter, Wolflord, Druinlord, Drollmagi, Wraith Knight
  158. Zone 16: Werewolf, Green Dragon, Starwyvern, Wizard, Axe Knight
  159. Zone 17: Wizard, Axe Knight, Blue Dragon, Blue Dragon, Stoneman
  160. Zone 18: Wizard, Stoneman, Armored Knight, Armored Knight, Red Dragon
  161. Zone 19: Ghost, Magician, Scorpion, Druin, Druin
  162.  
  163.  
  164.  
  165. *************************
  166. B. Combat
  167. *************************
  168.  
  169. -=Enemies=-
  170.  
  171. These are all the stats of the enemies:
  172.  
  173. Strength is used in figuring out how much damage will be done to you.
  174.  
  175. Agility is used in figuring out how much damage will be reduced for the enemy,
  176. and it is used to determine how hard it is for you to run away.
  177.  
  178. HP is how many hit points the enemy has, and this typically varies.
  179.  
  180. SLEEP resist, STOPSPELL resist, and HURT resist are the chances that the spell
  181. will have no effect on the enemy. HURT and HURTMORE have the same chance.
  182.  
  183. Dodge is the chance that the enemy will dodge any physical attack.
  184.  
  185. GP is how much gold will be awarded, and this typically varies.
  186.  
  187. XP is how many experience points will be awarded to you.
  188.  
  189. Pattern is what the enemy decides to do when attacking. It starts with the
  190. first line and if it doesn't do that attack, it moves to the next line.
  191.  
  192.  
  193. #00 : Slime
  194.  
  195. Strength: 5
  196. Agility: 3
  197. HP: 3
  198. SLEEP resist: 0 / 16
  199. STOPSPELL resist: 15 / 16
  200. HURT resist: 0 / 16
  201. Dodge: 1 / 64
  202. XP: 1
  203. GP: 1
  204. Pattern: Attack only
  205.  
  206. #01 : Red Slime
  207.  
  208. Strength: 7
  209. Agility: 3
  210. HP: 4
  211. SLEEP resist: 0 / 16
  212. STOPSPELL resist: 15 / 16
  213. HURT resist: 0 / 16
  214. Dodge: 1 / 64
  215. XP: 1
  216. GP: 2
  217. Pattern: Attack only
  218.  
  219. #02 : Drakee
  220.  
  221. Strength: 9
  222. Agility: 6
  223. HP: 5 - 6
  224. SLEEP resist: 0 / 16
  225. STOPSPELL resist: 15 / 16
  226. HURT resist: 0 / 16
  227. Dodge: 1 / 64
  228. XP: 2
  229. GP: 2
  230. Pattern: Attack only
  231.  
  232. #03 : Ghost
  233.  
  234. Strength: 11
  235. Agility: 8
  236. HP: 6 - 7
  237. SLEEP resist: 0 / 16
  238. STOPSPELL resist: 15 / 16
  239. HURT resist: 0 / 16
  240. Dodge: 4 / 64
  241. XP: 3
  242. GP: 3 - 4
  243. Pattern: Attack only
  244.  
  245. #04 : Magician
  246.  
  247. Strength: 11
  248. Agility: 12
  249. HP: 10 - 13
  250. SLEEP resist: 0 / 16
  251. STOPSPELL resist: 0 / 16
  252. HURT resist: 0 / 16
  253. Dodge: 1 / 64
  254. XP: 4
  255. GP: 9 - 11
  256. Pattern: 50 % to cast HURT
  257. Otherwise attack
  258.  
  259. #05 : Magidrakee
  260.  
  261. Strength: 14
  262. Agility: 14
  263. HP: 12 - 15
  264. SLEEP resist: 0 / 16
  265. STOPSPELL resist: 0 / 16
  266. HURT resist: 0 / 16
  267. Dodge: 1 / 64
  268. XP: 5
  269. GP: 9 - 11
  270. Pattern: 50 % to cast HURT
  271. Otherwise attack
  272.  
  273. #06 : Scorpion
  274.  
  275. Strength: 18
  276. Agility: 16
  277. HP: 16 - 20
  278. SLEEP resist: 0 / 16
  279. STOPSPELL resist: 15 / 16
  280. HURT resist: 0 / 16
  281. Dodge: 1 / 64
  282. XP: 6
  283. GP: 12 - 15
  284. Pattern: Attack only
  285.  
  286. #07 : Druin
  287.  
  288. Strength: 20
  289. Agility: 18
  290. HP: 17 - 22
  291. SLEEP resist: 0 / 16
  292. STOPSPELL resist: 15 / 16
  293. HURT resist: 0 / 16
  294. Dodge: 2 / 64
  295. XP: 7
  296. GP: 12 - 15
  297. Pattern: Attack only
  298.  
  299. #08 : Poltergeist
  300.  
  301. Strength: 18
  302. Agility: 20
  303. HP: 18 - 23
  304. SLEEP resist: 0 / 16
  305. STOPSPELL resist: 0 / 16
  306. HURT resist: 0 / 16
  307. Dodge: 6 / 64
  308. XP: 8
  309. GP: 13 - 17
  310. Pattern: 75 % to cast HURT
  311. Otherwise attack
  312.  
  313. #09 : Droll
  314.  
  315. Strength: 24
  316. Agility: 24
  317. HP: 19 - 25
  318. SLEEP resist: 0 / 16
  319. STOPSPELL resist: 14 / 16
  320. HURT resist: 0 / 16
  321. Dodge: 2 / 64
  322. XP: 10
  323. GP: 18 - 24
  324. Pattern: Attack only
  325.  
  326. #10 : Drakeema
  327.  
  328. Strength: 22
  329. Agility: 26
  330. HP: 16 - 20
  331. SLEEP resist: 2 / 16
  332. STOPSPELL resist: 0 / 16
  333. HURT resist: 0 / 16
  334. Dodge: 6 / 64
  335. XP: 11
  336. GP: 15 - 19
  337. Pattern: 25 % to cast HEAL, but only if its HP < 1/4 of its max HP
  338. Otherwise 50 % to cast HURT
  339. Otherwise attack
  340.  
  341. #11 : Skeleton
  342.  
  343. Strength: 28
  344. Agility: 22
  345. HP: 23 - 30
  346. SLEEP resist: 0 / 16
  347. STOPSPELL resist: 15 / 16
  348. HURT resist: 0 / 16
  349. Dodge: 4 / 64
  350. XP: 11
  351. GP: 22 - 29
  352. Pattern: Attack only
  353.  
  354. #12 : Warlock
  355.  
  356. Strength: 28
  357. Agility: 22
  358. HP: 23 - 30
  359. SLEEP resist: 3 / 16
  360. STOPSPELL resist: 1 / 16
  361. HURT resist: 0 / 16
  362. Dodge: 2 / 64
  363. XP: 13
  364. GP: 26 - 34
  365. Pattern: 25 % to cast SLEEP, but only if you're not asleep
  366. Otherwise 50 % to cast HURT
  367. Otherwise attack
  368.  
  369. #13 : Metal Scorpion
  370.  
  371. Strength: 36
  372. Agility: 42
  373. HP: 17 - 22
  374. SLEEP resist: 0 / 16
  375. STOPSPELL resist: 15 / 16
  376. HURT resist: 0 / 16
  377. Dodge: 2 / 64
  378. XP: 14
  379. GP: 30 - 39
  380. Pattern: Attack only
  381.  
  382. #14 : Wolf
  383.  
  384. Strength: 40
  385. Agility: 30
  386. HP: 26 - 34
  387. SLEEP resist: 1 / 16
  388. STOPSPELL resist: 15 / 16
  389. HURT resist: 0 / 16
  390. Dodge: 2 / 64
  391. XP: 16
  392. GP: 37 - 49
  393. Pattern: Attack only
  394.  
  395. #15 : Wraith
  396.  
  397. Strength: 44
  398. Agility: 34
  399. HP: 28 - 36
  400. SLEEP resist: 7 / 16
  401. STOPSPELL resist: 0 / 16
  402. HURT resist: 0 / 16
  403. Dodge: 4 / 64
  404. XP: 17
  405. GP: 45 - 59
  406. Pattern: 25 % to cast HEAL, but only if its HP < 1/4 of its max HP
  407. Otherwise attack
  408.  
  409. #16 : Metal Slime
  410.  
  411. Strength: 10
  412. Agility: 255
  413. HP: 4
  414. SLEEP resist: 15 / 16
  415. STOPSPELL resist: 15 / 16
  416. HURT resist: 15 / 16
  417. Dodge: 1 / 64
  418. XP: 115
  419. GP: 4 - 5
  420. Pattern: 75 % to cast HURT
  421. Otherwise attack
  422.  
  423. #17 : Specter
  424.  
  425. Strength: 40
  426. Agility: 38
  427. HP: 28 - 36
  428. SLEEP resist: 3 / 16
  429. STOPSPELL resist: 1 / 16
  430. HURT resist: 0 / 16
  431. Dodge: 4 / 64
  432. XP: 18
  433. GP: 52 - 69
  434. Pattern: 25 % to cast SLEEP, but only if you're not asleep
  435. Otherwise 75 % to cast HURT
  436. Otherwise attack
  437.  
  438. #18 : Wolflord
  439.  
  440. Strength: 50
  441. Agility: 36
  442. HP: 29 - 38
  443. SLEEP resist: 4 / 16
  444. STOPSPELL resist: 7 / 16
  445. HURT resist: 0 / 16
  446. Dodge: 2 / 64
  447. XP: 20
  448. GP: 60 - 79
  449. Pattern: 50 % to cast STOPSPELL, but only if your spell isn't blocked
  450. Otherwise attack
  451.  
  452. #19 : Druinlord
  453.  
  454. Strength: 47
  455. Agility: 40
  456. HP: 27 - 35
  457. SLEEP resist: 15 / 16
  458. STOPSPELL resist: 0 / 16
  459. HURT resist: 0 / 16
  460. Dodge: 4 / 64
  461. XP: 20
  462. GP: 63 - 84
  463. Pattern: 75 % to cast HEAL, but only if its HP < 1/4 of its max HP
  464. Otherwise 25 % to cast HURT
  465. Otherwise attack
  466.  
  467. #20 : Drollmagi
  468.  
  469. Strength: 52
  470. Agility: 50
  471. HP: 29 - 38
  472. SLEEP resist: 2 / 16
  473. STOPSPELL resist: 2 / 16
  474. HURT resist: 0 / 16
  475. Dodge: 1 / 64
  476. XP: 22
  477. GP: 67 - 89
  478. Pattern: 50 % to cast STOPSPELL, but only if your spell isn't blocked
  479. Otherwise attack
  480.  
  481. #21 : Wyvern
  482.  
  483. Strength: 56
  484. Agility: 48
  485. HP: 32 - 42
  486. SLEEP resist: 4 / 16
  487. STOPSPELL resist: 15 / 16
  488. HURT resist: 0 / 16
  489. Dodge: 2 / 64
  490. XP: 24
  491. GP: 75 - 99
  492. Pattern: Attack only
  493.  
  494. #22 : Rogue Scorpion
  495.  
  496. Strength: 60
  497. Agility: 90
  498. HP: 27 - 35
  499. SLEEP resist: 7 / 16
  500. STOPSPELL resist: 15 / 16
  501. HURT resist: 0 / 16
  502. Dodge: 2 / 64
  503. XP: 26
  504. GP: 82 - 109
  505. Pattern: Attack only
  506.  
  507. #23 : Wraith Knight
  508.  
  509. Strength: 68
  510. Agility: 56
  511. HP: 35 - 46
  512. SLEEP resist: 5 / 16
  513. STOPSPELL resist: 0 / 16
  514. HURT resist: 3 / 16
  515. Dodge: 4 / 64
  516. XP: 28
  517. GP: 90 - 119
  518. Pattern: 75 % to cast HEAL, but only if its HP < 1/4 of its max HP
  519. Otherwise attack
  520.  
  521. #24 : Golem
  522.  
  523. Strength: 120
  524. Agility: 60
  525. HP: 53 - 70
  526. SLEEP resist: 15 / 16
  527. STOPSPELL resist: 15 / 16
  528. HURT resist: 15 / 16
  529. Dodge: 0 / 64
  530. XP: 5
  531. GP: 7 - 9
  532. Pattern: Attack only
  533.  
  534. #25 : Goldman
  535.  
  536. Strength: 48
  537. Agility: 40
  538. HP: 38 - 50
  539. SLEEP resist: 13 / 16
  540. STOPSPELL resist: 15 / 16
  541. HURT resist: 0 / 16
  542. Dodge: 1 / 64
  543. XP: 6
  544. GP: 150 - 199
  545. Pattern: Attack only
  546.  
  547. #26 : Knight
  548.  
  549. Strength: 76
  550. Agility: 78
  551. HP: 42 - 55
  552. SLEEP resist: 6 / 16
  553. STOPSPELL resist: 7 / 16
  554. HURT resist: 0 / 16
  555. Dodge: 1 / 64
  556. XP: 33
  557. GP: 97 - 129
  558. Pattern: 50 % to cast STOPSPELL, but only if your spell isn't blocked
  559. Otherwise attack
  560.  
  561. #27 : Magiwyvern
  562.  
  563. Strength: 78
  564. Agility: 68
  565. HP: 44 - 58
  566. SLEEP resist: 2 / 16
  567. STOPSPELL resist: 0 / 16
  568. HURT resist: 0 / 16
  569. Dodge: 2 / 64
  570. XP: 34
  571. GP: 105 - 139
  572. Pattern: 50 % to cast SLEEP, but only if you're not asleep
  573. Otherwise attack
  574.  
  575. #28 : Demon Knight
  576.  
  577. Strength: 79
  578. Agility: 64
  579. HP: 38 - 50
  580. SLEEP resist: 15 / 16
  581. STOPSPELL resist: 15 / 16
  582. HURT resist: 15 / 16
  583. Dodge: 15 / 64
  584. XP: 37
  585. GP: 112 - 149
  586. Pattern: Attack only
  587.  
  588. #29 : Werewolf
  589.  
  590. Strength: 86
  591. Agility: 70
  592. HP: 46 - 60
  593. SLEEP resist: 7 / 16
  594. STOPSPELL resist: 15 / 16
  595. HURT resist: 0 / 16
  596. Dodge: 7 / 64
  597. XP: 40
  598. GP: 116 - 154
  599. Pattern: Attack only
  600.  
  601. #30 : Green Dragon
  602.  
  603. Strength: 88
  604. Agility: 74
  605. HP: 49 - 65
  606. SLEEP resist: 7 / 16
  607. STOPSPELL resist: 15 / 16
  608. HURT resist: 2 / 16
  609. Dodge: 2 / 64
  610. XP: 45
  611. GP: 120 - 159
  612. Pattern: 25 % to breathe fire
  613. Otherwise attack
  614.  
  615. #31 : Starwyvern
  616.  
  617. Strength: 86
  618. Agility: 80
  619. HP: 49 - 65
  620. SLEEP resist: 8 / 16
  621. STOPSPELL resist: 0 / 16
  622. HURT resist: 1 / 16
  623. Dodge: 2 / 64
  624. XP: 43
  625. GP: 120 - 159
  626. Pattern: 75 % to cast HEALMORE, but only if its HP < 1/4 of its max HP
  627. Otherwise 25 % to breathe fire
  628. Otherwise attack
  629.  
  630. #32 : Wizard
  631.  
  632. Strength: 80
  633. Agility: 70
  634. HP: 49 - 65
  635. SLEEP resist: 15 / 16
  636. STOPSPELL resist: 7 / 16
  637. HURT resist: 15 / 16
  638. Dodge: 2 / 64
  639. XP: 50
  640. GP: 123 - 164
  641. Pattern: 50 % to cast HURTMORE
  642. Otherwise attack
  643.  
  644. #33 : Axe Knight
  645.  
  646. Strength: 94
  647. Agility: 82
  648. HP: 53 - 70
  649. SLEEP resist: 15 / 16
  650. STOPSPELL resist: 3 / 16
  651. HURT resist: 1 / 16
  652. Dodge: 1 / 64
  653. XP: 54
  654. GP: 123 - 164
  655. Pattern: 25 % to cast SLEEP, but only if you're not asleep
  656. Otherwise attack
  657.  
  658. #34 : Blue Dragon
  659.  
  660. Strength: 98
  661. Agility: 84
  662. HP: 53 - 70
  663. SLEEP resist: 15 / 16
  664. STOPSPELL resist: 15 / 16
  665. HURT resist: 7 / 16
  666. Dodge: 2 / 64
  667. XP: 60
  668. GP: 112 - 149
  669. Pattern: 25 % to breathe fire
  670. Otherwise attack
  671.  
  672. #35 : Stoneman
  673.  
  674. Strength: 100
  675. Agility: 40
  676. HP: 121 - 160
  677. SLEEP resist: 2 / 16
  678. STOPSPELL resist: 15 / 16
  679. HURT resist: 7 / 16
  680. Dodge: 1 / 64
  681. XP: 65
  682. GP: 105 - 139
  683. Pattern: Attack only
  684.  
  685. #36 : Armored Knight
  686.  
  687. Strength: 105
  688. Agility: 86
  689. HP: 68 - 90
  690. SLEEP resist: 15 / 16
  691. STOPSPELL resist: 7 / 16
  692. HURT resist: 1 / 16
  693. Dodge: 2 / 64
  694. XP: 70
  695. GP: 105 - 139
  696. Pattern: 75 % to cast HEALMORE, but only if its HP < 1/4 of its max HP
  697. Otherwise 25 % to cast HURTMORE
  698. Otherwise attack
  699.  
  700. #37 : Red Dragon
  701.  
  702. Strength: 120
  703. Agility: 90
  704. HP: 76 - 100
  705. SLEEP resist: 15 / 16
  706. STOPSPELL resist: 7 / 16
  707. HURT resist: 15 / 16
  708. Dodge: 2 / 64
  709. XP: 100
  710. GP: 105 - 139
  711. Pattern: 25 % to cast SLEEP, but only if you're not asleep
  712. Otherwise 25 % to breathe fire
  713. Otherwise attack
  714.  
  715. #38 : Dragonlord first form
  716.  
  717. Strength: 90
  718. Agility: 75
  719. HP: 76 - 100
  720. SLEEP resist: 15 / 16
  721. STOPSPELL resist: 15 / 16
  722. HURT resist: 15 / 16
  723. Dodge: 0 / 64
  724. XP: 0
  725. GP: 0
  726. Pattern: 25 % to cast STOPSPELL, but only if your spell isn't blocked
  727. Otherwise 75 % to cast HURTMORE
  728. Otherwise attack
  729.  
  730. #39 : Dragonlord second form
  731.  
  732. Strength: 140
  733. Agility: 200
  734. HP: 130
  735. SLEEP resist: 15 / 16
  736. STOPSPELL resist: 15 / 16
  737. HURT resist: 15 / 16
  738. Dodge: 0 / 64
  739. XP: 0
  740. GP: 0
  741. Pattern: 50 % to breathe a very strong fire
  742. Otherwise attack
  743.  
  744.  
  745. -=Enemy attack formulas=-
  746.  
  747. ~Attacks~
  748.  
  749. There are two formulas for attack damage for enemies. The standard range is
  750. from:
  751.  
  752. (EnemyStrength - HeroDefense / 2) / 4,
  753.  
  754. to:
  755.  
  756. (EnemyStrength - HeroDefense / 2) / 2
  757.  
  758. The hero's defense is equal to his agility / 2 rounded down, plus the modifiers
  759. for his equipment.
  760.  
  761.  
  762. The other type of attack happens if your defense power is greater than or equal
  763. to the enemy's strength. In that case, the range is from:
  764.  
  765. 0
  766.  
  767. to:
  768.  
  769. (enemyStrength + 4) / 6
  770.  
  771.  
  772. ~Spells~
  773.  
  774. NOTE: Enemy HURT and HEAL classes of spells have different ranges than the
  775. hero's spells.
  776.  
  777. HURT does 3 - 10 damage
  778. HURTMORE does 30 - 45 damage
  779.  
  780. Both Magic Armor and Erdrick's Armor will reduce HURT spells by 1/3. So:
  781.  
  782. HURT does 2 - 6 damage vs. Erdrick's and Magic Armor
  783. HURTMORE does 20 - 30 damage vs. Erdrick's and Magic Armor
  784.  
  785.  
  786. SLEEP always puts you to sleep, and there is no resisting it. Waking up from
  787. sleep is a 50/50 chance, but because of the limitations of the game programming
  788. it's not possible for it to last for more than 6 turns.
  789.  
  790.  
  791. STOPSPELL has a 50/50 chance of working against you. If you have Erdrick's
  792. Armor it has no chance of working.
  793.  
  794.  
  795. HEAL recovers 20 - 27 HP
  796. HEALMORE recovers 85 - 100 HP
  797.  
  798.  
  799. ~Fire breath~
  800.  
  801. There are two types of fire breath. Only the Dragonlord's second form has the
  802. stronger breath. The rest of the enemies that have breath attacks only have
  803. the weaker type of breath.
  804.  
  805. Weak breath does 16 - 23 damage
  806. Strong breath does 65 - 72 damage
  807.  
  808. The only thing that protects against fire breath is Erdrick's Armor, which
  809. reduces the damage by 1/3. So:
  810.  
  811. Weak breath vs. Erdrick's Armor does 10 - 14 damage
  812. Strong breath vs. Erdrick's Armor does 42 - 48 damage
  813.  
  814.  
  815. -=Hero attack formulas=-
  816.  
  817. ~Attacks~
  818.  
  819. All enemies except the Golem and the Dragonlord have the capability of dodging
  820. any attack, including excellent moves, as is listed in the enemy chart above.
  821.  
  822. Just like the standard enemy attack, the range for the hero's standard attack
  823. damage is from:
  824.  
  825. (HeroAttack - EnemyAgility / 2) / 4,
  826.  
  827. to:
  828.  
  829. (HeroAttack - EnemyAgility / 2) / 2
  830.  
  831. If the damage done is less than 1, then there is 50/50 chance that you will do
  832. either no damage, or 1 damage.
  833.  
  834.  
  835. Excellent moves have a 1/32 chance of happening per attack, and the formulas
  836. completely ignore the defense of the enemy. They range from:
  837.  
  838. Hero attack / 2
  839.  
  840. to:
  841.  
  842. Hero attack
  843.  
  844.  
  845. Unfortunately, excellent moves are not possible against either form of the
  846. Dragonlord. They can also be dodged.
  847.  
  848.  
  849. ~Spells~
  850.  
  851. Hero spells have different ranges than enemy spells.
  852.  
  853. HURT does 5 - 12 damage
  854. HURTMORE does 58 - 65 damage
  855.  
  856. SLEEP effectiveness depends on the enemy's SLEEP resist stat. You're always
  857. guaranteed one turn of attack, and after that turn it is a 1/3 chance that the
  858. enemy will wake up.
  859.  
  860. STOPSPELL effectiveness depends on the enemy's STOPSPELL resist stat. It never
  861. loses its effect.
  862.  
  863.  
  864. -=Running=-
  865.  
  866. Enemy: If your strength is two times the enemy's strength or more, there is a
  867. 25% chance the enemy will run when it's given a turn. The enemy also makes
  868. this check right upon encounter, so he may get a chance to run right away
  869. regardless of initiative.
  870.  
  871. Hero: Certain groups of monsters have higher chances of blocking your running.
  872. The more difficult an enemy is, it may belong to a group that is better at
  873. blocking.
  874.  
  875. Group 1: #00 (Slime) - #19 (Druinlord)
  876. Group 2: #20 (Drollmagi) - #29 (Werewolf)
  877. Group 3: #30 (Green Dragon) - #34 (Blue Dragon)
  878. Group 4: #35 (Stoneman) - #39 (Dragonlord second form)
  879.  
  880. So for instance, group 4 will block you much easier than group 1 will. On top
  881. of that is a test of agility. The test goes like this:
  882.  
  883. If HeroAgility * Random # < EnemyAgility * Random # * GroupFactor, then the
  884. enemy will block you.
  885.  
  886. Random # is a random number between 0 and 255.
  887.  
  888. GroupFactor depends on the group:
  889.  
  890. Group 1: 0.25
  891. Group 2: 0.375
  892. Group 3: 0.5
  893. Group 4: 1.0
  894.  
  895. So you can see that enemies in group 1 are going to have a much lower product
  896. than enemies in group 4, meaning that it will be more likely that your product
  897. will be higher and that you will get away.
  898.  
  899.  
  900. And yes, it is possible to run from the Dragonlord, although you will repeat
  901. the same dialog and have to fight the first form again. You can also run from
  902. the Axe Knight in Hauksness, the Golem outside Cantlin, and the Green Dragon in
  903. the Marsh Cave, but it will put you back a spot so that you can't just skip
  904. them and get their prize.
  905.  
  906. Also worth noting is that if the monster is asleep, you can run away every
  907. time.
  908.  
  909.  
  910. -=Initiative=-
  911.  
  912. This is the same equation as running from enemies in Group 1, except instead of
  913. being blocked, the enemy will go first.
  914.  
  915.  
  916.  
  917. *************************
  918. C. Chests
  919. *************************
  920.  
  921. -=Shrine west of Kol=-
  922.  
  923. Staff of Rain
  924.  
  925. -=Charlock=-
  926.  
  927. B2:
  928. Erdrick's Sword
  929.  
  930. B7:
  931. Two Herbs, 500 - 755 gold, Magic Key, Wings, Cursed Belt
  932.  
  933. -=Garinham=-
  934.  
  935. Back room:
  936. 10 - 17 gold, Torch, Herb
  937.  
  938. -=Grave of Garinham=-
  939.  
  940. B1:
  941. 6-13 gold, 5-20 gold, Herb
  942.  
  943. B3:
  944. Cursed Belt, Silver Harp
  945.  
  946. -=Erdrick's Cave=-
  947.  
  948. B2: Erdrick's Tablet
  949.  
  950. -=Mountain Cave=-
  951.  
  952. B1:
  953. Herb
  954.  
  955. B2:
  956. Fighter's Ring, Torch, 10 - 17 gold, 100 - 131 gold (this chest can also be the
  957. Death Necklace, which is a 1/32 chance, and can only be obtained once)
  958.  
  959. -=Rimuldar=-
  960.  
  961. Wings
  962.  
  963. -=Tantegel=-
  964.  
  965. Throne Room:
  966. 120 gold, Torch, Magic Key
  967.  
  968. Treasury:
  969. All chests are 6 - 13 gold
  970.  
  971. Basement:
  972. Stones of Sunlight
  973.  
  974.  
  975. -=The treasure chest bug=-
  976.  
  977. The handling of treasure chests in Dragon Warrior was done in a very strange
  978. way. Whenever you take a chest, it doesn't simply check to see if you are
  979. standing on a chest, but rather it checks what your position is on the map and
  980. it checks if you've already taken a chest at that position. These positions
  981. are loaded into a collection of numbers. Whenever you leave a town or cave,
  982. this collection is wiped clean, which in part is why chests reappear when you
  983. re-enter. The only time this collection is not cleared is when you die because
  984. it was an oversight on the part of the programmers, which was later corrected
  985. in sequels to the game. Because the data is not cleared, it thinks you still
  986. picked up those specific chests at those specific coordinates.
  987.  
  988. Another thing is that whenever you enter the throne room in Tantegel, the
  989. original three chests that were in that room are placed into this collection to
  990. make certain you don't get them again. So if you die in one cave after having
  991. collected two chests, that makes the total chests it thinks you've collected as
  992. five. Because the maximum number of chest positions the game alotted is eight,
  993. that makes it so that when we pick up the fourth chest in the treasury, that it
  994. would be the ninth chest. Because the collection is full, it can't store that
  995. ninth chest's position, and therefore that position will never be on that list
  996. when you hit take. So if the game can't find that position on the list, the
  997. chest never disappears.
  998.  
  999. The bug allows you to pull as much gold as you want, which effectively gives
  1000. you lots of gold really fast, and allows you to buy some of the best equipment
  1001. very early in the game.
  1002.  
  1003.  
  1004.  
  1005. *************************
  1006. D. Name choice and stats
  1007. *************************
  1008.  
  1009. The name you choose to give your hero will affect your stats and stat growth,
  1010. so it becomes very important. Only the first four letters of the name are used
  1011. in this calculation. Each letter has a corresponding numerical value, and they
  1012. are added up to find the result.
  1013.  
  1014. This is a simplification of those corresponding numbers:
  1015.  
  1016. a b c d e f
  1017. g h i j k l m n o p q r s t u v
  1018. w x y z A B C D E F G H I J K L
  1019. M N O P Q R S T U V W X Y Z
  1020. ' . , - ? ! ) (
  1021.  
  1022. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
  1023.  
  1024. Take the values of the first four letters and add them up. This is our sum. If
  1025. you divide that sum by 4, and take the remainder, that is your growth type.
  1026. There are 4 different growth types, with each one focusing on two particular
  1027. stats that will be reduced in the long term, but will be higher in the short
  1028. term.
  1029.  
  1030. Type 0: Long term HP and MP, short term Strength and Agility
  1031. Type 1: Long term Strength and HP, short term Agility and MP
  1032. Type 2: Long term Agility and MP, short term Strength and HP
  1033. Type 3: Long term Strength and Agility, short term HP and MP
  1034.  
  1035. So below is a chart with all the stat numbers at each level. If you have long
  1036. term growth in that category, then the number is unchanged. If you have short
  1037. term growth in that category, then there is some math to get the adjusted
  1038. number. Take the sum from above and divide by 4 again, this time rounding
  1039. down. Take that number, divide by 4, and take the remainder. Take this number
  1040. and add it to 9/10 of the number on the chart to get your final value.
  1041.  
  1042. Level Strength Agility HP MP
  1043.  
  1044. 1 4 4 15 0
  1045. 2 5 4 22 0
  1046. 3 7 6 24 5
  1047. 4 7 8 31 16
  1048. 5 12 10 35 20
  1049. 6 16 10 38 24
  1050. 7 18 17 40 26
  1051. 8 22 20 46 29
  1052. 9 30 22 50 36
  1053. 10 35 31 54 40
  1054. 11 40 35 62 50
  1055. 12 48 40 63 58
  1056. 13 52 48 70 64
  1057. 14 60 55 78 70
  1058. 15 68 64 86 72
  1059. 16 72 70 92 95
  1060. 17 72 78 100 100
  1061. 18 85 84 115 108
  1062. 19 87 86 130 115
  1063. 20 92 88 138 128
  1064. 21 95 90 149 135
  1065. 22 97 90 158 146
  1066. 23 99 94 165 153
  1067. 24 103 98 170 161
  1068. 25 113 100 174 161
  1069. 26 117 105 180 168
  1070. 27 125 107 189 175
  1071. 28 130 115 195 180
  1072. 29 135 120 200 190
  1073. 30 140 130 210 200
  1074.  
  1075.  
  1076. So as an example, I'll use the name Erdrick at level 20 and do the math.
  1077.  
  1078. So I'll look up the values for the first four letters:
  1079. E: 8
  1080. r: 11
  1081. d: 13
  1082. r: 11
  1083.  
  1084. My sum is then 8 + 11 + 13 + 11 = 43
  1085.  
  1086. My growth type is the remainder of 43 / 4, which is 3. Growth type 3 is long
  1087. term Strength and Agility, so I can automatically pick those numbers off of the
  1088. chart. My strength is 92 and my agility is 88.
  1089.  
  1090. So now I need to find my short term stats. Again I take 43 / 4, but I round it
  1091. down this time, giving me 10. I will take that result, divide by 4, and take
  1092. the remainder, which is 2. So I will take that number and add it to 9/10 of
  1093. what the base stat is. For HP it is 138, so 138 * 9/10 + 2 will give me the
  1094. result, which is 126. Doing the same process for MP I will get 117.
  1095.  
  1096. So my stats end up as:
  1097.  
  1098. Strength: 92
  1099. Agility: 88
  1100. HP: 126
  1101. MP: 117
  1102.  
  1103.  
  1104.  
  1105. *******************************************************************************
  1106. * III. Precise Formulas and Code *
  1107. *******************************************************************************
  1108.  
  1109. These are the advanced formulas that will reference assembly language straight
  1110. from the game. Before reading onward, there are several algorithms you must be
  1111. aware of.
  1112.  
  1113.  
  1114.  
  1115. *************************
  1116. A. Common algorithms
  1117. *************************
  1118.  
  1119. First and foremost is the random generator subroutine, which is located at
  1120. $C55B. It generates a random number between 0 and 255, which for future
  1121. reference I will refer to as RAND. This number is stored at $95. Here's how
  1122. it works:
  1123.  
  1124. The code What it does
  1125. ------------------------- --------------------------------------------------
  1126.  
  1127. $C55B:A5 95 LDA $0095 Load up the previous random number.
  1128. $C55D:85 3D STA $003D Put it into $3D.
  1129. $C55F:A5 94 LDA $0094 Load up the random number's lower byte.
  1130. $C561:85 3C STA $003C Put it into $3C.
  1131. $C563:06 94 ASL $0094
  1132. $C565:26 95 ROL $0095 Multiply $9495 by 2.
  1133.  
  1134. $94 is the lower byte and $95 is the higher byte. Together they are used as
  1135. one larger number. This is apparent by doing the ASL on $94, and carrying the
  1136. overflow into $95. These byte pairs will be referred to as $9495 and $3C3D.
  1137.  
  1138. The code What it does
  1139. ------------------------- --------------------------------------------------
  1140.  
  1141. $C567:18 CLC
  1142. $C568:65 94 ADC $0094 Add $3C3D to the new $9495.
  1143. $C56A:85 94 STA $0094
  1144. $C56C:A5 95 LDA $0095
  1145. $C56E:65 3D ADC $003D
  1146. $C570:85 95 STA $0095
  1147. $C572:A5 94 LDA $0094 Add $94 to $95.
  1148. $C574:18 CLC
  1149. $C575:65 95 ADC $0095
  1150. $C577:85 95 STA $0095
  1151. $C579:A5 94 LDA $0094 Add 0x81 to $9495.
  1152. $C57B:18 CLC
  1153. $C57C:69 81 ADC #$81
  1154. $C57E:85 94 STA $0094
  1155. $C580:A5 95 LDA $0095
  1156. $C582:69 00 ADC #$00
  1157. $C584:85 95 STA $0095
  1158. $C586:60 RTS
  1159.  
  1160. So to simplify a little bit, we have:
  1161.  
  1162. $9495 = $9495 * 2 + $9495
  1163. $95 = $94 + $95
  1164. $9495 = $9495 + 0x81
  1165.  
  1166. We can simplify this a little bit more. The first line could be summed up as
  1167. $9495 * 3. For our purposes, the second line can be expressed as $9495 * 257
  1168. since the overflow is inconsequential. So then we have:
  1169.  
  1170. $9495 *= 3
  1171. $9495 *= 257
  1172. $9495 += 0x81
  1173.  
  1174. This can then be combined into one line as:
  1175.  
  1176. $9495 = $9495 * 771 + 0x81
  1177.  
  1178. Or:
  1179.  
  1180. $9495 = $9495 * 0x303 + 0x81
  1181.  
  1182. This formula presents some limitations. The modulo of the low byte ($94) by 4
  1183. can only ever equal 0 or 1 (bit 1 can never be 1). This means that $94 only
  1184. represents 128 values, where $95 represents 256. This makes 32,768
  1185. possibilities.
  1186.  
  1187. The biggest limitation is when it is run consecutively and the consecutive
  1188. values are used. While the distribution is even, running it consecutively will
  1189. result in patterns cropping up. In the case of the hero waking up from SLEEP,
  1190. which is a 50/50 chance, after a few turns it is impossible for him to stay
  1191. asleep. A true random generator could go on for a long time, but this one is
  1192. fairly limited. It does work quite well when waiting for input though. When
  1193. the player is idle, the generator runs once a frame, which almost guarantees
  1194. that it will be random.
  1195.  
  1196.  
  1197. The next algorithm to know is multiplication, which is located at $C1C9.
  1198.  
  1199. The code What it does
  1200. ------------------------- --------------------------------------------------
  1201.  
  1202. $C1C9:A9 00 LDA #$00 $40 and $41 form a double byte, and they represent
  1203. $C1CB:85 40 STA $0040 the answer to the multiplication. Here they are
  1204. $C1CD:85 41 STA $0041 zeroed.
  1205. $C1CF:A5 3C LDA $003C $3C and $3D also form a double byte, and they are
  1206. $C1D1:05 3D ORA $003D one of the factors. Here it checks if $3C3D is 0
  1207. $C1D3:F0 1A BEQ $C1EF and it ends the subroutine if so.
  1208. $C1D5:46 3D LSR $003D
  1209. $C1D7:66 3C ROR $003C $3C3D is divided by 2.
  1210. $C1D9:90 0D BCC $C1E8 If the remainder is 0, it branches to $C1E8.
  1211. $C1DB:A5 3E LDA $003E
  1212. $C1DD:18 CLC
  1213. $C1DE:65 40 ADC $0040
  1214. $C1E0:85 40 STA $0040 $3E and $3F are the other double byte factor.
  1215. $C1E2:A5 3F LDA $003F Here they are added to $4041 (the result).
  1216. $C1E4:65 41 ADC $0041
  1217. $C1E6:85 41 STA $0041
  1218. $C1E8:06 3E ASL $003E
  1219. $C1EA:26 3F ROL $003F $3E3F is multiplied by 2.
  1220. $C1EC:4C CF C1 JMP $C1CF The process is repeated until $3C == $3D
  1221. $C1EF:60 RTS
  1222.  
  1223. There are other FAQs that deal with the particulars of how this works, and it's
  1224. rather lengthy. Suffice it to say that all that you need to know is that
  1225. $3C3D * $3E3F = $4041.
  1226.  
  1227.  
  1228. The last algorithm to know is division, which is located at $C1F0.
  1229.  
  1230. The code What it does
  1231. ------------------------- --------------------------------------------------
  1232.  
  1233. $C1F0:A9 00 LDA #$00
  1234. $C1F2:85 3D STA $003D $3D, part of a double byte $3C3D, is set to 0.
  1235. $C1F4:A0 10 LDY #$10 Y = 0x10, which is setting up 16 loops.
  1236. $C1F6:A9 00 LDA #$00
  1237. $C1F8:06 3C ASL $003C
  1238. $C1FA:26 3D ROL $003D
  1239. $C1FC:85 40 STA $0040 $40 is set to $3C3D * 2.
  1240. $C1FE:65 40 ADC $0040 The accumulator is set to $40 (plus 1 if there is
  1241. overflow).
  1242. $C200:E6 3C INC $003C $3C++
  1243. $C202:38 SEC
  1244. $C203:E5 3E SBC $003E $3E is subtracted from the accumulator.
  1245. $C205:B0 05 BCS $C20C If there is no overflow, it branches to $C20C.
  1246. $C207:18 CLC
  1247. $C208:65 3E ADC $003E Else $3E is added to the accumulator.
  1248. $C20A:C6 3C DEC $003C $3C--
  1249. $C20C:88 DEY Y--
  1250. $C20D:D0 E9 BNE $C1F8 If Y != 0, then repeat.
  1251. $C20F:85 40 STA $0040 Store the accumulator in $40.
  1252. $C211:60 RTS
  1253.  
  1254. Like multiplication, the explanation for how this works is lengthy, so suffice
  1255. it to say that all you need to know is that $3C3D / $3E = $3C remainder $40.
  1256.  
  1257. Now that we know the basics of the algorithms, we can progress to the formulas.
  1258.  
  1259.  
  1260. *************************
  1261. B. Journeying
  1262. *************************
  1263.  
  1264. -= Items and Spells =-
  1265.  
  1266. For all healing items and spells, the code is basically the same.
  1267.  
  1268. The code What it does
  1269. ------------------------- --------------------------------------------------
  1270.  
  1271. $DBB8:20 5B C5 JSR $C55B Do the random algorithm.
  1272. $DBBB:A5 95 LDA $0095 Load our random number and...
  1273. $DBBD:29 07 AND #$07 ...limit it to a number between 0-7.
  1274. $DBBF:18 CLC
  1275. $DBC0:69 0A ADC #$0A Add that number to 0x0A.
  1276. $DBC2:18 CLC
  1277. $DBC3:65 C5 ADC $00C5 Add that to your HP.
  1278. $DBC5:B0 04 BCS $DBCB If it exceeds 255, branch to $DBCB.
  1279. $DBC7:C5 CA CMP $00CA Or if it exceeds your max HP, branch to $DBCB.
  1280. $DBC9:90 02 BCC $DBCD
  1281. $DBCB:A5 CA LDA $00CA
  1282. $DBCD:85 C5 STA $00C5 Make the HP the max HP.
  1283.  
  1284. All the healing works this way. Here are the values for various spells/items:
  1285.  
  1286. Item HP gained Code location
  1287.  
  1288. Herb: RAND & 0x0F + 0x17 $DCFE
  1289. HEAL: RAND & 0x07 + 0x0A $DBB8
  1290. HEALMORE: RAND & 0x0F + 0x55 $DBD7
  1291.  
  1292.  
  1293. Radiant spell
  1294.  
  1295. The code What it does
  1296. ------------------------- --------------------------------------------------
  1297.  
  1298. $DA6A:A9 50 LDA #$50
  1299. $DA6C:85 DA STA $00DA Puts 0x50 into the radiant counter.
  1300.  
  1301. After initial casting, you have the three square radius for 0x50 steps. Every
  1302. step you take does:
  1303.  
  1304. The code What it does
  1305. ------------------------- --------------------------------------------------
  1306.  
  1307. $CA5A:C6 DA DEC $00DA Decrease the radiant counter by 1.
  1308. $CA5C:D0 0E BNE $CA6C If it's not 0, move on to other things.
  1309. $CA5E:A5 D0 LDA $00D0 If it is 0, check the radius ($D0).
  1310. $CA60:C9 01 CMP #$01 If it's 1...
  1311. $CA62:F0 08 BEQ $CA6C ...Move on to other things.
  1312. $CA64:A9 3C LDA #$3C Otherwise put 0x3C into $DA.
  1313. $CA66:85 DA STA $00DA
  1314. $CA68:C6 D0 DEC $00D0
  1315. $CA6A:C6 D0 DEC $00D0 $D0 -= 2
  1316.  
  1317. $D0 is the number that signifies the radius. It is initially set at seven.
  1318. Every time $DA hits 0, $D0 is subtracted by 2. The radius could be expressed
  1319. as ($D0 - 1) / 2. When it is 1, there is no more extra visible area. Torches
  1320. simply set this value to 0x03 and they last until you leave the cave.
  1321.  
  1322.  
  1323. REPEL spell
  1324.  
  1325. The code What it does
  1326. ------------------------- --------------------------------------------------
  1327.  
  1328. $DA98:A9 FF LDA #$FF
  1329. $DA9A:85 DB STA $00DB Put 0xFF into the repel counter.
  1330.  
  1331. After the initial casting you have the repel counter ($DB) / 2 number of steps.
  1332. The reason it is divided by 2 is because Fairy Water sets $DB to 0xFE. They
  1333. were separated in this way so that they could run the same formulas, but also
  1334. to have different messages when the effect wears off. So every step subtracts
  1335. 2 from the counter.
  1336.  
  1337. The way encounters work with the effect:
  1338.  
  1339. The code What it does
  1340. ------------------------- --------------------------------------------------
  1341.  
  1342. $CF20:A5 45 LDA $0045 Load up the current area
  1343. $CF22:C9 01 CMP #$01 Check if you're on the overworld
  1344. $CF24:D0 1E BNE $CF44
  1345. $CF26:A5 DB LDA $00DB Load the repel counter
  1346. $CF28:F0 1A BEQ $CF44 If it's not 0...
  1347. $CF2A:A5 CD LDA $00CD ...load the hero's defense and...
  1348. $CF2C:4A LSR ...divide that by 2...
  1349. $CF2D:85 3E STA $003E ...and put it into $3E.
  1350. $CF2F:A6 3C LDX $003C X = $3C (at current, $3C is the enemy ID)
  1351. $CF31:BD FA F4 LDA $F4FA,X Load the current enemy's strength and...
  1352. $CF34:38 SEC
  1353. $CF35:E5 3E SBC $003E ...subtract $3E (HeroDefense / 2) from it.
  1354. $CF37:90 0A BCC $CF43 Branch if there is overflow.
  1355. $CF39:85 3E STA $003E Store (EnemyStrength - HeroDefense / 2) at $3E.
  1356. $CF3B:BD FA F4 LDA $F4FA,X Load the current enemy's strength and...
  1357. $CF3E:4A LSR ...divide it by 2.
  1358. $CF3F:C5 3E CMP $003E If EnemyStrength / 2 > EnemyStrength -
  1359. HeroDefense/2
  1360. $CF41:90 01 BCC $CF44 Branch
  1361. $CF43:60 RTS
  1362.  
  1363. There is some redundancy here. First it checks if the hero's defense is twice
  1364. or more times the enemy's strength. If it's not, then it checks if the hero's
  1365. defense is greater than the enemy's strength. The first check could
  1366. essentially be cut, but probably wasn't for memory or speed reasons.
  1367.  
  1368. So the only formula worth concerning yourself with here is:
  1369.  
  1370. If (HeroDefense >> 1 > EnemyStrength >> 1) then the enemy is evaded.
  1371.  
  1372. The bitwise right shifts make it worth noting that if your defense is say, 51,
  1373. and the enemy's strength is say, 50, you won't evade them. So the formula
  1374. can't be simplified to just HeroDefense > EnemyStrength like I do in the
  1375. earlier section.
  1376.  
  1377.  
  1378. The Silver Harp
  1379.  
  1380. The code What it does
  1381. ------------------------- --------------------------------------------------
  1382.  
  1383. $DE18:A5 45 LDA $0045
  1384. $DE1A:C9 01 CMP #$01 Check to make sure you're on the overworld.
  1385. $DE1C:D0 23 BNE $DE41
  1386. $DE1E:20 5B C5 JSR $C55B
  1387. $DE21:A5 95 LDA $0095 Load up a random number.
  1388. $DE23:29 07 AND #$07 Limit that number to 0-7.
  1389. $DE25:C9 05 CMP #$05 If the number is 5...
  1390. $DE27:F0 F5 BEQ $DE1E
  1391. $DE29:C9 07 CMP #$07 ...or 7...
  1392. $DE2B:F0 F1 BEQ $DE1E repeat the random process until it isn't.
  1393.  
  1394. This random number serves as the monster you will encounter. 5 is the
  1395. Magidrakee and 7 is the Druin. This shows that the summoning of enemies only
  1396. works on the overworld.
  1397.  
  1398. Because of the limitations of the random generator, and the fact that it is
  1399. repeated in succession if the result is 5 or 7, this makes the odds not an even
  1400. 1/6 split for each remaining enemy. The actual odds are:
  1401.  
  1402. 0 - Slime: 5504/32768 ~16.8%
  1403. 1 - Red Slime: 5472/32768 ~16.7%
  1404. 2 - Drakee: 5504/32768 ~16.8%
  1405. 3 - Ghost: 5440/32768 ~16.6%
  1406. 4 - Magician: 5472/32768 ~16.7%
  1407. 6 - Scorpion: 5376/32768 ~16.4%
  1408.  
  1409. So there's not a whole lot of variance there. There are other areas, such as
  1410. the chances of encountering an enemy from each zone set, that are a bit more
  1411. varied.
  1412.  
  1413.  
  1414. -= Encounters =-
  1415.  
  1416. For every step that you take, the random subroutine is called. First, it
  1417. figures out what kind of tile you are on. Then it proceeds to check types of
  1418. terrain. It starts with the swamp:
  1419.  
  1420. The code What it does
  1421. ------------------------- --------------------------------------------------
  1422.  
  1423. $CDC6:A5 E0 LDA $00E0 Load the current tile.
  1424. $CDC8:C9 06 CMP #$06 Check if it's swamp.
  1425. $CDCA:D0 36 BNE $CE02 If it's not, move on.
  1426. $CDCC:A5 BE LDA $00BE If it is, load the equipment type.
  1427. $CDCE:29 1C AND #$1C
  1428. $CDD0:C9 1C CMP #$1C
  1429. $CDD2:F0 27 BEQ $CDFB If you're wearing Erdrick's Armor skip the damage.
  1430. ...
  1431. $CDDF:A5 C5 LDA $00C5
  1432. $CDE1:38 SEC
  1433. $CDE2:E9 02 SBC #$02 If not, subtract 2 hit points.
  1434. $CDE4:B0 02 BCS $CDE8 Check if HP is less than 0.
  1435. $CDE6:A9 00 LDA #$00
  1436. $CDE8:85 C5 STA $00C5
  1437. ...
  1438. $CDF0:A5 C5 LDA $00C5
  1439. $CDF2:D0 07 BNE $CDFB If you're still alive, skip ahead.
  1440. ...
  1441. $CDFB:A9 0F LDA #$0F
  1442. $CDFD:25 95 AND $0095 Limit the last random number to 0-15
  1443. $CDFF:F0 7B BEQ $CE7C If it's 0, move on to check the zone you're in.
  1444. $CE01:60 RTS
  1445.  
  1446. And then moves on to desert:
  1447.  
  1448. The code What it does
  1449. ------------------------- --------------------------------------------------
  1450.  
  1451. $CE02:C9 01 CMP #$01 Check if it's desert.
  1452. $CE04:F0 0D BEQ $CE13
  1453. $CE13:A9 07 LDA #$07
  1454. $CE15:D0 E6 BNE $CDFD
  1455. $CDFD:25 95 AND $0095 Limit the random number to 0-7.
  1456. $CDFF:F0 7B BEQ $CE7C If it's 0, move on to check the zone you're in.
  1457. $CE01:60 RTS
  1458.  
  1459. And then to hills:
  1460.  
  1461. The code What it does
  1462. ------------------------- --------------------------------------------------
  1463.  
  1464. $CE06:C9 02 CMP #$02 Check if it's hills.
  1465. $CE08:D0 0D BNE $CE17
  1466. ...
  1467. $CE13:A9 07 LDA #$07
  1468. $CE15:D0 E6 BNE $CDFD
  1469. $CDFD:25 95 AND $0095 Limit the random number to 0-7.
  1470. $CDFF:F0 7B BEQ $CE7C If it's 0, move on to check the zone you're in.
  1471. $CE01:60 RTS
  1472.  
  1473. And then forest:
  1474.  
  1475. The code What it does
  1476. ------------------------- --------------------------------------------------
  1477.  
  1478. $CE17:C9 0B CMP #$0B Check if it's forest.
  1479. $CE19:F0 44 BEQ $CE5F
  1480. $CE5F:A9 0F LDA #$0F
  1481. $CE61:D0 9A BNE $CDFD
  1482. $CDFD:25 95 AND $0095 Limit the random number to 0-15.
  1483. $CDFF:F0 7B BEQ $CE7C If it's 0, move on to check the zone you're in.
  1484. $CE01:60 RTS
  1485.  
  1486. And then brick floor:
  1487.  
  1488. The code What it does
  1489. ------------------------- --------------------------------------------------
  1490.  
  1491. $CE1B:C9 04 CMP #$04 Check if it's brick floor.
  1492. $CE1D:F0 40 BEQ $CE5F
  1493. $CE5F:A9 0F LDA #$0F
  1494. $CE61:D0 9A BNE $CDFD
  1495. $CDFD:25 95 AND $0095 Limit the random number to 0-15.
  1496. $CDFF:F0 7B BEQ $CE7C If it's 0, move on to check the zone you're in.
  1497. $CE01:60 RTS
  1498.  
  1499. And then if it's barrier:
  1500.  
  1501. The code What it does
  1502. ------------------------- --------------------------------------------------
  1503.  
  1504. $CE1F:C9 0D CMP #$0D Check if it's barrier.
  1505. $CE21:D0 40 BNE $CE63
  1506. $CE23:A5 BE LDA $00BE If it is, load the equipment type.
  1507. $CE25:29 1C AND #$1C
  1508. $CE27:C9 1C CMP #$1C
  1509. $CE29:F0 34 BEQ $CE5F If you're wearing Erdrick's Armor skip the damage.
  1510. $CE5F:A9 0F LDA #$0F
  1511. $CE61:D0 9A BNE $CDFD
  1512. $CDFD:25 95 AND $0095 Limit the random number to 0-15.
  1513. $CDFF:F0 7B BEQ $CE7C If it's 0, move on to check the zone you're in.
  1514. $CE01:60 RTS
  1515.  
  1516. And if it's none of the above:
  1517.  
  1518. The code What it does
  1519. ------------------------- --------------------------------------------------
  1520.  
  1521. $CE63:A5 3A LDA $003A Load the hero's x position.
  1522. $CE65:4A LSR
  1523. $CE66:B0 07 BCS $CE6F If x is odd, proceed to check if y is even.
  1524. $CE68:A5 3B LDA $003B If x is even, load the hero's y position.
  1525. $CE6A:4A LSR
  1526. $CE6B:90 07 BCC $CE74 If y is even, the random number will be 0-31.
  1527. $CE6D:B0 09 BCS $CE78 If y is odd, the random number will be 0-15.
  1528. $CE6F:A5 3B LDA $003B If the x position was odd...
  1529. $CE71:4A LSR
  1530. $CE72:90 04 BCC $CE78 ..and if the y position is even, the random number
  1531. $CE74:A9 1F LDA #$1F will be 0-31. If y is odd, it will be 0-15.
  1532. $CE76:D0 85 BNE $CDFD
  1533. $CE78:A9 0F LDA #$0F
  1534. $CE7A:D0 FA BNE $CE76
  1535.  
  1536. Basically, what this all does is set up a checker board style of encounters in
  1537. places like grasslands. One type of checker is a 1 in 16 chance of encounter
  1538. while the other type is a 1 in 32 chance. The point is to essentially make the
  1539. encounter similar to a 1 in 24 chance.
  1540.  
  1541. Then, we start to check what zone we're in:
  1542.  
  1543. The code What it does
  1544. ------------------------- --------------------------------------------------
  1545.  
  1546. $CE7C:A5 45 LDA $0045 Check which area you're in.
  1547. $CE7E:C9 01 CMP #$01 If it's the overworld...
  1548. $CE80:D0 56 BNE $CED8 ...don't branch.
  1549. $CE82:A5 3B LDA $003B Load the hero's y coordinate...
  1550. $CE84:85 3C STA $003C ...and put it into $3C.
  1551. $CE86:A9 0F LDA #$0F
  1552. $CE88:85 3E STA $003E Set $3E to 0x0F.
  1553. $CE8A:20 F0 C1 JSR $C1F0 Run the division subroutine ($3C / $3E).
  1554. $CE8D:A5 3C LDA $003C Load the result of the division...
  1555. $CE8F:85 42 STA $0042 ...and put it into $42 for later.
  1556. $CE91:A5 3A LDA $003A Load the hero's X coordinate...
  1557. $CE93:85 3C STA $003C ...and put it into $3C.
  1558. $CE95:A9 0F LDA #$0F
  1559. $CE97:85 3E STA $003E Set $3E to 0x0F.
  1560. $CE99:20 F0 C1 JSR $C1F0 Runs the division subroutine ($3C / $3E).
  1561. $CE9C:A5 42 LDA $0042 Load the hero's y grid...
  1562. $CE9E:0A ASL
  1563. $CE9F:0A ASL ...and multiply it by 4.
  1564. $CEA0:85 3E STA $003E Put the result in $3E.
  1565. $CEA2:A5 3C LDA $003C Load the hero's x grid...
  1566. $CEA4:4A LSR ...and divide it by 2...
  1567. $CEA5:18 CLC
  1568. $CEA6:65 3E ADC $003E ...and add it to the previous y grid * 4.
  1569. $CEA8:AA TAX Transfer the result to X.
  1570. $CEA9:BD 22 F5 LDA $F522,X Loads what zone grid you are in...
  1571. $CEAC:85 3E STA $003E ...and stores it in $3E.
  1572. $CEAE:A5 3C LDA $003C Load the hero's x grid again.
  1573. $CEB0:4A LSR
  1574. $CEB1:B0 08 BCS $CEBB If it's an odd number, get the small nibble of $3E
  1575. $CEB3:46 3E LSR $003E If it's even, get the large nibble of $3E.
  1576. $CEB5:46 3E LSR $003E
  1577. $CEB7:46 3E LSR $003E
  1578. $CEB9:46 3E LSR $003E
  1579. $CEBB:A5 3E LDA $003E
  1580. $CEBD:29 0F AND #$0F
  1581. $CEBF:D0 43 BNE $CF04 If the zone isn't 0, go on to combat.
  1582.  
  1583. So what this does is divides your x and y coordinates by 15 to figure out what
  1584. grid you are currently in. It then takes that grid and converts it into a
  1585. sequential number to figure out what enemy zone this grid represents.
  1586.  
  1587. So for instance, let's say your coordinates are 0x2B, 0x2C (one square south of
  1588. Tantegel). The x grid is 0x2B / 0x0F, which is 2 (the remainder is
  1589. unimportant). The y grid is 0x2C / 0x0F, which is also 2. So now we follow the
  1590. equation:
  1591.  
  1592. yGrid * 4 + (xGrid >> 1)
  1593.  
  1594. And we would have 2 * 4 + (2 >> 1), which is 9. This result is used as the
  1595. offset from $F522, which in this case would be $F52B, which is 0x00. Normally
  1596. we would find out which nibble is our zone (in this case it would be the large
  1597. nibble), but it doesn't matter since they are both 0. Since the zone is 0, we
  1598. go on to this next code:
  1599.  
  1600. The code What it does
  1601. ------------------------- --------------------------------------------------
  1602.  
  1603. $CEC1:20 5B C5 JSR $C55B If the zone is 0, run the random subroutine.
  1604. $CEC4:A5 E0 LDA $00E0 Load the current tile.
  1605. $CEC6:C9 02 CMP #$02 If it's hills...
  1606. $CEC8:D0 07 BNE $CED1
  1607. $CECA:A5 95 LDA $0095 ...load the random number and...
  1608. $CECC:29 03 AND #$03 ...limit it to 0-3
  1609. $CECE:F0 34 BEQ $CF04 If it's 0, go on to picking the enemy.
  1610.  
  1611. Essentially what this does is that while you're in zone 0, hill encounters are
  1612. reduced from 1/8 to 1/32. If it's not hills, the limitation is:
  1613.  
  1614. The code What it does
  1615. ------------------------- --------------------------------------------------
  1616.  
  1617. $CED1:A5 95 LDA $0095 Load the random number and...
  1618. $CED3:29 01 AND #$01 ...limit it to 0 or 1.
  1619. $CED5:F0 2D BEQ $CF04 If it's 0, go on to picking the enemy.
  1620.  
  1621. So every other type of terrain is limited by a factor of 2. That means you're
  1622. much less likely to have encounters near Tantegel.
  1623.  
  1624. Now on to picking the enemy.
  1625.  
  1626.  
  1627. -= Monster Sets =-
  1628.  
  1629. The code What it does
  1630. ------------------------- --------------------------------------------------
  1631.  
  1632. $CF04:85 3E STA $003E Store the zone number at $3E.
  1633. $CF06:0A ASL
  1634. $CF07:0A ASL
  1635. $CF08:18 CLC
  1636. $CF09:65 3E ADC $003E Multiply the zone number by 5.
  1637. $CF0B:85 3E STA $003E Put the result in $3E.
  1638. $CF0D:20 5B C5 JSR $C55B Run the random subroutine.
  1639. $CF10:A5 95 LDA $0095
  1640. $CF12:29 07 AND #$07 Limit the random number to 0-7.
  1641. $CF14:C9 05 CMP #$05 If it's 5-7...
  1642. $CF16:B0 F5 BCS $CF0D ...go back and repeat until it's not.
  1643. $CF18:65 3E ADC $003E Add the random number to $3E.
  1644. $CF1A:AA TAX
  1645. $CF1B:BD 4F F5 LDA $F54F,X Use the result as the offset from $F54F to get the
  1646. enemy ID.
  1647. $CF1E:85 3C STA $003C Store the ID at $3C.
  1648.  
  1649. So since there are five possibilities per zone, this figures out the zone * 5 +
  1650. a random number between 0 and 4. From there, it checks the offset at $F54F to
  1651. see what enemy ID is there. The chart at $F54F is as follows:
  1652.  
  1653. 00 01 00 01 00
  1654. 01 00 01 02 01
  1655. 00 03 02 03 01
  1656. 01 01 02 03 04
  1657. 03 04 05 05 06
  1658. 03 04 05 06 0B
  1659. 05 06 0B 0C 0E
  1660. 0B 0C 0D 0E 0E
  1661. 0D 0F 12 12 19
  1662. 0F 15 12 15 19
  1663. 15 16 17 1A 1C
  1664. 17 1A 1B 1C 10
  1665. 1A 1B 1C 1D 1F
  1666. 1D 1E 1F 1F 20
  1667. 08 09 0A 0B 0C
  1668. 11 12 13 14 17
  1669. 1D 1E 1F 20 21
  1670. 20 21 22 22 23
  1671. 20 23 24 24 25
  1672. 03 04 06 07 07
  1673.  
  1674. Each enemy ID corresponds to this chart:
  1675.  
  1676. Zone 0: Slime, Red Slime, Slime, Red Slime, Slime
  1677. Zone 1: Red Slime, Slime, Red Slime, Drakee, Red Slime
  1678. Zone 2: Slime, Ghost, Drakee, Ghost, Red Slime
  1679. Zone 3: Red Slime, Red Slime, Drakee, Ghost, Magician
  1680. Zone 4: Ghost, Magician, Magidrakee, Magidrakee, Scorpion
  1681. Zone 5: Ghost, Magician, Magidrakee, Scorpion, Skeleton
  1682. Zone 6: Magidrakee, Scorpion, Skeleton, Warlock, Wolf
  1683. Zone 7: Skeleton, Warlock, Metal Scorpion, Wolf, Wolf
  1684. Zone 8: Metal Scorpion, Wraith, Wolflord, Wolflord, Goldman
  1685. Zone 9: Wraith, Wyvern, Wolflord, Wyvern, Goldman
  1686. Zone 10: Wyvern, Rogue Scorpion, Wraith Knight, Knight, Demon Knight
  1687. Zone 11: Wraith Knight, Knight, Magiwyvern, Demon Knight, Metal Slime
  1688. Zone 12: Knight, Magiwyvern, Demon Knight, Werewolf, Starwyvern
  1689. Zone 13: Werewolf, Green Dragon, Starwyvern, Starwyvern, Wizard
  1690. Zone 14: Poltergeist, Droll, Drakeema, Skeleton, Warlock
  1691. Zone 15: Specter, Wolflord, Druinlord, Drollmagi, Wraith Knight
  1692. Zone 16: Werewolf, Green Dragon, Starwyvern, Wizard, Axe Knight
  1693. Zone 17: Wizard, Axe Knight, Blue Dragon, Blue Dragon, Stoneman
  1694. Zone 18: Wizard, Stoneman, Armored Knight, Armored Knight, Red Dragon
  1695. Zone 19: Ghost, Magician, Scorpion, Druin, Druin
  1696.  
  1697. Each enemy has a roughly equal chance to be encountered, although because of
  1698. the limitations of the random generator, they are slightly imbalanced. It's
  1699. called once to determine if there is combat, once again if you're in zone 0,
  1700. and then however many times it takes to get a number between 0 and 4 instead of
  1701. 0 and 7 (there is a maximum of 7). It's mostly because of that last part that
  1702. the odds are uneven.
  1703.  
  1704. Enemy # Chance to encounter
  1705.  
  1706. 0 416/2048 ~20.3%
  1707. 1 448/2048 ~21.9%
  1708. 2 448/2048 ~21.9%
  1709. 3 336/2048 ~16.4%
  1710. 4 400/2048 ~19.5%
  1711.  
  1712. Since there is one extra call in zone 0, the odds there are different:
  1713.  
  1714. Enemy # Chance to encounter
  1715.  
  1716. 0 368/2048 ~18.0%
  1717. 1 384/2048 ~18.8%
  1718. 2 448/2048 ~21.9%
  1719. 3 416/2048 ~20.3%
  1720. 4 432/2048 ~21.1%
  1721.  
  1722.  
  1723.  
  1724. *************************
  1725. C. Combat
  1726. *************************
  1727.  
  1728. -=Enemies=-
  1729.  
  1730. These are all the stats of the enemies.
  1731.  
  1732. ID Enemy Name Str Agi HP Pat SR DR XP GP
  1733. 00 Slime 05 03 03 00 0F 01 01 02
  1734. 01 Red Slime 07 03 04 00 0F 01 01 03
  1735. 02 Drakee 09 06 06 00 0F 01 02 03
  1736. 03 Ghost 0B 08 07 00 0F 04 03 05
  1737. 04 Magician 0B 0C 0D 02 00 01 04 0C
  1738. 05 Magidrakee 0E 0E 0F 02 00 01 05 0C
  1739. 06 Scorpion 12 10 14 00 0F 01 06 10
  1740. 07 Druin 14 12 16 00 0F 02 07 10
  1741.  
  1742. 08 Poltergeist 12 14 17 03 00 06 08 12
  1743. 09 Droll 18 18 19 00 0E 02 0A 19
  1744. 0A Drakeema 16 1A 14 92 20 06 0B 14
  1745. 0B Skeleton 1C 16 1E 00 0F 04 0B 1E
  1746. 0C Warlock 1C 16 1E 12 31 02 0D 23
  1747. 0D Metal Scorpion 24 2A 16 00 0F 02 0E 28
  1748. 0E Wolf 28 1E 22 00 1F 02 10 32
  1749. 0F Wraith 2C 22 24 90 70 04 11 3C
  1750.  
  1751. 10 Metal Slime 0A FF 04 03 FF F1 73 06
  1752. 11 Specter 28 26 24 13 31 04 12 46
  1753. 12 Wolflord 32 24 26 60 47 02 14 50
  1754. 13 Druinlord 2F 28 23 B1 F0 04 14 55
  1755. 14 Drollmagi 34 32 26 60 22 01 16 5A
  1756. 15 Wyvern 38 30 2A 00 4F 02 18 64
  1757. 16 Rogue Scorpion 3C 5A 23 00 7F 02 1A 6E
  1758. 17 Wraith Knight 44 38 2E B0 50 34 1C 78
  1759.  
  1760. 18 Golem 78 3C 46 00 FF F0 05 0A
  1761. 19 Goldman 30 28 32 00 DF 01 06 C8
  1762. 1A Knight 4C 4E 37 60 67 01 21 82
  1763. 1B Magiwyvern 4E 44 3A 20 20 02 22 8C
  1764. 1C Demon Knight 4F 40 32 00 FF FF 25 96
  1765. 1D Werewolf 56 46 3C 00 7F 07 28 9B
  1766. 1E Green Dragon 58 4A 41 09 7F 22 2D A0
  1767. 1F Starwyvern 56 50 41 F9 80 12 2B A0
  1768.  
  1769. 20 Wizard 50 46 41 06 F7 F2 32 A5
  1770. 21 Axe Knight 5E 52 46 10 F3 11 36 A5
  1771. 22 Blue Dragon 62 54 46 09 FF 72 3C 96
  1772. 23 Stoneman 64 28 A0 00 2F 71 41 8C
  1773. 24 Armored Knight 69 56 5A F5 F7 12 46 8C
  1774. 25 Red Dragon 78 5A 64 19 F7 F2 64 8C
  1775. 26 Dragonlord 1 5A 4B 64 57 FF F0 00 00
  1776. 27 Dragonlord 2 8C C8 82 0E FF F0 00 00
  1777.  
  1778.  
  1779. "Str" is the enemy's strength or attack power.
  1780.  
  1781.  
  1782. "Agi" is the enemy's agility.
  1783.  
  1784.  
  1785. "HP" is the enemy's hit points. This number is just the maximum that their HP
  1786. can be, but it is variable. The code to calculate it is:
  1787.  
  1788. The code What it does
  1789. ------------------------- --------------------------------------------------
  1790.  
  1791. $E599:AD 02 01 LDA $0102 Load the enemy's max HP...
  1792. $E59C:85 3E STA $003E ...and put it in $3E.
  1793. $E59E:20 5B C5 JSR $C55B
  1794. $E5A1:A5 95 LDA $0095
  1795. $E5A3:85 3C STA $003C Put the random number into $3C.
  1796. $E5A5:A9 00 LDA #$00
  1797. $E5A7:85 3D STA $003D
  1798. $E5A9:85 3F STA $003F
  1799. $E5AB:20 C9 C1 JSR $C1C9 Multiply the random number by the max HP.
  1800. $E5AE:A5 41 LDA $0041 Load the result / 256.
  1801. $E5B0:4A LSR
  1802. $E5B1:4A LSR Divide it by 4.
  1803. $E5B2:85 40 STA $0040 Store the result at $40.
  1804. $E5B4:AD 02 01 LDA $0102 Load the enemy's max HP.
  1805. $E5B7:38 SEC
  1806. $E5B8:E5 40 SBC $0040 Subtract $40 from the max HP.
  1807. $E5BA:85 E2 STA $00E2 Set the enemy's current HP to that result.
  1808.  
  1809. The result is:
  1810.  
  1811. MaxHP - ((RAND * MaxHP) >> 10)
  1812.  
  1813. So that will be a range from 75.1-100% of the value. The only exception to
  1814. this is the Dragonlord's second form. He always has the full value for HP.
  1815.  
  1816.  
  1817. "Pat" is the enemy's attack pattern. See below for the more advanced info on
  1818. how this number works.
  1819.  
  1820.  
  1821. "SR" is status resistance. The first nibble / 16 is the chance to resist
  1822. SLEEP:
  1823.  
  1824. The code What it does
  1825. ------------------------- --------------------------------------------------
  1826.  
  1827. $E770:AD 04 01 LDA $0104 Load the enemy's status resistance.
  1828. $E773:4A LSR
  1829. $E774:4A LSR
  1830. $E775:4A LSR
  1831. $E776:4A LSR Get the first nibble (SLEEP resistance).
  1832. $E777:20 46 E9 JSR $E946
  1833. $E946:85 3E STA $003E Store it at $3E.
  1834. $E948:20 5B C5 JSR $C55B
  1835. $E94B:A5 95 LDA $0095 Get the random number...
  1836. $E94D:29 0F AND #$0F ...and limit it to 0-15.
  1837. $E94F:C5 3E CMP $003E If that number is greater or equal to the enemy's
  1838. $E951:90 01 BCC $E954 SLEEP resistance, then it is successful.
  1839. $E953:60 RTS
  1840.  
  1841. The second nibble / 16 is the chance to resist STOPSPELL:
  1842.  
  1843. The code What it does
  1844. ------------------------- --------------------------------------------------
  1845.  
  1846. $E78A:AD 04 01 LDA $0104 Load the enemy's status resistance.
  1847. $E78D:29 0F AND #$0F Get the second nibble (STOPSPELL resistance).
  1848. $E78F:20 46 E9 JSR $E946
  1849. $E946:85 3E STA $003E Store it at $3E.
  1850. $E948:20 5B C5 JSR $C55B
  1851. $E94B:A5 95 LDA $0095 Get the random number...
  1852. $E94D:29 0F AND #$0F ...and limit it to 0-15.
  1853. $E94F:C5 3E CMP $003E If that number is greater or equal to the enemy's
  1854. $E951:90 01 BCC $E954 STOPSPELL resistance, then it is successful.
  1855. $E953:60 RTS
  1856.  
  1857. So for instance, a Slime's SR is 0F. That means SLEEP will always work and
  1858. that STOPSPELL has a 15/16 chance of failing. Enemies who don't use magic have
  1859. F as their STOPSPELL resistance, but this still allows a small chance of it
  1860. working even though it will have no real effect.
  1861.  
  1862.  
  1863. "DR" is damage resistance. The first nibble / 16 is the chance that HURT and
  1864. HURTMORE will have no effect:
  1865.  
  1866. The code What it does
  1867. ------------------------- --------------------------------------------------
  1868.  
  1869. $E73A:AD 05 01 LDA $0105 Load the enemy's damage resistance.
  1870. $E73D:4A LSR
  1871. $E73E:4A LSR
  1872. $E73F:4A LSR
  1873. $E740:4A LSR Get the first nibble (HURT resistance).
  1874. $E741:20 46 E9 JSR $E946
  1875. $E946:85 3E STA $003E Store it at $3E.
  1876. $E948:20 5B C5 JSR $C55B
  1877. $E94B:A5 95 LDA $0095 Get the random number...
  1878. $E94D:29 0F AND #$0F ...and limit it to 0-15.
  1879. $E94F:C5 3E CMP $003E If that number is greater or equal to the enemy's
  1880. $E951:90 01 BCC $E954 HURT resistance, then it is successful.
  1881. $E953:60 RTS
  1882.  
  1883. The second nibble / 64 is the chance of dodging:
  1884.  
  1885. The code What it does
  1886. ------------------------- --------------------------------------------------
  1887.  
  1888. $E66E:20 5B C5 JSR $C55B
  1889. $E671:A5 95 LDA $0095 Get a random number and...
  1890. $E673:29 3F AND #$3F ...limit it to 0-63.
  1891. $E675:85 95 STA $0095 Store the number at $95.
  1892. $E677:AD 05 01 LDA $0105 Load the enemy's damage resistance.
  1893. $E67A:29 0F AND #$0F Get the second nibble (dodging chance).
  1894. $E67C:F0 1C BEQ $E69A If it is 0, the enemy dodges.
  1895. $E67E:38 SEC
  1896. $E67F:E9 01 SBC #$01 Subtract 1 from the dodging chance.
  1897. $E681:C5 95 CMP $0095 If that number is greater or equal to the previous
  1898. $E683:90 15 BCC $E69A random number (0-63), the enemy dodges.
  1899.  
  1900. So for instance, a Slime's DR is 01. That means that HURT spells will always
  1901. connect and that it has a 1/64 chance to dodge an attack.
  1902.  
  1903.  
  1904. "XP" is the experience you will get.
  1905.  
  1906.  
  1907. "GP" is the maximum gold you can get plus one. The code for gold received is:
  1908.  
  1909. The code What it does
  1910. ------------------------- --------------------------------------------------
  1911.  
  1912. $EA2A:AD 07 01 LDA $0107 Load the enemy's gold value.
  1913. $EA2D:85 3E STA $003E Store it at $3E.
  1914. $EA2F:20 5B C5 JSR $C55B
  1915. $EA32:A5 95 LDA $0095 Get a random number and...
  1916. $EA34:29 3F AND #$3F ...limit it to 0-63.
  1917. $EA36:18 CLC
  1918. $EA37:69 C0 ADC #$C0 Add that number to 0xC0.
  1919. $EA39:85 3C STA $003C Store the result at $3C.
  1920. $EA3B:A9 00 LDA #$00
  1921. $EA3D:85 3D STA $003D
  1922. $EA3F:85 3F STA $003F
  1923. $EA41:20 C9 C1 JSR $C1C9 Multiply the enemy's gold value by $3C.
  1924. $EA44:A5 41 LDA $0041 Load the result / 256.
  1925. $EA46:85 00 STA $0000 And store it at $00
  1926.  
  1927. That result is later added to your gold total. So the formula is:
  1928.  
  1929. (GP * ((RAND & 0x3F) + 0xC0)) >> 8
  1930.  
  1931. So that will be a range from 75-99.9% of the value. You will never receive
  1932. that full number.
  1933.  
  1934.  
  1935.  
  1936. -=Enemy patterns=-
  1937.  
  1938. The above mentioned enemy pattern is a little bit more elaborate than the other
  1939. stats. An enemy can have up to two special moves. One focuses on status
  1940. spells and healing, and the other focuses on damage spells and fire breath.
  1941. Certain checks are made to see if they use these attacks. If they don't, they
  1942. simply attack.
  1943.  
  1944. Special move 1:
  1945.  
  1946. The code What it does
  1947. ------------------------- --------------------------------------------------
  1948.  
  1949. $EB4B:20 5B C5 JSR $C55B Run the random subroutine for later.
  1950. $EB4E:AD 03 01 LDA $0103 Load the enemy's pattern.
  1951. $EB51:29 30 AND #$30 Get bits 4 and 5, which is the 1/4 chance of
  1952. carrying out special move 1.
  1953. $EB53:85 3C STA $003C Store it at $3C.
  1954. $EB55:A5 95 LDA $0095 Load the previous random number.
  1955. $EB57:29 30 AND #$30 Get bits 4 and 5.
  1956. $EB59:C5 3C CMP $003C If the random number is less than the enemy's
  1957. $EB5B:B0 37 BCS $EB94 pattern, they will carry out special move 1.
  1958. Otherwise move on to special move 2.
  1959. $EB5D:AD 03 01 LDA $0103 Load the enemy's pattern.
  1960. $EB60:29 C0 AND #$C0 Get bits 6 and 7, which is special move 1.
  1961. $EB62:D0 07 BNE $EB6B
  1962. $EB64:A5 DF LDA $00DF If special move 1 is 0, it is to cast SLEEP.
  1963. $EB66:30 2C BMI $EB94 If the hero is already asleep, then move on to
  1964. special move 2. Otherwise cast SLEEP, which is
  1965. always successful.
  1966. $EB6B:C9 40 CMP #$40
  1967. $EB6D:D0 09 BNE $EB78
  1968. $EB6F:A5 DF LDA $00DF If special move 1 is 1, it is to cast STOPSPELL.
  1969. $EB71:29 10 AND #$10 If the hero's spell is already stopped, then move
  1970. $EB73:D0 1F BNE $EB94 on to special move 2. Otherwise cast STOPSPELL,
  1971. which has a 50/50 chance of success unless
  1972. equipped with Erdrick's Armor, in which case there
  1973. is no chance.
  1974. $EB78:C9 80 CMP #$80
  1975. $EB7A:D0 0C BNE $EB88 If special move 1 is 2, it is to cast HEAL.
  1976. $EB7C:AD 02 01 LDA $0102 Load the enemy's max HP.
  1977. $EB7F:4A LSR
  1978. $EB80:4A LSR Divide that by 4.
  1979. $EB81:C5 E2 CMP $00E2 If the enemy's current HP is less than a quarter
  1980. $EB83:90 0F BCC $EB94 of its max HP, then it will carry out the HEAL
  1981. spell. Otherwise move on to special move 2.
  1982. If special move 1 is 3, it is to cast HEALMORE.
  1983. $EB88:AD 02 01 LDA $0102 Load the enemy's max HP.
  1984. $EB8B:4A LSR
  1985. $EB8C:4A LSR Divide that by 4.
  1986. $EB8D:C5 E2 CMP $00E2 If the enemy's current HP is less than a quarter
  1987. $EB8F:90 03 BCC $EB94 of its max HP, then it will carry out the HEALMORE
  1988. spell. Otherwise move on to special move 2.
  1989.  
  1990. Special move 2:
  1991.  
  1992. The code What it does
  1993. ------------------------- --------------------------------------------------
  1994.  
  1995. $EB94:20 5B C5 JSR $C55B Run the random subroutine for later.
  1996. $EB97:AD 03 01 LDA $0103 Load the enemy's pattern.
  1997. $EB9A:29 03 AND #$03 Get bits 0 and 1, which is the 1/4 chance of
  1998. carrying out special move 2.
  1999. $EB9C:85 3C STA $003C Store it at $3C.
  2000. $EB9E:A5 95 LDA $0095 Load the previous random number.
  2001. $EBA0:29 03 AND #$03 Get bits 0 and 1.
  2002. $EBA2:C5 3C CMP $003C If the random number is less than the enemy's
  2003. $EBA4:B0 1B BCS $EBC1 pattern, they will carry out special move 2.
  2004. Otherwise move on to attack.
  2005. $EBA6:AD 03 01 LDA $0103 Load the enemy's pattern.
  2006. $EBA9:29 0C AND #$0C Get bits 2 and 3, which is special move 2.
  2007. $EBAB:D0 03 BNE $EBB0 If special move 2 is 0, it is to cast HURT.
  2008. $EBB0:C9 04 CMP #$04
  2009. $EBB2:D0 03 BNE $EBB7 If special move 2 is 1, it is to cast HURTMORE.
  2010. $EBB7:C9 08 CMP #$08
  2011. $EBB9:D0 03 BNE $EBBE If special move 2 is 2, it is to breathe fire.
  2012. $EBBE:4C E1 EC JMP $ECE1 If special move 2 is 3, it is to breathe strong
  2013. fire.
  2014.  
  2015.  
  2016. As an example of how it works, we will use a Starwyvern.
  2017.  
  2018. The Starwyvern's pattern is F9, which is 11111001 in binary.
  2019.  
  2020. The first bytes it checks are 4 & 5:
  2021.  
  2022. 11111001
  2023. ^^
  2024.  
  2025. This number / 4 is the chance that they will do special move 1. In this case,
  2026. it is a 3 / 4 chance that the Starwyvern will do special move 1.
  2027.  
  2028. Bytes 6 & 7 correspond to what special move 1 is.
  2029.  
  2030. 11111001
  2031. ^^
  2032.  
  2033. 00: Cast SLEEP
  2034. 01: Cast STOPSPELL
  2035. 10: Cast HEAL
  2036. 11: Cast HEALMORE
  2037.  
  2038. The Starwyvern's ability then is HEALMORE.
  2039.  
  2040. There are always exceptions to if these will be performed. If the hero is
  2041. already asleep, the enemy will not cast SLEEP. If the hero's spell is already
  2042. stopped, the enemy will not cast STOPSPELL. If the enemy's HP >= their max HP
  2043. / 4, then it will not cast healing spells.
  2044.  
  2045. So if the enemy doesn't end up doing special move 1, it moves onto special
  2046. move 2.
  2047.  
  2048. Bytes 0 & 1 are checked:
  2049.  
  2050. 11111001
  2051. ^^
  2052.  
  2053. Again, just like our first check, this number / 4 is the chance that they will
  2054. do special move 2. In the case of the Starwyvern, it's chance is 1 / 4.
  2055.  
  2056. Bytes 2 & 3 correspond to what special move 2 is.
  2057.  
  2058. 11111001
  2059. ^^
  2060.  
  2061. 00: Cast HURT
  2062. 01: Cast HURTMORE
  2063. 10: Breath attack 1
  2064. 11: Breath attack 2
  2065.  
  2066. The Starwyvern's ability then is breath attack 1.
  2067.  
  2068. If this special attack isn't used, then the enemy will just do a regular
  2069. attack.
  2070.  
  2071. So the starwyvern's attack chances can be broken down as such:
  2072. If starwyvern HP < 16
  2073. 3/4 chance to HEAL, 1/16 chance to breathe fire, 3/16 chance to attack
  2074. If starwyvern HP >= 16
  2075. 1/4 chance to breathe fire, 3/4 chance to attack
  2076.  
  2077.  
  2078.  
  2079. -=Enemy attack formulas=-
  2080.  
  2081. ~Attacks~
  2082.  
  2083. There are two formulas for attack damage for enemies. This is the starting
  2084. code:
  2085.  
  2086. The code What it does
  2087. ------------------------- --------------------------------------------------
  2088.  
  2089. $EBCD:AD 00 01 LDA $0100 Load the enemy's strength.
  2090. $EBD0:85 42 STA $0042 Store it at $42.
  2091. $EBD2:A5 CD LDA $00CD Load the hero's defense.
  2092. $EBD4:85 43 STA $0043 Store it at $43.
  2093. $EBD6:20 F4 EF JSR $EFF4
  2094. $EFF4:46 43 LSR $0043 Divide the hero's defense by 2.
  2095. $EFF6:A5 42 LDA $0042
  2096. $EFF8:4A LSR Divide the enemy's strength by 2.
  2097. $EFF9:85 3E STA $003E Store the result at $3E
  2098. $EFFB:E6 3E INC $003E Add 1 to $3E.
  2099. $EFFD:A5 42 LDA $0042
  2100. $EFFF:38 SEC
  2101. $F000:E5 43 SBC $0043 Subtract the halved hero's defense from the
  2102. enemy's strength.
  2103. $F002:90 04 BCC $F008 Branch if it's less than 0.
  2104. $F004:C5 3E CMP $003E Otherwise compare it to $3E, which is the enemy's
  2105. strength / 2 + 1.
  2106. $F006:B0 28 BCS $F030 If it's greater or equal, branch. If not, proceed
  2107. to do lesser damage.
  2108.  
  2109. So $F008 is where lesser damage is determined. $F030 is where regular damage
  2110. is determined. Lesser damage is done if (EnemyStrength >> 2) is less than
  2111. (HeroDefense >> 2 + 1).
  2112.  
  2113. Lesser damage:
  2114.  
  2115. The code What it does
  2116. ------------------------- --------------------------------------------------
  2117.  
  2118. $F008:20 5B C5 JSR $C55B
  2119. $F00B:A5 95 LDA $0095
  2120. $F00D:85 3C STA $003C Put a random number at $3C.
  2121. $F00F:A9 00 LDA #$00
  2122. $F011:85 3D STA $003D
  2123. $F013:85 3F STA $003F
  2124. $F015:20 C9 C1 JSR $C1C9 Multiply the random number by $3E.
  2125. $F018:A5 41 LDA $0041 Load the result / 256.
  2126. $F01A:18 CLC
  2127. $F01B:69 02 ADC #$02 Add 2 to that result.
  2128. $F01D:85 3C STA $003C Store the result in $3C.
  2129. $F01F:A9 03 LDA #$03
  2130. $F021:85 3E STA $003E
  2131. $F023:4C F0 C1 JMP $C1F0 Divide $3C by 3.
  2132.  
  2133. So the end result is floor(((((EnemyStrength >> 1 + 1) * RAND) >> 8) + 2) / 3).
  2134. That's fairly simplified, although it could also be expressed as:
  2135.  
  2136. floor((((EnemyStrength + 2) * RAND + 1024) >> 9) / 3)
  2137.  
  2138. Regular damage:
  2139.  
  2140. The code What it does
  2141. ------------------------- --------------------------------------------------
  2142.  
  2143. $F030:85 42 STA $0042 Store the enemy's strength minus the halved hero's
  2144. defense at $42.
  2145. $F032:85 3E STA $003E Also store it at $3E.
  2146. $F034:E6 3E INC $003E Add 1 to $3E.
  2147. $F036:20 5B C5 JSR $C55B
  2148. $F039:A5 95 LDA $0095
  2149. $F03B:85 3C STA $003C Put a random number at $3C.
  2150. $F03D:A9 00 LDA #$00
  2151. $F03F:85 3D STA $003D
  2152. $F041:85 3F STA $003F
  2153. $F043:20 C9 C1 JSR $C1C9 Multiply the random number by $3E
  2154. $F046:A5 41 LDA $0041 Load the result / 256 and...
  2155. $F048:18 CLC
  2156. $F049:65 42 ADC $0042 ...add it to $42.
  2157. $F04B:6A ROR
  2158. $F04C:4A LSR Divide that result by 4.
  2159. $F04D:85 3C STA $003C Store the result at $3C.
  2160. $F04F:60 RTS
  2161.  
  2162. So the end result is (((EnemyStrength - (HeroDefense >> 1) + 1) * RAND) >> 8 +
  2163. EnemyStrength - (HeroDefense >> 1)) >> 2. This can be simplified as:
  2164.  
  2165. ((256 + RAND) * (EnemyStrength - (HeroDefense >> 1) + 1) - 256) >> 10
  2166.  
  2167.  
  2168. ~Spells~
  2169.  
  2170. Spell Damage done Code location
  2171.  
  2172. HURT : RAND & 0x07 + 0x03 $EC2A
  2173. HURTMORE : RAND & 0x0F + 0x1E $EC5C
  2174.  
  2175. Both Magic Armor and Erdrick's Armor will reduce HURT spells:
  2176.  
  2177. The code What it does
  2178. ------------------------- --------------------------------------------------
  2179.  
  2180. $EC36:A5 BE LDA $00BE Load the hero's equipment byte.
  2181. $EC38:29 1C AND #$1C Get bits 2-4, which is the armor.
  2182. $EC3A:C9 1C CMP #$1C Check if it's Erdrick's Armor.
  2183. $EC3C:F0 04 BEQ $EC42 If it is, branch.
  2184. $EC3E:C9 18 CMP #$18 Otherwise, check if it's Magic Armor.
  2185. $EC40:D0 10 BNE $EC52 If it is, continue.
  2186. $EC42:A5 00 LDA $0000 Load the HURT damage.
  2187. $EC44:85 3C STA $003C Store it at $3C.
  2188. $EC46:A9 03 LDA #$03
  2189. $EC48:85 3E STA $003E
  2190. $EC4A:20 F0 C1 JSR $C1F0 Divide the HURT damage by 3.
  2191. $EC4D:A5 3C LDA $003C
  2192. $EC4F:0A ASL Multiply the result by 2.
  2193. $EC50:85 00 STA $0000
  2194.  
  2195. It's divided by 3, the remainder is discarded, and that result is multiplied by
  2196. 2.
  2197.  
  2198.  
  2199. SLEEP:
  2200.  
  2201. The code What it does
  2202. ------------------------- --------------------------------------------------
  2203.  
  2204. $EC99:A5 DF LDA $00DF Load the byte that has the hero's sleep status.
  2205. $EC9B:09 80 ORA #$80 Set bit 7 to 1, which puts the hero to sleep.
  2206. $EC9D:85 DF STA $00DF
  2207.  
  2208. SLEEP always puts you to sleep, and there is no resisting it. Waking up from
  2209. sleep is a 50/50 chance:
  2210.  
  2211. The code What it does
  2212. ------------------------- --------------------------------------------------
  2213.  
  2214. $E5D6:20 5B C5 JSR $C55B
  2215. $E5D9:A5 95 LDA $0095 Get a random number.
  2216. $E5DB:4A LSR
  2217. $E5DC:B0 07 BCS $E5E5 If it's an odd number, proceed to wake up.
  2218. $E5E5:A5 DF LDA $00DF Load the byte that has the hero's sleep status.
  2219. $E5E7:29 7F AND #$7F Set bit 7 to 0, which wakes the hero up.
  2220. $E5E9:85 DF STA $00DF
  2221.  
  2222. Because of the limitations of the random generator, it's not possible for sleep
  2223. to last on the hero for more than a set number of turns. Per turn, the random
  2224. generator is run 4 times:
  2225.  
  2226. 1. Check to see if the enemy does special move 1. Since special move 1 is
  2227. SLEEP, it will not do this if you are sleeping. So it automatically goes to
  2228. check 2.
  2229. 2. Check to see if the enemy does special move 2.
  2230. 3. If it does or doesn't do that move, it will run the random generator just
  2231. once to calculate damage.
  2232. 4. The check to see if the hero wakes up.
  2233.  
  2234. The results of this are:
  2235.  
  2236. Turns asleep Chance of being asleep that long
  2237. ------------ --------------------------------
  2238.  
  2239. 1 100.0%
  2240. 2 50.0%
  2241. 3 25.0%
  2242. 4 12.5%
  2243. 5 ~9.0%
  2244. 6 ~3.1%
  2245. 7 ~0.4%
  2246. 8 0.0%
  2247.  
  2248. So the longest you could stay asleep would be 6 turns, although it is highly
  2249. unlikely.
  2250.  
  2251. There can actually be an extra random check added in there, and that is if the
  2252. enemy feels intimidated and wants to run. This really shouldn't be of concern
  2253. since if you're a lot stronger than them, it shouldn't matter if you get
  2254. sleeplocked. Regardless, these are the odds:
  2255.  
  2256. Turns asleep Chance of being asleep that long
  2257. ------------ --------------------------------
  2258.  
  2259. 1 100.0%
  2260. 2 62.5%
  2261. 3 ~22.9%
  2262. 4 ~9.0%
  2263. 5 ~3.3%
  2264. 6 ~3.1%
  2265. 7 ~1.0%
  2266. 8 ~0.6%
  2267. 9 ~0.4%
  2268. 10 ~0.2%
  2269. 11 ~0.2%
  2270. 12 0.0%
  2271.  
  2272. So the odds are much better in the initial rounds, but it has the capacity to
  2273. last 4 turns longer. Again, it probably wouldn't matter much if you are
  2274. stronger than the enemy.
  2275.  
  2276.  
  2277. STOPSPELL has a 50/50 chance of working against you unless you are equipped
  2278. with Erdrick's Armor, in which case it won't work at all:
  2279.  
  2280. The code What it does
  2281. ------------------------- --------------------------------------------------
  2282.  
  2283. $EC70:A5 BE LDA $00BE Load the hero's equipment byte.
  2284. $EC72:29 1C AND #$1C Get bits 2-4, which is the armor.
  2285. $EC74:C9 1C CMP #$1C Check if it's Erdrick's Armor.
  2286. $EC76:F0 16 BEQ $EC8E If it is, STOPSPELL will not work.
  2287. $EC78:20 5B C5 JSR $C55B
  2288. $EC7B:A5 95 LDA $0095 Otherwise get a random number.
  2289. $EC7D:4A LSR
  2290. $EC7E:90 0E BCC $EC8E If it's an odd number, your spell is stopped.
  2291. $EC80:A5 DF LDA $00DF Load the byte with the hero's STOPSPELL status.
  2292. $EC82:09 10 ORA #$10 Set bit 4 to 1, which stops the hero's spell.
  2293. $EC84:85 DF STA $00DF
  2294.  
  2295.  
  2296. Spell HP recovered Code location
  2297.  
  2298. HEAL : RAND & 0x07 + 0x14 $ECAD
  2299. HEALMORE : RAND & 0x0F + 0x55 $ECD5
  2300.  
  2301.  
  2302. ~Fire breath~
  2303.  
  2304. There are two types of fire breath. Only the Dragonlord's second form has the
  2305. stronger breath. The rest of the enemies that have breath attacks only have
  2306. the weaker type of breath.
  2307.  
  2308. Breath type Damage done Code location
  2309.  
  2310. Weak breath : RAND & 0x07 + 0x10 $ECED
  2311. Strong breath : RAND & 0x07 + 0x41 $ECE1
  2312.  
  2313. The only thing that protects against fire breath is Erdrick's Armor, which
  2314. reduces the damage:
  2315.  
  2316. The code What it does
  2317. ------------------------- --------------------------------------------------
  2318.  
  2319. $ECFC:A5 BE LDA $00BE Load the hero's equipment byte.
  2320. $ECFE:29 1C AND #$1C Get bits 2-4, which is the armor.
  2321. $ED00:C9 1C CMP #$1C Check if it's Erdrick's Armor.
  2322. $ED02:D0 10 BNE $ED14 If it's not, do regular damage.
  2323. $ED04:A5 00 LDA $0000
  2324. $ED06:85 3C STA $003C
  2325. $ED08:A9 03 LDA #$03
  2326. $ED0A:85 3E STA $003E
  2327. $ED0C:20 F0 C1 JSR $C1F0 Otherwise divide the fire damage by 3.
  2328. $ED0F:A5 3C LDA $003C
  2329. $ED11:0A ASL Multiply the result by 2.
  2330. $ED12:85 00 STA $0000
  2331.  
  2332.  
  2333. It's divided by 3, the remainder is discarded, and that result is multiplied by
  2334. 2.
  2335.  
  2336.  
  2337.  
  2338. -=Hero attack formulas=-
  2339.  
  2340. ~Attacks~
  2341.  
  2342. First, the initial values are loaded:
  2343.  
  2344. The code What it does
  2345. ------------------------- --------------------------------------------------
  2346.  
  2347. $E60C:A5 CC LDA $00CC Get the hero's attack power.
  2348. $E60E:85 42 STA $0042 Store it at $42 for later.
  2349. $E610:AD 01 01 LDA $0101 Get the enemy's agility.
  2350. $E613:85 43 STA $0043 Store it at $43 for later.
  2351. $E615:A5 E0 LDA $00E0 Get the enemy type.
  2352. $E617:C9 26 CMP #$26 Check if it's the Dragonlord...
  2353. $E619:F0 36 BEQ $E651
  2354. $E61B:C9 27 CMP #$27 ...in either form.
  2355. $E61D:F0 32 BEQ $E651
  2356.  
  2357. It branches to $E651 in either case. This is where it determines if you can
  2358. get an excellent move, and they aren't possible to achieve against the
  2359. Dragonlord. So if the enemy is either form of the Dragonlord, it skips the
  2360. check.
  2361.  
  2362. Excellent move check:
  2363.  
  2364. The code What it does
  2365. ------------------------- --------------------------------------------------
  2366.  
  2367. $E61F:20 5B C5 JSR $C55B
  2368. $E622:A5 95 LDA $0095 Load a random number.
  2369. $E624:29 1F AND #$1F Limit that number to 0-31.
  2370. $E626:D0 29 BNE $E651
  2371.  
  2372. Just like above, it will branch to $E651 if the random result is not 0. If it
  2373. is, it will calculate the damage for a critical hit.
  2374.  
  2375. Excellent move damage:
  2376.  
  2377. The code What it does
  2378. ------------------------- --------------------------------------------------
  2379.  
  2380. $E634:20 5B C5 JSR $C55B
  2381. $E637:A5 95 LDA $0095 Load a random number.
  2382. $E639:85 3C STA $003C Store it at $3C for later.
  2383. $E63B:A5 CC LDA $00CC Load the hero's attack power.
  2384. $E63D:4A LSR Divide it by 2.
  2385. $E63E:85 3E STA $003E Put the result into $3E.
  2386. $E640:A9 00 LDA #$00
  2387. $E642:85 3D STA $003D
  2388. $E644:85 3F STA $003F
  2389. $E646:20 C9 C1 JSR $C1C9 Multiply the random number by the hero's attack >>
  2390. 1.
  2391. $E649:A5 CC LDA $00CC Load the hero's attack power.
  2392. $E64B:38 SEC
  2393. $E64C:E5 41 SBC $0041 Subtract our previous product / 256 from the
  2394. hero's attack power.
  2395.  
  2396. So the end result for damage is HeroAttack - ((RAND * (Hero attack >> 1)) >> 8)
  2397.  
  2398. Regular damage:
  2399.  
  2400. The code What it does
  2401. ------------------------- --------------------------------------------------
  2402.  
  2403. $E651:20 E5 EF JSR $EFE5
  2404. $EFE5:46 43 LSR $0043 Divide the enemy agility by 2 for later.
  2405. $EFE7:A5 42 LDA $0042 Get the hero's attack power.
  2406. $EFE9:38 SEC
  2407. $EFEA:E5 43 SBC $0043 Subtract the halved enemy agility from it.
  2408. $EFEC:90 38 BCC $F026 If it's less than 0, branch to calculate minimal
  2409. damage.
  2410. $EFEE:C9 02 CMP #$02 Otherwise check if it's 0 or 1.
  2411. $EFF0:B0 3E BCS $F030 If not, it branches to calculate the rest of
  2412. regular damage.
  2413. $EFF2:90 32 BCC $F026 If so, it branches to calculate minimal damage.
  2414. $F030:85 42 STA $0042 Store HeroAttack - (EnemyAgility >> 1) at $42.
  2415. $F032:85 3E STA $003E Store the same number at $3E.
  2416. $F034:E6 3E INC $003E Add 1 to $3E.
  2417. $F036:20 5B C5 JSR $C55B
  2418. $F039:A5 95 LDA $0095 Loads a random number.
  2419. $F03B:85 3C STA $003C Store it at $3C.
  2420. $F03D:A9 00 LDA #$00
  2421. $F03F:85 3D STA $003D
  2422. $F041:85 3F STA $003F
  2423. $F043:20 C9 C1 JSR $C1C9 Multiply the random number by $3E (Heroattack -
  2424. (EnemyAgility >> 1)).
  2425. $F046:A5 41 LDA $0041 Load the result / 256.
  2426. $F048:18 CLC
  2427. $F049:65 42 ADC $0042 Add that to HeroAttack - (EnemyAgility >> 1).
  2428. $F04B:6A ROR
  2429. $F04C:4A LSR Then divide that result by 4.
  2430. $F04D:85 3C STA $003C Store the result at $3C.
  2431. $F04F:60 RTS
  2432.  
  2433. So the end result for damage is:
  2434.  
  2435. (((HeroAttack - (EnemyAgility >> 1)) * RAND) >> 8 + HeroAttack - (EnemyAgility
  2436. >> 1)) >> 2
  2437.  
  2438. This can be simplified as:
  2439.  
  2440. ((RAND + 256) * (HeroAttack - (EnemyAgility >> 1))) >> 10
  2441.  
  2442.  
  2443. For the minimal damage, it may seem like the checks are redundant, but one is
  2444. for numbers less than 0, and the other is for simply 0 and 1. This is just a
  2445. limitation of the programming. Minimal damage is:
  2446.  
  2447. Minimal damage:
  2448.  
  2449. The code What it does
  2450. ------------------------- --------------------------------------------------
  2451.  
  2452. $F026:20 5B C5 JSR $C55B
  2453. $F029:A5 95 LDA $0095 Load a random number.
  2454. $F02B:29 01 AND #$01 Limits that number to 0 or 1.
  2455. $F02D:85 3C STA $003C Stores the result in $3C for later.
  2456. $F02F:60 RTS
  2457.  
  2458. The result is 0 or 1 damage.
  2459.  
  2460.  
  2461. ~Spells~
  2462.  
  2463. Spell Damage done Code location
  2464.  
  2465. HURT : RAND & 0x07 + 0x05 $E744
  2466. HURTMORE : RAND & 0x07 + 0x3A $E75F
  2467.  
  2468.  
  2469. -=Running=-
  2470.  
  2471. Every turn the enemy checks to see if it will run, even before the hero gets
  2472. off a turn. Here's how it decides to run:
  2473.  
  2474. The code What it does
  2475. ------------------------- --------------------------------------------------
  2476.  
  2477. $EFB7:A5 C8 LDA $00C8 Load the hero's strength.
  2478. $EFB9:4A LSR Divide it by 2.
  2479. $EFBA:CD 00 01 CMP $0100 Compare to the enemy's strength.
  2480. $EFBD:90 25 BCC $EFE4 If it's less, then continue to fight.
  2481. $EFBF:20 5B C5 JSR $C55B
  2482. $EFC2:A5 95 LDA $0095 Otherwise get a random number.
  2483. $EFC4:29 03 AND #$03 Limit that number to 0-3.
  2484. $EFC6:D0 1C BNE $EFE4 If it's 0, then the enemy will run away.
  2485.  
  2486.  
  2487. Chances of the hero running:
  2488.  
  2489. The code What it does
  2490. ------------------------- --------------------------------------------------
  2491.  
  2492. $EE91:20 5B C5 JSR $C55B
  2493. $EE94:A5 E0 LDA $00E0 Load the current enemy.
  2494. $EE96:C9 23 CMP #$23 Compare its ID to 0x23.
  2495. $EE98:90 05 BCC $EE9F
  2496. $EE9A:A5 95 LDA $0095 If it's greater or equal to 0x23, use a plain
  2497. $EE9C:4C C7 EE JMP $EEC7 random number 0-255.
  2498. $EE9F:C9 1E CMP #$1E Otherwise if it's greater or equal to 0x1E...
  2499. $EEA1:90 07 BCC $EEAA
  2500. $EEA3:A5 95 LDA $0095
  2501. $EEA5:29 7F AND #$7F ...use a random number limited to 0-127.
  2502. $EEA7:4C C7 EE JMP $EEC7
  2503. $EEAA:C9 14 CMP #$14 Otherwise if it's greater or equal to 0x14...
  2504. $EEAC:90 12 BCC $EEC0
  2505. $EEAE:A5 95 LDA $0095
  2506. $EEB0:29 3F AND #$3F
  2507. $EEB2:85 3E STA $003E ...put a random number limited to 0-63 at $3E.
  2508. $EEB4:20 5B C5 JSR $C55B
  2509. $EEB7:A5 95 LDA $0095
  2510. $EEB9:29 1F AND #$1F
  2511. $EEBB:65 3E ADC $003E Add another random number limited to 0-31 to $3E.
  2512. $EEBD:4C C7 EE JMP $EEC7 This effectively makes the random number 0-94.
  2513. $EEC0:20 5B C5 JSR $C55B
  2514. $EEC3:A5 95 LDA $0095 If the enemyID is less than 0x14, load a random
  2515. $EEC5:29 3F AND #$3F number and limit it to 0-63.
  2516. $EEC7:85 3C STA $003C Store whatever the limited random number is at $3C
  2517. $EEC9:AD 01 01 LDA $0101 Load the enemy's strength.
  2518. $EECC:85 3E STA $003E Store it at $3E.
  2519. $EECE:A9 00 LDA #$00
  2520. $EED0:85 3D STA $003D
  2521. $EED2:85 3F STA $003F
  2522. $EED4:20 C9 C1 JSR $C1C9 Multiply the random number by the enemy's strength
  2523. $EED7:A5 40 LDA $0040
  2524. $EED9:85 42 STA $0042
  2525. $EEDB:A5 41 LDA $0041
  2526. $EEDD:85 43 STA $0043 Store the double byte $4041 at $4243.
  2527. $EEDF:20 5B C5 JSR $C55B
  2528. $EEE2:A5 95 LDA $0095
  2529. $EEE4:85 3C STA $003C Put a random number at $3C.
  2530. $EEE6:A5 C9 LDA $00C9 Load the hero's agility.
  2531. $EEE8:85 3E STA $003E
  2532. $EEEA:A9 00 LDA #$00
  2533. $EEEC:85 3D STA $003D
  2534. $EEEE:85 3F STA $003F
  2535. $EEF0:20 C9 C1 JSR $C1C9 Multiply the random number by the hero's agility.
  2536. $EEF3:A5 40 LDA $0040
  2537. $EEF5:38 SEC
  2538. $EEF6:E5 42 SBC $0042
  2539. $EEF8:A5 41 LDA $0041
  2540. $EEFA:E5 43 SBC $0043 Subtract the product $4041 from $4243.
  2541. $EEFC:60 RTS
  2542. $E89B:B0 07 BCS $E8A4 If the result is less than 0, the attempt to flee
  2543. is successful.
  2544.  
  2545. Essentially the harder enemies get, the better the chances that they'll have of
  2546. blocking you.
  2547.  
  2548. Here are the conditionals for being blocked:
  2549.  
  2550. Group 1 (0x00-0x13): (EnemyAgility * (RAND >> 2)) > (HeroAgility * RAND)
  2551. Group 2 (0x04-0x1D): (EnemyAgility * ((RAND >> 2) + (RAND >> 3))) >
  2552. (HeroAgility * RAND)
  2553. Group 3 (0x1E-0x22): (EnemyAgility * RAND) >> 1 > (HeroAgility * RAND)
  2554. Group 4 (0x23-0x27): (EnemyAgility * RAND) > (HeroAgility * RAND)
  2555.  
  2556. The only condition where running always works is if the enemy is asleep:
  2557.  
  2558. The code What it does
  2559. ------------------------- --------------------------------------------------
  2560.  
  2561. $E894:24 DF BIT $00DF Get bit 6 of $DF, which is if the enemy is asleep.
  2562. $E896:70 0C BVS $E8A4 If he's asleep, running is successful.
  2563.  
  2564.  
  2565. -=Initiative=-
  2566.  
  2567. This is the same equation as running from enemies in Group 1 ($EEC0), except
  2568. instead of the hero being blocked, the enemy will go first.
  2569.  
  2570.  
  2571.  
  2572. *************************
  2573. C. Chests
  2574. *************************
  2575.  
  2576. Each chest type has an ID that corresponds to what treasure is inside.
  2577.  
  2578. Chest ID Chest location Contents Code location
  2579. -------- -------------------- ------------------------- -------------
  2580.  
  2581. 02 Charlock B7 (x2) Herb $E248
  2582. Garinham back room
  2583. Grave of Garinham B1
  2584. Mountain Cave B1
  2585. 03 Charlock B7 Magic Key $E226
  2586. Tantegel throne room
  2587. 04 Garinham back room Torch $E26C
  2588. Mountain cave B2
  2589. Tantegel throne room
  2590. 05
  2591. 06 Charlock B7 Wings $E242
  2592. Rimuldar
  2593. 09 Mountain Cave B2 Fighter's Ring $E26C
  2594. 0C Charlock B7 Cursed Belt $E26C
  2595. Grave of Garinham B3
  2596. 0D Grave of Garinham B3 Silver Harp $E2B9
  2597. 0E Mountain Cave B2 0x05 + (RAND & 0x0F) Gold $E250
  2598. or 1/32 chance for the
  2599. Death Necklace (but only
  2600. one can be acquired).
  2601. 0F Tantegel basement Stones of Sunlight $E2DB
  2602. 10 Shrine west of Kol Staff of Rain $E26C
  2603. 11 Charlock B2 Erdrick's Sword $E297
  2604. 12 Garinham B1 0x05 + (RAND & 0x0F) Gold $E2F1
  2605. 13 Garinham B1 0x06 + (RAND & 0x07) Gold $E303
  2606. Tantegel treasury (x4)
  2607. 14 Garinham back room 0x0A + (RAND & 0x07) Gold $E315
  2608. Mountain Cave B2
  2609. 15 Charlock B7 0x1F4 + RAND Gold $E327
  2610. 16 Tantegel throne room 120 Gold $E339
  2611. 17 Erdrick's Cave B2 Erdrick's Tablet $E3C5
  2612.  
  2613. Notice that several of the locations refer to $E26C. This code takes the chest
  2614. ID and subtracts 3 from it to determine what item you should get.
  2615.  
  2616. Also, it would seem that various IDs are missing, but were never intended to be
  2617. found in chests. Some of the same algorithms work with buying and receiving
  2618. items.
  2619.  
  2620.  
  2621. -=The treasure chest bug=-
  2622.  
  2623. The code for opening a treasure chest:
  2624.  
  2625. The code What it does
  2626. ------------------------- --------------------------------------------------
  2627.  
  2628. $E209:A5 3A LDA $003A Load the hero's x position.
  2629. $E20B:D9 21 03 CMP $0321,Y Check if that x position contains treasure.
  2630. $E20E:D0 07 BNE $E217
  2631. $E210:A5 3B LDA $003B If it does, load the hero's y position.
  2632. $E212:D9 22 03 CMP $0322,Y Check if that y position contains treasure.
  2633. $E215:F0 0A BEQ $E221
  2634. $E221:B9 23 03 LDA $0323,Y If it does, load the treasure ID.
  2635. $E224:85 DE STA $00DE Store it at $DE.
  2636.  
  2637. So instead of checking if the actual sprite behind the hero is a treasure chest
  2638. , it looks to see if that is a valid position for treasure. We will see why
  2639. this is prone to be buggy in a bit. After the above code it starts checking
  2640. which treasure to give you, which we'll skip here. Instead we'll move to right
  2641. after that where that position is added to an array of coordinates:
  2642.  
  2643. The code What it does
  2644. ------------------------- --------------------------------------------------
  2645.  
  2646. $E39A:A2 00 LDX #$00 Set the pointer to the start of the array.
  2647. $E39C:BD 1C 60 LDA $601C,X Check if the first slot is empty.
  2648. $E39F:1D 1D 60 ORA $601D,X Also check if the second slot is empty.
  2649. $E3A2:F0 07 BEQ $E3AB If they are full, then branch.
  2650. $E3A4:E8 INX
  2651. $E3A5:E8 INX Otherwise add 2 to the pointer.
  2652. $E3A6:E0 10 CPX #$10 If the pointer is greater than or equal to the
  2653. $E3A8:D0 F2 BNE $E39C size of the array, then the checking is complete.
  2654. $E3AA:60 RTS Otherwise repeat the search for an empty slot.
  2655. $E3AB:A5 3A LDA $003A If an empty slot was found, load the x coordinate
  2656. $E3AD:9D 1C 60 STA $601C,X into it.
  2657. $E3B0:A5 3B LDA $003B And load the y coordinate into the next slot.
  2658. $E3B2:9D 1D 60 STA $601D,X
  2659.  
  2660. The problem here comes if the array is full. If the array is full, the
  2661. coordinates of the current chest won't be stored there and consequently you'd
  2662. be able to keep opening that chest. The programmers thought they got around
  2663. this with various methods. They made sure that no dungeon would contain more
  2664. chests than could fit into the array, which would be 8. And whenever you
  2665. entered or exited a town or dungeon, the array was always wiped. What they
  2666. didn't foresee was to clear the array when you die. So you could go into a
  2667. dungeon, collect treasure chests, die, and wake up in the castle with that
  2668. array still full. On top of that, every time you start off in the throne room
  2669. of Tantegel, it automatically fills the last 3 positions of the array so that
  2670. you aren't able to pick up the initial 3 treasures anymore. It doesn't matter
  2671. that you can't see the chests because as previously mentioned, seeing them
  2672. doesn't matter. It's the array of coordinates that matter. So if you get
  2673. enough chests in a cave (2 minimum), die, and raid the treasury in Tantegel,
  2674. you will come upon a chest that never disappears. All because that coordinate
  2675. can never be stored in that full array.
  2676.  
  2677.  
  2678.  
  2679. *************************
  2680. D. Name choice and stats
  2681. *************************
  2682.  
  2683. The algorithm for figuring out stats in relation to your name. This loads the
  2684. base values for the four main stats plus which spells you will have at that
  2685. level:
  2686.  
  2687. The code What it does
  2688. ------------------------- --------------------------------------------------
  2689.  
  2690. $99C0:A4 3C LDY $003C
  2691. $99C2:B1 22 LDA ($22),Y Get the strength value.
  2692. $99C4:85 C8 STA $00C8 Store it.
  2693. $99C6:C8 INY Increment the pointer.
  2694. $99C7:B1 22 LDA ($22),Y Get the agility value.
  2695. $99C9:85 C9 STA $00C9 Store it.
  2696. $99CB:C8 INY Increment the pointer.
  2697. $99CC:B1 22 LDA ($22),Y Get the max HP value.
  2698. $99CE:85 CA STA $00CA Store it.
  2699. $99D0:C8 INY Increment the pointer.
  2700. $99D1:B1 22 LDA ($22),Y Get the max MP value.
  2701. $99D3:85 CB STA $00CB Store it.
  2702. $99D5:C8 INY Increment the pointer.
  2703. $99D6:B1 22 LDA ($22),Y Get the higher level spells.
  2704. $99D8:05 CF ORA $00CF
  2705. $99DA:85 CF STA $00CF Store it in bits 0 and 1 of $CF.
  2706. $99DC:C8 INY Increment the pointer.
  2707. $99DD:B1 22 LDA ($22),Y Get the lower level spells.
  2708. $99DF:85 CE STA $00CE Store it at $CE.
  2709.  
  2710. Later, the value of each of the first four letters of your name is added up:
  2711.  
  2712. The code What it does
  2713. ------------------------- --------------------------------------------------
  2714.  
  2715. $F085:A2 04 LDX #$04 Set the pointer to 4.
  2716. $F087:A9 00 LDA #$00 Set the sum to 0.
  2717. $F089:18 CLC
  2718. $F08A:7D B4 00 ADC $00B4,X Add the value of $B4 offset by the pointer to the
  2719. sum.
  2720. $F08D:CA DEX Subtract 1 from the pointer.
  2721. $F08E:D0 F9 BNE $F089 If it's 0, continue.
  2722.  
  2723. Decide from that sum which attributes will be limited:
  2724.  
  2725. The code What it does
  2726. ------------------------- --------------------------------------------------
  2727.  
  2728. $F090:85 42 STA $0042 Store the sum of the letters at $42.
  2729. $F092:29 03 AND #$03 Get bits 0 and 1 of the sum.
  2730. $F094:85 43 STA $0043 Store that at $43.
  2731. $F096:A5 42 LDA $0042 Load the sum.
  2732. $F098:4A LSR
  2733. $F099:4A LSR Divide it by 4.
  2734. $F09A:29 03 AND #$03 Get bits 0 and 1 of the result.
  2735. $F09C:85 42 STA $0042 Store that at $42.
  2736. $F09E:A5 43 LDA $0043 Load $43 (bits 0 and 1 of the sum).
  2737. $F0A0:4A LSR
  2738. $F0A1:B0 0A BCS $F0AD
  2739. $F0A3:A5 C8 LDA $00C8 If it's an even number, limit the strength.
  2740. $F0A5:20 0C F1 JSR $F10C
  2741. $F0A8:85 C8 STA $00C8
  2742. $F0AA:4C B6 F0 JMP $F0B6
  2743. $F0AD:A5 CB LDA $00CB If it's an odd number, limit the MP.
  2744. $F0AF:F0 05 BEQ $F0B6
  2745. $F0B1:20 0C F1 JSR $F10C
  2746. $F0B4:85 CB STA $00CB
  2747. $F0B6:A5 43 LDA $0043 Load $43 (bits 0 and 1 of the sum).
  2748. $F0B8:29 02 AND #$02 Get just bit 1.
  2749. $F0BA:D0 0A BNE $F0C6 If bit 1 of the sum is 0, limit the agility.
  2750. $F0BC:A5 C9 LDA $00C9
  2751. $F0BE:20 0C F1 JSR $F10C
  2752. $F0C1:85 C9 STA $00C9
  2753. $F0C3:4C CD F0 JMP $F0CD
  2754. $F0C6:A5 CA LDA $00CA If bit 1 of the sum is 1, limit the HP.
  2755. $F0C8:20 0C F1 JSR $F10C
  2756. $F0CB:85 CA STA $00CA
  2757.  
  2758. The limiting of the attributes:
  2759.  
  2760. The code What it does
  2761. ------------------------- --------------------------------------------------
  2762.  
  2763. $F10C:85 3C STA $003C Store the current attribute at $3C.
  2764. $F10E:A9 09 LDA #$09
  2765. $F110:85 3E STA $003E
  2766. $F112:A9 00 LDA #$00
  2767. $F114:85 3D STA $003D
  2768. $F116:85 3F STA $003F
  2769. $F118:20 C9 C1 JSR $C1C9 Multiply the attribute by 9.
  2770. $F11B:A5 40 LDA $0040
  2771. $F11D:85 3C STA $003C
  2772. $F11F:A5 41 LDA $0041
  2773. $F121:85 3D STA $003D Store the result in the double byte $3C3D.
  2774. $F123:A9 0A LDA #$0A
  2775. $F125:85 3E STA $003E
  2776. $F127:A9 00 LDA #$00
  2777. $F129:85 3F STA $003F
  2778. $F12B:20 F4 C1 JSR $C1F4 Divide the result by 10.
  2779. $F12E:A5 3C LDA $003C
  2780. $F130:18 CLC Take that result and add it to $42, which is now
  2781. $F131:65 42 ADC $0042 bits 2 and 3 of the original sum.
  2782.  
  2783. So in general, the best sums are those where bits 2 and 3 are both 1. Bit 0 of
  2784. the sum determines if it will be long term strength or long term MP. Bit 1 of
  2785. the sum determines if it will be long term agility or long term HP.
  2786.  
  2787.  
  2788.  
  2789. *******************************************************************************
  2790. * IV. Frequently Asked Questions *
  2791. *******************************************************************************
  2792.  
  2793. Q: What is the best way to contact you?
  2794. A: I read the gamefaqs.com forum for Dragon Warrior fairly often. I seldom
  2795. check my e-mail.
  2796.  
  2797. Q: Will you ever figure out formulas for other games like the rest of the
  2798. Dragon Warrior series or other RPGs?
  2799. A: I never say never, but I have no plans in the immediate future.
  2800.  
  2801. Q: What does the Fighter's Ring do?
  2802. A: It has no meaningful purpose. It only changes what a single townsperson
  2803. says. Don't pay any attention to websites, FAQs, or even original manuals
  2804. that say otherwise. They all just assumed that it had a function and made a
  2805. sloppy guess that has carried on for some time.
  2806.  
  2807. Q: Does the Silver Harp have any other effects depending on your location?
  2808. A: Nope. It always summons the same lame group of enemies.
  2809.  
  2810. Q: Is there a limit to how long enemies can be asleep?
  2811. A: No. The reason the hero's nap time is limited is because the limited random
  2812. generator produces distinct patterns when run consecutively. If you sit by
  2813. idly while waiting to make a command, the random generator is run 60 times
  2814. per second. This effectively makes it a time-based random, which can result
  2815. in any outcome. Tool-assisted speedruns have taken advantage of this.
  2816.  
  2817. Q: Is it possible to get in an encounter the first step after battle?
  2818. A: Yes. There is no counter, so theoretically you could have infinte
  2819. encounters in a row. This is actually used in various tool-assisted speed
  2820. runs to level up quickly.
  2821. FAQ Display Options: Printable Version
  2822.  
  2823. GameFAQs.comfacebook.com/GFAQstwitter.com/GameFAQsHelp / Contact UsChange Colors
  2824. gamespot.comgiantbomb.commetacritic.comgamerankings.com
  2825. © 2017 CBS Interactive Inc. All rights reserved.SitemapAdvertisePartnershipsCareersPrivacy PolicyAd ChoiceTerms of Use
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement