赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 0 |
经验 | 0 |
最后登录 | 2009-1-18 |
在线时间 | 0 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 0
- 在线时间
- 0 小时
- 注册时间
- 2009-1-15
- 帖子
- 2
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
lass Interpreter
def enemy_battle
#各参数说明:X打开独立开关X;1结束游戏
#各参数说明:X打开独立开关X;1暂时消除事件
#怪物事件命名格式:
#Enemy+怪物编号+视野内移动+视野+视野外移动+主角死亡处理+事件死亡处理
evt = $game_map.events[@event_id]
eid = evt.event.name[5,3].to_i
ego = evt.event.name[11,1]
ekp = evt.event.name[12,1]
enemy = $data_enemies[eid]
player = $game_player
actor = $game_party.actors[0]
weapon = $data_weapons[actor.weapon_id]
battle_action(actor, enemy, player, evt)
actor.hp -= player.damage if not player.damage == "Miss"
if actor.hp <= 0
$game_system.se_play($data_system.actor_collapse_se)
if ego == "1"
$game_temp.gameover = true
else
$game_self_switches[[@map_id,@event_id,ego]] = true
$game_map.need_refresh = true
end
end
battle_action(enemy, actor, evt, player)
evt.hp -= evt.damage if not evt.damage == "Miss"
if evt.hp<=0
$game_system.se_play($data_system.enemy_collapse_se)
$game_party.gain_gold(enemy.gold)
actor.exp += enemy.exp
if rand(100)<enemy.treasure_prob
if enemy.item_id > 0
$game_party.gain_item(enemy.item_id, 1)
end
if enemy.weapon_id > 0
$game_party.gain_weapon(enemy.weapon_id, 1)
end
if enemy.armor_id > 0
$game_party.gain_armor(enemy.armor_id, 1)
end
end
if ekp == "1"
evt.erase
else
$game_self_switches[[@map_id,@event_id,ekp]] = true
$game_map.need_refresh = true
end
end
evt.direction_fix = false
evt.turn_toward_player
evt.direction_fix = true
end
def get_damage_p(p2,p1)
p1d = p1.direction
p2d = p2.direction
if p1d == p2d
case p1d
when 2
if p1.y < p2.y
return 4
else
return 1
end
when 4
if p1.x > p2.x
return 4
else
return 1
end
when 6
if p1.x < p2.x
return 4
else
return 1
end
when 8
if p1.y > p2.y
return 4
else
return 1
end
end
end
return 2
end
def battle_action(dmer, ater, evt, player)
dct_dmg = get_damage_p(evt, player)
if ater.is_a?(Game_Actor) and $game_switches[2]==true
skill = $data_skills[$game_variables[$game_party.actors[0].id+50]]
ater.sp -= skill.sp_cost
power = skill.power + ater.atk * skill.atk_f / 100
if power > 0
power -= dmer.pdef * skill.pdef_f / 200
power -= dmer.mdef * skill.mdef_f / 200
power += ater.int/2 + rand(ater.int/2)
power = [power, 0].max
end
# 计算倍率
rate = 20
rate += (ater.str * skill.str_f / 100)
rate += (ater.dex * skill.dex_f / 100)
rate += (ater.agi * skill.agi_f / 100)
rate += (ater.int * skill.int_f / 100)
# 计算基本伤害
evt.damage = power * rate / 20
# 属性修正
evt.damage *= elements_correct(skill.element_set, dmer)
evt.damage /= 100
if rand(100) < (4 * ater.dex * dct_dmg / dmer.agi)
evt.damage *= 2
evt.critical = true
end
# 命中判定
eva = 8 * dmer.agi / ater.dex / dct_dmg + dmer.eva
hit = evt.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit_result = (rand(100) < hit)
if hit_result
evt.damage_pop = true
else
evt.damage = "Miss"
evt.damage_pop = true
end
elsif ater.is_a?(Game_Actor)
evt.damage = [ater.atk + ater.str/2 + rand(ater.str/2) - dmer.pdef , 0].max
if rand(100) < (4 * ater.dex * dct_dmg / dmer.agi)
evt.damage *= 2
evt.critical = true
end
hit_per = 8 * dmer.agi * 2 / ater.dex / dct_dmg + dmer.eva
hit = evt.damage < 0 ? 100 : 100 - hit_per
hit_result = (rand(100) < hit)
if hit_result
evt.damage_pop = true
else
evt.damage = "Miss"
evt.critical = false
evt.damage_pop = true
end
else
rating_max = 0
for i in 0...ater.actions.size
if ater.actions.rating > rating_max
rating_max = ater.actions.rating
end
end
ratings_total = 0
for i in 0...ater.actions.size
if ater.actions.rating > rating_max - 3
ratings_total += ater.actions.rating - (rating_max - 3)
end
end
value = rand(ratings_total)
# 设置对应生成随机数的当前行动
for i in 0...ater.actions.size
if ater.actions.rating > rating_max - 3
if value < ater.actions.rating - (rating_max - 3)
if ater.actions.kind == 0
ekid = 0
evt.damage = [ater.atk + ater.str/2 + rand(ater.str/2) - dmer.pdef , 0].max
if rand(100) < (4 * ater.dex * dct_dmg / dmer.agi)
evt.damage *= 2
evt.critical = true
end
hit_per = 8 * dmer.agi * 2 / ater.dex / dct_dmg + dmer.eva
hit = evt.damage < 0 ? 100 : 100 - hit_per
hit_result = (rand(100) < hit)
if hit_result
evt.damage_pop = true
else
evt.damage = "Miss"
evt.critical = false
evt.damage_pop = true
end
else
ekid = ater.actions.skill_id
skill = $data_skills[ekid]
power = skill.power + ater.atk * skill.atk_f / 100
if power > 0
power -= dmer.pdef * skill.pdef_f / 200
power -= dmer.mdef * skill.mdef_f / 200
power += ater.int/2 + rand(ater.int/2)
power = [power, 0].max
end
# 计算倍率
rate = 20
rate += (ater.str * skill.str_f / 100)
rate += (ater.dex * skill.dex_f / 100)
rate += (ater.agi * skill.agi_f / 100)
rate += (ater.int * skill.int_f / 100)
# 计算基本伤害
evt.damage = power * rate / 20
# 属性修正
evt.damage *= elements_correct(skill.element_set, dmer)
evt.damage /= 100
if rand(100) < (4 * ater.dex * dct_dmg / dmer.agi)
evt.damage *= 2
evt.critical = true
end
# 命中判定
eva = 8 * dmer.agi / ater.dex / dct_dmg + dmer.eva
hit = evt.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit_result = (rand(100) < hit)
# 状态变化
if hit_result
evt.damage_pop = true
for i in 0...skill.plus_state_set.size
dmer.add_state(skill.plus_state_set)
end
for i in 0...skill.minus_state_set.size
dmer.remove_state(skill.minus_state_set)
end
else
evt.damage = "Miss"
evt.damage_pop = true
end
end
break
else
value -= ater.actions.rating - (rating_max - 3)
end
end
end
end
if ater.is_a?(Game_Actor)
if $game_switches[2]==true
evt.animation_id = skill.animation2_id
else
weapon = $data_weapons[ater.weapon_id]
if weapon == nil
evt.animation_id = 4
else
evt.animation_id = weapon.animation2_id
end
end
else
if ekid==0
evt.animation_id = ater.animation2_id
else
evt.animation_id = skill.animation2_id
end
end
end
def elements_correct(element_set, dmer)
# 無属性的情况
if element_set == []
# 返回 100
return 100
end
# 在被赋予的属性中返回最弱的
weakest = -100
for i in element_set
if dmer.is_a?(RPG::Enemy)
# 获取对应属性有效度的数值
table = [0,200,150,100,50,0,-100]
result = table[dmer.element_ranks]
weakest = [weakest, result].max
else
weakest = [weakest, dmer.element_rate(i)].max
end
end
return weakest
end
end
这个是ARPG模板的脚本~我想问的是:
#各参数说明:X打开独立开关X;1结束游戏
#各参数说明:X打开独立开关X;1暂时消除事件
#怪物事件命名格式:
#Enemy+怪物编号+视野内移动+视野+视野外移动+主角死亡处理+事件死亡处理
这个怎吗添?{/ll}我等了N天了~{/dk}麻烦懂脚本的速度点告我!我很急这用这个~{/gg} 此贴于 2009-1-15 12:12:48 被版主darkten提醒,请楼主看到后对本贴做出回应。 此贴于 2009-1-15 12:15:24 被版主darkten提醒,请楼主看到后对本贴做出回应。 |
|