Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.38 KB | None | 0 0
  1. immediate = {
  2. if = {
  3. limit = { ehof_log_functions = yes }
  4. log = "EHOF: ehof_travel.80 fired :: EHOF Wormhole Generation & Accuracy Dice"
  5. }
  6. # First Dice:
  7. # Determined from EHOF Phase
  8.  
  9. if = {
  10. # EHOF Phase 1: D10
  11. limit = { active_ehof_is_phase_1 = yes }
  12. random_list = {
  13. 10 = { ROOT = { set_variable = { which = ehof_rolled_d10 value = 1 } } }
  14. 10 = { ROOT = { set_variable = { which = ehof_rolled_d10 value = 2 } } }
  15. 10 = { ROOT = { set_variable = { which = ehof_rolled_d10 value = 3 } } }
  16. 10 = { ROOT = { set_variable = { which = ehof_rolled_d10 value = 4 } } }
  17. 10 = { ROOT = { set_variable = { which = ehof_rolled_d10 value = 5 } } }
  18. 10 = { ROOT = { set_variable = { which = ehof_rolled_d10 value = 6 } } }
  19. 10 = { ROOT = { set_variable = { which = ehof_rolled_d10 value = 7 } } }
  20. 10 = { ROOT = { set_variable = { which = ehof_rolled_d10 value = 8 } } }
  21. 10 = { ROOT = { set_variable = { which = ehof_rolled_d10 value = 9 } } }
  22. 10 = { ROOT = { set_variable = { which = ehof_rolled_d10 value = 10 } } }
  23. }
  24. set_variable = {
  25. which = ehof_acc_r1
  26. value = ehof_rolled_d10
  27. }
  28. if = {
  29. limit = { ehof_log_travel = yes }
  30. log = "EHOF: ehof_travel.80 >> Player rolled First Dice: got [this.ehof_acc_r1] from D10"
  31. }
  32. } else_if = {
  33. # EHOF Phase 2: D12
  34. limit = { active_ehof_is_phase_2 = yes }
  35. random_list = {
  36. 25 = {
  37. random_list = {
  38. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 1 } } }
  39. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 2 } } }
  40. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 3 } } }
  41. }
  42. }
  43. 25 = {
  44. random_list = {
  45. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 4 } } }
  46. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 5 } } }
  47. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 6 } } }
  48. }
  49. }
  50. 25 = {
  51. random_list = {
  52. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 7 } } }
  53. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 8 } } }
  54. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 9 } } }
  55. }
  56. }
  57. 25 = {
  58. random_list = {
  59. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 10 } } }
  60. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 11 } } }
  61. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 12 } } }
  62. }
  63. }
  64. }
  65. set_variable = {
  66. which = ehof_acc_r1
  67. value = ehof_rolled_d12
  68. }
  69. if = {
  70. limit = { ehof_log_travel = yes }
  71. log = "EHOF: ehof_travel.80 >> Player rolled First Dice: got [this.ehof_acc_r1] from D12"
  72. }
  73. } else_if = {
  74. # EHOF Phase 3: D20
  75. limit = { active_ehof_is_phase_3 = yes }
  76. random_list = {
  77. 50 = {
  78. random_list = {
  79. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 1 } } }
  80. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 5 } } }
  81. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 11 } } }
  82. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 15 } } }
  83. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 3 } } }
  84. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 7 } } }
  85. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 13 } } }
  86. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 17 } } }
  87. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 9 } } }
  88. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 19 } } }
  89. }
  90. }
  91. 50 = {
  92. random_list = {
  93. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 2 } } }
  94. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 6 } } }
  95. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 12 } } }
  96. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 16 } } }
  97. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 4 } } }
  98. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 8 } } }
  99. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 14 } } }
  100. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 18 } } }
  101. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 10 } } }
  102. 10 = { ROOT = { set_variable = { which = ehof_rolled_d20 value = 20 } } }
  103. }
  104. }
  105. }
  106. set_variable = {
  107. which = ehof_acc_r1
  108. value = ehof_rolled_d12
  109. }
  110. if = {
  111. limit = { ehof_log_travel = yes }
  112. log = "EHOF: ehof_travel.80 >> Player rolled First Dice: got [this.ehof_acc_r1] from D20"
  113. }
  114. }
  115.  
  116.  
  117. # Second Dice:
  118. # Player rolls a D12 which is modified by Targetted System's Accuracy Modifiers (sub-rolls):
  119. random_list = {
  120. 25 = {
  121. random_list = {
  122. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 4 } } }
  123. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 8 } } }
  124. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 12 } } }
  125. }
  126. }
  127. 25 = {
  128. random_list = {
  129. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 3 } } }
  130. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 7 } } }
  131. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 11 } } }
  132. }
  133. }
  134. 25 = {
  135. random_list = {
  136. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 2 } } }
  137. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 6 } } }
  138. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 10 } } }
  139. }
  140. }
  141. 25 = {
  142. random_list = {
  143. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 1 } } }
  144. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 5 } } }
  145. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 9 } } }
  146. }
  147. }
  148. }
  149. if = {
  150. limit = { ehof_log_travel = yes }
  151. log = "EHOF: ehof_travel.80 >> Player rolled Second Dice: got [this.ehof_rolled_d12] from D12"
  152. }
  153. set_variable = {
  154. which = ehof_modifiers
  155. value = 0
  156. }
  157. if = {
  158. limit = { ehof_is_target_black_hole = yes }
  159. if = {
  160. limit = { active_ehof_is_phase_1 = yes }
  161. set_variable = {
  162. which = ehof_modifiers
  163. value = 1
  164. }
  165. } else_if = {
  166. limit = { active_ehof_is_phase_2 = yes }
  167. set_variable = {
  168. which = ehof_modifiers
  169. value = 1
  170. }
  171. } else_if = {
  172. limit = { active_ehof_is_phase_3 = yes }
  173. set_variable = {
  174. which = ehof_modifiers
  175. value = 2
  176. }
  177. }
  178. } else_if = {
  179. limit = { ehof_is_target_neutron = yes }
  180. if = {
  181. limit = { active_ehof_is_phase_1 = yes }
  182. set_variable = {
  183. which = ehof_modifiers
  184. value = 1
  185. }
  186. } else_if = {
  187. limit = { active_ehof_is_phase_2 = yes }
  188. set_variable = {
  189. which = ehof_modifiers
  190. value = 1
  191. }
  192. } else_if = {
  193. limit = { active_ehof_is_phase_3 = yes }
  194. set_variable = {
  195. which = ehof_modifiers
  196. value = 2
  197. }
  198. }
  199. } else_if = {
  200. limit = { ehof_is_target_pulsar = yes }
  201. if = {
  202. limit = { active_ehof_is_phase_1 = yes }
  203. set_variable = {
  204. which = ehof_modifiers
  205. value = 1
  206. }
  207. } else_if = {
  208. limit = { active_ehof_is_phase_2 = yes }
  209. set_variable = {
  210. which = ehof_modifiers
  211. value = 1
  212. }
  213. } else_if = {
  214. limit = { active_ehof_is_phase_3 = yes }
  215. set_variable = {
  216. which = ehof_modifiers
  217. value = 2
  218. }
  219. }
  220. } else_if = {
  221. limit = { ehof_is_target_binary = yes }
  222. if = {
  223. limit = { active_ehof_is_phase_2 = yes }
  224. set_variable = {
  225. which = ehof_modifiers
  226. value = 0
  227. }
  228. } else_if = {
  229. limit = { active_ehof_is_phase_3 = yes }
  230. set_variable = {
  231. which = ehof_modifiers
  232. value = 1
  233. }
  234. }
  235. } else_if = {
  236. limit = { ehof_is_target_trinary = yes }
  237. if = {
  238. limit = { active_ehof_is_phase_2 = yes }
  239. set_variable = {
  240. which = ehof_modifiers
  241. value = 0
  242. }
  243. } else_if = {
  244. limit = { active_ehof_is_phase_3 = yes }
  245. set_variable = {
  246. which = ehof_modifiers
  247. value = 1
  248. }
  249. }
  250. } else_if = {
  251. limit = { ehof_is_target_red_giant = yes }
  252. if = {
  253. limit = { active_ehof_is_phase_2 = yes }
  254. set_variable = {
  255. which = ehof_modifiers
  256. value = -1
  257. }
  258. } else_if = {
  259. limit = { active_ehof_is_phase_3 = yes }
  260. set_variable = {
  261. which = ehof_modifiers
  262. value = 1
  263. }
  264. }
  265. } else_if = {
  266. limit = { ehof_is_target_white_blue = yes }
  267. if = {
  268. limit = { active_ehof_is_phase_3 = yes }
  269. set_variable = {
  270. which = ehof_modifiers
  271. value = 0
  272. }
  273. }
  274. } else_if = {
  275. limit = { ehof_is_target_blue = yes }
  276. if = {
  277. limit = { active_ehof_is_phase_3 = yes }
  278. set_variable = {
  279. which = ehof_modifiers
  280. value = 1
  281. }
  282. }
  283. } else_if = {
  284. limit = { ehof_is_target_yellow_white_dwarf = yes }
  285. if = {
  286. limit = { active_ehof_is_phase_3 = yes }
  287. set_variable = {
  288. which = ehof_modifiers
  289. value = -1
  290. }
  291. }
  292. } else_if = {
  293. limit = { ehof_is_target_yellow_dwarf = yes }
  294. if = {
  295. limit = { active_ehof_is_phase_3 = yes }
  296. set_variable = {
  297. which = ehof_modifiers
  298. value = -1
  299. }
  300. }
  301. } else_if = {
  302. limit = { ehof_is_target_orange_dwarf = yes }
  303. if = {
  304. limit = { active_ehof_is_phase_3 = yes }
  305. set_variable = {
  306. which = ehof_modifiers
  307. value = -2
  308. }
  309. }
  310. } else_if = {
  311. limit = { ehof_is_target_red_dwarf = yes }
  312. if = {
  313. limit = { active_ehof_is_phase_3 = yes }
  314. set_variable = {
  315. which = ehof_modifiers
  316. value = 0
  317. }
  318. }
  319. } else_if = {
  320. limit = { ehof_is_target_brown_dwarf = yes }
  321. if = {
  322. limit = { active_ehof_is_phase_3 = yes }
  323. set_variable = {
  324. which = ehof_modifiers
  325. value = -2
  326. }
  327. }
  328. } else_if = {
  329. limit = { ehof_is_target_wormhole_cohesive = yes }
  330. if = {
  331. limit = { active_ehof_is_phase_1 = yes }
  332. set_variable = {
  333. which = ehof_modifiers
  334. value = 2
  335. }
  336. } else_if = {
  337. limit = { active_ehof_is_phase_2 = yes }
  338. set_variable = {
  339. which = ehof_modifiers
  340. value = 2
  341. }
  342. } else_if = {
  343. limit = { active_ehof_is_phase_3 = yes }
  344. set_variable = {
  345. which = ehof_modifiers
  346. value = 3
  347. }
  348. }
  349. }
  350.  
  351. if = {
  352. limit = { NOT = { check_variable = { which = ehof_modifiers value = 0 } } }
  353. set_variable = {
  354. which = ehof_counter
  355. value = 0
  356. }
  357. set_variable = {
  358. which = ehof_modifier_var
  359. value = 0
  360. }
  361. if = {
  362. limit = { check_variable = { which = ehof_modifiers value < 0 } }
  363. while = {
  364. limit = { check_variable = { which = ehof_counter value > ehof_modifiers } }
  365. random_list = {
  366. 50 = {
  367. random_list = {
  368. 33 = { ROOT = { set_variable = { which = ehof_rolled_d6 value = -1 } } }
  369. 33 = { ROOT = { set_variable = { which = ehof_rolled_d6 value = -2 } } }
  370. 33 = { ROOT = { set_variable = { which = ehof_rolled_d6 value = -3 } } }
  371. }
  372. }
  373. 50 = {
  374. random_list = {
  375. 33 = { ROOT = { set_variable = { which = ehof_rolled_d6 value = -4 } } }
  376. 33 = { ROOT = { set_variable = { which = ehof_rolled_d6 value = -5 } } }
  377. 33 = { ROOT = { set_variable = { which = ehof_rolled_d6 value = -6 } } }
  378. }
  379. }
  380. }
  381. change_variable = {
  382. which = ehof_modifier_var
  383. value = ehof_rolled_d6
  384. }
  385. subtract_variable = {
  386. which = ehof_counter
  387. value = 1
  388. }
  389. if = {
  390. limit = { ehof_log_travel = yes }
  391. log = "EHOF: ehof_travel.80 >> Second Dice is modified by -[this.ehof_rolled_d12]"
  392. }
  393. }
  394. } else = {
  395. while = {
  396. limit = { check_variable = { which = ehof_counter value < ehof_modifiers } }
  397. random_list = {
  398. 50 = {
  399. random_list = {
  400. 33 = { ROOT = { set_variable = { which = ehof_rolled_d6 value = 1 } } }
  401. 33 = { ROOT = { set_variable = { which = ehof_rolled_d6 value = 2 } } }
  402. 33 = { ROOT = { set_variable = { which = ehof_rolled_d6 value = 3 } } }
  403. }
  404. }
  405. 50 = {
  406. random_list = {
  407. 33 = { ROOT = { set_variable = { which = ehof_rolled_d6 value = 4 } } }
  408. 33 = { ROOT = { set_variable = { which = ehof_rolled_d6 value = 5 } } }
  409. 33 = { ROOT = { set_variable = { which = ehof_rolled_d6 value = 6 } } }
  410. }
  411. }
  412. }
  413. change_variable = {
  414. which = ehof_modifier_var
  415. value = ehof_rolled_d6
  416. }
  417. change_variable = {
  418. which = ehof_counter
  419. value = 1
  420. }
  421. if = {
  422. limit = { ehof_log_travel = yes }
  423. log = "EHOF: ehof_travel.80 >> Second Dice is modified by +[this.ehof_rolled_d12]"
  424. }
  425. }
  426. }
  427. change_variable = {
  428. which = ehof_rolled_d12
  429. value = ehof_modifier_var
  430. }
  431. }
  432.  
  433. set_variable = {
  434. which = ehof_acc_r2
  435. value = ehof_rolled_d12
  436. }
  437. if = {
  438. limit = { ehof_log_travel = yes }
  439. log = "EHOF: ehof_travel.80 >> After modifiers Second Dice = [this.ehof_acc_r2]"
  440. }
  441.  
  442. # Third Dice:
  443. # Bonus RANDOM D12, rolled then modified by the Base Aiming modifier:
  444. random_list = {
  445. 25 = {
  446. random_list = {
  447. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 4 } } }
  448. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 8 } } }
  449. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 12 } } }
  450. }
  451. }
  452. 25 = {
  453. random_list = {
  454. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 3 } } }
  455. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 7 } } }
  456. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 11 } } }
  457. }
  458. }
  459. 25 = {
  460. random_list = {
  461. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 2 } } }
  462. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 6 } } }
  463. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 10 } } }
  464. }
  465. }
  466. 25 = {
  467. random_list = {
  468. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 1 } } }
  469. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 5 } } }
  470. 33 = { ROOT = { set_variable = { which = ehof_rolled_d12 value = 9 } } }
  471. }
  472. }
  473. }
  474. if = {
  475. limit = { ehof_log_travel = yes }
  476. log = "EHOF: ehof_travel.80 >> Player rolled Third Dice: got [this.ehof_rolled_d12] from d12"
  477. }
  478. set_variable = {
  479. which = ehof_modifier_var
  480. value = ehof_rolled_d12
  481. }
  482. if = {
  483. limit = { active_ehof_is_phase_1 = yes }
  484. multiply_variable = {
  485. which = ehof_modifier_var
  486. value = 0.02
  487. }
  488. } else_if = {
  489. limit = { active_ehof_is_phase_2 = yes }
  490. multiply_variable = {
  491. which = ehof_modifier_var
  492. value = 0.26
  493. }
  494. } else_if = {
  495. limit = { active_ehof_is_phase_3 = yes }
  496. multiply_variable = {
  497. which = ehof_modifier_var
  498. value = 0.54
  499. }
  500. }
  501. if = {
  502. limit = { ehof_log_travel = yes }
  503. log = "EHOF: ehof_travel.80 >> Third Dice is modified by +[this.ehof_modifier_var]"
  504. }
  505. change_variable = {
  506. which = ehof_rolled_d12
  507. value = ehof_modifier_var
  508. }
  509. set_variable = {
  510. which = ehof_acc_r3
  511. value = ehof_rolled_d12
  512. }
  513. if = {
  514. limit = { ehof_log_travel = yes }
  515. log = "EHOF: ehof_travel.80 >> After modifiers Third Dice = [this.ehof_acc_r3]"
  516. }
  517. set_variable = {
  518. which = ehof_acc_final
  519. value = 0
  520. }
  521.  
  522. change_variable = {
  523. which = ehof_acc_final
  524. value = ehof_acc_r1
  525. }
  526. change_variable = {
  527. which = ehof_acc_final
  528. value = ehof_acc_r2
  529. }
  530. change_variable = {
  531. which = ehof_acc_final
  532. value = ehof_acc_r3
  533. }
  534. if = {
  535. limit = { ehof_log_travel = yes }
  536. log = "EHOF: ehof_travel.80 >> Total of Dice: [this.ehof_acc_r1] + [this.ehof_acc_r2] + [this.ehof_acc_r3] = [this.ehof_acc_final]"
  537. }
  538.  
  539. @generation_threshold = 10.0
  540. @accuracy_threshold = 25.0
  541.  
  542. if = {
  543. limit = { check_variable = { which = ehof_acc_final value >= @generation_threshold } }
  544. # Wormhole is generated successfully
  545. if = {
  546. limit = { ehof_log_travel = yes }
  547. log = "EHOF: ehof_travel.80 >> [this.ehof_acc_final] meets generation threshold. Wormhole will be generated."
  548. }
  549. if = {
  550. limit = { check_variable = { which = ehof_acc_final value >= @accuracy_threshold } }
  551. # Wormhole is generated accurately
  552. if = {
  553. limit = { ehof_log_travel = yes }
  554. log = "EHOF: ehof_travel.80 >> [this.ehof_acc_final] meets accuracy threshold. Wormhole will be accurate to player's choice."
  555. }
  556. event_target:ehof_mega_active = { set_megastructure_flag = ehof_acc_true }
  557. } else = {
  558. # Wormhole selects a random destination
  559. if = {
  560. limit = { ehof_log_travel = yes }
  561. log = "EHOF: ehof_travel.80 >> [this.ehof_acc_final] does not meet accuracy threshold. Random destination will be chosen."
  562. }
  563. event_target:ehof_mega_active = { set_megastructure_flag = ehof_acc_false }
  564. }
  565. } else = {
  566. # Wormhole generation failure
  567. if = {
  568. limit = { ehof_log_travel = yes }
  569. log = "EHOF: ehof_travel.80 >> [this.ehof_acc_final] does not meet generation threshold. No wormhole will be generated."
  570. }
  571. event_target:ehof_mega_active = { set_megastructure_flag = ehof_wormhole_nogo }
  572. }
  573. }
  574. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement