标题: 请教一下脚本好手 [打印本页] 作者: doublehjb 时间: 2009-7-11 22:55 标题: 请教一下脚本好手 请问以下的战斗事件脚本是讲什么的?真的希望有人能帮帮忙....
俺搞了一整天,还是不明白为啥“角色的判断血量的条”件不能触发.....
#--------------------------------------------------------------------------
# ● 判断是否符合战斗事件 (页) 条件
# page : 战斗事件页
#--------------------------------------------------------------------------
def conditions_met?(page)
c = page.condition
if not c.turn_ending and not c.turn_valid and not c.enemy_valid and
not c.actor_valid and not c.switch_valid
return false # 未设置条件…不执行
end
if @event_flags
return false # 已执行
end
if c.enemy_valid # 敌方角色
enemy = $game_troop.members[c.enemy_index]
return false if enemy == nil
if c.turn_ending == false #
return false if enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
elsif c.turn_ending and not c.turn_valid
return false if enemy.Battler_turn != c.enemy_hp or enemy.cp != 100
elsif c.turn_ending and c.turn_valid
a = c.turn_a
b = c.turn_b
if b>0
return false if (a==0 and ( c.enemy_hp < 1 or enemy.Battler_turn < c.enemy_hp or enemy.Battler_turn % b != c.enemy_hp % b or enemy.cp != 100 or enemy.turn_start != 1))
return false if (a==1 and ( c.enemy_hp < 1 or enemy.Battler_turn < c.enemy_hp or enemy.Battler_turn % b != c.enemy_hp % b or enemy.cp != 100 or enemy.turn_start != 0))
else
if a == 0 #回合开始时 等于
return false if ( enemy.Battler_turn != c.enemy_hp or enemy.cp != 100 or enemy.turn_start != 1)
elsif a == 1 # #回合开始时 回合数大于
return false if (enemy.Battler_turn <= c.enemy_hp or enemy.cp != 100 or enemy.turn_start != 1)
elsif a == 2 #回合开始时 回合数小于
return false if (enemy.Battler_turn >= c.enemy_hp or enemy.cp != 100 or enemy.turn_start != 1)
elsif a == 3 #回合结束时 回合数等于
return false if (enemy.Battler_turn != c.enemy_hp or enemy.cp != 100 or enemy.turn_start != 0)
elsif a == 4 #回合结束时 回合数大于
return false if (enemy.Battler_turn <= c.enemy_hp or enemy.cp != 100 or enemy.turn_start != 0)
elsif a == 5 # 回合结束时 回合数小于
return false if (enemy.Battler_turn >= c.enemy_hp or enemy.cp != 100 or enemy.turn_start != 0)
end
end
end
end
if c.actor_valid # 角色
actor = $game_actors[c.actor_id]
return false if actor == nil
if c.turn_ending == false #
return false if actor.hp * 100.0 / actor.maxhp > c.actor_hp
elsif c.turn_ending and not c.turn_valid
return false if actor.Battler_turn != c.actor_hp or actor.cp != 100
elsif c.turn_ending and c.turn_valid
a = c.turn_a
b = c.turn_b
if b > 0
return false if (a== 0 and ( c.actor_hp < 1 or actor.Battler_turn < c.actor_hp or actor.Battler_turn % b != c.actor_hp % b or actor.cp != 100 or actor.turn_start != 1))
return false if (a== 1 and ( c.actor_hp < 1 or actor.Battler_turn < c.actor_hp or actor.Battler_turn % b != c.actor_hp % b or actor.cp != 100 or actor.turn_start != 0))
else
if a == 0 # 等于
return false if (actor.Battler_turn != c.actor_hp or actor.cp != 100 or actor.turn_start != 1)
elsif a == 1 #回合开始时 回合数大于
return false if (actor.Battler_turn <= c.actor_hp or actor.cp != 100 or actor.turn_start != 1)
elsif a == 2 #回合开始时 回合数小于
return false if (actor.Battler_turn >= c.actor_hp or actor.cp != 100 or actor.turn_start != 1)
elsif a == 3 #回合结束时 回合数等于
return false if (actor.Battler_turn != c.actor_hp or actor.cp != 100 or actor.turn_start != 0)
elsif a == 4 #回合结束时 回合数大于
return false if (actor.Battler_turn <= c.actor_hp or actor.cp != 100 or actor.turn_start != 0)
elsif a == 5 #回合结束时 回合数小于
return false if (actor.Battler_turn >= c.actor_hp or actor.cp != 100 or actor.turn_start != 0)
end
end
end
end
if c.switch_valid # 开关
return false if $game_switches[c.switch_id] == false
end
return true # 符合条件
end作者: 霜冻之狼 时间: 2009-7-15 17:50 本帖最后由 霜冻之狼 于 2009-7-15 18:18 编辑