Advertisement
FlipelyFlip

Item & Geld Diebstahl Enemy-Changes

May 26th, 2024 (edited)
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.57 KB | None | 0 0
  1. class Game_Enemy < Game_Battler
  2.   alias :ffs_add_gold_item_initialize :initialize
  3.   #--------------------------------------------------------------------------
  4.   # * Object Initialization
  5.   #--------------------------------------------------------------------------
  6.   def initialize(index, enemy_id)
  7.     ffs_add_gold_item_initialize(index, enemy_id)
  8.     @stolen_gold = 0
  9.     @stolen_item = []
  10.   end
  11.   #--------------------------------------------------------------------------
  12.   # * Returns the total amount of stolen gold
  13.   #--------------------------------------------------------------------------
  14.   def stolen_gold
  15.     return @stolen_gold
  16.   end
  17.   #--------------------------------------------------------------------------
  18.   # * Returns all the stolen items
  19.   #--------------------------------------------------------------------------
  20.   def stolen_item
  21.     return @stolen_item
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # * Adds the stolen gold
  25.   #--------------------------------------------------------------------------
  26.   def add_stolen_gold(value)
  27.     @stolen_gold += value
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # * Adds the stolen item
  31.   #--------------------------------------------------------------------------
  32.   def add_stolen_item(item)
  33.     if item.is_a?(RPG::Item)
  34.       it = RPG::Enemy::DropItem.new(1,item.id,1)
  35.     elsif item.is_a?(RPG::Weapon)
  36.       it = RPG::Enemy::DropItem.new(2,item.id,1)
  37.     elsif item.is_a?(RPG::Armor)
  38.       it = RPG::Enemy::DropItem.new(3,item.id,1)
  39.     end
  40.     @stolen_item.push(it)
  41.   end
  42.   #--------------------------------------------------------------------------
  43.   # * Get Gold
  44.   #--------------------------------------------------------------------------
  45.   def gold
  46.     enemy.gold + @stolen_gold
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # * Create Array of Dropped Items
  50.   #--------------------------------------------------------------------------
  51.   def make_drop_items
  52.     for i in 0...@stolen_item.size
  53.       enemy.drop_items.push(@stolen_item[i])
  54.     end
  55.     enemy.drop_items.inject([]) do |r, di|
  56.       if di.kind > 0 && rand * di.denominator < drop_item_rate
  57.         r.push(item_object(di.kind, di.data_id))
  58.       else
  59.         r
  60.       end
  61.     end
  62.   end
  63. end
  64.  
  65. class RPG::Enemy::DropItem
  66.   def initialize(k=0,id=1,de=1)
  67.     @kind = k
  68.     @data_id = id
  69.     @denominator = de
  70.   end
  71.  
  72.   attr_accessor :kind
  73.   attr_accessor :data_id
  74.   attr_accessor :denominator
  75. end
  76.  
  77.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement