Advertisement
Dekita

alignment 1.0

Apr 18th, 2014
817
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.74 KB | None | 0 0
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - Alignment
  5. # -- Author : Dekita
  6. # -- Version : 1.0
  7. # -- Level : Easy / Normal
  8. # -- Requires : N/A
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:Alignment]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # o4/o4/2o14 - Finished,
  21. # o3/o4/2o14 - Started
  22. #
  23. #===============================================================================
  24. # ☆ Introduction
  25. #-------------------------------------------------------------------------------
  26. # This script allows for actors to have their own individual 'alignment'.
  27. # Alignment can be changed by defeating enemies that have been notetagged to
  28. # give alignment points on death. There are also various script calls to use.
  29. #
  30. # Alignment can change various things about each actor. Including their stats,
  31. # image, face and skills.
  32. # The stats that can be changed are params, xparams, sparams, atk lvl, def lvl,
  33. # atk element, def element, parent stats, max tp. This all depends on what
  34. # scripts of mine you are using.
  35. #
  36. #===============================================================================
  37. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  38. #===============================================================================
  39. # 1. You MUST give credit to "Dekita" !!
  40. # 2. You are NOT allowed to repost this script.(or modified versions)
  41. # 3. You are NOT allowed to convert this script.
  42. # 4. You are NOT allowed to use this script for Commercial games.
  43. # 5. ENJOY!
  44. #
  45. # "FINE PRINT"
  46. # By using this script you hereby agree to the above terms and conditions,
  47. # if any violation of the above terms occurs "legal action" may be taken.
  48. # Not understanding the above terms and conditions does NOT mean that
  49. # they do not apply to you.
  50. # If you wish to discuss the terms and conditions in further detail you can
  51. # contact me at http://dekitarpg.wordpress.com/
  52. #
  53. #===============================================================================
  54. # ☆ Instructions
  55. #-------------------------------------------------------------------------------
  56. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  57. #
  58. #===============================================================================
  59. # ☆ Script Calls
  60. #-------------------------------------------------------------------------------
  61. # $game_actors[ACTOR_ID].alignment_setup(ID)
  62. # ^- Changes ACTOR_ID's alignment 'Setup' id to 'ID'
  63. #
  64. # $game_actors[ACTOR_ID].act_good(VAL)
  65. # $game_actors[ACTOR_ID].act_evil(VAL)
  66. # ^- Changes ACTOR_ID's alignment value by VAL
  67. #
  68. # $game_actors[ACTOR_ID].mod_alignment_rate(MOD_TYPE,VAL)
  69. # ^- Changes ACTOR_ID's alignment rate.
  70. # MOD_TYPE:
  71. # :set - sets the rate to VAL
  72. # :add - adds VAL onto current rate
  73. # :sub - subtracts VAL from current rate
  74. # :div - Divides current rate by VAL
  75. # :mul - multiplies current rate by VAL
  76. # :mod - current rate modulo(%) VAL
  77. #
  78. # $game_actors[ACTOR_ID].alignment
  79. # Returns the actors alignment object. Dont use unless you know how to.
  80. #
  81. #===============================================================================
  82. # ☆ HELP
  83. #-------------------------------------------------------------------------------
  84. # N/A
  85. #
  86. #===============================================================================
  87. module Alignment ; Setup=[] # << KEEP
  88. #===============================================================================
  89. #-----------------------------------------------------------------------------
  90. # If Mod_Charface is true, when an actor is fully good/evil thei character
  91. # image and face image will change.
  92. # The new char/face images must have the same name as the actors normal
  93. # char/face images. eg. if your charset and faceset are both called
  94. # 'Actor1', the script will check for 'Actor1_Evil' or 'Actor1_Good'
  95. # NOTE: If you do not have the images, this can cause errors.
  96. #-----------------------------------------------------------------------------
  97. Mod_Charface = false
  98. #-----------------------------------------------------------------------------
  99. # = [icon id, hue]
  100. #-----------------------------------------------------------------------------
  101. Good_Icon = [61,0]
  102. Evil_Icon = [62,0]
  103. Neut_Icon = [63,0]
  104. #-----------------------------------------------------------------------------
  105. # = ['text', text color]
  106. #-----------------------------------------------------------------------------
  107. Good_Text = ['Good',Text_Color::Sky_Blue]
  108. Evil_Text = ['Evil',Text_Color::Deep_Red]
  109. Neut_Text = ['Neutral',Text_Color::White]
  110. #-----------------------------------------------------------------------------
  111. # Show ? = [ ? , x, y]
  112. #-----------------------------------------------------------------------------
  113. Show_Icon = [true, 0, 0]
  114. Show_Text = [true, 26, 0]
  115. #-----------------------------------------------------------------------------
  116. # Enemy Notetags :
  117. # <align good: val>
  118. # <align evil: val>
  119. #-----------------------------------------------------------------------------
  120. Good_Pts_Note = /<align good:(.*)>/i
  121. Evil_Pts_Note = /<align evil:(.*)>/i
  122. #-----------------------------------------------------------------------------
  123. # Max value for both good/evil alignment.
  124. # If 100, there wil be a 200 value difference between good and evil.
  125. #-----------------------------------------------------------------------------
  126. Max_Value = 100
  127. #-----------------------------------------------------------------------------
  128. # Default Setup[ id ]
  129. #-----------------------------------------------------------------------------
  130. Default_Setup = 0
  131. #-----------------------------------------------------------------------------
  132. # Setup Help Info
  133. #-----------------------------------------------------------------------------
  134. # [:param , id, value],
  135. # [:x_param , id, value],
  136. # [:s_param , id, value],
  137. # [:atk_ele , id, value],
  138. # [:def_ele , id, value],
  139. # [:spds_stat , id, value]
  140. # [:atk_lvl , value],
  141. # [:def_lvl , value],
  142. # [:max_tp , value],
  143. # [:skill , id, alignment_req],
  144. #-----------------------------------------------------------------------------
  145. # Setup[ 0 ]
  146. #-----------------------------------------------------------------------------
  147. Setup[0]={
  148. :good => [
  149. [:def_lvl , 50],
  150. [:atk_ele , 9, 0.5],
  151. [:def_ele , 9, 0.5],
  152. [:atk_ele ,10,-0.5],
  153. [:def_ele ,10,-0.5],
  154. [:skill ,48, 50],
  155. [:max_tp , 100],
  156. ],
  157. :evil => [
  158. [:atk_lvl , 50],
  159. [:atk_ele ,10, 0.5],
  160. [:def_ele ,10, 0.5],
  161. [:atk_ele , 9,-0.5],
  162. [:def_ele , 9,-0.5],
  163. [:skill ,49, 50],
  164. [:max_tp , 100],
  165. ],
  166. }
  167. #-----------------------------------------------------------------------------
  168. # Setup[ 1 ]
  169. #-----------------------------------------------------------------------------
  170. Setup[1]={
  171. :good => [
  172. [:param , 0, 1000],
  173. [:param , 2, 100],
  174. [:param , 4, 100],
  175. ],
  176. :evil => [
  177. [:param , 1, 1000],
  178. [:param , 3, 100],
  179. [:param , 5, 100],
  180. ],
  181. }
  182. #-----------------------------------------------------------------------------
  183. # << Add more Setup[ id ]'s here.
  184. # Follow the same format as above.
  185. #-----------------------------------------------------------------------------
  186. #####################
  187. # CUSTOMISATION END #
  188. end #####################
  189. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  190. # #
  191. # http://dekitarpg.wordpress.com/ #
  192. # #
  193. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  194. #===============================================================================#
  195. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  196. # YES?\.\. #
  197. # OMG, REALLY? \| #
  198. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  199. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  200. #===============================================================================#
  201. module Vocanicon
  202. #===============================================================================
  203. #-----------------------------------------------------------------------------
  204. #
  205. #-----------------------------------------------------------------------------
  206. AGT = Alignment::Good_Text[0]
  207. AGC = Alignment::Good_Text[1]
  208. AGI = Alignment::Good_Icon[0]
  209. AGH = Alignment::Good_Icon[1]
  210. AET = Alignment::Evil_Text[0]
  211. AEC = Alignment::Evil_Text[1]
  212. AEI = Alignment::Evil_Icon[0]
  213. AEH = Alignment::Evil_Icon[1]
  214. ANT = Alignment::Neut_Text[0]
  215. ANC = Alignment::Neut_Text[1]
  216. ANI = Alignment::Neut_Icon[0]
  217. ANH = Alignment::Neut_Icon[1]
  218. #-----------------------------------------------------------------------------
  219. # [Nam,Col,icn,hue]
  220. #-----------------------------------------------------------------------------
  221. Align_Good = [AGT,AGC,AGI,AGH]
  222. Align_Evil = [AET,AEC,AEI,AEH]
  223. Align_Neut = [ANT,ANC,ANI,ANH]
  224. end
  225. #===============================================================================
  226. module DataManager
  227. #===============================================================================
  228. #-----------------------------------------------------------------------------
  229. #
  230. #-----------------------------------------------------------------------------
  231. class << self
  232. alias :lbd_alignment :load_database
  233. end
  234. #-----------------------------------------------------------------------------
  235. #
  236. #-----------------------------------------------------------------------------
  237. def self.load_database
  238. lbd_alignment
  239. loa_alignment
  240. end
  241. #-----------------------------------------------------------------------------
  242. #
  243. #-----------------------------------------------------------------------------
  244. def self.loa_alignment
  245. for o in $data_enemies
  246. next if o == nil
  247. o.load_alignment
  248. end
  249. end
  250. end # DataManager
  251. #===============================================================================
  252. class RPG::Enemy < RPG::BaseItem
  253. #===============================================================================
  254. #-----------------------------------------------------------------------------
  255. #
  256. #-----------------------------------------------------------------------------
  257. attr_accessor :good_align_pts
  258. attr_accessor :evil_align_pts
  259. #-----------------------------------------------------------------------------
  260. #
  261. #-----------------------------------------------------------------------------
  262. def load_alignment
  263. @good_align_pts=0
  264. @evil_align_pts=0
  265. self.note.split(/[\r\n]+/).each do |line|
  266. case line
  267. when Alignment::Good_Pts_Note then @good_align_pts = $1.to_i
  268. when Alignment::Evil_Pts_Note then @evil_align_pts = $1.to_i
  269. end
  270. end
  271. end
  272. end
  273. #===============================================================================
  274. class Battler_Alignment
  275. #===============================================================================
  276. #-----------------------------------------------------------------------------
  277. #
  278. #-----------------------------------------------------------------------------
  279. include Alignment
  280. #-----------------------------------------------------------------------------
  281. #
  282. #-----------------------------------------------------------------------------
  283. attr_accessor :setup
  284. attr_accessor :good_param
  285. attr_accessor :good_xparam
  286. attr_accessor :good_sparam
  287. attr_accessor :good_atk_ele
  288. attr_accessor :good_def_ele
  289. attr_accessor :good_atl_dfl
  290. attr_accessor :good_spds_stats
  291. attr_accessor :good_max_tp
  292. attr_accessor :good_skills
  293. attr_accessor :evil_param
  294. attr_accessor :evil_xparam
  295. attr_accessor :evil_sparam
  296. attr_accessor :evil_atk_ele
  297. attr_accessor :evil_def_ele
  298. attr_accessor :evil_atl_dfl
  299. attr_accessor :evil_spds_stats
  300. attr_accessor :evil_max_tp
  301. attr_accessor :evil_skills
  302. attr_accessor :total_param
  303. attr_accessor :total_xparam
  304. attr_accessor :total_sparam
  305. attr_accessor :total_atk_ele
  306. attr_accessor :total_def_ele
  307. attr_accessor :total_atl_dfl
  308. attr_accessor :total_spds_stats
  309. attr_accessor :total_max_tp
  310. attr_accessor :total_skills
  311. attr_accessor :default_character_name
  312. attr_accessor :default_character_index
  313. attr_accessor :default_face_name
  314. attr_accessor :default_face_index
  315. attr_accessor :rate
  316. #-----------------------------------------------------------------------------
  317. #
  318. #-----------------------------------------------------------------------------
  319. def initialize(id=Alignment::Default_Setup)
  320. reset(id)
  321. end
  322. #-----------------------------------------------------------------------------
  323. #
  324. #-----------------------------------------------------------------------------
  325. def reset(id)
  326. initialize_v(id)
  327. initialize_good
  328. initialize_evil
  329. initialize_total
  330. initialize_char_face
  331. setup_good
  332. setup_evil
  333. setup_total
  334. end
  335. #-----------------------------------------------------------------------------
  336. #
  337. #-----------------------------------------------------------------------------
  338. def initialize_v(id)
  339. @setup = Setup[id]
  340. @rate = 1.0
  341. end
  342. #-----------------------------------------------------------------------------
  343. #
  344. #-----------------------------------------------------------------------------
  345. def initialize_good
  346. @good_value = 0
  347. @good_param = [0] * 8
  348. @good_xparam = [0] * 10
  349. @good_sparam = [0] * 10
  350. @good_atk_ele = [0] * $data_system.elements.size
  351. @good_def_ele = [0] * $data_system.elements.size
  352. @good_atl_dfl = [0] * 2
  353. @good_spds_stats = [0] * 8
  354. @good_spds_stats = [0] * SPDS::Commands.size if $D13x[:ISPDS]
  355. @good_max_tp = 0
  356. @good_skills = []
  357. end
  358. #-----------------------------------------------------------------------------
  359. #
  360. #-----------------------------------------------------------------------------
  361. def initialize_evil
  362. @evil_value = 0
  363. @evil_param = [0] * 8
  364. @evil_xparam = [0] * 10
  365. @evil_sparam = [0] * 10
  366. @evil_atk_ele = [0] * $data_system.elements.size
  367. @evil_def_ele = [0] * $data_system.elements.size
  368. @evil_atl_dfl = [0] * 2
  369. @evil_spds_stats = [0] * 8
  370. @evil_spds_stats = [0] * SPDS::Commands.size if $D13x[:ISPDS]
  371. @evil_max_tp = 0
  372. @evil_skills = []
  373. end
  374. #-----------------------------------------------------------------------------
  375. #
  376. #-----------------------------------------------------------------------------
  377. def initialize_total
  378. @total_param = [0] * 8
  379. @total_xparam = [0] * 10
  380. @total_sparam = [0] * 10
  381. @total_atk_ele = [0] * $data_system.elements.size
  382. @total_def_ele = [0] * $data_system.elements.size
  383. @total_atl_dfl = [0] * 2
  384. @total_spds_stats = [0] * 8
  385. @total_spds_stats = [0] * SPDS::Commands.size if $D13x[:ISPDS]
  386. @total_max_tp = 0
  387. @total_skills = []
  388. end
  389. #-----------------------------------------------------------------------------
  390. #
  391. #-----------------------------------------------------------------------------
  392. def initialize_char_face
  393. @default_character_name = ''
  394. @default_character_index = 0
  395. @default_face_name = ''
  396. @default_face_index = 0
  397. @good_character_name = ''
  398. @good_character_index = 0
  399. @good_face_name = ''
  400. @good_face_index = 0
  401. @evil_character_name = ''
  402. @evil_character_index = 0
  403. @evil_face_name = ''
  404. @evil_face_index = 0
  405. end
  406. #-----------------------------------------------------------------------------
  407. #
  408. #-----------------------------------------------------------------------------
  409. def setup_good
  410. @setup[:good].each do |i|
  411. case i[0]
  412. when :param then @good_param [i[1]] = i[2] if $D13x[:Stats_Control]
  413. when :x_param then @good_xparam [i[1]] = i[2] if $D13x[:Stats_Control]
  414. when :s_param then @good_sparam [i[1]] = i[2] if $D13x[:Stats_Control]
  415. when :atk_ele then @good_atk_ele[i[1]] = i[2] if $D13x[:Elems_Control]
  416. when :def_ele then @good_def_ele[i[1]] = i[2] if $D13x[:Elems_Control]
  417. when :atk_lvl then @good_atl_dfl[0] = i[1] if $D13x[:Atk_Def_Lvs]
  418. when :def_lvl then @good_atl_dfl[1] = i[1] if $D13x[:Atk_Def_Lvs]
  419. when :spds_stat then @good_spds_stats[i[1]] = i[2] if $D13x[:ISPDS]
  420. when :max_tp then @good_max_tp = i[1] if $D13x[:TP_Control]
  421. when :skill then @good_skills << [i[1],i[2]]
  422. end
  423. end
  424. end
  425. #-----------------------------------------------------------------------------
  426. #
  427. #-----------------------------------------------------------------------------
  428. def setup_evil
  429. @setup[:evil].each do |i|
  430. case i[0]
  431. when :param then @evil_param [i[1]] = i[2] if $D13x[:Stats_Control]
  432. when :x_param then @evil_xparam [i[1]] = i[2] if $D13x[:Stats_Control]
  433. when :s_param then @evil_sparam [i[1]] = i[2] if $D13x[:Stats_Control]
  434. when :atk_ele then @evil_atk_ele[i[1]] = i[2] if $D13x[:Elems_Control]
  435. when :def_ele then @evil_def_ele[i[1]] = i[2] if $D13x[:Elems_Control]
  436. when :atk_lvl then @evil_atl_dfl[0] = i[1] if $D13x[:Atk_Def_Lvs]
  437. when :def_lvl then @evil_atl_dfl[1] = i[1] if $D13x[:Atk_Def_Lvs]
  438. when :spds_stat then @evil_spds_stats[i[1]] = i[2] if $D13x[:ISPDS]
  439. when :max_tp then @evil_max_tp = i[1] if $D13x[:TP_Control]
  440. when :skill then @evil_skills << [i[1],i[2]]
  441. end
  442. end
  443. end
  444. #-----------------------------------------------------------------------------
  445. #
  446. #-----------------------------------------------------------------------------
  447. def setup_total
  448. setup_total_param
  449. setup_total_xparam
  450. setup_total_sparam
  451. setup_total_atk_ele
  452. setup_total_def_ele
  453. setup_total_atl_dfl
  454. setup_total_spds_stats
  455. setup_total_max_tp
  456. setup_total_skills
  457. end
  458. #-----------------------------------------------------------------------------
  459. #
  460. #-----------------------------------------------------------------------------
  461. def setup_total_param
  462. m = max_value
  463. g = good_value
  464. e = evil_value
  465. 8.times do |i|
  466. par = g > 0 ? ((@good_param[i]/m)*g) : ((@evil_param[i]/m)*e)
  467. @total_param[i] = par.to_i
  468. end
  469. end
  470. #-----------------------------------------------------------------------------
  471. #
  472. #-----------------------------------------------------------------------------
  473. def setup_total_xparam
  474. m = max_value
  475. g = good_value
  476. e = evil_value
  477. 10.times do |i|
  478. par = g > 0 ? ((@good_xparam[i]/m)*g) : ((@evil_xparam[i]/m)*e)
  479. @total_xparam[i] = par.to_f
  480. end
  481. end
  482. #-----------------------------------------------------------------------------
  483. #
  484. #-----------------------------------------------------------------------------
  485. def setup_total_sparam
  486. m = max_value
  487. g = good_value
  488. e = evil_value
  489. 10.times do |i|
  490. par = g > 0 ? ((@good_sparam[i]/m)*g) : ((@evil_sparam[i]/m)*e)
  491. @total_sparam[i] = par.to_f
  492. end
  493. end
  494. #-----------------------------------------------------------------------------
  495. #
  496. #-----------------------------------------------------------------------------
  497. def setup_total_atk_ele
  498. m = max_value
  499. g = good_value
  500. e = evil_value
  501. @total_atk_ele.size.times do |i|
  502. par = g > 0 ? ((@good_atk_ele[i]/m)*g) : ((@evil_atk_ele[i]/m)*e)
  503. @total_atk_ele[i] = par.to_f
  504. end
  505. end
  506. #-----------------------------------------------------------------------------
  507. #
  508. #-----------------------------------------------------------------------------
  509. def setup_total_def_ele
  510. m = max_value
  511. g = good_value
  512. e = evil_value
  513. @total_def_ele.size.times do |i|
  514. p @good_def_ele[i]/m*g
  515. par = g > 0 ? ((@good_def_ele[i]/m)*g) : ((@evil_def_ele[i]/m)*e)
  516. @total_def_ele[i] = par.to_f
  517. end
  518. p @total_def_ele
  519. end
  520. #-----------------------------------------------------------------------------
  521. #
  522. #-----------------------------------------------------------------------------
  523. def setup_total_atl_dfl
  524. m = max_value
  525. g = good_value
  526. e = evil_value
  527. 2.times do |i|
  528. par = g > 0 ? ((@good_atl_dfl[i]/m)*g) : ((@evil_atl_dfl[i]/m)*e)
  529. @total_atl_dfl[i] = par.to_i
  530. end
  531. end
  532. #-----------------------------------------------------------------------------
  533. #
  534. #-----------------------------------------------------------------------------
  535. def setup_total_spds_stats
  536. m = max_value
  537. g = good_value
  538. e = evil_value
  539. @total_spds_stats.size.times do |i|
  540. par = g > 0 ? ((@good_spds_stats[i]/m)*g) : ((@evil_spds_stats[i]/m)*e)
  541. @total_spds_stats[i] = par.to_i
  542. end
  543. end
  544. #-----------------------------------------------------------------------------
  545. #
  546. #-----------------------------------------------------------------------------
  547. def setup_total_max_tp
  548. m = max_value
  549. g = good_value
  550. e = evil_value
  551. par = g > 0 ? ((@good_max_tp/m)*g) : ((@evil_max_tp/m)*e)
  552. @total_max_tp = par.to_i
  553. end
  554. #-----------------------------------------------------------------------------
  555. #
  556. #-----------------------------------------------------------------------------
  557. def setup_total_skills
  558. m = max_value
  559. g = good_value
  560. e = evil_value
  561. clone_good(m,g)
  562. clone_evil(m,e)
  563. end
  564. #-----------------------------------------------------------------------------
  565. #
  566. #-----------------------------------------------------------------------------
  567. def clone_good(m,g)
  568. @good_skills.each do |s|
  569. @total_skills << s[0] if g >= s[1]
  570. end
  571. end
  572. #-----------------------------------------------------------------------------
  573. #
  574. #-----------------------------------------------------------------------------
  575. def clone_evil(m,e)
  576. @evil_skills.each do |s|
  577. @total_skills << s[0] if e >= s[1]
  578. end
  579. end
  580. #-----------------------------------------------------------------------------
  581. #
  582. #-----------------------------------------------------------------------------
  583. def refresh
  584. initialize_total
  585. setup_total
  586. end
  587. #-----------------------------------------------------------------------------
  588. #
  589. #-----------------------------------------------------------------------------
  590. def max_value
  591. Alignment::Max_Value
  592. end
  593. #-----------------------------------------------------------------------------
  594. #
  595. #-----------------------------------------------------------------------------
  596. def good_value
  597. return 0 if @evil_value >= max_value
  598. return @good_value
  599. end
  600. #-----------------------------------------------------------------------------
  601. #
  602. #-----------------------------------------------------------------------------
  603. def evil_value
  604. return 0 if @good_value >= max_value
  605. return @evil_value
  606. end
  607. #-----------------------------------------------------------------------------
  608. #
  609. #-----------------------------------------------------------------------------
  610. def is_good?
  611. return false if @evil_value > 0
  612. return true if @good_value > 0
  613. return false
  614. end
  615. #-----------------------------------------------------------------------------
  616. #
  617. #-----------------------------------------------------------------------------
  618. def is_evil?
  619. return false if @good_value > 0
  620. return true if @evil_value > 0
  621. return false
  622. end
  623. #-----------------------------------------------------------------------------
  624. #
  625. #-----------------------------------------------------------------------------
  626. def is_max_good?
  627. return true if is_good? && (good_value >= max_value)
  628. return false
  629. end
  630. #-----------------------------------------------------------------------------
  631. #
  632. #-----------------------------------------------------------------------------
  633. def is_max_evil?
  634. return true if is_evil? && (evil_value >= max_value)
  635. return false
  636. end
  637. #-----------------------------------------------------------------------------
  638. #
  639. #-----------------------------------------------------------------------------
  640. def is_neutral?
  641. return true if @good_value == 0 && @evil_value == 0
  642. return false
  643. end
  644. #-----------------------------------------------------------------------------
  645. #
  646. #-----------------------------------------------------------------------------
  647. def act_good(str=1,ref=true)
  648. @good_value += str if @evil_value == 0
  649. @good_value = max_value if @good_value > max_value
  650. @evil_value -= str
  651. @evil_value = 0 if @evil_value < 0
  652. refresh if ref
  653. end
  654. #-----------------------------------------------------------------------------
  655. #
  656. #-----------------------------------------------------------------------------
  657. def act_evil(str=1,ref=true)
  658. @evil_value += str if @good_value == 0
  659. @evil_value = max_value if @evil_value > max_value
  660. @good_value -= str
  661. @good_value = 0 if @good_value < 0
  662. refresh if ref
  663. end
  664. #-----------------------------------------------------------------------------
  665. #
  666. #-----------------------------------------------------------------------------
  667. def setup_char_face(came='',cind=0,fame='',find=0)
  668. return unless can_default_charname?
  669. @default_character_name = came
  670. @default_character_index = cind
  671. @default_face_name = fame
  672. @default_face_index = find
  673. end
  674. #-----------------------------------------------------------------------------
  675. #
  676. #-----------------------------------------------------------------------------
  677. def current_char_face
  678. return set_good_charface if good_value == max_value
  679. return set_evil_charface if evil_value == max_value
  680. return set_neutral_charface
  681. end
  682. #-----------------------------------------------------------------------------
  683. #
  684. #-----------------------------------------------------------------------------
  685. def set_good_charface
  686. return set_neutral_charface unless Mod_Charface
  687. a = @default_character_name+'_Good'
  688. b = @default_character_index
  689. c = @default_face_name+'_Good'
  690. d = @default_face_index
  691. return [a,b,c,d]
  692. end
  693. #-----------------------------------------------------------------------------
  694. #
  695. #-----------------------------------------------------------------------------
  696. def set_evil_charface
  697. return set_neutral_charface unless Mod_Charface
  698. a = @default_character_name+'_Evil'
  699. b = @default_character_index
  700. c = @default_face_name+'_Evil'
  701. d = @default_face_index
  702. return [a,b,c,d]
  703. end
  704. #-----------------------------------------------------------------------------
  705. #
  706. #-----------------------------------------------------------------------------
  707. def set_neutral_charface
  708. a = @default_character_name
  709. b = @default_character_index
  710. c = @default_face_name
  711. d = @default_face_index
  712. return [a,b,c,d]
  713. end
  714. #-----------------------------------------------------------------------------
  715. #
  716. #-----------------------------------------------------------------------------
  717. def can_default_charname?
  718. return true if @default_character_name = ''
  719. return false
  720. end
  721. end
  722. #===============================================================================
  723. module Game_Battler_Alignment
  724. #===============================================================================
  725. #-----------------------------------------------------------------------------
  726. #
  727. #-----------------------------------------------------------------------------
  728. attr_reader :alignment
  729. #-----------------------------------------------------------------------------
  730. #
  731. #-----------------------------------------------------------------------------
  732. def setup_alignment
  733. @alignment = Battler_Alignment.new
  734. end
  735. #-----------------------------------------------------------------------------
  736. #
  737. #-----------------------------------------------------------------------------
  738. def alignment_setup(id)
  739. return unless Alignment::Setup[id]
  740. @alignment.reset(id)
  741. end
  742. #-----------------------------------------------------------------------------
  743. #
  744. #-----------------------------------------------------------------------------
  745. def act_good(str=1)
  746. @alignment.act_good(str*alignment_pts_rate)
  747. end
  748. #-----------------------------------------------------------------------------
  749. #
  750. #-----------------------------------------------------------------------------
  751. def act_evil(str=1)
  752. @alignment.act_evil(str*alignment_pts_rate)
  753. end
  754. #-----------------------------------------------------------------------------
  755. #
  756. #-----------------------------------------------------------------------------
  757. def alignment_pts_rate
  758. @alignment.rate
  759. end
  760. #-----------------------------------------------------------------------------
  761. #
  762. #-----------------------------------------------------------------------------
  763. def refresh_alignement
  764. @alignment.refresh
  765. end
  766. #-----------------------------------------------------------------------------
  767. #
  768. #-----------------------------------------------------------------------------
  769. def alignment_param(id)
  770. @alignment.total_param[id]
  771. end
  772. #-----------------------------------------------------------------------------
  773. #
  774. #-----------------------------------------------------------------------------
  775. def alignment_xparam(id)
  776. @alignment.total_xparam[id]
  777. end
  778. #-----------------------------------------------------------------------------
  779. #
  780. #-----------------------------------------------------------------------------
  781. def alignment_sparam(id)
  782. @alignment.total_sparam[id]
  783. end
  784. #-----------------------------------------------------------------------------
  785. #
  786. #-----------------------------------------------------------------------------
  787. def alignment_def_ele(id)
  788. @alignment.total_def_ele[id]
  789. end
  790. #-----------------------------------------------------------------------------
  791. #
  792. #-----------------------------------------------------------------------------
  793. def alignment_atk_ele(id)
  794. @alignment.total_atk_ele[id]
  795. end
  796. #-----------------------------------------------------------------------------
  797. #
  798. #-----------------------------------------------------------------------------
  799. def alignment_atl_dfl(id)
  800. @alignment.total_atl_dfl[id]
  801. end
  802. #-----------------------------------------------------------------------------
  803. #
  804. #-----------------------------------------------------------------------------
  805. def alignment_spds_stats(id)
  806. @alignment.total_spds_stats[id]
  807. end
  808. #-----------------------------------------------------------------------------
  809. #
  810. #-----------------------------------------------------------------------------
  811. def alignment_max_tp
  812. @alignment.total_max_tp
  813. end
  814. end
  815. #===============================================================================
  816. module Game_Actor_Alignment
  817. #===============================================================================
  818. #-----------------------------------------------------------------------------
  819. #
  820. #-----------------------------------------------------------------------------
  821. include Game_Battler_Alignment
  822. #-----------------------------------------------------------------------------
  823. #
  824. #-----------------------------------------------------------------------------
  825. def set_alignment_graphic
  826. came = @character_name
  827. cind = @character_index
  828. fame = @face_name
  829. find = @face_index
  830. @alignment.setup_char_face(came,cind,fame,find)
  831. end
  832. #-----------------------------------------------------------------------------
  833. #
  834. #-----------------------------------------------------------------------------
  835. def refresh_alignment_graphic
  836. return unless Alignment::Mod_Charface
  837. data = @alignment.current_char_face
  838. came = data[0]
  839. cind = data[1]
  840. fame = data[2]
  841. find = data[3]
  842. set_graphic(came,cind,fame,find)
  843. end
  844. #-----------------------------------------------------------------------------
  845. #
  846. #-----------------------------------------------------------------------------
  847. def alignment_skills
  848. @alignment.total_skills.sort.collect{|id| $data_skills[id]}
  849. end
  850. #-----------------------------------------------------------------------------
  851. #
  852. #-----------------------------------------------------------------------------
  853. def mod_alignment_rate(mod,val)
  854. case mod
  855. when :set then @alignment.rate = val
  856. when :add then @alignment.rate = @alignment.rate+val
  857. when :sub then @alignment.rate = @alignment.rate-val
  858. when :div then @alignment.rate = @alignment.rate/val
  859. when :mul then @alignment.rate = @alignment.rate*val
  860. when :mod then @alignment.rate = @alignment.rate%val
  861. end
  862. end
  863. end
  864. #===============================================================================
  865. class Game_Actor < Game_Battler
  866. #===============================================================================
  867. #-----------------------------------------------------------------------------
  868. #
  869. #-----------------------------------------------------------------------------
  870. include Game_Actor_Alignment
  871. #-----------------------------------------------------------------------------
  872. #
  873. #-----------------------------------------------------------------------------
  874. alias :alignment_init :initialize
  875. alias :parp_alignment :param_plus
  876. alias :xpar_alignment :xparam_plus if $D13x[:Stats_Control]
  877. alias :spar_alignment :sparam_plus if $D13x[:Stats_Control]
  878. alias :atke_alignment :atk_ele_plus if $D13x[:Elems_Control]
  879. alias :defe_alignment :def_ele_plus if $D13x[:Elems_Control]
  880. alias :atdf_alignment :atl_dfl_plus if $D13x[:Atk_Def_Lvs]
  881. alias :spds_alignment :spds_plus if $D13x[:ISPDS]
  882. alias :max_tp_plusali :max_tp_plus if $D13x[:TP_Control]
  883. alias :alignment_skills_alias :skills
  884. alias :align_refresh :refresh
  885. #-----------------------------------------------------------------------------
  886. #
  887. #-----------------------------------------------------------------------------
  888. def initialize(*args,&block)
  889. setup_alignment
  890. alignment_init(*args,&block)
  891. end
  892. #-----------------------------------------------------------------------------
  893. #
  894. #-----------------------------------------------------------------------------
  895. def refresh
  896. align_refresh
  897. refresh_alignment_graphic
  898. end
  899. #-----------------------------------------------------------------------------
  900. # Get Added Value of Parameter
  901. #-----------------------------------------------------------------------------
  902. def param_plus(param_id)
  903. parp_alignment(param_id) + alignment_param(param_id)
  904. end
  905. if $D13x[:Stats_Control]
  906. #---------------------------------------------------------------------------
  907. # Get Added Value of x-Parameter
  908. #---------------------------------------------------------------------------
  909. def xparam_plus(xparam_id)
  910. xpar_alignment(xparam_id) + alignment_xparam(xparam_id)
  911. end
  912. #---------------------------------------------------------------------------
  913. # Get Added Value of s-Parameter
  914. #---------------------------------------------------------------------------
  915. def sparam_plus(sparam_id)
  916. spar_alignment(sparam_id) + alignment_sparam(sparam_id)
  917. end
  918. end # if $D13x[:Stats_Control]
  919. if $D13x[:Elems_Control]
  920. #---------------------------------------------------------------------------
  921. # Get Added Value of def-Element
  922. #---------------------------------------------------------------------------
  923. def def_ele_plus(element_id)
  924. defe_alignment(element_id) + alignment_def_ele(element_id)
  925. end
  926. #---------------------------------------------------------------------------
  927. # Get Added Value of atk-Element
  928. #---------------------------------------------------------------------------
  929. def atk_ele_plus(element_id)
  930. atke_alignment(element_id) + alignment_atk_ele(element_id)
  931. end
  932. end # if $D13x[:Elems_Control]
  933. if $D13x[:Atk_Def_Lvs]
  934. #---------------------------------------------------------------------------
  935. # Atk Lv | Def Lv ++
  936. #---------------------------------------------------------------------------
  937. def atl_dfl_plus(id)
  938. atdf_alignment(id) + alignment_atl_dfl(id)
  939. end
  940. end # if $D13x[:Atk_Def_Lvs]
  941. if $D13x[:ISPDS]
  942. #---------------------------------------------------------------------------
  943. # Get SPDS Stats Plus
  944. #---------------------------------------------------------------------------
  945. def spds_plus(id)
  946. spds_alignment(id) + alignment_spds_stats(id)
  947. end
  948. end # if $D13x[:ISPDS]
  949. if $D13x[:TP_Control]
  950. #---------------------------------------------------------------------------
  951. # Atk Lv | Def Lv ++
  952. #---------------------------------------------------------------------------
  953. def max_tp_plus
  954. max_tp_plusali + alignment_max_tp
  955. end
  956. end # if $D13x[:TP_Control]
  957. #-----------------------------------------------------------------------------
  958. # Get Skill Object Array
  959. #-----------------------------------------------------------------------------
  960. def skills
  961. alignment_skills_alias + alignment_skills
  962. end
  963. end
  964. #==============================================================================
  965. class Game_Enemy < Game_Battler
  966. #==============================================================================
  967. #-----------------------------------------------------------------------------
  968. #
  969. #-----------------------------------------------------------------------------
  970. def good_align_on_die
  971. return enemy.good_align_pts
  972. end
  973. #-----------------------------------------------------------------------------
  974. #
  975. #-----------------------------------------------------------------------------
  976. def evil_align_on_die
  977. return enemy.evil_align_pts
  978. end
  979. end
  980. #===============================================================================
  981. class Game_Troop < Game_Unit
  982. #===============================================================================
  983. #-----------------------------------------------------------------------------
  984. #
  985. #-----------------------------------------------------------------------------
  986. def good_align_total
  987. dead_members.inject(0) {|r, enemy| r += enemy.good_align_on_die }
  988. end
  989. #-----------------------------------------------------------------------------
  990. #
  991. #-----------------------------------------------------------------------------
  992. def evil_align_total
  993. dead_members.inject(0) {|r, enemy| r += enemy.evil_align_on_die }
  994. end
  995. end
  996. #===============================================================================
  997. class Window_Base < Window
  998. #===============================================================================
  999. #-----------------------------------------------------------------------------
  1000. #
  1001. #-----------------------------------------------------------------------------
  1002. alias :draw_alignment_at_face :draw_actor_face
  1003. #-----------------------------------------------------------------------------
  1004. #
  1005. #-----------------------------------------------------------------------------
  1006. def draw_actor_face(actor, x, y, enabled = true)
  1007. draw_alignment_at_face(actor,x,y,enabled)
  1008. draw_align_at_face(actor,x,y,enabled)
  1009. end
  1010. #-----------------------------------------------------------------------------
  1011. #
  1012. #-----------------------------------------------------------------------------
  1013. def draw_align_at_face(actor,x,y,enabled)
  1014. return unless actor
  1015. data = Vocanicon::Align_Neut
  1016. data = Vocanicon::Align_Good if actor.alignment.is_max_good?
  1017. data = Vocanicon::Align_Evil if actor.alignment.is_max_evil?
  1018. text = data[0]
  1019. colo = data[1]
  1020. icon = data[2]
  1021. ihue = data[3]
  1022. if Alignment::Show_Icon[0]
  1023. nx = x+Alignment::Show_Icon[1]
  1024. ny = y+Alignment::Show_Icon[2]
  1025. draw_de_icon(icon,nx,ny,ihue,enabled)
  1026. end
  1027. if Alignment::Show_Text[0]
  1028. nx = x+Alignment::Show_Text[1]
  1029. ny = y+Alignment::Show_Text[2]
  1030. change_color(colo)
  1031. draw_text(nx,ny,96,line_height,text)
  1032. end
  1033. change_color(Text_Color::White)
  1034. end
  1035. end
  1036. #==============================================================================#
  1037. # http://dekitarpg.wordpress.com/ #
  1038. #==============================================================================#
  1039. end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement