Advertisement
Dekita

$D13x Core 1.2-

Mar 26th, 2013
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.35 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # ☆ $D13x - CORE
  4. # -- Author : Dekita
  5. # -- Version : 1.2
  6. # -- Level : Easy
  7. # -- Requires : N/A
  8. # -- Engine : RPG Maker VX Ace.
  9. #
  10. #===============================================================================
  11. # ☆ Import
  12. #-------------------------------------------------------------------------------
  13. $D13x={}if$D13x==nil
  14. $D13x[:CORE] = true
  15. #===============================================================================
  16. # ☆ Updates
  17. #-------------------------------------------------------------------------------
  18. # D /M /Y
  19. # 26/o3/2o13 - Compatibility, (Status Scene)
  20. # 18/03/2013 - Compatibility, (Skill Scene)
  21. # 23/o2/2o13 - Started, Finished,
  22. #
  23. #===============================================================================
  24. # ☆ Introduction
  25. #-------------------------------------------------------------------------------
  26. # This script simply holds some information and methods used by some other
  27. # scripts in the $D13x system, things like fonts, color, vocab..
  28. #
  29. # Place above all other $D13x Scripts.
  30. #
  31. #===============================================================================
  32. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  33. #===============================================================================
  34. # 1. You MUST give credit to "Dekita" !!
  35. # 2. You are NOT allowed to repost this script.(or modified versions)
  36. # 3. You are NOT allowed to convert this script.
  37. # 4. You are NOT allowed to use this script for Commercial games.
  38. # 5. ENJOY!
  39. #
  40. # "FINE PRINT"
  41. # By using this script you hereby agree to the above terms and conditions,
  42. # if any violation of the above terms occurs "legal action" may be taken.
  43. # Not understanding the above terms and conditions does NOT mean that
  44. # they do not apply to you.
  45. # If you wish to discuss the terms and conditions in further detail you can
  46. # contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
  47. #
  48. #===============================================================================
  49. # ☆ Instructions
  50. #-------------------------------------------------------------------------------
  51. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  52. # Place Above ALL Other $D13x Scripts.
  53. #
  54. #===============================================================================
  55. # ☆ Notetags
  56. #-------------------------------------------------------------------------------
  57. # <tcol: red, grn, blu>
  58. # use this notetag to change the color of the text shown in some of my
  59. # scenes.
  60. #
  61. #===============================================================================
  62. module Text_Color
  63. #===============================================================================
  64.  
  65. # White's
  66. Pure_White = Color.new(255,255,255)
  67. White = Color.new(222,222,222)
  68. Grey = Color.new(111,111,111)
  69. # Yellow's
  70. Yellow = Color.new(255,255,0)
  71. Gold = Color.new(212,212,64)
  72. Orange = Color.new(255,182,0)
  73. Deep_Orange = Color.new(212,64,0)
  74. Dirt_Orange = Color.new(182,64,0)
  75. Brown = Color.new(128,32,0)
  76. # Red's
  77. Red = Color.new(251,111,111)
  78. Deep_Red = Color.new(222,60,60)
  79. Pink = Color.new(255,0,255)
  80. Dark_Pink = Color.new(182,0,156)
  81. # Blue's
  82. Sky_Blue = Color.new(0,182,255)
  83. Light_Blue = Color.new(64,128,255)
  84. Dark_Blue = Color.new(32,64,255)
  85. Purple = Color.new(182,64,255)
  86. Magenta = Color.new(156,156,255)
  87. # Green's
  88. Green = Color.new(111,251,111)
  89. Candy_Green = Color.new(0,255,0)
  90. Dirty_Green = Color.new(128,182,0)
  91. Khaki_Green = Color.new(111,156,64)
  92. Turquoise = Color.new(0,255,182)
  93.  
  94. Default_Equip_Color = White
  95.  
  96. end
  97.  
  98. #==============================================================================
  99. module General
  100. #==============================================================================
  101.  
  102. Fonts = ["VL Gothic"]
  103. Font_Size = 18
  104. Font_Bold = false
  105.  
  106.  
  107. # Gauge = [ Color 1 , Color 2 ]
  108. Hp_Colors = [ Text_Color::Dirt_Orange , Text_Color::Gold ]
  109. Mp_Colors = [ Text_Color::Dark_Blue , Text_Color::Sky_Blue ]
  110. Exp_Color = [ Text_Color::White , Text_Color::Deep_Red ]
  111.  
  112. end
  113.  
  114. #==============================================================================
  115. module Vocab
  116. #==============================================================================
  117.  
  118. # Parameters ( overwrite )
  119. def self.param(param_id)
  120. case param_id
  121. when 0 then "Max HP" # "Health"
  122. when 1 then "Max MP" # "Will"
  123. when 2 then "Physical Attack" # "Attack"
  124. when 3 then "Physical Resist" # "Defence"
  125. when 4 then "Magical Attack" # "Magic"
  126. when 5 then "Magical Resist" # "Aura"
  127. when 6 then "Agility" # "Speed"
  128. when 7 then "Luck" # "Luck"
  129. end
  130. end
  131.  
  132. # X - Parameters ( new )
  133. def self.x_param(x_param_id)
  134. case x_param_id
  135. when 0 then "Accuracy"
  136. when 1 then "Evasion"
  137. when 2 then "Critical"
  138. when 3 then "Crit Eva"
  139. when 4 then "Mag Eva"
  140. when 5 then "Mag Ref"
  141. when 6 then "Counter"
  142. when 7 then "HP Regen"
  143. when 8 then "MP Regen"
  144. when 9 then "TP Regen"
  145. end
  146. end
  147.  
  148. # S - Parameters ( new )
  149. def self.s_param(s_param_id)
  150. case s_param_id
  151. when 0 then "Aggro"
  152. when 1 then "Guard"
  153. when 2 then "Recovery"
  154. when 3 then "Medicine"#Pharmacology
  155. when 4 then "MP Cost"
  156. when 5 then "TP Charge"
  157. when 6 then "P DMG Taken"
  158. when 7 then "M DMG Taken"
  159. when 8 then "Floor DMG"
  160. when 9 then "Exp Rate"
  161. end
  162. end
  163.  
  164. Attack_Speed = "Atk Speed"
  165.  
  166. Attack_Times = "Atks Per Turn"#"APT"
  167.  
  168. Skill_Type = "Skillset"
  169.  
  170. Skill = "Skills"
  171.  
  172. Equip_Type = "Equipable"
  173.  
  174. Action_Times = "Action Time"
  175.  
  176. # Specials ( new )
  177. def self.specials(id)
  178. case id
  179. when 0 then "Auto-Fight"
  180. when 1 then "Guard"
  181. when 2 then "Substitue"
  182. when 3 then "Preserve TP"
  183. end
  184. end
  185.  
  186. # Collapse Type ( new )
  187. def self.collapse_type(id)
  188. case id
  189. when 0 then "Boss"
  190. when 1 then "Instant"
  191. when 2 then "No Vanish"
  192. end
  193. end
  194.  
  195. # Party Ability ( new )
  196. def self.party_ability(id)
  197. case id
  198. when 0 then "Encounter ½"
  199. when 1 then "Encounter NA"
  200. when 2 then "No Surprise"
  201. when 3 then "Pre-Emptive +"
  202. when 4 then "Gold Double"
  203. when 5 then "Double Drops"
  204. end
  205. end
  206.  
  207. Fixed = "Fixed "
  208. Sealed = "Sealed "
  209. Slot_Type = "Slot Type"
  210. Dual_Slot = "Dual Wield"
  211. One__Slot = "Single"
  212.  
  213. # Vocab for Statistic Control Script
  214. LevelDown = "%s has fell back to %s %s!"
  215. ForgetSkill = "%s's requirements are no longer met!"
  216.  
  217. #####################
  218. # CUSTOMISATION END #
  219. end #####################
  220. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  221. # #
  222. # http://dekitarpg.wordpress.com/ #
  223. # #
  224. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  225. # The following code is protected under the 2013 Dekita Data Protection Act. #
  226. # Ie. The “Do Not Fucking Look” Law. #
  227. # Breaking This One And Only Rule May Result In The Following Side Effects : #
  228. # Eyes Bleeding, Nightmares, Severe Head Ache's AND A Scratch On Your Knee :p #
  229. # That is all ! #
  230. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  231. #===============================================================================#
  232. class Object
  233. #===============================================================================
  234. #-------------------------------------------------------------------------
  235. # rand_between
  236. #-------------------------------------------------------------------------
  237. def rand_between(min, max)
  238. min + rand(max - min + 1)
  239. end
  240.  
  241. end
  242.  
  243. #===============================================================================
  244. class Numeric
  245. #===============================================================================
  246. #---------------------------------------------------------------------------
  247. # To Float (with limited digits after decimal point)
  248. #---------------------------------------------------------------------------
  249. def to_flim(limit = 5, saftey = "0")
  250. str = self.to_f.to_s + saftey
  251. new_str = ""
  252. limit.times do |i|
  253. break if new_str =~ /[0-9].[0-9][0-9]/
  254. break if str[i] == nil
  255. new_str += str[i]
  256. end
  257. return new_str
  258. end
  259. #---------------------------------------------------------------------------
  260. # To A Percentage Of (num)
  261. #---------------------------------------------------------------------------
  262. def perc_of(num)
  263. self.to_f / num.to_f * 100.0
  264. end
  265. #---------------------------------------------------------------------------
  266. # Even ?
  267. #---------------------------------------------------------------------------
  268. def even?
  269. e = self.to_s
  270. e[e.size] == ("0"||"2"||"4"||"6"||"8")
  271. end
  272. #---------------------------------------------------------------------------
  273. # 0dd?
  274. #---------------------------------------------------------------------------
  275. def odd?
  276. o = self.to_s
  277. o[o.size] == ("1"||"3"||"5"||"7"||"9")
  278. end
  279.  
  280. end
  281.  
  282. #===============================================================================
  283. module DataManager
  284. #===============================================================================
  285. #---------------------------------------------------------------------------
  286. # Alias List
  287. #---------------------------------------------------------------------------
  288. class << self
  289. alias :lbd_unique_shits :load_database
  290. end
  291. #---------------------------------------------------------------------------
  292. # Load Database (alias)
  293. #---------------------------------------------------------------------------
  294. def self.load_database
  295. lbd_unique_shits
  296. loa_unique_shits
  297. end
  298. #---------------------------------------------------------------------------
  299. # Load Unique Shit
  300. #---------------------------------------------------------------------------
  301. def self.loa_unique_shits
  302. classes = [$data_weapons, $data_armors , $data_items , $data_skills ,
  303. $data_actors , $data_classes, $data_enemies, $data_states ]
  304. for g in classes
  305. for o in g
  306. next if o == nil
  307. o.load_unique_shit
  308. end
  309. end
  310. end
  311.  
  312. end # << DataManager
  313.  
  314. #===============================================================================
  315. class RPG::BaseItem
  316. #===============================================================================
  317. #--------------------------------------------------------------------------
  318. # Pi Variables
  319. #--------------------------------------------------------------------------
  320. attr_accessor :item_disp_color
  321. #--------------------------------------------------------------------------
  322. # Loads Unique Shit
  323. #--------------------------------------------------------------------------
  324. def load_unique_shit
  325. load_item_color
  326. # << For use in Child Classes
  327. end
  328. #---------------------------------------------------------------------------
  329. # Load Item Text Color
  330. #---------------------------------------------------------------------------
  331. def load_item_color
  332. @item_disp_color = Text_Color::Default_Equip_Color
  333. if self.note.match(/<tcol:(.*),(.*),(.*)>/i)
  334. @item_disp_color = Color.new($1.to_i,$2.to_i,$3.to_i)
  335. end
  336. end
  337. #--------------------------------------------------------------------------
  338. # Returns features for item filtered by code (credits Tsukihime)
  339. #--------------------------------------------------------------------------
  340. def feature_val(code)
  341. self.features.select {|ft| ft.code == code}
  342. end
  343. #--------------------------------------------------------------------------
  344. # Returns features for item filtered by code and data ID (credits Tsukihime)
  345. #--------------------------------------------------------------------------
  346. def feature_val_with_id(code, data_id)
  347. self.features.select {|ft| ft.code == code && ft.data_id == data_id}
  348. end
  349. #--------------------------------------------------------------------------
  350. # Returns sum of all features for item, by code and data ID (credits Tsukihime)
  351. #--------------------------------------------------------------------------
  352. def features_sum(code, data_id)
  353. feature_val_with_id(code, data_id).inject(0.0) {|r, ft| r += ft.value }
  354. end
  355. #--------------------------------------------------------------------------
  356. # Returns features pi
  357. #--------------------------------------------------------------------------
  358. def features_pi(code, data_id)
  359. feature_val_with_id(code, data_id).inject(1.0) {|r, ft| r *= ft.value }
  360. end
  361. #--------------------------------------------------------------------------
  362. # Calculate Set Sum of Features
  363. #--------------------------------------------------------------------------
  364. def features_set(code)
  365. feature_val(code).inject([]) {|r, ft| r |= [ft.data_id] }
  366. end
  367.  
  368. end # << RPG::BaseItem
  369.  
  370. #==============================================================================
  371. class Window_Base < Window
  372. #==============================================================================
  373. #--------------------------------------------------------------------------
  374. # Draw Gauge (w/height)
  375. #--------------------------------------------------------------------------
  376. def draw_deki_gauge(gx, gy, gw, gh, rate, color1, color2)
  377. empty_gauge_color = Color.new(0,0,0,128)
  378. fill_w = [(gw * rate).to_i, gw].min
  379. gauge_h = gh
  380. gauge_y = gy + line_height - 2 - gauge_h
  381. contents.fill_rect(gx, gauge_y, gw, gauge_h, empty_gauge_color)
  382. contents.gradient_fill_rect(gx, gauge_y, fill_w, gauge_h, color1, color2)
  383. end
  384. #--------------------------------------------------------------------------
  385. # Draw Hp
  386. #--------------------------------------------------------------------------
  387. def draw_de_hp(x, y)
  388. wid = self.width/2 - (standard_padding*2)
  389. rate = @actor.hp_rate
  390. color1 = General::Hp_Colors[0]
  391. color2 = General::Hp_Colors[1]
  392. draw_text(x, y, wid, line_height, Vocab::param(0))
  393. draw_text(x, y, wid-x-2, line_height, "#{@actor.hp}/#{@actor.mhp}",2)
  394. draw_deki_gauge(x, y, wid-x-2, 3, rate, color1, color2)
  395. end
  396. #--------------------------------------------------------------------------
  397. # Draw Mp
  398. #--------------------------------------------------------------------------
  399. def draw_de_mp(x, y)
  400. wid = self.width/2 - (standard_padding*2)
  401. rate = @actor.mp_rate
  402. color1 = General::Mp_Colors[0]
  403. color2 = General::Mp_Colors[1]
  404. draw_text(x, y, wid, line_height, Vocab::param(1))
  405. draw_text(x, y, wid-x-2, line_height, "#{@actor.mp}/#{@actor.mmp}",2)
  406. draw_deki_gauge(x, y, wid-x-2, 3, rate, color1, color2)
  407. end
  408. #--------------------------------------------------------------------------
  409. # Draw Exp (w/gauge)
  410. #--------------------------------------------------------------------------
  411. def draw_de_xp(x, y, gauge = true)
  412. s1 = @actor.current_level_exp
  413. s2 = @actor.next_level_exp
  414. s1_g = @actor.exp - @actor.current_level_exp
  415. s2_g = @actor.next_level_exp - @actor.current_level_exp
  416. wid = self.width/2 - (standard_padding*2)
  417. wid_b = self.width/2 - (standard_padding)
  418. rate = (s1_g).to_f / (s2_g)
  419. color1 = General::Exp_Color[0]
  420. color2 = General::Exp_Color[1]
  421. draw_text(wid_b, y, wid, line_height, "Exp:")
  422. draw_text(wid_b, y, wid-x-2, line_height, "#{s1}/#{s2}",2)
  423. draw_deki_gauge(wid_b, y, wid-x-2, 3, rate, color1, color2) if gauge
  424. end
  425.  
  426. end
  427.  
  428. #==============================================================================
  429. class Deki_Help < Window_Base
  430. #==============================================================================
  431. #--------------------------------------------------------------------------
  432. # Object Initialization
  433. #--------------------------------------------------------------------------
  434. def initialize(line_number = 2)
  435. super(0, 0, Graphics.width/4*3, fitting_height(line_number))
  436. @item = nil
  437. end
  438. #--------------------------------------------------------------------------
  439. # Set Text
  440. #--------------------------------------------------------------------------
  441. def set_text(text)
  442. if text != @text
  443. @text = text
  444. refresh
  445. end
  446. end
  447. #--------------------------------------------------------------------------
  448. # Clear
  449. #--------------------------------------------------------------------------
  450. def clear
  451. set_text("")
  452. end
  453. #--------------------------------------------------------------------------
  454. # Set Item , item : Skills and items etc.
  455. #--------------------------------------------------------------------------
  456. def set_item(item)
  457. return if @item == item
  458. @item = item
  459. refresh
  460. set_text(item ? item.description : "")
  461. end
  462. #--------------------------------------------------------------------------
  463. # Refresh
  464. #--------------------------------------------------------------------------
  465. def refresh
  466. contents.clear
  467. draw_text_ex(4, 0, @text)
  468. end
  469. #--------------------------------------------------------------------------
  470. # Reset Font Settings
  471. #--------------------------------------------------------------------------
  472. def reset_font_settings
  473. change_color(normal_color)
  474. self.contents.font.name = General::Fonts
  475. self.contents.font.size = General::Font_Size
  476. self.contents.font.bold = General::Font_Bold
  477. end
  478.  
  479. end
  480.  
  481. #==============================================================================#
  482. # http://dekitarpg.wordpress.com/ #
  483. #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement