# ╔═══════════════════════════════════════════════╦════════════════════╗
# ║ Title: Falco Mana Stone Extension ║ Version: 1.02 ║
# ║ Author: Roninator2 ║ ║
# ╠═══════════════════════════════════════════════╬════════════════════╣
# ║ Function: ║ Date Created ║
# ║ ╠════════════════════╣
# ║ Add Mana Stone Combination features ║ 16 Jun 2024 ║
# ╚═══════════════════════════════════════════════╩════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Requires: Falco Mana Stones ║
# ║ ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Brief Description: ║
# ║ Gives the option to add more bonuses when stones and added ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Instructions: ║
# ║ When stones are added in a particular order, bonus features ║
# ║ are added to the item. ║
# ║ ║
# ║ Fill out the combo's to be used in the FalMana Stone area below ║
# ║ ║
# ║ ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Updates: ║
# ║ 1.00 - 16 Nov 2024 - Script finished ║
# ║ 1.01 - 17 Nov 2024 - Converted to Item features not actor ║
# ║ 1.02 - 19 Nov 2024 - Added - adding states with names ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Credits and Thanks: ║
# ║ Roninator2 ║
# ║ ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Terms of use: ║
# ║ Follow the original Authors terms of use where applicable ║
# ║ - When not made by me (Roninator2) ║
# ║ Free for all uses in RPG Maker except nudity ║
# ║ Anyone using this script in their project before these terms ║
# ║ were changed are allowed to use this script even if it conflicts ║
# ║ with these new terms. New terms effective 03 Apr 2024 ║
# ║ No part of this code can be used with AI programs or tools ║
# ║ Credit must be given ║
# ╚════════════════════════════════════════════════════════════════════╝
module FalMana
STONE_COMBO = { # add your combos here
# [item id's, ...] => [:param, value]
# if you change this mid game you will have to start over
[17,17] => [:mhp, 50],
[18,18] => [:mmp, 20],
[17,18] => [:atk, 5],
[19,20] => [:def, 5],
[19,20,21] => [:def, 50],
}
COMBO_NAMES = {
# [item id's, ...] => ["text string", state id to apply]
[17,17] => [" of Knight's Valor", 4],
[18,18] => [" of two", 0],
[17,18] => [" of three", 0],
[19,20] => [" of four", 0],
[19,20,21] => [" of five", 0],
}
end
# ╔════════════════════════════════════════════════════════════════════╗
# ║ End of editable region ║
# ╚════════════════════════════════════════════════════════════════════╝
module FalMana
def self.socket_manastone(item, index, value, actor)
item.manaslots[index] = value
actor.add_param(value.manastone_param[0], value.manastone_param[1])
stone_combo(item, :add)
name_combo(item, actor)
end
def self.remove_manastone(item, index, value, actor)
stone_combo(item, :remove)
item.manaslots[index] = nil
actor.add_param(value.manastone_param[0], - value.manastone_param[1])
name_combo(item, actor)
end
def self.clear_manastones(item, actor)
stone_combo(item, :clear)
item.manaslots.each {|m| actor.add_param(m.manastone_param[0],
- m.manastone_param[1]) unless m.nil?}
item.manaslots.size.times {|i| item.manaslots[i] = nil}
name_combo(item, actor)
end
def self.stone_combo(item, process)
return if item.nil?
return if item.manaslots.nil?
combo = FalMana::STONE_COMBO
if @cb_on.nil?
@cb_on = {}
combo.each do |a|
@cb_on[a[0]] = false
end
end
item.name = item.original_name
combo.each_with_index { |c,i|
s = c[0].size
cb = false
item.manaslots.each_with_index { |mi,j|
next if j == 0
k = -1
dv = []
s.times do
dv[j+k] = item.manaslots[j+k].nil? ? nil : item.manaslots[j+k].id
k += 1
end
dv.compact!
if c[0] == dv
@cb_on.each do |cba|
p = c[1][0]
v = c[1][1]
adjust_param(p, v, item, process, cba) if cba[0] == dv
end
end
}
}
end
def self.name_combo(item, actor)
return if item.nil?
return if item.manaslots.nil?
combo = FalMana::STONE_COMBO
combo.each_with_index { |c,i|
s = c[0].size
item.manaslots.each_with_index { |mi,j|
next if j == 0
k = -1
dv = []
s.times do
dv[j+k] = item.manaslots[j+k].nil? ? nil : item.manaslots[j+k].id
k += 1
end
dv.compact!
if c[0] == dv
add_name = FalMana::COMBO_NAMES[dv][0]
item.name = item.name + add_name if add_name != nil
actor.add_state(FalMana::COMBO_NAMES[dv][1]) if FalMana::COMBO_NAMES[dv][1] > 0
end
}
}
end
def self.adjust_param(param, value, item, option, cba)
case option
when :add
case param
when :tgr, :grd, :rec, :pha, :mcr, :tcr, :pdr, :mdr, :fdr, :exr
list = [:tgr, :grd, :rec, :pha, :mcr, :tcr, :pdr, :mdr, :fdr, :exr]
list.each_with_index do |st, j|
if param == st
value = value.to_f / 100 + 1
item.features.push(RPG::BaseItem::Feature.new(23, j, value))
end
end
when :hit, :eva, :cri, :cev, :mev, :mrf, :cnt, :hrg, :mrg, :trg
list = [:hit, :eva, :cri, :cev, :mev, :mrf, :cnt, :hrg, :mrg, :trg]
list.each_with_index do |st, j|
if param == st
value = value.to_f / 100
item.features.push(RPG::BaseItem::Feature.new(22, id, value))
end
end
when :mhp, :mmp, :atk, :def, :mat, :mdf, :agi, :luk
list = [:mhp, :mmp, :atk, :def, :mat, :mdf, :agi, :luk]
list.each_with_index do |st, j|
if param == st
item.params[j] += value
end
end
end
@cb_on[cba[0]] = true
when :remove
case param
when :tgr, :grd, :rec, :pha, :mcr, :tcr, :pdr, :mdr, :fdr, :exr
list = [:tgr, :grd, :rec, :pha, :mcr, :tcr, :pdr, :mdr, :fdr, :exr]
list.each_with_index do |st, j|
if param == st
value = value.to_f / 100 + 1
ft = RPG::BaseItem::Feature.new(23, j, value)
item.features.each do |rft|
rft.delete if rft == ft
end
item.features.compact!
end
end
when :hit, :eva, :cri, :cev, :mev, :mrf, :cnt, :hrg, :mrg, :trg
list = [:hit, :eva, :cri, :cev, :mev, :mrf, :cnt, :hrg, :mrg, :trg]
list.each_with_index do |st, j|
if param == st
value = value.to_f / 100
ft = RPG::BaseItem::Feature.new(22, j, value)
item.features.each do |rft|
rft.delete if rft == ft
end
item.features.compact!
end
end
when :mhp, :mmp, :atk, :def, :mat, :mdf, :agi, :luk
list = [:mhp, :mmp, :atk, :def, :mat, :mdf, :agi, :luk]
list.each_with_index do |st, j|
if param == st
item.params[j] -= value
end
end
end
@cb_on[cba[0]] = false
when :clear
case param
when :tgr, :grd, :rec, :pha, :mcr, :tcr, :pdr, :mdr, :fdr, :exr
list = [:tgr, :grd, :rec, :pha, :mcr, :tcr, :pdr, :mdr, :fdr, :exr]
list.each_with_index do |st, j|
if param == st
value = value.to_f / 100 + 1
ft = RPG::BaseItem::Feature.new(23, j, value)
item.features.each do |rft|
rft.delete if rft == ft
end
item.features.compact!
end
end
when :hit, :eva, :cri, :cev, :mev, :mrf, :cnt, :hrg, :mrg, :trg
list = [:hit, :eva, :cri, :cev, :mev, :mrf, :cnt, :hrg, :mrg, :trg]
list.each_with_index do |st, j|
if param == st
value = value.to_f / 100
ft = RPG::BaseItem::Feature.new(22, j, value)
item.features.each do |rft|
rft.delete if rft == ft
end
item.features.compact!
end
end
when :mhp, :mmp, :atk, :def, :mat, :mdf, :agi, :luk
list = [:mhp, :mmp, :atk, :def, :mat, :mdf, :agi, :luk]
list.each_with_index do |st, j|
if param == st
item.params[j] -= value
end
end
end
@cb_on[cba[0]] = false
end
end
end
module DataManager
class <<self
alias load_database_original_r2_equip_name load_database
end
def self.load_database
load_database_original_r2_equip_name
load_original_r2_equip_name
end
def self.load_original_r2_equip_name
groups = [$data_weapons, $data_armors]
for group in groups
for obj in group
next if obj.nil?
obj.load_original_r2_equip_name
end
end
end
end
class RPG::EquipItem
attr_accessor :original_name
def load_original_r2_equip_name
@original_name = self.name
end
end
class Game_Actor < Game_Battler
def change_equip(slot_id, item)
FalMana.stone_combo(@equips[slot_id].object, :clear)
FalMana.add_param(self, @equips[slot_id].object, true)
FalMana.add_param(self, item)
falcaomanastones_change(slot_id, item)
FalMana.stone_combo(item, :add)
end
end