KID's Luck Systems(무슨 뜻?)

by Man... posted Oct 27, 2008
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄

#------------------------------------------------------------------------------
# By Nam Kid
# Luck Systems VX 1.2
# Li�n H�? : zaw.thieugia_vl@yahoo.com
# hoa?c : zaw.thieugia@gmail.com
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Luck Info :
# 4-5-2008 ver 1.00
# +) Make Luck point ( % )
# +) Add Cri with Luck ( x2 damage ) and Perfect Cri ( x3 damage )
# +) Add % usefull item or skill heal ( restore HP and MP )
# +) Add damage of item or skill when use atk
# 5-5-2008 ver 1.01 ( small update )
# +) Add Money and exp more or less with luck point
# 22-6-2008 ver 1.2 ( some small update )
# +) Luck up for actor ( actor ID => luck up point )
# +) Add Lucky Dodges ( eva ) - not complete 100% - beta
# +) Add Perfect Hit ( hit )
# +) Fix Gold
# ... continue update ..
#
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# script na`y chua dc add va`o menu
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# thanks Moghunter vo�i script Luck systems XP1.2
#------------------------------------------------------------------------------

module KID
LUCK_MAX = {1 => 100} # gio�i ha?n Luck
LUCK_UP = {1 => 2, 2 => 2, 3 => 1, 4 => 2} # di�?m luck khi tang level
LUCKSTART = {1 => 100} # lu�c khi ba�t d�`u ( c��u tru�c : ID actor => luck )
end
class Game_Actor < Game_Battler
alias kid_setup setup
def setup(actor_id)
maxluck = KID::LUCK_MAX[actor_id]
if maxluck == nil
@max_luck = 100
else
@max_luck = maxluck
end

if KID::LUCKSTART[actor_id] == nil
@luck = 1
else
@luck = KID::LUCKSTART[actor_id]
end

if KID::LUCK_UP[actor_id] == nil
@luckup = 1
else
@luckup = KID::LUCK_UP[actor_id]
end
kid_setup(actor_id)
end

def max_luck
return @max_luck
end

def luck
if @max_luck != nil and @luck > @max_luck
@luck = @max_luck
else
if @luck > 100
@luck = 100
end
return @luck
end
end

def level_up
@level += 1
@luck += @luckup
for learning in self.class.learnings
learn_skill(learning.skill_id) if learning.level == @level
end
end

def level_down
@level -= 1
@luck -= @luckup
end
end


class Game_Battler

def calc_eva(user, obj = nil)
eva = self.eva
unless obj == nil # if it is a skill or an item
eva = 0 unless obj.physical_attack # 0% if not a physical attack
end
unless parriable? # If not parriable
eva = 0 # 0%
end
if user.is_a?(Game_Actor)
eva -= user.luck
eva == 0 if eva <= 0
end
unless user.is_a?(Game_Actor)
eva -= user.luck
eva == 0 if eva <= 0
end
return eva
end

def make_attack_damage_value(attacker)
damage = attacker.atk * 4 - self.def * 2
damage = 0 if damage < 0
damage *= elements_max_rate(attacker.element_set)
damage /= 100
if damage == 0
damage = rand(2)
elsif attacker.is_a?(Game_Actor) # xa�c nh�?n Luck chi? co� khi actor ra do`n
if rand(100) < attacker.luck # ng�~u nhi�n
damage *= 2 # dam x2
@critical = true # hi�?n cri trong ba?n battler log
end
elsif damage > 0
@critical = (rand(100) < attacker.cri)
@critical = false if prevent_critical
damage *= 3 if @critical
end
damage = apply_variance(damage, 20)
damage = apply_guard(damage)
@hp_damage = damage
end

def make_obj_damage_value(user, obj)
damage = obj.base_damage
if damage > 0
damage += user.atk * 4 * obj.atk_f / 100
damage += user.spi * 2 * obj.spi_f / 100
unless obj.ignore_defense
damage -= self.def * 2 * obj.atk_f / 100
damage -= self.spi * 1 * obj.spi_f / 100
end
damage = 0 if damage < 0
elsif user.is_a?(Game_Actor) # xa�c nh�?n Luck chi? co� khi actor su? du?ng
if rand(100) < user.luck # ng�~u nhi�n
damage += user.atk * 4 * obj.atk_f * user.luck / (100 + user.luck)
damage += user.spi * 2 * obj.spi_f * user.luck / (100 + user.luck)
unless obj.ignore_defense
damage -= self.def * 2 * obj.atk_f / (100 + 2*user.luck)
damage -= self.spi * 1 * obj.spi_f / (100 + 2*user.luck)
end
end
elsif damage < 0
damage -= user.atk * 4 * obj.atk_f / 100
damage -= user.spi * 2 * obj.spi_f / 100
end
damage *= elements_max_rate(obj.element_set)
damage /= 100
damage = apply_variance(damage, obj.variance)
damage = apply_guard(damage)
if obj.damage_to_mp
@mp_damage = damage
else
@hp_damage = damage
end
end

def calc_hp_recovery(user, item)
result = maxhp * item.hp_recovery_rate / 100 + item.hp_recovery
result *= 2 if user.pharmacology
result += user.luck * 2 if user.is_a?(Game_Actor)
return result
end

def calc_mp_recovery(user, item)
result = maxmp * item.mp_recovery_rate / 100 + item.mp_recovery
result *= 2 if user.pharmacology
result += user.luck * 3 if user.is_a?(Game_Actor)
return result
end

end

class Game_Enemy < Game_Battler

def exp
for actor in $game_party.members
if rand(100) < actor.luck
enemy.exp += (actor.luck + enemy.exp) / 3
end
return enemy.exp
end
end

def gold
for actor in $game_party.members
enemy.gold += (actor.luck + enemy.gold) / 3 + ( rand(100) - rand(100)) / actor.luck
return enemy.gold
end
end

end