Advertisement
Falmc

Falcao Pets Servants 1.3

Oct 5th, 2012
2,993
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 81.59 KB | None | 0 0
  1. #==============================================================================#
  2. #  #*****************#                                                         #
  3. #  #*** By Falcao ***#          * Falcao Pets Servants System 1.3              #
  4. #  #*****************#          This script allow you to have pet servants     #
  5. #                               that perform a avance command system helping   #
  6. #       RMVXACE                 the game player to complete tasks.             #
  7. #                               Date: Octuber 4 2012                           #
  8. #                                                                              #
  9. # Falcao RGSS site:  http://falcaorgss.wordpress.com                           #
  10. # Falcao Forum site: http://makerpalace.com                                    #
  11. #                                                                              #
  12. #==============================================================================#
  13.  
  14. # 1.3 change log
  15. # - Fixed minor bug when mood overload with other mood commands
  16. # - Added option to enable or disable the followers spot for the pet
  17.  
  18. #-------------------------------------------------------------------------------
  19. # * Installation
  20. #
  21. # Paste this script above main, no graphics required just copy and paste it into
  22. # your project, 5 item have been created in the database, witch are the gift
  23. # bundle items, if you are using my FA Interactive system 2.0 paste this script
  24. # below it, commons events has been created, to show how to make custom commands
  25. #
  26. #-------------------------------------------------------------------------------
  27. # * Features
  28. #
  29. # - Create as many pets you want at the pet factory below
  30. # - Assigns commands to the pets (you can create as many command you want)
  31. # - Pets level up
  32. # - Pets have a mood bar
  33. # - Pets give a gift bunndle when mood reach the maximun
  34. # - Each pet  give special bonus when is in use
  35. # - A avance command action system is implemented such as
  36. #   pet Steal, pet Grab objects, Pet Trigger targets, Pet Climb etc
  37. # - Pet minder Shop available!
  38. # - You can assign unique commands for each pet
  39. # - Pet are able to: create item, weapons, armor, gold, heal party, increase
  40. #   mood when dancing or playing with pet
  41. # - Custom command system implemented, so you can create your own fully
  42. #   custamizable commands via common events.
  43. # - Commands cooldown system, that mean you can assigh waiting time to each
  44. #   command available
  45. # - Mouse system buttons support!, you can select targets with the mouse in case
  46. #   you are using my mouse system buttons script
  47. #  
  48. #-------------------------------------------------------------------------------
  49. # * Compatibility
  50. #
  51. # Despite the complex of this system, i design this script to be compatible with
  52. # any other script, tested with ABS systems, pixel movement system etc
  53. #-------------------------------------------------------------------------------
  54. # * License
  55. #
  56. # For non-comercial games only
  57. # If you need this script for comercial games contact me  falmc99@gmail.com
  58. #-------------------------------------------------------------------------------
  59.  
  60. #-------------------------------------------------------------------------------
  61. #                            * Game flow usage
  62. #
  63. # Use the following events comments tags to complete pet tasks
  64. #
  65. # /PET TRIGGER             - The event start when touched by the pet, it is
  66. #                            usable with 'Trigger Targets cmd'
  67. # /PET CLIMB               - This make the event as a referencial point for
  68. #                            the command climb
  69. # /PET GRAB                - The event become grab-able for the pet
  70. #
  71. # /PET STEAL ITEM x        - Intead x put the item id you want the pet to steal
  72. #                            from the event. ex: PET STEAL ITEM 1
  73. # /PET STEAL WEAPON x      - Instead x put weapon id you want the pet to steal
  74. #                            from the event. ex: /PET STEAL WEAPON 5
  75. # /PET STEAL ARMOR x       - Instead x put armor id you want the pet to steal
  76. #                            from the event. ex: /PET STEAL ARMOR 3
  77. # /PET STEAL GOLD x        - Instead x put gold amount you want the pet to steal
  78. #                            from the event. ex: /PET STEAL GOLD 35
  79. # /PET STEAL CHANCE 1 / x  - Instead x put the probability to steal any kind
  80. #                            ex: /PET STEAL CHANCE 1 / 3 (chance one of three)
  81. # /IGNORE TARGETING          The tags above use a event target to perform action
  82. #                            this will avoid events on map from being targeted
  83. #
  84. # Important note:
  85. # The pet take only one task from the steal command per event, so if you assign
  86. # steal items, the pet going to steal items nothing else.
  87. #-------------------------------------------------------------------------------
  88. #                       * In-Game script calls
  89. #
  90. # SceneManager.call(Scene_PetShop)      Call the pet minder Shop
  91. # SceneManager.call(Scene_PetCommands)  Call manually the pet command window
  92. #
  93. # $game_player.gamepet.mood_cmd(x)      Instead x put mood command id to add  
  94.  
  95. # $game_player.adopt_pet(x)             If you dont want to buy pets from the
  96. #                                       shop you can add them manually, instead
  97. #                                       x put pet id from the pet factory
  98. #
  99. # See game demo for details and examples.
  100. #-------------------------------------------------------------------------------
  101.  
  102. module FalPet
  103.  
  104. #=============================================================================
  105. # * Pets global settings
  106.  
  107. # Starting Mood Maximun
  108.   StartingMoodMax = 30
  109.  
  110. # After how many gifts the pet level up?
  111.   Growing = 3
  112.  
  113. # Amount added to to the StartingMoodMax value when pet level up
  114.   MoodMaxPlus = 18
  115.  
  116. # The pet give you a gift when level up, define here the level and the gift
  117. # The maximun level will be the maximun gift
  118. # A = pet level   B = Item id
  119.   GiftBundle = {
  120.  
  121.   1 => 17,
  122.   2 => 18,
  123.   3 => 19,
  124.   4 => 20,
  125.   5 => 21,
  126.  
  127.   }
  128.  
  129. # Ballon id showed when the pet play
  130.   BalloonPlaying = 1
  131.  
  132. # Balloon played when pet play dead
  133.   PlayDeadBalloon = 8
  134.  
  135. # BGM played when pet dancing
  136.   DancingBgm = "Town7"
  137.  
  138. # Mood text when pet mood is low
  139.   MoodLowText = 'Feels sad...'
  140.  
  141. # Mood text when pet mood is overage
  142.   MoodOverageText = 'Feels content!'
  143.  
  144. # Mood text when pet mood is medium
  145.   MoodMediumText = 'Loves you!'
  146.  
  147. # Mood text when pet mood is hight
  148.   MoodHight = 'Want pussy!'
  149.  
  150. # Cursor icon index showed when selecting and event target
  151.   CursorIcon = 389
  152.  
  153. # Pet get stacked sometimes when performing action task such as Climb, Grab etc
  154. # after how many stucked times pet give up?
  155.   StuckCount = 15
  156.  
  157. # Buttom to call the pet commands, (W key from the keyboard)
  158.   CommandsKey = :R
  159.  
  160. # Do you want to use the key? you can call the scene commands manually
  161.   UseKey = true
  162.  
  163. # Allow the followers to yiled spot for the pet? change true or false
  164.   YieldSpot = true
  165.  
  166. #=============================================================================
  167. #                      * Pet Factory
  168. #
  169. # You can create as many pets you want, set the prices, set speciallity skills
  170. # for each pet and give the entire party a bonus when using the pet, 10 pets
  171. # has been created as examples.
  172. #
  173.  
  174.   Pets = {
  175.                                                 #-----------------------------#
  176.                                                 #           * Sounds          #
  177.                                                 #
  178. # Pet Id      Graphic    Index     Name            Voice       Vol     Pitch
  179.     1   =>  ["Animal",     0,    "Isidoro",       "Dog",       80,     150],
  180.     2   =>  ["Animal",     1,    "Mitcha",        "Cat",       80,     100],
  181.     3   =>  ["Spiritual",  5,    "Navis",         "Ice1",      100,    100],
  182.     4   =>  ["Animal",     3,    "Gordura",       "Coin",      80,     100],
  183.     5   =>  ["Animal",     4,    "Fart Cow",      "Cow",       80,     100],
  184.     6   =>  ["Animal",     5,    "Laziness",      "Horse",     80,     120],
  185.     7   =>  ["Animal",     6,    "Coyote",        "Wolf",     100,     150],
  186.     8   =>  ["Monster3",   5,    "Draconic",      "Monster6",  80,     150],
  187.     9   =>  ["Monster3",   7,    "Spiderpussy",   "Monster3",  80,     150],
  188.     10  =>  ["Monster3",   4,    "Rataliony",     "Miss",      80,     100],
  189.  
  190.   }
  191.  
  192. # Edit the pet prices, this will be the price displayed at the pet shop
  193.   Price = {
  194.  
  195. #   Pet id   Price
  196.      1  =>   10000,
  197.      2  =>   200,
  198.      3  =>   700,
  199.      4  =>   100,
  200.      5  =>   500,
  201.      6  =>   3000,
  202.      7  =>   6000,
  203.      8  =>   8000,
  204.      9  =>   5000,
  205.      10 =>   900,
  206.      
  207.      
  208.  
  209.   }
  210.  
  211. # You can assign especific specialities for each pet, there are 16 commands
  212. # Availables listed below. (listed default ones only, you can create more!)
  213.  
  214. # 10 = Trigger Targets  14 = Heal Party       18 = Create Gold   22 = Custom4
  215. # 11 = Steal Items      15 = Create Items     19 = Rainsing S    23 = Custom5
  216. # 12 = Grab objects     16 = Create Weapons   20 = Custom2       24 = Custom6
  217. # 13 = Climb            17 = Create Armors    21 = Custom3       25 = Custom7
  218. #
  219. # Each command id going inside the arrays below
  220.   Speciality = {
  221.  
  222. # Pet id    Command Speciality ids
  223.     1  =>  [10, 11, 12, 13, 14, 15, 16, 17, 18],
  224.     2  =>  [16],
  225.     3  =>  [14, 19, 21],
  226.     4  =>  [17],
  227.     5  =>  [15],
  228.     6  =>  [12],
  229.     7  =>  [11],
  230.     8  =>  [10, 20],
  231.     9  =>  [13],
  232.     10 =>  [18],
  233.    
  234.   }
  235.  
  236.  
  237. # Game party guarantee a bonus when using specific pet, each parameters is added
  238. # when the pet is in use, and it is losed when you equip another pet
  239. # This is oriented to the 8 parameters available in game, this make a huge
  240. # diference for each pet. see examples below
  241.  
  242.   Bonus = {
  243.  
  244. # Pet id                 * Bonus Parameters
  245.     1  => [mhp =  10,   mmp =   0,   atk =   0,  defe =   0,
  246.            mat =   0,   mdf =   0,   agi =   0,  luk  =   0],
  247.          
  248.     2  => [mhp =  20,   mmp =  20,   atk =   2,  defe =  10,
  249.            mat =   1,   mdf =   1,   agi =  10,  luk  =  10],
  250.          
  251.     3  => [mhp = 200,   mmp = 200,   atk =   0,  defe =   20,
  252.            mat =   6,   mdf =   6,   agi =   0,  luk  =   0],
  253.  
  254.     4  => [mhp =   0,   mmp =   0,   atk =  10,  defe =   120,
  255.            mat =   0,   mdf =   0,   agi =   0,  luk  =   0],
  256.          
  257.     5  => [mhp = 100,   mmp =  50,   atk =   0,  defe =   0,
  258.            mat =   0,   mdf =   0,   agi =   0,  luk  =   0],
  259.          
  260.     6  => [mhp =   0,   mmp =   0,   atk =  10,  defe =   0,
  261.            mat =   0,   mdf =   0,   agi =   0,  luk  =  50],
  262.          
  263.     7  => [mhp =   0,   mmp =   0,   atk =   0,  defe =  60,
  264.            mat =   0,   mdf =  11,   agi =  10,  luk  =  10],
  265.  
  266.     8  => [mhp =  60,   mmp =  60,   atk =   9,  defe =   0,
  267.            mat =   0,   mdf =   0,   agi =   0,  luk  =   0],
  268.          
  269.     9  => [mhp =  50,   mmp =  50,   atk =  10,  defe =   0,
  270.            mat =   0,   mdf =   0,   agi =   0,  luk  =   0],
  271.    
  272.     10 => [mhp =   0,   mmp =   0,   atk =   0,  defe =  6,
  273.            mat =   0,   mdf =   0,   agi =  14,  luk  =  11],    
  274.          
  275.   }
  276.  
  277.  
  278. #=============================================================================
  279. #               * Pet Commands configuration
  280. #
  281. # There are 3 types of commands available, Defaults, Mood gain and Speciality
  282. #
  283. #- Defaults commands are the basics and are always available for the pets
  284. #- Moods gain commands are those commands that increase the mood of the pet
  285. #  by performing an act, like playing with pet, dancing atc.
  286. #- Speciality commands give the pet tasks to do, this category breaks into 3
  287. #  sub-categories such, Action, Casting and Custom
  288. #
  289. # Terms explanation
  290. #
  291. # Cmd_Name           - Command name
  292. # Cmd_IconIndex      - Command icon index
  293. # Cmd_Description    - Command short description
  294. # Cmd_CoolDown       - Cool Down is the time you have to wait to use a command
  295. #                      again, time is measured in seconds
  296. #
  297. # Cmd_MoodGain       - Amount of mood added to the pet when using a mood command
  298. # Cmd_ActionTime     - Time in frames of the command duration (only for custom)
  299. #
  300.  
  301. #===============================================================================
  302. # * Deafault commands
  303.  
  304.   # command 1
  305.   Cmd1_Name = 'Toggle Pet'
  306.   Cmd1_IconIndex = 217
  307.   Cmd1_Description = 'Toggle pet on off'
  308.   Cmd1_CoolDown = 0
  309.  
  310.   # command 26
  311.   Cmd26_Name = 'Adopted pets'
  312.   Cmd26_IconIndex = 168
  313.   Cmd26_Description = 'List of adopted pets'
  314.   Cmd26_CoolDown = 0
  315.  
  316. #=============================================================================
  317. # * Mood gain commands (Play commands)
  318. #
  319. # There are 8 default moods commands available listed below
  320. #
  321. # 2 = Jumpa          4 = Take a breath   6 = Make a twist  8 = Dance
  322. # 3 = Turn around    5 = Chase jump      7 = Play dead     9 = Trampoline
  323. #
  324. # Moods commands are added manually to menu, use the next script calls to add
  325. # $game_player.gamepet.mood_cmd(id)       id = id of the mood command
  326.  
  327. # You can also set defaults mood commands, they will be added automatically
  328.   DeafaultMoodCommands = [2]
  329.  
  330.   # command 2
  331.   Cmd2_Name = 'Jumpa'
  332.   Cmd2_IconIndex = 122
  333.   Cmd2_Description = 'Perform jumps showing happiness'
  334.   Cmd2_CoolDown = 8
  335.   Cmd2_MoodGain = 4
  336.  
  337.   # command 3
  338.   Cmd3_Name = 'Turn around'
  339.   Cmd3_IconIndex = 12
  340.   Cmd3_Description = 'Turn around command'
  341.   Cmd3_CoolDown = 20
  342.   Cmd3_MoodGain = 8
  343.  
  344.   # command 4
  345.   Cmd4_Name = 'Take a breath'
  346.   Cmd4_IconIndex = 177
  347.   Cmd4_Description = 'Pet take a big breath'
  348.   Cmd4_CoolDown = 10
  349.   Cmd4_MoodGain = 6
  350.  
  351.   # command 5
  352.   Cmd5_Name = 'Chase jump'
  353.   Cmd5_IconIndex = 176
  354.   Cmd5_Description = 'Jump to his handsome owner'
  355.   Cmd5_CoolDown = 18
  356.   Cmd5_MoodGain = 10
  357.  
  358.   # command 6
  359.   Cmd6_Name = 'Make a twist'
  360.   Cmd6_IconIndex = 103
  361.   Cmd6_Description = 'Play twist'
  362.   Cmd6_CoolDown = 30
  363.   Cmd6_MoodGain = 16
  364.  
  365.   # command 7
  366.   Cmd7_Name = 'Play dead'
  367.   Cmd7_IconIndex = 1
  368.   Cmd7_Description = 'Play dead emote'
  369.   Cmd7_CoolDown = 60
  370.   Cmd7_MoodGain = 22
  371.  
  372.   # command 8
  373.   Cmd8_Name = 'Dance'
  374.   Cmd8_IconIndex = 118
  375.   Cmd8_Description = 'Pet start dancing!'
  376.   Cmd8_CoolDown = 120
  377.   Cmd8_MoodGain = 46
  378.  
  379.   # command 9
  380.   Cmd9_Name = 'Trampoline'
  381.   Cmd9_IconIndex = 119
  382.   Cmd9_Description = 'Start making a trampoline!'
  383.   Cmd9_CoolDown = 120
  384.   Cmd9_MoodGain = 36
  385.  
  386. #=============================================================================
  387. # * Pet speciality commands configurations
  388. #=============================================================================
  389. # * Action commands
  390.  
  391.   # command 10
  392.   Cmd10_Name = 'Trigger Targets'
  393.   Cmd10_IconIndex = 398
  394.   Cmd10_Description = 'Command the Pet to trigger selected targets'
  395.   Cmd10_CoolDown = 0
  396.  
  397.   # command 11
  398.   Cmd11_Name = 'Steal items'
  399.   Cmd11_IconIndex = 9
  400.   Cmd11_Description = 'Command the pet to steal items and money'
  401.   Cmd11_CoolDown = 0
  402.  
  403.   # command 12
  404.   Cmd12_Name = 'Grab objects'
  405.   Cmd12_IconIndex = 491
  406.   Cmd12_Description = 'Command the pet to grab selected objects'
  407.   Cmd12_CoolDown = 0
  408.  
  409.   # command 13
  410.   Cmd13_Name = 'Climb'
  411.   Cmd13_IconIndex = 275
  412.   Cmd13_Description = 'Command the pet to help the owner to climb'
  413.   Cmd13_CoolDown = 0
  414.  
  415. #=============================================================================
  416. # * Casting commands
  417.  
  418.   # command 14
  419.   Cmd14_Name = 'Heal Party'
  420.   Cmd14_IconIndex = 14
  421.   Cmd14_Description = 'Heal hp and mp for a fixed percentage'
  422.   Cmd14_CoolDown = 60
  423.  
  424.   # This casting command heals your entire party by a percentage, there are four
  425.   # available: '25%'  '50%'   '75%'  '100%'
  426.   HealPercent = '75%'
  427. #---------------------
  428.  
  429.   # command 15
  430.   Cmd15_Name = 'Create Items'
  431.   Cmd15_IconIndex = 213
  432.   Cmd15_Description = 'Create random items for the owner party'
  433.   Cmd15_CoolDown = 120
  434.  
  435.   # Animation played when pet is creating items
  436.   ItemAnime = 107
  437.  
  438.   # This command give you random items, add the participants items below
  439.   # A => B     A = Item id    B = Quantity
  440.   RandomItems = {
  441.  
  442.   1 =>  10,
  443.   2 =>  25,
  444.   6 =>  35,
  445.  
  446.   }
  447. #-----------------------
  448.  
  449.   # command 16
  450.   Cmd16_Name = 'Create Weapons'
  451.   Cmd16_IconIndex = 402
  452.   Cmd16_Description = 'Create random weapons for the owner party'
  453.   Cmd16_CoolDown = 240
  454.  
  455.   # Animation played when pet is creating weapons
  456.   WeaponAnime = 107
  457.  
  458.   # This command give you random weapons, add the participants weapons below
  459.   # A => B     A = Weapon id    B = Quantity
  460.   RandomWeapons = {
  461.  
  462.   1 => 11,
  463.   2 => 2,
  464.   6 => 7,
  465.  
  466.   }
  467. #-------------------------
  468.  
  469.   # command 17
  470.   Cmd17_Name = 'Create Armors'
  471.   Cmd17_IconIndex = 170
  472.   Cmd17_Description = 'Create random armors for the owner party'
  473.   Cmd17_CoolDown = 300
  474.  
  475.   # Animation played when pet is creating armors
  476.   ArmorAnime = 107
  477.  
  478.   # This command give you random armors, add the participants armors below
  479.   # A => B     A = Armor id    B = Quantity
  480.   RandomArmors = {
  481.  
  482.   1 => 17,
  483.   2 => 2,
  484.   6 => 8,
  485.  
  486.   }
  487. #--------------------------
  488.   # command 18
  489.   Cmd18_Name = 'Create Gold'
  490.   Cmd18_IconIndex = 344
  491.   Cmd18_Description = 'Create random Gold for the owner party'
  492.   Cmd18_CoolDown = 180
  493.  
  494.   # Animation played when pet is creating gold
  495.   GoldAnime = 107
  496.  
  497.   # This command give you random gold, add the gold amount partisipant
  498.   # Random gold amount go inside the array
  499.   RandomGold = [100, 25, 77, 45, 88]
  500.  
  501.  
  502. #--------------------------
  503.   # command 19
  504.   Cmd19_Name = 'Raising Spirit'
  505.   Cmd19_IconIndex = 112
  506.   Cmd19_Description = 'For short time cool down become instant!'
  507.   Cmd19_CoolDown = 600
  508.  
  509.   # Instant cool down buff duration in seconds
  510.   BuffDuration = 60
  511.  
  512. #=============================================================================
  513. # * Custom commands
  514. #
  515. # Custom commands are designed to work via common events, a switch is activated
  516. # when the command time is running and it is deactivated when time ends.
  517. # So the common event should be parallel process as condition the switch
  518. # assigned below
  519.  
  520.   # Switch id that remains active when a custom command is running
  521.   CustomSwitch = 100
  522.  
  523. # List of special tasks you can give the pet inside the common event
  524. # when a custom command is running
  525. #
  526. # * Basics
  527. #
  528. # pet                  Get currently using pet
  529. # pet.cmd(id)          Get pet command (change id for command id integer)
  530. # pet.time?(x)         Get current command action time (change x for an integer)
  531. # pet.level            Get currently pet level
  532. # pet.ending?          Check if action time command is about to finish
  533. #
  534. # * Actions
  535. #
  536. # pet.prepare          Player and pet turn face to face  
  537. # pet.liedown          Pet lie down                
  538. # pet.reset_liedown    Pet stand up
  539. # pet.cast             Pet make a casting position
  540. # pet.jump_high(x,y,h) Jump higher than normal, chan x,y,h for an integer
  541. # pet.play_voice       Play the pet voice
  542. # pet.pop_mood         Pet start gaining the custom command mood assigned
  543. # pet.pop_text(t,time) Pet start poping a window with custom text, change
  544. #                      t for 'text to display' and time for time in seconds
  545. # pet.zoom(x, y)       Pet start zooming, change x,y for desire integers,  
  546. #                      zoom support decimals.
  547. # pet.reset_zoom       Reset zoom to normal size        
  548. #
  549. # Those are just special commands for the pet, since the pet is a character
  550. # he can use any command from the move route such as, move_up,
  551. # animation_id, balloon_id, move_away_from_player etc.
  552.  
  553.   # command 20
  554.   Cmd20_Name = 'Sleep'
  555.   Cmd20_IconIndex = 6
  556.   Cmd20_Description = 'Start sleeping'
  557.   Cmd20_CoolDown = 40
  558.   Cmd20_MoodGain = 12
  559.   Cmd20_ActionTime = 300
  560.   Cmd20_Type = 'Mood +'
  561.  
  562.   # command 21
  563.   Cmd21_Name = 'Iron Body'
  564.   Cmd21_IconIndex = 13
  565.   Cmd21_Description = 'Cast a magic shield'
  566.   Cmd21_CoolDown = 120
  567.   Cmd21_MoodGain = 0
  568.   Cmd21_ActionTime = 200
  569.   Cmd21_Type = 'Casting'
  570.  
  571.   # command 22
  572.   Cmd22_Name = 'Command name'
  573.   Cmd22_IconIndex = 344
  574.   Cmd22_Description = 'Any description'
  575.   Cmd22_CoolDown = 5
  576.   Cmd22_MoodGain = 0
  577.   Cmd22_ActionTime = 200
  578.   Cmd22_Type = ''
  579.  
  580.   # command 23
  581.   Cmd23_Name = 'Command name'
  582.   Cmd23_IconIndex = 344
  583.   Cmd23_Description = 'Any description'
  584.   Cmd23_CoolDown = 5
  585.   Cmd23_MoodGain = 0
  586.   Cmd23_ActionTime = 200
  587.   Cmd23_Type = ''
  588.  
  589.   # command 24
  590.   Cmd24_Name = 'Command name'
  591.   Cmd24_IconIndex = 344
  592.   Cmd24_Description = 'Any description'
  593.   Cmd24_CoolDown = 5
  594.   Cmd24_MoodGain = 0
  595.   Cmd24_ActionTime = 200
  596.   Cmd24_Type = ''
  597.  
  598.   # command 25
  599.   Cmd25_Name = 'Command name'
  600.   Cmd25_IconIndex = 344
  601.   Cmd25_Description = 'Any description'
  602.   Cmd25_CoolDown = 5
  603.   Cmd25_MoodGain = 0
  604.   Cmd25_ActionTime = 200
  605.   Cmd25_Type = ''
  606.  
  607.   #-----------------------------------------------------------------------------
  608.   # * Commands database
  609.   Commands = {
  610.  
  611.   1 =>  [Cmd1_Name,   c = 1, ii = Cmd1_IconIndex,  t = 0,   tg = false, nil,
  612.          Cmd1_Description, Cmd1_CoolDown, 0, ty = 'Triggering'],
  613.   2 =>  [Cmd2_Name,  c = 2, Cmd2_IconIndex,      t = 160, tg = false, nil,
  614.          Cmd2_Description, Cmd2_CoolDown, Cmd2_MoodGain, ty = 'Mood +'],
  615.   3 =>  [Cmd3_Name, c = 3, Cmd3_IconIndex, t = 160, tg = false, nil,
  616.          Cmd3_Description, Cmd3_CoolDown, Cmd3_MoodGain, ty = 'Mood +'],
  617.   4 =>  [Cmd4_Name,      c = 4, ii = Cmd4_IconIndex,  t = 160, tg = false, nil,
  618.          Cmd4_Description, Cmd4_CoolDown, Cmd4_MoodGain, ty = 'Mood +'],
  619.   5 =>  [Cmd5_Name,      c = 5, Cmd5_IconIndex,  t = 160, tg = false, nil,
  620.          Cmd5_Description, Cmd5_CoolDown, Cmd5_MoodGain, ty = 'Mood +'],
  621.   6 =>  [Cmd6_Name,      c = 6, Cmd6_IconIndex,  t = 200, tg = false, nil,
  622.          Cmd6_Description, Cmd6_CoolDown, Cmd6_MoodGain, ty = 'Mood +'],
  623.   7 =>  [Cmd7_Name,      c = 7, Cmd7_IconIndex,  t = 500, tg = false, nil,
  624.          Cmd7_Description, Cmd7_CoolDown, Cmd7_MoodGain, ty = 'Mood +'],
  625.   8 =>  [Cmd8_Name,      c = 8, Cmd8_IconIndex,  t = 500, tg = false, nil,
  626.          Cmd8_Description, Cmd8_CoolDown, Cmd8_MoodGain, ty = 'Mood +'],
  627.   9 =>  [Cmd9_Name,      c = 9, Cmd9_IconIndex,  t = 400, tg = false, nil,
  628.          Cmd9_Description, Cmd9_CoolDown, Cmd9_MoodGain, ty = 'Mood +'],
  629.   #----------------------- # Actions
  630.   10 => [Cmd10_Name,    c = 10,  Cmd10_IconIndex, t = 0,   tg = true, nil,
  631.          Cmd10_Description, Cmd10_CoolDown, 0, ty = 'Action'],
  632.   11 => [Cmd11_Name,    c = 11,  Cmd11_IconIndex, t = 0,   tg = true, nil,
  633.          Cmd11_Description, Cmd11_CoolDown, 0, ty = 'Action'],
  634.   12 => [Cmd12_Name,    c = 12,  Cmd12_IconIndex, t = 0,   tg = true, nil,
  635.          Cmd12_Description, Cmd12_CoolDown, 0, ty = 'Action'],
  636.   13 => [Cmd13_Name,    c = 13,  Cmd13_IconIndex, t = 0,   tg = true, nil,
  637.          Cmd13_Description, Cmd13_CoolDown, 0, ty = 'Action'],
  638.   #-------------------- casting commands
  639.   14 => [Cmd14_Name,    c = 14,  Cmd14_IconIndex, t = 300,   tg = false, nil,
  640.          Cmd14_Description, Cmd14_CoolDown, 0, ty = 'Casting'],
  641.   15 => [Cmd15_Name,    c = 15,  Cmd15_IconIndex, t = 200,   tg = false, nil,
  642.          Cmd15_Description, Cmd15_CoolDown, 0, ty = 'Casting'],
  643.   16 => [Cmd16_Name,    c = 16,  Cmd16_IconIndex, t = 200,   tg = false, nil,
  644.          Cmd16_Description, Cmd16_CoolDown, 0, ty = 'Casting'],
  645.   17 => [Cmd17_Name,    c = 17,  Cmd17_IconIndex, t = 200,   tg = false, nil,
  646.          Cmd17_Description, Cmd17_CoolDown, 0, ty = 'Casting'],
  647.   18 => [Cmd18_Name,    c = 18,  Cmd18_IconIndex, t = 200,   tg = false, nil,
  648.          Cmd18_Description, Cmd18_CoolDown, 0, ty = 'Casting'],
  649.   19 => [Cmd19_Name,    c = 19,  Cmd19_IconIndex, t = 200,   tg = false, nil,
  650.          Cmd19_Description, Cmd19_CoolDown, 0, ty = 'Casting'],
  651.          
  652.   #----------------------- custom commands      
  653.   20 => [Cmd20_Name, c = 20, Cmd20_IconIndex, Cmd20_ActionTime, tg = false, nil,
  654.          Cmd20_Description, Cmd20_CoolDown, Cmd20_MoodGain, Cmd20_Type],
  655.   21 => [Cmd21_Name, c = 21, Cmd21_IconIndex, Cmd21_ActionTime, tg = false, nil,
  656.          Cmd21_Description, Cmd21_CoolDown, Cmd21_MoodGain, Cmd21_Type],
  657.   22 => [Cmd22_Name, c = 22, Cmd22_IconIndex, Cmd22_ActionTime, tg = false, nil,
  658.          Cmd22_Description, Cmd22_CoolDown, Cmd22_MoodGain, Cmd22_Type],
  659.   23 => [Cmd23_Name, c = 23, Cmd23_IconIndex, Cmd23_ActionTime, tg = false, nil,
  660.          Cmd23_Description, Cmd23_CoolDown, Cmd23_MoodGain, Cmd23_Type],
  661.   24 => [Cmd24_Name, c = 24, Cmd24_IconIndex, Cmd24_ActionTime, tg = false, nil,
  662.          Cmd24_Description, Cmd24_CoolDown, Cmd24_MoodGain, Cmd24_Type],
  663.   25 => [Cmd25_Name, c = 25, Cmd25_IconIndex, Cmd25_ActionTime, tg = false, nil,
  664.          Cmd25_Description, Cmd25_CoolDown, Cmd25_MoodGain, Cmd25_Type],
  665.   #--------------------------------------------------------------
  666.   26 => [Cmd26_Name,    c = 26,  Cmd26_IconIndex, t = 0,   tg = false, s = true,
  667.          Cmd26_Description, Cmd26_CoolDown, 0, ty = 'Listing'],
  668.          
  669.   #----this is the command return, this is not listed, it cannot be changed
  670.   27 => [nil, nil, nil, nil, nil, nil,
  671.          nil, nil, nil, nil],
  672.          
  673.   #-----------------------------------------------------------------------------
  674.   # Need more custom commands? you can create as many custom commands you need
  675.   # the next command on database would be 28, see examples below
  676.   #  28 => ['name', id, icon_index, action_time, target, nil,
  677.   #          'Description', Cool down, mood gainig, type],
  678.   #
  679.   #  So the command should be as follows
  680.   #
  681.   # 28 => ['Any name', id = 28, icon = 19, action_time = 200, false, nil,
  682.   #        'Any description', cooldown = 5, mood_gain = 0, type = 'Any type'],
  683.   #
  684.   #
  685.   # Do not change the values  "false, nil" from the commands data, they are
  686.   # defaults for the action commands.
  687.   #-----------------------------------------------------------------------------
  688.   # * Start creating new custom commands here
  689.  
  690.  
  691.  
  692.   }
  693.  
  694. end
  695.  
  696.  
  697. #-------------------------------------------------------------------------------
  698. # Game Pet class
  699.  
  700. class Game_Pet < Game_Character
  701.   include FalPet
  702.   attr_accessor :command, :stucked, :lastspot, :action_time, :short_jump
  703.   attr_accessor :chase_event_id, :mood, :cooldown, :unlock_command,:reservedmood
  704.   attr_accessor :pet_level, :grow_inflation, :lvup_pop, :stealed_item, :pet_id
  705.   attr_accessor :character_name, :character_index, :petname, :sounds, :casting
  706.   attr_accessor :randomitem, :custom_mode, :stuck_count, :instantcd, :through
  707.   def initialize
  708.     super
  709.     @pet_id = 0
  710.     @priority_type = 1
  711.     @mood = 0
  712.     @pet_level = 1
  713.     @cooldown = []
  714.     FalPet::Commands.keys.size.times do ; @cooldown.push(0) ; end
  715.     @unlock_command = DeafaultMoodCommands
  716.     @grow_inflation = [StartingMoodMax, grow = 0, GiftBundle.max_by{|k,v| v}[0]]
  717.     @lvup_pop = false
  718.     @instantcd = 0
  719.     @reservedmood = 0
  720.     reset_pet
  721.   end
  722.  
  723.   def reset_pet
  724.     @command = 0
  725.     @stucked = 0
  726.     @action_time = 0
  727.     @short_jump = false
  728.     @lastspot = nil
  729.     @casting = false
  730.     @custom_mode = nil
  731.     @stuck_count = 0
  732.     @through = true
  733.     $game_switches[CustomSwitch] = false if $game_switches[CustomSwitch]
  734.   end
  735.  
  736.   # set up
  737.   def setup_pet(id)
  738.     get_bonus(@pet_id, sub = true) if @pet_id > 0
  739.     @pet_id = id
  740.     set = Pets[@pet_id]
  741.     @character_name = set[0]
  742.     @character_index = set[1]
  743.     @petname = set[2]
  744.     @sounds = [set[3], set[4], set[5]]
  745.     @balloon_id = 1 if SceneManager.scene_is?(Scene_Map)
  746.     play_voice
  747.     get_bonus(@pet_id)
  748.   end
  749.  
  750.   def get_bonus(id, sub=false)
  751.     set = Bonus[id]
  752.     for member in $game_party.members
  753.       for i in 0...8
  754.         sub ? member.add_param(i, -set[i]) : member.add_param(i, set[i])
  755.       end
  756.     end
  757.   end
  758.  
  759.   def play_voice
  760.     RPG::SE.new(@sounds[0],@sounds[1],@sounds[2]).play
  761.   end
  762.  
  763.   def busy?
  764.     @command > 0
  765.   end
  766.  
  767.   def custom_command?
  768.     return true if @command.between?(20, 25)
  769.     return true if @command.between?(28, FalPet::Commands.keys.size)
  770.     return false
  771.   end
  772.  
  773.   def time?(t)
  774.     t == @action_time
  775.   end
  776.  
  777.   def prepare
  778.     $game_player.prepare_petact
  779.   end
  780.  
  781.   def pop_text(text, time)
  782.     $game_player.gamepet.custom_mode = text
  783.     $game_player.petpop_time = time * 60
  784.   end
  785.  
  786.   def pop_mood
  787.     $game_player.start_poping_window(1, 3)
  788.   end
  789.  
  790.   def level
  791.     return @pet_level
  792.   end
  793.  
  794.   def cast
  795.     @casting = true
  796.   end
  797.  
  798.   def ending?
  799.     @action_time == 2
  800.   end
  801.  
  802.   def cmd?(c)
  803.     c == @command
  804.   end
  805.  
  806.   def play_balloon
  807.     @balloon_id = BalloonPlaying
  808.   end
  809.  
  810.   def zoom(x, y)
  811.     @zoomfx_x = x
  812.     @zoomfx_y = y
  813.   end
  814.  
  815.   def reset_zoom
  816.     @zoomfx_x = 1.0
  817.     @zoomfx_y = 1.0
  818.   end
  819.  
  820.   def gain_mood(n)
  821.     @mood = [[@mood + n, 0].max, @grow_inflation[0]].min
  822.   end
  823.  
  824.   def gain_level(n)
  825.     @pet_level = [[@pet_level + n, 0].max, @grow_inflation[2]].min
  826.   end
  827.  
  828.   def mood_full?
  829.     @mood == @grow_inflation[0]
  830.   end
  831.  
  832.   # apply pet growing
  833.   def apply_growing
  834.     @grow_inflation[1] += 1
  835.     if @grow_inflation[1] == Growing
  836.       if @pet_level != @grow_inflation[2]
  837.         @grow_inflation[0] = @grow_inflation[0] + MoodMaxPlus
  838.         gain_level(1)
  839.         @lvup_pop = true
  840.       end
  841.       @grow_inflation[1] = 0
  842.     end
  843.   end
  844.  
  845.   def twist(value, m)
  846.     set_direction(2) if @action_time == value
  847.     set_direction(4) if @action_time == value - m
  848.     set_direction(6) if @action_time == value - m - m
  849.     set_direction(8) if @action_time == value - m - m - m
  850.   end
  851.  
  852.   def mood_cmd(id)
  853.     return unless id.between?(2, 9)
  854.     @unlock_command.push(id) unless @unlock_command.include?(id)
  855.   end
  856.  
  857.   # gift item
  858.   def mood_item
  859.     FalPet::GiftBundle.each do |level, item_id|
  860.       if level == @pet_level
  861.         item = $data_items[item_id]
  862.         return item if !item.nil?
  863.       end
  864.     end
  865.     return $data_items[1]
  866.   end
  867.  
  868.   # radom items
  869.   def get_randomitem(type, variable)
  870.     case type
  871.     when 'item'   ; operand = $data_items
  872.     when 'weapon' ; operand = $data_weapons
  873.     when 'armor'  ; operand = $data_armors
  874.     when 'gold'   ; operand = nil
  875.     end
  876.     if operand != nil
  877.       data = []
  878.       variable.each {|id, value|  data.push([id, value])}
  879.       item = data[rand(data.size)]
  880.       @randomitem = [operand[item[0]], item[1]]
  881.     else
  882.       gold = variable[rand(variable.size)]
  883.       @randomitem = [gold]
  884.     end
  885.   end
  886.  
  887.   def update
  888.     @pattern = 0 if @casting
  889.     @move_speed = $game_player.real_move_speed if !busy?
  890.     if custom_command?
  891.       $game_switches[CustomSwitch] = true if !$game_switches[CustomSwitch]
  892.     end
  893.     for event in $game_map.events.values
  894.       if event.check_evcom("/PET GRAB")
  895.         event.priority_type = 1 if event.priority_type != 1
  896.       end
  897.     end
  898.     super
  899.   end
  900.  
  901.   def cast_item_producing(anime, ct=false)
  902.     case @action_time
  903.     when 180 ; jump_high(0, 0, 16) ; @casting = true
  904.     when 160 ; ct ? $game_player.animation_id = anime : @animation_id = anime
  905.     when 6   ; play_balloon ; play_voice
  906.     when 1   ; RPG::SE.new("Item3",80).play if !ct
  907.     ct ? $game_player.start_poping_window(13, 2) :
  908.     $game_player.start_poping_window(11, 3)
  909.     end
  910.   end
  911.  
  912.   def update_anime_pattern
  913.     @casting ? return : super
  914.   end
  915. end
  916.  
  917. #-------------------------------------------------------------------------------
  918. # * Character base new methods and variabbles
  919.  
  920. class Game_CharacterBase
  921.   attr_accessor :x, :y, :direction, :priority_type, :pattern, :through
  922.   attr_accessor :step_anime, :direction_fix, :move_speed, :egrabbing
  923.   attr_accessor :zoomfx_x
  924.   attr_accessor :zoomfx_y
  925.   attr_accessor :anglefx
  926.  
  927.   alias falcao_zoomfx_ini initialize
  928.   def initialize
  929.     @zoomfx_x = 1.0
  930.     @zoomfx_y = 1.0
  931.     @anglefx = 0.0
  932.     @layingdown = false
  933.     falcao_zoomfx_ini
  934.   end
  935.  
  936.   def liedown
  937.     set_direction(8)
  938.     @anglefx = 100
  939.     @layingdown = true
  940.   end
  941.  
  942.   def reset_liedown
  943.     @anglefx = 0.0
  944.     @layingdown = false
  945.   end
  946.  
  947.   def move_toward_char(character)
  948.     sx = distance_x_from(character.x)
  949.     sy = distance_y_from(character.y)
  950.     if sx != 0 && sy != 0
  951.       move_diagonal(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2)
  952.     elsif sx != 0
  953.       move_straight(sx > 0 ? 4 : 6)
  954.     elsif sy != 0
  955.       move_straight(sy > 0 ? 8 : 2)
  956.     end
  957.   end
  958.  
  959.   # jump to specific tiles
  960.   def jumpto_tile(x, y)
  961.     jumpto(0, [x, y])
  962.   end
  963.  
  964.   # jumpto character ( 0 = Game Player, 1 and up event id)
  965.   def jumpto(char_id, tilexy=nil)
  966.     char_id > 0 ? char = $game_map.events[char_id] : char = $game_player
  967.     tilexy.nil? ? condxy = [char.x, char.y] : condxy = [tilexy[0], tilexy[1]]
  968.     jx = + eval_distance(tilexy.nil? ? char : tilexy)[0] if condxy[0] >= @x
  969.     jy = - eval_distance(tilexy.nil? ? char : tilexy)[1] if condxy[1] <= @y
  970.     jx = - eval_distance(tilexy.nil? ? char : tilexy)[0] if condxy[0] <= @x
  971.     jy = - eval_distance(tilexy.nil? ? char : tilexy)[1] if condxy[1] <= @y
  972.     jx = - eval_distance(tilexy.nil? ? char : tilexy)[0] if condxy[0] <= @x
  973.     jy = + eval_distance(tilexy.nil? ? char : tilexy)[1] if condxy[1] >= @y
  974.     jx = + eval_distance(tilexy.nil? ? char : tilexy)[0] if condxy[0] >= @x
  975.     jy = + eval_distance(tilexy.nil? ? char : tilexy)[1] if condxy[1] >= @y
  976.     jump(jx, jy)
  977.   end
  978.  
  979.   def eval_distance(target)
  980.     if target.is_a?(Array)
  981.       distance_x = (@x - target[0]).abs
  982.       distance_y = (@y - target[1]).abs
  983.     else
  984.       distance_x = (@x - target.x).abs
  985.       distance_y = (@y - target.y).abs
  986.     end
  987.     return [distance_x, distance_y]
  988.   end
  989.  
  990.   # climb area
  991.   def climb_area?(target, size)
  992.     distance = (@x - target.x).abs + (@y - target.y).abs
  993.     enable   = (distance <= size-1)
  994.     return true if enable
  995.     return false
  996.   end
  997.  
  998.   # controlled jump x, y , height
  999.   def jump_high(x_plus, y_plus, heigh)
  1000.     if x_plus.abs > y_plus.abs
  1001.       set_direction(x_plus < 0 ? 4 : 6) if x_plus != 0
  1002.     else
  1003.       set_direction(y_plus < 0 ? 8 : 2) if y_plus != 0
  1004.     end
  1005.     @x += x_plus
  1006.     @y += y_plus
  1007.     distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
  1008.     @jump_peak = heigh + distance - @move_speed
  1009.     @jump_count = @jump_peak * 2
  1010.     @stop_count = 0
  1011.     straighten ; @priority_type = 2
  1012.   end
  1013.  
  1014.   def samepos?(target)
  1015.     @x == target.x and @y == target.y
  1016.   end
  1017.  
  1018.   # get distance passable tile_x and tile_y
  1019.   def tiles_pass
  1020.     dir = @direction
  1021.     operand = 17 if dir == 4 || dir == 6
  1022.     operand = 13 if dir == 2 || dir == 8
  1023.     for i in 1...operand
  1024.       return [@x, @y + i] if dir == 2 and $game_map.passable?(@x, @y + i, dir)
  1025.       return [@x, @y - i] if dir == 8 and $game_map.passable?(@x, @y - i, dir)
  1026.       return [@x - i, @y] if dir == 4 and $game_map.passable?(@x - i, @y, dir)  
  1027.       return [@x + i, @y] if dir == 6 and $game_map.passable?(@x + i, @y, dir)  
  1028.     end
  1029.     return nil
  1030.   end
  1031.  
  1032.   def adjustpxy
  1033.     push_x, push_y =   0,   1 if @direction == 2
  1034.     push_x, push_y = - 1,   0 if @direction == 4
  1035.     push_x, push_y =   1,   0 if @direction == 6
  1036.     push_x, push_y =   0, - 1 if @direction == 8
  1037.     return [push_x, push_y]
  1038.   end
  1039.  
  1040. end
  1041.  
  1042. #-------------------------------------------------------------------------------
  1043. # * Game player new methods and variabbles
  1044.  
  1045. class Game_Player < Game_Character
  1046.   attr_reader   :gamepet
  1047.   attr_reader   :showing_pet
  1048.   attr_accessor :petpop_time
  1049.   attr_accessor :petpop_refresh
  1050.   attr_accessor :petpop_type
  1051.   attr_accessor :adopted_pets
  1052.   attr_accessor :just_jumped
  1053.   alias falcao_pet_ini initialize
  1054.   def initialize
  1055.     @gamepet = Game_Pet.new
  1056.     @showing_pet = false
  1057.     @petpop_refresh = false
  1058.     @petpop_time = 0
  1059.     @petpop_type = 0
  1060.     @climb_wait = 0
  1061.     @adopted_pets = []
  1062.     @just_jumped = false
  1063.     falcao_pet_ini
  1064.   end
  1065.  
  1066.   alias falcao_pet_main_update update
  1067.   def update
  1068.     update_gamepet
  1069.     falcao_pet_main_update
  1070.   end
  1071.  
  1072.   def adopt_pet(id)
  1073.     @adopted_pets.include?(id) ? return :  @adopted_pets.push(id)
  1074.     @gamepet.setup_pet(id)
  1075.     @showing_pet = true
  1076.   end
  1077.  
  1078.   def have_pet?
  1079.     !@adopted_pets.empty?
  1080.   end
  1081.  
  1082.   def update_gamepet
  1083.     return unless have_pet?
  1084.    
  1085.     if @gamepet.action_time > 0
  1086.       @gamepet.action_time -= 1
  1087.       globalpet_reset if @gamepet.action_time == 0
  1088.     end
  1089.     @petpop_time -= 1 if @petpop_time > 0
  1090.     @climb_wait -= 1 if @climb_wait > 0
  1091.     @gamepet.update if @showing_pet
  1092.     update_path_manager
  1093.     update_call_commands
  1094.     case @gamepet.command
  1095.     when 1
  1096.       update_command_showhide
  1097.     when 2..9
  1098.       update_command_play
  1099.     when 10
  1100.       update_command_startevet(@gamepet.chase_event_id)
  1101.     when 11
  1102.       update_command_steal(@gamepet.chase_event_id)
  1103.     when 12
  1104.       update_command_grab(@gamepet.chase_event_id)
  1105.     when 13
  1106.       update_command_climb(@gamepet.chase_event_id)
  1107.     when 14
  1108.       update_command_heal
  1109.     when 15
  1110.       update_command_randomitems
  1111.     when 16
  1112.       update_command_randomweapons
  1113.     when 17
  1114.       update_command_randomarmors
  1115.     when 18
  1116.       update_command_randomgold
  1117.     when 19
  1118.       update_command_instantcd
  1119.     when 27
  1120.       update_command_return
  1121.     end
  1122.     update_poppetwindow
  1123.   end
  1124.  
  1125.   def update_call_commands
  1126.     return unless FalPet::UseKey
  1127.     SceneManager.call(Scene_PetCommands) if Input.trigger?(FalPet::CommandsKey)
  1128.   end
  1129.  
  1130.   # command return
  1131.   def update_command_return
  1132.     @gamepet.move_toward_character(self) unless @gamepet.moving?
  1133.     globalpet_reset if @gamepet.x == @x and @gamepet.y == @y
  1134.   end
  1135.  
  1136.   # path manager
  1137.   def update_path_manager
  1138.     return unless @gamepet.command == 27 || @gamepet.command.between?(10, 13)
  1139.     @gamepet.stucked += 1 if not @gamepet.moving?
  1140.     @gamepet.stucked = 0 if @gamepet.moving?
  1141.     @gamepet.stucked = 0 if @climb_wait > 0 and !@gamepet.moving?
  1142.     if @gamepet.stuck_count >= FalPet::StuckCount
  1143.       @gamepet.command = 27
  1144.       @gamepet.stuck_count = 0
  1145.       start_poping_window(12, 3)
  1146.     end
  1147.     #------------------------------------------
  1148.     if @gamepet.stucked == 45
  1149.       if @gamepet.command == 27
  1150.         event = $game_map.events[@gamepet.chase_event_id] rescue nil
  1151.         @gamepet.turn_toward_character(self)
  1152.         if @gamepet.tiles_pass != nil
  1153.           tilex, tiley = @gamepet.tiles_pass[0], @gamepet.tiles_pass[1]
  1154.           @gamepet.jumpto_tile(tilex, tiley)
  1155.           event.jumpto_tile(tilex,tiley) if !event.nil? && !event.egrabbing.nil?
  1156.         else
  1157.           @gamepet.jumpto(0)
  1158.           event.jumpto(0) if !event.nil? and !event.egrabbing.nil?
  1159.         end
  1160.      
  1161.         # command activate / steal / grab / climb
  1162.       elsif @gamepet.command.between?(10, 13)
  1163.         event = $game_map.events[@gamepet.chase_event_id]
  1164.         @gamepet.turn_toward_character(event)
  1165.         if @gamepet.tiles_pass != nil
  1166.           if @gamepet.climb_area?(event, 3)
  1167.             @gamepet.jumpto(@gamepet.chase_event_id)
  1168.             return
  1169.           end
  1170.           @gamepet.jumpto_tile(@gamepet.tiles_pass[0], @gamepet.tiles_pass[1])
  1171.         else
  1172.           @gamepet.jumpto(@gamepet.chase_event_id)
  1173.         end
  1174.       end
  1175.       @gamepet.stucked = 0
  1176.       @gamepet.stuck_count += 1
  1177.     end
  1178.   end
  1179.  
  1180.   def start_poping_window(type, time, seconds=true)
  1181.     @petpop_type = type
  1182.     seconds ? @petpop_time = time * 60 : @petpop_time = time
  1183.   end
  1184.  
  1185.   # comand showhide
  1186.   def update_command_showhide
  1187.     # hide
  1188.     if @showing_pet
  1189.       @gamepet.balloon_id = 1
  1190.       unless @gamepet.jumping?
  1191.         @showing_pet = false
  1192.         @gamepet.reset_pet
  1193.       end
  1194.       # show
  1195.     else
  1196.       @gamepet.balloon_id = 4
  1197.       @showing_pet = true
  1198.       @gamepet.reset_pet
  1199.     end
  1200.   end
  1201.  
  1202.   # play with pet
  1203.   def update_command_play
  1204.     prepare_petact
  1205.     time = @gamepet.action_time
  1206.     case @gamepet.command
  1207.     when 2 # jump jump
  1208.       @gamepet.jump(0,0) if time == 130
  1209.       @gamepet.jump(0,0) if time == 100
  1210.       @gamepet.jump(0,0) if time == 70
  1211.       @gamepet.play_balloon if time == 40
  1212.       @gamepet.play_voice  if time == 20
  1213.      
  1214.     when 3 # tun r around
  1215.       @gamepet.jump(0,0) if time == 130
  1216.       @gamepet.twist(100, 10)
  1217.       @gamepet.turn_toward_character(self) if time == 50
  1218.       @gamepet.play_balloon if time == 30
  1219.       @gamepet.play_voice if time == 20
  1220.      
  1221.     when 4 # zoom
  1222.       if time > 90 and time < 130
  1223.         @gamepet.zoomfx_x += 0.02
  1224.         @gamepet.zoomfx_y += 0.02
  1225.       elsif time > 30 and time < 70
  1226.         @gamepet.zoomfx_x -= 0.02
  1227.         @gamepet.zoomfx_y -= 0.02
  1228.       end
  1229.       @gamepet.play_balloon if time == 30
  1230.       @gamepet.play_voice if time == 20
  1231.      
  1232.     when 5 #chase jump
  1233.       if time == 130
  1234.         @gamepet.lastspot = [@gamepet.x, @gamepet.y]
  1235.         @gamepet.jumpto(0)
  1236.       elsif time == 90
  1237.         @gamepet.jumpto_tile(@gamepet.lastspot[0], @gamepet.lastspot[1])
  1238.       end
  1239.       @gamepet.move_forward if time == 70
  1240.       @gamepet.turn_toward_character(self) if time == 50
  1241.       @gamepet.move_forward if time == 10
  1242.       @gamepet.play_balloon if time == 30
  1243.       @gamepet.play_voice if time == 20
  1244.      
  1245.     when 6 # twist
  1246.       @gamepet.move_away_from_player if time == 170
  1247.       @gamepet.turn_toward_character(self) if time == 150
  1248.       @gamepet.twist(140, 5) ; @gamepet.twist(120, 5)
  1249.       @gamepet.twist(100, 5) ; @gamepet.twist(80, 5)
  1250.       @gamepet.twist(60, 5)  ; @gamepet.twist(40, 10)
  1251.       @gamepet.play_balloon if time == 20
  1252.       @gamepet.play_voice if time == 10
  1253.       @gamepet.jump(0,0) if time == 10
  1254.       @gamepet.turn_toward_character(self) if time == 10
  1255.      
  1256.     when 7 # play dead
  1257.       @gamepet.move_away_from_player if time == 470
  1258.       @gamepet.turn_toward_character(self) if time == 450
  1259.       @gamepet.balloon_id = FalPet::PlayDeadBalloon if  time == 400
  1260.       @gamepet.liedown if time == 430
  1261.       @gamepet.play_balloon if time == 20
  1262.       @gamepet.play_voice if time == 10
  1263.       @gamepet.turn_toward_character(self) if time == 10
  1264.      
  1265.     when 8 # dance
  1266.       RPG::BGM.fade(1 * 1000) if time == 590
  1267.       @gamepet.move_away_from_player if time == 470
  1268.       @gamepet.turn_toward_character(self) if time == 450
  1269.       if time == 410
  1270.         $game_system.save_bgm
  1271.         RPG::BGM.new(FalPet::DancingBgm,80).play
  1272.         @gamepet.step_anime = true
  1273.         @gamepet.move_speed = 5
  1274.       end
  1275.       @gamepet.move_forward if time == 320
  1276.       @gamepet.move_backward if time == 260
  1277.       @gamepet.jump(0, 0) if time == 220
  1278.       @gamepet.jump(0, 0) if time == 205
  1279.       @gamepet.twist(180, 5) ; @gamepet.twist(160, 5)
  1280.       @gamepet.turn_toward_character(self) if time == 130
  1281.       @gamepet.move_speed = 4 if time == 125
  1282.       @gamepet.liedown if time == 120
  1283.       @gamepet.reset_liedown if time == 110
  1284.       @gamepet.play_balloon if time == 40
  1285.       @gamepet.play_voice if time == 40
  1286.       @gamepet.move_toward_player if time == 30
  1287.       $game_system.replay_bgm if time == 2
  1288.      
  1289.     when 9 # trampoline
  1290.       case time
  1291.       when 350; @gamepet.jump_high(0,0, 20); RPG::SE.new("Jump2",80,).play
  1292.       when 300; jump_high(0, 0, 20); ; RPG::SE.new("Jump2",80,).play
  1293.       when 250; @gamepet.jump_high(0,0, 20); RPG::SE.new("Jump2",80,).play
  1294.       when 200; jump_high(0, 0, 20); ; RPG::SE.new("Jump2",80,).play
  1295.       when 150; @gamepet.jump_high(0,0, 20); RPG::SE.new("Jump2",80,).play
  1296.       when 112; @gamepet.liedown; RPG::SE.new("Crossbow",80,).play
  1297.                 $game_map.screen.start_shake(7, 7, 20)
  1298.       when 80;  @gamepet.play_balloon; RPG::SE.new("Miss",80,).play
  1299.       when 10;  @gamepet.reset_liedown; @gamepet.play_voice
  1300.                 @gamepet.turn_toward_player
  1301.       end
  1302.     end
  1303.     start_poping_window(1, 3) if time == 1
  1304.   end
  1305.  
  1306.   # reseting
  1307.   def globalpet_reset
  1308.     @gamepet.reset_pet
  1309.     @gamepet.zoomfx_x = 1.0
  1310.     @gamepet.zoomfx_y = 1.0
  1311.     @gamepet.reset_liedown
  1312.     @vastored = nil
  1313.     @gamepet.step_anime = false
  1314.     @gamepet.direction_fix = false
  1315.     @gamepet.priority_type = 1
  1316.     @climb_wait = 0
  1317.     if @gamepet.chase_event_id != nil
  1318.       event = $game_map.events[@gamepet.chase_event_id]
  1319.       if !event.nil? and !event.egrabbing.nil?
  1320.         event.egrabbing = nil
  1321.         event.move_speed = @gvdata[0]
  1322.         event.move_type = @gvdata[1]
  1323.         event.priority_type = @gvdata[2]
  1324.       end
  1325.     end
  1326.   end
  1327.  
  1328.   def update_poppetwindow
  1329.     if @gamepet.lvup_pop and @petpop_time == 0
  1330.       start_poping_window(3, 80, false)
  1331.       @petpop_refresh = true
  1332.       @gamepet.lvup_pop = false
  1333.       RPG::SE.new("Up1",80).play
  1334.       @gamepet.jump(0, 0)
  1335.     end
  1336.     if @petpop_time == 2 * 60 and @petpop_type == 1 and
  1337.       @gamepet.reservedmood != 0
  1338.       @gamepet.gain_mood(@gamepet.reservedmood)
  1339.       @gamepet.mood_full? ? @petpop_type = 2 : @petpop_type = 1
  1340.       @petpop_refresh = true
  1341.       @gamepet.reservedmood = 0
  1342.     end
  1343.   end
  1344.  
  1345. #-------------------------------------------------------------------------------
  1346. # Pet trigger targets
  1347.   def update_command_startevet(id)
  1348.     event = $game_map.events[id]
  1349.     @gamepet.through = false if @gamepet.through
  1350.     @gamepet.move_toward_character(event) unless @gamepet.moving?
  1351.     if @gamepet.samepos?(event) && @gamepet.command == 10 && !@gamepet.jumping?
  1352.       event.check_evcom("/PET TRIGGER") ? event.start : start_poping_window(4,2)
  1353.       @gamepet.command = 27
  1354.     end
  1355.   end
  1356.  
  1357.   #-----------------------------------------------------------------------------
  1358.   # steal
  1359.  
  1360.   def update_command_steal(id)
  1361.     event = $game_map.events[id]
  1362.     @gamepet.through = false if @gamepet.through
  1363.     @gamepet.move_toward_character(event) unless @gamepet.moving?
  1364.     if @gamepet.samepos?(event) && @gamepet.command == 11 && !@gamepet.jumping?
  1365.       item   = event.check_evvar("/PET STEAL ITEM")
  1366.       weapon = event.check_evvar("/PET STEAL WEAPON")
  1367.       armor  = event.check_evvar("/PET STEAL ARMOR")
  1368.       gold   = event.check_evvar("/PET STEAL GOLD")
  1369.       chance = event.check_evvar("/PET STEAL CHANCE 1 / ")
  1370.       chance = 1 if chance == 0
  1371.       have_something = item > 0 || weapon > 0 || gold > 0 || armor > 0
  1372.       unless have_something
  1373.         start_poping_window(7, 3)
  1374.         @gamepet.play_voice
  1375.         @gamepet.command = 27
  1376.         return
  1377.       end
  1378.       if rand(chance) == 0
  1379.         if item != 0
  1380.           gain_stealed_item($data_items[item])
  1381.         elsif weapon != 0
  1382.           gain_stealed_item($data_weapons[weapon])
  1383.         elsif armor != 0
  1384.           gain_stealed_item($data_armors[armor])
  1385.         elsif gold != 0
  1386.           @gamepet.stealed_item = gold
  1387.           $game_party.gain_gold(gold)
  1388.           RPG::SE.new("Shop",80).play
  1389.           start_poping_window(5, 3)
  1390.         end
  1391.       else
  1392.         start_poping_window(6, 3)
  1393.         @gamepet.play_voice
  1394.       end
  1395.       @gamepet.command = 27
  1396.     end
  1397.   end
  1398.  
  1399.   def gain_stealed_item(stealed)
  1400.     @gamepet.stealed_item = stealed
  1401.     $game_party.gain_item(stealed, 1)
  1402.     RPG::SE.new("Item3",80).play
  1403.     start_poping_window(5, 3)
  1404.   end
  1405.  
  1406.   #-----------------------------------------------------------------------------
  1407.   # Grab
  1408.  
  1409.   def update_command_grab(id)
  1410.     event = $game_map.events[id]
  1411.     @gamepet.through = false if @gamepet.through
  1412.     @gamepet.move_toward_character(event) unless @gamepet.moving?
  1413.     if @gamepet.samepos?(event) && @gamepet.command == 12 && !@gamepet.jumping?
  1414.       @gvdata = [event.move_speed, event.move_type, event.priority_type]
  1415.       event.check_evcom("/PET GRAB") ? event.egrabbing = true :
  1416.       start_poping_window(8, 2)
  1417.       @gamepet.command = 27
  1418.     end
  1419.   end
  1420.  
  1421.   #-----------------------------------------------------------------------------
  1422.   # Climb CLIMB MIERDDAAAAAAAAAAAAAAAAAAAA
  1423.  
  1424.   def update_command_climb(id)
  1425.     event = $game_map.events[id]
  1426.     event.priority_type = 0 if event.priority_type != 0
  1427.     event.through = true if !event.through
  1428.     @gamepet.through = false if @gamepet.through
  1429.     @gamepet.move_toward_character(event) if !@gamepet.moving? and
  1430.     @climb_wait == 0
  1431.     @gamepet.turn_toward_character(self) if @climb_wait > 0
  1432.     if @climb_wait == 1 and @gamepet.x == event.x and @gamepet.y == event.y
  1433.       @gamepet.command = 27
  1434.       return
  1435.     end
  1436.     if climb_area?(event, 7) and @climb_wait > 0 and !moving?
  1437.       if @gamepet.x == @x and @gamepet.y == @y
  1438.         globalpet_reset
  1439.         return
  1440.       end
  1441.       # jump to cimb aerea player
  1442.       if !passable?(@x, @y, @direction) and @gamepet.x == event.x and
  1443.         @gamepet.y == event.y and Input.dir8 != 0
  1444.         jumpto(event.id)
  1445.         self.followers.reverse_each do |f|
  1446.           f.move_toward_player ; f.move_toward_player ; f.move_toward_player
  1447.           f.jumpto(event.id)
  1448.         end
  1449.         RPG::SE.new("Shot1",80).play
  1450.         globalpet_reset
  1451.       end
  1452.     end
  1453.     if @gamepet.samepos?(event) && @climb_wait == 0 && !@gamepet.jumping?
  1454.       if event.check_evcom("/PET CLIMB")
  1455.         unless @gamepet.x == @x and @gamepet.y == @y
  1456.           start_poping_window(9, 1)
  1457.           @gamepet.play_voice
  1458.           @gamepet.jump(0, 0)
  1459.           @climb_wait = 12 * 60
  1460.         end
  1461.       end
  1462.     end
  1463.   end
  1464.  
  1465.   # preparation for pet acting
  1466.   def prepare_petact
  1467.     if @vastored.nil?
  1468.       turn_toward_character(@gamepet) ; @gamepet.turn_toward_character(self)
  1469.       @vastored = true ; followers.gather
  1470.     end
  1471.   end
  1472.  
  1473.   #-----------------------------------------------------------------------------
  1474.   # heal command
  1475.  
  1476.   def update_command_heal
  1477.     prepare_petact
  1478.     @gamepet.move_away_from_player if @gamepet.action_time == 270
  1479.     @gamepet.turn_toward_character(self) if @gamepet.action_time == 250
  1480.     if @gamepet.action_time == 210
  1481.       @gamepet.jump_high(0, 0, 18)
  1482.       @gamepet.casting = true
  1483.     end
  1484.     $game_map.screen.start_shake(5, 5, 60) if @gamepet.action_time == 160
  1485.     if @gamepet.action_time == 120
  1486.       @gamepet.balloon_id = 1
  1487.       @gamepet.play_voice
  1488.     end
  1489.     self.animation_id = 40 if @gamepet.action_time == 100
  1490.     if @gamepet.action_time == 1
  1491.       for member in $game_party.members
  1492.         case FalPet::HealPercent
  1493.         when '25%'  ; hp = 4    ; when '50%'  ; hp = 2
  1494.         when '75%'  ; hp = 1.32 ; when '100%' ; hp = 1
  1495.         end
  1496.         member.change_hp((member.mhp  / hp).truncate, false)
  1497.         member.mp += (member.mmp  / hp).truncate
  1498.         start_poping_window(10, 3)
  1499.       end
  1500.     end
  1501.   end
  1502.  
  1503.   #-----------------------------------------------------------------------------
  1504.   # Make random item
  1505.   def update_command_randomitems
  1506.     prepare_petact
  1507.     @gamepet.cast_item_producing(FalPet::ItemAnime)
  1508.     if @gamepet.action_time == 2
  1509.       @gamepet.get_randomitem('item', FalPet::RandomItems)
  1510.       $game_party.gain_item(@gamepet.randomitem[0], @gamepet.randomitem[1])
  1511.     end
  1512.   end
  1513.  
  1514.   #-----------------------------------------------------------------------------
  1515.   # Make random weapon
  1516.   def update_command_randomweapons
  1517.     prepare_petact
  1518.     @gamepet.cast_item_producing(FalPet::WeaponAnime)
  1519.     if @gamepet.action_time == 2
  1520.       @gamepet.get_randomitem('weapon', FalPet::RandomWeapons)
  1521.       $game_party.gain_item(@gamepet.randomitem[0], @gamepet.randomitem[1])
  1522.     end
  1523.   end
  1524.  
  1525.   #-----------------------------------------------------------------------------
  1526.   # Make random armor
  1527.   def update_command_randomarmors
  1528.     prepare_petact
  1529.     @gamepet.cast_item_producing(FalPet::ArmorAnime)
  1530.     if @gamepet.action_time == 2
  1531.       @gamepet.get_randomitem('armor', FalPet::RandomArmors)
  1532.       $game_party.gain_item(@gamepet.randomitem[0], @gamepet.randomitem[1])
  1533.     end
  1534.   end
  1535.  
  1536.   #-----------------------------------------------------------------------------
  1537.   # Make random gold
  1538.   def update_command_randomgold
  1539.     prepare_petact
  1540.     @gamepet.cast_item_producing(FalPet::GoldAnime)
  1541.     if @gamepet.action_time == 2
  1542.       @gamepet.get_randomitem('gold', FalPet::RandomGold)
  1543.       $game_party.gain_gold(@gamepet.randomitem[0])
  1544.       RPG::SE.new("Shop",80).play
  1545.     end
  1546.   end
  1547.  
  1548.   #-----------------------------------------------------------------------------
  1549.   # Command instant cooldown
  1550.   def update_command_instantcd
  1551.     prepare_petact
  1552.     @gamepet.cast_item_producing(FalPet::GoldAnime, true)
  1553.     if @gamepet.action_time == 2
  1554.       @gamepet.instantcd = FalPet::BuffDuration * 60
  1555.     end
  1556.   end
  1557.  
  1558.   #-----------------------------------------------------------------------------
  1559.   alias falcaopet_move_straight move_straight
  1560.   def move_straight(d, turn_ok = true)
  1561.     return if @layingdown
  1562.     @gamepet.move_toward_char(self) if passable?(@x, @y, d) and
  1563.     not @gamepet.busy?
  1564.     falcaopet_move_straight(d, turn_ok = true)
  1565.     @just_jumped = false if @just_jumped
  1566.   end
  1567.  
  1568.   alias falcaopet_move_diagonal move_diagonal
  1569.   def move_diagonal(horz, vert)
  1570.     @gamepet.move_toward_char(self) if diagonal_passable?(@x,@y, horz, vert) and
  1571.     not @gamepet.busy?
  1572.     falcaopet_move_diagonal(horz, vert)
  1573.   end
  1574.  
  1575.   alias falcaopet_perform_transfer perform_transfer
  1576.   def perform_transfer
  1577.     $game_system.replay_bgm if @gamepet.command == 8
  1578.     globalpet_reset
  1579.     falcaopet_perform_transfer
  1580.     @gamepet.moveto(@x, @y)
  1581.     @gamepet.set_direction(@direction)
  1582.   end
  1583.  
  1584.   alias falcaopet_get_on_vehicle get_on_vehicle
  1585.   def get_on_vehicle
  1586.     falcaopet_get_on_vehicle
  1587.     if vehicle
  1588.       @showing_pet = false
  1589.       $game_system.replay_bgm if @gamepet.command == 8 ; globalpet_reset
  1590.     end
  1591.   end
  1592. end
  1593.  
  1594. # sprite set
  1595. class Spriteset_Map
  1596.   alias falcao_pet_create_characters create_characters
  1597.   def create_characters
  1598.     create_pet_sprite
  1599.     falcao_pet_create_characters
  1600.   end
  1601.  
  1602.   alias falcao_pet_dispose dispose
  1603.   def dispose
  1604.     dispose_pet_sprite
  1605.     dispose_petpop_window
  1606.     falcao_pet_dispose
  1607.   end
  1608.  
  1609.   def create_petpop_window
  1610.     return if not @mood_window.nil?
  1611.     @mood_window = Window_Base.new(544 / 2 - 230 / 2, 0, 230, 76)
  1612.     refresh_petpop_window
  1613.   end
  1614.  
  1615.   # refresh pet pop
  1616.   def refresh_petpop_window
  1617.     return if @mood_window.nil?
  1618.     @mood_window.contents.clear
  1619.     pet = $game_player.gamepet
  1620.     if pet.custom_mode != nil
  1621.       draw_extra_text(pet.custom_mode, 0, 20)
  1622.       return
  1623.     end
  1624.     case $game_player.petpop_type
  1625.  
  1626.     # Gain mood
  1627.     when 1
  1628.       @mood_window.draw_petmoodbar(0, 38)
  1629.       case (pet.mood.to_f / pet.grow_inflation[0].to_f * 100.0)
  1630.       when  0..25  ;  text = FalPet::MoodLowText
  1631.       when 26..50  ;  text = FalPet::MoodOverageText
  1632.       when 51..75  ;  text = FalPet::MoodMediumText
  1633.       when 76..100  ; text = FalPet::MoodHight
  1634.       end
  1635.       draw_extra_text(text, 100, 5, @mood_window.normal_color)
  1636.       # Giving gift
  1637.     when 2
  1638.       @mood_window.draw_petgift(110, 20)
  1639.       draw_extra_text('Gave you a gift', 0, 20)
  1640.       return if pet.mood == 0
  1641.       $game_party.gain_item(pet.mood_item, 1)
  1642.       RPG::SE.new("Item3",80).play
  1643.       pet.mood = 0
  1644.       pet.apply_growing
  1645.      
  1646.     when 3;  draw_extra_text('Level Up!', 0, 20, Color.new(255, 120, 0, 255))
  1647.     when 4;  draw_extra_text('Cannot be triggered...', 0, 20)
  1648.     when 5;  @mood_window.draw_stealed_item(0, 20)
  1649.              @mood_window.draw_petname(0, -8)
  1650.     when 6;  draw_extra_text('Could not steal!', 0, 20)
  1651.     when 7;  draw_extra_text('Nothing to steal!', 0, 20)
  1652.     when 8;  draw_extra_text('I cannot grab this shit!', 0, 20)
  1653.     when 9;  draw_extra_text('Hey come!', 0, 20)  
  1654.     when 10
  1655.       draw_extra_text("Your party was healed by #{FalPet::HealPercent}!",0, 20)
  1656.     when 11
  1657.       item = pet.randomitem
  1658.       @mood_window.contents.fill_rect(166, -6, 30, 30, Color.new(0, 0, 0, 60))
  1659.       if item[0].is_a? Fixnum
  1660.         @mood_window.draw_icon(344, 168, 0)
  1661.         draw_extra_text("Gave you x#{item[0]} #{Vocab::currency_unit}!", 0, 20)
  1662.       else
  1663.         @mood_window.draw_icon(item[0].icon_index, 168, 0)
  1664.         draw_extra_text("Gave you #{item[0].name} x#{item[1]}!", 0, 20)
  1665.       end
  1666.     when 12; draw_extra_text('Fuck that!', 0, 20)
  1667.     when 13; draw_extra_text('Cool down become instant!', 0, 20)  
  1668.     end
  1669.   end
  1670.  
  1671.   def draw_extra_text(text, x, y, color=nil)
  1672.     @mood_window.contents.font.color = color if !color.nil?
  1673.     @mood_window.draw_petname(0, -8)
  1674.     @mood_window.contents.font.size = 18
  1675.     @mood_window.contents.draw_text(x, y, @mood_window.width, 32, text)
  1676.   end
  1677.  
  1678.   def dispose_petpop_window
  1679.     return if @mood_window.nil?
  1680.     @mood_window.dispose
  1681.     @mood_window = nil
  1682.   end
  1683.  
  1684.   alias falcao_pet_update update
  1685.   def update
  1686.     if $game_player.petpop_refresh
  1687.       refresh_petpop_window
  1688.       $game_player.petpop_refresh = false
  1689.     end
  1690.     $game_player.showing_pet ? create_pet_sprite : dispose_pet_sprite
  1691.     $game_player.petpop_time > 0 ? create_petpop_window : dispose_petpop_window
  1692.     @pet_sprite.update unless @pet_sprite.nil?
  1693.     falcao_pet_update
  1694.   end
  1695.  
  1696.   def create_pet_sprite
  1697.     return if not @pet_sprite.nil?
  1698.     @pet_sprite = Sprite_Character.new(@viewport1, $game_player.gamepet)
  1699.   end
  1700.  
  1701.   def dispose_pet_sprite
  1702.     return if @pet_sprite.nil?
  1703.     @pet_sprite.dispose
  1704.     @pet_sprite = nil
  1705.   end
  1706. end
  1707.  
  1708. class Game_Event < Game_Character
  1709.   attr_accessor  :move_type
  1710.   attr_accessor  :target_index
  1711.   def check_evcom(comment)
  1712.     return false if @list.nil? or @list.size <= 0
  1713.     for item in @list
  1714.       if item.code == 108 or item.code == 408
  1715.         if item.parameters[0].include?(comment)
  1716.           return true
  1717.         end
  1718.       end
  1719.     end
  1720.     return false
  1721.   end
  1722.  
  1723.   def check_evvar(comment)
  1724.     return 0 if @list.nil? or @list.size <= 0
  1725.     for item in @list
  1726.       if item.code == 108 or item.code == 408
  1727.         if item.parameters[0] =~ /#{comment}[ ]?(\d+)?/
  1728.           return $1.to_i
  1729.         end
  1730.       end
  1731.     end
  1732.     return 0
  1733.   end
  1734.  
  1735.   def on_current_screen?
  1736.     px = ($game_map.display_x).truncate
  1737.     py = ($game_map.display_y).truncate
  1738.     distance_x = @x - px
  1739.     distance_y = @y - py
  1740.     return true if distance_x.between?(0, 16) and distance_y.between?(0, 12)
  1741.     return false
  1742.   end
  1743. end
  1744.  
  1745. # data manager
  1746. class << DataManager
  1747.   alias falcaopet_setup_new_game setup_new_game unless $@
  1748.   def setup_new_game
  1749.     falcaopet_setup_new_game
  1750.     $game_player.gamepet.moveto($data_system.start_x, $data_system.start_y)
  1751.   end
  1752. end
  1753.  
  1754. # Sprite character
  1755. class Sprite_Character < Sprite_Base
  1756.   alias falcaopet_zoom_update update
  1757.   def update
  1758.     self.zoom_x = @character.zoomfx_x
  1759.     self.zoom_y = @character.zoomfx_y
  1760.     self.angle = @character.anglefx
  1761.     falcaopet_zoom_update
  1762.   end
  1763.  
  1764.   alias falcaopet_update_pos update_position
  1765.   def update_position
  1766.     falcaopet_update_pos
  1767.     if @character.egrabbing
  1768.       self.x = $game_player.gamepet.screen_x
  1769.       self.y = $game_player.gamepet.screen_y - 14
  1770.       @character.x = $game_player.gamepet.x
  1771.       @character.y = $game_player.gamepet.y
  1772.       @character.set_direction($game_player.gamepet.direction) unless
  1773.       @character.direction_fix
  1774.       @character.move_speed = 6
  1775.       @character.move_type = 0
  1776.       @character.priority_type = 1
  1777.     end
  1778.   end
  1779. end
  1780.  
  1781. # get custom command data
  1782. class Game_Interpreter
  1783.   def pet
  1784.     return $game_player.gamepet
  1785.   end
  1786. end
  1787.  
  1788. # Game followers plugin, this fit the pet with followers members
  1789. class Game_Follower < Game_Character
  1790.   def chase_preceding_character
  1791.     unless moving?
  1792.       prechar = @preceding_character
  1793.       if $game_player.showing_pet
  1794.         if prechar.is_a?(Game_Player) and !prechar.followers.gathering? and
  1795.            !prechar.just_jumped and FalPet::YieldSpot
  1796.           sx = distance_x_from(prechar.x - prechar.adjustpxy[0])
  1797.           sy = distance_y_from(prechar.y - prechar.adjustpxy[1])
  1798.         else
  1799.           sx = distance_x_from(prechar.x) ; sy = distance_y_from(prechar.y)
  1800.         end
  1801.       else
  1802.         sx = distance_x_from(prechar.x) ; sy = distance_y_from(prechar.y)
  1803.       end
  1804.       if sx != 0 && sy != 0
  1805.         move_diagonal(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2)
  1806.       elsif sx != 0
  1807.         move_straight(sx > 0 ? 4 : 6)
  1808.       elsif sy != 0
  1809.         move_straight(sy > 0 ? 8 : 2)
  1810.       end
  1811.     end
  1812.   end
  1813. end
  1814.  
  1815. #===============================================================================
  1816. # * Scenes and Windows
  1817. #===============================================================================
  1818.  
  1819. # Window base new methods
  1820. class Window_Base < Window
  1821.   def draw_petmoodbar(x, y)
  1822.     contents.font.color = normal_color
  1823.     mood = $game_player.gamepet.mood
  1824.     max = $game_player.gamepet.grow_inflation[0]
  1825.     contents.fill_rect(x, y, 102, 10, Color.new(0, 0, 0))
  1826.     contents.fill_rect(x+1, y+1, 100 *mood / max, 4, Color.new(180, 225, 245))
  1827.     contents.fill_rect(x+1, y+5, 100 *mood / max, 4, Color.new(20, 160, 225))
  1828.     contents.font.size = 16
  1829.     contents.draw_text(x,y -24,self.width, 32, 'Mood: ' + mood.to_s + "/#{max}")
  1830.   end
  1831.  
  1832.   def draw_petname(x, y, a=0)
  1833.     contents.font.size = 18
  1834.     contents.font.color = normal_color
  1835.     lv = $game_player.gamepet.pet_level ; name = $game_player.gamepet.petname
  1836.     contents.draw_text(x, y, self.width, 32, name + " Lv #{lv}", a)
  1837.   end
  1838.  
  1839.   def draw_petgift(x, y)
  1840.     contents.fill_rect(x, y - 18, 106, 76, Color.new(0, 0, 0, 60))
  1841.     item = $game_player.gamepet.mood_item
  1842.     draw_icon(item.icon_index, x + 30, y - 3)
  1843.     contents.font.size = 15
  1844.     contents.font.color = normal_color
  1845.     contents.draw_text(x -2, y - 24, 90, 32, 'Gift', 1)
  1846.     contents.draw_text(x, y + 10, 90, 32, item.name, 1)
  1847.   end
  1848.  
  1849.   def draw_stealed_item(x, y)
  1850.     contents.fill_rect(x + 160, y - 21, 30, 30, Color.new(0, 0, 0, 60))
  1851.     contents.font.color = normal_color
  1852.     contents.font.size = 18
  1853.     item = $game_player.gamepet.stealed_item
  1854.     if item.is_a? Fixnum
  1855.       draw_icon(344, x + 163, y - 19)
  1856.       text = item.to_s + " #{Vocab::currency_unit}"
  1857.     else
  1858.       text = item.name
  1859.       draw_icon(item.icon_index, x + 163, y - 19)
  1860.     end
  1861.     contents.draw_text(x, y + 1, 200, 32, "Have stealed #{text}!")
  1862.   end
  1863. end
  1864.  
  1865. #-------------------------------------------------------------------------------
  1866. # Pets commands selectable
  1867. class Window_PetCommands < Window_Selectable
  1868.   def initialize(x=0, y=0, w=350, h=242) #192
  1869.     super(x, y + 76,  w, h)
  1870.     self.z = 101
  1871.     refresh
  1872.     self.index = 0
  1873.     activate if !busy?
  1874.   end
  1875.  
  1876.   def busy?
  1877.     return true if $game_player.gamepet.busy? || $game_player.in_airship? ||
  1878.     $game_player.in_boat? || $game_player.in_ship?
  1879.     return false
  1880.   end
  1881.  
  1882.   def item
  1883.     return @data[self.index]
  1884.   end
  1885.  
  1886.   def refresh
  1887.     self.contents.clear if self.contents != nil
  1888.     @data = []
  1889.     FalPet::Commands.sort.reverse.each do |id, command |
  1890.       next if id == 27
  1891.       @data.push(command) if id == 1 or id == 26
  1892.       @data.push(command) if $game_player.gamepet.unlock_command.include?(id)
  1893.       next if id == 26
  1894.       next unless id.between?(10, FalPet::Commands.keys.size)
  1895.       @data.push(command) if
  1896.       FalPet::Speciality[$game_player.gamepet.pet_id].include?(id)
  1897.     end
  1898.     @item_max = @data.size
  1899.     if @item_max > 0
  1900.       self.contents = Bitmap.new(width - 32, row_max * 26)
  1901.       for i in 0...@item_max
  1902.         draw_item(i)
  1903.       end
  1904.     end
  1905.   end
  1906.  
  1907.   def draw_item(index)
  1908.     item = @data[index]
  1909.     x, y = index % col_max * (145 + 32), index / col_max  * 24
  1910.     self.contents.font.size = 18
  1911.     draw_icon(item[2], x, y, !$game_player.gamepet.busy? )
  1912.     unless busy?
  1913.       cool_down(item[1]) > 0 ? self.contents.font.color = disable_color :
  1914.       self.contents.font.color = normal_color
  1915.     else
  1916.       self.contents.font.color = disable_color
  1917.     end
  1918.     self.contents.font.color = disable_color  if item[1] != 1 and
  1919.     !$game_player.showing_pet
  1920.     self.contents.draw_text(x + 24, y, 212, 32, item[0], 0)
  1921.   end
  1922.  
  1923.   def disable_color
  1924.     return Color.new(255, 255, 255, 128)
  1925.   end
  1926.  
  1927.   def cool_down(i)
  1928.     cd = $game_player.gamepet
  1929.     cooldown = 0
  1930.     FalPet::Commands.each do |id, cmd |
  1931.       cooldown = cd.cooldown[cmd[1]-1] if i == id and cd.cooldown[cmd[1] -1] > 0
  1932.     end
  1933.     return cooldown
  1934.   end
  1935.  
  1936.   def cool_data(i)
  1937.     data = [false, nil]
  1938.     FalPet::Commands.each do |id, cmd |
  1939.       data = [true, cmd[1] - 1] if i == id
  1940.     end
  1941.     return data
  1942.   end
  1943.  
  1944.   def item_max
  1945.     return @item_max.nil? ? 0 : @item_max
  1946.   end
  1947.  
  1948.   def col_max
  1949.     return 2
  1950.   end
  1951. end
  1952.  
  1953. #-------------------------------------------------------------------------------
  1954. # Scene pet commands
  1955. class Scene_PetCommands < Scene_Base
  1956.   def start
  1957.     super
  1958.     @pet = $game_player.gamepet
  1959.     x, y  = 544 / 2 - 350 / 2, 10
  1960.     @info_window = Window_Base.new(x, y, 350, 76)
  1961.     @color = Color.new(255, 120, 0, 255)
  1962.     @petCommand_window = Window_PetCommands.new(x, y)
  1963.     @mood_window = Window_Base.new(x, y + 76 + 242, 350, 76)
  1964.     @mood_window.draw_petmoodbar(0, 38)
  1965.     @mood_window.draw_petname(0, -8)
  1966.     @mood_window.draw_character(@pet.character_name,@pet.character_index,170,54)
  1967.     @mood_window.draw_petgift(236, 20)
  1968.     @background_sprite = Sprite.new
  1969.     @background_sprite.bitmap = SceneManager.background_bitmap
  1970.     @refresh_delay = 0
  1971.     refresh_info
  1972.   end
  1973.  
  1974.   def refresh_info
  1975.     @info_window.contents.clear
  1976.     @info_window.contents.font.size = 18
  1977.     @info_window.contents.font.color = @info_window.normal_color
  1978.     @petCommand_window.busy? ? text = 'Pet is busy...' :
  1979.     text = @petCommand_window.item[6]
  1980.     @info_window.contents.draw_text(- 10, 0,@info_window.width, 32, text, 1)
  1981.     action = @petCommand_window.item[9]
  1982.     mood = @petCommand_window.item[8]
  1983.     mood = '' if mood == 0
  1984.     @info_window.contents.draw_text(0, 28, @info_window.width, 32,
  1985.     'Type: ' + action + " #{mood}")
  1986.     cooldown > 0 ? operand = cooldown : operand = @petCommand_window.item[7] *60
  1987.     operand = @pet.instantcd if @pet.instantcd > 0
  1988.     total_sec = operand / Graphics.frame_rate
  1989.     cd = sprintf("%02d:%02d", total_sec / 60, total_sec % 60)
  1990.     if @pet.instantcd > 0
  1991.       text = "Instant!:  #{cd}"
  1992.       @info_window.contents.font.color = @color
  1993.     else
  1994.       text = "Cooldown:  #{cd}"
  1995.     end
  1996.     @info_window.contents.draw_text(-50, 28, 350, 32, text, 2)
  1997.   end
  1998.  
  1999.   def cooldown
  2000.     return @petCommand_window.cool_down(@petCommand_window.item[1])
  2001.   end
  2002.  
  2003.   def update
  2004.     super
  2005.     if Input.trigger?(:B)
  2006.       SceneManager.goto(Scene_Map)
  2007.       Sound.play_cancel
  2008.     end
  2009.     return if @petCommand_window.busy?
  2010.     update_refresh
  2011.     if Input.trigger?(:C)
  2012.       cmd = @petCommand_window
  2013.       if cmd.item[1] != 1
  2014.         if cooldown > 0 || !$game_player.showing_pet
  2015.           Sound.play_buzzer
  2016.           return
  2017.         end
  2018.       end
  2019.       Sound.play_ok
  2020.       if @petCommand_window.item[4]
  2021.         apply_cooldown(cmd)
  2022.         SceneManager.callp(Scene_Event, @petCommand_window.item[1])
  2023.       elsif @petCommand_window.item[5]
  2024.         apply_cooldown(cmd)
  2025.         SceneManager.goto(Scene_Pets)
  2026.       else
  2027.         apply_cooldown(cmd)
  2028.         @pet.command = @petCommand_window.item[1]
  2029.         @pet.action_time = @petCommand_window.item[3]
  2030.         if @pet.custom_command?
  2031.           @pet.action_time = @pet.action_time + 1 if (@pet.action_time%2 == 0)
  2032.         end
  2033.         @pet.jumpto(0) if @petCommand_window.item[1] == 1 and
  2034.         $game_player.showing_pet
  2035.         $game_player.petpop_time =0 if @pet.reservedmood > 0 and cmd.item[8] > 0
  2036.         @pet.reservedmood = cmd.item[8]
  2037.         SceneManager.goto(Scene_Map)
  2038.       end
  2039.     end
  2040.   end
  2041.  
  2042.   def update_refresh
  2043.     refresh_info if cooldown > 0 || @pet.instantcd > 0
  2044.     if @index != @petCommand_window.index
  2045.       @index = @petCommand_window.index
  2046.       refresh_info
  2047.     end
  2048.     @refresh_delay -= 1 if @refresh_delay > 0
  2049.     @refresh_delay = 2 if @pet.instantcd == 1
  2050.     if @refresh_delay == 1
  2051.       @petCommand_window.refresh
  2052.       refresh_info
  2053.     end
  2054.     for i in 0...@pet.cooldown.size
  2055.       if @pet.cooldown[i] == 1
  2056.         @refresh_delay = 2
  2057.       end
  2058.     end
  2059.   end
  2060.  
  2061.   def apply_cooldown(cmd)
  2062.     if cmd.cool_data(cmd.item[1])[0] and cmd.cool_down(cmd.item[1]) == 0
  2063.       index = cmd.cool_data(cmd.item[1])[1]
  2064.       @pet.cooldown[index] = @petCommand_window.item[7] * 60
  2065.     end
  2066.   end
  2067.  
  2068.   def terminate
  2069.     super
  2070.     @petCommand_window.dispose
  2071.     @background_sprite.dispose
  2072.     @info_window.dispose
  2073.   end
  2074. end
  2075.  
  2076. #-------------------------------------------------------------------------------
  2077. # Invisible window event selection
  2078. class Window_Event < Window_Selectable
  2079.   attr_reader   :participants
  2080.   def initialize(x=0, y=0, w=150, h=192)
  2081.     super(x, y,  w, h)
  2082.     self.z = 101
  2083.     @participants = []
  2084.     refresh
  2085.     self.index = 0
  2086.     self.visible = false
  2087.     activate
  2088.   end
  2089.  
  2090.   def item
  2091.     return @data[self.index]
  2092.   end
  2093.  
  2094.   def refresh
  2095.     self.contents.clear if self.contents != nil
  2096.     @data = []
  2097.     for event in $game_map.events.values
  2098.       if event.on_current_screen?
  2099.         next if event.tile_id == 0 and event.character_name == ""
  2100.         next if event.check_evcom("/IGNORE TARGETING")
  2101.         @data.push(event)
  2102.         event.target_index = @data.size - 1
  2103.         @participants.push(event)
  2104.       end
  2105.     end
  2106.     @item_max = @data.size
  2107.     if @item_max > 0
  2108.       self.contents = Bitmap.new(width - 32, row_max * 26)
  2109.       for i in 0...@item_max
  2110.         draw_item(i)
  2111.       end
  2112.     end
  2113.   end
  2114.  
  2115.   def draw_item(index)
  2116.     item = @data[index]
  2117.     x, y = index % col_max * (120 + 32), index / col_max  * 24
  2118.     self.contents.font.size = 16
  2119.     self.contents.draw_text(x + 24, y, 212, 32, item.id.to_s, 0)
  2120.   end
  2121.  
  2122.   def item_max
  2123.     return @item_max.nil? ? 0 : @item_max
  2124.   end
  2125.  
  2126.   def col_max
  2127.     return 1
  2128.   end
  2129. end
  2130.  
  2131. #-------------------------------------------------------------------------------
  2132. # Scenen events selection target
  2133. class Scene_Event < Scene_Base
  2134.   def initialize(command)
  2135.     @command = command
  2136.   end
  2137.  
  2138.   def start
  2139.     super
  2140.     @mouse_exist = defined?(Map_Buttons).is_a?(String)
  2141.     @event_window = Window_Event.new
  2142.     @info_window = Sprite.new
  2143.     @info_window.bitmap = Bitmap.new(300, 60)
  2144.     @info_window.z = 900; @info_window.x = 544/2 -200/2; @info_window.y = 180
  2145.     @info_window.bitmap.font.size = 28; @info_window.bitmap.font.bold = true
  2146.     @event_window.item.nil? ? t = 'No targets!' : t = 'Select target'
  2147.     @info_window.bitmap.draw_text(-30, 0, @info_window.width, 32, t, 1)
  2148.     @background_sprite = Sprite.new
  2149.     @background_sprite.bitmap = SceneManager.background_bitmap
  2150.     @info_time = 60
  2151.     create_cursor unless @event_window.item.nil?
  2152.   end
  2153.  
  2154.   def refresh_info(type)
  2155.     @info_window.bitmap.clear
  2156.     t = 'I cant climb that bich!' if type == 1
  2157.     t = 'Invalid Target!' if type == 2
  2158.     @info_window.bitmap.draw_text(-30, 0, @info_window.width, 32, t, 1)
  2159.   end
  2160.  
  2161.   def create_cursor
  2162.     if @mouse_exist
  2163.       @cursor = $mouse_cursor
  2164.       @cursor_zooming = 0 ; update_cursor_position
  2165.       return
  2166.     end
  2167.    
  2168.     @cursor = Sprite.new
  2169.     icon = FalPet::CursorIcon
  2170.     @cursor.bitmap = Bitmap.new(24, 24)
  2171.     bitmap = Cache.system("Iconset")
  2172.     rect = Rect.new(icon % 16 * 24, icon / 16 * 24, 24, 24)
  2173.     @cursor.bitmap.blt(0, 0, bitmap, rect)
  2174.     @cursor_zooming = 0
  2175.     update_cursor_position
  2176.   end
  2177.  
  2178.   def update
  2179.     super
  2180.     if Input.trigger?(:B)
  2181.       SceneManager.goto(Scene_PetCommands)
  2182.       Sound.play_cancel
  2183.     end
  2184.     @info_time -= 1 if @info_time > 0
  2185.     if @info_time == 0
  2186.       @info_window.opacity -= 8 if @info_window.opacity > 0
  2187.       if @info_window.opacity == 0 and @event_window.item.nil?
  2188.         Sound.play_cancel
  2189.         SceneManager.goto(Scene_PetCommands)
  2190.       end
  2191.     end
  2192.      
  2193.     return if @event_window.item.nil?
  2194.     update_cursor_position
  2195.     update_target_selection
  2196.   end
  2197.  
  2198.   # target selection
  2199.   def update_target_selection
  2200.     if Input.trigger?(:C)
  2201.       if @mouse_exist
  2202.         for event in @event_window.participants
  2203.           if Mouse.map_grid[0] == event.x and Mouse.map_grid[1] == event.y
  2204.             @event_window.select(event.target_index)
  2205.             @selected = true
  2206.           end
  2207.         end
  2208.         if @selected.nil?
  2209.           refresh_info(2)
  2210.           @info_time = 60; @info_window.opacity = 255
  2211.           Sound.play_buzzer
  2212.           return
  2213.         end
  2214.       end
  2215.       if @command == 13 and not @event_window.item.check_evcom("/PET CLIMB")
  2216.         refresh_info(1)
  2217.         @info_time = 60; @info_window.opacity = 255
  2218.         Sound.play_buzzer
  2219.         return
  2220.       end
  2221.       Sound.play_ok
  2222.       $game_player.gamepet.chase_event_id = @event_window.item.id
  2223.       $game_player.gamepet.command = @command
  2224.       SceneManager.goto(Scene_Map)
  2225.     end
  2226.   end
  2227.  
  2228.   def update_cursor_position
  2229.     if @mouse_exist
  2230.       @cursor.x = Mouse.pos[0]
  2231.       @cursor.y = Mouse.pos[1]
  2232.     else
  2233.       @cursor.x = @event_window.item.screen_x
  2234.       @cursor.y = @event_window.item.screen_y - 16
  2235.     end
  2236.     @cursor_zooming += 1
  2237.     case @cursor_zooming
  2238.     when 1..10 ; @cursor.zoom_x -= 0.01 ; @cursor.zoom_y -= 0.01
  2239.     when 11..20; @cursor.zoom_x += 0.01 ; @cursor.zoom_y += 0.01
  2240.     when 21..30; @cursor.zoom_x = 1.0   ; @cursor.zoom_y = 1.0
  2241.       @cursor_zooming = 0
  2242.     end
  2243.   end
  2244.  
  2245.   def terminate
  2246.     super
  2247.     @event_window.dispose
  2248.     @background_sprite.dispose
  2249.     @info_window.dispose
  2250.     @info_window.bitmap.dispose
  2251.     if @mouse_exist
  2252.       @cursor.zoom_x = 1.0   ; @cursor.zoom_y = 1.0 ; @selected = nil
  2253.     else
  2254.       @cursor.dispose unless @cursor.nil?
  2255.       @cursor.bitmap.dispose unless @cursor.nil?
  2256.     end
  2257.   end
  2258. end
  2259.  
  2260. #-------------------------------------------------------------------------------
  2261. # Window pets
  2262. class Window_Pets < Window_Selectable
  2263.   def initialize(shop)
  2264.     super(0, 0,  406, 122)
  2265.     self.z = 101
  2266.     @shop = shop
  2267.     refresh
  2268.     self.index = 0
  2269.     activate
  2270.   end
  2271.  
  2272.   def item
  2273.     return @data[self.index]
  2274.   end
  2275.  
  2276.   def refresh
  2277.     self.contents.clear if self.contents != nil
  2278.     @data = []
  2279.     FalPet::Pets.each do |id , pet|
  2280.       pet.push(id) unless pet.include?(id)
  2281.       @data.push(pet) if @shop
  2282.       @data.push(pet) if $game_player.adopted_pets.include?(id) and !@shop
  2283.     end
  2284.     @item_max = @data.size
  2285.     if @item_max > 0
  2286.       self.contents = Bitmap.new(width - 32, row_max * 26)
  2287.       for i in 0...@item_max
  2288.         draw_item(i)
  2289.       end
  2290.     end
  2291.   end
  2292.  
  2293.   def draw_item(index)
  2294.     item = @data[index]
  2295.     x, y = index % col_max * (107 + 32), index / col_max  * 24
  2296.     self.contents.font.size = 18
  2297.     self.contents.draw_text(x, y, 212, 32, item[2], 0)
  2298.   end
  2299.  
  2300.   def item_max
  2301.     return @item_max.nil? ? 0 : @item_max
  2302.   end
  2303.  
  2304.   def col_max
  2305.     return 3
  2306.   end
  2307. end
  2308.  
  2309. #-------------------------------------------------------------------------------
  2310. # Scene pets base, refered at pep shop and pets adopted
  2311. class Scene_PetsBase < Scene_Base
  2312.   def start
  2313.     super
  2314.     @pet = $game_player.gamepet
  2315.     SceneManager.scene_is?(Scene_PetShop) ? @shop = true : @shop = false
  2316.     @pet_window = Window_Pets.new(@shop)
  2317.     x, y = 544 / 2 -406 / 2, 0
  2318.     @pet_window.x = x
  2319.     @pet_window.y = y + 110
  2320.     @info_window = Window_Base.new(x, y, 406, 110)
  2321.     @bonus_window = Window_Base.new(x, y + 122 + 110, 406, 184)
  2322.     @background_sprite = Sprite.new
  2323.     @background_sprite.bitmap = SceneManager.background_bitmap
  2324.     refresh_infodata
  2325.   end
  2326.  
  2327.   def refresh_infodata
  2328.     @info_window.contents.clear
  2329.     @info_window.contents.font.size = 18
  2330.     @shop ? xy = [0, 0] : xy = [286, 0]
  2331.     @info_window.contents.fill_rect(xy[0], xy[1],90,76, Color.new(0,0,0,60))
  2332.     @info_window.draw_character(@pet_window.item[0],
  2333.     @pet_window.item[1], xy[0] + 45, xy[1] + 64)
  2334.     @info_window.draw_text(xy[0] + 20, xy[1] + 66, 350, 32, 'Pet id')
  2335.     create_price_info if @shop
  2336.     refresh_bonus
  2337.     return if @shop
  2338.     @info_window.contents.fill_rect(0, -18, 90, 90, Color.new(0, 0, 0, 60))
  2339.     @info_window.draw_text(0, 64, @info_window.width, 32, 'Current Pet')
  2340.     @info_window.draw_text(-16, 0, @info_window.width, 32, @pet.petname, 1)
  2341.     @info_window.draw_character(@pet.character_name,@pet.character_index,45,64)
  2342.   end
  2343.  
  2344.   def refresh_bonus
  2345.     @bonus_window.contents.clear
  2346.     @bonus_window.contents.font.size = 20
  2347.     y = 0; manager = 0
  2348.     @bonus_window.contents.font.color = Color.new(255, 120, 0, 255)
  2349.     @bonus_window.draw_text(40, -6, 406, 32, 'Pet Special Skills', 1)
  2350.     @bonus_window.draw_text(0, -6, 406, 32, 'Bonus')
  2351.     @bonus_window.contents.font.color = @bonus_window.normal_color
  2352.    
  2353.     # draw speciality
  2354.     @bonus_window.contents.font.size = 16
  2355.     enable = FalPet::Speciality[@pet_window.item[6]]
  2356.     FalPet::Commands.each do |id, command |
  2357.       if enable.include?(id)
  2358.         manager += 1
  2359.         (manager%2 == 0) ? x = 260 : y += 17
  2360.         x = 128 unless (manager%2 == 0)
  2361.         @bonus_window.draw_text(x, y, @bonus_window.width, 32, command[0])
  2362.       end
  2363.     end
  2364.    
  2365.     #draw bonus parameters
  2366.     bonus = FalPet::Bonus[@pet_window.item[6]]
  2367.     y = 0
  2368.     for i in 0...8
  2369.       y += 17
  2370.       @bonus_window.draw_text(0, y, 406, 32, Vocab.param(i))
  2371.       @bonus_window.draw_text(58, y, 406, 32, "=> #{bonus[i].to_s}")
  2372.     end
  2373.   end
  2374.  
  2375.   def create_price_info
  2376.     @info_window.contents.font.size = 22
  2377.     @info_window.draw_text(156, 0, @info_window.width, 32, 'Pet Shop')
  2378.     @info_window.contents.font.size = 18
  2379.     @info_window.draw_text(156, 32, 350, 32, "Name: #{@pet_window.item[2]}")
  2380.     v = pet_price
  2381.     @info_window.draw_text(156,64,350,18,"Price: $#{v} " + Vocab::currency_unit)
  2382.     @info_window.contents.fill_rect(320, -18, 62, 56, Color.new(0, 0, 0, 60))
  2383.     @info_window.draw_text(28, 0, 350, 18, $game_party.gold.to_s, 2)
  2384.     @info_window.draw_text(28, 18, 350, 18, Vocab::currency_unit, 2)
  2385.   end
  2386.  
  2387.   def pet_price
  2388.     return FalPet::Price[@pet_window.item[6]]
  2389.   end
  2390.  
  2391.   def terminate
  2392.     super
  2393.     @bonus_window.dispose
  2394.     @background_sprite.dispose
  2395.     @info_window.dispose
  2396.     @pet_window.dispose
  2397.   end
  2398. end
  2399.  
  2400. #-------------------------------------------------------------------------------
  2401. # Scene pet adopted
  2402. class Scene_Pets < Scene_PetsBase
  2403.  
  2404.   def start() super end
  2405.   def update
  2406.     super
  2407.     if Input.trigger?(:B)
  2408.       SceneManager.goto(Scene_PetCommands)
  2409.       Sound.play_cancel
  2410.     end
  2411.     if @index != @pet_window.index
  2412.       @index = @pet_window.index
  2413.       refresh_infodata
  2414.     end
  2415.     if Input.trigger?(:C)
  2416.       @pet.setup_pet(@pet_window.item[6])
  2417.       refresh_infodata    
  2418.     end
  2419.   end
  2420. end
  2421.  
  2422. #-------------------------------------------------------------------------------
  2423. # Scene pet shop
  2424.  
  2425. class Scene_PetShop < Scene_PetsBase
  2426.  
  2427.   def start
  2428.     super
  2429.     @pop_window = Window_Base.new(200, 170, 150, 110)
  2430.     @pop_window.z = 500
  2431.     @pop_time = 0
  2432.     @pop_window.visible = false
  2433.   end
  2434.  
  2435.   def refresh_pop(type)
  2436.     @pop_window.contents.clear
  2437.     @pop_window.contents.font.size = 18
  2438.     case type
  2439.     when 1
  2440.       @pop_window.draw_text(0, 0, @pop_window.width, 32, "You have buyed!")
  2441.       @pop_window.draw_text(0, 22, @pop_window.width, 32, @pet_window.item[2])
  2442.       @pop_window.draw_text(0, 44, @pop_window.width, 32,
  2443.       Vocab::currency_unit + " -#{pet_price}")
  2444.     when 2
  2445.       @pop_window.draw_text(0, 0, 200, 32, "You dont have")
  2446.       @pop_window.draw_text(0, 22, 200, 32, "enough #{Vocab::currency_unit}")
  2447.     when 3
  2448.       @pop_window.draw_text(0, 0, @pop_window.width, 32, "You already owned!")
  2449.       @pop_window.draw_text(0, 22, @pop_window.width, 32, @pet_window.item[2])
  2450.     end
  2451.   end
  2452.  
  2453.   def update
  2454.     super
  2455.     if Input.trigger?(:B)
  2456.       SceneManager.goto(Scene_Map)
  2457.       Sound.play_cancel
  2458.     end
  2459.     if @index != @pet_window.index
  2460.       @index = @pet_window.index
  2461.       refresh_infodata
  2462.     end
  2463.     update_buying
  2464.   end
  2465.  
  2466.   def update_buying
  2467.     @pop_time -= 1 if @pop_time > 0
  2468.     @pop_time > 0 ? @pop_window.visible = true : @pop_window.visible = false
  2469.     if Input.trigger?(:C)
  2470.       if $game_player.adopted_pets.include?(@pet_window.item[6])
  2471.         refresh_pop(3)
  2472.         @pop_time = 2 * 60
  2473.         Sound.play_cancel
  2474.         return
  2475.       end
  2476.       if $game_party.gold >= pet_price
  2477.         $game_party.lose_gold(pet_price)
  2478.         RPG::SE.new("Shop", 80,).play
  2479.         $game_player.adopt_pet(@pet_window.item[6])
  2480.         refresh_infodata
  2481.         refresh_pop(1)
  2482.         @pop_time = 2 * 60
  2483.       else
  2484.         refresh_pop(2)
  2485.         @pop_time = 2 * 60
  2486.         Sound.play_buzzer
  2487.       end
  2488.     end
  2489.   end
  2490.  
  2491.   def terminate
  2492.     super
  2493.     @pop_window.dispose
  2494.   end
  2495. end
  2496.  
  2497. #-------------------------------------------------------------------------------
  2498.  
  2499. # update global cool down
  2500. class << Input
  2501.   unless self.method_defined?(:falcaopet_ccd_update)
  2502.     alias_method :falcaopet_ccd_update,   :update
  2503.   end
  2504.  
  2505.   def update
  2506.     update_cooldown_system
  2507.     falcaopet_ccd_update
  2508.   end
  2509.  
  2510.   def update_cooldown_system
  2511.     player = $game_player
  2512.     unless player.nil?
  2513.       player.gamepet.instantcd -= 1 if player.gamepet.instantcd > 0
  2514.       for i in 0...player.gamepet.cooldown.size
  2515.         if player.gamepet.cooldown[i] > 0 and player.gamepet.instantcd > 0    
  2516.           player.gamepet.cooldown[i] = 0 if not i == 19 - 1
  2517.         end
  2518.         player.gamepet.cooldown[i] -= 1 if player.gamepet.cooldown[i] > 0
  2519.       end
  2520.     end
  2521.   end
  2522. end
  2523.  
  2524. module SceneManager
  2525.   def self.callp(scene_class, *args)
  2526.     @scene = scene_class.new(*args)
  2527.   end
  2528. end
  2529.  
  2530. #-------------------------------------------------------------------------------
  2531. # FA Interactive System 2.0 pet plug-ins
  2532.  
  2533. class Game_Player < Game_Character
  2534.   if defined?(FalInt).is_a?(String)
  2535.     alias falcaopetplugins_fall player_start_falling
  2536.     def player_start_falling
  2537.       @showing_pet = false
  2538.       $game_system.replay_bgm if @gamepet.command == 8 ; globalpet_reset
  2539.       falcaopetplugins_fall
  2540.     end
  2541.   end
  2542. end
  2543.  
  2544. class Game_CharacterBase
  2545.   if defined?(FalInt).is_a?(String)
  2546.     alias falcaopetplugins_start_jump start_jump
  2547.     def start_jump(power)
  2548.       player = self.is_a?(Game_Player)
  2549.       if player and Input.dir4 != 0
  2550.         self.followers.reverse_each {|f| f.move_toward_player }
  2551.         self.gamepet.move_toward_player ; self.gamepet.move_toward_player
  2552.         self.gamepet.jump(0,  power)  if @direction == 2
  2553.         self.gamepet.jump(- power, 0) if @direction == 4
  2554.         self.gamepet.jump(power,  0)  if @direction == 6
  2555.         self.gamepet.jump(0, - power) if @direction == 8
  2556.         self.just_jumped = true
  2557.       end
  2558.       falcaopetplugins_start_jump(power)
  2559.     end
  2560.   end
  2561. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement