Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # Hunger & Thirst - Cannibalism Patch
- # Version 1.02
- # Author : LiTTleDRAgo
- #==============================================================================
- #------------------------------------------------------------------------------
- # ** Notetags for Enemies
- #------------------------------------------------------------------------------
- # For VX and VXA user can use notetags at Enemy Tabs to determine
- # food / drink recovery rates
- # (notetags configuration will be prioritized):
- #
- # <recover hunger by percent>
- # <recover thirst by percent>
- # <hunger: x>
- # <thirst: x>
- # <increase max hunger: x> # fixed value only
- # <increase max thirst: x> # fixed value only
- #
- #==============================================================================
- module LiTTleDRAgo
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # BEGIN CONFIGURATION
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- CANNIBALISM_RECOVER_HUNGER_THIRST = {
- # Cannibalism recover hunger / thirst
- # Set up your enemy recovery rates here. Recovery can be by either absolute
- # value, or by percent. Setting :percent to true will make it by percent.
- :id => [:hunger, :thirst, :percent],
- 1 => [ -5, 5, false],
- # For lazy user who wants to set every unconfigured enemy.
- 0 => [ 10, -3, true],
- }
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # END CONFIGURATION
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- #----------------------------------------------------------------------------
- # Don't edit
- CANNIBALISM_HUNGER_THIRST_TAGS = {
- :hunger => /<hunger:\s*([-]?\d+)\s*>/i,
- :thirst => /<thirst:\s*([-]?\d+)\s*>/i,
- :incmaxhunger => /<increase[-_ ]?max[-_ ]?hunger:\s*([-]?\d+)\s*>/i,
- :incmaxthirst => /<increase[-_ ]?max[-_ ]?thirst:\s*([-]?\d+)\s*>/i,
- :hungerpercent => /<recover[-_ ]?hunger[-_ ]?by[-_ ]?percent>/i,
- :thirstpercent => /<recover[-_ ]?thirst[-_ ]?by[-_ ]?percent>/i,
- }
- #----------------------------------------------------------------------------
- end
- ($imported||={})[:drg_hunger_thirst_cannibalism_patch] = 1.02
- hunger_thirst = "This script needs Drago - Hunger & Thirst ver 1.05 or above"
- cannibalism = "This script needs Drago - Cannibalism ver 1.05 or above"
- ($imported[:drg_hunger_thirst] || 0) >= 1.05 || raise(hunger_thirst)
- ($imported[:drg_cannibalism_xp] || 0) >= 1.05 || raise(cannibalism)
- #==============================================================================
- # ** Game_Battler
- #------------------------------------------------------------------------------
- # This class deals with battlers. It's used as a superclass for the Game_Actor
- # and Game_Enemy classes.
- #==============================================================================
- Klass = LiTTleDRAgo::VXA ? Scene_Battle : Game_Battler
- class Klass
- #--------------------------------------------------------------------------
- # ● Public Instance Variables
- #--------------------------------------------------------------------------
- attr_sec_reader :ca_hunger_tags,'LiTTleDRAgo::CANNIBALISM_HUNGER_THIRST_TAGS'
- #--------------------------------------------------------------------------
- # ● Alias Listing
- #--------------------------------------------------------------------------
- alias_sec_method :devour_hunger_thirst, :devour
- #--------------------------------------------------------------------------
- # ● Aliased method: devour
- #--------------------------------------------------------------------------
- def devour(user, item)
- irg = [user,item]
- target, user = self, user
- target, user = user, @subject if LiTTleDRAgo::VXA
- if item.is_a?(RPG::Skill) && devour_skill?(item)&& user.is_a?(Game_Actor)&&
- target.is_a?(Game_Enemy) && target.can_devour? && target.dead? &&
- (user.devoured[target.enemy_id] || 0) < target.devour_limit
- rec = LiTTleDRAgo::CANNIBALISM_RECOVER_HUNGER_THIRST[target.enemy_id]
- rec ||= LiTTleDRAgo::CANNIBALISM_RECOVER_HUNGER_THIRST[0] || []
- rec[0] = $1.to_i if target.get_note =~ ca_hunger_tags[:hunger]
- rec[1] = $1.to_i if target.get_note =~ ca_hunger_tags[:thirst]
- user.max_hunger += $1.to_i if target.get_note =~ ca_hunger_tags[:incmaxhunger]
- user.max_thirst += $1.to_i if target.get_note =~ ca_hunger_tags[:incmaxthirst]
- if rec.at(0).is_a?(Numeric) && rec.at(0) != 0
- a = rec.at(2)==true||target.get_note =~ ca_hunger_tags[:hungerpercent]
- rec[0] = (user.max_hunger*(rec.at(0)*0.01)).ceil if a
- user.hunger += rec.at(0)
- $game_party.check_hunger_states
- end
- if rec.at(1).is_a?(Numeric) && rec.at(1) != 0
- a = rec.at(2)==true||target.get_note =~ ca_hunger_tags[:thirstpercent]
- rec[1] = (user.max_thirst*(rec.at(1)*0.01)).ceil if a
- user.thirst += rec.at(1)
- $game_party.check_thirst_states
- end
- end
- devour_hunger_thirst(*irg)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement