iamnotknown
Member
um link is broken, thanks
#===============================================================================
# ** RGSS.BattleAction
#-------------------------------------------------------------------------------
# Description:
# ------------
#
# Makes setting battle actions faster and easier, from both the Game_Battler
# or directly to a Game_BattleAction object itself.
#
# Method List:
# ------------
#
# Game_BattleAction
# -----------------
# do_attack
# do_skill
# do_defend
# do_item
# do_escape
# do_nothing
#
# Game_Battler
# ------------
# do_attack
# do_skill
# do_defend
# do_item
# do_escape
# do_nothing
#===============================================================================
MACL::Loaded << 'RGSS.BattleAction'
#===============================================================================
# ** Game_BattleAction
#===============================================================================
class Game_BattleAction
#-----------------------------------------------------------------------------
# * Name : Do Attack
# Info : Sets Battle Action for Attack
# Author : Kain Nobel
# Call Info : Target (Optional) is a type of Game_Battler
#-----------------------------------------------------------------------------
def do_attack
@basic = 0
@kind = 0
end
#-----------------------------------------------------------------------------
# * Name : Do Skill
# Info : Sets Battle Action for Skill
# Author : Kain Nobel
# Call Info : Skill ID (Numeric) is ID of skill (Optional)
# Target (Optional) is a type of Game_Battler
#-----------------------------------------------------------------------------
def do_skill(skill_id = 0)
unless $data_skills[skill_id].is_a?(RPG::Skill)
clear
return
end
@kind = 1
@skill_id = skill_id
end
#-----------------------------------------------------------------------------
# * Name : Do Defend
# Info : Sets Battle Action for Defend
# Author : Kain Nobel
# Call Info : None
#-----------------------------------------------------------------------------
def do_defend
@basic = 1
@kind = 0
end
#-----------------------------------------------------------------------------
# * Name : Do Item
# Info : Sets Battle Action for Item
# Author : Kain Nobel
# Call Info : Item ID (Numeric) is ID of item (Optional)
# Target (Optional) is a type of Game_Battler
#-----------------------------------------------------------------------------
def do_item(item_id = 0, target = nil)
unless $data_items[item_id].is_a?(RPG::Item)
clear
return
end
@kind = 2
@skill_id = item_id
end
#-----------------------------------------------------------------------------
# * Name : Do Escape
# Info : Sets Battle Action for Escape
# Author : Kain Nobel
# Call Info : None
#-----------------------------------------------------------------------------
def do_escape
@kind = 0
@basic = 2
end
#-----------------------------------------------------------------------------
# * Name : Do Nothing
# Info : Sets Battle Action for Nothing
# Author : Kain Nobel
# Call Info : None
#-----------------------------------------------------------------------------
def do_nothing
@kind = 0
@basic = 3
end
end
#===============================================================================
# ** Game_Battler
#===============================================================================
class Game_Battler
#-----------------------------------------------------------------------------
# * Name : Do Attack
# Info : Current Action Does Attack and Selects Target
# Author : Kain Nobel
# Call Info : None
#-----------------------------------------------------------------------------
def do_attack
self.current_action.do_attack
if $scene.respond_to?(:set_target_battlers)
$scene.set_target_battlers(1)
end
end
#-----------------------------------------------------------------------------
# * Name : Do Skill
# Info : Current Action Does Skill and Selects Target
# Author : Kain Nobel
# Call Info : Skill ID (Numeric) Representing Skill from Database
#-----------------------------------------------------------------------------
def do_skill(skill_id)
skill = $data_skills[skill_id]
self.current_action.do_skill(skill.id)
if $scene.respond_to?(:set_target_battlers) && !skill.nil?
$scene.set_target_battlers(skill.scope)
end
end
#-----------------------------------------------------------------------------
# * Name : Do Defend
# Info : Current Action Does Defend
# Author : Kain Nobel
# Call Info : None
#-----------------------------------------------------------------------------
def do_defend
self.current_action.do_defend
if $scene.respond_to?(:set_target_battlers)
$scene.set_target_battlers(0)
end
end
#-----------------------------------------------------------------------------
# * Name : Do Item
# Info : Current Action Does Item and Selects Target
# Author : Kain Nobel
# Call Info : Item ID (Numeric) Representing Item from Database
#-----------------------------------------------------------------------------
def do_item(item_id)
item = $data_items[item_id]
self.current_action.do_item(item.id)
if $scene.respond_to?(:set_target_battlers) && !item.nil?
$scene.set_target_battlers(item.scope)
end
end
#-----------------------------------------------------------------------------
# * Name : Do Defend
# Info : Current Action Does Escape
# Author : Kain Nobel
# Call Info : None
#-----------------------------------------------------------------------------
def do_escape
self.current_action.do_escape
if $scene.respond_to?(:set_target_battlers)
$scene.set_target_battlers(0)
end
end
#-----------------------------------------------------------------------------
# * Name : Do Nothing
# Info : Current Action Does Nothing
# Author : Kain Nobel
# Call Info : None
#-----------------------------------------------------------------------------
def do_nothing
self.current_action.do_nothing
if $scene.respond_to?(:set_target_battlers)
$scene.set_target_battlers(0)
end
end
end
#===============================================================================
# ** Scene_Battle
#===============================================================================
class Scene_Battle
#-----------------------------------------------------------------------------
# * Public Instance Variables
#-----------------------------------------------------------------------------
attr_reader :target_battlers
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :macl_snbattle_settargetbattlers, :set_target_battlers
#-----------------------------------------------------------------------------
# * Set Target Battlers
#-----------------------------------------------------------------------------
def set_target_battlers(scope)
@target_battlers ||= Array.new
macl_snbattle_settargetbattlers(scope)
end
end
Does the Macl script have a licence ?
Can we use it in the games we want ? (crediting the authors)
Can we use it in commercial projects ? (crediting the authors too)
#==============================================================================
# ** RGSS.Bitmap.misc
#------------------------------------------------------------------------------
# Description:
# ------------
# Miscellaneous New stuff for the Bitmap class.
#
# Method List:
# ------------
# make_png
#==============================================================================
#==============================================================================
# ** Bitmap
#==============================================================================
class Bitmap
#-------------------------------------------------------------------------
# * Name : Make PNG
# Info : Saves Bitmap to File
# Author : ??? - [url=http://www.66rpg.com/htm/news624.htm]http://www.66rpg.com/htm/news624.htm[/url]
# Call Info : Zero to Three Arguments
# Name : Name of filenam
# Path : Directory in Game Folder
# Mode : Mode of Writing
#-------------------------------------------------------------------------
def make_png(name = 'like', path = '', mode = 0)
Dir.make_dir(path) if path != ''
f = Png_File.new(path + name + '.png', 'wb')
f.make_png(self)
f.close
end
end
#==============================================================================
# ** Class Png_File
#------------------------------------------------------------------------------
# Description:
# ------------
# Adds PNG_File class to save Bitmap's to PNG Files
#
# Class List:
# -----------
# Png_File
#==============================================================================
#==============================================================================
# ** Png_File
#==============================================================================
class Png_File < File
#--------------------------------------------------------------------------
# * Make PNG
#--------------------------------------------------------------------------
def make_png(bitmap)
# Save Bitmap & Mode
@bitmap = bitmap
# Create & Save PNG
self.write(make_header)
self.write(make_ihdr)
self.write(make_idat)
self.write(make_iend)
end
#--------------------------------------------------------------------------
# * Make Header
#--------------------------------------------------------------------------
def make_header
return [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a].pack('C*')
end
#--------------------------------------------------------------------------
# * Make IHDR
#--------------------------------------------------------------------------
def make_ihdr
ih_size = [13].pack("N")
ih_sign = 'IHDR'
ih_width = [@bitmap.width].pack('N')
ih_height = [@bitmap.height].pack('N')
ih_bit_depth = [8].pack('C')
ih_color_type = [6].pack('C')
ih_compression_method = [0].pack('C')
ih_filter_method = [0].pack('C')
ih_interlace_method = [0].pack('C')
string = ih_sign + ih_width + ih_height + ih_bit_depth + ih_color_type +
ih_compression_method + ih_filter_method + ih_interlace_method
ih_crc = [Zlib.crc32(string)].pack('N')
return ih_size + string + ih_crc
end
#--------------------------------------------------------------------------
# * Make IDAT
#--------------------------------------------------------------------------
def make_idat
header = "\x49\x44\x41\x54"
data = make_bitmap_data
size = [data.length].pack('N')
crc = [Zlib.crc32(header + data)].pack('N')
return size + header + data + crc
end
#--------------------------------------------------------------------------
# * Make bitmap data
#--------------------------------------------------------------------------
def make_bitmap_data
deflater = Zlib::Deflate.new(8)
t_Fx = 0
for y in 0...@bitmap.height
deflater << [0].pack("C*")
for x in 0...@bitmap.width
Graphics.update if (t_Fx += 1) % 10000 == 0
color = @bitmap.get_pixel(x, y)
deflater << [color.red, color.green, color.blue, color.alpha].pack("C*")
end
end
return deflater.flush(Zlib::FINISH)
end
#--------------------------------------------------------------------------
# * Make IEND
#--------------------------------------------------------------------------
def make_iend
ie_size = [0].pack('N')
ie_sign = 'IEND'
ie_crc = [Zlib.crc32(ie_sign)].pack('N')
return ie_size + ie_sign + ie_crc
end
end
,.,
|M|
|M|
`*`