Advertisement
Holy87

Item/Skill/Equip descriptions - VX Ace

Mar 27th, 2015
595
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 64.06 KB | None | 0 0
  1. $imported = {} if $imported == nil
  2. $imported["H87_DBDetails"] = true
  3. #===============================================================================
  4. # DETTAGLI OGGETTI/ABILITÀ/EQUIP
  5. #===============================================================================
  6. # Autore: Holy87
  7. # Versione: 1.0
  8. # Difficoltà utente: ★
  9. #-------------------------------------------------------------------------------
  10. # Questo script mostrerà descrizioni dettagliate sull'abilità, oggetto e equip
  11. # a fianco alla lista delle abilità dell'eroe.
  12. #-------------------------------------------------------------------------------
  13. # Istruzioni:
  14. # Copiare lo script sotto Materials, prima del Main. Lo script non ha bisogno
  15. # di ulteriori configurazioni, ma più in basso puoi modificare i testi delle
  16. # descrizioni e l'ordine e la disattivazione di alcuni dettagli.
  17. #
  18. # Puoi assegnare delle descrizioni personalizzate scrivendo nelle
  19. # note dell'abilità o dell'oggetto del database i seguenti tag:
  20. # <attr tipo_parametro: parametro>
  21. # ad esempio: <attr Forte contro: Insetti>
  22. # oppure, se si vuole aggiungere un'icona alla descrizione:
  23. # <attr tipo_parametro: parametro[id_icona]>
  24. # oppure, se vuoi una semplice descrizione
  25. # <tip: descrizione>
  26. # ad esempio: <tip: Può uccidere con un colpo>
  27. #
  28. # Puoi nascondere la visualizzazione del danno dell'abilità scrivendo la tag
  29. # <nascondi danno>
  30. # Puoi nascondere del tutto le visualizzazioni automatiche di un oggetto/skill
  31. # e visualizzare solo quelle personalizzate con
  32. # <nessuna descrizione>
  33. #-------------------------------------------------------------------------------
  34. # PER CHI FA SCRIPT, ISTRUZIONI PER INTEGRARE I PROPRI A QUESTO
  35. # ● Alias del metodo draw_script_details in Window_DetailsBase
  36. #   inserisci i comandi per stampare dettagli aggiuntivi qui. @item richiama
  37. #   l'oggetto attuale (può essere una skill, item o equip).
  38. # ● Usa il metodo draw_detail per mostrare il valore automaticamente nella sua
  39. #   riga. I parametri sono questi:
  40. #   draw_detail(value[, descr, icon_index, color])
  41. #   Se c'è solo value, il testo viene scritto al centro
  42. #   Se c'è anche icon_index, viene mostrata un'icona vicino al valore
  43. #   color può essere :special (giallo), :up (verde), :down (rosso) e :disabled
  44. #-------------------------------------------------------------------------------
  45. # Compatibilità:
  46. # classe Scene_Skill      ->   alias di start
  47. # classe Scene_Item       ->   alias di start
  48. # classe Window_SkillList ->   alias di initialize
  49. #                              override di col_max
  50. #                              overload di index=()
  51. # classe Window_ItemList  ->   alias di initialize
  52. #                              override di col_max
  53. #                              overload di index=()
  54. # modulo DataManager      ->   alias di load_normal_database
  55. #-------------------------------------------------------------------------------
  56.  
  57. #===============================================================================
  58. # ** Impostazioni
  59. #
  60. # ** Vocab
  61. #------------------------------------------------------------------------------
  62. #  Puoi modificare i vari testi per i dettagli
  63. #==============================================================================
  64. module Vocab
  65.   #--------------------------------------------------------------------------
  66.   # * Parametri extra
  67.   #--------------------------------------------------------------------------
  68.   HIT = "Mira:"
  69.   EVA = "Evasione:"
  70.   CRI = "Critici:"
  71.   CEV = "Ev. Critici:"
  72.   MEV = "Ev. Magica:"
  73.   MRF = "Prob. Riflesso:"
  74.   CNT = "Prob. Contrattacco:"
  75.   HRG = "Rigenerazione PV:"
  76.   MRG = "Rigenerazione PM:"
  77.   TRG = "Recupero PT:"
  78.   #--------------------------------------------------------------------------
  79.   # * Parametri speciali
  80.   #--------------------------------------------------------------------------
  81.   TGR = "Prob. bersaglio:"
  82.   GRD = "Prob. guardia:"
  83.   REC = "Bonus cura:"
  84.   PHA = "Efficacia pozioni:"
  85.   MCR = "Costo PM:"
  86.   TCR = "Costo PT:"
  87.   PDR = "Danno Fisico:"
  88.   MDR = "Danno Magico:"
  89.   FDR = "Danno da Terreno:"
  90.   EXR = "Esperienza:"
  91.   #--------------------------------------------------------------------------
  92.   # * Effetti dell'abilità o dell'oggetto utilizzabile
  93.   #--------------------------------------------------------------------------
  94.   SK_TARGET =     "Bersaglio:"
  95.   SK_ELEMENT =    "Elemento:"
  96.   SK_STATUS =     ""
  97.   SK_NOSTAT =     "Rimuove:"
  98.   SK_BUFF =       "Aumenta %s per %d turni"
  99.   SK_DEBUFF =     "Riduce %s per %d turni"
  100.   SK_REM_BUFF =   "Normalizza %s"
  101.   SK_SPEED =      "Velocità:"
  102.   SK_SUCCESS =    "Prob. Succ.:"
  103.   SK_REPEAT =     "N° colpi:"
  104.   SK_DAMAGE =     "Danno %s:"
  105.   SK_HEAL =       "Cura %s:"
  106.   SK_ABS  =       "Assorbe %s:"
  107.   SK_MENU =       "Utilizzabile dal menu"
  108.   SK_TYPE =       "Tipo:"
  109.   SK_GUARANTED =  "Colpo sicuro"
  110.   SK_MAGIC =      "Magia"
  111.   SK_ATTACK =     "Fisico"
  112.   SK_TP =         "Incremento PT:"
  113.   SK_TG_1E =      "Un nemico"
  114.   SK_TG_AE =      "Tutti nem."
  115.   SK_TG_1RE =     "A caso"
  116.   SK_TG_2RE =     "2 a caso"
  117.   SK_TG_3RE =     "3 a caso"
  118.   SK_TG_4RE =     "4 a caso"
  119.   SK_TG_1A =      "Un alleato"
  120.   SK_TG_AA =      "Party"
  121.   SK_TG_DA =      "Alleato KO"
  122.   SK_TG_AD =      "Alleati KO"
  123.   SK_TG_SF =      "Se stessi"
  124.   SK_TG_NO =      "Nessuno"
  125.   SK_CRITICAL =   "Critici possibili"
  126.   SK_REQUIRE =    "Richiede:"
  127.   EF_REC =        "Cura %s:"
  128.   SP_RUN      =   "Fuga"
  129.   EF_GROW     =   "Incremento %s:"
  130.   #--------------------------------------------------------------------------
  131.   # * Info delle abilità
  132.   #--------------------------------------------------------------------------
  133.   SK_COST =       "Costo %s:"
  134.   SK_REQ =        "Richiede:"
  135.   #--------------------------------------------------------------------------
  136.   # * Info dell'oggetto
  137.   #--------------------------------------------------------------------------
  138.   IT_CONSUMABLE = "Scompare dopo l'uso"
  139.   IT_KEY        = "Oggetto importante"
  140.   #--------------------------------------------------------------------------
  141.   # * Attributi dell'equipaggiamento
  142.   #--------------------------------------------------------------------------
  143.   EQ_ELDEF =      "Difesa %s:"
  144.   EQ_STDEF =      "Dif. Stato:"
  145.   EQ_DEBUFF =     "Difesa debuff %s:"
  146.   EQ_IMMUNE =     "Previene:"
  147.   EQ_ELEMENT =    "Elem. Att.:"
  148.   EQ_STATE =      "Stato Att.:"
  149.   EQ_SPEED =      "Bonus vel. attacco:"
  150.   EQ_ATK_T =      "Attacchi extra:"
  151.   EQ_SKILL_SLOT = "Sblocca %s"
  152.   EQ_SKILL_ADD  = "Apprendi:"
  153.   EQ_SKILL_REM  = "Blocca:"
  154.   EQ_STYPE_SEAL = "Blocca %s"
  155.   EQ_EQUIP_WTYPE= "Permette l'uso di %s"
  156.   EQ_EQUIP_ATYPE= "Permette l'uso di %s"
  157.   EQ_EQUIP_FIX  = "Blocca il cambio di %s"
  158.   EQ_EQUIP_SEAL = "%s non equipaggiabile"
  159.   EQ_DUAL_WIELD = "Permette di equipaggiare due armi"
  160.   EQ_ACTION_PLS = "Prob. azione extra:"
  161.   EQ_AUTO           = "Battaglia automatica"
  162.   EQ_GUARD        = "Super Difesa"
  163.   EQ_SUBST        = "Protegge gli alleati"
  164.   EQ_PRESERVE     = "Conserva i PT dopo la battaglia"
  165.   EQ_PARTY_ENC  = "Incontri casuali dimezzati"
  166.   EQ_PARTY_ENC2 = "Impedisce gli incontri casuali"
  167.   EQ_PARTY_AMB  = "Previene le imboscate"
  168.   EQ_PARTY_PRE  = "Cogli tutti i nemici di sorpresa"
  169.   EQ_PARTY_GOLD = "Raddoppia l'oro ottenuto"
  170.   EQ_PARTY_DROP = "Raddoppia la prob. di ottenere oggetti"
  171.   EQ_TYPE       = "Tipo:"
  172.   WP_TYPE       = "Tipo arma:"
  173.   AR_TYPE       = "Tipo armatura:"
  174.   SP_AUTO     =   "Battaglia automatica"
  175.   SP_DEF      =   "1/4 danni in difesa"
  176.   SP_FARMACOL =   "Effetto pozioni raddoppiato"
  177.   SP_PROT     =   "Protegge i compagni"
  178.   SP_TP_RES   =   "Conserva i PT"
  179.   #--------------------------------------------------------------------------
  180.   # * Info comuni all'oggetto ed equip
  181.   #--------------------------------------------------------------------------
  182.   IT_SELL     =   "Prezzo vendita:"
  183.   IT_UNSELL   =   "Non vendibile"
  184. end #vocab
  185.  
  186. # ** Det_Config
  187. #------------------------------------------------------------------------------
  188. #  Configurazione della finestra dei dettagli
  189. #==============================================================================
  190. module Det_Config
  191.  
  192.   # PERSONALIZZAZIONE DETTAGLI
  193.   # PUOI CAMBIARE L'ORDINE DEI DETTAGLI MOSTRATI CAMBIANDO L'ORDINE DEGLI ELEMENTI
  194.   # QUI SOTTO. PUOI ANCHE RIMUOVERLI SE NON VUOI CHE VENGANO MOSTRATE CERTE
  195.   # INFORMAZIONI.
  196.  
  197.   #--------------------------------------------------------------------------
  198.   # * Info comuni ad oggetti e skill
  199.   #--------------------------------------------------------------------------
  200.   OBJECT_DETAILS = [
  201.   :status,      #stato alterato (aggiunge e rimuove)
  202.   :buff,        #buff e debuff
  203.   :hp_recover,  #ricovero hp
  204.   :mp_recover,  #ricovero mp
  205.   :special,     #speciale
  206.   :grow,        #incremento
  207.   :learn,       #effetto
  208.   ]
  209.   #--------------------------------------------------------------------------
  210.   # * Info sull'abilità
  211.   #--------------------------------------------------------------------------
  212.   SKILL_DETAILS = [
  213.   :cost,        #costi
  214.   :target,      #bersaglio
  215.   :repeat,      #ripetizioni
  216.   :element,     #elemento
  217.   :success_r,   #prob. successo
  218.   :type,        #tipo abilità
  219.   :speed,       #velocità
  220.   :damage,      #tipo danno
  221.   :critical,    #possibilità di critico
  222.   :tp_gain,     #incremento PT
  223.   :required_w,  #arma richiesta
  224.   :map_using,   #utilizzo su mappa
  225.   ]
  226.   #--------------------------------------------------------------------------
  227.   # * Info sull'oggetto
  228.   #--------------------------------------------------------------------------
  229.   ITEM_DETAILS = [
  230.   :target,      #bersaglio
  231.   :consumable,  #si consuma?
  232.   :key_item,    #oggetto chiave
  233.   :repeat,      #ripetizioni
  234.   :element,     #elemento
  235.   :success_r,   #prob. successo
  236.   :speed,       #velocità
  237.   :damage,      #tipo danno
  238.   :critical,    #possibilità di critico
  239.   :tp_gain,     #incremento PT
  240.   :map_using,   #utilizzo su mappa
  241.   :sellprice,   #prezzo di vendita
  242.   ]
  243.   #--------------------------------------------------------------------------
  244.   # * Info sull'equipaggiamento
  245.   #--------------------------------------------------------------------------
  246.   EQUIP_DETAILS = [
  247.   :type,        #tipo (arma, scudo ec...)
  248.   :awtype,      #tipo di arma o armatura (spada, lancia... o armatura leggera)
  249.   :params,      #modificatori di parametri
  250.   :sellprice,   #prezzo di vendita
  251.   :features,    #proprietà aggiuntive
  252.   ]
  253.  
  254. # Larghezza della finestra delle skill
  255. # Decidi quanto spazio vuoi per la finestra delle skill e quella dei dettagli
  256.   LIST_WIDTH = 300
  257.  
  258. # Nemico su cui si basa il calcolo probabilistico del danno
  259. # Serve per mostrare il danno inflitto su una skill o oggetto d'attacco
  260.   SAMPLE_ENEMY = 1 #ID del nemico
  261.  
  262. # Se gli stati che infligge o rimuove sono maggiori del valore sottostante, lo
  263. # script non li mostra.
  264.   STATE_MAX = 4
  265.  
  266. # Imposta la grandezza del font (per far entrare più cose)
  267.   FONT_REDUCTION = 18
  268.  
  269. end # Det_Config
  270.  
  271. #==============================================================================
  272. # *** FINE CONFIGURAZIONE ***
  273. # Modificare le righe in basso potrebbe compromettere il funzionamento dello
  274. # script!
  275. #==============================================================================
  276.  
  277.  
  278.  
  279. #==============================================================================
  280. # ** Vocab
  281. #------------------------------------------------------------------------------
  282. #  Tipo arma
  283. #==============================================================================
  284. module Vocab
  285.   #--------------------------------------------------------------------------
  286.   # * Tipo arma
  287.   #--------------------------------------------------------------------------
  288.   def self.wtype(wtype_id)
  289.     return $data_system.weapon_types[wtype_id]
  290.   end
  291.   #--------------------------------------------------------------------------
  292.   # * Tipo armatura
  293.   #--------------------------------------------------------------------------
  294.   def self.atype(atype_id)
  295.     return $data_system.armor_types[atype_id]
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # * Tipo elemento
  299.   #--------------------------------------------------------------------------
  300.   def self.eltype(element_id)
  301.     return $data_system.elements[element_id]
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # * Restituisce il nome del parametro extra
  305.   #     param_id: id del parametro
  306.   #--------------------------------------------------------------------------
  307.   def self.ex_param(param_id)
  308.     params = [HIT, EVA, CRI, CEV, MEV, MRF, CNT, HRG, MRG, TRG]
  309.     return params[param_id]
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # * Restituisce il nome del parametro speciale
  313.   #     param_id: id del parametro
  314.   #--------------------------------------------------------------------------
  315.   def self.sp_param(param_id)
  316.     params = [TGR, GRD, REC, PHA, MCR, TCR, PDR, MDR, FDR, EXR]
  317.     return params[param_id]
  318.   end
  319.   #--------------------------------------------------------------------------
  320.   # * Restituisce il nome del tipo dell'abilità
  321.   #     stype_id: id del tipo
  322.   #--------------------------------------------------------------------------
  323.   def self.skill_type(stype_id)
  324.     return $data_system.skill_types[stype_id]
  325.   end
  326. end #vocab 2
  327.  
  328. #==============================================================================
  329. # ** Skill
  330. #------------------------------------------------------------------------------
  331. #  Aggiunge gli elementi di RPG::Skill
  332. #==============================================================================
  333. class RPG::BaseItem
  334.   attr_reader :custom_dets      #dettaglio personalizzato con categoria
  335.   attr_reader :custom_desc      #dettaglio con sola descrizione
  336.   attr_reader :show_damage      #mostra o nascondi il danno
  337.   attr_reader :no_description   #nasconde la descrizione automatica se true
  338.   #--------------------------------------------------------------------------
  339.   # * caricamento dei dettagli personalizzati
  340.   #--------------------------------------------------------------------------
  341.   def load_custom_details
  342.     return if @det_loaded
  343.     @det_loaded = true
  344.     @no_description = false
  345.     @custom_dets = []
  346.     @custom_desc = []
  347.     @show_damage = true
  348.     self.note.split(/[\r\n]+/).each { |line|
  349.       case line
  350.       #---
  351.       when /<nessuna descrizione>/i
  352.         @no_description = true
  353.       when /<attr[ ]+(.*):[ ](.*)\[(\d+)\]>/i
  354.         @custom_dets.push([$1,$2,$3.to_i])
  355.       when /<attr[ ]+(.*):[ ](.*)>/i
  356.         @custom_dets.push([$1,$2])
  357.       when /<tip:[ ]*(.*)>/i
  358.         @custom_desc.push($1)
  359.       when /<(?:NASCONDI_DANNO|nascondi danno)>/i
  360.         @show_damage = false
  361.       end
  362.     }
  363.   end
  364. end #baseitem
  365.  
  366. #==============================================================================
  367. # ** DataManager
  368. #------------------------------------------------------------------------------
  369. #  Aggiunta del caricamento dellle descrizioni personalizzate
  370. #==============================================================================
  371. module DataManager
  372.   class << self
  373.     alias descr_norm_db load_normal_database
  374.   end
  375.   #--------------------------------------------------------------------------
  376.   # * alias di load_normal_database
  377.   #--------------------------------------------------------------------------
  378.   def self.load_normal_database
  379.     descr_norm_db
  380.     load_object_description
  381.   end
  382.   #--------------------------------------------------------------------------
  383.   # * carica le descrizioni personalizzate di tutte le skill
  384.   #--------------------------------------------------------------------------
  385.   def self.load_object_description
  386.     for skill in $data_skills
  387.       next if skill.nil?
  388.       skill.load_custom_details
  389.     end
  390.     for item in $data_items
  391.       next if item.nil?
  392.       item.load_custom_details
  393.     end
  394.     for weapon in $data_weapons
  395.       next if weapon.nil?
  396.       weapon.load_custom_details
  397.     end
  398.     for armor in $data_armors
  399.       next if armor.nil?
  400.       armor.load_custom_details
  401.     end
  402.   end
  403. end #datamanager
  404.  
  405. #==============================================================================
  406. # ** Scene_Skill
  407. #------------------------------------------------------------------------------
  408. #  Modifica di Scene_Skill
  409. #==============================================================================
  410. class Scene_Skill < Scene_ItemBase
  411.   #--------------------------------------------------------------------------
  412.   # * alias metodo start
  413.   #--------------------------------------------------------------------------
  414.   alias ski_det_start start unless $@
  415.   def start
  416.     ski_det_start
  417.     create_detail_window
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # * crea la finestra dei dettagli e la assegna alla lista delle abilità
  421.   #--------------------------------------------------------------------------
  422.   def create_detail_window
  423.     x = @item_window.width
  424.     y = @item_window.y
  425.     w = Graphics.width - @item_window.width
  426.     h = @item_window.height
  427.     @window_skill_detail = Window_SkillDetails.new(x, y, w, h)
  428.     @window_skill_detail.viewport = @viewport
  429.     @item_window.detail_window = @window_skill_detail
  430.   end
  431. end #scene_skill
  432.  
  433. #==============================================================================
  434. # ** Scene_Item
  435. #------------------------------------------------------------------------------
  436. #  Modifica di Scene_Item
  437. #==============================================================================
  438. class Scene_Item < Scene_ItemBase
  439.   #--------------------------------------------------------------------------
  440.   # * alias metodo start
  441.   #--------------------------------------------------------------------------
  442.   alias ski_det_start start unless $@
  443.   def start
  444.     ski_det_start
  445.     create_detail_window
  446.   end
  447.   #--------------------------------------------------------------------------
  448.   # * crea la finestra dei dettagli e la assegna alla lista delle abilità
  449.   #--------------------------------------------------------------------------
  450.   def create_detail_window
  451.     x = @item_window.width
  452.     y = @item_window.y
  453.     w = Graphics.width - @item_window.width
  454.     h = @item_window.height
  455.     @window_item_detail = Window_ItemDetails.new(x, y, w, h)
  456.     @window_item_detail.viewport = @viewport
  457.     @item_window.detail_window = @window_item_detail
  458.   end
  459. end #scene_skill
  460.  
  461. #==============================================================================
  462. # ** Window_SkillList
  463. #------------------------------------------------------------------------------
  464. #  Modifica della lista delle abilità
  465. #==============================================================================
  466. class Window_SkillList < Window_Selectable
  467.   #--------------------------------------------------------------------------
  468.   # * alias metodo initialize
  469.   #--------------------------------------------------------------------------
  470.   alias dim_init_sel initialize unless $@
  471.   def initialize (x, y, width, height)
  472.     w = details_avaiable? ? Det_Config::LIST_WIDTH : width
  473.     dim_init_sel(x, y, w, height)
  474.   end
  475.   #--------------------------------------------------------------------------
  476.   # * sovrascrive il metodo col_max per una sola colonna
  477.   #--------------------------------------------------------------------------
  478.   alias det_col_max col_max unless $@
  479.   def col_max
  480.     return details_avaiable? ? 1 : det_col_max
  481.   end
  482.   #--------------------------------------------------------------------------
  483.   # * metodo index per aggiungere l'aggiornamento della finestra dettagli
  484.   #--------------------------------------------------------------------------
  485.   def index=(index)
  486.     super
  487.     update_detail_window
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # * imposta la finestra dei dettagli
  491.   #--------------------------------------------------------------------------
  492.   def detail_window=(detail_window)
  493.     @detail_window = detail_window
  494.     update_detail_window
  495.   end
  496.   #--------------------------------------------------------------------------
  497.   # * aggiorna oggetto ed eroe della finestra dei dettagli
  498.   #--------------------------------------------------------------------------
  499.   def update_detail_window
  500.     return if @detail_window.nil?
  501.     return if self.item.nil?
  502.     @detail_window.set_item(self.item, @actor)
  503.   end
  504.   #--------------------------------------------------------------------------
  505.   # * Restituisce true se si può mostrare la finestra di dettagli
  506.   #--------------------------------------------------------------------------
  507.   def details_avaiable?
  508.     return !SceneManager.scene_is?(Scene_Battle)
  509.   end
  510. end #window_skilllist
  511.  
  512. #==============================================================================
  513. # ** Window_SkillList
  514. #------------------------------------------------------------------------------
  515. #  Modifica della lista delle abilità
  516. #==============================================================================
  517. class Window_ItemList < Window_Selectable
  518.   #--------------------------------------------------------------------------
  519.   # * alias metodo initialize
  520.   #--------------------------------------------------------------------------
  521.   alias dim_init_sel initialize unless $@
  522.   def initialize (x, y, width, height)
  523.     w = details_avaiable? ? Det_Config::LIST_WIDTH : width
  524.     dim_init_sel(x, y, w, height)
  525.   end
  526.   #--------------------------------------------------------------------------
  527.   # * sovrascrive il metodo col_max per una sola colonna
  528.   #--------------------------------------------------------------------------
  529.   alias det_col_max col_max unless $@
  530.   def col_max
  531.     return details_avaiable? ? 1 : det_col_max
  532.   end
  533.   #--------------------------------------------------------------------------
  534.   # * metodo index per aggiungere l'aggiornamento della finestra dettagli
  535.   #--------------------------------------------------------------------------
  536.   def index=(index)
  537.     super
  538.     update_detail_window
  539.   end
  540.   #--------------------------------------------------------------------------
  541.   # * imposta la finestra dei dettagli
  542.   #--------------------------------------------------------------------------
  543.   def detail_window=(detail_window)
  544.     @detail_window = detail_window
  545.     update_detail_window
  546.   end
  547.   #--------------------------------------------------------------------------
  548.   # * aggiorna oggetto ed eroe della finestra dei dettagli
  549.   #--------------------------------------------------------------------------
  550.   def update_detail_window
  551.     return if @detail_window.nil?
  552.     return if self.item.nil?
  553.     @detail_window.set_item(self.item, @actor)
  554.   end
  555.   #--------------------------------------------------------------------------
  556.   # * Restituisce true se si può mostrare la finestra di dettagli
  557.   #--------------------------------------------------------------------------
  558.   def details_avaiable?
  559.     return SceneManager.scene_is?(Scene_Item)
  560.   end
  561. end #window_itemlist
  562.  
  563. #==============================================================================
  564. # ** Window_DetailBase
  565. #------------------------------------------------------------------------------
  566. #  Finestra base delle descrizioni che viene usata come superlcasse
  567. #==============================================================================
  568. class Window_DetailsBase < Window_Base
  569.   #--------------------------------------------------------------------------
  570.   # * Costanti (Effects)
  571.   #--------------------------------------------------------------------------
  572.   EFFECT_RECOVER_HP     = 11              # Ricovero HP
  573.   EFFECT_RECOVER_MP     = 12              # Ricovero MP
  574.   EFFECT_GAIN_TP        = 13              # Ricarica TP
  575.   EFFECT_ADD_STATE      = 21              # Aggiunti Stato
  576.   EFFECT_REMOVE_STATE   = 22              # Rimuovi Stato
  577.   EFFECT_ADD_BUFF       = 31              # Aggiungi Buff
  578.   EFFECT_ADD_DEBUFF     = 32              # Aggiungi Debuff
  579.   EFFECT_REMOVE_BUFF    = 33              # Rimuovi Buff
  580.   EFFECT_REMOVE_DEBUFF  = 34              # Rimuovi Debuff
  581.   EFFECT_SPECIAL        = 41              # Effetto speciale
  582.   EFFECT_GROW           = 42              # Incrementa parametro
  583.   EFFECT_LEARN_SKILL    = 43              # Impara abilità
  584.   SPECIAL_EFFECT_ESCAPE = 0               # Effetto speciale: fuga
  585.   #--------------------------------------------------------------------------
  586.   # * Costanti (Features)
  587.   #--------------------------------------------------------------------------
  588.   FEATURE_ELEMENT_RATE  = 11              # Rateo Elemento
  589.   FEATURE_DEBUFF_RATE   = 12              # Rateo Debuff
  590.   FEATURE_STATE_RATE    = 13              # Rateo Stato
  591.   FEATURE_STATE_RESIST  = 14              # Immunità Stato
  592.   FEATURE_PARAM         = 21              # Parametro
  593.   FEATURE_XPARAM        = 22              # Parametro Extra
  594.   FEATURE_SPARAM        = 23              # Parametro Speciale
  595.   FEATURE_ATK_ELEMENT   = 31              # Elemento all'attacco
  596.   FEATURE_ATK_STATE     = 32              # Stato all'attacco
  597.   FEATURE_ATK_SPEED     = 33              # Velocità Attacco
  598.   FEATURE_ATK_TIMES     = 34              # Numero attacchi +
  599.   FEATURE_STYPE_ADD     = 41              # Aggiungi tipo Abilità
  600.   FEATURE_STYPE_SEAL    = 42              # Disabilità tipo Abiltà
  601.   FEATURE_SKILL_ADD     = 43              # Aggiungi Abilità
  602.   FEATURE_SKILL_SEAL    = 44              # Disabilità Abilità
  603.   FEATURE_EQUIP_WTYPE   = 51              # Equipaggia Arma
  604.   FEATURE_EQUIP_ATYPE   = 52              # Equipaggia Armatura
  605.   FEATURE_EQUIP_FIX     = 53              # Blocca Equip
  606.   FEATURE_EQUIP_SEAL    = 54              # Proibisci Equip
  607.   FEATURE_SLOT_TYPE     = 55              # Tipo Slot
  608.   FEATURE_ACTION_PLUS   = 61              # Azioni+
  609.   FEATURE_SPECIAL_FLAG  = 62              # Effetto speciale
  610.   FEATURE_PARTY_ABILITY = 64              # Abilità Gruppo
  611.   #--------------------------------------------------------------------------
  612.   # * Costanti (Feature Flags)
  613.   #--------------------------------------------------------------------------
  614.   FLAG_ID_AUTO_BATTLE   = 0               # battaglia automatica
  615.   FLAG_ID_GUARD         = 1               # super difesa
  616.   FLAG_ID_SUBSTITUTE    = 2               # sostituto
  617.   FLAG_ID_PRESERVE_TP   = 3               # preserva PT
  618.   #--------------------------------------------------------------------------
  619.   # * Inizializzazione
  620.   #--------------------------------------------------------------------------
  621.   def initialize(x, y, width, height)
  622.     super
  623.   end
  624.   #--------------------------------------------------------------------------
  625.   # * aggiornamento della finestra
  626.   #--------------------------------------------------------------------------
  627.   def refresh
  628.     contents.clear
  629.     contents.font.size = Det_Config::FONT_REDUCTION if Det_Config::FONT_REDUCTION != 0
  630.     return if @item.nil?
  631.     @line = 0
  632.     write_object_data
  633.   end
  634.   #--------------------------------------------------------------------------
  635.   # * Scrive i dati
  636.   #--------------------------------------------------------------------------
  637.   def write_object_data
  638.     unless @item.no_description
  639.       draw_object_effects
  640.       draw_specific_details
  641.       draw_features
  642.       draw_script_details
  643.     end
  644.     draw_custom_details
  645.   end
  646.   #--------------------------------------------------------------------------
  647.   # * Scrive dettagli per altri script (va aliasato da altri script)
  648.   #--------------------------------------------------------------------------
  649.   def draw_script_details
  650.   end
  651.   #--------------------------------------------------------------------------
  652.   # * Scrive i dati specifici (va specificato nelle sottoclassi)
  653.   #--------------------------------------------------------------------------
  654.   def draw_specific_details
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # * Aggiorna l'oggetto da mostrare
  658.   #     item: oggetto
  659.   #     actor: eroe che la possiede
  660.   #--------------------------------------------------------------------------
  661.   def set_item(item, actor = nil)
  662.     @item = item
  663.     @actor = actor
  664.     refresh
  665.   end
  666.   #--------------------------------------------------------------------------
  667.   # * Restituisce l'eroe
  668.   #--------------------------------------------------------------------------
  669.   def actor
  670.     return @actor.nil? ? $game_party.members[0] : @actor
  671.   end
  672.   #--------------------------------------------------------------------------
  673.   # * Disegna un'icona stretchata
  674.   #--------------------------------------------------------------------------
  675.   def draw_icon_stretched(icon_index, x, y, enabled = true)
  676.     bitmap = Cache.system("Iconset")
  677.     rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  678.     dest_rect = Rect.new(x,y,line_height,line_height)
  679.     contents.stretch_blt(dest_rect, bitmap, rect, enabled ? 255 : translucent_alpha)
  680.   end  
  681.   #--------------------------------------------------------------------------
  682.   # * Modifica della line_height
  683.   #--------------------------------------------------------------------------
  684.   def line_height
  685.     super if Det_Config::FONT_REDUCTION == 0
  686.     return contents.text_size("A").height + 2
  687.   end
  688.   #--------------------------------------------------------------------------
  689.   # * scrive un dettaglio nella finestra e aggiunge una riga
  690.   #--------------------------------------------------------------------------
  691.   def draw_detail(text, detail = nil, icon = nil, color = :default)
  692.     y = @line * line_height
  693.     cw = contents.width - 2
  694.     lh = line_height
  695.     if !detail.nil?
  696.       change_color(system_color)
  697.       contents.draw_text(0, y, cw, lh, detail)
  698.       al = 2 #allineamento a destra
  699.     else
  700.       al = 1 #allineamento al centro
  701.     end
  702.     case color
  703.     when :default
  704.       change_color(normal_color)
  705.     when :down
  706.       change_color(power_down_color)
  707.     when :up
  708.       change_color(power_up_color)
  709.     when :special
  710.       change_color(crisis_color)
  711.     when :disabled
  712.       change_color(pending_color)
  713.     end
  714.     contents.draw_text(0, y, cw, lh, text.to_s.gsub(/\\[a-z]+\[[\d]+\]/i,""), al)
  715.     if !icon.nil?
  716.       tw = cw - (line_height + 2) - contents.text_size(text.to_s.gsub(/\\[a-z]+\[[\d]+\]/i,"")).width
  717.       draw_icon_stretched(icon, tw, y)
  718.     end
  719.     @line += 1
  720.     change_color(normal_color)
  721.   end
  722.   #--------------------------------------------------------------------------
  723.   # * Scrittura degli effetti universali per tutti gli oggetti
  724.   #--------------------------------------------------------------------------
  725.   def draw_object_effects
  726.     for i in 0..Det_Config::OBJECT_DETAILS.size-1
  727.       draw_effects(Det_Config::OBJECT_DETAILS[i])
  728.     end
  729.   end
  730.   #--------------------------------------------------------------------------
  731.   # * Chiama il metodo desiderato
  732.   #   effect: effetto desiderato
  733.   #--------------------------------------------------------------------------
  734.   def draw_effects(effect)
  735.     return unless @item.is_a?(RPG::UsableItem)
  736.     case effect#Det_Config::OBJECT_DETAILS[effect]
  737.       when :status      #stato alterato (aggiunge e rimuove)
  738.         draw_status_detail
  739.       when :buff        #buff e debuff
  740.         draw_buff_detail
  741.       when :hp_recover  #ricovero hp
  742.         draw_hp_recover_detail
  743.       when :mp_recover  #ricovero mp
  744.         draw_mp_recover_detail
  745.       when :special     #speciale
  746.         draw_special_detail
  747.       when :grow        #incremento
  748.         draw_grow_detail
  749.       when :learn       #apprendimento abilità
  750.         draw_learn_detail
  751.     end
  752.   end
  753.   #--------------------------------------------------------------------------
  754.   # * Dettagli speciali (feature) va specificato nelle sottoclassi.
  755.   #--------------------------------------------------------------------------
  756.   def draw_special_detail
  757.   end
  758.   #--------------------------------------------------------------------------
  759.   # * mostra gli stati alterati dell'abilità
  760.   #--------------------------------------------------------------------------
  761.   def draw_status_detail
  762.     return if @item.effects.size > Det_Config::STATE_MAX
  763.     for effect in @item.effects
  764.       if effect.code == EFFECT_ADD_STATE
  765.         state = $data_states[effect.data_id]
  766.         return if state.nil?
  767.         prob = (effect.value1 * 100).to_i
  768.         text = sprintf("%s (%d%%)", state.name, prob)
  769.         draw_detail(text, Vocab::SK_STATUS, state.icon_index)
  770.       elsif effect.code == EFFECT_REMOVE_STATE
  771.         state = $data_states[effect.data_id]
  772.         return if state.nil?
  773.         prob = (effect.value1 * 100).to_i
  774.         text = sprintf("%s (%d%%)", state.name, prob)
  775.         draw_detail(text, Vocab::SK_NOSTAT, state.icon_index)
  776.       end
  777.     end
  778.   end
  779.   #--------------------------------------------------------------------------
  780.   # * mostra i buff e debuff dell'abilità
  781.   #--------------------------------------------------------------------------
  782.   def draw_buff_detail
  783.     for effect in @item.effects
  784.       type = effect.code
  785.       buff = [EFFECT_ADD_BUFF, EFFECT_ADD_DEBUFF, EFFECT_REMOVE_BUFF, EFFECT_REMOVE_DEBUFF]
  786.       if buff.include?(type)
  787.         draw_detail(get_buff_bonus(effect))
  788.       end
  789.     end
  790.   end
  791.   #--------------------------------------------------------------------------
  792.   # * Mostra il ricovero PV
  793.   #--------------------------------------------------------------------------
  794.   def draw_hp_recover_detail
  795.     for effect in @item.effects
  796.       type = effect.code
  797.       next if type != EFFECT_RECOVER_HP
  798.       desc = sprintf(Vocab::EF_REC, Vocab.hp_a)
  799.       text = recover_value(effect.value1, effect.value2)
  800.       draw_detail(text, desc)
  801.     end
  802.   end
  803.   #--------------------------------------------------------------------------
  804.   # * Mostra il ricovero PM
  805.   #--------------------------------------------------------------------------
  806.   def draw_mp_recover_detail
  807.     for effect in @item.effects
  808.       type = effect.code
  809.       next if type != EFFECT_RECOVER_MP
  810.       desc = sprintf(Vocab::EF_REC, Vocab.mp_a)
  811.       text = recover_value(effect.value1, effect.value2)
  812.       draw_detail(text, desc)
  813.     end
  814.   end
  815.   #--------------------------------------------------------------------------
  816.   # * Restituisce il testo di recupero
  817.   #--------------------------------------------------------------------------
  818.   def recover_value(val1, val2)
  819.     t1 = t2 = ""
  820.     if val1 != 0
  821.       t1 = sprintf("%d%%", val1*100)
  822.     end
  823.     if val2 != 0
  824.       t2 = sprintf(" %+d", val2)
  825.     end
  826.     return t1+t2
  827.   end
  828.   #--------------------------------------------------------------------------
  829.   # * Mostra i dettagli dell'incremento
  830.   #--------------------------------------------------------------------------
  831.   def draw_grow_detail
  832.     for effect in @item.effects
  833.       next if effect.code != EFFECT_GROW
  834.       desc = sprintf(Vocab::EF_GROW,Vocab.param(effect.data_id))
  835.       text = effect.value1
  836.       draw_detail(text, desc)
  837.     end
  838.   end
  839.   #--------------------------------------------------------------------------
  840.   # * Mostra i dettagli dell'apprendimento abilità
  841.   #--------------------------------------------------------------------------
  842.   def draw_learn_detail
  843.     for effect in @item.effects
  844.       next if effect.code != EFFECT_LEARN_SKILL
  845.       desc = Vocab::EQ_SKILL_ADD
  846.       skill = $data_skills[effect.data_id]
  847.       draw_detail(skill.name, desc, skill.icon_index)
  848.     end
  849.   end
  850.   #--------------------------------------------------------------------------
  851.   # * scrittura dei dettagli personalizzati
  852.   #--------------------------------------------------------------------------
  853.   def draw_custom_details
  854.     @item.custom_dets.each do |det|
  855.       if det[2].nil?
  856.         draw_detail(det[1], det[0]+":")
  857.       else
  858.         draw_detail(det[1], det[0]+":", det[2])
  859.       end
  860.     end
  861.     for det in @item.custom_desc
  862.       draw_detail(det)
  863.     end
  864.   end
  865.   #--------------------------------------------------------------------------
  866.   # * Disegna le proprietà dell'oggetto
  867.   #--------------------------------------------------------------------------
  868.   def draw_features
  869.     features = @item.features
  870.     for feature in features
  871.       draw_feature(feature)
  872.     end
  873.   end
  874.   #--------------------------------------------------------------------------
  875.   # * Disegna una proprietà specifica
  876.   #     feature: ID proprietà
  877.   #--------------------------------------------------------------------------
  878.   def draw_feature(feature)
  879.     case feature.code
  880.     when FEATURE_ELEMENT_RATE
  881.       draw_elem_rate(feature.data_id, feature.value)
  882.     when FEATURE_DEBUFF_RATE
  883.       draw_debuff_rate(feature.data_id, feature.value)
  884.     when FEATURE_STATE_RATE
  885.       draw_state_rate(feature.data_id, feature.value)
  886.     when FEATURE_STATE_RESIST
  887.       draw_state_resist(feature.data_id)
  888.     when FEATURE_PARAM
  889.       draw_feature_param(feature.data_id, feature.value)
  890.     when FEATURE_XPARAM
  891.       draw_feature_xparam(feature.data_id, feature.value)
  892.     when FEATURE_SPARAM
  893.       draw_feature_sparam(feature.data_id, feature.value)
  894.     when FEATURE_ATK_ELEMENT
  895.       draw_feature_atk_element(feature.data_id)
  896.     when FEATURE_ATK_STATE
  897.       draw_feature_atk_state(feature.data_id, feature.value)
  898.     when FEATURE_ATK_SPEED
  899.       draw_feature_atk_speed(feature.value)
  900.     when FEATURE_ATK_TIMES
  901.       draw_feature_atk_times(feature.value)
  902.     when FEATURE_STYPE_ADD
  903.       draw_feature_sk_type(feature.data_id)
  904.     when FEATURE_STYPE_SEAL
  905.       draw_feature_skt_seal(feature.data_id)
  906.     when FEATURE_SKILL_ADD
  907.       draw_feature_sk_add(feature.data_id)
  908.     when FEATURE_SKILL_SEAL
  909.       draw_feature_sk_seal(feature.data_id)
  910.     when FEATURE_EQUIP_WTYPE
  911.       draw_feature_eqt_add(feature.data_id)
  912.     when FEATURE_EQUIP_ATYPE
  913.       draw_feature_art_add(feature.data_id)
  914.     when FEATURE_EQUIP_FIX
  915.       draw_feature_eq_fix(feature.data_id)
  916.     when FEATURE_EQUIP_SEAL
  917.       draw_feature_eq_seal(feature.data_id)
  918.     when FEATURE_SLOT_TYPE
  919.       draw_feature_eq_slot_type(feature.data_id)
  920.     when FEATURE_ACTION_PLUS
  921.       draw_feature_action_plus(feature.value)
  922.     when FEATURE_SPECIAL_FLAG
  923.       draw_feature_special_flag(feature.data_id)
  924.     when FEATURE_PARTY_ABILITY
  925.       draw_feature_party_ability(feature.data_id)
  926.     end
  927.   end
  928.   #--------------------------------------------------------------------------
  929.   # * Disegna il bonus difesa elementale
  930.   #     element: ID elemento
  931.   #     value:   valore della modifica
  932.   #--------------------------------------------------------------------------
  933.   def draw_elem_rate(element, value)
  934.     text = sprintf(Vocab::EQ_ELDEF, Vocab.eltype(element))
  935.     color = value > 1.0 ? :down : :up
  936.     rate = sprintf("%+d%%", 100-value*100)
  937.     draw_detail(rate, text, nil, color)
  938.   end
  939.   #--------------------------------------------------------------------------
  940.   # * Disegna il modificatore della probabilità di debuff
  941.   #     debuff: ID del debuff
  942.   #     value:  Difesa al debuff
  943.   #--------------------------------------------------------------------------
  944.   def draw_debuff_rate(debuff, value)
  945.     text = sprintf(Vocab::EQ_DEBUFF, Vocab.param(debuff))
  946.     color = value > 1.0 ? :down : :up
  947.     rate = sprintf("%+d%%", 100-value*100)
  948.     draw_detail(rate, text, nil, color)
  949.   end
  950.   #--------------------------------------------------------------------------
  951.   # * Disegna il modificatore probabilità di stati alterati
  952.   #     state_id: ID dello stato
  953.   #     value:    Valore della modifica
  954.   #--------------------------------------------------------------------------
  955.   def draw_state_rate(state_id, value)
  956.     state = $data_states[state_id]
  957.     color = value > 1.0 ? :down : :up
  958.     text = Vocab::EQ_STDEF
  959.     rate = sprintf("%s %+d%%", state.name, 100-value*100)
  960.     draw_detail(rate, text, state.icon_index, color)
  961.   end
  962.   #--------------------------------------------------------------------------
  963.   # * Disegna l'immunità a uno stato alterato
  964.   #   state_id: ID dello stato
  965.   #--------------------------------------------------------------------------
  966.   def draw_state_resist(state_id)
  967.     state = $data_states[state_id]
  968.     draw_detail(state.name, Vocab::EQ_IMMUNE, state.icon_index)
  969.   end
  970.   #--------------------------------------------------------------------------
  971.   # * Disegna il modificatore di un parametro normale
  972.   #     param: ID del parametro
  973.   #     value: valore della modifica
  974.   #--------------------------------------------------------------------------
  975.   def draw_feature_param(param, value)
  976.     text = Vocab.param(param)
  977.     color = value <= 1.0 ? :down : :up
  978.     rate = sprintf("%+d%%", (value-1.0)*100)
  979.     draw_detail(rate, text, nil, color)
  980.   end
  981.   #--------------------------------------------------------------------------
  982.   # * Disegna il modificatore di un parametro extra
  983.   #     param: ID del parametro
  984.   #     value: valore della modifica
  985.   #--------------------------------------------------------------------------
  986.   def draw_feature_xparam(param, value)
  987.     return if value == 0
  988.     text = Vocab.ex_param(param)
  989.     color = value <= 0.0 ? :down : :up
  990.     rate = sprintf("%+d%%", value*100)
  991.     draw_detail(rate, text, nil, color)
  992.   end
  993.   #--------------------------------------------------------------------------
  994.   # * Disegna il modificatore di un parametro speciale
  995.   #     param: ID del parametro
  996.   #     value: valore della modifica
  997.   #--------------------------------------------------------------------------
  998.   def draw_feature_sparam(param, value)
  999.     text = Vocab.sp_param(param)
  1000.     case param
  1001.     when 1, 2, 3, 5, 9
  1002.       color = value <= 1.0 ? :down : :up
  1003.     when 4, 6, 7, 8
  1004.       color = value > 1.0 ? :down : :up
  1005.     else
  1006.       color = :default
  1007.     end
  1008.     rate = sprintf("%+d%%", (value-1)*100)
  1009.     draw_detail(rate, text, nil, color)
  1010.   end
  1011.   #--------------------------------------------------------------------------
  1012.   # * Disegna l'elemento aggiunto all'attacco
  1013.   #     element:id: ID dell'elemento
  1014.   #--------------------------------------------------------------------------
  1015.   def draw_feature_atk_element(element_id)
  1016.     draw_detail(Vocab.eltype(element_id), Vocab::EQ_ELEMENT)
  1017.   end
  1018.   #--------------------------------------------------------------------------
  1019.   # * Disegna lo stato aggiunto all'attacco
  1020.   #     state_id: ID dello stato
  1021.   #     value:    Probabilità di aggiunta
  1022.   #--------------------------------------------------------------------------
  1023.   def draw_feature_atk_state(state_id, value)
  1024.     state = $data_states[state_id]
  1025.     return if state.nil?
  1026.     text = sprintf("%s (%d%%)", state.name, value*100)
  1027.     draw_detail(text, Vocab::EQ_STATE, state.icon_index)
  1028.   end
  1029.   #--------------------------------------------------------------------------
  1030.   # * Disegna il modificatore della velocità d'attacco
  1031.   #     value:  valore della modifica
  1032.   #--------------------------------------------------------------------------
  1033.   def draw_feature_atk_speed(value)
  1034.     color = value > 0 ? :down : :up
  1035.     draw_detail(sprintf("%+d", value), Vocab::EQ_SPEED, nil, color)
  1036.   end
  1037.   #--------------------------------------------------------------------------
  1038.   # * Disegna il modificatore del numero di attacchi
  1039.   #     value:  numero di attacchi aggiuntivi
  1040.   #--------------------------------------------------------------------------
  1041.   def draw_feature_atk_times(value)
  1042.     color = value <= 0 ? :down : :up
  1043.     draw_detail(sprintf("%+d", value), Vocab::EQ_ATK_T, nil, color)
  1044.   end
  1045.   #--------------------------------------------------------------------------
  1046.   # * Disegna il tipo di abilità aggiunto
  1047.   #     type: tipo di abilità
  1048.   #--------------------------------------------------------------------------
  1049.   def draw_feature_sk_type(type)
  1050.     text = sprintf(Vocab::EQ_SKILL_SLOT, Vocab.skill_type(type))
  1051.     draw_detail(text, nil, nil, :special)
  1052.   end
  1053.   #--------------------------------------------------------------------------
  1054.   # * Disegna il tipo di abilità bloccato
  1055.   #     type: tipo di abilità
  1056.   #--------------------------------------------------------------------------
  1057.   def draw_feature_skt_seal(type)
  1058.     text = sprintf(Vocab::EQ_STYPE_SEAL, Vocab.skill_type(type))
  1059.     draw_detail(text, nil, nil, :down)
  1060.   end
  1061.   #--------------------------------------------------------------------------
  1062.   # * Disegna l'abilità che aggiunge l'oggetto
  1063.   #     skill_id: ID dell'abilità
  1064.   #--------------------------------------------------------------------------
  1065.   def draw_feature_sk_add(skill_id)
  1066.     text = Vocab::EQ_SKILL_ADD
  1067.     skill = $data_skills[skill_id]
  1068.     return if skill.nil?
  1069.     draw_detail(skill.name, text, skill.icon_index)
  1070.   end
  1071.   #--------------------------------------------------------------------------
  1072.   # * Disegna l'abilità che rimuove l'oggetto
  1073.   #     skill_id: ID dell'abilità
  1074.   #--------------------------------------------------------------------------
  1075.   def draw_feature_sk_seal(skill_id)
  1076.     text = Vocab::EQ_SKILL_REM
  1077.     skill = $data_skills[skill_id]
  1078.     return if skill.nil?
  1079.     draw_detail(skill.name, text, skill.icon_index, :down)
  1080.   end
  1081.   #--------------------------------------------------------------------------
  1082.   # * Disegna il tipo di arma che l'equip può aggiungere
  1083.   #     wtype_id: ID del tipo d'arma
  1084.   #--------------------------------------------------------------------------
  1085.   def draw_feature_eqt_add(wtype_id)
  1086.     text = sprintf(Vocab::EQ_EQUIP_WTYPE, Vocab.wtype(wtype_id))
  1087.     draw_detail(text, nil, nil, :special)
  1088.   end
  1089.   #--------------------------------------------------------------------------
  1090.   # * Disegna il tipo di armatura che l'oggetto può aggiungere
  1091.   #     atype_id: ID del tipo d'armatura
  1092.   #--------------------------------------------------------------------------
  1093.   def draw_feature_art_add(atype_id)
  1094.     text = sprintf(Vocab::EQ_EQUIP_ATYPE, Vocab.atype(atype_id))
  1095.     draw_detail(text, nil, nil, :special)
  1096.   end
  1097.   #--------------------------------------------------------------------------
  1098.   # * Disegna lo slot equipaggiamento che viene blocato dall'oggetto
  1099.   #     etype_id: ID dello slot
  1100.   #--------------------------------------------------------------------------
  1101.   def draw_feature_eq_fix(etype_id)
  1102.     text = sprintf(Vocab::EQ_EQUIP_FIX, Vocab.etype(etype_id))
  1103.     draw_detail(text)
  1104.   end
  1105.   #--------------------------------------------------------------------------
  1106.   # * Disegna il tipo di equipaggiamento che viene rimosso dall'oggetto
  1107.   #     etype_id: ID dello slot
  1108.   #--------------------------------------------------------------------------
  1109.   def draw_feature_eq_seal(etype_id)
  1110.     text = sprintf(Vocab::EQ_EQUIP_SEAL, Vocab.etype(etype_id))
  1111.     draw_detail(text)
  1112.   end
  1113.   #--------------------------------------------------------------------------
  1114.   # * Disegna il modificatore di slot equip (due armi o no)
  1115.   #     st: tipo di modifica (è sempre 1)
  1116.   #--------------------------------------------------------------------------
  1117.   def draw_feature_eq_slot_type(st)
  1118.     return if st != 1
  1119.     draw_detail(Vocab::EQ_DUAL_WIELD, nil, nil, :special)
  1120.   end
  1121.   #--------------------------------------------------------------------------
  1122.   # * Disegna la probabilità di eseguire più azioni in un turno
  1123.   #     value: probabilità dell'azione extra
  1124.   #--------------------------------------------------------------------------
  1125.   def draw_feature_action_plus(value)
  1126.     text = Vocab::EQ_ACTION_PLS
  1127.     value = sprintf("%+d%%",value*100)
  1128.     draw_detail(value, text)
  1129.   end
  1130.   #--------------------------------------------------------------------------
  1131.   # * Disegna un effetto speciale dell'oggetto
  1132.   #     flag_id: ID dell'effetto speciale
  1133.   #--------------------------------------------------------------------------
  1134.   def draw_feature_special_flag(flag_id)
  1135.     case flag_id
  1136.     when FLAG_ID_AUTO_BATTLE
  1137.       draw_detail(Vocab::EQ_AUTO, nil, nil, :special)
  1138.     when FLAG_ID_GUARD
  1139.       draw_detail(Vocab::EQ_GUARD, nil, nil, :special)
  1140.     when FLAG_ID_SUBSTITUTE
  1141.       draw_detail(Vocab::EQ_SUBST, nil, nil, :special)
  1142.     when FLAG_ID_PRESERVE_TP
  1143.       draw_detail(Vocab::EQ_PRESERVE, nil, nil, :special)
  1144.     end
  1145.   end
  1146.   #--------------------------------------------------------------------------
  1147.   # * Disegna un'abilità speciale che l'oggetto conferisce al gruppo
  1148.   #     flag_id: ID dell'abilità
  1149.   #--------------------------------------------------------------------------
  1150.   def draw_feature_party_ability(flag_id)
  1151.     case flag_id
  1152.     when 0
  1153.       draw_detail(Vocab::EQ_PARTY_ENC, nil, nil, :special)
  1154.     when 1
  1155.       draw_detail(Vocab::EQ_PARTY_ENC2, nil, nil, :special)
  1156.     when 2
  1157.       draw_detail(Vocab::EQ_PARTY_AMB, nil, nil, :special)
  1158.     when 3
  1159.       draw_detail(Vocab::EQ_PARTY_ENC, nil, nil, :special)
  1160.     when 4
  1161.       draw_detail(Vocab::EQ_PARTY_PRE, nil, nil, :special)
  1162.     when 5
  1163.       draw_detail(Vocab::EQ_PARTY_GOLD, nil, nil, :special)
  1164.     when 6
  1165.       draw_detail(Vocab::EQ_PARTY_DROP, nil, nil, :special)
  1166.     end
  1167.   end
  1168. end #window_detail  
  1169.  
  1170. #==============================================================================
  1171. # ** Window_UsableItemDetails
  1172. #------------------------------------------------------------------------------
  1173. #  Questa classe contiene la finestra unica per oggetti e abilità
  1174. #==============================================================================
  1175. class Window_UsableItemDetails < Window_DetailsBase
  1176.   #--------------------------------------------------------------------------
  1177.   # * scrive il dettaglio secondo l'ordine delle impostazioni
  1178.   #--------------------------------------------------------------------------
  1179.   def draw_item_details(detail_type)
  1180.     case detail_type
  1181.     when :target
  1182.       draw_target_detail
  1183.     when :repeat
  1184.       draw_repeat_detail
  1185.     when :element
  1186.       draw_element_detail
  1187.     when :status
  1188.       draw_status_detail
  1189.     when :success_r
  1190.       draw_success_rate_detail
  1191.     when :type        #tipo abilità
  1192.       draw_type_detail
  1193.     when :speed       #velocità
  1194.       draw_speed_detail
  1195.     when :damage
  1196.       draw_damage_detail
  1197.     when :tp_gain
  1198.       draw_tp_detail
  1199.     when :map_using
  1200.       draw_mapUsing_detail
  1201.     when :critical
  1202.       draw_critical
  1203.     when :buff
  1204.       draw_buff_detail
  1205.     end
  1206.   end
  1207.   #--------------------------------------------------------------------------
  1208.   # * disegna il tipo di obiettivo dell'abilità
  1209.   #--------------------------------------------------------------------------
  1210.   def draw_target_detail
  1211.     return if @item.scope == 0
  1212.     draw_detail(get_target, Vocab::SK_TARGET)
  1213.   end
  1214.   #--------------------------------------------------------------------------
  1215.   # * mostra i colpi multipli se superiori a 1
  1216.   #--------------------------------------------------------------------------
  1217.   def draw_repeat_detail
  1218.     return if @item.repeats <= 1
  1219.     draw_detail(@item.repeats, Vocab::SK_REPEAT)
  1220.   end
  1221.   #--------------------------------------------------------------------------
  1222.   # * mostra l'elemento dell'abilità
  1223.   #--------------------------------------------------------------------------
  1224.   def draw_element_detail
  1225.     return if @item.damage.element_id <= 0
  1226.     draw_detail(Vocab.eltype(@item.damage.element_id), Vocab::SK_ELEMENT)
  1227.   end
  1228.   #--------------------------------------------------------------------------
  1229.   # * mostra la probabilità di successo dell'abilità
  1230.   #--------------------------------------------------------------------------
  1231.   def draw_success_rate_detail
  1232.     return if @item.success_rate == 0 || @item.success_rate == 100
  1233.     draw_detail(@item.success_rate.to_s + "%", Vocab::SK_SUCCESS)
  1234.   end
  1235.   #--------------------------------------------------------------------------
  1236.   # * mostra il tipo di colpo (sicuro, fisico o magico)
  1237.   #--------------------------------------------------------------------------
  1238.   def draw_type_detail
  1239.     draw_detail(get_hit_type, Vocab::SK_TYPE)
  1240.   end
  1241.   #--------------------------------------------------------------------------
  1242.   # * mostra l'influenza dell'abilità sulla velocità
  1243.   #--------------------------------------------------------------------------
  1244.   def draw_speed_detail
  1245.     return if @item.speed == 0
  1246.     draw_detail(@item.speed, Vocab::SK_SPEED)
  1247.   end
  1248.   #--------------------------------------------------------------------------
  1249.   # * mostra una previsione del danno inflitto dall'abilità
  1250.   #--------------------------------------------------------------------------
  1251.   def draw_damage_detail
  1252.     return if @item.show_damage == false
  1253.     damage = @item.damage
  1254.     return if @item.damage.type == 0
  1255.     damage_power = get_damage_power
  1256.     return if damage_power == 0
  1257.     draw_detail(damage_power, get_damage_type)
  1258.   end
  1259.   #--------------------------------------------------------------------------
  1260.   # * mostra i tp che dona l'abilità
  1261.   #--------------------------------------------------------------------------
  1262.   def draw_tp_detail
  1263.     return if @item.tp_gain == 0
  1264.     draw_detail(@item.tp_gain, Vocab::SK_TP)
  1265.   end
  1266.   #--------------------------------------------------------------------------
  1267.   # * mostra l'informazione se può essere usata su mappa
  1268.   #--------------------------------------------------------------------------
  1269.   def draw_mapUsing_detail
  1270.     draw_detail(Vocab::SK_MENU) if @item.menu_ok?
  1271.   end
  1272.   #--------------------------------------------------------------------------
  1273.   # * mostra se l'abilità consente colpi critici
  1274.   #--------------------------------------------------------------------------
  1275.   def draw_critical
  1276.     draw_detail(Vocab::SK_CRITICAL) if @item.damage.critical
  1277.   end
  1278.   #--------------------------------------------------------------------------
  1279.   # * ottiene l'effetto dell'abilità
  1280.   #--------------------------------------------------------------------------
  1281.   def get_damage_type
  1282.     case @item.damage.type
  1283.     when 1
  1284.       sprintf(Vocab::SK_DAMAGE, Vocab::hp_a)
  1285.     when 2
  1286.       sprintf(Vocab::SK_DAMAGE, Vocab::mp_a)
  1287.     when 3
  1288.       sprintf(Vocab::SK_HEAL, Vocab::hp_a)
  1289.     when 4
  1290.       sprintf(Vocab::SK_HEAL, Vocab::mp_a)
  1291.     when 5
  1292.       sprintf(Vocab::SK_ABS, Vocab::hp_a)
  1293.     when 6
  1294.       sprintf(Vocab::SK_ABS, Vocab::mp_a)
  1295.     end
  1296.   end
  1297.   #--------------------------------------------------------------------------
  1298.   # * ottiene il tipo di buff dell'abilità come testo
  1299.   #--------------------------------------------------------------------------
  1300.   def get_buff_bonus(effect)
  1301.     case effect.code
  1302.     when EFFECT_ADD_BUFF
  1303.       type = Vocab::SK_BUFF
  1304.     when EFFECT_ADD_DEBUFF
  1305.       type = Vocab::SK_DEBUFF
  1306.     when EFFECT_REMOVE_BUFF, EFFECT_REMOVE_DEBUFF
  1307.       noturns = true
  1308.       type = Vocab::SK_REM_BUFF
  1309.     end
  1310.     param = Vocab.param(effect.data_id)
  1311.     turns = effect.value1
  1312.     return noturns ? sprintf(type, param) : sprintf(type, param, turns)
  1313.   end
  1314.   #--------------------------------------------------------------------------
  1315.   # * ottiene lo scope dell'abilità (selezione dell'obiettivo)
  1316.   #--------------------------------------------------------------------------
  1317.   def get_target
  1318.     case @item.scope
  1319.     when 1
  1320.       Vocab::SK_TG_1E
  1321.     when 2
  1322.       Vocab::SK_TG_AE
  1323.     when 3
  1324.       Vocab::SK_TG_1RE
  1325.     when 4
  1326.       Vocab::SK_TG_2RE
  1327.     when 5
  1328.       Vocab::SK_TG_3RE
  1329.     when 6
  1330.       Vocab::SK_TG_4RE
  1331.     when 7
  1332.       Vocab::SK_TG_1A
  1333.     when 8
  1334.       Vocab::SK_TG_AA
  1335.     when 9
  1336.       Vocab::SK_TG_DA
  1337.     when 10
  1338.       Vocab::SK_TG_AD
  1339.     when 11
  1340.       Vocab::SK_TG_SF
  1341.     end
  1342.   end
  1343.   #--------------------------------------------------------------------------
  1344.   # * ottiene il tipo di colpo dell'abilità
  1345.   #--------------------------------------------------------------------------
  1346.   def get_hit_type
  1347.     case @item.hit_type
  1348.     when 0
  1349.       Vocab::SK_GUARANTED
  1350.     when 1
  1351.       Vocab::SK_ATTACK
  1352.     when 2
  1353.       Vocab::SK_MAGIC
  1354.     end
  1355.   end  
  1356.   #--------------------------------------------------------------------------
  1357.   # * ottiene la potenza del danno dell'abilità sperimentandola su un nemico
  1358.   #   o su se stessi se è una abilità su alleato
  1359.   #--------------------------------------------------------------------------
  1360.   def get_damage_power
  1361.     if @item.for_opponent?
  1362.       enemy = Game_Enemy.new(1, Det_Config::SAMPLE_ENEMY)
  1363.       damage = @item.damage.eval(actor.clone, enemy, $game_variables.clone)
  1364.     else
  1365.       damage = @item.damage.eval(actor.clone, actor.clone, $game_variables.clone)
  1366.     end
  1367.     damage *= -1 if damage < 0
  1368.     return damage
  1369.   end
  1370. end #usableitem
  1371.  
  1372. #==============================================================================
  1373. # ** Window_SkillDetails
  1374. #------------------------------------------------------------------------------
  1375. #  Questa classe contiene la finestra che mostra i dettagli dell'abilità
  1376. #==============================================================================
  1377. class Window_SkillDetails < Window_UsableItemDetails
  1378.   #--------------------------------------------------------------------------
  1379.   # * scrive i dati dell'abilità
  1380.   #--------------------------------------------------------------------------
  1381.   def draw_specific_details
  1382.     super
  1383.     for i in 0..Det_Config::SKILL_DETAILS.size-1
  1384.       draw_item_details(Det_Config::SKILL_DETAILS[i])
  1385.     end
  1386.   end
  1387.   #--------------------------------------------------------------------------
  1388.   # * scrive il dettaglio secondo l'ordine delle impostazioni
  1389.   #--------------------------------------------------------------------------
  1390.   def draw_item_details(detail_type)
  1391.     super
  1392.     case detail_type
  1393.     when :cost
  1394.       draw_cost_detail
  1395.     when :required_w
  1396.       draw_required_weapons
  1397.     end
  1398.   end
  1399.   #--------------------------------------------------------------------------
  1400.   # * disegna il costo dell'abilità
  1401.   #--------------------------------------------------------------------------
  1402.   def draw_cost_detail
  1403.     if @item.mp_cost > 0
  1404.       draw_detail(@item.mp_cost, sprintf(Vocab::SK_COST,Vocab::mp_a))
  1405.     end
  1406.     if @item.tp_cost > 0
  1407.       draw_detail(@item.tp_cost, sprintf(Vocab::SK_COST,Vocab::tp_a))
  1408.     end
  1409.   end
  1410.   #--------------------------------------------------------------------------
  1411.   # * mostra le armi richieste
  1412.   #--------------------------------------------------------------------------
  1413.   def draw_required_weapons
  1414.     draw_required_weapon(@item.required_wtype_id1)
  1415.     draw_required_weapon(@item.required_wtype_id2)
  1416.   end
  1417.   #--------------------------------------------------------------------------
  1418.   # * disegna l'arma
  1419.   #--------------------------------------------------------------------------
  1420.   def draw_required_weapon(weapon_type_id)
  1421.     return if weapon_type_id == 0
  1422.     weapon = Vocab.wtype(weapon_type_id)
  1423.     draw_detail(weapon, Vocab::SK_REQUIRE)
  1424.   end    
  1425. end #vindow_skilldetail
  1426.  
  1427. #==============================================================================
  1428. # ** Window_ItemDetails
  1429. #------------------------------------------------------------------------------
  1430. #  Questa classe contiene la finestra che mostra i dettagli degli oggetti
  1431. #==============================================================================
  1432. class Window_ItemDetails < Window_UsableItemDetails
  1433.   #--------------------------------------------------------------------------
  1434.   # * scrive i dati dell'oggetto
  1435.   #--------------------------------------------------------------------------
  1436.   def draw_specific_details
  1437.     super
  1438.     case @item
  1439.     when RPG::Item
  1440.       details_item
  1441.     when RPG::EquipItem
  1442.       details_equip
  1443.     end
  1444.   end
  1445.   #--------------------------------------------------------------------------
  1446.   # * Disegna i dettagli dell'oggetto
  1447.   #--------------------------------------------------------------------------
  1448.   def details_item
  1449.     for i in 0..Det_Config::ITEM_DETAILS.size-1
  1450.       draw_item_details(Det_Config::ITEM_DETAILS[i])
  1451.     end
  1452.   end
  1453.   #--------------------------------------------------------------------------
  1454.   # * Disegna i dettagli dell'equipaggiamento
  1455.   #--------------------------------------------------------------------------
  1456.   def details_equip
  1457.     for i in 0..Det_Config::EQUIP_DETAILS.size-1
  1458.       draw_equip_details(Det_Config::EQUIP_DETAILS[i])
  1459.     end
  1460.   end
  1461.   #--------------------------------------------------------------------------
  1462.   # * scrive il dettaglio secondo l'ordine delle impostazioni
  1463.   #     detail_type: tipo del dettaglio
  1464.   #--------------------------------------------------------------------------
  1465.   def draw_item_details(detail_type)
  1466.     super
  1467.     case detail_type
  1468.     when :consumable
  1469.       draw_consumable_detail
  1470.     when :key_item
  1471.       draw_key_detail
  1472.     when :sellprice
  1473.       draw_sell_detail
  1474.     end
  1475.   end
  1476.   #--------------------------------------------------------------------------
  1477.   # * Disegna i dettagli dell'equipaggiamento secondo l'ordine delle impost.
  1478.   #     detail_type: tipo del dettaglio
  1479.   #--------------------------------------------------------------------------
  1480.   def draw_equip_details(detail_type)
  1481.     case detail_type
  1482.     when :sellprice
  1483.       draw_sell_detail
  1484.     when :params
  1485.       draw_params_detail
  1486.     when :type
  1487.       draw_type_detail
  1488.     when :awtype
  1489.       draw_etype_detail
  1490.     end
  1491.   end
  1492.   #--------------------------------------------------------------------------
  1493.   # * scrive se consumabile
  1494.   #--------------------------------------------------------------------------
  1495.   def draw_consumable_detail
  1496.     draw_detail(Vocab::IT_CONSUMABLE) if @item.consumable
  1497.   end
  1498.   #--------------------------------------------------------------------------
  1499.   # * scrive se è un oggetto chiave
  1500.   #--------------------------------------------------------------------------
  1501.   def draw_key_detail
  1502.     draw_detail(Vocab::IT_KEY) if @item.key_item?
  1503.   end
  1504.   #--------------------------------------------------------------------------
  1505.   # * scrive il prezzo di vendita
  1506.   #--------------------------------------------------------------------------
  1507.   def draw_sell_detail
  1508.     if @item.price == 0
  1509.       text = Vocab::IT_UNSELL
  1510.       col_type = :disabled
  1511.     else
  1512.       text = item_price + Vocab.currency_unit
  1513.       col_type = :default
  1514.     end
  1515.     draw_detail(text, Vocab::IT_SELL, nil, col_type)
  1516.   end
  1517.  
  1518.   #--------------------------------------------------------------------------
  1519.   # * restituisce il prezzo dell'oggetto/equip
  1520.   #--------------------------------------------------------------------------
  1521.   def item_price
  1522.     return (@item.price/2).to_s
  1523.   end
  1524.   #--------------------------------------------------------------------------
  1525.   # * Disegna il parametro che viene modificato
  1526.   #--------------------------------------------------------------------------
  1527.   def draw_params_detail
  1528.     for i in 0..@item.params.size-1
  1529.       draw_param(i)
  1530.     end
  1531.   end
  1532.   #--------------------------------------------------------------------------
  1533.   # * Disegna il parametro
  1534.   #     param_index: ID del parametro
  1535.   #--------------------------------------------------------------------------
  1536.   def draw_param(param_index)
  1537.     param_name = Vocab.param(param_index)
  1538.     value = @item.params[param_index]
  1539.     return if value == 0
  1540.     color = value > 0 ? :up : :down
  1541.     draw_detail(sprintf("%+d",value), param_name, nil, color)
  1542.   end
  1543.   #--------------------------------------------------------------------------
  1544.   # * Disegna il tipo d'equipaggiamento secondo lo slot
  1545.   #--------------------------------------------------------------------------
  1546.   def draw_type_detail
  1547.     name = Vocab::EQ_TYPE
  1548.     type = Vocab::etype(@item.etype_id)
  1549.     draw_detail(type, name)
  1550.   end
  1551.   #--------------------------------------------------------------------------
  1552.   # * Disegna il tipo di equipaggiamento secondo la categoria
  1553.   #--------------------------------------------------------------------------
  1554.   def draw_etype_detail
  1555.     @item.is_a?(RPG::Weapon) ? draw_weapon_type : draw_armor_type
  1556.   end
  1557.   #--------------------------------------------------------------------------
  1558.   # * Disegna il tipo d'arma
  1559.   #--------------------------------------------------------------------------
  1560.   def draw_weapon_type
  1561.     name = Vocab::WP_TYPE
  1562.     value = $data_system.weapon_types[@item.wtype_id]
  1563.     draw_detail(value, name)
  1564.   end
  1565.   #--------------------------------------------------------------------------
  1566.   # * Disegna il tipo d'armatura
  1567.   #--------------------------------------------------------------------------
  1568.   def draw_armor_type
  1569.     name = Vocab::EQ_TYPE
  1570.     value = $data_system.armor_types[@item.atype_id]
  1571.     draw_detail(value, name)
  1572.   end
  1573. end #vindow_itemdetail
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement