#============================================================================== # 本脚本来自www.66RPG.com,使用和转载请保留此信息 #============================================================================== # ============================================================================ # 四格掉宝设定 by SailCat # ============================================================================ # 脚本使用说明: # 1.复制后插入到Main前面 # 2.数据库设定额外掉宝的概率,在敌人名称那里 # 格式: 敌人名称,宝物2,宝物3,宝物4 # 宝物写法: (I|W|A)n 分别对应: n号道具,n号武器,n号防具 I W A必须大写 # 例: Cockatrice,A5,I5,W3 # Fishman,I2,I3 # 三栏中任一栏留空不写时,取前一格的设定,全都不写时,取默认宝物设定 # 3.186行是四格概率比设定,在那里填上4个数字就可以更改概率了,该行内容: # rarity = [178, 51, 15, 12] # ============================================================================ #-------------------------------------------------------------------------- # □ RPG::Enemy #-------------------------------------------------------------------------- module RPG class Enemy def name name = @name.split(/,/)[0] return name != nil ? name : "" end def treasure2 treasure = @name.split(/,/)[1] return treasure.to_s end def treasure3 treasure = @name.split(/,/)[2] return treasure.to_s end def treasure4 treasure = @name.split(/,/)[3] return treasure.to_s end end end #============================================================================== # ■ Game_Enemy #------------------------------------------------------------------------------ # 处理敌人的类。本类在 Game_Troop 类 ($game_troop) 的 # 内部使用。 #============================================================================== class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # ● 获取物品 ID2 #-------------------------------------------------------------------------- def item2_id if $data_enemies[@enemy_id].treasure2 == "" return item_id elsif $data_enemies[@enemy_id].treasure2[0,1] != "I" return 0 else return $data_enemies[@enemy_id].treasure2[/[0-9]+/].to_i end end #-------------------------------------------------------------------------- # ● 获取武器 ID2 #-------------------------------------------------------------------------- def weapon2_id if $data_enemies[@enemy_id].treasure2 == "" return weapon_id elsif $data_enemies[@enemy_id].treasure2[0,1] != "W" return 0 else return $data_enemies[@enemy_id].treasure2[/[0-9]+/].to_i end end #-------------------------------------------------------------------------- # ● 获取防具 ID2 #-------------------------------------------------------------------------- def armor2_id if $data_enemies[@enemy_id].treasure2 == "" return armor_id elsif $data_enemies[@enemy_id].treasure2[0,1] != "A" return 0 else return $data_enemies[@enemy_id].treasure2[/[0-9]+/].to_i end end #-------------------------------------------------------------------------- # ● 获取物品 ID3 #-------------------------------------------------------------------------- def item3_id if $data_enemies[@enemy_id].treasure3 == "" return item2_id elsif $data_enemies[@enemy_id].treasure3[0,1] != "I" return 0 else return $data_enemies[@enemy_id].treasure3[/[0-9]+/].to_i end end #-------------------------------------------------------------------------- # ● 获取武器 ID3 #-------------------------------------------------------------------------- def weapon3_id if $data_enemies[@enemy_id].treasure3 == "" return weapon2_id elsif $data_enemies[@enemy_id].treasure3[0,1] != "W" return 0 else return $data_enemies[@enemy_id].treasure3[/[0-9]+/].to_i end end #-------------------------------------------------------------------------- # ● 获取防具 ID3 #-------------------------------------------------------------------------- def armor3_id if $data_enemies[@enemy_id].treasure3 == "" return armor2_id elsif $data_enemies[@enemy_id].treasure3[0,1] != "A" return 0 else return $data_enemies[@enemy_id].treasure3[/[0-9]+/].to_i end end #-------------------------------------------------------------------------- # ● 获取物品 ID4 #-------------------------------------------------------------------------- def item4_id if $data_enemies[@enemy_id].treasure4 == "" return item3_id elsif $data_enemies[@enemy_id].treasure4[0,1] != "I" return 0 else return $data_enemies[@enemy_id].treasure4[/[0-9]+/].to_i end end #-------------------------------------------------------------------------- # ● 获取武器 ID4 #-------------------------------------------------------------------------- def weapon4_id if $data_enemies[@enemy_id].treasure4 == "" return weapon3_id elsif $data_enemies[@enemy_id].treasure4[0,1] != "W" return 0 else return $data_enemies[@enemy_id].treasure4[/[0-9]+/].to_i end end #-------------------------------------------------------------------------- # ● 获取防具 ID4 #-------------------------------------------------------------------------- def armor4_id if $data_enemies[@enemy_id].treasure4 == "" return armor3_id elsif $data_enemies[@enemy_id].treasure4[0,1] != "A" return 0 else return $data_enemies[@enemy_id].treasure4[/[0-9]+/].to_i end end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ # 处理战斗画面的类。 #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ● 开始结束战斗回合 #-------------------------------------------------------------------------- def start_phase5 # 转移到回合 5 @phase = 5 # 演奏战斗结束 ME $game_system.me_play($game_system.battle_end_me) # 还原为战斗开始前的 BGM $game_system.bgm_play($game_temp.map_bgm) # 初始化 EXP、金钱、宝物 exp = 0 gold = 0 treasures = [] # 循环 for enemy in $game_troop.enemies # 敌人不是隐藏状态的情况下 unless enemy.hidden # 获得 EXP、增加金钱 exp += enemy.exp gold += enemy.gold # 出现宝物判定 if rand(100) < enemy.treasure_prob rarity = [178, 51, 15, 12] case rand(rarity[0] + rarity[1] + rarity[2] + rarity[3]) when 0..rarity[0] - 1 if enemy.item_id > 0 treasures.push($data_items[enemy.item_id]) end if enemy.weapon_id > 0 treasures.push($data_weapons[enemy.weapon_id]) end if enemy.armor_id > 0 treasures.push($data_armors[enemy.armor_id]) end when rarity[0]..rarity[0] + rarity[1] - 1 if enemy.item2_id > 0 treasures.push($data_items[enemy.item2_id]) end if enemy.weapon2_id > 0 treasures.push($data_weapons[enemy.weapon2_id]) end if enemy.armor2_id > 0 treasures.push($data_armors[enemy.armor2_id]) end when rarity[0] + rarity[1]..rarity[0] + rarity[1] + rarity[2] - 1 if enemy.item3_id > 0 treasures.push($data_items[enemy.item3_id]) end if enemy.weapon3_id > 0 treasures.push($data_weapons[enemy.weapon3_id]) end if enemy.armor3_id > 0 treasures.push($data_armors[enemy.armor3_id]) end else if enemy.item4_id > 0 treasures.push($data_items[enemy.item4_id]) end if enemy.weapon4_id > 0 treasures.push($data_weapons[enemy.weapon4_id]) end if enemy.armor4_id > 0 treasures.push($data_armors[enemy.armor4_id]) end end end end end # 限制宝物数为 8 个 treasures = treasures[0..7] # 获得 EXP for i in 0...$game_party.actors.size actor = $game_party.actors[i] if actor.cant_get_exp? == false last_level = actor.level actor.exp += exp if actor.level > last_level @status_window.level_up(i) end end end # 获得金钱 $game_party.gain_gold(gold) # 获得宝物 for item in treasures case item when RPG::Item $game_party.gain_item(item.id, 1) when RPG::Weapon $game_party.gain_weapon(item.id, 1) when RPG::Armor $game_party.gain_armor(item.id, 1) end end # 生成战斗结果窗口 @result_window = Window_BattleResult.new(exp, gold, treasures) # 设置等待计数 @phase5_wait_count = 100 end end
#============================================================================== # 本脚本来自www.66RPG.com,使用和转载请保留此信息 #============================================================================== |