Advertisement
Dekita

$D13x Core 1.2

Mar 26th, 2013
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.14 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. # Loads Unique Shit
  319. #--------------------------------------------------------------------------
  320. def load_unique_shit
  321. load_item_color
  322. # << For use in Child Classes
  323. end
  324. #---------------------------------------------------------------------------
  325. # Load Item Text Color
  326. #---------------------------------------------------------------------------
  327. def load_item_color
  328. @item_disp_color = Text_Color::Default_Equip_Color
  329. if self.note.match(/<tcol:(.*),(.*),(.*)>/i)
  330. @item_disp_color = Color.new($1.to_i,$2.to_i,$3.to_i)
  331. end
  332. end
  333. #--------------------------------------------------------------------------
  334. # Returns features for item filtered by code (credits Tsukihime)
  335. #--------------------------------------------------------------------------
  336. def feature_val(code)
  337. self.features.select {|ft| ft.code == code}
  338. end
  339. #--------------------------------------------------------------------------
  340. # Returns features for item filtered by code and data ID (credits Tsukihime)
  341. #--------------------------------------------------------------------------
  342. def feature_val_with_id(code, data_id)
  343. self.features.select {|ft| ft.code == code && ft.data_id == data_id}
  344. end
  345. #--------------------------------------------------------------------------
  346. # Returns sum of all features for item, by code and data ID (credits Tsukihime)
  347. #--------------------------------------------------------------------------
  348. def features_sum(code, data_id)
  349. feature_val_with_id(code, data_id).inject(0.0) {|r, ft| r += ft.value }
  350. end
  351. #--------------------------------------------------------------------------
  352. # Returns features pi
  353. #--------------------------------------------------------------------------
  354. def features_pi(code, data_id)
  355. feature_val_with_id(code, data_id).inject(1.0) {|r, ft| r *= ft.value }
  356. end
  357. #--------------------------------------------------------------------------
  358. # Calculate Set Sum of Features
  359. #--------------------------------------------------------------------------
  360. def features_set(code)
  361. feature_val(code).inject([]) {|r, ft| r |= [ft.data_id] }
  362. end
  363.  
  364. end # << RPG::BaseItem
  365.  
  366. #==============================================================================
  367. class Window_Base < Window
  368. #==============================================================================
  369. #--------------------------------------------------------------------------
  370. # Draw Gauge (w/height)
  371. #--------------------------------------------------------------------------
  372. def draw_deki_gauge(gx, gy, gw, gh, rate, color1, color2)
  373. empty_gauge_color = Color.new(0,0,0,128)
  374. fill_w = [(gw * rate).to_i, gw].min
  375. gauge_h = gh
  376. gauge_y = gy + line_height - 2 - gauge_h
  377. contents.fill_rect(gx, gauge_y, gw, gauge_h, empty_gauge_color)
  378. contents.gradient_fill_rect(gx, gauge_y, fill_w, gauge_h, color1, color2)
  379. end
  380. #--------------------------------------------------------------------------
  381. # Draw Hp
  382. #--------------------------------------------------------------------------
  383. def draw_de_hp(x, y)
  384. wid = self.width/2 - (standard_padding*2)
  385. rate = @actor.hp_rate
  386. color1 = General::Hp_Colors[0]
  387. color2 = General::Hp_Colors[1]
  388. draw_text(x, y, wid, line_height, Vocab::param(0))
  389. draw_text(x, y, wid-x-2, line_height, "#{@actor.hp}/#{@actor.mhp}",2)
  390. draw_deki_gauge(x, y, wid-x-2, 3, rate, color1, color2)
  391. end
  392. #--------------------------------------------------------------------------
  393. # Draw Mp
  394. #--------------------------------------------------------------------------
  395. def draw_de_mp(x, y)
  396. wid = self.width/2 - (standard_padding*2)
  397. rate = @actor.mp_rate
  398. color1 = General::Mp_Colors[0]
  399. color2 = General::Mp_Colors[1]
  400. draw_text(x, y, wid, line_height, Vocab::param(1))
  401. draw_text(x, y, wid-x-2, line_height, "#{@actor.mp}/#{@actor.mmp}",2)
  402. draw_deki_gauge(x, y, wid-x-2, 3, rate, color1, color2)
  403. end
  404. #--------------------------------------------------------------------------
  405. # Draw Exp (w/gauge)
  406. #--------------------------------------------------------------------------
  407. def draw_de_xp(x, y, gauge = true)
  408. s1 = @actor.current_level_exp
  409. s2 = @actor.next_level_exp
  410. s1_g = @actor.exp - @actor.current_level_exp
  411. s2_g = @actor.next_level_exp - @actor.current_level_exp
  412. wid = self.width/2 - (standard_padding*2)
  413. wid_b = self.width/2 - (standard_padding)
  414. rate = (s1_g).to_f / (s2_g)
  415. color1 = General::Exp_Color[0]
  416. color2 = General::Exp_Color[1]
  417. draw_text(wid_b, y, wid, line_height, "Exp:")
  418. draw_text(wid_b, y, wid-x-2, line_height, "#{s1}/#{s2}",2)
  419. draw_deki_gauge(wid_b, y, wid-x-2, 3, rate, color1, color2) if gauge
  420. end
  421.  
  422. end
  423.  
  424. #==============================================================================
  425. class Deki_Help < Window_Base
  426. #==============================================================================
  427. #--------------------------------------------------------------------------
  428. # Object Initialization
  429. #--------------------------------------------------------------------------
  430. def initialize(line_number = 2)
  431. super(0, 0, Graphics.width/4*3, fitting_height(line_number))
  432. @item = nil
  433. end
  434. #--------------------------------------------------------------------------
  435. # Set Text
  436. #--------------------------------------------------------------------------
  437. def set_text(text)
  438. if text != @text
  439. @text = text
  440. refresh
  441. end
  442. end
  443. #--------------------------------------------------------------------------
  444. # Clear
  445. #--------------------------------------------------------------------------
  446. def clear
  447. set_text("")
  448. end
  449. #--------------------------------------------------------------------------
  450. # Set Item , item : Skills and items etc.
  451. #--------------------------------------------------------------------------
  452. def set_item(item)
  453. return if @item == item
  454. @item = item
  455. refresh
  456. set_text(item ? item.description : "")
  457. end
  458. #--------------------------------------------------------------------------
  459. # Refresh
  460. #--------------------------------------------------------------------------
  461. def refresh
  462. contents.clear
  463. draw_text_ex(4, 0, @text)
  464. end
  465. #--------------------------------------------------------------------------
  466. # Reset Font Settings
  467. #--------------------------------------------------------------------------
  468. def reset_font_settings
  469. change_color(normal_color)
  470. self.contents.font.name = General::Fonts
  471. self.contents.font.size = General::Font_Size
  472. self.contents.font.bold = General::Font_Bold
  473. end
  474.  
  475. end
  476.  
  477. #==============================================================================#
  478. # http://dekitarpg.wordpress.com/ #
  479. #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement