Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Game_Enemy < Game_Battler
- alias :ffs_add_gold_item_initialize :initialize
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(index, enemy_id)
- ffs_add_gold_item_initialize(index, enemy_id)
- @stolen_gold = 0
- @stolen_item = []
- end
- #--------------------------------------------------------------------------
- # * Returns the total amount of stolen gold
- #--------------------------------------------------------------------------
- def stolen_gold
- return @stolen_gold
- end
- #--------------------------------------------------------------------------
- # * Returns all the stolen items
- #--------------------------------------------------------------------------
- def stolen_item
- return @stolen_item
- end
- #--------------------------------------------------------------------------
- # * Adds the stolen gold
- #--------------------------------------------------------------------------
- def add_stolen_gold(value)
- @stolen_gold += value
- end
- #--------------------------------------------------------------------------
- # * Adds the stolen item
- #--------------------------------------------------------------------------
- def add_stolen_item(item)
- if item.is_a?(RPG::Item)
- it = RPG::Enemy::DropItem.new(1,item.id,1)
- elsif item.is_a?(RPG::Weapon)
- it = RPG::Enemy::DropItem.new(2,item.id,1)
- elsif item.is_a?(RPG::Armor)
- it = RPG::Enemy::DropItem.new(3,item.id,1)
- end
- @stolen_item.push(it)
- end
- #--------------------------------------------------------------------------
- # * Get Gold
- #--------------------------------------------------------------------------
- def gold
- enemy.gold + @stolen_gold
- end
- #--------------------------------------------------------------------------
- # * Create Array of Dropped Items
- #--------------------------------------------------------------------------
- def make_drop_items
- for i in 0...@stolen_item.size
- enemy.drop_items.push(@stolen_item[i])
- end
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement