#==============================================================================
# ** Super Simple Cursed Items
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.0
# 03-21-2012
# RGSS / RMXP - Involves Rewrites
#------------------------------------------------------------------------------
# วิธีใช้งานโดย natsukikung
# INTRODUCTION:
#
# This lets you make certain weapons or pieces of armor cursed and unable to
# be removed without a script call. Nope, there's no item switching like in
# Guillaume777's or DerVVulfman's Slot systems. Not being included. ^_-
#
# It's called 'Simple' right? ^_^
#
#==============================================================================
#อาวุธต้องคำสาปไม่สามารถถอดได้ด้วยเมนูสวมใส่แต่ถอดได้ด้วยคำสั่งจากตัวโปรแกรม
module CursePatch
# * Cursed Equipment
# * You can insert the IDs of your cursed weapons or armor pieces in these
# * arrays to identify which gear cannot be self unequipped.
#
CURSED_WEAPONS = [1,2.3] #ใส่ไอดีอาวุธที่ต้องการให้ติดคำสาปถอดไม่ได้ (อย่าลืมลูกน้ำด้วยต่อตัวเลขด้วย)
CURSED_ARMOR = [] #ใส่ไอดีชุดเกราะที่อยากให้ติดคำสาป
# * Cursed Effect Tag
# * You can add this string to the end of your weapon or armor names so
# * they identify which items cannot be self unequipped. Strings will
# * be enclosed within parenthesis. Ex: Unknown Sword (cursed)
#
CURSED = 'cursed'
# * Cursed Color
# * Your typical 'color array' for any cursed items
COLOR_CURSED = Color.new(255, 107, 107, 255) #[ปรับเปลี่ยนสีชื่ออาวุธต้องสาปจากค่าตัวเลขที่นี่]
end
#==============================================================================
# ** RPG
#------------------------------------------------------------------------------
# A module containing RPGXP's data structures and more.
#==============================================================================
module RPG
#--------------------------------------------------------------------------
# * Reset values
#--------------------------------------------------------------------------
def RPG.cursereset
if @initialize_cursed_items then return end
# Loop through armors and set cursed flag
for armor in $data_armors
armor.set_cursed unless armor.nil?
end
# Loop through weapons and set cursed flag
for weapon in $data_weapons
weapon.set_cursed unless weapon.nil?
end
@initialize_cursed_items = true
end
#--------------------------------------------------------------------------
# * RPG Initialized
# bool : boolean value (true/false)
#--------------------------------------------------------------------------
def RPG.initialize_cursed_items=(bool)
@initialize_cursed_items = bool
end
#============================================================================
# ** Armor
#----------------------------------------------------------------------------
# Data class for armors.
#============================================================================
class RPG::Armor
#------------------------------------------------------------------------
# * Public Instance Variables
#------------------------------------------------------------------------
attr_accessor :cursed
#------------------------------------------------------------------------
# * Set Cursed
#------------------------------------------------------------------------
def set_cursed
pattern = '(' + CursePatch::CURSED + ')'
@cursed = true if @name.sub!(pattern, '') != nil
@cursed = true if CursePatch::CURSED_ARMOR.include?(@id)
end
end
#============================================================================
# ** Weapon
#----------------------------------------------------------------------------
# Data class for weapons.
#============================================================================
class RPG::Weapon
#------------------------------------------------------------------------
# * Public Instance Variables
#------------------------------------------------------------------------
attr_accessor :cursed
#------------------------------------------------------------------------
# * Set Cursed
#------------------------------------------------------------------------
def set_cursed
pattern = '(' + CursePatch::CURSED + ')'
@cursed = true if @name.sub!(pattern, '') != nil
@cursed = true if CursePatch::CURSED_WEAPONS.include?(@id)
end
end
end
#==============================================================================
# ** Window_EquipRight
#------------------------------------------------------------------------------
# This window displays items the actor is currently equipped with on the
# equipment screen.
#==============================================================================
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# * Draw Item Name
# item : item
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# translucent : translucent
#--------------------------------------------------------------------------
def draw_item_name(item, x, y)
return if item == nil
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.font.color = CursePatch::COLOR_CURSED if item.cursed
self.contents.draw_text(x + 28, y, 212, 32, item.name)
end
end
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs title screen processing.
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Fix items as you open RMXP
#--------------------------------------------------------------------------
alias cursepatch_title_main main
def main
RPG.initialize_cursed_items = false
cursepatch_title_main
RPG.cursereset
end
end
#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs equipment screen processing.
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# * Frame Update (when right window is active)
#--------------------------------------------------------------------------
alias cursepatch_update_right update_right
def update_right
if Input.trigger?(Input::C)
item = @right_window.item
unless item.nil?
return $game_system.se_play($data_system.buzzer_se) if item.cursed
end
end
# Perform the original call
cursepatch_update_right
end
end