khanhdu

scripts pet robot

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