Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # * Get Gold
- #--------------------------------------------------------------------------
- def gold(index)
- stolen_gold = $game_troop.stolen_money[@index]
- return enemy.gold + stolen_gold
- end
- #--------------------------------------------------------------------------
- # * Create Array of Dropped Items
- #--------------------------------------------------------------------------
- def make_drop_items(index)
- enemy.drop_items.inject([]) do |r, di|
- if di.kind > 0 && rand * di.denominator < drop_item_rate
- r.push(item_object(di.kind, di.data_id))
- else
- r
- end
- end
- end
- end
- class RPG::Enemy::DropItem
- def initialize(k=0,id=1,de=1)
- @kind = k
- @data_id = id
- @denominator = de
- end
- attr_accessor :kind
- attr_accessor :data_id
- attr_accessor :denominator
- end
- #==============================================================================
- # ** Game_Troop
- #------------------------------------------------------------------------------
- # This class handles enemy groups and battle-related data. Also performs
- # battle events. The instance of this class is referenced by $game_troop.
- #==============================================================================
- class Game_Troop < Game_Unit
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- alias :ffs_enemy_steal_saver_initialize :initialize
- def initialize
- @stolen_items = []
- @stolen_gold = []
- ffs_enemy_steal_saver_initialize
- end
- #--------------------------------------------------------------------------
- # * Clear
- #--------------------------------------------------------------------------
- alias :ffs_enemy_steal_saver_clear :clear
- def clear
- ffs_enemy_steal_saver_clear
- @stolen_items = []
- @stolen_gold = []
- end
- #--------------------------------------------------------------------------
- # * Setup
- #--------------------------------------------------------------------------
- alias :ffs_enemy_steal_saver_setup :setup
- def setup(troop_id)
- ffs_enemy_steal_saver_setup(troop_id)
- @enemies.each do |member|
- next unless $data_enemies[member.enemy_id]
- @stolen_items[member.index] = []
- @stolen_gold[member.index] = 0
- end
- end
- #--------------------------------------------------------------------------
- # * Returns the stolen items
- #--------------------------------------------------------------------------
- def stolen_item
- return @stolen_items
- end
- #--------------------------------------------------------------------------
- # * Returns the stolen money
- #--------------------------------------------------------------------------
- def stolen_money
- return @stolen_gold
- end
- #--------------------------------------------------------------------------
- # * Adds the stolen item
- #--------------------------------------------------------------------------
- def add_stolen_item(item, index)
- @stolen_items[index].push(item)
- end
- #--------------------------------------------------------------------------
- # * Add Stolen Money
- #--------------------------------------------------------------------------
- def add_stolen_money(money, index)
- @stolen_gold[index] += money
- end
- #--------------------------------------------------------------------------
- # * Create Array of Dropped Items
- #--------------------------------------------------------------------------
- def make_drop_items
- dead_members.inject([]) {|r, enemy|
- r += enemy.make_drop_items(enemy.index)
- r += @stolen_items[enemy.index]
- }
- end
- #--------------------------------------------------------------------------
- # * Calculate Total Gold
- #--------------------------------------------------------------------------
- def gold_total
- check_var ? get_gold_total*@diff_hash[var_value][9]/100 : get_gold_total
- end
- #--------------------------------------------------------------------------
- # * Calculate Total Gold
- #--------------------------------------------------------------------------
- def get_gold_total
- dead_members.inject(0) {|r, enemy| r += enemy.gold(enemy.index) } * gold_rate
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement